Go to the documentation of this file.
54 for (
const auto& tok : tokens)
63 const string vrtSpec(tok);
64 const auto slash = vrtSpec.find(
'/');
85 Foam::fileFormats::OBJedgeFormat::OBJedgeFormat
104 <<
"Cannot read file " << filename
115 string line = this->getLineNoComment(is);
118 while (
line.removeEnd(
'\\'))
120 line += this->getLineNoComment(is);
126 if (tokens.size() < 2)
142 readScalar(tokens[1]),
143 readScalar(tokens[2]),
144 readScalar(tokens[3])
159 for (label i = 1; i < dynVerts.size(); i++)
161 const edge e(dynVerts[i-1], dynVerts[i]);
164 dynUsedPoints[
e[0]] =
e[0];
165 dynUsedPoints[
e[1]] =
e[1];
178 for (label i = 1; i < dynVerts.size(); i++)
180 const edge e(dynVerts[i-1], dynVerts[i]);
183 dynUsedPoints[
e[0]] =
e[0];
184 dynUsedPoints[
e[1]] =
e[1];
194 if (dynUsedPoints[pointi] >= 0)
198 dynPoints[nUsed] = std::move(dynPoints[pointi]);
199 dynUsedPoints[pointi] = nUsed;
211 if (nUsed != dynUsedPoints.size())
213 for (
edge&
e : dynEdges)
215 e[0] = dynUsedPoints[
e[0]];
216 e[1] = dynUsedPoints[
e[1]];
243 <<
"Cannot write file " << filename <<
nl
249 <<
"o " <<
os.name().nameLessExt() <<
nl
251 <<
"# points : " << pointLst.size() <<
nl
252 <<
"# lines : " << edgeLst.size() <<
nl;
255 <<
"# <points count=\"" << pointLst.size() <<
"\">" <<
nl;
258 for (
const point&
p : pointLst)
260 os <<
"v " <<
p.x() <<
' ' <<
p.y() <<
' ' <<
p.z() <<
nl;
263 os <<
"# </points>" <<
nl
265 <<
"# <edges count=\"" << edgeLst.size() <<
"\">" <<
endl;
268 for (
const edge&
e : edgeLst)
270 os <<
"l " << (
e[0] + 1) <<
" " << (
e[1] + 1) <<
nl;
272 os <<
"# </edges>" <<
endl;
A class for handling words, derived from Foam::string.
A class for handling file names.
Input from file stream, using an ISstream.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
streamFormat format() const noexcept
Get the current stream format.
static word validate(const std::string &s, const bool prefix=false)
Construct validated word (no invalid characters).
Ostream & endl(Ostream &os)
Add newline and flush stream.
static label readObjVertices(const SubStrings< string > &tokens, DynamicList< label > &verts)
Foam::SubStrings< StringType > splitSpace(const StringType &str)
Split string into sub-strings at whitespace (TAB, NL, VT, FF, CR, SPC)
Sub-ranges of a string with a structure similar to std::match_results, but without the underlying reg...
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
pointField & storedPoints() noexcept
Non-const access to global points.
#define forAll(list, i)
Loop across all elements in list.
bool good() const noexcept
True if next operation might succeed.
static std::string dateTime()
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
void transfer(List< T > &list)
The IOstreamOption is a simple container for options an IOstream can normally have.
void setSize(const label n)
Same as resize()
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
OBJstream os(runTime.globalPath()/outputName)
virtual void clear()
Clear all storage.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Output to file stream, using an OSstream.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
const dimensionedScalar e
Elementary charge.
edgeList & storedEdges() noexcept
Non-const access to the edges.
Mesh data needed to do the Finite Area discretisation.