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" static void addNote(const string ¬e)
Add extra notes for the usage information.
void size(const label n)
Older name for setAddressableSize.
List< cell > cellList
List of cell.
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)
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.
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.
List< face > faceList
List of faces.
label size() const noexcept
The number of elements in table.
vectorField pointField
pointField is a vectorField.
IOList< label > labelIOList
IO for a List of label.
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...
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
static word defaultRegion
Return the default region name.
label size() const noexcept
The number of entries in the list.
virtual const labelList & faceOwner() const
Return face owner.
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
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.
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.
Foam::argList args(argc, argv)
Defines the attributes of an object for which implicit objectRegistry management is supported...
const labelListList & cellCells() const
bool found(const word &optName) const
Return true if the named option is found.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
const scalarField & cellVolumes() const
static constexpr const zero Zero
Global zero (0)