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
291 writeHeader(os, zones);
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
376 writeHeader(os, zoneLst);
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)
const word & name() const
Return name.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label size() const
The surface size is the number of faces.
const List< Face > & localFaces() const
Return patch faces addressing into local point list.
A surface zone on a MeshedSurface.
void size(const label)
Override size to be inconsistent with allocated storage.
const List< Face > & faces() const
Return const access to the faces.
bool good() const
Return true if next operation might succeed.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Field< point > & points() const
Return reference to global points.
const List< Face > & faces() const
Return const access to the faces.
const List< surfZone > & surfZones() const
Const access to the surface zones.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
const pointField & points() const
Return const access to the points.
A list of faces which address into the list of points.
A List obtained as a section of another List.
bool read(const char *, int32_t &)
bool useFaceMap() const
Use faceMap?
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
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.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
label start() const
Return start label of this zone in the face list.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats...
label size() const
Return size of this zone in the face list.
word name(const complex &)
Return a string representation of a complex.
#define WarningInFunction
Report a warning using Foam::Warning.
Input from memory buffer stream.
UnsortedMeshedSurface subsetMesh(const labelHashSet &include, labelList &pointMap, labelList &faceMap) const
Return new surface.
Foam::argList args(argc, argv)
A class for handling character strings derived from std::string.
const Field< PointType > & localPoints() const
Return pointField of points in patch.
ISstream & getLine(string &)
Raw, low-level getline into a string function.
surfZoneList sortedZones(labelList &faceMap) const
Sort faces according to zoneIds.