66 # pragma omp parallel for if( pPatches.size() > 1000 ) \
67 schedule(dynamic, Foam::max(10, pPatches.size()/(2*omp_get_num_threads())))
71 bool hasTreated(
false);
72 bool hasNotTreated(
false);
76 const label patch = pPatches(bpI, patchI);
77 if( treatPatches[patch] )
89 pVertices[bpI] |= PATCHNODE;
92 pVertices[bpI] |= EDGENODE;
100 if( pVertices[bpI] && (bpAtProcs.
sizeOfRow(bpI) != 0) )
101 pVertices[bpI] |= PARALLELBOUNDARY;
126 Info <<
"Creating new vertex for boundary vertex " << bpI <<
endl;
127 Info <<
"Global vertex label " << bPoints[bpI] <<
endl;
133 if( patchVertex[bpI] & EDGENODE )
136 Info <<
"Vertex is on the border" <<
endl;
141 if( !treatPatches[pPatches(bpI, patchI)] )
144 pPatches(bpI, patchI)
147 if( otherPatches.
size() == 1 )
151 Info <<
"Vertex is on an edge" <<
endl;
158 const label patchLabel =
159 boundaryFacePatches[
pFaces(bpI, pfI)];
161 if( treatPatches[patchLabel] )
171 const scalar magV =
mag(v) + VSMALL;
176 const scalar magN =
mag(
normal) + VSMALL;
181 if( patchVertex[pointPoints(bpI, ppI)] )
184 const vector vec =
points[bPoints[pointPoints(bpI, ppI)]] -
p;
185 const scalar prod = 0.5 *
mag(vec &
normal);
191 else if( otherPatches.
size() == 2 )
194 Info <<
"Vertex is a corner" <<
endl;
197 label otherVertex(-1);
200 const label bpJ = pointPoints(bpI, ppI);
204 if( !pPatches.
contains(bpJ, otherPatches[opI]) )
217 if( otherVertex == -1 )
221 "void boundaryLayers::createNewVertices"
223 "const boolList& treatPatches,"
224 "labelList& newLabelForVertex"
239 "void boundaryLayers::createNewVertices"
241 "const boolList& treatPatches,"
242 "labelList& newLabelForVertex"
244 ) <<
"There are more than 3 patches meeting at this vertex!"
252 if( otherPatches.
contains(boundaryFacePatches[faceLabel]) )
254 const face&
f = bFaces[faceLabel];
272 "void boundaryLayers::createNewVertices"
274 "const boolList& treatPatches,"
275 "labelList& newLabelForVertex"
277 ) <<
"Face does not contains this vertex!"
292 points[bPoints[pointPoints(bpI, ppI)]] -
304 Info <<
"Distance is " << dist <<
endl;
319 Info <<
"Creating vertices for layer cells" <<
endl;
337 label nExtrudedVertices(0);
339 if( patchVertex[bpI] )
346 if( patchVertex[bpI] )
391 "void boundaryLayers::createNewVertices("
392 "const meshSurfaceEngine& mse,"
393 "const boolList& treatPatches,"
394 "labelList& newLabelForVertex)"
395 ) <<
"Number of vertices " <<
nPoints_
396 <<
" does not match the list size "
399 Info <<
"Finished creating layer vertices" <<
endl;
430 forAll(patchLabels, patchI)
432 const label pLabel = patchLabels[patchI];
433 treatPatches =
false;
439 treatPatches[otherPatch] =
true;
463 if( !patchVertex[bpI] )
475 const label pointI = bPoints[bpI];
481 std::map<std::pair<label, label>,
label> m;
486 std::pair<label, label> pr(pKey, pKey);
501 # pragma omp parallel for schedule(dynamic, 50)
505 const label bpI = patchPoints[i];
507 const label pointI = bPoints[bpI];
517 std::map<std::pair<label, label>,
label> m;
522 std::pair<label, label> pr(pKey, pKey);
557 const label pointI = bPoints[bpI];
571 const std::pair<label, label> pr(pKey, pKey);
572 const std::map<std::pair<label, label>,
label>::const_iterator it =
574 if( (it != m.end()) && !usedPatches.
contains(pKey) )
577 newNodeLabel.
append(it->second);
582 if( newNodeLabel.
size() == 1 )
588 else if( newNodeLabel.
size() == 2 )
593 newP += newPatchPenetrationVector[0];
594 newP += newPatchPenetrationVector[1];
607 else if( newNodeLabel.
size() == 3 )
612 for(
label i=0;i<3;++i)
614 newP += newPatchPenetrationVector[i];
615 for(
label j=i+1;j<3;++j)
618 p + newPatchPenetrationVector[i] +
619 newPatchPenetrationVector[j];
634 std::make_pair(usedPatches[i], usedPatches[j]),
659 "void boundaryLayers::createNewVertices("
660 "const labelList& patchLabels, labelLongList& newLabelForVertex,"
661 "std::map<label, std::map<std::pair<label, label>, label> >&)"
662 ) <<
"Boundary node " << bpI <<
" is not at an edge!"
669 # pragma omp parallel for if( bPoints.size() > 1000 ) \
670 schedule(dynamic, 100)
708 std::map<label, LongList<labelledScalar> > exchangeDistances;
710 forAll(procPoints, pointI)
712 const label bpI = procPoints[pointI];
715 const label neiProc = bpAtProcs(bpI, procI);
719 if( exchangeDistances.find(neiProc) == exchangeDistances.end() )
721 exchangeDistances.insert
728 if( pVertices[bpI] & EDGENODE )
736 0.5 *
mag(
points[bPoints[pointPoints(bpI, ppI)]] -
p);
742 penetrationDistances[bpI] = dist;
746 const label neiProc = bpAtProcs(bpI, procI);
750 exchangeDistances[neiProc].append
762 const label bpI = globalToLocal[receivedData[i].scalarLabel()];
764 if( penetrationDistances[bpI] > receivedData[i].value() )
765 penetrationDistances[bpI] = receivedData[i].value();
770 forAll(procPoints, pointI)
772 const label bpI = procPoints[pointI];
774 if( pVertices[bpI] & EDGENODE )
778 const point np =
p - pNormals[bpI] * penetrationDistances[bpI];
787 newLabelForVertex_[bPoints[bpI]] = nPoints_;
816 forAll(procPoints, pointI)
818 const label bpI = procPoints[pointI];
821 const label neiProc = bpAtProcs(bpI, procI);
828 if( pVertices[bpI] & EDGENODE )
830 bpToEdgePoint.insert(bpI, edgePoints.
size());
850 if( patchKey_.size() )
852 forAll(treatPatches, patchI)
853 if( treatPatches[patchI] )
855 pKey = patchKey_[patchI];
862 const label bpI = edgePoints[epI];
868 if( !treatPatches[pPatches(bpI, patchI)] )
872 if( otherPatches.
size() == 1 )
877 const label patchLabel =
878 boundaryFacePatches[
pFaces(bpI, pfI)];
880 if( treatPatches[patchLabel] )
890 else if( otherPatches.
size() == 2 )
892 label otherVertex(-1);
895 const label bpJ = pointPoints(bpI, ppI);
899 if( !pPatches.
contains(bpJ, otherPatches[opI]) )
912 if( otherVertex == -1 )
923 "void boundaryLayers::createNewEdgeVerticesParallel("
924 "const labelLongList& procPoints,"
925 "const List<direction>& pVertices,"
926 "const boolList& treatPatches,"
927 "labelList& newLabelForVertex"
929 ) <<
"There are more than 3 patches meeting at this vertex!"
935 std::map<label, LongList<labelledPoint> > exchangeNormals;
937 exchangeNormals.insert
944 const label bpI = edgePoints[epI];
948 const label neiProc = bpAtProcs(bpI, procI);
965 exchangeNormals.clear();
968 while( counter < receivedData.
size() )
981 const label bpI = edgePoints[epI];
986 if( !treatPatches[pPatches(bpI, patchI)] )
989 if( otherPatches.
size() == 1 )
991 const scalar magV =
mag(v[epI]) + VSMALL;
996 const scalar magN =
mag(
normal[epI]) + VSMALL;
1003 const label bpI = edgePoints[epI];
1009 if( !treatPatches[pPatches(bpI, patchI)] )
1012 if( otherPatches.
size() == 1 )
1016 if( pVertices[pointPoints(bpI, ppI)] )
1019 const vector vec =
points[bPoints[pointPoints(bpI, ppI)]] -
p;
1020 const scalar prod = 0.5 *
mag(vec &
normal[epI]);
1022 if( prod < dist[epI] )
1031 if( otherPatches.
contains(boundaryFacePatches[faceLabel]) )
1033 const face&
f = bFaces[faceLabel];
1034 const label pos =
f.which(bPoints[bpI]);
1044 if( dst < dist[epI] )
1045 dist[epI] = 0.9 * dst;
1051 "void boundaryLayers::createNewEdgeVerticesParallel"
1053 "const labelLongList& procPoints,"
1054 "const List<direction>& pVertices,"
1055 "const boolList& treatPatches,"
1056 "labelList& newLabelForVertex"
1058 ) <<
"Face does not contains this vertex!"
1066 std::map<label, LongList<labelledScalar> > exchangeDistances;
1068 exchangeDistances.insert
1075 const label bpI = edgePoints[epI];
1078 const label neiProc = bpAtProcs(bpI, procI);
1090 exchangeDistances.clear();
1092 forAll(receivedDistances, i)
1094 const label bpI = globalToLocal[receivedDistances[i].scalarLabel()];
1095 const label epI = bpToEdgePoint[bpI];
1096 if( dist[epI] > receivedDistances[i].value() )
1097 dist[epI] = receivedDistances[i].value();
1103 const label bpI = edgePoints[epI];
1119 newLabelForVertex_[bPoints[bpI]] = nPoints_;
1123 const label pointI = bPoints[bpI];
1125 if( otherVrts_.find(pointI) == otherVrts_.end() )
1127 std::map<std::pair<label, label>,
label> m;
1128 otherVrts_.insert(std::make_pair(pointI, m));
1131 std::pair<label, label> pr(pKey, pKey);
1132 otherVrts_[pointI].insert(std::make_pair(pr, nPoints_));