50 return wordHashSet(*fileExtensionConstructorTablePtr_);
57 return wordHashSet(*writefileExtensionMemberFunctionTablePtr_);
72 readTypes() | FriendType::readTypes(),
89 writeTypes() | ProxyType::writeTypes(),
109 return canReadType(ext, verbose);
122 Info<<
"MeshedSurface::write"
123 "(const fileName&, const MeshedSurface&) : "
124 "writing to " << name
130 typename writefileExtensionMemberFunctionTable::iterator mfIter =
131 writefileExtensionMemberFunctionTablePtr_->find(ext);
133 if (mfIter == writefileExtensionMemberFunctionTablePtr_->end())
138 if (supported.
found(ext))
146 "MeshedSurface::write"
147 "(const fileName&, const MeshedSurface&)"
148 ) <<
"Unknown file extension " << ext <<
nl <<
nl
149 <<
"Valid types are :" <<
endl
150 << (supported | writeTypes())
156 mfIter()(
name, surf);
181 reset(pointLst, faceLst, zoneLst);
198 if (zoneSizes.
size())
200 if (zoneNames.
size())
202 addZones(zoneSizes, zoneNames);
218 ParentType(surf.faces(), surf.
points()),
219 zones_(surf.surfZones())
240 newFaces[faceI] = origFaces[faceMap[faceI]];
243 this->storedFaces().
transfer(newFaces);
268 const bool useGlobalPoints
291 useGlobalPoints ? mesh.
points() : allBoundary.localPoints()
297 useGlobalPoints ? allBoundary : allBoundary.localFaces()
304 label startFaceI = 0;
321 startFaceI += p.size();
325 newZones.setSize(nZone);
335 this->transcribe(surf);
392 this->transcribe(surf);
440 if (&faceMap && faceMap.
size())
444 if (zones.
size() == 1)
449 else if (zones.
size())
458 zone.
start() = newFaceI;
459 origEndI += zone.
size();
461 for (label faceI = newFaceI; faceI < faceMap.
size(); ++faceI)
463 if (faceMap[faceI] < origEndI)
486 ParentType::clearOut();
488 storedPoints().clear();
489 storedFaces().clear();
490 storedZones().clear();
498 ParentType::clearTopology();
501 ParentType::movePoints(newPoints);
504 storedPoints() = newPoints;
512 if (scaleFactor > 0 && scaleFactor != 1.0)
515 ParentType::clearTopology();
520 storedPoints() *= scaleFactor;
533 ParentType::clearOut();
539 storedPoints().transfer(pointLst());
544 storedFaces().transfer(faceLst());
549 storedZones().transfer(zoneLst());
562 ParentType::clearOut();
568 storedPoints().transfer(pointLst());
573 storedFaces().transfer(faceLst());
578 storedZones().transfer(zoneLst());
588 stitchFaces(SMALL, verbose);
608 bool hasMerged =
mergePoints(pointLst, tol, verbose, pointMap, newPoints);
617 Info<<
"MeshedSurface::stitchFaces : Renumbering all faces"
632 Face&
f = faceLst[faceI];
635 f[fp] = pointMap[f[fp]];
639 if (f.collapse() >= 3)
641 if (newFaceI != faceI)
643 faceLst[newFaceI] =
f;
645 faceMap[newFaceI] = faceI;
650 Pout<<
"MeshedSurface::stitchFaces : "
651 <<
"Removing collapsed face " << faceI <<
endl
652 <<
" vertices :" << f <<
endl;
657 if (newFaceI != faceLst.
size())
661 Pout<<
"MeshedSurface::stitchFaces : "
662 <<
"Removed " << faceLst.
size() - newFaceI
671 ParentType::clearOut();
683 bool changed =
false;
690 const label maxPointI = this->
points().
size() - 1;
693 Face&
f = faceLst[faceI];
696 if (f.collapse() >= 3)
700 if (f[fp] < 0 || f[fp] > maxPointI)
704 <<
" uses point indices outside point range 0.."
710 faceMap[faceI] = faceI;
723 "MeshedSurface::checkFaces(bool verbose)"
724 ) <<
"face[" << faceI <<
"] = " << f
725 <<
" does not have three unique vertices" <<
endl;
737 if (faceMap[faceI] < 0)
742 const Face&
f = faceLst[faceI];
746 const labelList& neighbours = fFaces[faceI];
750 forAll(neighbours, neighI)
752 const label neiFaceI = neighbours[neighI];
754 if (neiFaceI <= faceI || faceMap[neiFaceI] < 0)
761 const Face& nei = faceLst[neiFaceI];
771 "MeshedSurface::checkFaces(bool verbose)"
772 ) <<
"faces share the same vertices:" <<
nl
773 <<
" face[" << faceI <<
"] : " << f <<
nl
774 <<
" face[" << neiFaceI <<
"] : " << nei <<
endl;
785 faceMap[faceI] = faceI;
797 if (changed || newFaceI < faceLst.
size())
805 "MeshedSurface::checkFaces(bool verbose)"
806 ) <<
"Removed " << faceLst.
size() - newFaceI
807 <<
" illegal faces." <<
endl;
814 if (faceMap[faceI] >= 0)
816 if (newFaceI != faceI)
818 faceLst[newFaceI] = faceLst[faceI];
820 faceMap[newFaceI] = faceI;
831 ParentType::clearOut();
859 const label n = faceLst[faceI].nTriangles();
868 if (nTri <= faceLst.
size())
888 nTri -= faceLst.
size();
890 if (this->
points().empty())
897 const Face&
f = faceLst[faceI];
899 for (label fp = 1; fp < f.size() - 1; ++fp)
903 newFaces[newFaceI] =
triFace(f[0], f[fp], f[fp1]);
904 faceMap[newFaceI] = faceI;
918 const face&
f = faceLst[faceI];
922 for (label triI = 0; triI < nTmp; triI++)
924 newFaces[newFaceI] = Face
928 faceMap[newFaceI] = faceI;
945 ParentType::clearOut();
960 const pointField& locPoints = this->localPoints();
961 const List<Face>& locFaces = this->localFaces();
972 newPoints[pointI] = locPoints[pointMap[pointI]];
973 oldToNew[pointMap[pointI]] = pointI;
980 newZones[zoneI].
size() = 0;
987 const label origFaceI = faceMap[faceI];
988 newFaces[faceI] = Face(locFaces[origFaceI]);
991 Face&
f = newFaces[faceI];
994 f[fp] = oldToNew[f[fp]];
1009 zone.
start() = newFaceI;
1010 origEndI += zone.
size();
1012 for (label faceI = newFaceI; faceI < faceMap.
size(); ++faceI)
1014 if (faceMap[faceI] < origEndI)
1039 template<
class Face>
1047 return subsetMesh(include, pointMap, faceMap);
1052 template<
class Face>
1067 template<
class Face>
1078 if (zoneLst.
size() <= 1)
1094 newFaces[faceI].transfer(oldFaces[faceMap[faceI]]);
1110 template<
class Face>
1119 template<
class Face>
1126 return read(unzipName, unzipName.
ext());
1130 return read(name, ext);
1136 template<
class Face>
1146 transfer(New(name, ext)());
1151 template<
class Face>
1155 const word& surfName
1163 template<
class Face>
1168 this->storedPoints() = surf.
points();
1169 this->storedFaces() = surf.
faces();
1174 template<
class Face>