Minor clean-up and documentation comments

This commit is contained in:
Hrvoje Jasak 2015-06-26 19:30:41 +01:00
parent 079b436c58
commit 49cd83ac5d
25 changed files with 134 additions and 92 deletions

View file

@ -52,7 +52,7 @@ Foam::IPstream::IPstream
MPI_Status status;
// If the buffer size is not specified, probe the incomming message
// If the buffer size is not specified, probe the incoming message
// and set it
if (!bufSize)
{
@ -108,7 +108,7 @@ Foam::label Foam::IPstream::read
(
"IPstream::read"
"(const int fromProcNo, char* buf, std::streamsize bufSize)"
) << "MPI_Recv cannot receive incomming message"
) << "MPI_Recv cannot receive incoming message"
<< Foam::abort(FatalError);
return 0;
@ -127,7 +127,7 @@ Foam::label Foam::IPstream::read
"IPstream::read"
"(const int fromProcNo, char* buf, std::streamsize bufSize)"
) << "buffer (" << label(bufSize)
<< ") not large enough for incomming message ("
<< ") not large enough for incoming message ("
<< messageSize << ')'
<< Foam::abort(FatalError);
}
@ -232,6 +232,4 @@ bool Foam::IPstream::finishedRequest(const label i)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View file

@ -172,6 +172,4 @@ bool Foam::OPstream::finishedRequest(const label i)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View file

@ -175,7 +175,8 @@ private:
mutable labelList* slavePointPointHitsPtr_;
//- Slave edge hit. The index of master edge hit by the
// slave point in projection. For point or no edge hit, set to -1
// slave point in projection.
// For point or no edge hit, set to -1
mutable labelList* slavePointEdgeHitsPtr_;
//- Slave face hit. The index of master face hit by the

View file

