Go to the documentation of this file.
64 "inline void meshSurfaceOptimizer::updateTriMesh"
65 "(const labelLongList&)"
76 "inline void meshSurfaceOptimizer::updateTriMesh()"
93 Pout <<
"Transforming boundary node " << bpI <<
endl;
112 const scalar d =
mag(sp -
p);
117 vecY = pl.
normal() ^ vecX;
141 ((sPts[pI] -
p) & vecX),
142 ((sPts[pI] -
p) & vecY),
150 Info <<
"Original triangles " <<
endl;
153 Info <<
"Transformed triangles are " << trias <<
endl;
154 Info <<
"Transformed vertices " << pts <<
endl;
159 sPoints.setSize(pts.
size());
189 const bool transformIntoPlane
192 const VRWGraph& pPoints = surfaceEngine_.pointPoints();
194 const labelList& bPoints = surfaceEngine_.boundaryPoints();
196 if( vertexType_[bpI] & LOCKED )
197 return points[bPoints[bpI]];
200 if( transformIntoPlane )
202 const vector& pNormal = surfaceEngine_.pointNormals()[bpI];
204 if(
magSqr(pNormal) < VSMALL )
205 return points[bPoints[bpI]];
212 projectedPoints[pI] =
215 forAll(projectedPoints, pI)
216 newP += projectedPoints[pI];
218 newP /= projectedPoints.
size();
223 newP +=
points[bPoints[pPoints(bpI, pI)]];
234 const bool transformIntoPlane
237 const VRWGraph& pointFaces = surfaceEngine_.pointFaces();
239 const vectorField& faceCentres = surfaceEngine_.faceCentres();
240 const labelList& bPoints = surfaceEngine_.boundaryPoints();
242 if( vertexType_[bpI] & LOCKED )
243 return points[bPoints[bpI]];
247 if( transformIntoPlane )
249 const vector& pNormal = surfaceEngine_.pointNormals()[bpI];
251 if(
magSqr(pNormal) < VSMALL )
252 return points[bPoints[bpI]];
259 projectedPoints[pfI] =
262 forAll(projectedPoints, pI)
263 newP += projectedPoints[pI];
265 newP /= projectedPoints.
size();
270 newP += faceCentres[pointFaces(bpI, pfI)];
281 const bool transformIntoPlane
284 const VRWGraph& pointFaces = surfaceEngine_.pointFaces();
286 const vectorField& faceAreas = surfaceEngine_.faceNormals();
287 const vectorField& faceCentres = surfaceEngine_.faceCentres();
288 const labelList& bPoints = surfaceEngine_.boundaryPoints();
290 if( vertexType_[bpI] & LOCKED )
291 return points[bPoints[bpI]];
295 if( transformIntoPlane )
297 const vector& pNormal = surfaceEngine_.pointNormals()[bpI];
299 if(
magSqr(pNormal) < VSMALL )
300 return points[bPoints[bpI]];
307 projectedPoints[pfI] =
311 forAll(projectedPoints, pI)
313 const label bfI = pointFaces(bpI, pI);
314 const scalar
w = (faceAreas[bfI] & faceAreas[bfI]);
315 newP +=
w * projectedPoints[pI];
326 const label bfI = pointFaces(bpI, pfI);
327 const scalar
w = (faceAreas[bfI] & faceAreas[bfI]);
328 newP +=
w * faceCentres[pointFaces(bpI, pfI)];
345 const labelList& bPoints = surfaceEngine_.boundaryPoints();
347 if( vertexType_[bpI] & LOCKED )
348 return points[bPoints[bpI]];
351 Pout <<
"Smoothing boundary node " << bpI <<
endl;
352 Pout <<
"Node label in the mesh is " << bPoints[bpI] <<
endl;
357 const vector& pNormal = surfaceEngine_.pointNormals()[bpI];
358 if(
magSqr(pNormal) < VSMALL )
359 return points[bPoints[bpI]];
366 bool success = this->transformIntoPlane(bpI, pl, vecX, vecY, pts, trias);
370 return points[bPoints[bpI]];
379 vecX * newPoint.
x() +
387 "inline point meshSurfaceOptimizer::newPositionSurfaceOptimizer"
388 "(const label, const scalar) const"
389 ) <<
"Cannot move point " << bpI <<
endl;
391 return points[bPoints[bpI]];
402 const labelList& bPoints = surfaceEngine_.boundaryPoints();
403 const edgeList& edges = surfaceEngine_.edges();
404 const VRWGraph& bpEdges = surfaceEngine_.boundaryPointEdges();
407 if( vertexType_[bpI] & LOCKED )
408 return points[bPoints[bpI]];
410 const labelHashSet& featureEdges = partitionerPtr_->featureEdges();
416 const label beI = bpEdges(bpI, i);
418 if( featureEdges.
found(beI) )
420 edgePoints.
append(edges[beI].otherVertex(bPoints[bpI]));
424 if( edgePoints.
size() != 2 )
425 return points[bPoints[bpI]];
428 Info <<
"Edge points " << edgePoints <<
endl;
435 pos /= edgePoints.size();
440 template<
class labelListType>
449 # pragma omp parallel for schedule(dynamic, 20)
473 const label bpI = it();
479 const label neiProc = bpAtProcs(bpI, i);
494 const label bpI = globalToLocal[receivedData[i]];
501 template<
class labelListType>
505 # pragma omp parallel for schedule(dynamic, 50)
509 const label bpI = l[i];
528 const label bpI = it();
534 const label neiProc = bpAtProcs(bpI, i);
549 const label bpI = globalToLocal[receivedData[i]];
560 # pragma omp parallel for schedule(dynamic, 50)
const VRWGraph & bpAtProcs() const
processors which contain the vertex
const vector & normal() const
Return plane normal.
const labelList & bp() const
point nearestPoint(const point &p) const
Return nearest point in the plane for the given point.
volScalarField w(IOobject("w", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE), mesh, dimensionedScalar("w", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0.0))
A class for handling file names.
point newPositionLaplacian(const label bpI, const bool transformIntoPlane=true) const
labelLongList lockedSurfaceFaces_
locked faces which shall not be changed
point optimizePoint(const scalar tol=0.1)
optimizes position of a central point in the simplex
partTriMesh * triMeshPtr_
mesh of surface triangles needed for some smoothers
bool isnan(const ListType &)
check if a list has nan entries
#define forAll(list, i)
Loop across all elements in list.
void lockBoundaryPoints(const labelListType &)
lock boundary points. They are not be moved.
Template functions to aid in the implementation of demand driven data.
A List obtained as a section of another List.
const labelList & meshSurfacePointLabelInTriMesh() const
word scalarToText(const scalar s)
convert the scalar value into text
static bool & parRun()
Is this a parallel run?
const DynList< label > & bpNeiProcs() const
communication matrix for sending point data
void exchangeData(const labelLongList &nodesToSmooth, std::map< label, DynList< parTriFace > > &m) const
transfer data between processors
point newEdgePositionLaplacian(const label bpI) const
Ostream & endl(Ostream &os)
Add newline and flush stream.
const partTriMesh & triMesh() const
dimensioned< scalar > mag(const dimensioned< Type > &)
bool transformIntoPlane(const label bpI, const plane &pl, vector &vecX, vector &vecY, DynList< point > &pts, DynList< triFace > &trias) const
transform into a 2D space in plane
geometricSurfacePatchList & patchesAccess()
access to patches
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
bool isinf(const ListType &)
check if a list has inf entries
void setSize(const label)
Reset size of List.
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
const faceList::subList & boundaryFaces() const
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 point & centrePoint() const
return centre point coordinates
Pre-declare SubField and related Field type.
pointField & pointsAccess()
non-const access to points
DynList< point, 32 > & pts()
return points
List< direction > vertexType_
type of surface vertex
LongList< labelledTri > & facetsAccess()
access to facets
#define forAllRow(graph, rowI, index)
label sizeOfRow(const label rowI) const
Returns the number of elements in the given row.
bool found(const Key &) const
Return true if hashedEntry is found in table.
errorManip< error > abort(error &err)
point newPositionSurfaceOptimizer(const label bpI, const scalar tol=0.001) const
new position of a node after using surfaceOptimizer
const meshSurfaceEngine & surfaceEngine_
const reference to the mesh surface
void calculateTrianglesAndAddressing() const
calculate surface triangulation
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
point newPositionLaplacianFC(const label bpI, const bool transformIntoPlane=true) const
void setSize(const label)
Reset size of List.
prefixOSstream Pout(cout, "Pout")
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void setSize(const label)
Reset size of List.
void lockBoundaryFaces(const labelListType &)
lock the boundary faces which shall not be modified
void exchangeMap(const std::map< label, ListType > &m, LongList< T > &data, const Pstream::commsTypes commsType)
Triangle with additional region number.
void writeSurface(const fileName &) const
const DynList< triFace, 32 > & triangles() const
return triangles
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
A face is a list of labels corresponding to mesh vertices.
#define WarningIn(functionName)
Report a warning using Foam::Warning.
const Map< label > & globalToLocalBndPointAddressing() const
global point label to local label. Only for processors points
void lockFeatureEdges()
lock edge points
point newPositionLaplacianWFC(const label bpI, const bool transformIntoPlane=true) const
dimensioned< scalar > magSqr(const dimensioned< Type > &)
void append(const T &e)
Append an element at the end of the list.
dimensionedScalar pos(const dimensionedScalar &ds)