38 template<
class Triangulation>
60 List<labelPair> ownerNeighbourPair(owner.size());
62 forAll(ownerNeighbourPair, oNI)
64 ownerNeighbourPair[oNI] =
labelPair(owner[oNI], neighbour[oNI]);
68 <<
"Sorting faces, owner and neighbour into upper triangular order" 73 oldToNew =
invert(oldToNew.size(), oldToNew);
81 template<
class Triangulation>
84 const label nInternalFaces,
88 const List<DynamicList<face>>& patchFaces,
89 const List<DynamicList<label>>& patchOwners
100 label nBoundaryFaces = 0;
105 patchDicts[
p].set(
"startFace", nInternalFaces + nBoundaryFaces);
107 nBoundaryFaces += patchFaces[
p].size();
110 faces.setSize(nInternalFaces + nBoundaryFaces);
111 owner.setSize(nInternalFaces + nBoundaryFaces);
113 label facei = nInternalFaces;
119 faces[facei] = patchFaces[
p][
f];
120 owner[facei] = patchOwners[
p][
f];
130 template<
class Triangulation>
133 PrintTable<word, label> triInfoTable(
"Mesh Statistics");
135 triInfoTable.add(
"Points", Triangulation::number_of_vertices());
136 triInfoTable.add(
"Edges", Triangulation::number_of_finite_edges());
137 triInfoTable.add(
"Faces", Triangulation::number_of_finite_facets());
138 triInfoTable.add(
"Cells", Triangulation::number_of_finite_cells());
140 scalar minSize = GREAT;
145 Finite_vertices_iterator vit = Triangulation::finite_vertices_begin();
146 vit != Triangulation::finite_vertices_end();
151 if (vit->internalOrBoundaryPoint())
153 minSize =
min(vit->targetCellSize(), minSize);
154 maxSize =
max(vit->targetCellSize(), maxSize);
161 Info<<
"Size (Min/Max) = " 169 template<
class Triangulation>
174 label nUnassigned = 0;
176 label nInternalNearBoundary = 0;
178 label nInternalSurface = 0;
180 label nInternalFeatureEdge = 0;
182 label nInternalFeaturePoint = 0;
184 label nExternalSurface = 0;
186 label nExternalFeatureEdge = 0;
188 label nExternalFeaturePoint = 0;
195 Finite_vertices_iterator vit = Triangulation::finite_vertices_begin();
196 vit != Triangulation::finite_vertices_end();
228 nInternalNearBoundary++;
248 nInternalFeatureEdge++;
258 nInternalFeaturePoint++;
278 nExternalFeatureEdge++;
288 nExternalFeaturePoint++;
296 label nTotalVertices =
299 + nInternalNearBoundary
301 + nInternalFeatureEdge
302 + nInternalFeaturePoint
304 + nExternalFeatureEdge
305 + nExternalFeaturePoint
308 if (nTotalVertices != label(Triangulation::number_of_vertices()))
311 << nTotalVertices <<
" does not equal " 312 << Triangulation::number_of_vertices()
316 PrintTable<word, label> vertexTable(
"Vertex Type Information");
318 vertexTable.add(
"Total", nTotalVertices);
319 vertexTable.add(
"Unassigned", nUnassigned);
320 vertexTable.add(
"nInternal", nInternal);
321 vertexTable.add(
"nInternalNearBoundary", nInternalNearBoundary);
322 vertexTable.add(
"nInternalSurface", nInternalSurface);
323 vertexTable.add(
"nInternalFeatureEdge", nInternalFeatureEdge);
324 vertexTable.add(
"nInternalFeaturePoint", nInternalFeaturePoint);
325 vertexTable.add(
"nExternalSurface", nExternalSurface);
326 vertexTable.add(
"nExternalFeatureEdge", nExternalFeatureEdge);
327 vertexTable.add(
"nExternalFeaturePoint", nExternalFeaturePoint);
328 vertexTable.add(
"nFar", nFar);
329 vertexTable.add(
"nReferred", nReferred);
336 template<
class Triangulation>
340 const fileName&
name,
343 const bool writeDelaunayData
347 faceList faces(Triangulation::number_of_finite_facets());
348 labelList owner(Triangulation::number_of_finite_facets());
349 labelList neighbour(Triangulation::number_of_finite_facets());
357 List<DynamicList<face>> patchFaces(1, DynamicList<face>());
358 List<DynamicList<label>> patchOwners(1, DynamicList<label>());
360 vertexMap.reserve(vertexCount());
361 cellMap.setSize(Triangulation::number_of_finite_cells(), -1);
391 label(Triangulation::number_of_vertices())
405 label(Triangulation::number_of_vertices())
410 Finite_vertices_iterator vit = Triangulation::finite_vertices_begin();
411 vit != Triangulation::finite_vertices_end();
415 if (!vit->farPoint())
417 vertexMap(
labelPair(vit->index(), vit->procIndex())) = vertI;
420 types[vertI] =
static_cast<label
>(vit->type());
421 processorIndices[vertI] = vit->procIndex();
428 types.setSize(vertI);
429 processorIndices.setSize(vertI);
437 Finite_cells_iterator cit = Triangulation::finite_cells_begin();
438 cit != Triangulation::finite_cells_end();
445 && !Triangulation::is_infinite(cit)
449 cellMap[cit->cellIndex()] = celli++;
454 labelList verticesOnTriFace(3, label(-1));
455 face newFace(verticesOnTriFace);
459 Finite_facets_iterator fit = Triangulation::finite_facets_begin();
460 fit != Triangulation::finite_facets_end();
464 const Cell_handle
c1(fit->first);
465 const label oppositeVertex = fit->second;
466 const Cell_handle
c2(
c1->neighbor(oppositeVertex));
482 !Triangulation::is_infinite(
c1)
483 && !
c1->hasFarPoint()
487 c1I = cellMap[
c1->cellIndex()];
495 !Triangulation::is_infinite(
c2)
496 && !
c2->hasFarPoint()
500 c2I = cellMap[
c2->cellIndex()];
504 if (!c1Real && !c2Real)
510 label ownerCell = -1;
511 label neighbourCell = -1;
513 for (label i = 0; i < 3; i++)
515 verticesOnTriFace[i] = vertexMap
521 Triangulation::vertex_triple_index(oppositeVertex, i)
525 Triangulation::vertex_triple_index(oppositeVertex, i)
531 newFace = face(verticesOnTriFace);
533 if (!c1Real || !c2Real)
549 patchFaces[0].append(newFace);
550 patchOwners[0].append(ownerCell);
570 faces[facei] = newFace;
571 owner[facei] = ownerCell;
572 neighbour[facei] = neighbourCell;
577 faces.setSize(facei);
578 owner.setSize(facei);
579 neighbour.setSize(facei);
581 sortFaces(faces, owner, neighbour);
617 label nValidPatches = 0;
633 patches.setSize(nValidPatches);
637 if (writeDelaunayData)
641 processorIndices.write();
IOField< label > labelIOField
IO for a Field of label.
autoPtr< polyMesh > createMesh(const fileName &name, labelPairLookup &vertexMap, labelList &cellMap, const bool writeDelaunayData=true) const
Create an fvMesh from the triangulation.
pointFromPoint topoint(const Point &P)
The vertex and cell classes must have an index defined.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
wordList patchTypes(nPatches)
const dimensionedScalar c2
Second radiation constant: default SI units: [m.K].
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
void printVertexInfo(Ostream &os) const
Write vertex statistics in the form of a table to stream.
#define forAll(list, i)
Loop across all elements in list.
void printInfo(Ostream &os) const
Write mesh statistics to stream.
List< face > faceList
List of faces.
vectorField pointField
pointField is a vectorField.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Foam::autoPtr< Foam::dynamicFvMesh > meshPtr
wordList patchNames(nPatches)
void reverse(UList< T > &list, const label n)
Reverse the first n elements of the list.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Pair< label > labelPair
A pair of labels.
OBJstream os(runTime.globalPath()/outputName)
virtual void print(Ostream &os) const
Print stream description to Ostream.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
List< word > wordList
List of word.
#define WarningInFunction
Report a warning using Foam::Warning.
const polyBoundaryMesh & patches
HashTable< label, labelPair, Foam::Hash< labelPair > > labelPairLookup
This is a Map of a labelPair to a label. Used for e.g. for face1, face2 to shared edge...
const dimensionedScalar c1
First radiation constant: default SI units: [W/m2].
messageStream Info
Information stream (stdout output on master, null elsewhere)
PtrList< dictionary > patchDicts
List< label > labelList
A List of labels.
Ostream & incrIndent(Ostream &os)
Increment the indent level.