Go to the documentation of this file.
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.found())
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(IOstream::ASCII);
242 ? surfaceFormatsCore::oneZone(faceLst,
"")
246 const bool useFaceMap = (surf.
useFaceMap() && zones.size() > 1);
252 <<
"Cannot write file " << filename <<
nl
257 os <<
"# Wavefront OBJ file written " << clock::dateTime().c_str() <<
nl
258 <<
"o " <<
os.name().nameLessExt() <<
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;
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
A class for handling words, derived from Foam::string.
A class for handling file names.
Input from file stream, using an ISstream.
Base class for mesh zones.
streamFormat format() const noexcept
bool insert(const Key &key, const T &obj)
const pointField & points() const
Foam::SubStrings< StringType > splitSpace(const StringType &str)
Sub-ranges of a string with a structure similar to std::match_results, but without the underlying reg...
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats.
const labelUList & faceMap() const
bool good() const noexcept
DynamicList< T, SizeMin > & append(const T &val)
The IOstreamOption is a simple container for options an IOstream can normally have.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
OBJstream os(runTime.globalPath()/outputName)
errorManipArg< error, int > exit(error &err, const int errNo=1)
Output to file stream, using an OSstream.
#define FatalErrorInFunction
const_iterator cfind(const Key &key) const
const word & name() const noexcept
label readLabel(const char *buf)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A surface zone on a MeshedSurface.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void transfer(List< T > &list)
const UList< Face > & surfFaces() const
vector point
Point is a vector.
StringType validate(const std::string &str, const UnaryPredicate &accept, const bool invert=false)
UList< label > labelUList
A UList of labels.
const UList< surfZone > & surfZones() const