Go to the documentation of this file.
99 int main(
int argc,
char *argv[])
105 "skip reading .face file for boundary information"
114 const fileName nodeFile(prefix +
".node");
115 const fileName eleFile(prefix +
".ele");
116 const fileName faceFile(prefix +
".face");
121 <<
" nodes : " << nodeFile <<
endl
122 <<
" elems : " << eleFile <<
endl
128 <<
" nodes : " << nodeFile <<
endl
129 <<
" elems : " << eleFile <<
endl
130 <<
" faces : " << faceFile <<
endl
133 Info<<
"Reading .face file for boundary information" <<
nl <<
endl;
139 <<
"Cannot read " << nodeFile <<
" or " << eleFile
143 if (readFaceFile && !
isFile(faceFile))
146 <<
"Cannot read " << faceFile <<
endl
147 <<
"Did you run tetgen with -f option?" <<
endl
148 <<
"If you don't want to read the .face file and thus not have"
149 <<
" patches please\nrerun with the -noFaceFile option"
165 nodeStream.getLine(
line);
167 while (
line.size() &&
line[0] ==
'#');
171 label nNodes, nDims, nNodeAttr;
174 nodeLine >> nNodes >> nDims >> nNodeAttr >> hasRegion;
178 <<
" nodes : " << nNodes <<
endl
179 <<
" nDims : " << nDims <<
endl
180 <<
" nAttr : " << nNodeAttr <<
endl
181 <<
" hasRegion : " << hasRegion <<
endl
196 while (nodeStream.good())
198 nodeStream.getLine(
line);
208 nodeLine >> nodeI >>
x >>
y >> z;
210 for (
label i = 0; i < nNodeAttr; i++)
222 nodeToPoint.insert(nodeI, pointI);
226 if (pointI != nNodes)
229 <<
"Only " << pointI <<
" nodes present instead of " << nNodes
242 eleStream.getLine(
line);
244 while (
line.size() &&
line[0] ==
'#');
248 label nTets, nPtsPerTet, nElemAttr;
250 eleLine >> nTets >> nPtsPerTet >> nElemAttr;
254 <<
" tets : " << nTets <<
endl
255 <<
" pointsPerTet : " << nPtsPerTet <<
endl
256 <<
" nAttr : " << nElemAttr <<
endl
262 <<
"Cannot handle tets with "
263 << nPtsPerTet <<
" points per tetrahedron in .ele file" <<
endl
264 <<
"Can only handle tetrahedra with four points"
271 <<
"Element attributes (third elemenent in .ele header)"
272 <<
" not used" <<
endl;
284 while (eleStream.good())
286 eleStream.getLine(
line);
295 for (
label i = 0; i < 4; i++)
305 for (
label i = 0; i < nElemAttr; i++)
361 faceStream.getLine(
line);
363 while (
line.size() &&
line[0] ==
'#');
367 label nFaces, nFaceAttr;
369 faceLine >> nFaces >> nFaceAttr;
373 <<
" faces : " << nFaces <<
endl
374 <<
" nAttr : " << nFaceAttr <<
endl
381 <<
"Expect boundary markers to be"
382 <<
" present in .face file." <<
endl
383 <<
"This is the second number in the header which is now:"
401 while (faceStream.good())
403 faceStream.getLine(
line);
409 label tetGenFaceI, dummy, region;
411 faceLine >> tetGenFaceI;
415 for (
label i = 0; i < 3; i++)
419 f[2-i] = nodeToPoint[nodeI];
425 boundaryFaces[faceI] =
f;
437 regionToPatch.find(region);
439 if (patchFind == regionToPatch.end())
443 Info<<
"Mapping tetgen region " << region
447 regionToPatch.insert(region,
nPatches++);
451 patchI = patchFind();
457 for (
label i = 1; i < nFaceAttr; i++)
479 Info<<
" region:" << iter.key() <<
'\t' <<
"patch:"
507 allPatchFaces[patchI].append(boundaryFaces[faceI]);
512 forAll(allPatchFaces, patchI)
515 << allPatchFaces[patchI].
size() <<
endl;
546 Info<<
"Writing mesh to " << runTime.constant() <<
endl <<
endl;
static SLList< string > validArgs
A list of valid (mandatory) arguments.
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.
static word defaultRegion
Return the default region name.
#define forAll(list, i)
Loop across all elements in list.
const labelListList & pointFaces() const
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList patchFaces(const polyBoundaryMesh &patches, const wordList &names)
Mesh consisting of general polyhedral cells.
wordList patchTypes(nPatches)
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=*(cellModeller::lookup("hex"));labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells]=cellShape(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< SMALL) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};const label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &oldCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< SLList< face > > pFaces[nBCs]
Like polyPatch but without reference to mesh. patchIdentifier::index is not used. Used in boundaryMes...
List< word > wordList
A List of words.
virtual bool write() const
Write mesh using IO settings from time.
List< faceList > faceListList
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.
static const cellModel * lookup(const word &)
Look up a model by name and return a pointer to the model or NULL.
int main(int argc, char *argv[])
wordList patchNames(nPatches)
label nInternalFaces() const
An analytical geometric cellShape.
Input from memory buffer stream.
errorManip< error > abort(error &err)
bool isFile(const fileName &, const bool checkGzip=true)
Does the name exist as a FILE in the file system?
errorManipArg< error, int > exit(error &err, const int errNo=1)
Tet storage. Null constructable (unfortunately tetrahedron<point, point> is not)
void setSize(const label)
Reset size of List.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
virtual const faceList & faces() const
Return raw faces.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Xfer< T > xferMove(T &)
Construct by transferring the contents of the arg.
Xfer< T > xferCopy(const T &)
Construct by copying the contents of the arg.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void reset(const label nPoints, const label nInternalFaces, const label nFaces, const label nCells)
Reset this primitiveMesh given the primitive array sizes.
bool optionFound(const word &opt) const
Return true if the named option is found.
A face is a list of labels corresponding to mesh vertices.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Maps a geometry to a set of cell primitives, which enables geometric cell data to be calculated witho...
void size(const label)
Override size to be inconsistent with allocated storage.
vector point
Point is a vector.
Foam::argList args(argc, argv)
#define WarningInFunction
Report a warning using Foam::Warning.
word name(const complex &)
Return a string representation of a complex.
Cell-face mesh analysis engine.