33 bool Foam::triSurface::readGTS(
const fileName& GTSfileName)
35 IFstream GTSfile(GTSfileName);
40 <<
"Cannot read file " << GTSfileName
47 string line = getLineNoComment(GTSfile);
49 IStringStream lineStream(line);
50 lineStream >> nPoints >> nEdges >> nElems;
60 line = getLineNoComment(GTSfile);
62 IStringStream lineStream(line);
63 lineStream >> x >> y >> z;
65 points_[pointi] =
point(x, y, z);
73 line = getLineNoComment(GTSfile);
75 IStringStream lineStream(line);
76 lineStream >> start >>
end;
78 edges[edgei] = edge(start - 1, end - 1);
85 label e0Label, e1Label, e2Label;
88 line = getLineNoComment(GTSfile);
90 IStringStream lineStream(line);
91 lineStream >> e0Label >> e1Label >> e2Label;
98 if (!lineStream.bad())
109 const edge& e0 =
edges[e0Label - 1];
110 const edge& e1 =
edges[e1Label - 1];
111 const edge& e2 =
edges[e2Label - 1];
113 label common01 = e0.commonVertex(e1);
117 <<
"Edges 0 and 1 of triangle " << trianglei
118 <<
" do not share a point.\n" 119 <<
" edge0:" << e0 <<
endl 124 label e0Far = e0.otherVertex(common01);
125 label e1Far = e1.otherVertex(common01);
127 label common12 = e1.commonVertex(e2);
131 <<
"Edges 1 and 2 of triangle " << trianglei
132 <<
" do not share a point.\n" 133 <<
" edge1:" << e1 <<
endl 137 label e2Far = e2.otherVertex(common12);
140 if ((common12 != e1Far) || (e2Far != e0Far))
143 <<
"Edges of triangle " << trianglei
144 <<
" reference more than three points.\n" 145 <<
" edge0:" << e0 <<
endl 146 <<
" edge1:" << e1 <<
endl 147 <<
" edge2:" << e2 <<
endl 151 operator[](trianglei) = labelledTri(e0Far, common01, e1Far, region);
label nPoints() const
Return number of points supporting patch faces.
#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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
T & operator[](const label)
Return element of UList.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
iterator end()
Return an iterator to end traversing the UList.
vectorField pointField
pointField is a vectorField.
const Field< PointType > & points() const
Return reference to global points.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
label nEdges() const
Return number of edges in patch.
void setSize(const label)
Reset size of List.
vector point
Point is a vector.