37inline void Foam::fileFormats::STARCDedgeFormat::writeLines
40 const edgeList& edges,
44 starCellId =
max(1, starCellId);
46 for (
const edge&
e :
edges)
55 <<
" " << starCellId <<
" "
56 << (
e[0]+1) <<
" " << (
e[1]+1) <<
nl;
72 const word caseName =
os.name().stem();
75 <<
"! " << pointLst.
size() <<
" points, " << nEdges <<
" lines" <<
nl
76 <<
"! case " << caseName <<
nl
77 <<
"! ------------------------------" <<
nl;
86 os <<
"! ------------------------------" <<
nl
87 <<
"*set icvo mxv - 1" <<
nl
88 <<
"vread " << caseName <<
".vrt icvo,,,coded" <<
nl
89 <<
"cread " << caseName <<
".cel icvo,,,add,coded" <<
nl
144 <<
"Cannot read file " << is.name()
152 label ignoredLabel, shapeId, nLabels, cellTableId, typeId;
157 while (is.read(tok).good() && tok.
isLabel())
165 vertexLabels.clear();
166 vertexLabels.reserve(nLabels);
169 for (label i = 0; i < nLabels; ++i)
179 vertexLabels.append(mapPointId[vrtId]);
182 if (typeId == starcdLineType)
184 if (vertexLabels.size() >= 2)
186 dynEdges.
append(edge(vertexLabels[0], vertexLabels[1]));
188 usedPoints.set(vertexLabels[0]);
189 usedPoints.set(vertexLabels[1]);
197 if (!usedPoints.all())
202 for (
const label pointi : usedPoints)
210 mapPointId.set(pointi, nUsed);
217 for (edge&
e : dynEdges)
219 e[0] = mapPointId[
e[0]];
220 e[1] = mapPointId[
e[1]];
249 writePoints(
os, pointLst);
256 writeLines(
os, edgeLst);
Various functions to operate on Lists.
Input/output from string buffers.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
void append(const T &val)
Copy append an element to the end of this list.
void reserve(const label len)
Reserve allocation space for at least this size, allocating new space if required and retaining old c...
bool set(const Key &key, const T &obj)
Copy assign a new entry, overwriting existing entries.
void clear()
Remove all entries from table.
Input from file stream as an ISstream, normally using std::ifstream for the actual input.
virtual const fileName & name() const override
Read/write access to the name of the stream.
A simple container for options an IOstream can normally have.
streamFormat format() const noexcept
Get the current stream format.
@ ASCII
"ascii" (normal default)
bool good() const noexcept
True if next operation might succeed.
virtual Istream & read(token &t) override
Return next token from stream.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void clear()
Clear the list, i.e. set size to zero.
A HashTable to objects of type <T> with a label key.
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
void size(const label n)
Older name for setAddressableSize.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
void set(const bitSet &bitset)
Set specified bits from another bitset.
bool all() const
True if all bits in this bitset are set or if the set is empty.
static std::string dateTime()
The current wall-clock date/time (in local time) as a string in ISO-8601 format (yyyy-mm-ddThh:mm:ss)...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Mesh data needed to do the Finite Area discretisation.
pointField & storedPoints() noexcept
Non-const access to global points.
edgeMesh(const faMesh &mesh)
Construct finite-area edge mesh faMesh reference.
const edgeList & edges() const noexcept
Return edges.
edgeList & storedEdges() noexcept
Non-const access to the edges.
static label size(const faMesh &mesh) noexcept
The geometric (internal) size - number of internal edges.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
A class for handling file names.
fileName lessExt() const
Return file name without extension (part before last .).
A token holds an item read from Istream.
bool isLabel() const noexcept
Integral token is convertible to Foam::label.
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
List< edge > edgeList
List of edge.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
bool read(const char *buf, int32_t &val)
Same as readInt32.
Map< label > invertToMap(const labelUList &values)
Create inverse mapping, which is a lookup table into the given list.
static void writeHeader(Ostream &os, const word &fieldName)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).