34 inline void Foam::fileFormats::STARCDedgeFormat::writeLines
44 const edge&
e =
edges[edgeI];
48 <<
' ' << starcdLineShape_
51 <<
' ' << starcdLineType_;
54 << (
e[0]+1) <<
" " << (
e[1]+1) <<
nl;
71 <<
"! " << pointLst.
size() <<
" points, " << nEdges <<
" lines" <<
nl
72 <<
"! case " << caseName <<
nl
73 <<
"! ------------------------------" <<
nl;
82 os <<
"! ------------------------------" <<
nl
83 <<
"*set icvo mxv - 1" <<
nl
84 <<
"vread " << caseName <<
".vrt icvo,,,coded" <<
nl
85 <<
"cread " << caseName <<
".cel icvo,,,add,coded" <<
nl
130 mapPointId.
insert(pointId[i], i);
144 <<
"Cannot read file " << is.
name()
148 readHeader(is,
"PROSTAR_CELL");
152 label lineLabel, shapeId, nLabels, cellTableId, typeId;
155 while ((is >> lineLabel).good())
157 is >> shapeId >> nLabels >> cellTableId >> typeId;
159 vertexLabels.
clear();
163 for (
label i = 0; i < nLabels; ++i)
173 vertexLabels.
append(mapPointId[vrtId]);
176 if (typeId == starcdLineType_)
178 if (vertexLabels.
size() >= 2)
180 dynEdges.
append(
edge(vertexLabels[0], vertexLabels[1]));
182 usedPoints.
set(vertexLabels[0]);
183 usedPoints.
set(vertexLabels[1]);
191 if (
unsigned(
points().size()) != usedPoints.
count())
198 if (usedPoints.
get(pointi))
202 pts[nUsed] = pts[pointi];
206 mapPointId.
set(pointi, nUsed);
217 edge&
e = dynEdges[edgeI];
219 e[0] = mapPointId[
e[0]];
220 e[1] = mapPointId[
e[1]];
242 writePoints(
OFstream(baseName +
".vrt")(), pointLst);
243 writeLines(
OFstream(baseName +
".cel")(), edgeLst);
Various functions to operate on Lists.
#define forAll(list, i)
Loop across all elements in list.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void reserve(const label)
Reserve allocation space for at least this size.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
void clear()
Clear the addressed list, i.e. set the size to zero.
void transfer(HashTable< T, Key, Hash > &)
Transfer the contents of the argument table into this table.
bool set(const Key &, const T &newElmt)
Set a new hashedEntry, overwriting existing entries.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
void clear()
Clear all entries from table.
const fileName & name() const
Return the name of the stream.
virtual const fileName & name() const
Return the name of the stream.
bool good() const
Return true if next operation might succeed.
void size(const label)
Override size to be inconsistent with allocated storage.
void clear()
Clear the list, i.e. set size to zero.
void setSize(const label)
Reset size of List.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual void flush()=0
Flush stream.
void set(const PackedList< 1 > &)
Set specified bits.
unsigned int get(const label) const
Get value at index I.
unsigned int count() const
Count number of bits set, O(log(n))
static string dateTime()
Return the current wall-clock date/time as a string.
Points connected by edges.
const edgeList & edges() const
Return edges.
const pointField & points() const
Return points.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A class for handling file names.
word name() const
Return file name (part beyond last /)
fileName lessExt() const
Return file name without extension (part before last .)
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
errorManipArg< error, int > exit(error &err, const int errNo=1)
bool read(const char *, int32_t &)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.