108 label faceI = pFaces[i];
110 if (mesh.
faces()[faceI] ==
f)
116 FatalErrorIn(
"findFace(const primitiveMesh&, const face&)")
125 int main(
int argc,
char *argv[])
138 fileName nodeFile(prefix +
".node");
140 fileName faceFile(prefix +
".face");
145 <<
" nodes : " << nodeFile <<
endl
146 <<
" elems : " << eleFile <<
endl
152 <<
" nodes : " << nodeFile <<
endl
153 <<
" elems : " << eleFile <<
endl
154 <<
" faces : " << faceFile <<
endl
157 Info<<
"Reading .face file for boundary information" <<
nl <<
endl;
163 <<
"Cannot read " << nodeFile <<
" or " << eleFile
167 if (readFaceFile && !
isFile(faceFile))
170 <<
"Cannot read " << faceFile <<
endl
171 <<
"Did you run tetgen with -f option?" <<
endl
172 <<
"If you don't want to read the .face file and thus not have"
173 <<
" patches please\nrerun with the -noFaceFile option"
189 nodeStream.getLine(line);
191 while (line.size() && line[0] ==
'#');
195 label nNodes, nDims, nNodeAttr;
198 nodeLine >> nNodes >> nDims >> nNodeAttr >> hasRegion;
202 <<
" nodes : " << nNodes <<
endl
203 <<
" nDims : " << nDims <<
endl
204 <<
" nAttr : " << nNodeAttr <<
endl
205 <<
" hasRegion : " << hasRegion <<
endl
220 while (nodeStream.good())
222 nodeStream.getLine(line);
224 if (line.size() && line[0] !=
'#')
232 nodeLine >> nodeI >> x >> y >> z;
234 for (label i = 0; i < nNodeAttr; i++)
246 nodeToPoint.insert(nodeI, pointI);
250 if (pointI != nNodes)
253 <<
"Only " << pointI <<
" nodes present instead of " << nNodes
266 eleStream.getLine(line);
268 while (line.size() && line[0] ==
'#');
272 label nTets, nPtsPerTet, nElemAttr;
274 eleLine >> nTets >> nPtsPerTet >> nElemAttr;
277 Info<<
"Read .ele header:" << endl
278 <<
" tets : " << nTets << endl
279 <<
" pointsPerTet : " << nPtsPerTet << endl
280 <<
" nAttr : " << nElemAttr << endl
286 <<
"Cannot handle tets with "
287 << nPtsPerTet <<
" points per tetrahedron in .ele file" << endl
288 <<
"Can only handle tetrahedra with four points"
295 <<
"Element attributes (third elemenent in .ele header)"
296 <<
" not used" << endl;
308 while (eleStream.good())
310 eleStream.getLine(line);
312 if (line.size() && line[0] !=
'#')
319 for (label i = 0; i < 4; i++)
323 tetPoints[i] = nodeToPoint[nodeI];
329 for (label i = 0; i < nElemAttr; i++)
385 faceStream.getLine(line);
387 while (line.size() && line[0] ==
'#');
391 label nFaces, nFaceAttr;
393 faceLine >> nFaces >> nFaceAttr;
396 Info<<
"Read .face header:" << endl
397 <<
" faces : " << nFaces << endl
398 <<
" nAttr : " << nFaceAttr << endl
405 <<
"Expect boundary markers to be"
406 <<
" present in .face file." << endl
407 <<
"This is the second number in the header which is now:"
425 while (faceStream.good())
427 faceStream.getLine(line);
429 if (line.size() && line[0] !=
'#')
433 label tetGenFaceI, dummy, region;
435 faceLine >> tetGenFaceI;
439 for (label i = 0; i < 3; i++)
443 f[2-i] = nodeToPoint[nodeI];
449 boundaryFaces[faceI] =
f;
461 regionToPatch.
find(region);
463 if (patchFind == regionToPatch.
end())
467 Info<<
"Mapping tetgen region " << region
471 regionToPatch.
insert(region, nPatches++);
475 patchI = patchFind();
478 boundaryPatch[faceI] = patchI;
481 for (label i = 1; i < nFaceAttr; i++)
504 iter != regionToPatch.
end();
508 Info<<
" region:" << iter.key() <<
'\t' <<
"patch:"
532 forAll(boundaryPatch, faceI)
534 label patchI = boundaryPatch[faceI];
536 allPatchFaces[patchI].
append(boundaryFaces[faceI]);
541 forAll(allPatchFaces, patchI)
544 << allPatchFaces[patchI].
size() <<
endl;
546 patchFaces[patchI].transfer(allPatchFaces[patchI]);
575 Info<<
"Writing mesh to " << runTime.constant() << endl <<
endl;