52 const bool mustTriangulate = this->isTri();
59 <<
"Cannot read file " << filename
67 string version = line.substr(4);
72 <<
"When reading AC3D file " << filename
73 <<
" read header " << line <<
" with version " 75 <<
"Only tested reading with version 'b'." 76 <<
" This might give problems" <<
endl;
80 if (!cueTo(is,
"OBJECT", args) || (args !=
"world"))
83 <<
"Cannot find \"OBJECT world\" in file " << filename
88 args = cueToOrDie(is,
"kids");
92 label vertexOffset = 0;
99 for (
label zoneI = 0; zoneI < nZones; ++zoneI)
103 args = cueToOrDie(is,
"OBJECT",
"while reading " + names[zoneI]);
106 label nZonePoints = 0;
118 <<
"Did not read up to \"kids 0\" while reading zone " 119 << zoneI <<
" from file " << filename
126 string str = parse<string>(
args);
127 string::stripInvalid<word>(str);
131 else if (cmd ==
"rot")
143 <<
"rot (rotation tensor) command not implemented" 144 <<
"Line:" << cmd <<
' ' << args <<
endl 145 <<
"while reading zone " << zoneI <<
endl;
147 else if (cmd ==
"loc")
157 else if (cmd ==
"numvert")
160 nZonePoints = parse<int>(
args);
162 for (
label vertI = 0; vertI < nZonePoints; ++vertI)
169 >> pt.
x() >> pt.
y() >> pt.
z();
172 dynPoints.
append(location + pt);
175 else if (cmd ==
"numsurf")
179 for (
label facei = 0; facei < nFaces; ++facei)
181 static string errorMsg =
182 string(
" while reading face ")
185 +
" from file " + filename;
187 cueToOrDie(is,
"SURF", errorMsg);
188 cueToOrDie(is,
"mat", errorMsg);
189 args = cueToOrDie(is,
"refs", errorMsg);
197 verts[vertI] = parse<int>(line) + vertexOffset;
202 if (mustTriangulate && f.size() > 3)
206 for (
label fp1 = 1; fp1 < f.size() - 1; ++fp1)
223 vertexOffset += nZonePoints;
225 else if (cmd ==
"kids")
233 <<
"Can only read objects without kids." 234 <<
" Encountered " << nKids <<
" kids when" 235 <<
" reading zone " << zoneI
246 this->storedPoints().transfer(dynPoints);
247 this->storedFaces().transfer(dynFaces);
250 this->addZones(sizes, names,
true);
251 this->stitchFaces(small);
270 : surfaceFormatsCore::oneZone(faceLst)
278 <<
"output with faceMap is not supported " << filename
287 <<
"Cannot open file for writing " << filename
297 os <<
"OBJECT poly" <<
nl 298 <<
"name \"" << zone.
name() <<
"\"\n";
319 os << pt.
x() <<
' ' << pt.
y() <<
' ' << pt.
z() <<
nl;
328 os <<
"SURF 0x20" <<
nl 329 <<
"mat " << zoneI <<
nl 330 <<
"refs " << f.size() <<
nl;
334 os << f[fp] <<
" 0 0" <<
nl;
338 os <<
"kids 0" <<
endl;
353 if (zoneLst.
size() <= 1)
372 <<
"Cannot open file for writing " << filename
383 os <<
"OBJECT poly" <<
nl 384 <<
"name \"" << zone.
name() <<
"\"\n";
391 const label facei = faceMap[faceIndex++];
392 include.insert(facei);
404 os << pt.
x() <<
' ' << pt.
y() <<
' ' << pt.
z() <<
endl;
413 os <<
"SURF 0x20" <<
nl 414 <<
"mat " << zoneI <<
nl 415 <<
"refs " << f.size() <<
nl;
419 os << f[fp] <<
" 0 0" <<
nl;
423 os <<
"kids 0" <<
endl;
A surface geometry mesh, in which the surface zone information is conveyed by the 'zoneId' associated...
label nPoints() const
Return number of points supporting patch faces.
#define forAll(list, i)
Loop across all elements in list.
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.
const word & name() const
Return name.
A surface zone on a MeshedSurface.
void size(const label)
Override size to be inconsistent with allocated storage.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label size() const
Return size of this zone in the face list.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
bool good() const
Return true if next operation might succeed.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
label size() const
The surface size is the number of faces.
A list of faces which address into the list of points.
bool useFaceMap() const
Use faceMap?
UnsortedMeshedSurface subsetMesh(const labelHashSet &include, labelList &pointMap, labelList &faceMap) const
Return new surface.
A List obtained as a section of another List.
void writeHeader(std::ostream &, const bool isBinary, const std::string &title)
Write header.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
const List< Face > & faces() const
Return const access to the faces.
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.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
const List< surfZone > & surfZones() const
Const access to the surface zones.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats...
word name(const complex &)
Return a string representation of a complex.
const List< Face > & faces() const
Return const access to the faces.
surfZoneList sortedZones(labelList &faceMap) const
Sort faces according to zoneIds.
label start() const
Return start label of this zone in the face list.
ISstream & getLine(string &, const bool continuation=true)
Read line into a string.
#define WarningInFunction
Report a warning using Foam::Warning.
const pointField & points() const
Return const access to the points.
Input from memory buffer stream.
const List< FaceType > & localFaces() const
Return patch faces addressing into local point list.
Foam::argList args(argc, argv)
A class for handling character strings derived from std::string.