69 octantNormal /=
mag(octantNormal);
84 pn[pointi] = pointNormals[pointi];
89 <<
"Average point normal not visible for point:" 90 <<
pp.meshPoints()[pointi] <<
endl;
114 else if (
n.x() < -SMALL)
130 else if (
n.y() < -SMALL)
145 else if (
n.z() < -SMALL)
158 for (label octant = 0; octant < 8; octant++)
160 if (visOctant & mask)
174 pn[pointi] = octantNormal[visI];
181 <<
"No visible octant for point:" <<
pp.meshPoints()[pointi]
182 <<
" cooord:" <<
pp.points()[
pp.meshPoints()[pointi]] <<
nl 183 <<
"Normal set to " << pn[pointi] <<
endl;
194 const primitiveMesh&
mesh,
198 return mesh.edges()[edgeI].unitVec(
mesh.points());
208 os <<
"v " << pt.x() <<
' ' << pt.y() <<
' ' << pt.z() <<
endl;
221 os <<
"v " << pt.x() <<
' ' << pt.y() <<
' ' << pt.z() <<
nl;
249 os <<
"v " << p1.x() <<
' ' << p1.y() <<
' ' << p1.z() <<
nl;
250 os <<
"v " << p2.x() <<
' ' << p2.y() <<
' ' << p2.z() <<
nl;
264 os <<
"v " << p1.x() <<
' ' << p1.y() <<
' ' << p1.z() <<
nl;
266 << (p2.x() - p1.x()) <<
' ' 267 << (p2.y() - p1.y()) <<
' ' 268 << (p2.z() - p1.z()) <<
endl;
280 for (
const edge&
e : treeBoundBox::edges)
282 os <<
"l " << (
e[0] + 1) <<
' ' << (
e[1] + 1) <<
nl;
292 const UList<point>&
points,
298 for (
const label celli : cellLabels)
309 const primitiveMesh&
mesh,
314 return mesh.edgeCells(edgeI).found(celli);
325 return mesh.faceEdges(facei).found(edgeI);
336 if (
mesh.isInternalFace(facei))
340 (
mesh.faceOwner()[facei] == celli)
341 || (
mesh.faceNeighbour()[facei] == celli)
349 if (
mesh.faceOwner()[facei] == celli)
368 const label edgeI = candidates[i];
370 const edge&
e = edges[edgeI];
372 if ((
e[0] == v0 &&
e[1] == v1) || (
e[0] == v1 &&
e[1] == v0))
383 const primitiveMesh&
mesh,
394 label edgeI = v0Edges[i];
396 const edge&
e = edges[edgeI];
398 if ((
e.start() == v1) || (
e.end() == v1))
409 const primitiveMesh&
mesh,
419 label edge0 = f0Edges[f0EdgeI];
423 label edge1 = f1Edges[f1EdgeI];
432 <<
"Faces " << f0 <<
" and " << f1 <<
" do not share an edge" 447 const cell& cFaces =
mesh.cells()[cell0I];
451 label facei = cFaces[cFacei];
455 mesh.isInternalFace(facei)
457 mesh.faceOwner()[facei] == cell1I
458 ||
mesh.faceNeighbour()[facei] == cell1I
468 <<
"No common face for" 469 <<
" cell0I:" << cell0I <<
" faces:" << cFaces
470 <<
" cell1I:" << cell1I <<
" faces:" 471 <<
mesh.cells()[cell1I]
494 label facei = eFaces[eFacei];
511 if ((face0 == -1) || (face1 == -1))
514 <<
"Can not find faces using edge " <<
mesh.edges()[edgeI]
522 const primitiveMesh&
mesh,
524 const label thisEdgeI,
525 const label thisVertI
528 forAll(edgeLabels, edgeLabelI)
530 label edgeI = edgeLabels[edgeLabelI];
532 if (edgeI != thisEdgeI)
534 const edge&
e =
mesh.edges()[edgeI];
536 if ((
e.start() == thisVertI) || (
e.end() == thisVertI))
544 <<
"Can not find edge in " 545 << UIndirectList<edge>(
mesh.edges(), edgeLabels)
546 <<
" connected to edge " 547 << thisEdgeI <<
" with vertices " <<
mesh.edges()[thisEdgeI]
580 const primitiveMesh&
mesh,
581 const label otherCelli,
585 if (!
mesh.isInternalFace(facei))
588 <<
"Face " << facei <<
" is not internal" 592 label newCelli =
mesh.faceOwner()[facei];
594 if (newCelli == otherCelli)
596 newCelli =
mesh.faceNeighbour()[facei];
604 const primitiveMesh&
mesh,
606 const label startEdgeI,
607 const label startVertI,
613 label edgeI = startEdgeI;
615 label vertI = startVertI;
617 for (label iter = 0; iter < nEdges; iter++)
621 vertI =
mesh.edges()[edgeI].otherVertex(vertI);
630 const polyMesh&
mesh,
634 const Vector<label>& dirs =
mesh.geometricD();
639 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
641 if (dirs[cmpt] == -1)
651 const polyMesh&
mesh,
655 const Vector<label>& dirs =
mesh.geometricD();
660 bool isConstrained =
false;
661 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
663 if (dirs[cmpt] == -1)
665 isConstrained =
true;
674 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
676 if (dirs[cmpt] == -1)
678 pts[i][cmpt] = 0.5*(
min[cmpt] +
max[cmpt]);
688 const polyMesh&
mesh,
689 const Vector<label>& dirs,
693 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
695 if (dirs[cmpt] == -1)
705 const polyMesh&
mesh,
706 const Vector<label>& dirs,
710 bool isConstrained =
false;
711 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
713 if (dirs[cmpt] == -1)
715 isConstrained =
true;
724 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
726 if (dirs[cmpt] == -1)
738 const primitiveMesh&
mesh,
766 const label startEdgeI
769 if (!hexMatcher::test(
mesh, celli))
778 label edgeI = startEdgeI;
782 for (label i = 0; i < 3; i++)
789 if ((eVec & avgVec) > 0)
798 label vertI =
mesh.edges()[edgeI].end();
816 if (!hexMatcher::test(
mesh, celli))
826 scalar maxCos = -GREAT;
829 for (label i = 0; i < 4; i++)
833 label e0 = cEdges[cEdgeI];
835 if (!doneEdges.found(e0))
839 scalar cosAngle =
mag(avgDir & cutDir);
841 if (cosAngle > maxCos)
851 doneEdges.insert(e0);
852 doneEdges.insert(e1);
853 doneEdges.insert(e2);
854 doneEdges.insert(e3);
861 if (!doneEdges.found(cEdges[cEdgeI]))
864 <<
"Cell:" << celli <<
" edges:" << cEdges <<
endl 865 <<
"Edge:" << cEdges[cEdgeI] <<
" not yet handled" 873 <<
"Problem : did not find edge aligned with " << cutDir
List< cell > cellList
List of cell.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
List< edge > edgeList
List of edge.
Cell-face mesh analysis engine.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
labelList faceLabels(nFaceLabels)
List< labelList > labelListList
List of labelList.
#define forAll(list, i)
Loop across all elements in list.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
List< face > faceList
List of faces.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
vectorField pointField
pointField is a vectorField.
const dimensionedScalar e
Elementary charge.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
OBJstream os(runTime.globalPath()/outputName)
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field...
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=cellModel::ref(cellModel::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].reset(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]
vector point
Point is a vector.
#define WarningInFunction
Report a warning using Foam::Warning.
A cell is defined as a list of faces with extra functionality.
tmp< pointField > points() const
Vertex coordinates. In octant coding.
Standard boundBox with extra functionality for use in octree.
Field< vector > vectorField
Specialisation of Field<T> for vector.
List< label > labelList
A List of labels.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
static constexpr const zero Zero
Global zero (0)