Go to the documentation of this file.
56 for (i=ts.size()-1; i>=0; i--)
69 for (
label j=i; j>=0; j--)
75 Pout<<
" triSurface::triSurfInstance(const Time& d)"
76 <<
"reading " << foamName
77 <<
" from " << ts[j].
name()/typeName
88 Pout<<
" triSurface::triSurfInstance(const Time& d)"
89 <<
"reading " << foamName
90 <<
" from constant/" <<
endl;
99 const label defaultRegion
106 const face&
f = faces[facei];
111 <<
"Face at position " << facei
112 <<
" does not have three vertices:" <<
f
116 labelledTri& tri = triFaces[facei];
121 tri.region() = defaultRegion;
131 const label defaultRegion
134 List<labelledTri> triFaces(faces.size());
140 labelledTri& tri = triFaces[facei];
145 tri.region() = defaultRegion;
162 for (
const label verti :
f)
164 if (verti < 0 || verti > maxPointi)
168 <<
" uses point indices outside point range 0.."
181 bitSet valid(size(),
true);
187 if ((
f[0] ==
f[1]) || (
f[0] ==
f[2]) || (
f[1] ==
f[2]))
195 <<
"triangle " << facei
196 <<
" does not have three unique vertices:\n";
203 const labelList& fEdges = faceEdges()[facei];
208 for (
const label edgei : fEdges)
210 const labelList& eFaces = edgeFaces()[edgei];
212 for (
const label neighbour : eFaces)
214 if (neighbour > facei)
221 ((
f[0] ==
n[0]) || (
f[0] ==
n[1]) || (
f[0] ==
n[2]))
222 && ((
f[1] ==
n[0]) || (
f[1] ==
n[1]) || (
f[1] ==
n[2]))
223 && ((
f[2] ==
n[0]) || (
f[2] ==
n[1]) || (
f[2] ==
n[2]))
231 <<
"triangles share the same vertices:\n"
232 <<
" face 1 :" << facei <<
endl;
238 << neighbour <<
endl;
254 for (
const label facei : valid)
256 (*this)[newFacei++] = (*this)[facei];
262 <<
"Removing " << size() - newFacei
263 <<
" illegal faces." <<
endl;
265 (*this).setSize(newFacei);
280 const labelList& myFaces = eFaces[edgei];
285 <<
"Edge " << edgei <<
" with vertices " << edges()[edgei]
286 <<
" has no edgeFaces"
289 else if (myFaces.size() > 2 && verbose)
292 <<
"Edge " << edgei <<
" with vertices " << edges()[edgei]
293 <<
" has more than 2 faces connected to it : " << myFaces
311 regions[facei] = operator[](facei).region();
317 label maxRegion = patches_.size()-1;
324 operator[](
faceMap.last()).region()
334 label region = operator[](facei).region();
336 newPatches[region].size()++;
342 label startFacei = 0;
343 forAll(newPatches, newPatchi)
345 surfacePatch& newPatch = newPatches[newPatchi];
347 newPatch.index() = newPatchi;
348 newPatch.start() = startFacei;
353 newPatchi < patches_.size()
354 && !patches_[newPatchi].name().empty()
357 newPatch.name() = patches_[newPatchi].name();
361 newPatch.name() = word(
"patch") +
Foam::name(newPatchi);
366 newPatchi < patches_.size()
367 && !patches_[newPatchi].geometricType().empty()
370 newPatch.geometricType() = patches_[newPatchi].geometricType();
377 startFacei += newPatch.size();
384 void Foam::triSurface::setDefaultPatches()
392 patches_.setSize(newPatches.size());
394 forAll(newPatches, patchi)
396 patches_[patchi].index() = patchi;
397 patches_[patchi].name() = newPatches[patchi].name();
398 patches_[patchi].geometricType() = newPatches[patchi].geometricType();
409 sortedEdgeFacesPtr_(nullptr),
410 edgeOwnerPtr_(nullptr)
418 sortedEdgeFacesPtr_(nullptr),
419 edgeOwnerPtr_(nullptr)
440 sortedEdgeFacesPtr_(
nullptr),
441 edgeOwnerPtr_(
nullptr)
455 sortedEdgeFacesPtr_(
nullptr),
456 edgeOwnerPtr_(
nullptr)
468 sortedEdgeFacesPtr_(
nullptr),
469 edgeOwnerPtr_(
nullptr)
483 sortedEdgeFacesPtr_(
nullptr),
484 edgeOwnerPtr_(
nullptr)
493 const scalar scaleFactor
504 const scalar scaleFactor
509 sortedEdgeFacesPtr_(
nullptr),
510 edgeOwnerPtr_(
nullptr)
513 scalePoints(scaleFactor);
530 ParentType::clearTopology();
538 ParentType::clearPatchMeshAddr();
544 ParentType::clearOut();
546 clearPatchMeshAddr();
568 if (!sortedEdgeFacesPtr_)
570 calcSortedEdgeFaces();
573 return *sortedEdgeFacesPtr_;
584 return *edgeOwnerPtr_;
594 ParentType::movePoints(pts);
597 storedPoints() = pts;
607 ParentType::movePoints(pts);
610 storedPoints().swap(pts);
617 if (scaleFactor > SMALL && scaleFactor != 1.0)
625 storedPoints() *= scaleFactor;
634 stitchTriangles(SMALL, verbose);
639 checkTriangles(verbose);
666 plainFaces[facei] = this->operator[](facei);
677 const label currentZone,
689 for (
const label facei : changedFaces)
691 const labelList& fEdges = faceEdges()[facei];
693 for (
const label edgei : fEdges)
695 if (!borderEdge[edgei])
697 const labelList& eFaces = edgeFaces()[edgei];
699 for (
const label nbrFacei : eFaces)
704 newChangedFaces.
append(nbrFacei);
706 else if (
faceZone[nbrFacei] != currentZone)
710 <<
" at face " << nbrFacei
711 <<
" connects to zone " << currentZone
712 <<
" at face " << facei
720 if (newChangedFaces.empty())
725 changedFaces.transfer(newChangedFaces);
741 if (borderEdge.size() != nEdges())
744 <<
"borderEdge boolList not same size as number of edges" <<
endl
745 <<
"borderEdge:" << borderEdge.size() <<
endl
746 <<
"nEdges :" << nEdges()
752 for (
label startFacei = 0;; zoneI++)
755 for (; startFacei < size(); startFacei++)
763 if (startFacei >= size())
770 markZone(borderEdge, startFacei, zoneI,
faceZone);
789 faceMap.setSize(locFaces.size());
797 if (include[oldFacei])
805 for (
const label verti :
f)
807 if (pointHad.
set(verti))
809 pointMap[pointi++] = verti;
832 subsetMeshMap(include, pointMap,
faceMap);
840 newPoints[pointi] = locPoints[pointMap[pointi]];
841 oldToNew[pointMap[pointi]] = pointi;
852 newTriangles[facei][0] = oldToNew[tri[0]];
853 newTriangles[facei][1] = oldToNew[tri[1]];
854 newTriangles[facei][2] = oldToNew[tri[2]];
855 newTriangles[facei].region() = tri.region();
866 return subsetMesh(include, pointMap,
faceMap);
874 this->storedFaces().swap(faceLst);
884 patches_.transfer(surf.
patches());
893 auto patches = ListOps::create<geometricSurfacePatch>
920 FaceListType::operator=(
static_cast<const FaceListType&
>(surf));
921 storedPoints() = surf.
points();
int debug
Static debugging option.
List< label > labelList
A List of labels.
vectorField pointField
pointField is a vectorField.
scalar timeOutputValue() const
Return current time value.
const surfZoneList & surfZones() const
Const access to the surface zones.
void subsetMeshMap(const boolList &include, labelList &pointMap, labelList &faceMap) const
'Create' sub mesh
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
const Field< PointType > & points() const
Return reference to global points.
A class for handling words, derived from Foam::string.
A class for handling file names.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
bool all() const
True if all bits in this bitset are set or if the set is empty.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
void markZone(const boolList &borderEdge, const label facei, const label currentZone, labelList &faceZone) const
Fill faceZone with currentZone for every face reachable.
void triFaceFaces(List< face > &plainFaceList) const
Create a list of faces from the triFaces.
Template functions to aid in the implementation of demand driven data.
bitSet & unset(const bitSet &other)
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
bool read(const char *buf, int32_t &val)
Same as readInt32.
List< surfacePatch > surfacePatchList
void set(const bitSet &bitset)
Set specified bits from another bitset.
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
void append(const T &val)
Append an element at the end of the list.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word ext() const
Return file name extension (part after last .)
virtual void clear()
Clear all storage.
void clearPatchMeshAddr()
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
const geometricSurfacePatchList & patches() const
virtual ~triSurface()
Destructor.
#define forAll(list, i)
Loop across all elements in list.
void swapFaces(List< labelledTri > &faceLst)
Swap the list of faces being addressed.
void deleteDemandDrivenData(DataPtr &dataPtr)
virtual void scalePoints(const scalar scaleFactor)
Scale points. A non-positive factor is ignored.
void checkTriangles(const bool verbose)
Check/remove duplicate/degenerate triangles.
triSurface subsetMesh(const boolList &include, labelList &pointMap, labelList &faceMap) const
Return new surface.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
virtual void movePoints(const pointField &pts)
Move points.
Triangulated surface description with patch information.
virtual void swapPoints(pointField &pts)
Swap points. Similar to movePoints, but returns the old points.
A subset of mesh faces organised as a primitive patch.
word name(const complex &c)
Return string representation of complex.
virtual const fileName & name() const
Return the name of the stream.
instantList times() const
Search the case for valid time directories.
void transfer(triSurface &surf)
Alter contents by transferring (triangles, points) components.
virtual const fileName & name() const
Return the name of the stream.
triSurface()
Construct null.
pointField & storedPoints()
Non-const access to global points.
List< surfZone > sortedZones(labelList &faceMap) const
Sort faces according to zoneIds.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
void swapPoints(pointField &points)
Swap the stored points.
List< Face > & storedFaces()
Non-const access to the faces.
List< triFace > triFaceList
list of triFaces
errorManip< error > abort(error &err)
const labelList & edgeOwner() const
If 2 face neighbours: label of face where ordering of edge.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void cleanup(const bool verbose)
Remove non-valid triangles.
label markZones(const boolList &borderEdge, labelList &faceZone) const
(size and) fills faceZone with zone of face. Zone is area
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const fileName & caseName() const
Return case name.
Helper to convert identifier types as an operation.
void swap(triSurface &surf)
fileName path() const
Return path.
A surface zone on a MeshedSurface.
static const word emptyType
The name for an 'empty' type.
const polyBoundaryMesh & patches
Triangle with additional region number.
A face is a list of labels corresponding to mesh vertices.
Various functions to operate on Lists.
const labelListList & sortedEdgeFaces() const
Return edge-face addressing sorted (for edges with more than.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
void operator=(const triSurface &surf)
Copy assignment.
void swapFaces(List< Face > &faces)
Swap the stored faces.
void setSize(const label newSize)
Alias for resize(const label)
const word & constant() const
Return constant name.
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
defineTypeNameAndDebug(combustionModel, 0)
#define WarningInFunction
Report a warning using Foam::Warning.
static fileName triSurfInstance(const Time &)
Name of triSurface directory to use.
void checkEdges(const bool verbose)
Check triply (or more) connected edges.