Go to the documentation of this file.
31 #include "triSurface.H"
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
125 IFstream ACfile(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;
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);
221 <<
"rot (rotation tensor) command not implemented"
222 <<
"Line:" << cmd <<
' ' <<
args <<
endl
223 <<
"while reading patch " << patchI <<
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++)
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 ")
257 +
name(triI) +
" on patch " +
name(patchI)
258 +
" from file " + ACfileName;
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
320 geometricSurfacePatch
vectorField pointField
pointField is a vectorField.
const Field< point > & points() const
Return reference to global points.
Tensor< scalar > tensor
Tensor of scalars.
List< geometricSurfacePatch > geometricSurfacePatchList
static bool readCmd(IFstream &ACfile, string &cmd, string &args)
Ostream & endl(Ostream &os)
Add newline and flush stream.
const geometricSurfacePatchList & patches() const
static label parseInt(const string &str)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
ISstream & getLine(string &)
Raw, low-level getline into a string function.
static bool readUpto(const string &cmd, IFstream &ACfile, string &args)
triSurface()
Construct null.
graph_traits< Graph >::vertices_size_type size_type
static const sphericalTensor I(1)
Input from memory buffer stream.
bool readAC(const fileName &)
Vector< scalar > vector
A scalar version of the templated Vector.
errorManipArg< error, int > exit(error &err, const int errNo=1)
label size() const
Return the number of elements in the UList.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool stitchTriangles(const pointField &rawPoints, const scalar tol=SMALL, const bool verbose=false)
Function to stitch the triangles by removing duplicate points.
vector point
Point is a vector.
bool good() const
Return true if next operation might succeed.
Foam::argList args(argc, argv)
#define WarningInFunction
Report a warning using Foam::Warning.
word name(const complex &)
Return a string representation of a complex.