Go to the documentation of this file.
35 "Default_Boundary_Region";
40 { 0, 1, 4, 5, 2, -1 },
41 { 5, 4, 2, 0, -1, -1 },
75 mesh_.time().constant(),
84 bool useCellZones =
false;
85 cellTableId_.setSize(mesh_.nCells(), -1);
90 if (ioList.
size() == mesh_.nCells())
92 cellTableId_.transfer(ioList);
94 if (cellTable_.empty())
96 Info<<
"no cellTable information available" <<
endl;
102 << ioList.
objectPath() <<
" has incorrect number of cells "
103 <<
" - use cellZone information"
118 if (cellTable_.empty())
120 Info<<
"created cellTable from cellZones" <<
endl;
125 label nUnzoned = mesh_.nCells();
128 Info<<
"matching cellZones to cellTable" <<
endl;
130 forAll(mesh_.cellZones(), zoneI)
132 const cellZone& cZone = mesh_.cellZones()[zoneI];
135 nUnzoned -= cZone.
size();
137 label tableId = cellTable_.findIndex(cZone.
name());
143 dict.add(
"MaterialType",
"fluid");
144 tableId = cellTable_.append(
dict);
149 cellTableId_[cZone[i]] = tableId;
158 dict.add(
"Label",
"__unZonedCells__");
159 dict.add(
"MaterialType",
"fluid");
164 if (cellTableId_[i] < 0)
166 cellTableId_[i] = tableId;
176 os <<
"PROSTAR_" << filetype <<
nl
192 writeHeader(os,
"VERTEX");
198 os.
setf(std::ios::showpoint);
202 Info<<
"Writing " << os.
name() <<
" : "
210 << scaleFactor_ *
points[ptI].x() <<
" "
211 << scaleFactor_ *
points[ptI].y() <<
" "
212 << scaleFactor_ *
points[ptI].z() <<
nl;
222 writeHeader(os,
"CELL");
227 shapeLookupIndex.insert(hexModel->index(), 11);
228 shapeLookupIndex.insert(prismModel->index(), 12);
229 shapeLookupIndex.insert(tetModel->index(), 13);
230 shapeLookupIndex.insert(pyrModel->index(), 14);
234 const faceList& faces = mesh_.faces();
235 const labelList& owner = mesh_.faceOwner();
237 Info<<
"Writing " << os.
name() <<
" : "
243 label materialType = 1;
244 if (cellTable_.found(tableId))
247 if (
dict.found(
"MaterialType"))
250 dict.lookup(
"MaterialType") >> matType;
251 if (matType ==
"solid")
263 if (shapeLookupIndex.found(mapIndex))
265 label shapeId = shapeLookupIndex[mapIndex];
270 <<
" " << vrtList.
size()
272 <<
" " << materialType;
279 if ((count % 8) == 0)
284 os <<
" " << vrtList[i] + 1;
297 indices[0] = indices.
size();
303 count += faces[cFaces[faceI]].
size();
304 indices[faceI+1] = count;
311 <<
" " << materialType;
318 if ((count % 8) == 0)
323 os <<
" " << indices[i];
330 label meshFace = cFaces[faceI];
333 if (owner[meshFace] ==
cellId)
339 f = faces[meshFace].reverseFace();
344 if ((count % 8) == 0)
350 os <<
" " <<
f[i] + 1;
364 writeHeader(os,
"BOUNDARY");
368 const faceList& faces = mesh_.faces();
369 const labelList& owner = mesh_.faceOwner();
376 faceLookupIndex.insert(hexModel->index(), 0);
377 faceLookupIndex.insert(prismModel->index(), 1);
378 faceLookupIndex.insert(tetModel->index(), 2);
379 faceLookupIndex.insert(pyrModel->index(), 3);
381 Info<<
"Writing " << os.
name() <<
" : "
382 << (mesh_.nFaces() -
patches[0].start()) <<
" boundaries" <<
endl;
385 label defaultId = findDefaultBoundary();
393 label regionId = patchI;
394 if (regionId == defaultId)
398 else if (defaultId == -1 || regionId < defaultId)
409 label faceI = patchStart;
410 faceI < (patchStart + patchSize);
433 if (faceLookupIndex.found(mapIndex))
438 if (faces[faceI] == sFaces[sFaceI])
445 mapIndex = faceLookupIndex[mapIndex];
446 cellFaceId = foamToStarFaceAddr[mapIndex][cellFaceId];
455 <<
" " << cellFaceId + 1
458 <<
" " << bndType.c_str()
470 const scalar scaleFactor
475 boundaryRegion_.readDict(mesh_);
476 cellTable_.readDict(mesh_);
491 rm(baseName +
".vrt");
492 rm(baseName +
".cel");
493 rm(baseName +
".bnd");
494 rm(baseName +
".inp");
502 if (baseName.empty())
508 mesh_.time().timeName() !=
"0"
509 && mesh_.time().timeName() != mesh_.time().constant()
512 baseName +=
"_" + mesh_.time().timeName();
517 writePoints(baseName);
518 writeCells(baseName);
522 writeBoundary(baseName);
virtual ~STARCD()
Destructor.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
A class for handling words, derived from string.
A class for handling file names.
#define forAll(list, i)
Loop across all elements in list.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
bool rm(const fileName &)
Remove a file, returning true if successful otherwise false.
static const label foamToStarFaceAddr[4][6]
Face addressing from OpenFOAM faces -> pro-STAR faces.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
faceList faces() const
Faces of this cell.
Mesh consisting of general polyhedral cells.
fileName objectPath() const
Return complete path + object name.
bool headerOk()
Read and check header info.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
void writeCells(const fileName &baseName) const
Write cells.
static void writeHeader(Ostream &, const char *filetype)
Pro-STAR 4+ header format.
static const char * defaultBoundaryName
A list of keyword definitions, which are a keyword followed by any number of values (e....
An analytical geometric cellShape.
const word & name() const
Return name.
const polyMesh & mesh_
Mesh reference.
ios_base::fmtflags setf(const ios_base::fmtflags f)
Set flags of stream.
virtual int precision() const
Get precision of output field.
STARCD(const STARCD &)
Disallow default bitwise copy construct.
static string defaultMeshName
Specify a default mesh name.
void clear()
Clear the list, i.e. set size to zero.
void writePoints(const fileName &baseName) const
Write points.
virtual bool write(const fileName &meshName=fileName::null) const
Write volume mesh.
A face is a list of labels corresponding to mesh vertices.
const fileName & name() const
Return the name of the stream.
void size(const label)
Override size to be inconsistent with allocated storage.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
void writeBoundary(const fileName &baseName) const
Write boundary.
label findDefaultBoundary() const
#define WarningInFunction
Report a warning using Foam::Warning.
label index() const
Return index of model in the model list.
word name(const complex &)
Return a string representation of a complex.
void rmFiles(const fileName &baseName) const
Remove STAR-CD files for the baseName.
virtual void flush()
Flush stream.
write OpenFOAM meshes and/or results to another CFD format
const cellModel & model() const
Model reference.