Go to the documentation of this file.
53 Info <<
"Creating polyMesh from octree" <<
endl;
72 leafCellLabel[leafI] = nCells++;
82 cells.setSize(nCells);
94 std::map<label, labelLongList> procFaces;
98 const label own = owner[faceI];
99 const label nei = neighbour[faceI];
101 const label ownLabel = leafCellLabel[own];
104 neiLabel = leafCellLabel[nei];
106 if( (ownLabel != -1) && (neiLabel != -1) )
109 ++nFacesInCell[ownLabel];
110 ++nFacesInCell[neiLabel];
112 else if( ownLabel != -1 )
115 ++nFacesInCell[ownLabel];
121 procFaces[procNo].append(faceI);
124 else if( neiLabel != -1 )
127 ++nFacesInCell[neiLabel];
133 procFaces[procNo].append(faceI);
141 cells[cI].setSize(nFacesInCell[cI]);
151 procBoundaries.
setSize(procFaces.size());
152 std::ostringstream ss;
154 const word name(
"processor"+ss.str()+
"to");
155 label nProcBoundaries(nFaces), patchI(0);
158 std::map<label, labelLongList>::const_iterator iter;
159 for(iter=procFaces.begin();iter!=procFaces.end();++iter)
161 const label procI = iter->first;
163 std::ostringstream ssNei;
179 nProcBoundaries -= iter->second.size();
186 for(iter=procFaces.begin();iter!=procFaces.end();++iter)
188 procBoundaries[patchI].patchStart() = nProcBoundaries;
195 const label own = owner[fLabel];
196 const label nei = neighbour[fLabel];
198 const label curCell = leafCellLabel[own];
201 neiCell = leafCellLabel[nei];
207 faces[nProcBoundaries].
setSize(octreeFaces[fLabel].size());
209 faces[nProcBoundaries][pI] = octreeFaces(fLabel, pI);
210 cells[curCell][nFacesInCell[curCell]++] = nProcBoundaries++;
212 else if( curCell == -1 )
215 faces[nProcBoundaries].
setSize(octreeFaces[fLabel].size());
217 faces[nProcBoundaries][i++] = octreeFaces(fLabel, 0);
219 faces[nProcBoundaries][i++] = octreeFaces(fLabel, pI);
220 cells[neiCell][nFacesInCell[neiCell]++] = nProcBoundaries++;
226 "void cartesianMeshExtractor::createPolyMesh()"
227 ) <<
"Face " << octreeFaces[fLabel] <<
" causes problems!"
232 if( procBoundaries[patchI].patchSize() !=
233 (nProcBoundaries - procBoundaries[patchI].patchStart())
237 "cartesianMeshExtractor::createPolyMesh()"
247 forAll(octreeFaces, faceI)
249 const label own = owner[faceI];
250 const label nei = neighbour[faceI];
252 const label ownLabel = leafCellLabel[own];
255 neiLabel = leafCellLabel[nei];
257 if( (ownLabel != -1) && (neiLabel != -1) )
262 faces[nFaces][pI] = octreeFaces(faceI, pI);
264 cells[ownLabel][nFacesInCell[ownLabel]++] = nFaces;
265 cells[neiLabel][nFacesInCell[neiLabel]++] = nFaces;
268 else if( ownLabel != -1 )
279 faces[nFaces][pI] = octreeFaces(faceI, pI);
281 cells[ownLabel][nFacesInCell[ownLabel]++] = nFaces;
284 else if( neiLabel != -1 )
294 faces[nFaces][0] = octreeFaces(faceI, 0);
296 faces[nFaces][octreeFaces.
sizeOfRow(faceI)-pI] =
297 octreeFaces(faceI, pI);
299 cells[neiLabel][nFacesInCell[neiLabel]++] = nFaces;
305 label nProcBoundaries(0);
306 forAll(procBoundaries, patchI)
307 nProcBoundaries += procBoundaries[patchI].patchSize();
309 if( faces.
size() != (nProcBoundaries + nFaces) )
312 Serr <<
"Number of processor boundaries " << nProcBoundaries <<
endl;
313 Serr <<
"Number of domain faces " << nFaces <<
endl;
316 "void cartesianMeshExtractor::createPolyMesh()"
325 if( owner[faceI] == -1 )
330 "void cartesianMeshExtractor::createPolyMesh"
332 "pointFieldPMG& points,"
333 "faceListPMG& faces,"
336 ) <<
"Face " << faceI
343 closedness[owner[faceI]] += area;
344 if( neighbour[faceI] != -1 )
345 closedness[neighbour[faceI]] -= area;
349 if(
mag(closedness[cellI]) > 1
e-10 )
350 Info <<
"Cell " << cellI <<
" is not closed by "
351 << closedness[cellI] <<
endl;
369 const scalar tZ = 0.05 * (bb.
max().
z() - bb.
min().
z());
384 newFaceOwner.
append(fOwner[bfI]);
386 const vector& fNormal = fNormals[bfI];
402 "void cartesianMeshExtractor::createPolyMesh()"
425 Info <<
"Finished creating polyMesh" <<
endl;
const vectorField & faceCentres() const
const labelList & neighbour() const
const labelList & owner() const
owner and neighbour cells for faces
void append(const T &e)
Append an element at the end of the list.
A class for handling words, derived from string.
const point & max() const
Maximum describing the bounding box.
#define forAll(list, i)
Loop across all elements in list.
Template functions to aid in the implementation of demand driven data.
A List obtained as a section of another List.
static bool & parRun()
Is this a parallel run?
bool isQuadtree() const
is octree a quadtree or an octree
void replaceBoundary(const wordList &patchNames, const VRWGraph &boundaryFaces, const labelLongList &faceOwners, const labelLongList &facePatches)
replace the boundary with new boundary faces
Ostream & endl(Ostream &os)
Add newline and flush stream.
const pointFieldPMG & points() const
access to points
dimensioned< scalar > mag(const dimensioned< Type > &)
labelList patchFaces(const polyBoundaryMesh &patches, const wordList &names)
const labelLongList & octreeFaceOwner() const
return owners of octree faces
PtrList< boundaryPatch > & boundariesAccess()
access to boundary data
bool set(const label) const
Is element set.
PtrList< processorBoundaryPatch > & procBoundariesAccess()
access to processor boundary data
const faceList::subList & boundaryFaces() const
cellListPMG & cellsAccess()
access to cells
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void reorderBoundaryFaces()
Pre-declare SubField and related Field type.
OSstream Serr(cerr, "Serr")
void setSize(const label nElmts)
set the number of used elements
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
#define forAllRow(graph, rowI, index)
wordList patchNames(nPatches)
const point & min() const
Minimum describing the bounding box.
label sizeOfRow(const label rowI) const
Returns the number of elements in the given row.
errorManip< error > abort(error &err)
const double e
Elementary charge.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const labelLongList & octreeFaceNeighbour() const
return neighbours of octree faces
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
const List< direction > & boxType() const
return which octree boxes are used for mesh creation
const meshOctree & octree() const
return const reference to meshOctree
const boundBox & rootBox() const
return rootBox
label size() const
return the number of used elements
void appendList(const ListType &l)
Append a list as a row at the end of the graph.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
short procNo() const
return processor number
A bounding box defined in terms of the points at its extremities.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
faceListPMG & facesAccess()
access to mesh faces
const VRWGraph & octreeFaces() const
return octree faces, created for MESHCELL boxes
const vectorField & faceNormals() const
const meshOctreeCubeBasic & returnLeaf(const label) const
word name(const complex &)
Return a string representation of a complex.
const labelList & faceOwners() const