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

Function read

src/surfMesh/surfaceFormats/tri/TRIsurfaceFormatCore.C:56–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
55
56bool Foam::fileFormats::TRIsurfaceFormatCore::read
57(
58 const fileName& filename
59)
60{
61 this->clear();
62 sorted_ = true;
63
64 IFstream is(filename);
65 if (!is.good())
66 {
67 FatalErrorInFunction
68 << "Cannot read file " << filename
69 << exit(FatalError);
70 }
71
72 // uses similar structure as STL, just some points
73 // the rest of the reader resembles the STL binary reader
74 DynamicList<point> dynPoints;
75 DynamicList<label> dynZones;
76 DynamicList<label> dynSizes;
77 HashTable<label> lookup;
78
79 // place faces without a group in zone0
80 label zoneI = 0;
81 dynSizes.append(zoneI);
82 lookup.insert("zoneI", zoneI);
83
84 while (is.good())
85 {
86 string line = this->getLineNoComment(is);
87
88 // handle continuations ?
89 // if (line[line.size()-1] == '\\')
90 // {
91 // line.substr(0, line.size()-1);
92 // line += this->getLineNoComment(is);
93 // }
94
95 IStringStream lineStream(line);
96
97 point p
98 (
99 readScalar(lineStream),
100 readScalar(lineStream),
101 readScalar(lineStream)
102 );
103
104 if (!lineStream) break;
105
106 dynPoints.append(p);
107 dynPoints.append
108 (
109 point
110 (
111 readScalar(lineStream),
112 readScalar(lineStream),
113 readScalar(lineStream)

Callers 14

TRIsurfaceFormat.CFile · 0.70
MeshedSurface.CFile · 0.50
NASsurfaceFormat.CFile · 0.50
OFFsurfaceFormat.CFile · 0.50
OFSsurfaceFormat.CFile · 0.50
STLtriangleMethod · 0.50
STLsurfaceFormat.CFile · 0.50
OBJsurfaceFormat.CFile · 0.50
VTKsurfaceFormat.CFile · 0.50

Calls 12

pointClass · 0.85
exitFunction · 0.50
readScalarFunction · 0.50
forAllFunction · 0.50
clearMethod · 0.45
goodMethod · 0.45
appendMethod · 0.45
insertMethod · 0.45
sizeMethod · 0.45
endMethod · 0.45
setCapacityMethod · 0.45
transferMethod · 0.45

Tested by

no test coverage detected