@ -93,7 +93,7 @@ public:
//- Bounding box of this node
treeBoundBox bb_;
//- parent node (index into nodes_ of tree)
//- Parent node (index into nodes_ of tree)
label parent_;
//- IDs of the 8 nodes on all sides of the mid point
@ -165,8 +165,8 @@ private:
// Construction
//- Split list of indices into 8 bins according to where they are in
// relation to mid.
//- Split list of indices into 8 bins according to where they are
// in relation to mid.
void divide
(
const labelList& indices,
@ -376,6 +376,8 @@ private:
public:
// Static functions
//- Get the perturbation tolerance
static scalar& perturbTol();

View file

@ -25,11 +25,12 @@ Class
Foam::PointIndexHit
Description
This class describes the interaction of (usually) a face and a point.
This class describes the interaction of a shape (edge, face, cell)
and a point.
It carries the info of a successful hit and (if successful),
returns the interaction point.
like pointHit but carries face (or cell, edge etc.) index
Works like pointHit but carries face (or cell, edge etc.) index
SourceFiles

View file

@ -140,7 +140,8 @@ class octree
const treeBoundBox octreeBb_;
//- Refinement crit: size of leaves. Average number of entries per
// leaf. Should be fine enough for efficient searching at lowest level.
// leaf. Should be fine enough for efficient searching
// at lowest level.
const scalar maxLeafRatio_;
//- Refinement crit: multiplicity of entries (so in how many leaves
@ -165,7 +166,8 @@ class octree
// Static data members
//- Refinement crit: max number of level
//- Refinement criterion max number of level
static const label maxNLevels = 20;
@ -325,8 +327,8 @@ public:
//- Find nearest to line. Returns -1 or index of shape and
// sets:
// - tightest (is both input and output).
// - linePoint : point on line (-GREAT,-GREAT,-GREAT if not found)
// - shapePoint : point on shape (GREAT, GREAT, GREAT if not found)
// - linePoint: point on line (-GREAT,-GREAT,-GREAT if not found)
// - shapePoint: point on shape (GREAT, GREAT, GREAT if not found)
// Uses Type::calcNearest.
label findNearest
(

View file

@ -55,7 +55,10 @@ class IPstream
{
// Private data
//- ID of sending processor
int fromProcNo_;
//- Message size
label messageSize_;
@ -76,14 +79,14 @@ public:
// Constructors
//- Construct given process index to read from and optional buffer size,
//- Construct given process index to read from, optional buffer size,
// read format and IO version
IPstream
(
const commsTypes commsType,
const int fromProcNo,
const label bufSize = 0,
streamFormat format=BINARY,
streamFormat format = BINARY,
versionNumber version = currentVersion
);

View file

@ -55,6 +55,7 @@ class OPstream
{
// Private data
// ID of receiving processor
int toProcNo_;
@ -68,7 +69,12 @@ class OPstream
inline void writeToBuffer(const char&);
//- Write data to the transfer buffer
inline void writeToBuffer(const void* data, size_t count, size_t align);
inline void writeToBuffer
(
const void* data,
size_t count,
size_t align
);
public:
@ -82,7 +88,7 @@ public:
const commsTypes commsType,
const int toProcNo,
const label bufSize = 0,
streamFormat format=BINARY,
streamFormat format = BINARY,
versionNumber version = currentVersion
);
@ -140,7 +146,7 @@ public:
Ostream& writeQuoted
(
const std::string&,
const bool quoted=true
const bool quoted = true
);
//- Write label

View file

@ -269,9 +269,9 @@ const Foam::debug::optimisationSwitch
Foam::Pstream::defaultCommsType
(
"commsType",
"nonBlocking",
// "nonBlocking",
// "scheduled",
// "blocking",
"blocking",
"blocking, nonBlocking, scheduled"
);

View file

@ -373,7 +373,8 @@ public:
template <class T, class BinaryOp>
static void gather(T& Value, const BinaryOp& bop);
//- Scatter data. Distribute without modification. Reverse of gather
//- Scatter data. Distribute without modification.
// Reverse of gather
template <class T>
static void scatter(const List<commsStruct>& comms, T& Value);
@ -421,7 +422,11 @@ public:
//- Like above but switches between linear/tree communication
template <class T, class CombineOp>
static void listCombineGather(List<T>& Value, const CombineOp& cop);
static void listCombineGather
(
List<T>& Value,
const CombineOp& cop
);
//- Scatter data. Reverse of combineGather
template <class T>

View file

@ -547,8 +547,6 @@ void Pstream::mapCombineScatter(Container& Values)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View file

@ -99,7 +99,7 @@ void Pstream::gatherList
IPstream fromBelow(Pstream::scheduled, belowID);
fromBelow >> Values[belowID];
if (debug & 2)
if (debug > 1)
{
Pout<< " received through "
<< belowID << " data from:" << belowID
@ -112,7 +112,7 @@ void Pstream::gatherList
label leafID = belowLeaves[leafI];
fromBelow >> Values[leafID];
if (debug & 2)
if (debug > 1)
{
Pout<< " received through "
<< belowID << " data from:" << leafID
@ -129,11 +129,11 @@ void Pstream::gatherList
{
const labelList& belowLeaves = myComm.allBelow();
if (debug & 2)
if (debug > 1)
{
Pout<< " sending to " << myComm.above()
<< " data from me:" << Pstream::myProcNo()
<< " data:" << Values[Pstream::myProcNo()] << endl;
<< " data from: " << Pstream::myProcNo()
<< " data: " << Values[Pstream::myProcNo()] << endl;
}
if (contiguous<T>())
@ -163,11 +163,11 @@ void Pstream::gatherList
{
label leafID = belowLeaves[leafI];
if (debug & 2)
if (debug > 1)
{
Pout<< " sending to "
<< myComm.above() << " data from:" << leafID
<< " data:" << Values[leafID] << endl;
<< myComm.above() << " data from: " << leafID
<< " data: " << Values[leafID] << endl;
}
toAbove << Values[leafID];
}

View file

@ -69,7 +69,6 @@ class error
public std::exception,
public messageStream
{
protected:
// Protected data
@ -83,6 +82,7 @@ protected:
bool throwExceptions_;
OStringStream* messageStreamPtr_;
public:
// Constructors

View file

@ -38,6 +38,7 @@ Foam::regIOobject::fileModificationSkew
30
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from IOobject

View file

@ -235,7 +235,7 @@ Foam::argList::argList
regroupArgv(argc, argv);
// Get executable name
args_[0] = fileName(argv[0]);
args_[0] = fileName(argv[0]);
executable_ = fileName(argv[0]).name();
// Check arguments and options, we already have argv[0]
@ -420,12 +420,12 @@ Foam::argList::argList
fileNameList roots;
decompDict.lookup("roots") >> roots;
if (roots.size() != Pstream::nProcs()-1)
if (roots.size() != Pstream::nProcs() - 1)
{
FatalError
<< "number of entries in decompositionDict::roots"
<< " is not equal to the number of slaves "
<< Pstream::nProcs()-1
<< Pstream::nProcs() - 1
<< exit(FatalError);
}
@ -433,8 +433,8 @@ Foam::argList::argList
bool hadCaseOpt = options_.found("case");
for
(
int slave=Pstream::firstSlave();
slave<=Pstream::lastSlave();
int slave = Pstream::firstSlave();
slave <= Pstream::lastSlave();
slave++
)
{
@ -486,8 +486,8 @@ Foam::argList::argList
// Distribute the master's argument list (unaltered)
for
(
int slave=Pstream::firstSlave();
slave<=Pstream::lastSlave();
int slave = Pstream::firstSlave();
slave <= Pstream::lastSlave();
slave++
)
{
@ -599,14 +599,14 @@ Foam::argList::argList
if (Pstream::master())
{
slaveProcs.setSize(Pstream::nProcs() - 1);
word slaveMachine;
word slaveMachine;
label slavePid;
label procI = 0;
for
(
int slave=Pstream::firstSlave();
slave<=Pstream::lastSlave();
int slave = Pstream::firstSlave();
slave <= Pstream::lastSlave();
slave++
)
{
@ -731,12 +731,12 @@ void Foam::argList::printUsage() const
}
keyValuePair<< ']';
sortedValidOptions[i]= keyValuePair.str();
sortedValidOptions[i]= keyValuePair.str();
}
sortedValidOptions.sort();
forAll (sortedValidOptions, sI)
Info << " " << sortedValidOptions[sI].c_str();
Info<< " " << sortedValidOptions[sI].c_str();
// place help/doc/srcDoc options of the way at the end,
// but with an extra space to separate it a little

View file

@ -32,6 +32,7 @@ Description
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "foamVersion.H"
const char* const Foam::FOAMversion = "VERSION_STRING";

View file

@ -62,7 +62,7 @@ IOPatchToPatchInterpolation<FromPatch, ToPatch>::IOPatchToPatchInterpolation
labelList* faPtr = new labelList(is);
FieldField<Field, scalar>* fwPtr = new FieldField<Field, scalar>(is);
scalarField* fdPtr = new scalarField(is);
Info << "Setting weights from file" << endl;
Info<< "Setting weights from file" << endl;
this->setWeights(paPtr, pwPtr, pdPtr, faPtr, fwPtr, fdPtr);
}
}

View file

@ -1248,7 +1248,10 @@ void Foam::immersedBoundaryFvPatch::makeIbCellCells() const
labelList procIbCells = procIbCellsSet.toc();
sort(procIbCells);
// Send and receive num of immersed boundary cells
// Note: consider more sophisticated gather-scatter
// HJ, 18/Jun/2015
// Send and receive number of immersed boundary cells
// next to processor boundaries
for (label procI = 0; procI < Pstream::nProcs(); procI++)
{

View file

@ -97,7 +97,10 @@ bool Foam::meshSearch::findNearer
// tree based searching
Foam::label Foam::meshSearch::findNearestCellTree(const point& location) const
Foam::label Foam::meshSearch::findNearestCellTree
(
const point& location
) const
{
const indexedOctree<treeDataPoint>& tree = cellCentreTree();
@ -109,12 +112,17 @@ Foam::label Foam::meshSearch::findNearestCellTree(const point& location) const
{
info = tree.findNearest(location, Foam::sqr(GREAT));
}
return info.index();
}
// linear searching
Foam::label Foam::meshSearch::findNearestCellLinear(const point& location) const
Foam::label
Foam::meshSearch::findNearestCellLinear
(
const point& location
) const
{
const vectorField& centres = mesh_.cellCentres();

View file

@ -269,7 +269,10 @@ public:
//- WIP. From a set of hits (points and
// indices) get the specified field. Misses do not get set.
virtual void getField(const List<pointIndexHit>&, labelList&) const;
virtual void getField
(
const List<pointIndexHit>&, labelList&
) const;
// regIOobject implementation
@ -277,6 +280,7 @@ public:
bool writeData(Ostream&) const
{
notImplemented("triSurfaceMesh::writeData(Ostream&) const");
return false;
}
@ -287,7 +291,6 @@ public:
IOstream::versionNumber ver,
IOstream::compressionType cmp
) const;
};

View file

@ -68,13 +68,13 @@ class triSurfaceSearch
// Private Member Functions
//- Disallow default bitwise copy construct
triSurfaceSearch(const triSurfaceSearch&);
//- Disallow default bitwise assignment
void operator=(const triSurfaceSearch&);
public:
// Static data members
@ -86,8 +86,7 @@ public:
// Constructors
//- Construct from surface. Holds reference to surface!
triSurfaceSearch(const triSurface&);
explicit triSurfaceSearch(const triSurface&);
// Member Functions

View file

@ -32,6 +32,11 @@ License
#include "HashTable.H"
#include "word.H"
template<>
Foam::surfaceWriter<bool>::wordConstructorTable*
Foam::surfaceWriter<bool>::wordConstructorTablePtr_;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class Type>

View file

@ -52,6 +52,7 @@ class labelledTri
{
// Private data
//- Region ID
label region_;

View file

@ -50,7 +50,7 @@ Foam::fileName Foam::triSurface::triSurfInstance(const Time& d)
instantList ts = d.times();
label i;
for (i=ts.size()-1; i>=0; i--)
for (i = ts.size() - 1; i >= 0; i--)
{
if (ts[i].value() <= d.timeOutputValue())
{
@ -61,9 +61,9 @@ Foam::fileName Foam::triSurface::triSurfInstance(const Time& d)
// Noting that the current directory has already been searched
// for mesh data, start searching from the previously stored time directory
if (i>=0)
if (i >= 0)
{
for (label j=i; j>=0; j--)
for (label j = i; j >= 0; j--)
{
if (isFile(d.path()/ts[j].name()/typeName/foamName))
{
@ -86,7 +86,8 @@ Foam::fileName Foam::triSurface::triSurfInstance(const Time& d)
<< "reading " << foamName
<< " from constant/" << endl;
}
return "constant";
return d.constant();
}
@ -98,7 +99,7 @@ Foam::List<Foam::labelledTri> Foam::triSurface::convertToTri
{
List<labelledTri> triFaces(faces.size());
forAll(triFaces, faceI)
forAll (triFaces, faceI)
{
const face& f = faces[faceI];
@ -133,7 +134,7 @@ Foam::List<Foam::labelledTri> Foam::triSurface::convertToTri
{
List<labelledTri> triFaces(faces.size());
forAll(triFaces, faceI)
forAll (triFaces, faceI)
{
const triFace& f = faces[faceI];
@ -159,8 +160,7 @@ void Foam::triSurface::printTriangle
const pointField& points
)
{
os
<< pre.c_str() << "vertex numbers:"
os << pre.c_str() << "vertex numbers:"
<< f[0] << ' ' << f[1] << ' ' << f[2] << endl
<< pre.c_str() << "vertex coords :"
<< points[f[0]] << ' ' << points[f[1]] << ' ' << points[f[2]]
@ -188,7 +188,7 @@ void Foam::triSurface::checkTriangles(const bool verbose)
// Simple check on indices ok.
const label maxPointI = points().size() - 1;
forAll(*this, faceI)
forAll (*this, faceI)
{
const labelledTri& f = (*this)[faceI];
@ -218,7 +218,7 @@ void Foam::triSurface::checkTriangles(const bool verbose)
const labelListList& fFaces = faceFaces();
forAll(*this, faceI)
forAll (*this, faceI)
{
const labelledTri& f = (*this)[faceI];
@ -240,12 +240,12 @@ void Foam::triSurface::checkTriangles(const bool verbose)
}
else
{
// duplicate triangle check
// Duplicate triangle check
const labelList& neighbours = fFaces[faceI];
// Check if faceNeighbours use same points as this face.
// Note: discards normal information - sides of baffle are merged.
forAll(neighbours, neighbourI)
forAll (neighbours, neighbourI)
{
if (neighbours[neighbourI] <= faceI)
{
@ -291,7 +291,7 @@ void Foam::triSurface::checkTriangles(const bool verbose)
{
// Pack
label newFaceI = 0;
forAll(*this, faceI)
forAll (*this, faceI)
{
if (valid[faceI])
{
@ -321,7 +321,7 @@ void Foam::triSurface::checkEdges(const bool verbose)
{
const labelListList& eFaces = edgeFaces();
forAll(eFaces, edgeI)
forAll (eFaces, edgeI)
{
const labelList& myFaces = eFaces[edgeI];
@ -503,7 +503,7 @@ Foam::surfacePatchList Foam::triSurface::calcPatches(labelList& faceMap) const
// Sort according to region numbers of labelledTri
SortableList<label> sortedRegion(size());
forAll(sortedRegion, faceI)
forAll (sortedRegion, faceI)
{
sortedRegion[faceI] = operator[](faceI).region();
}
@ -527,7 +527,7 @@ Foam::surfacePatchList Foam::triSurface::calcPatches(labelList& faceMap) const
surfacePatchList newPatches(maxRegion + 1);
// Fill patch sizes
forAll(*this, faceI)
forAll (*this, faceI)
{
label region = operator[](faceI).region();
@ -538,7 +538,7 @@ Foam::surfacePatchList Foam::triSurface::calcPatches(labelList& faceMap) const
// Fill rest of patch info
label startFaceI = 0;
forAll(newPatches, newPatchI)
forAll (newPatches, newPatchI)
{
surfacePatch& newPatch = newPatches[newPatchI];
@ -551,7 +551,11 @@ Foam::surfacePatchList Foam::triSurface::calcPatches(labelList& faceMap) const
// Take over any information from existing patches
if ((oldPatchI < patches_.size()) && (patches_[oldPatchI].name() != ""))
if
(
(oldPatchI < patches_.size())
&& (patches_[oldPatchI].name() != "")
)
{
newPatch.name() = patches_[oldPatchI].name();
}
@ -590,7 +594,7 @@ void Foam::triSurface::setDefaultPatches()
// Take over names and types (but not size)
patches_.setSize(newPatches.size());
forAll(newPatches, patchI)
forAll (newPatches, patchI)
{
patches_[patchI].index() = patchI;
patches_[patchI].name() = newPatches[patchI].name();
@ -845,13 +849,13 @@ void Foam::triSurface::markZone
// Pick up neighbours of changedFaces
DynamicList<label> newChangedFaces(2*changedFaces.size());
forAll(changedFaces, i)
forAll (changedFaces, i)
{
label faceI = changedFaces[i];
const labelList& fEdges = faceEdges()[faceI];
forAll(fEdges, i)
forAll (fEdges, i)
{
label edgeI = fEdges[i];
@ -859,7 +863,7 @@ void Foam::triSurface::markZone
{
const labelList& eFaces = edgeFaces()[edgeI];
forAll(eFaces, j)
forAll (eFaces, j)
{
label nbrFaceI = eFaces[j];
@ -965,7 +969,7 @@ void Foam::triSurface::subsetMeshMap
boolList pointHad(nPoints(), false);
forAll(include, oldFacei)
forAll (include, oldFacei)
{
if (include[oldFacei])
{
@ -1022,7 +1026,7 @@ Foam::triSurface Foam::triSurface::subsetMesh
// Create compact coordinate list and forward mapping array
pointField newPoints(pointMap.size());
labelList oldToNew(locPoints.size());
forAll(pointMap, pointi)
forAll (pointMap, pointi)
{
newPoints[pointi] = locPoints[pointMap[pointi]];
oldToNew[pointMap[pointi]] = pointi;
@ -1031,7 +1035,7 @@ Foam::triSurface Foam::triSurface::subsetMesh
// Renumber triangle node labels and compact
List<labelledTri> newTriangles(faceMap.size());
forAll(faceMap, facei)
forAll (faceMap, facei)
{
// Get old vertex labels
const labelledTri& tri = locFaces[faceMap[facei]];
@ -1091,11 +1095,11 @@ void Foam::triSurface::writeStats(Ostream& os) const
label nPoints = 0;
boundBox bb = boundBox::invertedBox;
forAll(*this, triI)
forAll (*this, triI)
{
const labelledTri& f = operator[](triI);
forAll(f, fp)
forAll (f, fp)
{
label pointI = f[fp];
if (pointIsUsed.set(pointI, 1))

View file

@ -192,7 +192,7 @@ class triSurface
const label defaultRegion = 0
);
//- helper function to print triangle info
//- Helper function to print triangle info
static void printTriangle
(
Ostream&,
@ -282,15 +282,16 @@ public:
triSurface(const triSurface&);
// Destructor
~triSurface();
~triSurface();
//- Clear all data
void clearOut();
//- Clear topology
void clearTopology();
//- Clear patch addressing
void clearPatchMeshAddr();
@ -320,6 +321,7 @@ public:
// If >2 neighbours: undetermined.
const labelList& edgeOwner() const;
// Edit
//- Move points
@ -329,13 +331,13 @@ public:
virtual void scalePoints(const scalar&);
//- Check/remove duplicate/degenerate triangles
void checkTriangles(const bool verbose);
void checkTriangles(const bool verbose = false);
//- Check triply (or more) connected edges.
void checkEdges(const bool verbose);
void checkEdges(const bool verbose = false);
//- Remove non-valid triangles
void cleanup(const bool verbose);
void cleanup(const bool verbose = false);
//- Fill faceZone with currentZone for every face reachable
// from faceI without crossing edge marked in borderEdge.
@ -377,6 +379,7 @@ public:
labelList& faceMap
) const;
// Write
//- Write to Ostream in simple FOAM format