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]];
238 <<
"Cannot open file for writing " << filename
246 <<
"# points : " << pointLst.size() <<
nl
247 <<
"# lines : " << edgeLst.size() <<
nl;
250 <<
"# <points count=\"" << pointLst.size() <<
"\">" <<
nl;
253 for (
const point&
p : pointLst)
255 os <<
"v " <<
p.x() <<
' ' <<
p.y() <<
' ' <<
p.z() <<
nl;
258 os <<
"# </points>" <<
nl
260 <<
"# <edges count=\"" << edgeLst.size() <<
"\">" <<
endl;
263 for (
const edge&
e : edgeLst)
265 os <<
"l " << (
e[0] + 1) <<
" " << (
e[1] + 1) <<
nl;
267 os <<
"# </edges>" <<
endl;
edgeList & storedEdges()
Non-const access to the edges.
static std::string nameLessExt(const std::string &str)
Return basename, without extension.
A class for handling words, derived from Foam::string.
A class for handling file names.
virtual const fileName & name() const
Read/write access to the name of the stream.
Input from file stream, using an ISstream.
pointField & storedPoints()
Non-const access to global points.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
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...
#define forAll(list, i)
Loop across all elements in list.
static std::string dateTime()
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
void clear()
Clear the addressed list, i.e. set the size to zero.
void transfer(List< T > &list)
void setSize(const label nElem)
Alter addressable list size.
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.
Input/output from file streams.
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
const dimensionedScalar e
Elementary charge.
bool good() const
Return true if next operation might succeed.
Mesh data needed to do the Finite Area discretisation.