Go to the documentation of this file.
43 return wordHashSet(*fileExtensionConstructorTablePtr_);
50 return wordHashSet(*writefileExtensionMemberFunctionTablePtr_);
61 return fileFormats::surfaceFormatsCore::checkSupport
63 readTypes() | MeshReference::readTypes(),
78 return fileFormats::surfaceFormatsCore::checkSupport
100 return canReadType(ext, verbose);
121 const word& fileType,
127 if (fileType.empty())
136 <<
"Cannot determine format from filename" <<
nl
141 write(
name, ext, surf, streamOpt, options);
148 auto mfIter = writefileExtensionMemberFunctionTablePtr_->cfind(fileType);
153 const wordHashSet delegate(ProxyType::writeTypes());
155 if (!delegate.
found(fileType))
158 <<
"Unknown write format " << fileType <<
nl <<
nl
159 <<
"Valid types:" <<
nl
160 <<
flatOutput((delegate | writeTypes()).sortedToc()) <<
nl
166 name, fileType, streamOpt, options
171 mfIter()(
name, surf, streamOpt, options);
245 zoneIds_(std::move(zoneIds)),
342 zoneIds_.resize(size());
348 zoneToc_[0].index() = 0;
350 if (zoneToc_[0].
name().empty())
352 zoneToc_[0].name() =
"zone0";
365 zoneIds_.resize(size());
366 zoneToc_.resize(zoneLst.size());
371 zoneToc_[zonei] =
zone;
388 zoneIds_.resize(size());
389 zoneToc_.resize(sizes.
size());
399 start += sizes[zonei];
412 zoneIds_.resize(size());
413 zoneToc_.resize(sizes.
size());
427 start += sizes[zonei];
439 if (faceMapNewToOld.
empty())
444 if (zoneToc_.empty())
448 else if (zoneToc_.size() == 1)
456 forAll(faceMapNewToOld, facei)
458 newZonesIds[facei] = zoneIds_[faceMapNewToOld[facei]];
460 zoneIds_.transfer(newZonesIds);
470 is >> this->storedZoneIds()
471 >> this->storedPoints()
472 >> this->storedFaces();
482 os << this->zoneIds()
484 << this->surfFaces();
493 this->storedFaces().resize(
s);
495 zoneIds_.resize(
s, zoneToc_.size() - 1);
518 zoneNames.insert(zonei, zoneToc_[zonei].
name());
529 for (
const label origId : zoneIds_)
541 const label origId = iter.key();
543 const word zoneName =
566 faceMap.resize(zoneIds_.size());
570 const label zonei =
lookup[zoneIds_[facei]];
571 faceMap[facei] = zoneLst[zonei].start() + zoneLst[zonei].size()++;
587 const pointField& locPoints = this->localPoints();
588 const List<Face>& locFaces = this->localFaces();
594 labelList oldToNew(locPoints.size(), -1);
597 oldToNew[pointMap[pointi]] = pointi;
601 List<Face> newFaces(UIndirectList<Face>(locFaces,
faceMap));
604 for (
auto&
f : newFaces)
606 for (label& vert :
f)
608 vert = oldToNew[vert];
614 List<label> newZones(UIndirectList<label>(zoneIds_,
faceMap));
617 List<surfZoneIdentifier> subToc(zoneToc_);
620 return UnsortedMeshedSurface<Face>
622 std::move(newPoints),
639 this->subsetMeshMap(include, pointMap,
faceMap);
640 return this->subsetMeshImpl(pointMap,
faceMap);
653 this->subsetMeshMap(include, pointMap,
faceMap);
654 return this->subsetMeshImpl(pointMap,
faceMap);
666 return this->subsetMesh(include, pointMap,
faceMap);
678 return this->subsetMesh(include, pointMap,
faceMap);
696 this->storedPoints().
swap(surf.storedPoints());
697 this->storedFaces().swap(surf.storedFaces());
698 zoneIds_.swap(surf.zoneIds_);
699 zoneToc_.swap(surf.zoneToc_);
701 this->storedZones().clear();
702 surf.storedZones().
clear();
719 this->storedPoints().transfer(surf.storedPoints());
720 this->storedFaces().transfer(surf.storedFaces());
721 zoneIds_.transfer(surf.zoneIds_);
722 zoneToc_.transfer(surf.zoneToc_);
738 MeshReference::transfer(surf);
769 transfer(*
New(
name, fileType));
800 this->storedPoints() = surf.points();
802 zoneIds_ = surf.zoneIds_;
803 zoneToc_ = surf.zoneToc_;
840 UnsortedMeshedSurface<Face>& surf
843 surf.readIstream(is);
852 const UnsortedMeshedSurface<Face>& surf
855 surf.writeOstream(os);
word lessExt() const
Return word without extension (part before last .)
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const surfZoneList & surfZones() const
Const access to the surface zones.
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)
void setZones(const surfZoneList &zoneLst)
Set zone ids and zones.
A class for handling words, derived from Foam::string.
autoPtr< labelList > releaseZoneIds()
Release (clear) stored zoneIds and return for reuse.
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))
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
A List obtained as a section of another List.
bool read(const char *buf, int32_t &val)
Same as readInt32.
Base class for mesh zones.
const List< Face > & surfFaces() const
Return const access to the faces.
A HashTable to objects of type <T> with a label key.
word ext() const
Return file name extension (part after last .)
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.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats.
Identifies a surface patch/zone by name, patch index and geometricType.
#define forAll(list, i)
Loop across all elements in list.
virtual const labelList & zoneIds() const
Return const access to the zone ids.
UnsortedMeshedSurface()
Default construct.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void transfer(UnsortedMeshedSurface< Face > &surf)
Transfer the contents of the argument and annul the argument.
A surface geometry mesh, in which the surface zone information is conveyed by the 'zoneId' associated...
#define DebugInFunction
Report an information message using Foam::Info.
word name(const complex &c)
Return string representation of complex.
const cellModel * lookup(const word &modelName)
Deprecated(2017-11) equivalent to cellModel::ptr static method.
UnsortedMeshedSurface subsetMesh(const UList< bool > &include, labelList &pointMap, labelList &faceMap) const
Return a new surface subsetted on the selected faces.
The IOstreamOption is a simple container for options an IOstream can normally have.
static bool canWriteType(const word &fileType, bool verbose=false)
Can we write this file format? Also checks friend types.
const List< surfZoneIdentifier > & zoneToc() const
Return const access to the zone table-of-contents.
Lookup type of boundary radiation properties.
#define forAllIters(container, iter)
Iterate across all elements in the container object.
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
virtual bool check(const char *operation) const
Check IOstream status for given operation.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
static wordHashSet readTypes()
Known readable file-types, without friends or proxies.
bool read(const fileName &name, const word &fileType)
Read from file with given format type.
errorManipArg< error, int > exit(error &err, const int errNo=1)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
static word defaultName(const label n=-1)
Default zone name: "zone" or "zoneN".
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Input/output from file streams.
FlatOutput< Container > flatOutput(const Container &obj, label len=0)
Global flatOutput function.
void setOneZone()
Set zones to 0 and set a single zone.
virtual void clear()
Clear all storage.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A surface zone on a MeshedSurface.
static bool canRead(const fileName &name, bool verbose=false)
Can we read this file format?
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
static const word null
An empty word.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
HashSet< word > wordHashSet
A HashSet with word keys.
void size(const label n) noexcept
Override size to be inconsistent with allocated storage.
A List with indirect addressing.
virtual void remapFaces(const labelUList &faceMapNewToOld)
Set new zones from faceMap.
Various functions to operate on Lists.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
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.
bool found(const Key &key) const
Return true if hashed entry is found in table.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
static bool canReadType(const word &fileType, bool verbose=false)
Can we read this file format? Also checks friend types.
void swap(MeshedSurface< Face > &surf)=delete
Swap contents - disabled.
static wordHashSet writeTypes()
Known writable file-types, without friends or proxies.
surfZoneList sortedZones(labelList &faceMap) const
Sort faces according to zoneIds.