Go to the documentation of this file.
61 <<
"Cannot read file " << filename <<
nl
76 <<
"When reading AC3D file " << filename
77 <<
" read header " <<
line <<
" with version "
79 <<
"Only tested reading with version 'b'."
80 <<
" This might give problems" <<
endl;
85 if (!cueTo(is,
"OBJECT",
args) ||
args !=
"world")
88 <<
"Cannot find 'OBJECT world' in file " << filename <<
nl
93 args = cueToOrDie(is,
"kids");
97 label vertexOffset = 0;
104 for (label zoneI = 0; zoneI <
nZones; ++zoneI)
108 args = cueToOrDie(is,
"OBJECT",
"while reading " + names[zoneI]);
111 label nZonePoints = 0;
120 if (!readCmd(is, cmd,
args))
123 <<
"Did not read up to 'kids 0' while reading zone "
124 << zoneI <<
" from file " << filename <<
nl
131 const string str = parse<string>(
args);
134 else if (cmd ==
"rot")
146 <<
"rot (rotation tensor) command not implemented"
147 <<
"Line:" << cmd <<
' ' <<
args <<
endl
148 <<
"while reading zone " << zoneI <<
endl;
150 else if (cmd ==
"loc")
160 else if (cmd ==
"numvert")
163 nZonePoints = parse<int>(
args);
165 for (label vertI = 0; vertI < nZonePoints; ++vertI)
172 >> pt.
x() >> pt.
y() >> pt.
z();
175 dynPoints.
append(location + pt);
178 else if (cmd ==
"numsurf")
180 const label nFaces = parse<int>(
args);
182 for (label facei = 0; facei < nFaces; ++facei)
184 const string errorMsg =
185 string(
" while reading face ")
188 +
" from file " + filename;
190 cueToOrDie(is,
"SURF", errorMsg);
191 cueToOrDie(is,
"mat", errorMsg);
192 args = cueToOrDie(is,
"refs", errorMsg);
194 const label nVert = parse<int>(
args);
200 verts[vertI] = vertexOffset + parse<int>(
line);
209 for (label fp1 = 1; fp1 <
f.size() - 1; ++fp1)
211 label fp2 =
f.fcIndex(fp1);
213 dynFaces.
append(Face{
f[0],
f[fp1],
f[fp2]});
226 vertexOffset += nZonePoints;
228 else if (cmd ==
"kids")
231 const label nKids = parse<int>(
args);
236 <<
"Can only read objects without kids."
237 <<
" Encountered " << nKids <<
" kids when"
238 <<
" reading zone " << zoneI
249 this->storedPoints().transfer(dynPoints);
250 this->storedFaces().transfer(dynFaces);
253 this->addZones(sizes, names);
254 this->addZonesToFaces();
255 this->stitchFaces(SMALL);
264 template<
class Patch>
274 os <<
"OBJECT poly" <<
nl
275 <<
"name \"" <<
name <<
"\"" <<
nl;
277 os <<
"numvert " <<
patch.nPoints() <<
nl;
281 os << pt.x() <<
' ' << pt.y() <<
' ' << pt.z() <<
nl;
284 os <<
"numsurf " <<
patch.size() <<
nl;
286 for (
const auto&
f :
patch.localFaces())
288 os <<
"SURF 0x20" <<
nl
289 <<
"mat " << zoneI <<
nl
290 <<
"refs " <<
f.size() <<
nl;
292 for (
const label verti :
f)
294 os << verti <<
" 0 0" <<
nl;
298 os <<
"kids 0" <<
endl;
312 streamOpt.
format(IOstream::ASCII);
321 : surfaceFormatsCore::oneZone(faceLst)
324 const bool useFaceMap = (surf.
useFaceMap() && zones.size() > 1);
330 <<
"Cannot write file " << filename <<
nl
336 if (zones.size() == 1)
358 FaceListType(faceLst, zoneMap),
370 FaceListType(faceLst,
zone.range()),
392 streamOpt.
format(IOstream::ASCII);
398 <<
"Cannot write file " << filename <<
nl
405 if (zoneLst.size() <= 1)
411 : surfaceFormatsCore::oneZone(surf.surfFaces())
430 FaceListType(surf.surfFaces(), zoneMap),
const Cmpt & x() const
Access to the vector x component.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
A class for handling words, derived from Foam::string.
ISstream & getLine(std::string &str, char delim='\n')
Raw, low-level getline (until delimiter) into a string.
A class for handling file names.
bool useFaceMap() const
Can/should use faceMap?
static constexpr const zero Zero
Global zero (0)
Input from file stream, using an ISstream.
A List obtained as a section of another List.
thermo validate(args.executable(), "h")
Base class for mesh zones.
streamFormat format() const noexcept
Get the current stream format.
const pointField & points() const
Return const access to the points.
Input/output from string buffers.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A class for handling character strings derived from std::string.
static void writeHeader(Ostream &os, const word &fieldName)
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats.
const Cmpt & z() const
Access to the vector z component.
const labelUList & faceMap() const
Const access to the faceMap, zero-sized when unused.
#define forAll(list, i)
Loop across all elements in list.
static void writeZone(Ostream &os, const Patch &patch, const word &name, const label zoneI)
A surface geometry mesh, in which the surface zone information is conveyed by the 'zoneId' associated...
word name(const complex &c)
Return string representation of complex.
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
The IOstreamOption is a simple container for options an IOstream can normally have.
static const word defaultName("coeffs")
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Input from string buffer, using a ISstream.
const word & name() const
Return name.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const std::string version
OpenFOAM version (name or stringified number) as a std::string.
Output to file stream, using an OSstream.
const Cmpt & y() const
Access to the vector y component.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const std::string patch
OpenFOAM patch number as a std::string.
A surface zone on a MeshedSurface.
A List with indirect addressing.
const UList< Face > & surfFaces() const
Return const access to the faces.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
bool good() const
Return true if next operation might succeed.
Foam::argList args(argc, argv)
#define WarningInFunction
Report a warning using Foam::Warning.
surfZoneList sortedZones(labelList &faceMap) const
Sort faces according to zoneIds.
A list of faces which address into the list of points.
const UList< surfZone > & surfZones() const
Const access to the surface zones.