43 return wordHashSet(*fileExtensionConstructorTablePtr_);
50 return wordHashSet(*writefileExtensionMemberFunctionTablePtr_);
61 return fileFormats::surfaceFormatsCore::checkSupport
63 readTypes() | MeshReference::readTypes(),
78 return fileFormats::surfaceFormatsCore::checkSupport
102 return canReadType(ext, verbose);
123 const word& fileType,
129 if (fileType.empty())
138 <<
"Cannot determine format from filename" <<
nl 143 write(
name, ext, surf, streamOpt, options);
150 auto* mfuncPtr = writefileExtensionMemberFunctionTable(fileType);
155 const wordHashSet delegate(ProxyType::writeTypes());
157 if (!delegate.found(fileType))
160 <<
"Unknown write format " << fileType <<
nl <<
nl 161 <<
"Valid types:" <<
nl 166 MeshedSurfaceProxy<Face>(surf).
write 168 name, fileType, streamOpt, options
173 mfuncPtr(
name, surf, streamOpt, options);
193 MeshReference(surf.
points(), surf.surfFaces()),
194 zoneIds_(surf.zoneIds()),
195 zoneToc_(surf.zoneToc())
205 MeshReference(surf.
points(), surf.surfFaces()),
246 MeshReference(
std::move(pointLst),
std::move(faceLst)),
247 zoneIds_(
std::move(zoneIds)),
344 zoneIds_.resize(size());
350 zoneToc_[0].index() = 0;
352 if (zoneToc_[0].
name().empty())
354 zoneToc_[0].name() =
"zone0";
367 zoneIds_.resize(size());
368 zoneToc_.resize(zoneLst.size());
372 const surfZone& zone = zoneLst[zonei];
373 zoneToc_[zonei] = zone;
385 const UList<word>&
names 390 zoneIds_.resize(size());
391 zoneToc_.resize(sizes.size());
396 zoneToc_[zonei] = surfZoneIdentifier(
names[zonei], zonei);
399 SubList<label>(zoneIds_, sizes[zonei], start) = zonei;
401 start += sizes[zonei];
414 zoneIds_.resize(size());
415 zoneToc_.resize(sizes.size());
420 zoneToc_[zonei] = surfZoneIdentifier
427 SubList<label>(zoneIds_, sizes[zonei], start) = zonei;
429 start += sizes[zonei];
441 if (faceMapNewToOld.empty())
446 if (zoneToc_.empty())
450 else if (zoneToc_.size() == 1)
456 List<label> newZonesIds(faceMapNewToOld.size());
458 forAll(faceMapNewToOld, facei)
460 newZonesIds[facei] = zoneIds_[faceMapNewToOld[facei]];
462 zoneIds_.transfer(newZonesIds);
472 is >> this->storedZoneIds()
473 >> this->storedPoints()
474 >> this->storedFaces();
484 os << this->zoneIds()
486 << this->surfFaces();
495 this->storedFaces().resize(
s);
497 zoneIds_.resize(
s, zoneToc_.size() - 1);
520 zoneNames.
insert(zonei, zoneToc_[zonei].
name());
531 for (
const label origId : zoneIds_)
533 ++(lookup(origId, 0));
543 const label origId = iter.key();
545 const word zoneName =
552 zoneLst[zonei] = surfZone
568 faceMap.resize(zoneIds_.size());
572 const label zonei = lookup[zoneIds_[facei]];
573 faceMap[facei] = zoneLst[zonei].start() + zoneLst[zonei].size()++;
589 const pointField& locPoints = this->localPoints();
590 const List<Face>& locFaces = this->localFaces();
593 pointField newPoints(UIndirectList<point>(locPoints, pointMap));
596 labelList oldToNew(locPoints.size(), -1);
599 oldToNew[pointMap[pointi]] = pointi;
603 List<Face> newFaces(UIndirectList<Face>(locFaces,
faceMap));
606 for (
auto&
f : newFaces)
608 for (label& vert :
f)
610 vert = oldToNew[vert];
616 List<label> newZones(UIndirectList<label>(zoneIds_,
faceMap));
619 List<surfZoneIdentifier> subToc(zoneToc_);
622 return UnsortedMeshedSurface<Face>
624 std::move(newPoints),
641 this->subsetMeshMap(include, pointMap,
faceMap);
642 return this->subsetMeshImpl(pointMap,
faceMap);
655 this->subsetMeshMap(include, pointMap,
faceMap);
656 return this->subsetMeshImpl(pointMap,
faceMap);
668 return this->subsetMesh(include, pointMap,
faceMap);
680 return this->subsetMesh(include, pointMap,
faceMap);
700 zoneIds_.swap(surf.zoneIds_);
701 zoneToc_.swap(surf.zoneToc_);
703 this->storedZones().clear();
723 zoneIds_.transfer(surf.zoneIds_);
724 zoneToc_.transfer(surf.zoneToc_);
740 MeshReference::transfer(surf);
802 this->storedPoints() = surf.
points();
804 zoneIds_ = surf.zoneIds_;
805 zoneToc_ = surf.zoneToc_;
824 List<surfZone> zoneLst = this->sortedZones(
faceMap);
826 return MeshedSurfaceProxy<Face>
842 UnsortedMeshedSurface<Face>& surf
845 surf.readIstream(is);
854 const UnsortedMeshedSurface<Face>& surf
857 surf.writeOstream(
os);
A surface geometry mesh, in which the surface zone information is conveyed by the 'zoneId' associated...
virtual void clear()
Clear all storage.
virtual void scalePoints(const scalar scaleFactor)
Scale points. A non-positive factor is ignored.
List< word > names(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
List of names generated by calling name() for each list item and filtered for matches.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static wordHashSet writeTypes()
Known writable file-types, without friends or proxies.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
void swap(MeshedSurface< Face > &surf)=delete
Swap contents - disabled.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
constexpr char nl
The newline '\n' character (0x0a)
void transfer(UnsortedMeshedSurface< Face > &surf)
Transfer the contents of the argument and annul the argument.
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.
autoPtr< labelList > releaseZoneIds()
Release (clear) stored zoneIds and return for reuse.
A simple container for options an IOstream can normally have.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
surfZoneList & storedZones()
Non-const access to the zones.
UList< label > labelUList
A UList of labels.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Various functions to operate on Lists.
#define forAll(list, i)
Loop across all elements in list.
static void write(const fileName &name, const MeshedSurfaceProxy &surf, IOstreamOption streamOpt=IOstreamOption(), const dictionary &options=dictionary::null)
Write to file, select based on its extension.
word ext() const
Return file name extension (part after last .)
bool insert(const label &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
A List obtained as a section of another List.
vectorField pointField
pointField is a vectorField.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
bool has_ext() const
Various checks for extensions.
List< Face > & storedFaces()
Non-const access to the faces.
Base class for mesh zones.
void clear()
Clear the list, i.e. set size to zero.
A class for handling words, derived from Foam::string.
static word defaultName(const label n=-1)
Default zone name: "zone" or "zoneN".
#define DebugInFunction
Report an information message using Foam::Info.
static wordHashSet readTypes()
Known readable file-types, without friends or proxies.
pointField & storedPoints()
Non-const access to global points.
#define forAllIters(container, iter)
Iterate across all elements in the container object.
static const word null
An empty word.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
const Field< point_type > & points() const noexcept
Return reference to global points.
UnsortedMeshedSurface()
Default construct.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
static bool canRead(const fileName &name, bool verbose=false)
Can we read this file format?
UnsortedMeshedSurface subsetMesh(const UList< bool > &include, labelList &pointMap, labelList &faceMap) const
Return a new surface subsetted on the selected faces.
const List< Face > & surfFaces() const
Return const access to the faces.
static void write(const fileName &name, const UnsortedMeshedSurface< Face > &surf, IOstreamOption streamOpt=IOstreamOption(), const dictionary &options=dictionary::null)
Write to file, select based on its extension.
OBJstream os(runTime.globalPath()/outputName)
static bool canReadType(const word &fileType, bool verbose=false)
Can we read this file format? Also checks friend types.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats...
virtual void remapFaces(const labelUList &faceMapNewToOld)
Set new zones from faceMap.
surfZoneList sortedZones(labelList &faceMap) const
Sort faces according to zoneIds.
const T & lookup(const label &key, const T &deflt) const
Return hashed entry if it exists, or return the given default.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
static bool canWriteType(const word &fileType, bool verbose=false)
Can we write this file format? Also checks friend types.
List< surfZone > surfZoneList
List of surfZone.
void setZones(const surfZoneList &zoneLst)
Set zone ids and zones.
List< label > sortedToc(const UList< bool > &bools)
Return the (sorted) values corresponding to 'true' entries.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
List< label > labelList
A List of labels.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
const surfZoneList & surfZones() const
Const access to the surface zones.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
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 read(const fileName &name, const word &fileType)
Read from file with given format type.
Defines the attributes of an object for which implicit objectRegistry management is supported...
A HashTable to objects of type <T> with a label key.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
void setOneZone()
Set zones to 0 and set a single zone.