MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / read

Function read

src/meshTools/edgeMesh/edgeMeshFormats/obj/OBJedgeFormat.C:97–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95
96
97bool Foam::fileFormats::OBJedgeFormat::read(const fileName& filename)
98{
99 clear();
100
101 IFstream is(filename);
102 if (!is.good())
103 {
104 FatalErrorInFunction
105 << "Cannot read file " << filename
106 << exit(FatalError);
107 }
108
109 DynamicList<point> dynPoints;
110 DynamicList<edge> dynEdges;
111 DynamicList<label> dynUsedPoints;
112
113 DynamicList<label> dynVertices;
114
115 while (is.good())
116 {
117 string line = this->getLineNoComment(is);
118
119 // handle continuations
120 if (line[line.size()-1] == '\\')
121 {
122 line.substr(0, line.size()-1);
123 line += this->getLineNoComment(is);
124 }
125
126 // Read first word
127 IStringStream lineStream(line);
128 word cmd;
129 lineStream >> cmd;
130
131 if (cmd == "v")
132 {
133 scalar x, y, z;
134 lineStream >> x >> y >> z;
135
136 dynPoints.append(point(x, y, z));
137 dynUsedPoints.append(-1);
138 }
139 else if (cmd == "l")
140 {
141 // Assume 'l' is followed by space.
142 string::size_type endNum = 1;
143
144 readVertices
145 (
146 line,
147 endNum,
148 dynVertices
149 );
150
151
152 for (label i = 1; i < dynVertices.size(); i++)
153 {
154 edge edgeRead(dynVertices[i-1], dynVertices[i]);

Callers 1

OBJedgeFormat.CFile · 0.70

Calls 10

pointClass · 0.85
readVerticesFunction · 0.85
clearFunction · 0.50
exitFunction · 0.50
forAllFunction · 0.50
goodMethod · 0.45
sizeMethod · 0.45
appendMethod · 0.45
setSizeMethod · 0.45
transferMethod · 0.45

Tested by

no test coverage detected