36inline void Foam::fileFormats::STARCDsurfaceFormat<Face>::writeShell
41 const label cellTableId
47 <<
' ' << (cellTableId + 1)
48 <<
' ' << starcdShellType;
53 for (
const label pointi :
f)
59 os <<
' ' << (pointi + 1);
92 Map<word> cellTableLookup = readInpCellTable
105 this->storedPoints(),
120 <<
"Cannot read file " << is.name() <<
nl
124 readHeader(is, STARCDCore::HEADER_CEL);
139 bool ignoreElemId =
false;
141 label ignoredLabel, shapeId, nLabels, cellTableId, typeId;
146 while (is.read(tok).good() && tok.
isLabel())
156 vertexLabels.clear();
157 vertexLabels.reserve(nLabels);
160 for (label i = 0; i < nLabels; ++i)
170 vertexLabels.append(mapPointId[vrtId]);
173 if (typeId == starcdShellType)
176 const auto iterGroup = lookup.
cfind(cellTableId);
177 if (iterGroup.good())
179 if (zoneId != *iterGroup)
188 zoneId = dynSizes.
size();
189 lookup.
insert(cellTableId, zoneId);
191 const auto iterTableName = cellTableLookup.
cfind(cellTableId);
193 if (iterTableName.good())
195 dynNames.
append(*iterTableName);
205 SubList<label>
vertices(vertexLabels, vertexLabels.size());
206 if (faceTraits<Face>::isTri() && nLabels > 3)
216 f.triangles(this->
points(), nTri, trias);
218 for (
const face& tri : trias)
221 dynFaces.
append(Face(tri));
226 else if (nLabels >= 3)
231 dynFaces.
append(Face(vertices));
246 this->sortFacesAndStore(dynFaces, dynZones, dynElemId, sorted);
249 this->addZones(dynSizes, dynNames);
280 const bool useFaceMap = (surf.
useFaceMap() && zones.size() > 1);
284 const bool useOrigFaceIds =
297 writePoints(
os, pointLst);
301 OFstream os(starFileName(prefix, STARCDCore::CEL_FILE), streamOpt);
309 for (label nLocal =
zone.
size(); nLocal--; ++faceIndex)
312 (useFaceMap ?
faceMap[faceIndex] : faceIndex);
314 const Face&
f = faceLst[facei];
318 elemId = elemIds[facei];
321 writeShell(
os,
f, elemId, zoneIndex);
330 OFstream
os(starFileName(prefix, STARCDCore::INP_FILE));
Various functions to operate on Lists.
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...
const_iterator cfind(const Key &key) const
Find and return an const_iterator set at the hashed entry.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not 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.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats.
const UList< surfZone > & surfZones() const noexcept
Const access to the surface zones.
const UList< Face > & surfFaces() const noexcept
Return const access to the faces.
const labelUList & faceIds() const noexcept
Const access to the faceIds, zero-sized when unused.
const labelUList & faceMap() const noexcept
Const access to the faceMap, zero-sized when unused.
const pointField & points() const noexcept
Return const access to the points.
bool useFaceMap() const noexcept
Can/should use faceMap?
pointField & storedPoints()
Non-const access to global points.
virtual void addZones(const UList< surfZone > &, const bool cullEmpty=false)
Add surface zones.
void sortFacesAndStore(DynamicList< Face > &unsortedFaces, DynamicList< label > &zoneIds, DynamicList< label > &elemIds, bool sorted)
Sort faces by zones and store sorted faces.
bool addZonesToFaces()
Propagate zone information on face regions.
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
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...
void size(const label n)
Older name for setAddressableSize.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
static bool isTri()
Face-type only handles triangles. Not true in general.
A face is a list of labels corresponding to mesh vertices.
A class for handling file names.
fileName lessExt() const
Return file name without extension (part before last .).
Lookup type of boundary radiation properties.
A surface zone on a MeshedSurface.
A token holds an item read from Istream.
bool isLabel() const noexcept
Integral token is convertible to Foam::label.
label labelToken() const
Return integer type as label value or Error.
Base class for mesh zones.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
bool found(const ListType &input, const UnaryPredicate &pred, const label start=0)
Same as found_if.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Map< label > invertToMap(const labelUList &values)
Create inverse mapping, which is a lookup table into the given list.
List< surfZone > surfZoneList
List of surfZone.
static void writeHeader(Ostream &os, const word &fieldName)
List< face > faceList
List of faces.
pointField vertices(const blockVertexList &bvl)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).