39 #ifdef DEBUGExtrudeLayer
60 extrudedFaces_(extrudedFaces),
61 pairOrientation_(pairOrientation),
62 pointExtruded_(pointExtruded)
86 if( faceInFront[lp.
first()] == -1 )
88 faceInFront[lp.
first()] = newFaceLabels.
size();
113 # pragma omp parallel for if( faceInFront.size() > 100 ) schedule(guided)
115 forAll(faceInFront, faceI)
117 if( faceInFront[faceI] < 0 )
120 const label fOwn = newFaceLabels[faceInFront[faceI]].first();
121 const label fNei = newFaceLabels[faceInFront[faceI]].second();
123 if( neighbour[faceI] < 0 )
136 if( fOwn != -1 && fNei != -1 )
144 faces[
nOrigFaces_+fNei] = faces[faceI].reverseFace();
154 faces[faceI] = faces[
nOrigFaces_+fOwn].reverseFace();
161 else if( fOwn != -1 )
164 faces[faceI] = faces[
nOrigFaces_+fOwn].reverseFace();
168 else if( fNei != -1 )
170 faces[
nOrigFaces_+fNei] = faces[faceI].reverseFace();
179 # pragma omp parallel for if( faceInFront.size() > 100 ) schedule(guided)
181 forAll(faceInFront, faceI)
183 if( faceInFront[faceI] < 0 )
186 const labelPair& lp = newFaceLabels[faceInFront[faceI]];
188 if( lp.
first() != -1 )
223 # pragma omp parallel for if( points.size() > 1000 ) schedule(guided)
242 std::map<label, labelLongList> exchangeData;
244 exchangeData.insert(std::make_pair(pProcs[i],
labelLongList()));
255 const label neiProc = pAtProcs(it(), i);
260 exchangeData[neiProc].append(it.key());
268 # pragma omp parallel for if( receivedData.size() > 1000 ) \
273 frontPoints[globalToLocal[receivedData[i]]] =
286 Pout <<
"Creating new points at processor boundaries" <<
endl;
291 Pout <<
"Front points are " << frontPoints <<
endl;
310 typedef std::map<label, DynList<edge> > dualEdgesMap;
311 dualEdgesMap procPointsDual;
318 const label pointI = it();
323 const label faceI = pointFaces(pointI, pfI);
327 if( (neighbour[faceI] < 0) || (owner[faceI] < 0) )
332 globalCellLabel[owner[faceI]],
333 globalCellLabel[neighbour[faceI]]
346 Pout <<
"Point " << it->first <<
" local dual edges " << it->second <<
endl;
355 Pout <<
"Adding data from processor boundaries" <<
endl;
356 forAll(procBoundaries, patchI)
358 if( procBoundaries[patchI].owner() )
361 const label start = procBoundaries[patchI].patchStart();
362 labelList globalLabels(procBoundaries[patchI].patchSize());
365 if( owner[start+fI] < 0 )
367 globalLabels[fI] = -1;
371 globalLabels[fI] = globalCellLabel[owner[start+fI]];
378 procBoundaries[patchI].neiProcNo(),
379 globalLabels.byteSize()
382 toOtherProc << globalLabels;
385 forAll(procBoundaries, patchI)
387 if( !procBoundaries[patchI].owner() )
394 procBoundaries[patchI].neiProcNo()
397 fromOtherProc >> receivedData;
399 const label start = procBoundaries[patchI].patchStart();
403 if( owner[start+i] < 0 )
406 const face&
f = faces[start+i];
412 dualEdgesMap::iterator dIter =
413 procPointsDual.find(
f[pI]);
414 const label cOwn = globalCellLabel[owner[start+i]];
415 const label cNei = receivedData[i];
424 Pout <<
"Exchanging data with other processors" <<
endl;
426 std::map<label, labelLongList> exchangeData;
428 exchangeData.insert(std::make_pair(pProcs[i],
labelLongList()));
433 const label pointI = dIter->first;
437 const label neiProc = pAtProcs(pointI, i);
444 dts.
append(globalPointLabel[pointI]);
450 const edge&
e = dualEdges[edgeI];
463 while( counter < receivedData.
size() )
465 const label pointI = globalToLocal[receivedData[counter++]];
469 const label nDualEdges = receivedData[counter++];
470 for(
label eI=0;eI<nDualEdges;++eI)
473 e.start() = receivedData[counter++];
474 e.end() = receivedData[counter++];
485 Pout <<
"Point " << it->first <<
" dual edges " << it->second <<
endl;
493 Pout <<
"Finding groups of edges at vertex" <<
endl;
496 const label pointI = dIter->first;
509 if( edgeGroup[eI] != -1 )
512 edgeGroup[eI] =
group;
516 while( front.
size() != 0 )
522 if( edgeGroup[eJ] != -1 )
527 if( dEdges[eLabel].commonVertex(dEdges[eJ]) != -1 )
530 edgeGroup[eJ] =
group;
545 const label faceI = pointFaces(pointI, pfI);
547 if( owner[faceI] < 0 )
550 const label own = globalCellLabel[owner[faceI]];
554 const edge& dualEdge = dEdges[eI];
556 if( (own == dualEdge.
start()) || (own == dualEdge.
end()) )
558 faceGroups[pfI] = edgeGroup[eI];
564 Info <<
"Edge groups for point " << pointI <<
" are " << edgeGroup <<
endl;
565 Info <<
"Face groups at point " << pointI <<
" are " << faceGroups
566 <<
" point faces " << pointFaces[pointI] <<
endl;
574 if( faceGroups[i] != 0 )
582 <<
"Front is not defined at point " << pointI
598 if( faceGroups[pfI] == -1 )
601 face&
f = faces[pointFaces(pointI, pfI)];
604 f[
pos] = currentNumPoints + faceGroups[pfI];
608 Pout <<
"Finishing creating new vertices at paralle boundaries" <<
endl;
613 forAll(pointFaces, pointI)
629 if( faceGroup[pfI] != -1 )
634 faceGroup[pfI] =
group;
636 while( front.
size() )
640 const label own = owner[pointFaces(pointI, fLabel)];
641 const label nei = neighbour[pointFaces(pointI, fLabel)];
645 if( faceGroup[pfJ] != -1 )
648 const label faceJ = pointFaces(pointI, pfJ);
650 if( owner[faceJ] < 0 )
653 if( owner[faceJ] == own || owner[faceJ] == nei )
655 faceGroup[pfJ] =
group;
659 if( neighbour[faceJ] < 0 )
662 if( neighbour[faceJ] == own || neighbour[faceJ] == nei )
664 faceGroup[pfJ] =
group;
678 if( faceGroup[i] != 0 )
686 <<
"Front is not defined at point " << pointI
702 if( faceGroup[pfI] == -1 )
705 face&
f = faces[pointFaces(pointI, pfI)];
708 f[
pos] = currentNumPoints + faceGroup[pfI];
714 # ifdef DEBUGExtrudeLayer
736 boolList pointAtProcBnd(displacements.size(),
false);
748 std::map<label, vector> normals;
749 std::map<label, scalar> distances;
752 std::map<label, LongList<labelledPointScalar> > exchangeData;
764 const label pointI = it();
776 const label faceI = pointFaces(pointI, pfI);
780 const face&
f = faces[faceI];
808 const label neiProc = pAtProcs(pointI, i);
813 exchangeData[neiProc].append(lps);
827 scalar& d = distances[pointI];
834 std::map<label, vector>::const_iterator it=normals.begin();
840 if(
mag(
n) > VSMALL )
842 displacements[it->first-
nOrigPoints_] =
n * distances[it->first];
847 # pragma omp parallel if( displacements.size() > 100 )
852 # pragma omp for schedule(guided)
856 if( pointAtProcBnd[pI] )
862 scalar thickness(VGREAT);
866 const label faceI = pointFaces(pointI, pfI);
870 const face&
f = faces[faceI];
900 displacements[pI] =
normal * thickness;
908 # pragma omp for schedule(guided)
914 # ifdef DEBUGExtrudeLayer
966 ef[1] =
f.nextLabel(pI);
967 ef[2] = of[
f.fcIndex(pI)];
980 ef[1] =
f.nextLabel(pI);
981 ef[2] = of[(
f.size()-
f.fcIndex(pI))%
f.size()];
982 ef[3] = of[(
f.size()-pI)%
f.size()];
1005 const label pointI =
f[eI];
1008 const label nextI =
f.nextLabel(eI);
1011 if( pointI < nextI )
1033 const label otherOrigFacePointI = adc.
origPoint(otherExtI, pointI);
1034 const label otherOrigFaceNextI = adc.
origPoint(otherExtI, nextI);
1039 label origPointI(-1), origNextI(-1);
1052 if( fc.
size() != 1 )
1056 origPointI = adc.
origPoint(fc[0], origFacePointI);
1057 origNextI = adc.
origPoint(fc[0], origFaceNextI);
1069 newCell[0][0] = pointI;
1070 newCell[0][1] = origFacePointI;
1071 newCell[0][2] = origFaceNextI;
1072 newCell[0][3] = nextI;
1075 newCell[1][0] = pointI;
1076 newCell[1][1] = nextI;
1077 newCell[1][2] = otherOrigFaceNextI;
1078 newCell[1][3] = otherOrigFacePointI;
1081 newCell[2][0] = otherOrigFacePointI;
1082 newCell[2][1] = otherOrigFaceNextI;
1083 newCell[2][2] = origNextI;
1084 newCell[2][3] = origPointI;
1087 newCell[3][0] = origFacePointI;
1088 newCell[3][1] = origPointI;
1089 newCell[3][2] = origNextI;
1090 newCell[3][3] = origFaceNextI;
1093 newCell[4][0] = pointI;
1094 newCell[4][1] = otherOrigFacePointI;
1095 newCell[4][2] = origPointI;
1096 newCell[4][3] = origFacePointI;
1099 newCell[5][0] = nextI;
1100 newCell[5][1] = origFaceNextI;
1101 newCell[5][2] = origNextI;
1102 newCell[5][3] = otherOrigFaceNextI;
1109 forAll(pointFaces, pointI)
1117 origFacePoints = -1;
1121 const label extI = pointFaces(pointI, pfI);
1123 origFacePoints[pfI] = adc.
origPoint(extI, pointI);
1127 bool createCell(
true);
1128 for(
label i=origFacePoints.
size()-1;i>0;--i)
1130 for(
label j=i-1;j>=0;--j)
1131 if( origFacePoints[i] == origFacePoints[j] )
1153 const label extI = pointFaces(pointI, pfI);
1158 const label eI =
f.which(pointI);
1159 const label origFacePointI = origFacePoints[pfI];
1175 cf[1] = origFacePoints[pfI];
1177 cf[3] = origFacePoints[
pos];
1187 forAll(origFacePoints, opI)
1192 label prev(-1), next(-1);
1193 forAll(origFacePoints, fJ)
1195 if( newCell[fJ][1] == origFacePoints[opI] )
1196 prev = newCell[fJ][2];
1197 if( newCell[fJ][3] == origFacePoints[opI] )
1198 next = newCell[fJ][2];
1201 if( (prev < 0) || (next < 0) )
1206 cf[1] = origFacePoints[opI];
1248 newBoundaryOwners.
append(bfOwner[bfI]);
1249 newBoundaryPatches.
append(facePatch[bfI]);
1260 if( neighbour[faceI] >= 0 )
1263 const face&
f = faces[faceI];
1280 if( origPts.
size() > 2 )
1282 if( newPts.
size() == 0 )
1291 const label bpI = bp[newPts[npI]];
1298 const label patchI = pointPatches(bpI, ppI);
1299 if(
patches.contains(patchI) )
1301 ++nAppearances[
patches.containsAtPosition(patchI)];
1315 if( nAppearances[i] == newPts.
size() )
1329 newBoundaryOwners.
append(owner[faceI]);
1330 newBoundaryPatches.
append(patch);
1345 forAll(boundaries, patchI)
1346 boundaries[patchI].patchType() =
patchTypes[patchI];
1358 const scalar thickness
1382 # ifdef DEBUGExtrudeLayer