62 <<
"Cannot read file " << filename <<
nl 86 string line = this->getLineNoComment(is);
89 while (
line.removeEnd(
'\\'))
91 line += this->getLineNoComment(is);
97 if (tokens.size() < 2)
113 readScalar(tokens[1]),
114 readScalar(tokens[2]),
115 readScalar(tokens[3])
125 const auto iterGroup = groupLookup.
cfind(groupName);
127 if (iterGroup.good())
129 if (zoneId != *iterGroup)
137 zoneId = dynSizes.
size();
138 groupLookup.
insert(groupName, zoneId);
139 dynNames.
append(groupName);
154 groupLookup.
insert(
"zone0", 0);
162 for (
const auto& tok : tokens)
171 const string vrtSpec(tok);
172 const auto slash = vrtSpec.find(
'/');
176 slash != string::npos
181 dynVerts.
append(vertId - 1);
186 if (faceTraits<Face>::isTri() &&
f.size() > 3)
190 for (label fp1 = 1; fp1 <
f.size() - 1; fp1++)
192 const label fp2 =
f.fcIndex(fp1);
194 dynFaces.
append(Face{
f[0],
f[fp1],
f[fp2]});
199 else if (
f.size() >= 3)
210 this->storedPoints().
transfer(dynPoints);
212 this->sortFacesAndStore(dynFaces, dynZones, dynElemId, sorted);
215 this->addZones(dynSizes, dynNames);
216 this->addZonesToFaces();
232 streamOpt.
format(IOstreamOption::ASCII);
242 ? surfaceFormatsCore::oneZone(faceLst,
"")
252 <<
"Cannot write file " << filename <<
nl 257 os <<
"# Wavefront OBJ file written " << clock::dateTime().c_str() <<
nl 258 <<
"o " <<
os.name().stem() <<
nl 260 <<
"# points : " << pointLst.
size() <<
nl 261 <<
"# faces : " << faceLst.
size() <<
nl 262 <<
"# zones : " << zones.
size() <<
nl;
267 os <<
"# " << zonei <<
" " << zones[zonei].name()
268 <<
" (nFaces: " << zones[zonei].
size() <<
")" <<
nl;
272 <<
"# <points count=\"" << pointLst.
size() <<
"\">" <<
nl;
275 for (
const point& pt : pointLst)
277 os <<
"v " << pt.x() <<
' ' << pt.y() <<
' ' << pt.z() <<
nl;
280 os <<
"# </points>" <<
nl 282 <<
"# <faces count=\"" << faceLst.
size() <<
"\">" <<
nl;
287 for (
const surfZone& zone : zones)
289 if (zone.name().size())
291 os <<
"g " << zone.name() <<
nl;
294 for (label nLocal = zone.size(); nLocal--; ++faceIndex)
297 (useFaceMap ?
faceMap[faceIndex] : faceIndex);
299 const Face&
f = faceLst[facei];
302 for (
const label verti :
f)
304 os <<
' ' << (verti + 1);
309 os <<
"# </faces>" <<
nl;
void size(const label n)
Older name for setAddressableSize.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Output to file stream, using an OSstream.
constexpr char nl
The newline '\n' character (0x0a)
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
A simple container for options an IOstream can normally have.
const pointField & points() const noexcept
Return const access to the points.
const labelUList & faceMap() const noexcept
Const access to the faceMap, zero-sized when unused.
UList< label > labelUList
A UList of labels.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
#define forAll(list, i)
Loop across all elements in list.
StringType validate(const std::string &str, const UnaryPredicate &accept, const bool invert=false)
Return a copy of the input string with validated characters.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
bool useFaceMap() const noexcept
Can/should use faceMap?
const_iterator cfind(const Key &key) const
Find and return an const_iterator set at the hashed entry.
const UList< surfZone > & surfZones() const noexcept
Const access to the surface zones.
void append(const T &val)
Copy append an element to the end of this list.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
OBJstream os(runTime.globalPath()/outputName)
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats...
Input from file stream, using an ISstream.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
Foam::SubStrings< StringType > splitSpace(const StringType &str)
Split string into sub-strings at whitespace (TAB, NL, VT, FF, CR, SPC)
vector point
Point is a vector.
bool good() const noexcept
True if next operation might succeed.
void transfer(List< T > &list)
Transfer contents of the argument List into this.
const UList< Face > & surfFaces() const noexcept
Return const access to the faces.
streamFormat format() const noexcept
Get the current stream format.