Go to the documentation of this file.
58 std::map<label, scalar>& mappingDistance
61 const vectorField& faceCentres = surfaceEngine_.faceCentres();
62 const VRWGraph& eFaces = surfaceEngine_.edgeFaces();
63 const edgeList& edges = surfaceEngine_.edges();
67 mappingDistance.clear();
70 const label beI = edgesToMap[i];
72 mappingDistance.insert(std::make_pair(beI, 0.0));
73 std::map<label, scalar>::iterator mIter = mappingDistance.find(beI);
78 const scalar d =
magSqr(faceCentres[eFaces(beI, efI)] -
p);
79 mIter->second =
Foam::max(mIter->second, d);
83 mIter->second *= 16.0;
90 const VRWGraph& beAtProcs = surfaceEngine_.beAtProcs();
92 surfaceEngine_.globalBoundaryEdgeLabel();
94 surfaceEngine_.globalToLocalBndEdgeAddressing();
97 std::map<label, DynList<labelledScalar> > exchangeData;
106 const label beI = edgesToMap[eI];
110 const label neiProc = beAtProcs(beI, i);
114 exchangeData[neiProc].append
133 std::map<label, scalar>::iterator mIter = mappingDistance.find(beI);
144 std::map<label, LongList<parMapperHelper> > exchangeData;
165 const label beI = parE[i].globalLabel();
166 beToList.insert(beI, i);
170 const label neiProc = beAtProcs(beI, procI);
174 exchangeData[neiProc].append
179 parE[i].movingDistance(),
180 globalEdgeLabel[beI],
202 const edge&
e = edges[beI];
234 # pragma omp parallel for schedule(dynamic, 50)
240 if( minZPoint[pointI] )
242 newP.
z() = sbb.
min().
z();
244 else if( maxZPoint[pointI] )
246 newP.
z() = sbb.
max().
z();
252 "void meshSurfaceMapper2D::adjustZCoordinates()"
285 const edge&
e = edges[edgesToMap[i]];
286 nodesToMap.
append(bp[
e.start()]);
287 nodesToMap.
append(bp[
e.end()]);
295 # pragma omp parallel for if( size > 1000 ) shared(parallelBndEdges) \
296 schedule(dynamic, Foam::max(1, size / (3 * omp_get_max_threads())))
300 const label beI = edgesToMap[i];
301 const edge&
e = edges[beI];
304 Info <<
nl <<
"Mapping edge " << beI <<
" with nodes "
321 mapPoint.
z() =
points[
e.start()].z();
327 if( beAtProcsPtr && beAtProcsPtr->
sizeOfRow(beI) )
330 # pragma omp critical
345 Info <<
"Mapped edge " << edges[beI] <<
endl;
366 if( cornerPoints.
found(
e.start()) || cornerPoints.
found(
e.end()) )
383 std::map<label, scalar> mappingDistance;
391 # pragma omp parallel for if( edgesToMap.size() > 10 )
395 const label beI = edgesToMap[eI];
396 const edge& be = edges[beI];
404 if( pPatches.
contains(bpe, pPatches(bps, i)) )
405 ePatches.
append(pPatches(bps, i));
408 if( !corners.
found(bps) || !corners.
found(bpe) )
411 "meshSurfaceMapper2D::mapCorners(const labelLongList&)"
412 ) <<
"Trying to map a point that is not a corner"
416 const scalar maxDist = mappingDistance[beI];
442 newP /= ePatches.
size();
443 if(
magSqr(newP - mapPointApprox) < 1
e-8 * maxDist )
446 mapPointApprox = newP;
449 distSqApprox =
magSqr(mapPointApprox -
p);
457 if( distSq > mappingDistance[beI] )
459 const vector disp = mapPoint -
p;
461 mapPoint =
Foam::sqrt(mappingDistance[beI] / distSq) * disp +
p;
462 distSq = mappingDistance[beI];
465 if( distSq > 1.2 * distSqApprox )
467 mapPoint = mapPointApprox;
481 const edge& be = edges[edgesToMap[eI]];
506 const edgeList& edges = surfaceEngine_.edges();
508 const VRWGraph& edgePatches = surfaceEngine_.edgePatches();
509 const labelList& bp = surfaceEngine_.bp();
513 beAtProcsPtr = &surfaceEngine_.beAtProcs();
521 # pragma omp parallel for if( size > 1000 ) shared(parallelBndEdges) \
522 schedule(dynamic, Foam::max(50, size / (3 * omp_get_max_threads())))
526 const label beI = edgesToMap[nI];
531 # pragma omp critical
533 selectedCorners.
append(beI);
538 const edge&
e = edges[beI];
545 meshOctree_.findNearestSurfacePointInRegion
554 mapPoint.
z() =
points[
e.start()].z();
560 if( beAtProcsPtr && beAtProcsPtr->
sizeOfRow(beI) )
563 # pragma omp critical
578 Info <<
"Mapped edge " << edges[beI] <<
endl;
582 mapToSmallestDistance(parallelBndEdges);
584 mapCorners(selectedCorners);
587 selectedCorners.
clear();
590 const edge&
e = edges[edgesToMap[eI]];
592 selectedCorners.
append(bp[
e.start()]);
593 selectedCorners.
append(bp[
e.end()]);
const VRWGraph & beAtProcs() const
processors which contain the edges
const labelList & bp() const
void append(const T &e)
Append an element at the end of the list.
label globalLabel() const
return global label
const point & max() const
Maximum describing the bounding box.
const Map< label > & globalToLocalBndEdgeAddressing() const
global boundary edge label to local label. Only for processor edges
const labelList & globalBoundaryEdgeLabel() const
global boundary edge label
#define forAll(list, i)
Loop across all elements in list.
void findNearestSurfacePoint(point &nearest, scalar &distSq, label &nearestTriangle, label ®ion, const point &p) const
find nearest surface point for vertex and its region
const pointField & points() const
access to points
void updateVertexNormals()
update normals of boundary vertices at processor boundaries
void clear()
Clear the list, i.e. set next free to zero.
static bool & parRun()
Is this a parallel run?
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.
label size() const
Size of the active part of the list.
Basic pointPatch represents a set of points from the mesh.
const polyMeshGen2DEngine & mesh2DEngine() const
create and return mesh 2D engine
const boolList & zMinPoints() const
bool contains(const label rowI, const label e) const
check if the element is in the given row (takes linear time)
label scalarLabel() const
return scalar label
const VRWGraph & pointPatches() const
const scalar & movingDistance() const
return moving distance
const scalar & value() const
return the value
label end() const
Return end vertex label.
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.
bool findNearestEdgePoint(point &edgePoint, scalar &distSq, label &nearestEdge, const point &p, const DynList< label > ®ions) const
find nearest feature-edges vertex to a given vertex
void moveBoundaryVertexNoUpdate(const label bpI, const point &newP)
relocate the selected boundary vertex
const DynList< label > & beNeiProcs() const
communication matrix for sending edge data
labelLongList activeBoundaryEdges_
#define forAllRow(graph, rowI, index)
void moveBoundaryVertex(const label bpI, const point &newP)
relocate the selected boundary vertex and update geometry data
const point & min() const
Minimum describing the bounding box.
const pointFieldPMG & points() const
PtrList< coordinateSystem > coordinates(solidRegions.size())
label sizeOfRow(const label rowI) const
Returns the number of elements in the given row.
const boolList & zMaxPoints() const
void mapVerticesOntoSurface()
bool found(const Key &) const
Return true if hashedEntry is found in table.
void updateGeometry(const labelLongList &)
errorManip< error > abort(error &err)
const double e
Elementary charge.
const meshOctree & meshOctree_
reference to the octree
const edgeList & edges() const
const meshSurfaceEngine & surfaceEngine_
reference to mesh surface
errorManipArg< error, int > exit(error &err, const int errNo=1)
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
const point & coordinates() const
return point coordinates
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
void mapVerticesOntoSurfacePatches()
label start() const
Return start vertex label.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
dimensionedScalar sqrt(const dimensionedScalar &ds)
const meshSurfacePartitioner & meshPartitioner() const
create and return mesh surface partitioner
void findMappingDistance(const labelLongList &, std::map< label, scalar > &) const
find mapping distance for corner points
void exchangeMap(const std::map< label, ListType > &m, LongList< T > &data, const Pstream::commsTypes commsType)
A bounding box defined in terms of the points at its extremities.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
void findNearestSurfacePointInRegion(point &nearest, scalar &distSq, label &nearestTriangle, const label region, const point &p) const
find nearest surface point for vertex in a given region
const triSurf & surface() const
return a reference to the surface
const labelHashSet & corners() const
return labels of corner points (from the list of boundary points)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
void mapToSmallestDistance(LongList< parMapperHelper > &)
map to the location with the smallest distance
void adjustZCoordinates()
adjust z coordinates of the mesh to the ones in the surface mesh
void append(const T &e)
Append an element at the end of the list.