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* mfuncPtr = writefileExtensionMemberFunctionTable(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 mfuncPtr(
name, surf, streamOpt, options);
192 zoneIds_(surf.zoneIds()),
193 zoneToc_(surf.zoneToc())
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]];
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);
502 MeshReference::clear();
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();
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);
698 zoneIds_.swap(surf.zoneIds_);
699 zoneToc_.swap(surf.zoneToc_);
701 this->storedZones().clear();
721 zoneIds_.transfer(surf.zoneIds_);
722 zoneToc_.transfer(surf.zoneToc_);
738 MeshReference::transfer(surf);
769 transfer(*
New(
name, fileType));
800 this->storedPoints() = surf.points();
801 this->storedFaces() = surf.surfFaces();
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);
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
Return true if hashed entry is found in table.
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,...
The IOstreamOption is 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 transfer(List< T > &list)
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 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.
List< Face > & storedFaces()
Non-const access to the faces.
virtual void scalePoints(const scalar scaleFactor)
Scale points. A non-positive factor is ignored.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual bool read()
Re-read model coefficients if they have changed.
A List obtained as a section of another List.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
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 the UList 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 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.
static bool canRead(const fileName &name, bool verbose=false)
Can we read this file format?
void setOneZone()
Set zones to 0 and set a single zone.
virtual void clear()
Clear all storage.
friend class UnsortedMeshedSurface
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.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
static word defaultName
The default cloud name: defaultCloud.
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
A class for handling file names.
virtual bool write()
Write the output fields.
Lookup type of boundary radiation properties.
transferModelList & transfer()
Transfer.
Identifies a surface patch/zone by name and index, with optional geometric type.
A surface zone on a MeshedSurface.
A class for handling words, derived from Foam::string.
word ext() const
Return file name extension (part after last .)
word lessExt() const
Return word without extension (part before last .)
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))
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
#define DebugInFunction
Report an information message using Foam::Info.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
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.