39 const UList<point>&
pts,
45 triPointRef::unitNormal(
pts[
f[0]],
pts[
f[1]],
pts[
f[2]]);
51 for (label fp1 = 1; fp1 <
f.size() - 1; ++fp1)
53 const label fp2 =
f.fcIndex(fp1);
72 const UList<point>&
pts,
79 triPointRef::unitNormal(
pts[
f[0]],
pts[
f[1]],
pts[
f[2]]);
85 for (label fp1 = 1; fp1 <
f.size() - 1; ++fp1)
87 const label fp2 =
f.fcIndex(fp1);
133 const auto& readpts = reader.
points();
137 pointLst.
setSize(nUniquePoints);
140 pointLst[pointMap[pointi]] = readpts[pointi];
156 const label startPt = 3*facei;
157 faceLst[facei] = Face
174 const label startPt = 3*
faceMap[facei];
175 faceLst[facei] = Face
186 this->storedFaces().transfer(faceLst);
190 this->addZones(sizes,
names);
194 this->addZones(sizes);
196 this->addZonesToFaces();
214 <<
"Cannot write file " << filename <<
nl 225 ? surfaceFormatsCore::oneZone(faceLst)
236 for (label nLocal =
zone.
size(); nLocal--; ++faceIndex)
239 (useFaceMap ?
faceMap[faceIndex] : faceIndex);
241 const Face&
f = faceLst[facei];
243 writeShell(
os, pointLst,
f);
257 std::ofstream
os(filename, std::ios::binary);
261 <<
"Cannot write file " << filename <<
nl 265 const UList<point>& pointLst = surf.
points();
266 const UList<Face>& faceLst = surf.
surfFaces();
273 : surfaceFormatsCore::oneZone(faceLst)
276 const bool useFaceMap = (surf.
useFaceMap() && zones.size() > 1);
280 STLCore::writeBinaryHeader(
os, nTris);
284 for (
const surfZone& zone : zones)
286 for (label nLocal = zone.size(); nLocal--; ++faceIndex)
289 (useFaceMap ?
faceMap[faceIndex] : faceIndex);
291 const Face&
f = faceLst[facei];
293 writeShell(
os, pointLst,
f, zoneIndex);
313 if (surf.
zoneToc().size() == 1)
319 <<
"Cannot write file " << filename <<
nl 324 for (
const Face&
f : faceLst)
326 writeShell(
os, pointLst,
f);
328 os <<
"endsolid " << surf.
zoneToc()[0].name() <<
nl;
338 MeshedSurfaceProxy<Face>
358 std::ofstream
os(filename, std::ios::binary);
362 <<
"Cannot write file " << filename <<
nl 367 const UList<Face>& faceLst = surf.
surfFaces();
368 const UList<label>& zoneIds = surf.
zoneIds();
372 STLCore::writeBinaryHeader(
os, nTris);
399 streamOpt.
format() == IOstreamOption::BINARY
401 || STLCore::isBinaryName(filename, STLCore::UNKNOWN)
404 writeBinary(filename, surf);
422 if (STLCore::isBinaryName(filename,
format))
424 writeBinary(filename, surf);
428 writeAscii(filename, surf, comp);
444 streamOpt.
format() == IOstreamOption::BINARY
446 || STLCore::isBinaryName(filename, STLCore::UNKNOWN)
449 writeBinary(filename, surf);
467 if (STLCore::isBinaryName(filename,
format))
469 writeBinary(filename, surf);
473 writeAscii(filename, surf, comp);
A surface geometry mesh, in which the surface zone information is conveyed by the 'zoneId' associated...
label nTriangles() const
Count number of triangles.
void size(const label n)
Older name for setAddressableSize.
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)
compressionType
Compression treatment (UNCOMPRESSED | COMPRESSED)
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.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
Output to file stream, using an OSstream.
A surface zone on a MeshedSurface.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
A simple container for options an IOstream can normally have.
const UList< surfZone > & surfZones() const
Const access to the surface zones.
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.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
bool useFaceMap() const
Can/should use faceMap?
vectorField pointField
pointField is a vectorField.
void setSize(const label n)
Alias for resize()
Base class for mesh zones.
void clear()
Clear the list, i.e. set size to zero.
const Field< point_type > & points() const noexcept
Return reference to global points.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
const List< Face > & surfFaces() const
Return const access to the faces.
virtual const labelList & zoneIds() const
Return const access to the zone ids.
OBJstream os(runTime.globalPath()/outputName)
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats...
compressionType compression() const noexcept
Get the stream compression.
const List< surfZoneIdentifier > & zoneToc() const
Return const access to the zone table-of-contents.
surfZoneList sortedZones(labelList &faceMap) const
Sort faces according to zoneIds.
word format(conversionProperties.get< word >("format"))
virtual label nTriangles() const
Count number of triangles.
const labelUList & faceMap() const
Const access to the faceMap, zero-sized when unused.
vector point
Point is a vector.
const pointField & points() const
Return const access to the points.
const word & name() const noexcept
The zone name.
List< surfZone > surfZoneList
List of surfZone.
List< label > labelList
A List of labels.
streamFormat format() const noexcept
Get the current stream format.
const volScalarField & p0
const UList< Face > & surfFaces() const
Return const access to the faces.