Go to the documentation of this file.
55 Info <<
"Starting creating layer cells" <<
endl;
72 forAll(patchLabels, patchI)
74 const label pLabel = patchLabels[patchI];
103 if( treatPatches[boundaryFacePatches[bfI]] )
105 const face&
f = bFaces[bfI];
115 for(
label pI=
f.size()-1;pI>0;--pI)
126 newBoundaryOwners.
append(cellsToAdd.
size() + nOldCells);
127 newBoundaryPatches.
append(boundaryFacePatches[bfI]);
134 newF[1] =
f.nextLabel(pI);
142 const label edgeI = faceEdges(bfI, pI);
145 label neiFace = edgeFaces(edgeI, 0);
147 neiFace = edgeFaces(edgeI, 1);
149 if( !treatPatches[boundaryFacePatches[neiFace]] )
152 newBoundaryOwners.
append(cellsToAdd.
size() + nOldCells);
153 newBoundaryPatches.
append(boundaryFacePatches[neiFace]);
156 else if( edgeFaces.
sizeOfRow(edgeI) == 1 )
158 const Map<label>& otherProcPatch = *otherProcPatchPtr;
159 if( !treatPatches[otherProcPatch[edgeI]] )
163 newBoundaryOwners.
append(cellsToAdd.
size() + nOldCells);
164 newBoundaryPatches.
append(otherProcPatch[edgeI]);
170 Info <<
"Adding cell " << cellFaces <<
endl;
178 Info <<
"Storing original boundary face "
179 << bfI <<
" into patch " << boundaryFacePatches[bfI] <<
endl;
183 newBoundaryOwners.
append(faceOwners[bfI]);
184 newBoundaryPatches.
append(boundaryFacePatches[bfI]);
203 iter!=globalToLocal.end();
207 const label bpI = iter();
208 procPoint[bPoints[bpI]] =
true;
227 const label patchI = boundaryFacePatches[edgeFaces(edgeI, 0)];
230 if( otherProcPatchPtr && otherProcPatchPtr->found(edgeI) )
232 patchJ = otherProcPatchPtr->operator[](edgeI);
236 patchJ = boundaryFacePatches[edgeFaces(edgeI, 1)];
239 if( patchI == patchJ )
246 if( pKeyI < 0 || pKeyJ < 0 )
251 "void boundaryLayers::createLayerCells(const labelList&)"
258 const edge&
e = edges[edgeI];
270 newBoundaryOwners.
append(nOldCells+cellsToAdd.
size());
271 newBoundaryPatches.
append(patchJ);
274 newBoundaryOwners.
append(nOldCells+cellsToAdd.
size());
275 newBoundaryPatches.
append(patchI);
278 const label bps = bp[
e.start()];
279 label unusedPatch(-1);
282 const label ptchI = pointPatches(bps, i);
284 if( ptchI == patchI )
286 if( ptchI == patchJ )
288 if( unusedPatch != -1 )
301 newBoundaryOwners.
append(nOldCells+cellsToAdd.
size());
302 newBoundaryPatches.
append(unusedPatch);
307 pointProcFaces.
append(cellFaces[5]);
312 const label bpe = bp[
e.end()];
316 const label ptchI = pointPatches(bpe, i);
318 if( ptchI == patchI )
320 if( ptchI == patchJ )
322 if( unusedPatch != -1 )
335 newBoundaryOwners.
append(nOldCells+cellsToAdd.
size());
336 newBoundaryPatches.
append(unusedPatch);
341 pointProcFaces.
append(cellFaces[4]);
346 Info <<
"Adding new cell at edge " << cellFaces <<
endl;
354 typedef std::map<std::pair<label, label>,
label> mPairToLabelType;
355 typedef std::map<label, mPairToLabelType> mPointsType;
356 typedef std::map<label, DynList<label, 3> > ppType;
368 std::map<label, labelLongList> facesToSend;
370 typedef std::map<label, DynList<DynList<label, 8>, 8> > ppfType;
372 ppfType parPointFaces;
373 ppType parPointPatches;
378 if( iter->second.size() == 2 )
381 const label bpI = bp[iter->first];
385 parPoint.
insert(iter->first);
391 const label prI = pProcs(bpI, i);
393 if( facesToSend.find(prI) == facesToSend.end() )
413 const label bfI = pointFaces(bpI, pfI);
414 const face& bf = bFaces[bfI];
416 pPatches[pfI] = boundaryFacePatches[bfI];
421 bfCopy[pI] = globalPointLabel[bp[bf[pI]]];
435 stp.
append(globalPointLabel[bpI]);
439 const label bfI = pointFaces(bpI, pfI);
440 const face& bf = bFaces[bfI];
443 stp.
append(boundaryFacePatches[bfI]);
445 stp.
append(globalPointLabel[bp[bf[pI]]]);
455 while( counter < receivedData.
size() )
457 const label bpI = globalToLocal[receivedData[counter++]];
458 const label nFaces = receivedData[counter++];
459 for(
label fI=0;fI<nFaces;++fI)
462 parPointPatches[bpI].append(receivedData[counter++]);
464 f[pI] = receivedData[counter++];
465 parPointFaces[bpI].append(
f);
474 const label gpI = globalPointLabel[iter->first];
492 const label pAdd = fPatches[i+1];
493 fPatches[i+1] = fPatches[j];
504 nodePatches.insert(std::make_pair(bPoints[iter->first], patchIDs));
511 if( iter->second.size() == 2 )
514 if( parPoint.
found(iter->first) )
517 const label bpI = bp[iter->first];
522 pFaces[fI] = pointFaces(bpI, fI);
533 (obf.
which(
e.start()) >= 0) &&
551 nodePatches.insert(std::make_pair(iter->first, patchIDs));
569 if( pKeys.
size() != 3 )
573 Pout <<
"Creating corner cell at point " << iter->first <<
endl;
581 newBoundaryOwners.
append(nOldCells+cellsToAdd.
size());
582 newBoundaryPatches.
append(patchIDs[0]);
585 newBoundaryOwners.
append(nOldCells+cellsToAdd.
size());
586 newBoundaryPatches.
append(patchIDs[1]);
589 newBoundaryOwners.
append(nOldCells+cellsToAdd.
size());
590 newBoundaryPatches.
append(patchIDs[2]);
594 if( procPoint[iter->first] )
596 pointProcFaces.
append(cellFaces[0]);
599 pointProcFaces.
append(cellFaces[2]);
602 pointProcFaces.
append(cellFaces[4]);
608 Info <<
"Adding corner cell " << cellFaces <<
endl;
642 forAll(boundaries, patchI)
643 boundaries[patchI].patchType() =
patchTypes_[patchI];
648 Info <<
"Finished creating layer cells" <<
endl;
664 labelList otherFaceProc(faceCandidates.size(), -1);
667 VRWGraph pointFaceCandidates(nPoints_);
668 forAll(faceCandidates, fI)
670 forAll(faceCandidates[fI], pI)
671 pointFaceCandidates.
append(faceCandidates[fI][pI], fI);
674 boolList duplicateFace(faceCandidates.size(),
false);
676 std::map<labelledPair, label> pointOfOriginToFaceLabel;
677 forAll(faceCandidates, fI)
681 const label pointI =
f[0];
685 globalPointLabel[bp[pointI]],
688 patchKey_[candidatePatches[fI][0]],
689 patchKey_[candidatePatches[fI][1]]
694 pointOfOriginToFaceLabel.find(lp) != pointOfOriginToFaceLabel.end()
697 duplicateFace[fI] =
true;
698 pointOfOrigin[fI] = lp;
699 duplicateFace[pointOfOriginToFaceLabel[lp]] =
true;
703 pointOfOrigin[fI] = lp;
705 pointOfOriginToFaceLabel.insert(std::make_pair(lp, fI));
712 std::map<label, LongList<labelledPair> > exchangeData;
716 const label neiProcI = neiProcs[procI];
721 if( exchangeData.find(neiProcI) == exchangeData.end() )
728 forAll(faceCandidates, fI)
730 if( duplicateFace[fI] )
733 const label bpI = bp[faceCandidates[fI][0]];
737 const label neiProcNo = bpAtProcs(bpI, procI);
742 dataToSend.
append(pointOfOrigin[fI]);
747 std::map<label, List<labelledPair> > receivedMap;
749 exchangeData.clear();
754 iter=receivedMap.begin();
755 iter!=receivedMap.end();
765 const label pointI = bPoints[globalToLocal[gpI]];
768 forAllRow(pointFaceCandidates, pointI, i)
770 const label fI = pointFaceCandidates(pointI, i);
775 patchKey_[candidatePatches[fI][0]],
776 patchKey_[candidatePatches[fI][1]]
781 patchKey_[candidatePatches[fI][1]],
782 patchKey_[candidatePatches[fI][0]]
786 (
f[0] == pointI) && ((pk == lp) || (rpk == lp))
790 otherFaceProc[pointOfOriginToFaceLabel[lpp]] = iter->first;
802 forAll(mesh_.procBoundaries(), patchI)
805 otherProcToProcPatch.insert(wp.
neiProcNo(), patchI);
814 const label fI = pointOfOriginToFaceLabel[pointOfOrigin[i]];
816 if( duplicateFace[fI] || (otherFaceProc[fI] == -1) )
819 if( !otherProcToProcPatch.found(otherFaceProc[fI]) )
821 otherProcToProcPatch.insert
832 newProc.
append(otherProcToProcPatch[otherFaceProc[fI]]);
const VRWGraph & bpAtProcs() const
processors which contain the vertex
const labelList & bp() const
const labelPair & pair() const
return the pair
void append(const T &e)
Append an element at the end of the list.
wordList patchNames_
patch names
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
const meshSurfaceEngine & surfaceEngine() const
Return const reference to meshSurfaceEngine.
label size() const
Returns the number of graphs.
label nPoints_
number of vertices in the mesh
#define forAll(list, i)
Loop across all elements in list.
const labelList & globalBoundaryPointLabel() const
global boundary point label
polyMeshGen & mesh_
Reference to the mesh.
Template functions to aid in the implementation of demand driven data.
wordList patchTypes_
patch types
A List obtained as a section of another List.
edge faceEdge(const label n) const
Return n-th face edge.
void addProcessorFaces(const VRWGraph &procFaces, const labelLongList &facePatches)
add additional faces into processor patches
static bool & parRun()
Is this a parallel run?
const DynList< label > & bpNeiProcs() const
communication matrix for sending point data
const VRWGraph & pointFaces() const
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
dimensionedScalar pMin("pMin", dimPressure, fluid)
const labelList & boundaryFacePatches() const
patch label for each boundary face
label fcIndex(const label index, const label offset=1) const
return forward and reverse circular indices
const VRWGraph & faceEdges() const
void replaceBoundary(const wordList &patchNames, const VRWGraph &boundaryFaces, const labelLongList &faceOwners, const labelLongList &facePatches)
replace the boundary with new boundary faces
std::map< label, std::map< std::pair< label, label >, label > > otherVrts_
Ostream & endl(Ostream &os)
Add newline and flush stream.
void createNewFacesFromPointsParallel(const LongList< DynList< label, 4 > > &faceCandidates, const LongList< labelPair > &candidatePatches)
label size() const
Size of the active part of the list.
void createNewCellFromNode(const label pointI, const DynList< label, 3 > &pKeys, FixedList< FixedList< label, 4 >, 6 > &cellFaces) const
creating hex cells near corners
bool contains(const T &e) const
check if the element is in the list (takes linear time)
const VRWGraph & pointPatches() const
void appendGraph(const GraphType &l)
Append a graph at the end of the graphList.
label which(const label globalIndex) const
Navigation through face vertices.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=*(cellModeller::lookup("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]=cellShape(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];} label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;} } 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};const 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< SLList< face > > pFaces[nBCs]
PtrList< boundaryPatch > & boundariesAccess()
access to boundary data
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.
void reorderBoundaryFaces()
const cellListPMG & cells() const
access to cells
const Map< label > & otherEdgeFaceAtProc() const
void appendIfNotIn(const T &e)
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
#define forAllRow(graph, rowI, index)
label sizeOfRow(const label rowI) const
Returns the number of elements in the given row.
labelList patchKey_
a key assigned to each patch. It is needed to search in otherVrts_
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
bool found(const Key &) const
Return true if hashedEntry is found in table.
void createLayerCells(const labelList &patchLabels)
const VRWGraph & edgeFaces() const
errorManip< error > abort(error &err)
const double e
Elementary charge.
const edgeList & edges() const
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
void clearOut()
delete meshSurfaceEngine
void setSize(const label)
Reset size of List.
void createNewCellFromEdge(const edge &e, const label pKeyI, const label pKeyJ, FixedList< FixedList< label, 4 >, 6 > &cellFaces) const
creating hex cells near feature edges
label containsAtPosition(const T &e) const
label neiProcNo() const
return the neighbour processor
void clear()
Clear the graph.
label pairLabel() const
return pair label
List< DynList< label > > treatPatchesWithPatch_
extrude patches with patch
prefixOSstream Pout(cout, "Pout")
void appendList(const ListType &l)
Append a list as a row at the end of the graph.
const PtrList< boundaryPatch > & boundaries() const
ordinary boundaries
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.
A 1D vector of objects of type <T> with a fixed size <Size>.
void createNewFacesParallel(const boolList &treatPatches)
void clear()
Clear the list, i.e. set size to zero.
void exchangeMap(const std::map< label, ListType > &m, LongList< T > &data, const Pstream::commsTypes commsType)
bool insert(const Key &key)
Insert a new entry.
void append(const label rowI, const label)
Append an element to the given row.
void addCells(const LongList< faceList > &cellFaces)
add cells (vertices must be added)
const labelList & boundaryPoints() const
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
A face is a list of labels corresponding to mesh vertices.
const Map< label > & globalToLocalBndPointAddressing() const
global point label to local label. Only for processors points
void size(const label)
Override size to be inconsistent with allocated storage.
const Map< label > & otherEdgeFacePatch() const
const meshSurfacePartitioner & surfacePartitioner() const
return const reference to meshSurfacePartitioner
LongList< label > labelLongList
Pair< label > labelPair
Label pair.
void clear()
Clear the list, i.e. set next free to zero.
label size() const
return the number of used elements
label findNewNodeLabel(const label pointI, const label pKey) const
helper function finding a new face label for multiply extruded nodes
void append(const T &e)
Append an element at the end of the list.
const labelList & faceOwners() const
dimensionedScalar pos(const dimensionedScalar &ds)