61 "fileFormats::GTSsurfaceFormat::read(const fileName&)" 63 <<
"Cannot read file " << filename
68 string line = this->getLineNoComment(is);
93 line = this->getLineNoComment(is);
100 pointLst[pointI] =
point(x, y, z);
108 line = this->getLineNoComment(is);
114 edges[edgei] =
edge(beg - 1, end - 1);
122 label e0Label, e1Label, e2Label;
125 line = this->getLineNoComment(is);
129 >> e0Label >> e1Label >> e2Label;
136 if (!lineStream.
bad())
151 const edge& e0 = edges[e0Label - 1];
152 const edge& e1 = edges[e1Label - 1];
153 const edge& e2 = edges[e2Label - 1];
160 "fileFormats::GTSsurfaceFormat::read(const fileName&)" 162 <<
"Edges 0 and 1 of triangle " << faceI
163 <<
" do not share a point.\n" 164 <<
" edge0:" << e0 <<
nl 177 "fileFormats::GTSsurfaceFormat::read(const fileName&)" 179 <<
"Edges 1 and 2 of triangle " << faceI
180 <<
" do not share a point.\n" 181 <<
" edge1:" << e1 <<
nl 188 if (common12 != e1Far || e2Far != e0Far)
192 "fileFormats::GTSsurfaceFormat::read(const fileName&)" 194 <<
"Edges of triangle " << faceI
195 <<
" reference more than three points.\n" 196 <<
" edge0:" << e0 <<
nl 197 <<
" edge1:" << e1 <<
nl 198 <<
" edge2:" << e2 <<
nl 202 faceLst[faceI] =
triFace(e0Far, common01, e1Far);
203 zoneIds[faceI] = zoneI;
217 this->storedZoneToc().transfer(newZones);
237 : surfaceFormatsCore::oneZone(faceLst)
248 if (faceLst[faceI].size() != 3)
258 "fileFormats::GTSsurfaceFormat::write" 259 "(const fileName&, const MeshedSurface<Face>&)" 261 <<
"Surface has " << nNonTris <<
"/" << faceLst.
size()
262 <<
" non-triangulated faces - not writing!" <<
endl;
273 "fileFormats::GTSsurfaceFormat::write" 274 "(const fileName&, const MeshedSurface<Face>&)" 276 <<
"Cannot open file for writing " << filename
282 os <<
"# GTS file" <<
nl 287 os <<
"# " << zoneI <<
" " 288 << zones[zoneI].name() <<
nl;
292 os <<
"# nPoints nEdges nTriangles" << nl
293 << pointLst.
size() <<
' ' << surf.
nEdges() <<
' ' 300 const point& pt = pointLst[pointI];
302 os << pt.
x() <<
' ' << pt.
y() <<
' ' << pt.
z() <<
nl;
313 os << meshPts[es[edgei].start()] + 1 <<
' ' 314 << meshPts[es[edgei].
end()] + 1 <<
endl;
327 const labelList& fEdges = faceEs[faceIndex++];
329 os << fEdges[0] + 1 <<
' ' 330 << fEdges[1] + 1 <<
' ' 331 << fEdges[2] + 1 <<
' ' 358 if (faceLst[faceI].size() != 3)
368 "fileFormats::GTSsurfaceFormat::write" 369 "(const fileName&, const UnsortedMeshedSurfaces<Face>&)" 371 <<
"Surface has " << nNonTris <<
"/" << faceLst.
size()
372 <<
" non-triangulated faces - not writing!" <<
endl;
383 "fileFormats::GTSsurfaceFormat::write" 384 "(const fileName&, const UnsortedMeshedSurface<Face>&)" 386 <<
"Cannot open file for writing " << filename
392 os <<
"# GTS file" <<
nl 397 os <<
"# " << zoneI <<
" " 398 << zoneToc[zoneI].name() <<
nl;
403 os <<
"# nPoints nEdges nTriangles" << nl
404 << pointLst.
size() <<
' ' << surf.
nEdges() <<
' ' 411 os << pointLst[pointI].x() <<
' ' 412 << pointLst[pointI].y() <<
' ' 413 << pointLst[pointI].z() <<
endl;
424 os << meshPts[es[edgeI].start()] + 1 <<
' ' 425 << meshPts[es[edgeI].
end()] + 1 <<
endl;
436 os << fEdges[0] + 1 <<
' ' 437 << fEdges[1] + 1 <<
' ' 438 << fEdges[2] + 1 <<
' ' 439 << zoneIds[faceI] <<
endl;
Input from memory buffer stream.
iterator end()
Return an iterator to end traversing the UList.
const List< surfZoneIdentifier > & zoneToc() const
Return const access to the zone table-of-contents.
vector point
Point is a vector.
const List< surfZone > & surfZones() const
Const access to the surface zones.
label commonVertex(const edge &a) const
Return common vertex.
word name(const complex &)
Return a string representation of a complex.
bool bad() const
Return true if stream is corrupted.
const List< label > & zoneIds() const
Return const access to the zone ids.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void size(const label)
Override size to be inconsistent with allocated storage.
Provide a means of reading/writing GTS format. The output is never sorted by zone and is only written...
errorManipArg< error, int > exit(error &err, const int errNo=1)
static void write(const fileName &, const MeshedSurface< Face > &)
Write MeshedSurface.
label size() const
The surface size is the number of faces.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
An identifier for a surface zone on a meshed surface.
void setSize(const label)
Reset size of List.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const List< Face > & faces() const
Return const access to the faces.
label size() const
The surface size is the number of faces.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
bool good() const
Return true if next operation might succeed.
label otherVertex(const label a) const
Given one vertex, return the other.
A surface zone on a MeshedSurface.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
A surface geometry mesh, in which the surface zone information is conveyed by the 'zoneId' associated...
A class for handling file names.
const labelListList & faceEdges() const
Return face-edge addressing.
virtual bool read(const fileName &)
Read from file.
A surface geometry mesh with zone information, not to be confused with the similarly named surfaceMes...
bool read(const char *, int32_t &)
label nEdges() const
Return number of edges in patch.
const Field< point > & points() const
Return reference to global points.