65 if (space != string::npos)
67 cmd = line.substr(0, space);
68 args = line.substr(space+1);
93 if (space != string::npos && line.substr(0, space) == cmd)
95 args = line.substr(space+1);
109 const string errorMsg
115 <<
"Cannot find command " << cmd
123 bool triSurface::readAC(
const fileName& ACfileName)
130 <<
"Cannot read file " << ACfileName
137 string version = line.substr(4);
142 <<
"When reading AC3D file " << ACfileName
143 <<
" read header " << line <<
" with version " << version
144 <<
endl <<
"Only tested reading with version 'b'." 145 <<
" This might give problems" <<
endl;
152 if (!
readUpto(
"OBJECT", ACfile, args) || (args !=
"world"))
155 <<
"Cannot find \"OBJECT world\" in file " << ACfileName
173 label patchStartVert = 0;
192 while (ACfile.
good())
196 if (!
readCmd(ACfile, cmd, args))
199 <<
"Did not read up to \"kids 0\" while reading patch " 200 <<
patchi <<
" from file " << ACfileName
208 nameStream >> patchName;
210 else if (cmd ==
"rot")
216 >> rot.
xx() >> rot.
xy() >> rot.
xz()
217 >> rot.
yx() >> rot.
yy() >> rot.
yz()
218 >> rot.
zx() >> rot.
zy() >> rot.
zz();
221 <<
"rot (rotation tensor) command not implemented" 222 <<
"Line:" << cmd <<
' ' << args <<
endl 225 else if (cmd ==
"loc")
229 lineStream >> loc.
x() >> loc.
y() >> loc.
z();
231 else if (cmd ==
"numvert")
235 for (
label vertI = 0; vertI < nVerts; vertI++)
243 lineStream >> pt.
x() >> pt.
y() >> pt.
z();
249 else if (cmd ==
"numsurf")
253 for (
label triI = 0; triI < nTris; triI++)
255 static string errorMsg =
256 string(
" while reading face ")
258 +
" from file " + ACfileName;
260 readUpto(
"SURF", ACfile, args, errorMsg);
261 readUpto(
"mat", ACfile, args, errorMsg);
262 readUpto(
"refs", ACfile, args, errorMsg);
269 <<
"Can only read surfaces with 3 vertices." 271 <<
"Detected " << size <<
" when reading triangle " 272 << triI <<
" of patch " <<
patchi 302 patchStartVert += nVerts;
304 else if (cmd ==
"kids")
313 <<
"Can only read objects without kids." 314 <<
" Encountered " << nKids <<
" kids when" 315 <<
" reading patch " <<
patchi 338 *
this =
triSurface(faces, patches, allPoints,
true);
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static label parseInt(const string &str)
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool good() const
Return true if next operation might succeed.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
static const Identity< scalar > I
A class for handling words, derived from string.
static bool readCmd(IFstream &ACfile, string &cmd, string &args)
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
const Field< PointType > & points() const
Return reference to global points.
Triangle with additional region number.
graph_traits< Graph >::vertices_size_type size_type
static bool readUpto(const string &cmd, IFstream &ACfile, string &args)
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
word name(const complex &)
Return a string representation of a complex.
const geometricSurfacePatchList & patches() const
ISstream & getLine(string &, const bool continuation=true)
Read line into a string.
triSurface()
Construct null.
#define WarningInFunction
Report a warning using Foam::Warning.
Input from memory buffer stream.
The geometricSurfacePatch is like patchIdentifier but for surfaces. Holds type, name and index...
faceList faces() const
Return the list of triangles as a faceList.
Foam::argList args(argc, argv)
A class for handling character strings derived from std::string.
label size() const
Return the number of elements in the UList.