43inline void Foam::OBJstream::vertex_state(
const char c)
49 else if (startOfLine_)
100 if (quoted) vertex_state(0);
102 const char* last = (str + len);
105 for (
const char* iter = str; iter != last; ++iter)
110 if (quoted) vertex_state(0);
120 for (
const char* iter = str; *iter; ++iter)
155 const char* iter = str.data();
156 const char* last = (str.data() + str.size());
159 for (; iter != last; ++iter)
161 const char c = *iter;
166 startOfLine_ =
false;
169 startOfLine_ = (
c ==
'\n');
185 write(
'v') <<
' ' <<
p.x() <<
' ' <<
p.y() <<
' ' <<
p.z() <<
nl;
202 write(
'v') <<
' ' <<
p.x() <<
' ' <<
p.y() <<
' ' <<
p.z() <<
nl;
212 write(
'l') <<
' ' << nVertices_-1 <<
' ' << nVertices_ <<
nl;
221 write(
'l') <<
' ' << nVertices_-1 <<
' ' << nVertices_ <<
nl;
235 write(
'l') <<
' ' << nVertices_-1 <<
' ' << nVertices_ <<
nl;
248 write(
'l') <<
' ' << nVertices_-1 <<
' ' << nVertices_ <<
nl;
259 const label start = nVertices_+1;
266 for (
int i = 0; i < 3; ++i)
268 write(
' ') << i+start;
270 write(
' ') << start <<
'\n';
275 for (
int i = 0; i < 3; ++i)
277 write(
' ') << i+start;
291 const label start = nVertices_+1;
300 write(
' ') << i+start;
302 write(
' ') << start <<
'\n';
309 write(
' ') << i+start;
324 const label start = nVertices_+1;
326 for (
const label fp :
f)
335 write(
' ') << i+start;
337 write(
' ') << start <<
'\n';
344 write(
' ') << i+start;
361 const label start = nVertices_+1;
371 <<
e.second()+start <<
nl;
379 for (
const label fp :
f)
381 write(
' ') << fp+start;
402 label objPointId = nVertices_+1;
406 for (
const edge&
e : edges)
408 if (markedPoints.insert(
e.
first(), objPointId))
413 if (markedPoints.insert(
e.second(), objPointId))
420 for (
const edge&
e : edges)
423 << markedPoints[
e.
first()] <<
' '
424 << markedPoints[
e.second()] <<
nl;
429 const label start = nVertices_+1;
433 for (
const edge&
e : edges)
437 <<
e.second()+start <<
nl;
451 const label start = nVertices_+1;
461 <<
e.second()+start <<
nl;
469 for (
const label fp :
f)
471 write(
' ') << fp+start;
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
A simple container for options an IOstream can normally have.
A HashTable to objects of type <T> with a label key.
An OFstream that keeps track of vertices and provides convenience output methods for OBJ files.
virtual Ostream & writeQuoted(const char *str, std::streamsize len, const bool quoted=true) override
Write character/string content, with/without surrounding quotes.
virtual Ostream & write(const char c) override
Write character.
Ostream & writeFace(const UList< point > &points, const bool lines=true)
Write face loop points with lines/filled-polygon.
Ostream & writeLine(const point &p0, const point &p1)
Write line joining two points.
Ostream & writeComment(const std::string &str)
Write comment (with '# ' prefix).
OBJstream(const fileName &pathname, IOstreamOption streamOpt=IOstreamOption())
Construct from pathname (ASCII, uncompressed).
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
OFstream(std::nullptr_t)
Construct a null output file stream that behaves like /dev/null.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual Ostream & writeQuoted(const char *str, std::streamsize len, const bool quoted=true)=0
Write character/string content, with/without surrounding quotes.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
const Field< point_type > & localPoints() const
Return pointField of points in patch.
const List< face_type > & localFaces() const
Return patch faces addressing into local point list.
A non-owning sub-view of a List (allocated or unallocated storage).
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
T & first()
Access first element of the list, position [0].
void size(const label n)
Older name for setAddressableSize.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
A face is a list of labels corresponding to mesh vertices.
A class for handling file names.
Standard boundBox with extra functionality for use in octree.
static const edgeList edges
Edge to point addressing, using octant corner points.
static const faceList faces
Face to point addressing, using octant corner points.
tmp< pointField > points() const
Vertex coordinates. In octant coding.
A class for handling words, derived from Foam::string.
#define defineTypeName(Type)
Define the typeName.
const volScalarField & p0
const dimensionedScalar c
Speed of light in a vacuum.
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field.
line< point, const point & > linePointRef
A line using referred points.
vector point
Point is a vector.
triangle< point, const point & > triPointRef
A triangle using referred points.
vectorField pointField
pointField is a vectorField.
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.