35 template<
class Triangulation>
57 List<labelPair> ownerNeighbourPair(owner.size());
59 forAll(ownerNeighbourPair, oNI)
61 ownerNeighbourPair[oNI] =
labelPair(owner[oNI], neighbour[oNI]);
65 <<
"Sorting faces, owner and neighbour into upper triangular order" 72 oldToNew =
invert(oldToNew.size(), oldToNew);
80 template<
class Triangulation>
83 const label nInternalFaces,
86 PtrList<dictionary>& patchDicts,
87 const List<DynamicList<face>>& patchFaces,
88 const List<DynamicList<label>>& patchOwners
91 label nPatches = patchFaces.size();
93 patchDicts.setSize(nPatches);
96 patchDicts.set(
patchi,
new dictionary());
99 label nBoundaryFaces = 0;
103 patchDicts[
p].set(
"nFaces", patchFaces[p].size());
104 patchDicts[
p].set(
"startFace", nInternalFaces + nBoundaryFaces);
106 nBoundaryFaces += patchFaces[
p].size();
109 faces.setSize(nInternalFaces + nBoundaryFaces);
110 owner.setSize(nInternalFaces + nBoundaryFaces);
112 label facei = nInternalFaces;
118 faces[facei] = patchFaces[
p][
f];
119 owner[facei] = patchOwners[
p][
f];
129 template<
class Triangulation>
132 PrintTable<word, label> triInfoTable(
"Mesh Statistics");
134 triInfoTable.add(
"Points", Triangulation::number_of_vertices());
135 triInfoTable.add(
"Edges", Triangulation::number_of_finite_edges());
136 triInfoTable.add(
"Faces", Triangulation::number_of_finite_facets());
137 triInfoTable.add(
"Cells", Triangulation::number_of_finite_cells());
139 scalar minSize = great;
144 Finite_vertices_iterator vit = Triangulation::finite_vertices_begin();
145 vit != Triangulation::finite_vertices_end();
150 if (vit->internalOrBoundaryPoint())
152 minSize =
min(vit->targetCellSize(), minSize);
153 maxSize =
max(vit->targetCellSize(), maxSize);
160 Info<<
"Size (Min/Max) = " 168 template<
class Triangulation>
172 label nInternalRef = 0;
173 label nUnassigned = 0;
174 label nUnassignedRef = 0;
175 label nInternalNearBoundary = 0;
176 label nInternalNearBoundaryRef = 0;
177 label nInternalSurface = 0;
178 label nInternalSurfaceRef = 0;
179 label nInternalFeatureEdge = 0;
180 label nInternalFeatureEdgeRef = 0;
181 label nInternalFeaturePoint = 0;
182 label nInternalFeaturePointRef = 0;
183 label nExternalSurface = 0;
184 label nExternalSurfaceRef = 0;
185 label nExternalFeatureEdge = 0;
186 label nExternalFeatureEdgeRef = 0;
187 label nExternalFeaturePoint = 0;
188 label nExternalFeaturePointRef = 0;
194 Finite_vertices_iterator vit = Triangulation::finite_vertices_begin();
195 vit != Triangulation::finite_vertices_end();
224 nInternalNearBoundaryRef++;
227 nInternalNearBoundary++;
234 nInternalSurfaceRef++;
244 nInternalFeatureEdgeRef++;
247 nInternalFeatureEdge++;
254 nInternalFeaturePointRef++;
257 nInternalFeaturePoint++;
264 nExternalSurfaceRef++;
274 nExternalFeatureEdgeRef++;
277 nExternalFeatureEdge++;
284 nExternalFeaturePointRef++;
287 nExternalFeaturePoint++;
295 label nTotalVertices =
298 + nInternalNearBoundary
300 + nInternalFeatureEdge
301 + nInternalFeaturePoint
303 + nExternalFeatureEdge
304 + nExternalFeaturePoint
307 if (nTotalVertices !=
label(Triangulation::number_of_vertices()))
310 << nTotalVertices <<
" does not equal " 311 << Triangulation::number_of_vertices()
315 PrintTable<word, label> vertexTable(
"Vertex Type Information");
317 vertexTable.add(
"Total", nTotalVertices);
318 vertexTable.add(
"Unassigned", nUnassigned);
319 vertexTable.add(
"nInternal", nInternal);
320 vertexTable.add(
"nInternalNearBoundary", nInternalNearBoundary);
321 vertexTable.add(
"nInternalSurface", nInternalSurface);
322 vertexTable.add(
"nInternalFeatureEdge", nInternalFeatureEdge);
323 vertexTable.add(
"nInternalFeaturePoint", nInternalFeaturePoint);
324 vertexTable.add(
"nExternalSurface", nExternalSurface);
325 vertexTable.add(
"nExternalFeatureEdge", nExternalFeatureEdge);
326 vertexTable.add(
"nExternalFeaturePoint", nExternalFeaturePoint);
327 vertexTable.add(
"nFar", nFar);
328 vertexTable.add(
"nReferred", nReferred);
331 vertexTable.
print(os);
335 template<
class Triangulation>
339 const fileName& name,
340 labelTolabelPairHashTable& vertexMap,
342 const bool writeDelaunayData
346 faceList faces(Triangulation::number_of_finite_facets());
347 labelList owner(Triangulation::number_of_finite_facets());
348 labelList neighbour(Triangulation::number_of_finite_facets());
354 patchDicts.set(0,
new dictionary());
356 List<DynamicList<face>> patchFaces(1, DynamicList<face>());
357 List<DynamicList<label>> patchOwners(1, DynamicList<label>());
359 vertexMap.resize(vertexCount());
360 cellMap.setSize(Triangulation::number_of_finite_cells(), -1);
390 label(Triangulation::number_of_vertices())
404 label(Triangulation::number_of_vertices())
409 Finite_vertices_iterator vit = Triangulation::finite_vertices_begin();
410 vit != Triangulation::finite_vertices_end();
414 if (!vit->farPoint())
416 vertexMap(
labelPair(vit->index(), vit->procIndex())) = vertI;
419 types[vertI] =
static_cast<label>(vit->type());
420 processorIndices[vertI] = vit->procIndex();
427 types.setSize(vertI);
428 processorIndices.setSize(vertI);
436 Finite_cells_iterator cit = Triangulation::finite_cells_begin();
437 cit != Triangulation::finite_cells_end();
444 && !Triangulation::is_infinite(cit)
448 cellMap[cit->cellIndex()] = celli++;
454 face newFace(verticesOnTriFace);
458 Finite_facets_iterator fit = Triangulation::finite_facets_begin();
459 fit != Triangulation::finite_facets_end();
463 const Cell_handle
c1(fit->first);
464 const label oppositeVertex = fit->second;
465 const Cell_handle
c2(
c1->neighbor(oppositeVertex));
481 !Triangulation::is_infinite(
c1)
482 && !
c1->hasFarPoint()
486 c1I = cellMap[
c1->cellIndex()];
494 !Triangulation::is_infinite(
c2)
495 && !
c2->hasFarPoint()
499 c2I = cellMap[
c2->cellIndex()];
503 if (!c1Real && !c2Real)
509 label ownerCell = -1;
510 label neighbourCell = -1;
512 for (
label i = 0; i < 3; i++)
514 verticesOnTriFace[i] = vertexMap
520 Triangulation::vertex_triple_index(oppositeVertex, i)
524 Triangulation::vertex_triple_index(oppositeVertex, i)
530 newFace = face(verticesOnTriFace);
532 if (!c1Real || !c2Real)
548 patchFaces[0].append(newFace);
549 patchOwners[0].append(ownerCell);
569 faces[facei] = newFace;
570 owner[facei] = ownerCell;
571 neighbour[facei] = neighbourCell;
576 faces.setSize(facei);
577 owner.setSize(facei);
578 neighbour.setSize(facei);
580 sortFaces(faces, owner, neighbour);
619 label nValidPatches = 0;
635 patches.setSize(nValidPatches);
639 if (writeDelaunayData)
643 processorIndices.write();
void inplaceReorder(const labelUList &oldToNew, ListType &)
Inplace reorder the elements of a list.
#define forAll(list, i)
Loop across all elements in list.
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 sortedOrder(const UList< T > &, labelList &order)
Generate the (stable) sort order for the list.
pointFromPoint topoint(const Point &P)
The vertex and cell classes must have an index defined.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
const dimensionedScalar & c1
First radiation constant: default SI units: [W/m^2].
wordList patchTypes(nPatches)
Ostream & endl(Ostream &os)
Add newline and flush stream.
void printVertexInfo(Ostream &os) const
Write vertex statistics in the form of a table to stream.
void printInfo(Ostream &os) const
Write mesh statistics to stream.
vectorField pointField
pointField is a vectorField.
labelList invert(const label len, const labelUList &)
Invert one-to-one map. Unmapped elements will be -1.
autoPtr< BasicCompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleMomentumTransportModel::transportModel &transport)
wordList patchNames(nPatches)
Pair< label > labelPair
Label pair.
List< label > labelList
A List of labels.
void reverse(UList< T > &, const label n)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
List< word > wordList
A List of words.
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionedScalar & c2
Second radiation constant: default SI units: [m K].
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
PtrList< dictionary > patchDicts
virtual void print(Ostream &) const
Print description of IOstream to Ostream.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
IOField< label > labelIOField
labelField with IO.
autoPtr< polyMesh > createMesh(const fileName &name, labelTolabelPairHashTable &vertexMap, labelList &cellMap, const bool writeDelaunayData=true) const
Create an fvMesh from the triangulation.