Go to the documentation of this file.
57 label nBoundaryFaces(0);
62 nBoundaryFaces += boundaries[patchI].patchSize();
69 boundaries[0].patchStart()
88 "void meshSurfaceEngine::calculateBoundaryFaces() const"
89 ) <<
"Cannot select boundary faces. Invalid patch index "
94 Info <<
"Found " << nBoundaryFaces <<
" boundary faces " <<
endl;
100 "void meshSurfaceEngine::calculateBoundaryFaces() const"
101 ) <<
"Boundary faces are not at the end of the face list!"
120 # pragma omp parallel for schedule(static, 1)
123 owners[fI] = owner[start+fI];
139 const label nThreads = 3 * omp_get_num_procs();
140 # pragma omp parallel for num_threads(nThreads) schedule(static, 1)
147 isBndPoint[bf[pI]] =
true;
170 forAll(procBoundaries, patchI)
172 const label start = procBoundaries[patchI].patchStart();
173 const label end = start + procBoundaries[patchI].patchSize();
177 for(
label faceI=start;faceI<end;++faceI)
181 if( (
bp[
f[pI]] != -1) && !addedPoint.
found(
f[pI]) )
189 dts.
append((
f.size() - pI) %
f.size());
196 procBoundaries[patchI].neiProcNo(),
203 forAll(procBoundaries, patchI)
205 const label start = procBoundaries[patchI].patchStart();
210 procBoundaries[patchI].neiProcNo()
212 fromOtherProc >> receiveData;
215 while( counter < receiveData.size() )
217 const label fI = receiveData[counter++];
218 const label pI = receiveData[counter++];
220 if(
bp[
faces[start+fI][pI]] == -1 )
222 bp[
faces[start+fI][pI]] = pointI++;
241 # pragma omp parallel for num_threads(nThreads) schedule(static, 1)
258 forAll(boundaries, patchI)
260 const label nFaces = boundaries[patchI].patchSize();
261 for(
label patchFaceI=0;patchFaceI<nFaces;++patchFaceI)
263 facePatch[faceI] = patchI;
289 label nThreads = 3 * omp_get_num_procs();
290 if( bPoints.
size() < 1000 )
293 const label nThreads(1);
296 label minRow(INT_MAX), maxRow(0);
300 # pragma omp parallel num_threads(nThreads)
304 const label threadI = omp_get_thread_num();
306 const label threadI(0);
310 dot.setSize(nThreads);
314 label localMinRow(minRow), localMaxRow(0);
316 # pragma omp for schedule(static)
320 const face& bf = bFaces[bfI];
324 localMaxRow =
Foam::max(localMaxRow, bpI);
325 localMinRow =
Foam::min(localMinRow, bpI);
332 # pragma omp critical
348 # pragma omp for schedule(static)
350 for(
label i=0;i<maxRow;++i)
357 const label range = (maxRow - minRow) / nThreads + 1;
363 # pragma omp for schedule(static)
367 const face& bf = bFaces[bfI];
373 const label threadNo = (bpI - minRow) /
range;
375 if( threadNo == threadI )
391 for(
label i=0;i<nThreads;++i)
394 dataForOtherThreads[i][threadI];
397 ++npf[
data[j].first()];
422 for(
label i=0;i<threadI;++i)
425 dataForOtherThreads[i][threadI];
432 pointFacesAddr(bpI, npf[bpI]) = bfI;
433 pointInFaceAddr(bpI, npf[bpI]) =
434 bFaces[bfI].which(bPoints[bpI]);
442 # pragma omp for schedule(static)
446 const face& bf = bFaces[bfI];
454 pointInFaceAddr(bpI, npf[bpI]) = pI;
455 pointFacesAddr(bpI, npf[bpI]++) = bfI;
461 for(
label i=threadI+1;i<nThreads;++i)
464 dataForOtherThreads[i][threadI];
471 pointFacesAddr(bpI, npf[bpI]) = bfI;
472 pointInFaceAddr(bpI, npf[bpI]) =
473 bFaces[bfI].which(bPoints[bpI]);
494 const label nThreads = 3 * omp_get_num_procs();
500 # pragma omp parallel num_threads(nThreads)
504 # pragma omp for schedule(static)
510 # pragma omp for schedule(static)
518 npPatches[bpI] = pf.
size();
531 # pragma omp for schedule(static)
549 std::map<label, labelLongList> exchangeData;
553 const label bpI = iter();
561 if( exchangeData.find(neiProc) == exchangeData.end() )
576 dataToSend.
append(globalPointLabel[bpI]);
579 dataToSend.
append(pPatches(bpI, patchI));
588 while( counter < receivedData.
size() )
590 const label bpI = globalToLocal[receivedData[counter++]];
611 const label nThreads = 3 * omp_get_num_procs();
617 # pragma omp parallel num_threads(nThreads)
621 # pragma omp for schedule(static)
627 # pragma omp for schedule(static)
643 npp[bpI] = pPoints.
size();
656 # pragma omp for schedule(static)
687 std::map<label, labelLongList> exchangeData;
690 const label bpI = iter();
706 if( exchangeData.find(neiProc) == exchangeData.end() )
707 exchangeData.insert(std::make_pair(neiProc,
labelLongList()));
709 if( neiToSend.
size() != 0 )
712 dts.
append(globalPointLabel[bpI]);
715 dts.
append(globalPointLabel[neiToSend[i]]);
724 while( counter < receivedData.
size() )
726 const label bpI = globalToLocal[receivedData[counter++]];
727 const label size = receivedData[counter++];
728 for(
label i=0;i<size;++i)
730 const label gpI = receivedData[counter++];
731 if( globalToLocal.found(gpI) )
746 # pragma omp parallel for if( pFaces.size() > 1000 ) schedule(dynamic, 50)
765 (*pointNormalsPtr_)[pI] =
normal;
779 # pragma omp parallel for if( bFaces.size() > 1000 )
783 const face& bf = bFaces[bfI];
797 # pragma omp parallel for if( bFaces.size() > 1000 )
818 std::map<label, LongList<labelledPoint> > exchangeData;
822 const label bpI = iter();
828 n += fNormals[
pFaces(bpI, pfI)];
835 if( exchangeData.find(neiProc) == exchangeData.end() )
843 exchangeData[neiProc].append
856 const label bpI = globalToLocal[receivedData[i].pointLabel()];
857 pNormals[bpI] += receivedData[i].coordinates();
862 # pragma omp parallel for if( bpAtProcs.size() > 1000 ) \
899 label nThreads = 3 * omp_get_num_procs();
900 if(
pFaces.size() < 1000 )
903 const label nThreads(1);
911 # pragma omp parallel num_threads(nThreads)
917 # pragma omp for schedule(static)
921 std::set<std::pair<label, label> > edgesAtPoint;
926 const face& bf = bFaces[bfI];
946 std::set<std::pair<label, label> >::const_iterator it;
947 for(it=edgesAtPoint.begin();it!=edgesAtPoint.end();++it)
948 edgesHelper.
append(
edge(it->first, it->second));
954 const label threadI = omp_get_thread_num();
956 const label threadI(0);
958 nEdgesForThread[threadI] = edgesHelper.
size();
961 # pragma omp critical
963 edgeI += edgesHelper.
size();
979 for(
label i=0;i<threadI;++i)
980 localStart += nEdgesForThread[i];
984 edgesPtr_->operator[](localStart+i) = edgesHelper[i];
1007 forAll(procBoundaries, patchI)
1009 const label start = procBoundaries[patchI].patchStart();
1010 const label end = start + procBoundaries[patchI].patchSize();
1013 for(
label faceI=start;faceI<end;++faceI)
1018 const edge e =
f.faceEdge(eI);
1024 if(
edges[bpEdges(
s, peI)] ==
e )
1027 dts.
append((
f.size()-1-eI)%
f.size());
1036 procBoundaries[patchI].neiProcNo(),
1044 forAll(procBoundaries, patchI)
1050 procBoundaries[patchI].neiProcNo()
1052 fromOtherProc >> receivedEdges;
1054 const label start = procBoundaries[patchI].patchStart();
1055 label nReceivedEdges(0);
1056 while( nReceivedEdges < receivedEdges.size() )
1058 const face&
f =
faces[start+receivedEdges[nReceivedEdges++]];
1059 const label eI = receivedEdges[nReceivedEdges++];
1061 const edge e =
f.faceEdge(eI);
1066 if(
edges[bpEdges(
s, peI)] ==
e )
1086 }
while( addEdges );
1104 const label nThreads = 3 * omp_get_num_procs();
1106 # pragma omp parallel num_threads(nThreads)
1110 # pragma omp for schedule(static)
1113 nfe[bfI] = bFaces[bfI].
size();
1116 # pragma omp barrier
1127 # pragma omp barrier
1129 # pragma omp for schedule(dynamic, 100)
1133 const face& bf = bFaces[bfI];
1143 const label beI = bpEdges(bps, peI);
1170 const label nThreads = 3 * omp_get_num_procs();
1172 # pragma omp parallel num_threads(nThreads)
1176 # pragma omp for schedule(static)
1182 # pragma omp for schedule(static)
1193 const face& bf = bFaces[bfI];
1207 # pragma omp barrier
1214 # pragma omp barrier
1216 # pragma omp for schedule(static)
1229 const face& bf = bFaces[bfI];
1243 if( eFaces.
size() == 2 )
1245 const face& bf = bFaces[eFaces[1]];
1252 const label helper = eFaces[0];
1253 eFaces[0] = eFaces[1];
1294 const label beI = it();
1333 "void meshSurfaceEngine::calculateFaceFacesAddressing() const"
1334 ) <<
"The surface of the mesh is invalid!"
1335 <<
" The number of faces containing edge " << efI
labelList * boundaryPointsPtr_
boundary points
const VRWGraph & boundaryPointEdges() const
VRWGraph * pointFacesPtr_
point faces addressing
const VRWGraph & bpAtProcs() const
processors which contain the vertex
vector normal(const pointField &) const
Vector normal; magnitude is equal to area of face.
const labelList & owner() const
owner and neighbour cells for faces
const labelList & bp() const
void append(const T &e)
Append an element at the end of the list.
void updatePointNormalsAtProcBoundaries() const
VRWGraph * faceEdgesPtr_
face edges addressing
const label activePatch_
number of active patch
vectorField * faceCentresPtr_
face centres
vectorField * faceNormalsPtr_
face normals
List< label > labelList
A List of labels.
const Map< label > & globalToLocalBndEdgeAddressing() const
global boundary edge label to local label. Only for processor edges
void calculateEdgePatchesAddressing() const
void setRow(const label rowI, const ListType &l)
Set row with the list.
#define forAll(list, i)
Loop across all elements in list.
const labelList & globalBoundaryPointLabel() const
global boundary point label
Output inter-processor communications stream.
void calculateFaceCentres() const
void calculatePointPatches() const
void calculateFaceFacesAddressing() const
LocalMin-mean differencing scheme class.
Template functions to aid in the implementation of demand driven data.
faceList::subList * boundaryFacesPtr_
boundary faces
A List obtained as a section of another List.
edge faceEdge(const label n) const
Return n-th face edge.
friend Ostream & operator(Ostream &, const Field< Type > &)
static bool & parRun()
Is this a parallel run?
T & newElmt(const label)
Return subscript-checked element of UList.
const VRWGraph & pointFaces() const
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
const labelList & boundaryFacePatches() const
patch label for each boundary face
const VRWGraph & faceEdges() const
VRWGraph * pointPointsPtr_
point points addressing
Ostream & endl(Ostream &os)
Add newline and flush stream.
const pointFieldPMG & points() const
access to points
label size() const
Size of the active part of the list.
dimensioned< scalar > mag(const dimensioned< Type > &)
void appendIfNotIn(const label rowI, const label)
Append an element to the given row if it does not exist there.
const VRWGraph & faceFaces() const
const faceListPMG & faces() const
access to faces
label which(const label globalIndex) const
Navigation through face vertices.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Field< vector > vectorField
Specialisation of Field<T> for vector.
void setSize(const label)
Reset size of List.
void calculateBoundaryOwners() const
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]
label end() const
Return end vertex label.
const VRWGraph & edgePatches() const
edgeList * edgesPtr_
edges
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const faceList::subList & boundaryFaces() const
LocalMax-mean differencing scheme class.
void calculatePointPoints() 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.
labelList * boundaryFacePatchPtr_
patches boundary faces are in
Pre-declare SubField and related Field type.
VRWGraph * bpEdgesPtr_
boundary point-edges addressing
labelList * boundaryFaceOwnersPtr_
face owners
void calculateFaceEdgesAddressing() const
label size() const
Returns the number of rows.
void appendIfNotIn(const T &e)
void setSize(const label)
Reset the number of rows.
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)
const pointFieldPMG & points() const
void calculatePointFaces() const
label size() const
return the number of used elements
label sizeOfRow(const label rowI) const
Returns the number of elements in the given row.
SubList< T > subList
Declare type of subList.
const VRWGraph & pointPoints() const
bool found(const Key &) const
Return true if hashedEntry is found in table.
const VRWGraph & edgeFaces() const
const double e
Elementary charge.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
const edgeList & edges() const
void calculatePointNormals() const
void calculateFaceNormals() const
void reverseAddressing(const GraphType &origGraph)
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)
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
void setSize(const label)
Reset size of List.
label prevLabel(const label i) const
Previous vertex on face.
label nextLabel(const label i) const
Next vertex on face.
label start() const
Return start vertex label.
label byteSize() const
Return the binary size in number of characters of the UList.
labelList * bppPtr_
pointBoundaryPoint addressing
polyMeshGen & mesh_
reference to the mesh
VRWGraph * pointPatchesPtr_
point-patches addressing
void calculateEdgesAndAddressing() const
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 calculateBoundaryFaces() const
calculate boundary nodes, faces and addressing
void calculateBoundaryFacePatches() const
label size() const
Return the number of elements in the PtrList.
void exchangeMap(const std::map< label, ListType > &m, LongList< T > &data, const Pstream::commsTypes commsType)
vectorField * pointNormalsPtr_
point normals
bool insert(const Key &key)
Insert a new entry.
void calculateEdgeFacesAddressing() const
void append(const label rowI, const label)
Append an element to the given row.
const PtrList< processorBoundaryPatch > & procBoundaries() const
inter-processor boundaries
const labelList & boundaryPoints() const
Input inter-processor communications stream.
#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.
label size() const
Return the number of elements in the UList.
const Map< label > & otherEdgeFacePatch() const
VRWGraph * edgeFacesPtr_
edge faces addressing
LongList< label > labelLongList
const vectorField & faceNormals() const
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
void setRowSize(const label rowI, const label newSize)
Reset the size of the given row.
Pair< label > labelPair
Label pair.
Database for solution data, solver performance and other reduced data.
VRWGraph * pointInFacePtr_
void calculateBoundaryNodes() const
A normal distribution model.
VRWGraph * edgePatchesPtr_
edge-patches addressing
VRWGraph * faceFacesPtr_
face-faces addressing
void append(const T &e)
Append an element at the end of the list.
void setSizeAndRowSize(const ListType &)
set the size and row sizes
dimensionedScalar pos(const dimensionedScalar &ds)
const faceListPMG & faces() const