65 if (space != string::npos)
67 cmd =
line.substr(0, space);
93 if (space != string::npos &&
line.substr(0, space) == cmd)
109 const string errorMsg
115 <<
"Cannot find command " << cmd
123 bool triSurface::readAC(
const fileName& ACfileName)
125 IFstream ACfile(ACfileName);
130 <<
"Cannot read file " << ACfileName
135 ACfile.getLine(line);
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;
155 <<
"Cannot find \"OBJECT world\" in file " << ACfileName
167 DynamicList<point>
points;
168 DynamicList<labelledTri>
faces;
173 label patchStartVert = 0;
186 string patchName = string(
"patch") +
name(
patchi);
192 while (ACfile.good())
199 <<
"Did not read up to \"kids 0\" while reading patch "
200 <<
patchi <<
" from file " << ACfileName
206 IStringStream nameStream(
args);
208 nameStream >> patchName;
210 else if (cmd ==
"rot")
213 IStringStream lineStream(
args);
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")
227 IStringStream lineStream(
args);
229 lineStream >> loc.x() >> loc.y() >> loc.z();
231 else if (cmd ==
"numvert")
235 for (
label vertI = 0; vertI < nVerts; vertI++)
237 ACfile.getLine(line);
239 IStringStream lineStream(line);
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;
269 <<
"Can only read surfaces with 3 vertices."
271 <<
"Detected " <<
size <<
" when reading triangle "
272 << triI <<
" of patch " <<
patchi
276 ACfile.getLine(line);
280 ACfile.getLine(line);
284 ACfile.getLine(line);
302 patchStartVert += nVerts;
304 else if (cmd ==
"kids")
313 <<
"Can only read objects without kids."
314 <<
" Encountered " << nKids <<
" kids when"
315 <<
" reading patch " <<
patchi
320 geometricSurfacePatch
graph_traits< Graph >::vertices_size_type size_type
bool good() const
Return true if next operation might succeed.
ISstream & getLine(string &, const bool continuation=true)
Read line into a string.
Input from memory buffer stream.
void append(const T &)
Append an element at the end of the list.
label size() const
Return the number of elements in the UList.
const Field< PointType > & points() const
Return reference to global points.
triSurface()
Construct null.
const geometricSurfacePatchList & patches() const
faceList faces() const
Return the list of triangles as a faceList.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Tensor< scalar > tensor
Tensor of scalars.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
List< geometricSurfacePatch > geometricSurfacePatchList
static label parseInt(const string &str)
vectorField pointField
pointField is a vectorField.
static const Identity< scalar > I
vector point
Point is a vector.
Vector< scalar > vector
A scalar version of the templated Vector.
static bool readCmd(IFstream &ACfile, string &cmd, string &args)
static bool readUpto(const string &cmd, IFstream &ACfile, string &args)
Foam::argList args(argc, argv)