34 inline void Foam::fileFormats::STARCDedgeFormat::writeLines
44 const edge&
e = edges[edgeI];
48 <<
' ' << starcdLineShape_
51 <<
' ' << starcdLineType_;
53 os <<
nl <<
" " << cellId <<
" " 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
95 Foam::fileFormats::STARCDedgeFormat::STARCDedgeFormat
130 mapPointId.insert(pointId[i], i);
145 "fileFormats::STARCDedgeFormat::read(const fileName&)" 147 <<
"Cannot read file " << is.
name()
155 label lineLabel, shapeId, nLabels, cellTableId, typeId;
158 while ((is >> lineLabel).good())
160 is >> shapeId >> nLabels >> cellTableId >> typeId;
162 vertexLabels.
clear();
166 for (
label i = 0; i < nLabels; ++i)
176 vertexLabels.
append(mapPointId[vrtId]);
179 if (typeId == starcdLineType_)
181 if (vertexLabels.
size() >= 2)
183 dynEdges.
append(
edge(vertexLabels[0], vertexLabels[1]));
185 usedPoints.
set(vertexLabels[0]);
186 usedPoints.
set(vertexLabels[1]);
194 if (
unsigned(
points().size()) != usedPoints.
count())
201 if (usedPoints.
get(pointI))
205 pts[nUsed] = pts[pointI];
209 mapPointId.set(pointI, nUsed);
220 edge&
e = dynEdges[edgeI];
222 e[0] = mapPointId[e[0]];
223 e[1] = mapPointId[e[1]];
246 writeLines(
OFstream(baseName +
".cel")(), edgeLst);
static void writePoints(Ostream &, const pointField &)
Write header and points to (.vrt) file.
word name() const
Return file name (part beyond last /)
const fileName & name() const
Return the name of the stream.
edgeList & storedEdges()
Non-const access to the edges.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
void set(const PackedList< 1 > &)
Set specified bits.
static bool readPoints(IFstream &, pointField &, labelList &ids)
Read points from a (.vrt) file.
static void writeHeader(Ostream &, const word &fileType)
Write header for fileType (CELL|VERTEX|BOUNDARY)
void clear()
Clear the addressed list, i.e. set the size to zero.
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const pointField & points() const
Return points.
static void write(const fileName &, const edgeMesh &)
Write edge mesh.
void size(const label)
Override size to be inconsistent with allocated storage.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Various functions to operate on Lists.
unsigned int count() const
Count number of bits set, O(log(n))
static bool readHeader(IFstream &, const word &fileSignature)
Read header.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
static string dateTime()
Return the current wall-clock date/time as a string.
virtual void clear()
Clear all storage.
void clear()
Clear the list, i.e. set size to zero.
const double e
Elementary charge.
void setSize(const label)
Reset size of List.
bool good() const
Return true if next operation might succeed.
static void writeCase(Ostream &, const pointField &, const label nEdges)
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
virtual void flush()=0
Flush stream.
virtual const fileName & name() const
Return the name of the stream.
Points connected by edges.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
A class for handling file names.
fileName lessExt() const
Return file name without extension (part before last .)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
virtual bool read(const fileName &)
Read from file.
pointField & storedPoints()
Non-const access to global points.
void reserve(const label)
Reserve allocation space for at least this size.
unsigned int get(const label) const
Get value at index I.
const edgeList & edges() const
Return edges.