51 return wordHashSet(*fileExtensionConstructorTablePtr_);
58 return wordHashSet(*writefileExtensionMemberFunctionTablePtr_);
71 return fileFormats::surfaceFormatsCore::checkSupport
73 readTypes() | FriendType::readTypes(),
88 return fileFormats::surfaceFormatsCore::checkSupport
90 writeTypes() | ProxyType::writeTypes(),
108 ext =
name.lessExt().ext();
110 return canReadType(ext, verbose);
128 typename writefileExtensionMemberFunctionTable::iterator mfIter =
129 writefileExtensionMemberFunctionTablePtr_->find(ext);
131 if (mfIter == writefileExtensionMemberFunctionTablePtr_->end())
136 if (supported.
found(ext))
143 <<
"Unknown file extension " << ext <<
nl <<
nl
144 <<
"Valid types are :" <<
endl
145 << (supported | writeTypes())
151 mfIter()(
name, surf);
176 reset(move(pointLst), move(faceLst), move(zoneLst));
193 if (zoneSizes.
size())
195 if (zoneNames.
size())
197 addZones(zoneSizes, zoneNames);
214 zones_(surf.surfZones())
234 newFaces[
faceMap[facei]] = origFaces[facei];
237 this->storedFaces().
transfer(newFaces);
262 const bool useGlobalPoints
285 useGlobalPoints ? mesh.points() : allBoundary.localPoints()
291 useGlobalPoints ? allBoundary : allBoundary.localFaces()
298 label startFacei = 0;
315 startFacei +=
p.size();
319 newZones.setSize(nZone);
322 MeshedSurface<face> surf
381 move(mesh.storedPoints()),
382 move(mesh.storedFaces()),
383 move(mesh.storedZones())
386 this->transcribe(surf);
415 else if (zones.
size())
425 origEndI += zone.
size();
427 for (
label facei = newFacei; facei <
faceMap.size(); ++facei)
452 ParentType::clearOut();
454 storedPoints().clear();
455 storedFaces().clear();
456 storedZones().clear();
464 ParentType::clearGeom();
467 storedPoints() = newPoints;
475 if (scaleFactor > 0 && scaleFactor != 1.0)
480 ParentType::clearGeom();
482 storedPoints() = newPoints;
495 ParentType::clearOut();
501 storedPoints().transfer(pointLst);
506 storedFaces().transfer(faceLst);
511 storedZones().transfer(zoneLst);
524 ParentType::clearOut();
530 storedPoints().transfer(pointLst);
535 storedFaces().transfer(faceLst);
540 storedZones().transfer(zoneLst);
550 stitchFaces(small, verbose);
570 bool hasMerged =
mergePoints(pointLst, tol, verbose, pointMap, newPoints);
593 Face&
f = faceLst[facei];
596 f[fp] = pointMap[
f[fp]];
600 if (
f.collapse() >= 3)
602 if (newFacei != facei)
604 faceLst[newFacei] =
f;
611 Pout<<
"MeshedSurface::stitchFaces : "
612 <<
"Removing collapsed face " << facei <<
endl
613 <<
" vertices :" <<
f <<
endl;
618 if (newFacei != faceLst.
size())
622 Pout<<
"MeshedSurface::stitchFaces : "
623 <<
"Removed " << faceLst.
size() - newFacei
633 ParentType::clearOut();
645 bool changed =
false;
655 Face&
f = faceLst[facei];
658 if (
f.collapse() >= 3)
662 if (
f[fp] < 0 ||
f[fp] > maxPointi)
666 <<
" uses point indices outside point range 0.."
684 <<
"face[" << facei <<
"] = " <<
f
685 <<
" does not have three unique vertices" <<
endl;
702 const Face&
f = faceLst[facei];
706 const labelList& neighbours = fFaces[facei];
710 forAll(neighbours, neighI)
712 const label neiFacei = neighbours[neighI];
714 if (neiFacei <= facei ||
faceMap[neiFacei] < 0)
721 const Face& nei = faceLst[neiFacei];
730 <<
"faces share the same vertices:" <<
nl
731 <<
" face[" << facei <<
"] : " <<
f <<
nl
732 <<
" face[" << neiFacei <<
"] : " << nei <<
endl;
755 if (changed || newFacei < faceLst.
size())
762 <<
"Removed " << faceLst.
size() - newFacei
763 <<
" illegal faces." <<
endl;
772 if (newFacei != facei)
774 faceLst[newFacei] = faceLst[facei];
787 ParentType::clearOut();
815 const label n = faceLst[facei].nTriangles();
824 if (nTri <= faceLst.
size())
844 nTri -= faceLst.
size();
846 if (this->
points().empty())
853 const Face&
f = faceLst[facei];
859 newFaces[newFacei] =
triFace(
f[0],
f[fp],
f[fp1]);
873 const face&
f = faceLst[facei];
879 newFaces[newFacei] = triEngine.
triPoints(triI,
f);
897 ParentType::clearOut();
912 const pointField& locPoints = this->localPoints();
913 const List<Face>& locFaces = this->localFaces();
924 newPoints[pointi] = locPoints[pointMap[pointi]];
925 oldToNew[pointMap[pointi]] = pointi;
932 newZones[zoneI].
size() = 0;
940 newFaces[facei] = Face(locFaces[origFacei]);
943 Face&
f = newFaces[facei];
946 f[fp] = oldToNew[
f[fp]];
961 zone.
start() = newFacei;
962 origEndI += zone.
size();
964 for (
label facei = newFacei; facei <
faceMap.size(); ++facei)
998 return subsetMesh(include, pointMap,
faceMap);
1003 template<
class Face>
1018 template<
class Face>
1029 if (zoneLst.
size() <= 1)
1062 template<
class Face>
1069 return read(unzipName, unzipName.
ext());
1079 template<
class Face>
1094 template<
class Face>
1098 const word& surfName
1107 template<
class Face>
1112 this->storedPoints() = surf.
points();
1113 this->storedFaces() = surf.
faces();
1118 template<
class Face>
Various functions to operate on Lists.
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
A HashTable with keys but without contents.
bool found(const Key &) const
Return true if hashedEntry is found in table.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
void size(const label)
Override size to be inconsistent with allocated storage.
void clear()
Clear the list, i.e. set size to zero.
void setSize(const label)
Reset size of List.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats.
static void write(const fileName &, const MeshedSurfaceProxy< Face > &)
Write to file.
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
static bool isTri()
Face storage only handles triangulated faces.
virtual void scalePoints(const scalar)
Scale points. A non-positive factor is ignored.
const List< surfZone > & surfZones() const
Const access to the surface zones.
const List< Face > & faces() const
Return const access to the faces.
void transcribe(MeshedSurface< face > &)
Transfer points/zones and transcribe face -> triFace.
void operator=(const MeshedSurface< Face > &)
static wordHashSet writeTypes()
pointField & storedPoints()
Non-const access to global points.
virtual void cleanup(const bool verbose)
Remove invalid faces.
void transfer(MeshedSurface< Face > &)
Transfer the contents of the argument and annul the argument.
virtual ~MeshedSurface()
Destructor.
bool read(const fileName &, const word &ext)
Read from file. Chooses reader based on explicit extension.
virtual label triangulate()
Triangulate in-place, returning the number of triangles added.
static bool canWriteType(const word &ext, const bool verbose=false)
Can we write this file format?
MeshedSurface subsetMesh(const labelHashSet &include, labelList &pointMap, labelList &faceMap) const
Return new surface.
surfZoneList & storedZones()
Non-const access to the zones.
static bool canRead(const fileName &, const bool verbose=false)
Can we read this file format?
static bool canReadType(const word &ext, const bool verbose=false)
Can we read this file format?
virtual bool stitchFaces(const scalar tol=small, const bool verbose=false)
static void write(const fileName &, const MeshedSurface< Face > &)
Write to file.
virtual void reset(pointField &&points, List< Face > &&faces, surfZoneList &&zones)
Reset primitive data (points, faces and zones)
List< Face > & storedFaces()
Non-const access to the faces.
virtual void remapFaces(const labelUList &faceMap)
Set new zones from faceMap.
virtual void clear()
Clear all storage.
friend class MeshedSurface
virtual bool checkFaces(const bool verbose=false)
virtual void setPoints(const pointField &)
Reset the points.
static wordHashSet readTypes()
A list of faces which address into the list of points.
autoPtr< PrimitivePatch< ::Foam::List< Face >, pointField > > clone() const
Construct and return a clone.
const Field< PointType > & points() const
Return reference to global points.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
A List obtained as a section of another List.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A List with indirect addressing.
label size() const
Return the number of elements in the UList.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
A surface geometry mesh, in which the surface zone information is conveyed by the 'zoneId' associated...
surfZoneList sortedZones(labelList &faceMap) const
Sort faces according to zoneIds.
virtual void clear()
Clear all storage.
const word & name() const
Return const reference to name.
A face is a list of labels corresponding to mesh vertices.
A class for handling file names.
word ext() const
Return file name extension (part after last .)
Mesh consisting of general polyhedral cells.
virtual const faceList & faces() const
Return raw faces.
virtual const pointField & points() const
Return raw points.
A patch is a list of labels that address the faces in the global face list.
Triangulation of three-dimensional polygons.
const UList< triFace > & triPoints() const
Get the triangles' points.
label nInternalFaces() const
A surface mesh consisting of general polygon faces.
virtual const faceList & faces() const
Return faces.
virtual const pointField & points() const
Return points.
virtual const surfZoneList & surfZones() const
Return surface zones.
A surface zone on a MeshedSurface.
label start() const
Return start label of this zone in the face list.
label size() const
Return size of this zone in the face list.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const polyBoundaryMesh & bMesh
#define WarningInFunction
Report a warning using Foam::Warning.
#define InfoInFunction
Report an information message using Foam::Info.
label checkTopology(const polyMesh &mesh, const bool allTopology, const autoPtr< surfaceWriter > &surfWriter, const autoPtr< setWriter > &setWriter)
Check the topology.
errorManipArg< error, int > exit(error &err, const int errNo=1)
bool read(const char *, int32_t &)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
vectorField pointField
pointField is a vectorField.
bool notNull(const T &t)
Return true if t is not a reference to the nullObject of type T.
label mergePoints(const UList< Type > &points, const scalar mergeTol, const bool verbose, labelList &pointMap, const Type &origin=Type::zero)
Sorts and merges points. All points closer than/equal mergeTol get merged.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
HashSet wordHashSet
A HashSet with word keys.
prefixOSstream Pout(cout, "Pout")
List< surfZone > surfZoneList