39 bool triSurface::readGTS(
const fileName& GTSfileName)
41 IFstream GTSfile(GTSfileName);
46 <<
"Cannot read file " << GTSfileName
53 string line = getLineNoComment(GTSfile);
55 IStringStream lineStream(line);
56 lineStream >> nPoints >> nEdges >> nElems;
66 line = getLineNoComment(GTSfile);
68 IStringStream lineStream(line);
69 lineStream >> x >> y >> z;
71 points_[pointi] =
point(x, y, z);
79 line = getLineNoComment(GTSfile);
81 IStringStream lineStream(line);
82 lineStream >> start >>
end;
84 edges[edgei] = edge(start - 1, end - 1);
91 label e0Label, e1Label, e2Label;
94 line = getLineNoComment(GTSfile);
96 IStringStream lineStream(line);
97 lineStream >> e0Label >> e1Label >> e2Label;
104 if (!lineStream.bad())
115 const edge& e0 =
edges[e0Label - 1];
116 const edge& e1 =
edges[e1Label - 1];
117 const edge& e2 =
edges[e2Label - 1];
119 label common01 = e0.commonVertex(e1);
123 <<
"Edges 0 and 1 of triangle " << trianglei
124 <<
" do not share a point.\n"
125 <<
" edge0:" << e0 <<
endl
130 label e0Far = e0.otherVertex(common01);
131 label e1Far = e1.otherVertex(common01);
133 label common12 = e1.commonVertex(e2);
137 <<
"Edges 1 and 2 of triangle " << trianglei
138 <<
" do not share a point.\n"
139 <<
" edge1:" << e1 <<
endl
143 label e2Far = e2.otherVertex(common12);
146 if ((common12 != e1Far) || (e2Far != e0Far))
149 <<
"Edges of triangle " << trianglei
150 <<
" reference more than three points.\n"
151 <<
" edge0:" << e0 <<
endl
152 <<
" edge1:" << e1 <<
endl
153 <<
" edge2:" << e2 <<
endl
157 operator[](trianglei) = labelledTri(e0Far, common01, e1Far, region);