83 label facei = pFaces[i];
85 if (mesh.
faces()[facei] ==
f)
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");
120 Info<<
"Files:" << endl
121 <<
" nodes : " << nodeFile << endl
122 <<
" elems : " << eleFile << endl
127 Info<<
"Files:" << 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;
177 Info<<
"Read .node header:" << endl
178 <<
" nodes : " << nNodes << endl
179 <<
" nDims : " << nDims << endl
180 <<
" nAttr : " << nNodeAttr << endl
181 <<
" hasRegion : " << hasRegion << endl
196 while (nodeStream.good())
198 nodeStream.getLine(line);
200 if (line.size() && line[0] !=
'#')
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;
253 Info<<
"Read .ele header:" << endl
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 element in .ele header)" 272 <<
" not used" <<
endl;
284 while (eleStream.good())
286 eleStream.getLine(line);
288 if (line.size() && line[0] !=
'#')
295 for (
label i = 0; i < 4; i++)
299 tetPoints[i] = nodeToPoint[nodeI];
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;
372 Info<<
"Read .face header:" << endl
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);
405 if (line.size() && line[0] !=
'#')
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();
454 boundaryPatch[facei] =
patchi;
457 for (
label i = 1; i < nFaceAttr; i++)
479 Info<<
" region:" << iter.key() <<
'\t' <<
"patch:" 495 word defaultFacesName =
"defaultFaces";
496 word defaultFacesType = polyPatch::typeName;
497 wordList patchPhysicalTypes(nPatches, polyPatch::typeName);
503 forAll(boundaryPatch, facei)
505 label patchi = boundaryPatch[facei];
512 forAll(allPatchFaces, patchi)
517 patchFaces[
patchi].transfer(allPatchFaces[patchi]);
546 Info<<
"Writing mesh to " << runTime.constant() << endl <<
endl;
List< faceList > faceListList
const word & executable() const
Name of executable without the path.
#define forAll(list, i)
Loop across all elements in list.
static const cellModel * lookup(const word &)
Look up a model by name and return a pointer to the model or nullptr.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
A face is a list of labels corresponding to mesh vertices.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
label nInternalFaces() const
Cell-face mesh analysis engine.
bool isFile(const fileName &, const bool checkVariants=true, const bool followLink=true)
Does the name exist as a file in the file system?
An analytical geometric cellShape.
void size(const label)
Override size to be inconsistent with allocated storage.
wordList patchTypes(nPatches)
void reset(const fvMesh &)
Reset mesh.
static word defaultRegion
Return the default region name.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool optionFound(const word &opt) const
Return true if the named option is found.
static SLList< string > validArgs
A list of valid (mandatory) arguments.
virtual bool write(const bool write=true) const
Write mesh using IO settings from time.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
A class for handling words, derived from string.
void append(const T &)
Append an element at the end of the list.
wordList patchNames(nPatches)
errorManip< error > abort(error &err)
#define FatalIOErrorIn(functionName, ios)
Report an error message using Foam::FatalIOError.
word name(const complex &)
Return a string representation of a complex.
List< word > wordList
A List of words.
void setSize(const label)
Reset size of List.
vector point
Point is a vector.
#define WarningInFunction
Report a warning using Foam::Warning.
Input from memory buffer stream.
virtual const faceList & faces() const =0
Return faces.
Maps a geometry to a set of cell primitives, which enables geometric cell data to be calculated witho...
const labelListList & pointFaces() const
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Mesh consisting of general polyhedral cells.
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
Foam::argList args(argc, argv)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...