Go to the documentation of this file.
41 if ((faceNormals[faceLabels[i]] &
n) < SMALL)
65 octantNormal /=
mag(octantNormal);
80 pn[pointI] = pointNormals[pointI];
85 <<
"Average point normal not visible for point:"
110 else if (
n.x() < -SMALL)
126 else if (
n.y() < -SMALL)
141 else if (
n.z() < -SMALL)
154 for (
label octant = 0; octant < 8; octant++)
156 if (visOctant & mask)
170 pn[pointI] = octantNormal[visI];
174 pn[pointI] = vector::zero;
177 <<
"No visible octant for point:" << pp.
meshPoints()[pointI]
179 <<
"Normal set to " << pn[pointI] <<
endl;
208 os <<
"v " << pt.
x() <<
' ' << pt.
y() <<
' ' << pt.
z() <<
endl;
234 os <<
"v" <<
' ' << p1.
x() <<
' ' << p1.
y() <<
' ' << p1.
z() <<
endl;
235 os <<
"v" <<
' ' << p2.
x() <<
' ' << p2.
y() <<
' ' << p2.
z() <<
endl;
237 os <<
"l" <<
" " << (count + 1) <<
" " << (count + 2) <<
endl;
250 os <<
"v" <<
' ' << p1.
x() <<
' ' << p1.
y() <<
' ' << p1.
z() <<
endl;
253 <<
' ' << p2.
x() - p1.
x()
254 <<
' ' << p2.
y() - p1.
y()
255 <<
' ' << p2.
z() - p1.
z() <<
endl;
272 const cell& cFaces =
cells[cellLabels[i]];
276 usedFaces.
insert(cFaces[j]);
313 if (
mesh.isInternalFace(faceI))
317 (
mesh.faceOwner()[faceI] == cellI)
318 || (
mesh.faceNeighbour()[faceI] == cellI)
326 if (
mesh.faceOwner()[faceI] == cellI)
345 label edgeI = candidates[i];
347 const edge&
e = edges[edgeI];
349 if ((
e[0] == v0 &&
e[1] == v1) || (
e[0] == v1 &&
e[1] == v0))
371 label edgeI = v0Edges[i];
373 const edge&
e = edges[edgeI];
375 if ((
e.start() == v1) || (
e.end() == v1))
396 label edge0 = f0Edges[f0EdgeI];
400 label edge1 = f1Edges[f1EdgeI];
409 <<
"Faces " << f0 <<
" and " <<
f1 <<
" do not share an edge"
424 const cell& cFaces =
mesh.cells()[cell0I];
428 label faceI = cFaces[cFaceI];
432 mesh.isInternalFace(faceI)
434 mesh.faceOwner()[faceI] == cell1I
435 ||
mesh.faceNeighbour()[faceI] == cell1I
445 <<
"No common face for"
446 <<
" cell0I:" << cell0I <<
" faces:" << cFaces
447 <<
" cell1I:" << cell1I <<
" faces:"
448 <<
mesh.cells()[cell1I]
471 label faceI = eFaces[eFaceI];
488 if ((face0 == -1) || (face1 == -1))
491 <<
"Can not find faces using edge " <<
mesh.edges()[edgeI]
501 const label thisEdgeI,
502 const label thisVertI
505 forAll(edgeLabels, edgeLabelI)
507 label edgeI = edgeLabels[edgeLabelI];
509 if (edgeI != thisEdgeI)
513 if ((
e.start() == thisVertI) || (
e.end() == thisVertI))
521 <<
"Can not find edge in "
523 <<
" connected to edge "
524 << thisEdgeI <<
" with vertices " <<
mesh.edges()[thisEdgeI]
558 const label otherCellI,
562 if (!
mesh.isInternalFace(faceI))
565 <<
"Face " << faceI <<
" is not internal"
569 label newCellI =
mesh.faceOwner()[faceI];
571 if (newCellI == otherCellI)
573 newCellI =
mesh.faceNeighbour()[faceI];
583 const label startEdgeI,
584 const label startVertI,
590 label edgeI = startEdgeI;
592 label vertI = startVertI;
594 for (
label iter = 0; iter < nEdges; iter++)
598 vertI =
mesh.edges()[edgeI].otherVertex(vertI);
616 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
618 if (dirs[cmpt] == -1)
620 pt[cmpt] = 0.5*(
min[cmpt] +
max[cmpt]);
637 bool isConstrained =
false;
638 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
640 if (dirs[cmpt] == -1)
642 isConstrained =
true;
651 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
653 if (dirs[cmpt] == -1)
655 pts[i][cmpt] = 0.5*(
min[cmpt] +
max[cmpt]);
670 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
672 if (dirs[cmpt] == -1)
687 bool isConstrained =
false;
688 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
690 if (dirs[cmpt] == -1)
692 isConstrained =
true;
701 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
703 if (dirs[cmpt] == -1)
743 const label startEdgeI
755 label edgeI = startEdgeI;
759 for (
label i = 0; i < 3; i++)
766 if ((eVec & avgVec) > 0)
780 avgVec /=
mag(avgVec) + VSMALL;
803 scalar maxCos = -GREAT;
806 for (
label i = 0; i < 4; i++)
810 label e0 = cEdges[cEdgeI];
812 if (!doneEdges.
found(e0))
816 scalar cosAngle =
mag(avgDir & cutDir);
818 if (cosAngle > maxCos)
838 if (!doneEdges.
found(cEdges[cEdgeI]))
841 <<
"Cell:" << cellI <<
" edges:" << cEdges <<
endl
842 <<
"Edge:" << cEdges[cEdgeI] <<
" not yet handled"
850 <<
"Problem : did not find edge aligned with " << cutDir
const labelListList & pointFaces() const
Return point-face addressing.
const Field< PointType > & points() const
Return reference to global points.
List< Key > toc() const
Return the table of contents.
#define forAll(list, i)
Loop across all elements in list.
void writeOBJ(Ostream &os, label &vertI, const tetPoints &tet)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< scalar > mag(const dimensioned< Type > &)
Mesh consisting of general polyhedral cells.
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]
A cellMatcher for hex cells.
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.
label nPoints() const
Return number of points supporting patch faces.
bool found(const Key &) const
Return true if hashedEntry is found in table.
errorManip< error > abort(error &err)
Vector< scalar > vector
A scalar version of the templated Vector.
Representation of a 3D Cartesian coordinate system as a Vector of vectors.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
const Field< PointType > & pointNormals() const
Return point normals for patch.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const Field< PointType > & faceNormals() const
Return face normals for patch.
bool isA(const Type &t)
Check if a dynamic_cast to typeid is possible.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
const dimensionedScalar e
Elementary charge.
bool insert(const Key &key)
Insert a new entry.
A List with indirect addressing.
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,...
const labelList & meshPoints() const
Return labelList of mesh points in patch.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
#define WarningInFunction
Report a warning using Foam::Warning.
A cell is defined as a list of faces with extra functionality.
A list of faces which address into the list of points.
Cell-face mesh analysis engine.