Go to the documentation of this file.
49 if (readTypes_.
empty())
51 readTypes_ = {
"ftr",
"stl",
"stlb" };
63 if (writeTypes_.empty())
65 writeTypes_ = {
"ftr",
"stl",
"stlb",
"gts" };
104 return canReadType(ext, verbose);
109 void Foam::triSurface::printTriangle
118 << pre.c_str() <<
"vertex numbers:"
119 <<
f[0] <<
' ' <<
f[1] <<
' ' <<
f[2] <<
endl
120 << pre.c_str() <<
"vertex coords :"
122 << pre.c_str() <<
"region :" <<
f.region() <<
endl
127 bool Foam::triSurface::read(Istream& is)
130 is >> patches_ >> storedPoints() >> storedFaces();
136 bool Foam::triSurface::read
138 const fileName&
name,
154 return read(unzipName, unzipName.ext(),
false);
162 else if (ext ==
"stl")
164 return readSTL(
name);
166 else if (ext ==
"stlb")
168 return readSTL(
name,
true);
173 using proxyType = UnsortedMeshedSurface<labelledTri>;
174 if (proxyType::readTypes().
found(ext))
183 using proxyType = MeshedSurface<labelledTri>;
184 if (proxyType::readTypes().
found(ext))
193 <<
"unknown file extension " << ext
194 <<
" for reading file " <<
name
195 <<
". Supported extensions:" <<
nl
203 void Foam::triSurface::write
205 const fileName&
name,
217 else if (ext ==
"stl")
221 else if (ext ==
"stlb")
223 writeSTLBINARY(
name);
225 else if (ext ==
"gts")
232 List<surfZone> zoneLst = this->sortedZones(
faceMap);
234 MeshedSurfaceProxy<labelledTri> proxy
242 proxy.write(
name, ext);
247 <<
"unknown file extension " << ext
248 <<
" for writing file " <<
name
249 <<
". Supported extensions:" <<
nl
262 sortedEdgeFacesPtr_(nullptr),
263 edgeOwnerPtr_(nullptr)
275 sortedEdgeFacesPtr_(nullptr),
276 edgeOwnerPtr_(nullptr)
292 void Foam::triSurface::write
295 const bool sortByRegion
302 void Foam::triSurface::write(
Ostream& os)
const
315 void Foam::triSurface::write(
const Time& d)
const
319 fileName foamPath(d.
path()/triSurfInstance(d)/typeName/foamFile);
339 regionsUsed.
insert(
f.region());
343 const label pointi =
f[fp];
344 if (pointIsUsed.
set(pointi))
352 os <<
"Triangles : " << size()
353 <<
" in " << regionsUsed.
size() <<
" region(s)" <<
nl
355 <<
"Bounding Box : " << bb <<
endl;
365 sm.setDefaultPatches();
void writeStats(Ostream &os) const
Write some statistics.
word lessExt() const
Return word without extension (part before last .)
List< label > labelList
A List of labels.
label size() const noexcept
The number of elements in table.
bool exists(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist (as DIRECTORY or FILE) in the file system?
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)
A class for handling words, derived from Foam::string.
A class for handling file names.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
static const wordHashSet & writeTypes()
Known writable file-types.
Input from file stream, using an ISstream.
static const boundBox invertedBox
A large inverted boundBox: min/max == +/- ROOTVGREAT.
bool read(const char *buf, int32_t &val)
Same as readInt32.
static bool canWriteType(const word &ext, const bool verbose=false)
Can this file format type be written via MeshedSurfaceProxy?
void set(const bitSet &bitset)
Set specified bits from another bitset.
Istream & operator>>(Istream &, directionInfo &)
Ostream & endl(Ostream &os)
Add newline and flush stream.
word ext() const
Return file name extension (part after last .)
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Triangulated surface description with patch information.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
word name(const complex &c)
Return string representation of complex.
static bool canWriteType(const word &ext, const bool verbose=false)
Can we write this file format?
triSurface()
Construct null.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
static wordHashSet readTypes()
Known readable file-types.
static wordHashSet readTypes()
Known readable file-types.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Output to file stream, using an OSstream.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
static wordHashSet writeTypes()
The file format types that can be written via MeshedSurfaceProxy.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const fileName & caseName() const
Return case name.
fileName path() const
Return path.
Input/output from file streams.
FlatOutput< Container > flatOutput(const Container &obj, label len=0)
Global flatOutput function.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
const polyBoundaryMesh & patches
Triangle with additional region number.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
A bounding box defined in terms of min/max extrema points.
static bool canReadType(const word &ext, const bool verbose=false)
Can we read this file format?
static bool canRead(const fileName &name, const bool verbose=false)
Can we read this file format?
static const wordHashSet & readTypes()
Known readable file-types.
bool empty() const noexcept
True if the hash table is empty.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Ostream & operator<<(Ostream &, const boundaryPatch &)
static fileName triSurfInstance(const Time &)
Name of triSurface directory to use.
void add(const boundBox &bb)
Extend to include the second box.