46 void Foam::smoothTriSurfaceMesh::calcFeatureEdges(
const scalar featureAngle)
48 if (featureAngle <= -180)
64 if (eFaces.size() > 2)
66 isBorderEdge_[edgei] =
true;
68 else if (eFaces.size() == 2)
72 if ((n0&n1) < cosAngle)
74 isBorderEdge_[edgei] =
true;
79 forAll(isBorderEdge_, edgei)
81 if (isBorderEdge_[edgei])
83 const edge&
e =
edges[edgei];
84 isPointOnBorderEdge_[
e[0]] =
true;
85 isPointOnBorderEdge_[
e[1]] =
true;
93 const label startFacei,
94 const label localPointi
97 const triSurface&
s = *
this;
99 if (!isPointOnBorderEdge_[localPointi])
106 pn +=
s[facei].unitNormal(
points());
108 return pn.normalise();
117 const labelList& fEdges = faceEdges()[startFacei];
124 const edge&
e = edges[fEdges[i]];
125 if (
e.otherVertex(localPointi) == -1)
127 e0 = fEdges[fEdges.rcIndex(i)];
128 e1 = fEdges[fEdges.fcIndex(i)];
133 label facei = startFacei;
139 while (!isBorderEdge_[edgei])
142 const labelList& eFaces = edgeFaces()[edgei];
143 if (eFaces.size() != 2)
150 if (eFaces[i] != facei)
157 if (facei == startFacei)
165 const labelList& fEdges = faceEdges()[facei];
169 label ei = fEdges[i];
170 if (ei != edgei && edges[ei].otherVertex(localPointi) != -1)
185 while (!isBorderEdge_[edgei])
188 const labelList& eFaces = edgeFaces()[edgei];
189 if (eFaces.size() != 2)
196 if (eFaces[i] != facei)
203 if (facei == startFacei)
211 const labelList& fEdges = faceEdges()[facei];
215 label ei = fEdges[i];
216 if (ei != edgei && edges[ei].otherVertex(localPointi) != -1)
225 return n.normalise();
231 Foam::smoothTriSurfaceMesh::smoothTriSurfaceMesh
234 const scalar featureAngle
238 isBorderEdge_(nEdges()),
241 calcFeatureEdges(featureAngle);
245 Foam::smoothTriSurfaceMesh::smoothTriSurfaceMesh
252 isBorderEdge_(nEdges()),
253 isPointOnBorderEdge_(
nPoints())
255 if (
dict.found(
"featureAngle"))
257 calcFeatureEdges(readScalar(
dict.lookup(
"featureAngle")));
279 DebugPout<<
"smoothTriSurfaceMesh::getNormal :" 281 <<
" tris:" << s.
size()
282 <<
" feat edges:" << isBorderEdge_.count()
291 label facei = info[i].index();
296 s[facei].tri(
pts).pointToBarycentric(info[i].hitPoint())
300 const triFace& localTri =
s.localFaces()[facei];
307 normal[i] =
n.normalise();
void size(const label n)
Older name for setAddressableSize.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
List< edge > edgeList
List of edge.
const word & name() const noexcept
Return the object name.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
virtual tmp< pointField > points() const
Get the points that define the surface.
Unit conversion functions.
virtual ~smoothTriSurfaceMesh()
Destructor.
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< labelList > labelListList
List of labelList.
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
IOoject and searching on triSurface.
Templated 2D Barycentric derived from VectorSpace. Has 3 components, one of which is redundant...
const dimensionedScalar e
Elementary charge.
void setSize(const label n)
Alias for resize()
dimensionedScalar cos(const dimensionedScalar &ds)
A triangular face using a FixedList of labels corresponding to mesh vertices.
const labelListList & edgeFaces() const
Return edge-face addressing.
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];} pointMap[start]=pointMap[end]=Foam::min(start, end);} } 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};constexpr 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< DynamicList< face > > pFaces[nBCs]
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
defineTypeNameAndDebug(combustionModel, 0)
triSurface()
Default construct.
PtrList< coordinateSystem > coordinates(solidRegions.size())
#define DebugPout
Report an information message using Foam::Pout.
List< label > labelList
A List of labels.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
Triangulated surface description with patch information.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
constexpr scalar degToRad(const scalar deg) noexcept
Conversion from degrees to radians.
Defines the attributes of an object for which implicit objectRegistry management is supported...
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
static constexpr const zero Zero
Global zero (0)