43 #ifndef meshRefinement_H
44 #define meshRefinement_H
63 class polyDistributionMap;
64 class decompositionMethod;
65 class refinementSurfaces;
66 class refinementFeatures;
67 class refinementRegions;
69 class fvMeshDistribute;
70 class searchableSurface;
74 class localPointRegion;
167 const scalar mergeDistance_;
170 const bool overwrite_;
173 const word oldInstance_;
209 void calcNeighbourData
216 void updateIntersections(
const labelList& changedFaces);
236 const label exposedPatchi
245 static bool markForRefine
247 const label markValue,
248 const label nAllowRefine,
255 void markFeatureCellLevel
263 label markFeatureRefinement
266 const label nAllowRefine,
273 label markInternalDistanceToFeatureRefinement
275 const label nAllowRefine,
281 label markInternalRefinement
283 const label nAllowRefine,
296 label markSurfaceRefinement
298 const label nAllowRefine,
310 const scalar tol = 1
e-6
316 label markSurfaceCurvatureRefinement
318 const scalar curvature,
319 const label nAllowRefine,
329 const scalar planarCos,
330 const label nAllowRefine,
332 const label surfaceLevel,
334 const vector& surfaceNormal,
347 label markProximityRefinement
349 const scalar curvature,
350 const label nAllowRefine,
363 const bool allowBoundary,
369 void getBafflePatches
384 const label ownPatch,
385 const label nbrPatch,
393 void markBoundaryFace
420 const scalar minFaceArea,
421 const scalar maxNonOrtho,
428 const scalar volFraction,
444 const bool removeEdgeConnectedCells,
456 labelList markFacesOnProblemCellsGeometric
470 const scalar freeStandingAngle
480 void findCellZoneGeometric
491 void findCellZoneInsideWalk
500 bool calcRegionToZone
502 const label surfZoneI,
503 const label ownRegion,
504 const label neiRegion,
511 void findCellZoneTopo
521 void makeConsistentFaceIndex
528 void handleSnapProblems
531 const bool useTopologicalSnapDetection,
532 const bool removeEdgeConnectedCells,
554 void calcPatchNumMasterFaces
571 void consistentOrientation
623 return mergeDistance_;
665 return surfaceIndex_;
670 return surfaceIndex_;
679 return userFaceData_;
684 return userFaceData_;
699 const bool keepZoneFaces,
700 const bool keepBaffles,
786 const scalar curvature,
787 const scalar planarAngle,
789 const bool featureRefinement,
790 const bool featureDistanceRefinement,
791 const bool internalRefinement,
792 const bool surfaceRefinement,
793 const bool curvatureRefinement,
794 const bool gapRefinement,
795 const label maxGlobalCells,
796 const label maxLocalCells
809 const scalar maxLoadUnbalance
819 const scalar maxLoadUnbalance
828 const bool handleSnapProblems,
832 const bool useTopologicalSnapDetection,
833 const bool removeEdgeConnectedCells,
837 const bool mergeFreeStanding,
838 const scalar freeStandingAngle,
851 const label nBufferLayers,
898 const bool allowFreeStandingZoneFaces
919 const point& location
997 const scalar concaveCos,
1031 const scalar minCos,
1135 template<
class Enum>
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A HashTable to objects of type <T> with a label key.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Abstract base class for decomposition.
A list of keyword definitions, which are a keyword followed by any number of values (e....
A class for handling file names.
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
Mesh data needed to do the Finite Volume discretisation.
Refinement of (split) hexes using polyTopoChange.
Takes mesh with 'baffles' (= boundary faces sharing points). Determines for selected points on bounda...
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
autoPtr< polyTopoChangeMap > createBaffles(const labelList &ownPatch, const labelList &nbrPatch)
Create baffle for every internal face where ownPatch != -1.
autoPtr< polyTopoChangeMap > splitMeshRegions(const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, const refinementParameters::cellSelectionPoints &selectionPoints)
Split mesh according to selectionPoints.
autoPtr< polyDistributionMap > refineAndBalance(const string &msg, decompositionMethod &decomposer, fvMeshDistribute &distributor, const labelList &cellsToRefine, const scalar maxLoadUnbalance)
Refine some cells and rebalance.
autoPtr< polyTopoChangeMap > mergeBaffles(const List< labelPair > &)
Merge baffles. Gets pairs of faces.
static int readFlags(const Enum &namedEnum, const wordList &)
Helper: convert wordList into bit pattern using provided.
static void collectAndPrint(const UList< point > &points, const UList< T > &data)
Print list according to (collected and) sorted coordinate.
labelList intersectedFaces() const
Get faces with intersection.
labelList intersectedPoints() const
Get points on surfaces with intersection and boundary faces.
autoPtr< polyTopoChangeMap > doRestorePoints(removePoints &pointRemover, const labelList &facesToRestore)
IOwriteType
Enumeration for what to write.
void baffleAndSplitMesh(const bool handleSnapProblems, const snapParameters &snapParams, const bool useTopologicalSnapDetection, const bool removeEdgeConnectedCells, const scalarField &perpendicularAngle, const bool mergeFreeStanding, const scalar freeStandingAngle, const dictionary &motionDict, Time &runTime, const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, const refinementParameters::cellSelectionPoints &selectionPoints)
Split off unreachable areas of mesh.
label mergeEdgesUndo(const scalar minCos, const dictionary &motionDict)
Merge edges, maintain mesh quality. Return global number.
labelList refineCandidates(const List< point > &insidePoints, const scalar curvature, const scalar planarAngle, const bool featureRefinement, const bool featureDistanceRefinement, const bool internalRefinement, const bool surfaceRefinement, const bool curvatureRefinement, const bool gapRefinement, const label maxGlobalCells, const label maxLocalCells) const
Calculate list of cells to refine.
meshRefinement(fvMesh &mesh, const dictionary &refineDict, const scalar mergeDistance, const bool overwrite, refinementSurfaces &, const refinementFeatures &, const refinementRegions &)
Construct from components.
static void testSyncPointList(const string &msg, const polyMesh &mesh, const List< scalar > &fld)
void checkData()
Debugging: check that all faces still obey start()>end()
autoPtr< polyTopoChangeMap > zonify(const List< point > &insidePoints, const bool allowFreeStandingZoneFaces)
Put faces/cells into zones according to surface specification.
autoPtr< polyTopoChangeMap > splitMesh(const label nBufferLayers, const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, const refinementParameters::cellSelectionPoints &selectionPoints)
Split off (with optional buffer layers) unreachable areas.
const refinementSurfaces & surfaces() const
Reference to surface search engines.
void operator=(const meshRefinement &)=delete
Disallow default bitwise assignment.
void topoChange(const polyTopoChangeMap &, const labelList &changedFaces)
Update for external change to mesh. changedFaces are in new mesh.
word name() const
Replacement for Time::name() : return oldInstance (if.
const fvMesh & mesh() const
Reference to mesh.
autoPtr< polyTopoChangeMap > refine(const labelList &cellsToRefine)
Refine some cells.
static const NamedEnum< IOwriteType, 5 > IOwriteTypeNames
label mergePatchFacesUndo(const scalar minCos, const scalar concaveCos, const labelHashSet &patchIDs, const dictionary &motionDict, const labelList &preserveFaces)
Merge coplanar faces. preserveFaces is != -1 for faces.
autoPtr< polyTopoChangeMap > createZoneBaffles(const labelList &globalToMasterPatch, const labelList &globalToSlavePatch, List< labelPair > &)
Create baffles for faces straddling zoned surfaces. Return.
void printMeshInfo(const bool, const string &) const
Print some mesh stats.
void distribute(const polyDistributionMap &)
Update local numbering for mesh redistribution.
void dumpRefinementLevel() const
Write refinement level as volScalarFields for postprocessing.
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)
void checkZoneFaces() const
Debug helper: check faceZones are not on processor patches.
label countHits() const
Count number of intersections (local)
ClassName("meshRefinement")
Runtime type information.
static T gAverage(const PackedBoolList &isMasterElem, const UList< T > &values)
Helper: calculate average.
mapType
Enumeration for how the userdata is to be mapped upon refinement.
@ KEEPALL
have slaves (upon refinement) from master
@ REMOVE
set value to -1 any face that was refined
@ MASTERONLY
maintain master only
static const NamedEnum< IOdebugType, 5 > IOdebugTypeNames
const List< Tuple2< mapType, labelList > > & userFaceData() const
Additional face data that is maintained across.
const refinementFeatures & features() const
Reference to feature edge mesh.
labelList meshedPatches() const
Get patchIDs for patches added in addMeshedPatch.
static void checkCoupledFaceZones(const polyMesh &)
Helper function: check that face zones are synced.
const labelList & surfaceIndex() const
Per start-end edge the index of the surface hit.
autoPtr< polyTopoChangeMap > doRemovePoints(removePoints &pointRemover, const boolList &pointCanBeDeleted)
labelList collectFaces(const labelList &candidateFaces, const labelHashSet &set) const
label addMeshedPatch(const word &name, const dictionary &)
Add patch originating from meshing. Update meshedPatches_.
bool isGap(const scalar, const vector &, const vector &, const vector &, const vector &) const
Is local topology a small gap?
void testSyncBoundaryFaceList(const scalar mergeDistance, const string &, const UList< T > &, const UList< T > &) const
Compare two lists over all boundary faces.
void selectSeparatedCoupledFaces(boolList &) const
Select coupled faces that are not collocated.
static tmp< pointVectorField > makeDisplacementField(const pointMesh &pMesh, const labelList &adaptPatchIDs)
Helper function to make a pointVectorField with correct.
const refinementRegions & shells() const
Reference to refinement shells (regions)
static const NamedEnum< IOoutputType, 1 > IOoutputTypeNames
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.
autoPtr< polyDistributionMap > balance(const bool keepZoneFaces, const bool keepBaffles, const scalarField &cellWeights, decompositionMethod &decomposer, fvMeshDistribute &distributor)
Redecompose according to cell count.
autoPtr< polyDistributionMap > balanceAndRefine(const string &msg, decompositionMethod &decomposer, fvMeshDistribute &distributor, const labelList &cellsToRefine, const scalar maxLoadUnbalance)
Balance before refining some cells.
scalar mergeDistance() const
autoPtr< polyTopoChangeMap > dupNonManifoldPoints()
Find boundary points that connect to more than one cell.
static autoPtr< indirectPrimitivePatch > makePatch(const polyMesh &, const labelList &)
Create patch from set of patches.
void storeData(const labelList &pointsToStore, const labelList &facesToStore, const labelList &cellsToStore)
Signal points/face/cells for which to store data.
static void updateList(const labelList &newToOld, const T &nullValue, List< T > &elems)
Helper: reorder list according to map.
const word & oldInstance() const
(points)instance of mesh upon construction
bool overwrite() const
Overwrite the mesh?
bool write() const
Write mesh and all data.
IOoutputType
Enumeration for what to output.
void setInstance(const fileName &)
Set instance of all local IOobjects.
labelList growFaceCellFace(const labelHashSet &set) const
autoPtr< polyTopoChangeMap > splitFaces(const labelList &splitFaces, const labelPairList &splits)
Split faces into two.
const hexRef8 & meshCutter() const
Reference to meshcutting engine.
static label findRegion(const polyMesh &, const labelList &cellRegion, const vector &perturbVec, const point &location)
Find region point is in. Uses optional perturbation to re-test.
static writeType writeLevel()
Get/set write level.
IOdebugType
Enumeration for what to debug.
bool isNormalGap(const scalar, const vector &, const vector &, const vector &, const vector &) const
Is local topology a small gap normal to the test vector.
static void findRegions(const polyMesh &, labelList &cellRegion, const vector &perturbVec, const refinementParameters::cellSelectionPoints &selectionPoints)
Find regions points are in and update cellRegion.
void dumpIntersections(const fileName &prefix) const
Debug: Write intersection information to OBJ format.
static outputType outputLevel()
Get/set output level.
static void weightedSum(const polyMesh &mesh, const PackedBoolList &isMasterEdge, const labelList &meshPoints, const edgeList &edges, const scalarField &edgeWeights, const Field< Type > &data, Field< Type > &sum)
Helper: weighted sum (over all subset of mesh points) by.
Mesh representing a set of points created from polyMesh.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Mesh consisting of general polyhedral cells.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Direct mesh changes based on v1.3 polyTopoChange syntax.
Container with cells to refine. Refinement given as single direction.
Encapsulates queries for features.
Class to hold the points to select cells inside and outside.
Encapsulates queries for volume refinement ('refine all cells within shell').
Container for data on surfaces used for surface-driven refinement. Contains all the data about the le...
Given list of cells to remove insert all the topology changes.
Removes selected points from mesh and updates faces using these points.
Simple container to keep together snap specific information.
Contains information about location on a triSurface.
A class for managing temporary objects.
A class for handling words, derived from string.
gmvFile<< "tracers "<< particles.size()<< nl;{ pointField positions(particles.size());label particlei=0;forAllConstIter(Cloud< passiveParticle >, particles, iter) { positions[particlei++]=iter().position(mesh);} for(i=0;i< pTraits< point >::nComponents;i++) { forAll(positions, particlei) { gmvFile<< component(positions[particlei], i)<< ' ';} gmvFile<< nl;}}forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)