62 bool limitRefinementLevel
71 label oldNCells = refCells.
size();
75 const labelList& cCells = cellCells[celli];
79 if (refLevel[cCells[i]] > (refLevel[celli]+1))
89 if (refCells.
size() > oldNCells)
91 Info<<
"Added an additional " << refCells.
size() - oldNCells
92 <<
" cells to satisfy 1:2 refinement level" 102 int main(
int argc,
char *argv[])
106 "Attempt to determine refinement levels of a refined cartesian mesh.\n" 107 "Run BEFORE snapping!" 113 "Read level from refinementLevel file" 120 Info<<
"Dividing cells into bins depending on cell volume.\nThis will" 121 <<
" correspond to refinement levels for a mesh with only 2x2x2" 123 <<
"The upper range for every bin is always 1.1 times the lower range" 124 <<
" to allow for some truncation error." 127 const bool readLevel =
args.
found(
"readLevel");
142 lowerLimits.
append(sortedVols[0]);
147 if (sortedVols[i] > upperLimits.
last())
156 Info<<
"Collected " << bin.
size() <<
" elements in bin " 157 << lowerLimits.
last() <<
" .. " 162 lowerLimits.
append(sortedVols[i]);
165 Info<<
"Creating new bin " << lowerLimits.
last()
166 <<
" .. " << upperLimits.
last()
173 bin.
append(sortedVols.indices()[i]);
177 bins.
last().shrink();
187 Info<<
"Volume bins:" <<
nl;
195 Info<<
" " << lowerLimits[binI] <<
" .. " << upperLimits[binI]
196 <<
" : writing " << bin.
size() <<
" cells to cellSet " 231 forAll(newPatches, patchi)
236 patches[patchi].clone(fMesh.boundaryMesh())
240 fMesh.addFvPatches(newPatches);
252 if (!readLevel && refHeader.typeHeaderOk<
labelIOList>(
true))
255 <<
"Detected " << refHeader.name() <<
" file in " 257 <<
" recreate it or use the -readLevel option to use it" 303 refLevel[bin[i]] = bins.
size() - binI - 1;
304 postRefLevel[bin[i]] = refLevel[bin[i]];
309 postRefLevel.boundaryFieldRef();
314 forAll(postRefLevel.boundaryField(), patchi)
320 Info<<
"Setting field for patch "<<
endl;
326 bField[facei] = postRefLevel[own];
330 Info<<
"Determined current refinement level and writing to " 331 << postRefLevel.name() <<
" (as volScalarField; for post processing)" 334 <<
" (as labelIOList; for meshing)" <<
nl 338 postRefLevel.write();
359 Info<<
"Collected " << refCells.
size() <<
" cells that need to be" 360 <<
" refined to get closer to overall 2:1 refinement level limit" 362 <<
"Written cells to be refined to cellSet " << refCells.
name()
367 Info<<
"After refinement this tool can be run again to see if the 2:1" 368 <<
" limit is observed all over the mesh" <<
nl <<
endl;
372 Info<<
"All cells in the mesh observe the 2:1 refinement level limit" const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
static void addNote(const string ¬e)
Add extra notes for the usage information.
void size(const label n)
Older name for setAddressableSize.
const word & name() const noexcept
Return the object name.
A list that is sorted upon construction or when explicitly requested with the sort() method...
Cell-face mesh analysis engine.
constexpr char nl
The newline '\n' character (0x0a)
List< face > faceList
A List of faces.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
label size() const noexcept
The number of elements in table.
const cellList & cells() const
Ignore writing from objectRegistry::writeObject()
const dimensionSet dimless
Dimensionless.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
vectorField pointField
pointField is a vectorField.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
static word defaultRegion
Return the default region name.
label size() const noexcept
The number of elements in the list.
virtual const labelList & faceOwner() const
Return face owner.
void append(const T &val)
Copy append an element to the end of this list.
virtual const faceList & faces() const
Return raw faces.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
static word timeName(const scalar t, const int precision=precision_)
Return time name of given scalar time formatted with the given precision.
DynamicList< T, SizeMin > & shrink()
Shrink the allocated space to the number of elements used.
T & last()
Access last element of the list, position [size()-1].
#define WarningInFunction
Report a warning using Foam::Warning.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
label nCells() const noexcept
Number of mesh cells.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
A collection of cell labels.
Mesh data needed to do the Finite Volume discretisation.
label start() const
Return start label of this patch in the polyMesh face list.
const polyBoundaryMesh & patches
Automatically write from objectRegistry::writeObject()
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
messageStream Info
Information stream (stdout output on master, null elsewhere)
List< label > labelList
A List of labels.
A patch is a list of labels that address the faces in the global face list.
virtual bool write(const bool valid=true) const
Write using setting from DB.
Foam::argList args(argc, argv)
Defines the attributes of an object for which implicit objectRegistry management is supported...
const labelListList & cellCells() const
List< cell > cellList
A List of cells.
bool found(const word &optName) const
Return true if the named option is found.
IOList< label > labelIOList
Label container classes.
const scalarField & cellVolumes() const
static constexpr const zero Zero
Global zero (0)