123 void Foam::meshRefinement::calcNeighbourData
129 const labelList& cellLevel = meshCutter_.cellLevel();
130 const pointField& cellCentres = mesh_.cellCentres();
132 label nBoundaryFaces = mesh_.nFaces() - mesh_.nInternalFaces();
134 if (neiLevel.
size() != nBoundaryFaces || neiCc.
size() != nBoundaryFaces)
136 FatalErrorIn(
"meshRefinement::calcNeighbour(..)") <<
"nBoundaries:" 137 << nBoundaryFaces <<
" neiLevel:" << neiLevel.
size()
153 label bFaceI = pp.
start()-mesh_.nInternalFaces();
159 neiLevel[bFaceI] = cellLevel[faceCells[i]];
160 neiCc[bFaceI] = cellCentres[faceCells[i]];
164 else if (addedPatchIDSet.
found(patchI))
175 fn /=
mag(fn)+VSMALL;
177 label own = faceCells[i];
178 label ownLevel = cellLevel[own];
179 label faceLevel = meshCutter_.getAnchorLevel(pp.
start()+i);
182 scalar d = ((faceCentres[i] - cellCentres[own]) & fn);
183 if (faceLevel > ownLevel)
188 neiLevel[bFaceI] = faceLevel;
190 neiCc[bFaceI] = faceCentres[i] + d*fn;
198 neiLevel[bFaceI] = cellLevel[faceCells[i]];
199 neiCc[bFaceI] = faceCentres[i];
213 void Foam::meshRefinement::updateIntersections(
const labelList& changedFaces)
215 const pointField& cellCentres = mesh_.cellCentres();
221 label nMasterFaces = 0;
222 forAll(isMasterFace, faceI)
224 if (isMasterFace.
get(faceI) == 1)
231 label nChangedFaces = 0;
234 if (isMasterFace.
get(changedFaces[i]) == 1)
241 Info<<
"Edge intersection testing:" <<
nl 242 <<
" Number of edges : " << nMasterFaces <<
nl 243 <<
" Number of edges to retest : " << nChangedFaces
249 labelList neiLevel(mesh_.nFaces()-mesh_.nInternalFaces());
250 pointField neiCc(mesh_.nFaces()-mesh_.nInternalFaces());
251 calcNeighbourData(neiLevel, neiCc);
259 label faceI = changedFaces[i];
260 label own = mesh_.faceOwner()[faceI];
262 start[i] = cellCentres[own];
263 if (mesh_.isInternalFace(faceI))
265 end[i] = cellCentres[mesh_.faceNeighbour()[faceI]];
269 end[i] = neiCc[faceI-mesh_.nInternalFaces()];
285 surfaces_.findHigherIntersection
298 surfaceIndex_[changedFaces[i]] = surfaceHit[i];
305 label nHits = countHits();
308 Info<<
" Number of intersected edges : " << nTotHits <<
endl;
311 setInstance(mesh_.facesInstance());
326 "meshRefinement::testSyncPointList(const polyMesh&" 327 ", const List<scalar>&)" 329 <<
"fld size:" << fld.
size() <<
" mesh points:" << mesh.
nPoints()
333 Pout<<
"Checking field " << msg <<
endl;
352 const scalar& minVal = minFld[pointI];
353 const scalar& maxVal = maxFld[pointI];
354 if (
mag(minVal-maxVal) > SMALL)
357 <<
" minFld:" << minVal <<
nl 358 <<
" maxFld:" << maxVal <<
nl 376 "meshRefinement::testSyncPointList(const polyMesh&" 377 ", const List<point>&)" 379 <<
"fld size:" << fld.
size() <<
" mesh points:" << mesh.
nPoints()
383 Pout<<
"Checking field " << msg <<
endl;
390 point(GREAT, GREAT, GREAT)
402 const point& minVal = minFld[pointI];
403 const point& maxVal = maxFld[pointI];
404 if (
mag(minVal-maxVal) > SMALL)
407 <<
" minFld:" << minVal <<
nl 408 <<
" maxFld:" << maxVal <<
nl 417 Pout<<
"meshRefinement::checkData() : Checking refinement structure." 419 meshCutter_.checkMesh();
421 Pout<<
"meshRefinement::checkData() : Checking refinement levels." 423 meshCutter_.checkRefinementLevels(1,
labelList(0));
426 label nBnd = mesh_.nFaces()-mesh_.nInternalFaces();
428 Pout<<
"meshRefinement::checkData() : Checking synchronization." 438 mesh_.nInternalFaces()
451 testSyncBoundaryFaceList
454 "testing faceCentres : ",
464 calcNeighbourData(neiLevel, neiCc);
472 start[faceI] = mesh_.cellCentres()[mesh_.faceOwner()[faceI]];
474 if (mesh_.isInternalFace(faceI))
476 end[faceI] = mesh_.cellCentres()[mesh_.faceNeighbour()[faceI]];
480 end[faceI] = neiCc[faceI-mesh_.nInternalFaces()];
496 surfaces_.findHigherIntersection
512 mesh_.nInternalFaces()
520 if (surfaceIndex_[faceI] != surfaceHit[faceI])
522 if (mesh_.isInternalFace(faceI))
525 <<
"Internal face:" << faceI
526 <<
" fc:" << mesh_.faceCentres()[faceI]
527 <<
" cached surfaceIndex_:" << surfaceIndex_[faceI]
528 <<
" current:" << surfaceHit[faceI]
530 << mesh_.cellCentres()[mesh_.faceOwner()[faceI]]
532 << mesh_.cellCentres()[mesh_.faceNeighbour()[faceI]]
538 != neiHit[faceI-mesh_.nInternalFaces()]
542 <<
"Boundary face:" << faceI
543 <<
" fc:" << mesh_.faceCentres()[faceI]
544 <<
" cached surfaceIndex_:" << surfaceIndex_[faceI]
545 <<
" current:" << surfaceHit[faceI]
547 << mesh_.cellCentres()[mesh_.faceOwner()[faceI]]
548 <<
" end:" << end[faceI]
558 mesh_.nFaces()-mesh_.nInternalFaces(),
559 mesh_.nInternalFaces()
562 labelList neiBoundarySurface(boundarySurface);
570 testSyncBoundaryFaceList
573 "testing surfaceIndex() : ",
581 Pout<<
"meshRefinement::checkData() : Counting duplicate faces." 589 identity(mesh_.nFaces()-mesh_.nInternalFaces())
590 + mesh_.nInternalFaces()
600 if (duplicateFace[i] != -1)
606 Pout<<
"meshRefinement::checkData() : Found " << nDup
607 <<
" duplicate pairs of faces." <<
endl;
614 meshCutter_.setInstance(inst);
615 surfaceIndex_.instance() = inst;
644 mesh_.updateMesh(map);
647 if (map().hasMotionPoints())
649 mesh_.movePoints(map().preMotionPoints());
659 setInstance(mesh_.facesInstance());
667 map().reverseFaceMap(),
674 updateMesh(map, newExposedFaces);
691 label faceI = splitFaces[i];
692 const face&
f = mesh_.faces()[faceI];
698 label nVerts = split[1]-split[0];
726 label own = mesh_.faceOwner()[faceI];
729 if (faceI >= mesh_.nInternalFaces())
731 patchI = mesh_.boundaryMesh().whichPatch(faceI);
735 nei = mesh_.faceNeighbour()[faceI];
738 label zoneI = mesh_.faceZones().whichZone(faceI);
739 bool zoneFlip =
false;
742 const faceZone& fz = mesh_.faceZones()[zoneI];
747 Pout<<
"face:" << faceI <<
" verts:" << f
748 <<
" split into f0:" << f0
784 mesh_.updateMesh(map);
787 if (map().hasMotionPoints())
789 mesh_.movePoints(map().preMotionPoints());
799 setInstance(mesh_.facesInstance());
802 const labelList& oldToNew = map().reverseFaceMap();
809 label oldFaceI = map().faceMap()[faceI];
810 if (oldToNew[oldFaceI] != faceI)
813 newSplitFaces[sz++] = faceI;
817 updateMesh(map, newSplitFaces);
1171 Foam::meshRefinement::meshRefinement
1174 const scalar mergeDistance,
1175 const bool overwrite,
1182 mergeDistance_(mergeDistance),
1183 overwrite_(overwrite),
1185 surfaces_(surfaces),
1186 features_(features),
1198 mesh_.facesInstance(),
1210 updateIntersections(
identity(mesh_.nFaces()));
1223 forAll(surfaceIndex_, faceI)
1225 if (surfaceIndex_[faceI] >= 0 && isMasterFace.
get(faceI) == 1)
1380 const bool keepZoneFaces,
1381 const bool keepBaffles,
1403 label nUnblocked = 0;
1417 specifiedProcessorFaces,
1423 if (keepZoneFaces || keepBaffles)
1445 const word& fzName = surfZones[surfI].faceZoneName();
1450 const faceZone& fZone = fZones[fzName];
1454 label faceI = fZone[i];
1455 if (blockedFace[faceI])
1459 mesh_.isInternalFace(faceI)
1463 blockedFace[faceI] =
false;
1486 Info<<
"Found " << nUnblocked
1487 <<
" zoned faces to keep together." <<
endl;
1493 boolList separatedCoupledFace(mesh_.nFaces(),
false);
1494 selectSeparatedCoupledFaces(separatedCoupledFace);
1496 label nSeparated = 0;
1497 forAll(separatedCoupledFace, faceI)
1499 if (separatedCoupledFace[faceI])
1501 if (blockedFace[faceI])
1503 blockedFace[faceI] =
false;
1509 Info<<
"Found " << nSeparated
1510 <<
" separated coupled faces to keep together." <<
endl;
1512 nUnblocked += nSeparated;
1518 label nBnd = mesh_.nFaces()-mesh_.nInternalFaces();
1520 labelList coupledFace(mesh_.nFaces(), -1);
1538 const labelPair& baffle = allCouples[i];
1546 forAll(coupledFace, faceI)
1548 if (coupledFace[faceI] != -1 && faceI < coupledFace[faceI])
1550 couples[nCpl++] =
labelPair(faceI, coupledFace[faceI]);
1559 Info<<
"Found " << nCouples <<
" baffles to keep together." 1614 blockedFace[baffle.
first()] =
false;
1615 blockedFace[baffle.
second()] =
false;
1623 specifiedProcessorFaces,
1631 Pout<<
"Wanted distribution:" << nProcCells <<
endl;
1636 Pout<<
"Wanted resulting decomposition:" <<
endl;
1637 forAll(nProcCells, procI)
1639 Pout<<
" " << procI <<
'\t' << nProcCells[procI] <<
endl;
1651 setInstance(mesh_.facesInstance());
1661 label nBoundaryFaces = 0;
1663 forAll(surfaceIndex_, faceI)
1665 if (surfaceIndex_[faceI] != -1)
1674 forAll(surfaceIndex_, faceI)
1676 if (surfaceIndex_[faceI] != -1)
1678 surfaceFaces[nBoundaryFaces++] = faceI;
1681 return surfaceFaces;
1688 const faceList& faces = mesh_.faces();
1692 label nBoundaryPoints = 0;
1694 forAll(surfaceIndex_, faceI)
1696 if (surfaceIndex_[faceI] != -1)
1698 const face&
f = faces[faceI];
1702 if (isBoundaryPoint.set(f[fp], 1u))
1739 labelList boundaryPoints(nBoundaryPoints);
1740 nBoundaryPoints = 0;
1741 forAll(isBoundaryPoint, pointI)
1743 if (isBoundaryPoint.get(pointI) == 1u)
1745 boundaryPoints[nBoundaryPoints++] = pointI;
1749 return boundaryPoints;
1767 const polyPatch& pp = patches[patchIDs[i]];
1769 nFaces += pp.size();
1778 const polyPatch& pp = patches[patchIDs[i]];
1784 addressing[nFaces++] = meshFaceI++;
1813 pointPatches.
size(),
1814 slipPointPatchVectorField::typeName
1819 patchFieldTypes[adaptPatchIDs[i]] =
1820 fixedValuePointPatchVectorField::typeName;
1823 forAll(pointPatches, patchI)
1825 if (isA<processorPointPatch>(pointPatches[patchI]))
1827 patchFieldTypes[patchI] = calculatedPointPatchVectorField::typeName;
1829 else if (isA<cyclicPointPatch>(pointPatches[patchI]))
1831 patchFieldTypes[patchI] = cyclicSlipPointPatchVectorField::typeName;
1843 "pointDisplacement",
1878 "meshRefinement::checkCoupledFaceZones(const polyMesh&)" 1879 ) <<
"faceZones are not synchronised on processors." <<
nl 1880 <<
"Processor " << procI <<
" has faceZones " 1881 << zoneNames[procI] <<
nl 1883 <<
" has faceZones " 1897 const faceZone& fZone = fZones[zoneI];
1905 if (faceToZone[bFaceI] == -1)
1907 faceToZone[bFaceI] = zoneI;
1909 else if (faceToZone[bFaceI] == zoneI)
1913 "meshRefinement::checkCoupledFaceZones(const polyMesh&)" 1914 ) <<
"Face " << fZone[i] <<
" in zone " 1916 <<
" is twice in zone!" 1923 "meshRefinement::checkCoupledFaceZones(const polyMesh&)" 1924 ) <<
"Face " << fZone[i] <<
" in zone " 1926 <<
" is also in zone " 1927 << fZones[faceToZone[bFaceI]].
name()
1939 if (faceToZone[i] != neiFaceToZone[i])
1943 "meshRefinement::checkCoupledFaceZones(const polyMesh&)" 1945 <<
" is in zone " << faceToZone[i]
1946 <<
", its coupled face is in zone " << neiFaceToZone[i]
1971 const edge&
e = edges[edgeI];
1977 pts[meshPoints[e[1]]]
1978 - pts[meshPoints[e[0]]]
1981 edgeWeights[edgeI] = 1.0/eMag;
1997 forAll(invSumWeight, pointI)
1999 scalar w = invSumWeight[pointI];
2003 invSumWeight[pointI] = 1.0/w;
2012 const label insertPatchI,
2013 const word& patchName,
2027 polyPatches.
setSize(patchI+1);
2045 polyPatches[patchI],
2050 addPatchFields<volScalarField>
2055 addPatchFields<volVectorField>
2060 addPatchFields<volSphericalTensorField>
2065 addPatchFields<volSymmTensorField>
2070 addPatchFields<volTensorField>
2078 addPatchFields<surfaceScalarField>
2083 addPatchFields<surfaceVectorField>
2088 addPatchFields<surfaceSphericalTensorField>
2093 addPatchFields<surfaceSymmTensorField>
2098 addPatchFields<surfaceTensorField>
2111 const word& patchName,
2127 label insertPatchI = polyPatches.
size();
2130 forAll(polyPatches, patchI)
2132 const polyPatch& pp = polyPatches[patchI];
2134 if (isA<processorPolyPatch>(pp))
2136 insertPatchI = patchI;
2137 startFaceI = pp.
start();
2143 patchDict.
set(
"nFaces", 0);
2144 patchDict.
set(
"startFace", startFaceI);
2149 label addedPatchI = appendPatch(mesh, insertPatchI, patchName, patchDict);
2155 for (
label i = 0; i < insertPatchI; i++)
2160 for (
label i = insertPatchI; i < addedPatchI; i++)
2165 oldToNew[addedPatchI] = insertPatchI;
2168 polyPatches.
reorder(oldToNew,
true);
2171 reorderPatchFields<volScalarField>(
mesh, oldToNew);
2172 reorderPatchFields<volVectorField>(
mesh, oldToNew);
2173 reorderPatchFields<volSphericalTensorField>(
mesh, oldToNew);
2174 reorderPatchFields<volSymmTensorField>(
mesh, oldToNew);
2175 reorderPatchFields<volTensorField>(
mesh, oldToNew);
2176 reorderPatchFields<surfaceScalarField>(
mesh, oldToNew);
2177 reorderPatchFields<surfaceVectorField>(
mesh, oldToNew);
2178 reorderPatchFields<surfaceSphericalTensorField>(
mesh, oldToNew);
2179 reorderPatchFields<surfaceSymmTensorField>(
mesh, oldToNew);
2180 reorderPatchFields<surfaceTensorField>(
mesh, oldToNew);
2182 return insertPatchI;
2197 return mesh_.boundaryMesh().findPatchID(name);
2202 label patchI = addPatch(mesh_, name, patchInfo);
2227 meshedPatches_.append(name);
2239 forAll(meshedPatches_, i)
2246 <<
"Problem : did not find patch " << meshedPatches_[i]
2247 <<
endl <<
"Valid patches are " << patches.
names()
2267 if (isA<coupledPolyPatch>(patches[patchI]))
2278 selected[cpp.
start()+i] =
true;
2290 const vector& perturbVec,
2298 regionI = cellToRegion[cellI];
2305 cellI = mesh.
findCell(p+perturbVec);
2308 regionI = cellToRegion[cellI];
2320 const point& keepPoint
2324 (void)mesh_.tetBasePtIs();
2329 boolList blockedFace(mesh_.nFaces(),
false);
2330 selectSeparatedCoupledFaces(blockedFace);
2334 label regionI = findRegion
2338 mergeDistance_*
vector(1,1,1),
2346 "meshRefinement::splitMeshRegions(const point&)" 2347 ) <<
"Point " << keepPoint
2348 <<
" is not inside the mesh." <<
nl 2349 <<
"Bounding box of the mesh:" << mesh_.bounds()
2358 forAll(cellRegion, cellI)
2360 if (cellRegion[cellI] != regionI)
2362 cellsToRemove.
append(cellI);
2365 cellsToRemove.shrink();
2367 label nCellsToKeep = mesh_.nCells() - cellsToRemove.
size();
2370 Info<<
"Keeping all cells in region " << regionI
2371 <<
" containing point " << keepPoint <<
endl 2372 <<
"Selected for keeping : " 2374 <<
" cells." <<
endl;
2394 label defaultPatch = 0;
2395 if (globalToMasterPatch.
size())
2397 defaultPatch = globalToMasterPatch[0];
2402 "meshRefinement::splitMeshRegions(const point&)" 2403 ) <<
"Removing non-reachable cells exposes " 2404 << nExposedFaces <<
" internal or coupled faces." << endl
2405 <<
" These get put into patch " << defaultPatch <<
endl;
2406 exposedPatch.setSize(exposedFaces.
size(), defaultPatch);
2409 return doRemoveCells
2426 meshCutter_.distribute(map);
2455 geometry[i].distribute
2463 if (faceMap.
valid())
2466 geometry[i].instance() = geometry[i].time().timeName();
2485 updateMesh(map, changedFaces, dummyMap, dummyMap, dummyMap);
2497 meshCutter_.storeData
2518 meshCutter_.updateMesh
2530 updateIntersections(changedFaces);
2537 if (userFaceData_[i].first() == KEEPALL)
2542 else if (userFaceData_[i].first() == MASTERONLY)
2547 forAll(newFaceData, faceI)
2553 newFaceData[faceI] = data[oldFaceI];
2573 if (reverseFaceMap[oldFaceI] != faceI)
2576 reverseFaceMap[oldFaceI] = -1;
2583 forAll(newFaceData, faceI)
2589 if (reverseFaceMap[oldFaceI] == faceI)
2591 newFaceData[faceI] = data[oldFaceI];
2605 && meshCutter_.write()
2606 && surfaceIndex_.write();
2632 writeOk = writeOk && s.
write();
2649 forAll(meshPoints, pointI)
2665 forAll(meshPoints, pointI)
2669 isPatchMasterPoint[pointI] =
true;
2673 return isPatchMasterPoint;
2688 myEdges[edgeI] = globalEdges.toGlobal(edgeI);
2704 if (myEdges[edgeI] == globalEdges.toGlobal(edgeI))
2706 isMasterEdge[edgeI] =
true;
2710 return isMasterEdge;
2722 <<
" : cells(local):" << mesh_.nCells()
2723 <<
" faces(local):" << mesh_.nFaces()
2724 <<
" points(local):" << mesh_.nPoints()
2730 label nMasterFaces = 0;
2733 if (isMasterFace[i])
2740 label nMasterPoints = 0;
2741 forAll(isMeshMasterPoint, i)
2743 if (isMeshMasterPoint[i])
2759 const labelList& cellLevel = meshCutter_.cellLevel();
2765 nCells[cellLevel[cellI]]++;
2771 Info<<
"Cells per refinement level:" <<
endl;
2774 Info<<
" " << levelI <<
'\t' << nCells[levelI]
2784 if (overwrite_ && mesh_.time().timeIndex() == 0)
2786 return oldInstance_;
2790 return mesh_.time().timeName();
2805 mesh_.time().timeName(),
2813 zeroGradientFvPatchScalarField::typeName
2816 const labelList& cellLevel = meshCutter_.cellLevel();
2818 forAll(volRefLevel, cellI)
2820 volRefLevel[cellI] = cellLevel[cellI];
2823 volRefLevel.write();
2835 mesh_.time().timeName(),
2845 const labelList& pointLevel = meshCutter_.pointLevel();
2847 forAll(pointRefLevel, pointI)
2849 pointRefLevel[pointI] = pointLevel[pointI];
2852 pointRefLevel.write();
2860 const pointField& cellCentres = mesh_.cellCentres();
2862 OFstream str(prefix +
"_edges.obj");
2864 Pout<<
"meshRefinement::dumpIntersections :" 2865 <<
" Writing cellcentre-cellcentre intersections to file " 2873 labelList neiLevel(mesh_.nFaces()-mesh_.nInternalFaces());
2874 pointField neiCc(mesh_.nFaces()-mesh_.nInternalFaces());
2875 calcNeighbourData(neiLevel, neiCc);
2877 labelList intersectionFaces(intersectedFaces());
2883 forAll(intersectionFaces, i)
2885 label faceI = intersectionFaces[i];
2886 start[i] = cellCentres[mesh_.faceOwner()[faceI]];
2888 if (mesh_.isInternalFace(faceI))
2890 end[i] = cellCentres[mesh_.faceNeighbour()[faceI]];
2894 end[i] = neiCc[faceI-mesh_.nInternalFaces()];
2900 const vectorField smallVec(ROOTSMALL*(end-start));
2909 surfaces_.findAnyIntersection
2917 forAll(intersectionFaces, i)
2919 if (surfaceHit[i] != -1)
2927 str <<
"l " << vertI-2 <<
' ' << vertI-1 <<
nl 2928 <<
"l " << vertI-1 <<
' ' << vertI <<
nl;
2944 if (writeFlags & WRITEMESH)
2948 if (writeFlags & WRITELEVELS)
2950 dumpRefinementLevel();
2952 if (debugFlags & OBJINTERSECTIONS && prefix.size())
2954 dumpIntersections(prefix);
2967 writeLevel_ = flags;
2973 return outputLevel_;
2979 outputLevel_ = flags;
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
void storeData(const labelList &pointsToStore, const labelList &facesToStore, const labelList &cellsToStore)
Signal points/face/cells for which to store data.
labelList getExposedFaces(const labelList &cellsToRemove) const
Get labels of exposed faces.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
static bool & parRun()
Is this a parallel run?
A List with indirect addressing.
fileName caseConstant() const
Return constant name for the case.
label countHits() const
Count number of intersections (local)
const boolList & flipMap() const
Return face flip map.
Simple random number generator.
const faceZoneMesh & faceZones() const
Return face zone mesh.
Pre-declare related SubField type.
cachedRandom rndGen(label(0),-1)
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
label addFace(const face &f, const label own, const label nei, const label masterPointID, const label masterEdgeID, const label masterFaceID, const bool flipFaceFlux, const label patchID, const label zoneID, const bool zoneFlip)
Add face to cells. Return new face label.
static PackedBoolList getMasterFaces(const polyMesh &)
Get per face whether it is uncoupled or a master of a.
static autoPtr< fvPatch > New(const polyPatch &, const fvBoundaryMesh &)
Return a pointer to a new patch created on freestore from polyPatch.
void selectSeparatedCoupledFaces(boolList &) const
Select coupled faces that are not collocated.
This boundary condition is not designed to be evaluated; it is assmued that the value is assigned via...
bool write() const
Write mesh and all data.
Mesh data needed to do the Finite Volume discretisation.
Container for data on surfaces used for surface-driven refinement. Contains all the data about the le...
label size() const
Return the number of elements in the PtrList.
virtual bool separated() const
Are the planes separated.
const labelList & reverseFaceMap() const
Reverse face map.
bool set(const label) const
Is element set.
static label findRegion(const polyMesh &, const labelList &cellRegion, const vector &perturbVec, const point &p)
Find region point is in. Uses optional perturbation to re-test.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
vector point
Point is a vector.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
An ordered pair of two objects of type <T> with first() and second() elements.
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 ))
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
const vectorField::subField faceAreas() const
Return face normals.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines. WIP.
dimensioned< scalar > mag(const dimensioned< Type > &)
void clear()
Delete object (if the pointer is valid) and set pointer to NULL.
labelList intersectedPoints() const
Get points on surfaces with intersection and boundary faces.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
virtual labelList decompose(const pointField &points, const scalarField &pointWeights)
Return for every coordinate the wanted processor number.
static const pointMesh & New(const polyMesh &mesh)
static const NamedEnum< IOdebugType, 5 > IOdebugTypeNames
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set).
A subset of mesh faces organised as a primitive patch.
const labelUList & faceCells() const
Return face-cell addressing.
static outputType outputLevel()
Get/set output level.
const Type & second() const
Return second.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Standard boundBox + extra functionality for use in octree.
void updateMesh(const mapPolyMesh &, const labelList &changedFaces)
Update for external change to mesh. changedFaces are in new mesh.
static labelList findDuplicateFaces(const primitiveMesh &, const labelList &)
Helper routine to find baffles (two boundary faces using the.
void size(const label)
Override size to be inconsistent with allocated storage.
static const NamedEnum< IOwriteType, 4 > IOwriteTypeNames
Given list of cells to remove insert all the topology changes.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void setRefinement(const labelList &cellsToRemove, const labelList &facesToExpose, const labelList &patchIDs, polyTopoChange &) const
Play commands into polyTopoChange to remove cells.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
const fileName & instance() const
void dumpRefinementLevel() const
Write refinement level as volScalarFields for postprocessing.
Database for solution data, solver performance and other reduced data.
autoPtr< mapPolyMesh > splitMeshRegions(const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, const point &keepPoint)
Split mesh. Keep part containing point.
static autoPtr< indirectPrimitivePatch > makePatch(const polyMesh &, const labelList &)
Create patch from set of patches.
fileName caseSystem() const
Return system name for the case.
PrimitivePatch< face, IndirectList, const pointField & > indirectPrimitivePatch
Foam::indirectPrimitivePatch.
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
label size() const
Number of entries.
static void syncEdgeList(const polyMesh &, List< T > &, const CombineOp &cop, const T &nullValue, const TransformOp &top)
Synchronize values on all mesh edges.
static PackedBoolList getMasterPoints(const polyMesh &)
Get per point whether it is uncoupled or a master of a.
void setConstraints(const polyMesh &mesh, boolList &blockedFace, PtrList< labelList > &specifiedProcessorFaces, labelList &specifiedProcessor, List< labelPair > &explicitConnections)
Helper: extract constraints:
Accumulating histogram of values. Specified bin resolution automatic generation of bins...
Mesh representing a set of points created from polyMesh.
void printMeshInfo(const bool, const string &) const
Print some mesh stats.
const fileName & pointsInstance() const
Return the current instance directory for points.
A list of keyword definitions, which are a keyword followed by any number of values (e...
void distribute(const mapDistributePolyMesh &)
Update local numbering for mesh redistribution.
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
static void syncFaceList(const polyMesh &mesh, UList< T > &l, const CombineOp &cop)
Synchronize values on all mesh faces.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
autoPtr< mapDistributePolyMesh > balance(const bool keepZoneFaces, const bool keepBaffles, const scalarField &cellWeights, decompositionMethod &decomposer, fvMeshDistribute &distributor)
Redecompose according to cell count.
const word & constant() const
Return constant name.
A patch is a list of labels that address the faces in the global face list.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
void setInstance(const fileName &)
Set instance of all local IOobjects.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
const vectorField::subField faceCentres() const
Return face centres.
wordList names() const
Return a list of patch names.
virtual bool write() const
Write using setting from DB.
A face is a list of labels corresponding to mesh vertices.
static void checkCoupledFaceZones(const polyMesh &)
Helper function: check that face zones are synced.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
const double e
Elementary charge.
Calculates points shared by more than two processor patches or cyclic patches.
void setSize(const label)
Reset size of List.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual bool parallel() const
Are the cyclic planes parallel.
autoPtr< mapPolyMesh > splitFaces(const labelList &splitFaces, const labelPairList &splits)
Split faces into two.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
#define WarningIn(functionName)
Report a warning using Foam::Warning.
static tmp< pointVectorField > makeDisplacementField(const pointMesh &pMesh, const labelList &adaptPatchIDs)
Helper function to make a pointVectorField with correct.
treeBoundBox extend(Random &, const scalar s) const
Return slightly wider bounding box.
virtual const pointField & points() const
Return raw points.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
static void testSyncPointList(const string &msg, const polyMesh &mesh, const List< scalar > &fld)
Abstract base class for decomposition.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
const fileName & name() const
Return the name of the stream.
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
static bool constraintType(const word &pt)
Return true if the given type is a constraint type.
const pointBoundaryMesh & boundary() const
Return reference to boundary mesh.
static PackedBoolList getMasterEdges(const polyMesh &mesh, const labelList &meshEdges)
Determine master edge for subset of edges. If coupled.
static PackedBoolList getMasterPoints(const polyMesh &mesh, const labelList &meshPoints)
Determine master point for subset of points. If coupled.
ListType renumber(const labelUList &oldToNew, const ListType &)
Renumber the values (not the indices) of a list.
label nTotalCells() const
Return total number of cells in decomposed mesh.
const labelList & faceMap() const
Old face map.
label findCell(const point &p, const cellDecomposition=CELL_TETS) const
Find cell enclosing this location and return index.
static void swapBoundaryFaceList(const polyMesh &mesh, UList< T > &l)
Swap coupled boundary face values.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
List< treeBoundBox > meshBb(1, treeBoundBox( boundBox(coarseMesh.points(), false) ).extend(rndGen, 1e-3))
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
static label appendPatch(fvMesh &, const label insertPatchI, const word &, const dictionary &)
Helper:append patch to end of mesh.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
errorManip< error > abort(error &err)
const word & name() const
Return name.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
const word & name() const
Return name.
static void syncPointList(const polyMesh &, List< T > &, const CombineOp &cop, const T &nullValue, const TransformOp &top)
Synchronize values on all mesh points.
IOwriteType
Enumeration for what to write.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return a pointer to a new patch created on freestore from.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Initialise the NamedEnum HashTable from the static list of names.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Encapsulates queries for features.
static labelList countCells(const labelList &)
Helper function: count cells per processor in wanted distribution.
static writeType writeLevel()
Get/set write level.
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
label start() const
Return start label of this patch in the polyMesh face list.
autoPtr< mapDistributePolyMesh > distribute(const labelList &dist)
Send cells to neighbours according to distribution.
label nInternalFaces() const
void modifyFace(const face &f, const label faceI, const label own, const label nei, const bool flipFaceFlux, const label patchID, const label zoneID, const bool zoneFlip)
Modify vertices or cell of face.
static const NamedEnum< IOoutputType, 1 > IOoutputTypeNames
static void calculateEdgeWeights(const polyMesh &mesh, const PackedBoolList &isMasterEdge, const labelList &meshPoints, const edgeList &edges, scalarField &edgeWeights, scalarField &invSumWeight)
Helper: calculate edge weights (1/length)
labelList intersectedFaces() const
Get faces with intersection.
Mesh consisting of general polyhedral cells.
void set(entry *)
Assign a new entry, overwrite any existing entry.
const PtrList< surfaceZonesInfo > & surfZones() const
List< label > labelList
A List of labels.
void clearOut()
Clear all geometry and addressing.
A class for handling file names.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Pair< label > labelPair
Label pair.
const Type & first() const
Return first.
IOoutputType
Enumeration for what to output.
const Time & time() const
Return time.
Vector< scalar > vector
A scalar version of the templated Vector.
Direct mesh changes based on v1.3 polyTopoChange syntax.
A List obtained as a section of another List.
IOdebugType
Enumeration for what to debug.
Container for searchableSurfaces.
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
void append(const T &)
Append an element at the end of the list.
word timeName() const
Replacement for Time::timeName() : return oldInstance (if.
const Time & time() const
Return time.
void checkData()
Debugging: check that all faces still obey start()>end()
void reorder(const labelUList &)
Reorders elements. Ordering does not have to be done in.
labelList meshedPatches() const
Get patchIDs for patches added in addMeshedPatch.
virtual const faceList & faces() const
Return raw faces.
wordList names() const
Return a list of zone names.
label addMeshedPatch(const word &name, const dictionary &)
Add patch originating from meshing. Update meshedPatches_.
static void swapBoundaryFacePositions(const polyMesh &mesh, UList< point > &l)
Swap coupled positions.
static void syncBoundaryFacePositions(const polyMesh &mesh, UList< point > &l, const CombineOp &cop)
Synchronize locations on boundary faces only.
static label addPatch(fvMesh &, const word &name, const dictionary &)
Helper:add patch to mesh. Update all registered fields.
void reorder(const labelUList &, const bool validBoundary)
Reorders patches. Ordering does not have to be done in.
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
void distributeFaceData(List< T > &lst) const
Distribute list of face data.
void writeOBJ(Ostream &os, const point &pt)
Write obj representation of point.
label findPatchID(const word &patchName) const
Find patch index given a name.
Type gMax(const FieldField< Field, Type > &f)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
bool found(const Key &) const
Return true if hashedEntry is found in table.
A class for managing temporary objects.
autoPtr< mapPolyMesh > changeMesh(polyMesh &mesh, const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
void dumpIntersections(const fileName &prefix) const
Debug: Write intersection information to OBJ format.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
defineTypeNameAndDebug(combustionModel, 0)
prefixOSstream Pout(cout,"Pout")
unsigned int get(const label) const
Get value at index I.
Encapsulates queries for volume refinement ('refine all cells within shell').
static const label labelMax
const word & system() const
Return system name.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.