43 return wordHashSet(*fileExtensionConstructorTablePtr_);
50 return wordHashSet(*writefileExtensionMemberFunctionTablePtr_);
63 readTypes() | MeshReference::readTypes(),
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);
205 MeshReference(surf.
points(), surf.surfFaces()),
246 MeshReference(std::move(pointLst), std::move(faceLst)),
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)
458 forAll(faceMapNewToOld, facei)
460 newZonesIds[facei] = zoneIds_[faceMapNewToOld[facei]];
462 zoneIds_.transfer(newZonesIds);
470bool Foam::UnsortedMeshedSurface<Face>::readIstream(
Istream& is)
472 is >> this->storedZoneIds()
473 >> this->storedPoints()
474 >> this->storedFaces();
482void Foam::UnsortedMeshedSurface<Face>::writeOstream(
Ostream&
os)
const
484 os << this->zoneIds()
493void Foam::UnsortedMeshedSurface<Face>::setSize(
const label
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 =
568 faceMap.resize(zoneIds_.size());
572 const label zonei =
lookup[zoneIds_[facei]];
573 faceMap[facei] = zoneLst[zonei].start() + zoneLst[zonei].size()++;
582Foam::UnsortedMeshedSurface<Face>
583Foam::UnsortedMeshedSurface<Face>::subsetMeshImpl
589 const pointField& locPoints = this->localPoints();
590 const List<Face>& locFaces = this->localFaces();
596 labelList oldToNew(locPoints.size(), -1);
599 oldToNew[pointMap[pointi]] = pointi;
606 for (
auto&
f : newFaces)
608 for (label& vert :
f)
610 vert = oldToNew[vert];
624 std::move(newPoints),
642 return this->subsetMeshImpl(pointMap,
faceMap);
656 return this->subsetMeshImpl(pointMap,
faceMap);
700 zoneIds_.swap(surf.zoneIds_);
701 zoneToc_.swap(surf.zoneToc_);
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>
839Foam::Istream& Foam::operator>>
845 surf.readIstream(is);
851Foam::Ostream& Foam::operator<<
857 surf.writeOstream(
os);
Various functions to operate on Lists.
const T & lookup(const Key &key, const T &deflt) const
Return hashed entry if it exists, or return the given default.
bool found(const Key &key) const
Same as contains().
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A simple container for options an IOstream can normally have.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void clear()
Clear the list, i.e. set size to zero.
A HashTable to objects of type <T> with a label key.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats.
static wordHashSet writeTypes()
The file format types that can be written via MeshedSurfaceProxy.
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 surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
surfZoneList & storedZones()
Non-const access to the zones.
const surfZoneList & surfZones() const
Const access to the surface zones.
pointField & storedPoints()
Non-const access to global points.
void transfer(pointField &pointLst, List< Face > &faceLst)
Transfer the components.
const List< Face > & surfFaces() const
Return const access to the faces.
List< Face > & storedFaces()
Non-const access to the faces.
virtual void clear()
Clear all storage.
virtual void scalePoints(const scalar scaleFactor)
Scale points. A non-positive factor is ignored.
virtual void removeZones()
Remove surface zones.
static wordHashSet readTypes()
Known readable file-types, without friends or proxies.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
const Field< point_type > & points() const noexcept
A non-owning sub-view of a List (allocated or unallocated storage).
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A List with indirect addressing. Like IndirectList but does not store addressing.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
bool empty() const noexcept
True if List is empty (ie, size() is zero).
void size(const label n)
Older name for setAddressableSize.
A surface geometry mesh, in which the surface zone information is conveyed by the 'zoneId' associated...
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.
static bool canWriteType(const word &fileType, bool verbose=false)
Can we write this file format? Also checks friend types.
autoPtr< labelList > releaseZoneIds()
Release (clear) stored zoneIds and return for reuse.
surfZoneList sortedZones(labelList &faceMap) const
Sort faces according to zoneIds.
static wordHashSet writeTypes()
Known writable file-types, without friends or proxies.
virtual void remapFaces(const labelUList &faceMapNewToOld)
Set new zones from faceMap.
void setZones(const surfZoneList &zoneLst)
Set zone ids and zones.
static bool canReadType(const word &fileType, bool verbose=false)
Can we read this file format? Also checks friend types.
void transfer(UnsortedMeshedSurface< Face > &surf)
Transfer the contents of the argument and annul the argument.
bool read(const fileName &name, const word &fileType)
Read from file with given format type.
virtual const labelList & zoneIds() const
Return const access to the zone ids.
labelList & storedZoneIds()
Return non-const access to the zone Ids.
static bool canRead(const fileName &name, bool verbose=false)
Can we read this file format?
label size() const
The surface size is the number of faces.
void subsetMeshMap(const BoolListType &include, labelList &pointMap, labelList &faceMap) const
Create mappings for a sub-surface.
void setOneZone()
Set zones to 0 and set a single zone.
virtual void clear()
Clear all storage.
friend class UnsortedMeshedSurface
friend class MeshedSurface
const List< surfZoneIdentifier > & zoneToc() const
Return const access to the zone table-of-contents.
void swap(MeshedSurface< Face > &surf)=delete
Swap contents - disabled.
UnsortedMeshedSurface subsetMesh(const UList< bool > &include, labelList &pointMap, labelList &faceMap) const
Return a new surface subsetted on the selected faces.
static wordHashSet readTypes()
Known readable file-types, without friends or proxies.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
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...
A class for handling file names.
Lookup type of boundary radiation properties.
Identifies a surface patch/zone by name and index, with optional geometric type.
static word defaultName(const label n=-1)
Default zone name: "zone" or "zoneN".
A surface zone on a MeshedSurface.
A class for handling words, derived from Foam::string.
static const word null
An empty word.
Base class for mesh zones.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
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))
#define DebugInFunction
Report an information message using Foam::Info.
List< label > sortedToc(const UList< bool > &bools)
Return the (sorted) values corresponding to 'true' entries.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
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.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
bool read(const char *buf, int32_t &val)
Same as readInt32.
List< label > labelList
A List of labels.
List< surfZone > surfZoneList
List of surfZone.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
UList< label > labelUList
A UList of labels.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.
#define forAllIters(container, iter)
Iterate across all elements in the container object.