41 if ((faceNormals[faceLabels[i]] & n) < SMALL)
65 octantNormal /=
mag(octantNormal);
78 if (
visNormal(pointNormals[pointi], faceNormals, pFaces))
80 pn[pointi] = pointNormals[pointi];
85 <<
"Average point normal not visible for point:" 100 const vector& n = faceNormals[pFaces[i]];
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];
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]);
280 writeOBJ(os, faces, points, usedFaces.toc());
346 label edgeI = candidates[i];
348 const edge&
e = edges[edgeI];
350 if ((e[0] == v0 && e[1] == v1) || (e[0] == v1 && e[1] == v0))
372 label edgeI = v0Edges[i];
374 const edge&
e = edges[edgeI];
376 if ((e.
start() == v1) || (e.
end() == v1))
397 label edge0 = f0Edges[f0EdgeI];
401 label edge1 = f1Edges[f1EdgeI];
410 <<
"Faces " << f0 <<
" and " << f1 <<
" do not share an edge" 425 const cell& cFaces = mesh.
cells()[cell0I];
429 label facei = cFaces[cFacei];
446 <<
"No common face for" 447 <<
" cell0I:" << cell0I <<
" faces:" << cFaces
448 <<
" cell1I:" << cell1I <<
" faces:" 449 << mesh.
cells()[cell1I]
473 label facei = eFaces[eFacei];
490 if ((face0 == -1) || (face1 == -1))
493 <<
"Can not find faces using edge " << mesh.
edges()[edgeI]
504 const label thisEdgeI,
505 const label thisVertI
508 forAll(edgeLabels, edgeLabelI)
510 label edgeI = edgeLabels[edgeLabelI];
512 if (edgeI != thisEdgeI)
516 if ((e.
start() == thisVertI) || (e.
end() == thisVertI))
524 <<
"Can not find edge in " 526 <<
" connected to edge " 527 << thisEdgeI <<
" with vertices " << mesh.
edges()[thisEdgeI]
563 const label otherCelli,
570 <<
"Face " << facei <<
" is not internal" 576 if (newCelli == otherCelli)
590 const label startEdgeI,
591 const label startVertI,
597 label edgeI = startEdgeI;
599 label vertI = startVertI;
601 for (
label iter = 0; iter < nEdges; iter++)
603 edgeI =
otherEdge(mesh, fEdges, edgeI, vertI);
605 vertI = mesh.
edges()[edgeI].otherVertex(vertI);
623 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
625 if (dirs[cmpt] == -1)
627 pt[cmpt] = 0.5*(min[cmpt] + max[cmpt]);
644 bool isConstrained =
false;
645 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
647 if (dirs[cmpt] == -1)
649 isConstrained =
true;
658 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
660 if (dirs[cmpt] == -1)
662 pts[i][cmpt] = 0.5*(min[cmpt] + max[cmpt]);
677 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
679 if (dirs[cmpt] == -1)
694 bool isConstrained =
false;
695 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
697 if (dirs[cmpt] == -1)
699 isConstrained =
true;
708 for (
direction cmpt=0; cmpt<vector::nComponents; cmpt++)
710 if (dirs[cmpt] == -1)
750 const label startEdgeI
762 label edgeI = startEdgeI;
766 for (
label i = 0; i < 3; i++)
773 if ((eVec & avgVec) > 0)
787 avgVec /=
mag(avgVec) + VSMALL;
811 scalar maxCos = -GREAT;
814 for (
label i = 0; i < 4; i++)
818 label e0 = cEdges[cEdgeI];
820 if (!doneEdges.found(e0))
824 scalar cosAngle =
mag(avgDir & cutDir);
826 if (cosAngle > maxCos)
836 doneEdges.insert(e0);
837 doneEdges.insert(e1);
838 doneEdges.insert(e2);
839 doneEdges.insert(e3);
846 if (!doneEdges.found(cEdges[cEdgeI]))
849 <<
"Cell:" << celli <<
" edges:" << cEdges <<
endl 850 <<
"Edge:" << cEdges[cEdgeI] <<
" not yet handled" 858 <<
"Problem : did not find edge aligned with " << cutDir
bool isA(const Type &t)
Check if a dynamic_cast to typeid is possible.
label end() const
Return end vertex label.
label nPoints() const
Return number of points supporting patch faces.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const boundBox & bounds() const
Return mesh bounding box.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
const point & min() const
Minimum describing the bounding box.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Cell-face mesh analysis engine.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
void size(const label)
Override size to be inconsistent with allocated storage.
const Vector< label > & geometricD() const
Return the vector of geometric directions in mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Field< PointType > & points() const
Return reference to global points.
virtual const pointField & points() const =0
Return mesh points.
const point & max() const
Maximum describing the bounding box.
const Field< PointType > & pointNormals() const
Return point normals for patch.
A cellMatcher for hex cells.
Vector< scalar > vector
A scalar version of the templated Vector.
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
iterator end()
Return an iterator to end traversing the UList.
const cellList & cells() const
const labelListList & edgeFaces() const
virtual const labelList & faceNeighbour() const =0
Face face-neighbour addressing.
A list of faces which address into the list of points.
const dimensionedScalar e
Elementary charge.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
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]
const labelListList & pointEdges() const
errorManip< error > abort(error &err)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
label start() const
Return start vertex label.
const labelListList & cellEdges() const
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
const labelListList & edgeCells() const
Representation of a 3D Cartesian coordinate system as a Vector of vectors.
const Field< PointType > & faceNormals() const
Return face normals for patch.
#define WarningInFunction
Report a warning using Foam::Warning.
A cell is defined as a list of faces with extra functionality.
A List with indirect addressing.
virtual const labelList & faceOwner() const =0
Face face-owner addresing.
dimensioned< scalar > mag(const dimensioned< Type > &)
Mesh consisting of general polyhedral cells.
const labelListList & pointFaces() const
Return point-face addressing.
const labelListList & faceEdges() const