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(),
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);
234 newFaces[faceMap[facei]] = origFaces[facei];
237 this->storedFaces().
transfer(newFaces);
254 this->transcribe(surf);
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);
329 this->transcribe(surf);
371 IOobject::MUST_READ_IF_MODIFIED,
386 this->transcribe(surf);
410 if (zones.
size() == 1)
415 else if (zones.
size())
424 zone.
start() = newFacei;
425 origEndI += zone.
size();
427 for (
label facei = newFacei; facei < faceMap.
size(); ++facei)
429 if (faceMap[facei] < origEndI)
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;
606 faceMap[newFacei] = facei;
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
627 faceMap.setSize(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.." 672 faceMap[facei] = facei;
684 <<
"face[" << facei <<
"] = " << f
685 <<
" does not have three unique vertices" <<
endl;
697 if (faceMap[facei] < 0)
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;
743 faceMap[facei] = facei;
755 if (changed || newFacei < faceLst.
size())
762 <<
"Removed " << faceLst.
size() - newFacei
763 <<
" illegal faces." <<
endl;
770 if (faceMap[facei] >= 0)
772 if (newFacei != facei)
774 faceLst[newFacei] = faceLst[facei];
776 faceMap[newFacei] = 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];
855 for (
label fp = 1; fp < f.size() - 1; ++fp)
857 label fp1 = f.fcIndex(fp);
859 newFaces[newFacei] =
triFace(f[0], f[fp], f[fp1]);
860 faceMap[newFacei] = facei;
873 const face&
f = faceLst[facei];
879 newFaces[newFacei] = triEngine.
triPoints(triI, f);
880 faceMap[newFacei] = facei;
897 ParentType::clearOut();
912 const pointField& locPoints = this->localPoints();
913 const List<Face>& locFaces = this->localFaces();
917 PatchTools::subsetMap(*
this, include, pointMap, faceMap);
924 newPoints[pointi] = locPoints[pointMap[pointi]];
925 oldToNew[pointMap[pointi]] = pointi;
932 newZones[zoneI].
size() = 0;
939 const label origFacei = faceMap[facei];
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)
966 if (faceMap[facei] < origEndI)
998 return subsetMesh(include, pointMap, faceMap);
1003 template<
class Face>
1018 template<
class Face>
1029 if (zoneLst.
size() <= 1)
1045 newFaces[faceMap[facei]].transfer(oldFaces[facei]);
1062 template<
class Face>
1069 return read(unzipName, unzipName.
ext());
1073 return read(name, ext);
1079 template<
class Face>
1089 transfer(
New(name, ext)());
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>
bool read(const fileName &, const word &ext)
Read from file. Chooses reader based on explicit extension.
A surface geometry mesh, in which the surface zone information is conveyed by the 'zoneId' associated...
virtual void clear()
Clear all storage.
A HashTable with keys but without contents.
#define forAll(list, i)
Loop across all elements in list.
const word & name() const
Return name.
A class for handling file names.
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
errorManipArg< error, int > exit(error &err, const int errNo=1)
A face is a list of labels corresponding to mesh vertices.
virtual ~MeshedSurface()
Destructor.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label nInternalFaces() const
surfZoneList & storedZones()
Non-const access to the zones.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
A surface zone on a MeshedSurface.
void size(const label)
Override size to be inconsistent with allocated storage.
static wordHashSet writeTypes()
faceList & storedFaces()
Non-const access to the faces.
virtual void clear()
Clear all storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label size() const
Return size of this zone in the face list.
void transfer(MeshedSurface< Face > &)
Transfer the contents of the argument and annul the argument.
MeshedSurface subsetMesh(const labelHashSet &include, labelList &pointMap, labelList &faceMap) const
Return new surface.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
surfZoneList & storedZones()
Non-const access to the zones.
word ext() const
Return file name extension (part after last .)
Macros for easy insertion into run-time selection tables.
label checkTopology(const polyMesh &, const bool, const bool, const autoPtr< surfaceWriter > &, const autoPtr< setWriter > &)
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Various functions to operate on Lists.
virtual const pointField & points() const
Return raw points.
A list of faces which address into the list of points.
A List obtained as a section of another List.
void operator=(const MeshedSurface< Face > &)
vectorField pointField
pointField is a vectorField.
static wordHashSet readTypes()
List< Face > & storedFaces()
Non-const access to the faces.
bool found(const Key &) const
Return true if hashedEntry is found in table.
void clear()
Clear the list, i.e. set size to zero.
static word timeName(const scalar, const int precision=curPrecision_)
Return time name of given scalar time.
A class for handling words, derived from string.
virtual const faceList & faces() const
Return faces.
pointField & storedPoints()
Non-const access to global points.
virtual void cleanup(const bool verbose)
Remove invalid faces.
virtual label triangulate()
Triangulate in-place, returning the number of triangles added.
const Field< PointType > & points() const
Return reference to global points.
const polyMesh & mesh() const
Return the mesh reference.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
HashSet wordHashSet
A HashSet with word keys.
virtual const faceList & faces() const
Return raw faces.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
static bool isTri()
Face storage only handles triangulated faces.
static void write(const fileName &, const MeshedSurface< Face > &)
Write to file.
static bool canWriteType(const word &ext, const bool verbose=false)
Can we write this file format?
A surface mesh consisting of general polygon faces.
virtual void reset(pointField &&points, List< Face > &&faces, surfZoneList &&zones)
Reset primitive data (points, faces and zones)
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats...
word name(const complex &)
Return a string representation of a complex.
List< surfZone > surfZoneList
const List< Face > & faces() const
Return const access to the faces.
virtual void scalePoints(const scalar)
Scale points. A non-positive factor is ignored.
surfZoneList sortedZones(labelList &faceMap) const
Sort faces according to zoneIds.
bool notNull(const T &t)
Return true if t is not a reference to the nullObject of type T.
label size() const
Return the number of elements in the UPtrList.
void setSize(const label)
Reset size of List.
static void write(const fileName &, const MeshedSurfaceProxy< Face > &)
Write to file.
label start() const
Return start label of this zone in the face list.
virtual void remapFaces(const labelUList &faceMap)
Set new zones from faceMap.
#define WarningInFunction
Report a warning using Foam::Warning.
virtual const surfZoneList & surfZones() const
Return surface zones.
static bool canReadType(const word &ext, const bool verbose=false)
Can we read this file format?
Triangulation of three-dimensional polygons.
virtual bool checkFaces(const bool verbose=false)
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
prefixOSstream Pout(cout, "Pout")
const polyBoundaryMesh & bMesh
static bool canRead(const fileName &, const bool verbose=false)
Can we read this file format?
A List with indirect addressing.
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.
fileName lessExt() const
Return file name without extension (part before last .)
virtual bool stitchFaces(const scalar tol=small, const bool verbose=false)
pointField & storedPoints()
Non-const access to global points.
Mesh consisting of general polyhedral cells.
virtual const pointField & points() const
Return points.
A patch is a list of labels that address the faces in the global face list.
label size() const
Return the number of elements in the UList.
const UList< triFace > & triPoints() const
Get the triangles' points.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
virtual void movePoints(const pointField &)
Move points.
const List< surfZone > & surfZones() const
Const access to the surface zones.
MeshedSurface()
Construct null.
#define InfoInFunction
Report an information message using Foam::Info.