46void 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
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();
231Foam::smoothTriSurfaceMesh::smoothTriSurfaceMesh
234 const scalar featureAngle
239 isPointOnBorderEdge_(
nPoints())
241 calcFeatureEdges(featureAngle);
245Foam::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();
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
InfoProxy< IOobject > info() const noexcept
Return info proxy, for printing information to a stream.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void setSize(label n)
Alias for resize().
const edgeList & edges() const
const labelListList & edgeFaces() const
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,...
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
Variant of triSurfaceMesh that interpolates face-normals to obtain point normals.
virtual ~smoothTriSurfaceMesh()
Destructor.
virtual void getNormal(const List< pointIndexHit > &, vectorField &normal) const
From a set of points and indices get the normal.
A triangular face using a FixedList of labels corresponding to mesh vertices.
IOoject and searching on triSurface.
triSurfaceMesh(const triSurfaceMesh &)=delete
No copy construct.
virtual tmp< pointField > coordinates() const
Get representative set of element coordinates.
virtual tmp< pointField > points() const
Get the points that define the surface.
Triangulated surface description with patch information.
triSurface()
Default construct.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
PtrList< coordinateSystem > coordinates(solidRegions.size())
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))
#define DebugPout
Report an information message using Foam::Pout.
List< edge > edgeList
List of edge.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
Barycentric2D< scalar > barycentric2D
A scalar version of the templated Barycentric2D.
Ostream & endl(Ostream &os)
Add newline and flush stream.
constexpr scalar degToRad() noexcept
Multiplication factor for degrees to radians conversion.
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0).
vectorField pointField
pointField is a vectorField.
dimensionedScalar cos(const dimensionedScalar &ds)
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]
#define forAll(list, i)
Loop across all elements in list.
Unit conversion functions.