52 namespace functionObjects
62 void Foam::functionObjects::cellDecomposer::makeMesh
64 const dictionary&
dict,
84 polyTopoChange meshMod(
mesh_);
90 autoPtr<bitSet> decomposeFacePtr;
97 switch (selectionMode)
103 decomposeCell =
true;
116 const word selectionName(
dict.get<word>(
"cellSet"));
119 <<
"- selecting cells using cellSet " 120 << selectionName <<
endl;
130 wordRes selectionNames;
133 !
dict.readIfPresent(
"cellZones", selectionNames)
134 || selectionNames.empty()
137 selectionNames.resize(1);
138 dict.readEntry(
"cellZone", selectionNames.first());
142 <<
"- selecting cells using cellZones " 153 <<
"No matching cellZones: " 165 decomposeCell.set(zones[
zoneIDs.first()]);
170 decomposeCell.set(zones.selection(
zoneIDs).sortedToc());
177 <<
"Unsupported selectionMode " 179 <<
". Valid selectionMode types are " 186 if (
dict.readIfPresent(
"decomposeType", decompTypeName))
188 if (decompTypeName ==
"polyhedral")
194 decomposeFacePtr.reset(
new bitSet(
mesh_.
nFaces()));
195 auto& decomposeFace = decomposeFacePtr();
198 bitSet oldDecomposeCell(decomposeCell);
199 decomposeCell =
false;
204 for (
const label celli : oldDecomposeCell)
211 && !prism.isA(
mesh_, celli)
214 decomposeCell.set(celli);
224 orEqOp<unsigned int>()
235 if (decomposeFacePtr)
245 decomposeFacePtr().sortedToc()
250 Pout<<
"Written " << meshMod.faces().size()
251 <<
" faces to " <<
os.name() <<
endl;
254 tetDecompPtr_().setRefinement
264 tetDecompPtr_().setRefinement
276 os.write(meshMod.faces(),
pointField(meshMod.points()),
false);
277 Pout<<
"Written " << meshMod.faces().size()
278 <<
" faces to " <<
os.name() <<
endl;
282 autoPtr<fvMesh> tetMeshPtr;
284 mapPtr_ = meshMod.makeMesh
301 tetDecompPtr_().updateMesh(mapPtr_());
303 Info<<
indent <<
"Writing decomposed mesh to " 304 << tetMeshPtr().objectRegistry::objectRelPath()
306 tetMeshPtr().
write();
311 tetMeshPtr.ptr()->polyMesh::store();
341 dict_ =
dict.optionalSubDict(typeName +
"Coeffs");
342 dict_.readEntry(
"mapRegion", mapRegion_);
343 dict_.readEntry(
"fields", fieldNames_);
344 makeMesh(dict_, mapRegion_);
357 if (mesh_.changing())
361 tetDecompPtr_.clear();
363 const_cast<Time&
>(this->mesh_.time()).
erase(mapRegion_);
364 makeMesh(dict_, mapRegion_);
369 ok = mapFieldType<scalar>() || ok;
370 ok = mapFieldType<vector>() || ok;
371 ok = mapFieldType<sphericalTensor>() || ok;
372 ok = mapFieldType<symmTensor>() || ok;
373 ok = mapFieldType<tensor>() || ok;
378 Log <<
" none" <<
nl;
393 ok = writeFieldType<scalar>() || ok;
394 ok = writeFieldType<vector>() || ok;
395 ok = writeFieldType<sphericalTensor>() || ok;
396 ok = writeFieldType<symmTensor>() || ok;
397 ok = writeFieldType<tensor>() || ok;
402 Log <<
" none" <<
nl;
virtual bool write()
Write.
defineTypeNameAndDebug(ObukhovLength, 0)
const labelIOList & zoneIDs
fileName path() const
Return path = rootPath/caseName. Same as TimePaths::path()
Ostream & indent(Ostream &os)
Indent stream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const fileName & facesInstance() const
Return the current instance directory for faces.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
const cellList & cells() const
Field reading functions for post-processing utilities.
static bool test(const UList< face > &faces)
Test if given list of faces satisfies criteria for HEX. (6 quad)
const Time & time() const
Return the top-level database.
label nFaces() const noexcept
Number of mesh faces.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static const Enum< selectionModeType > selectionModeTypeNames_
List of selection mode type names.
Decomposes polyMesh into tets (or pyramids)
Macros for easy insertion into run-time selection tables.
const word & name() const noexcept
Return the name of this functionObject.
static const Enum< decompositionType > decompositionTypeNames
virtual const pointField & points() const
Return raw points.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
vectorField pointField
pointField is a vectorField.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
cellDecomposer(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
A class for handling words, derived from Foam::string.
Reading is optional [identical to LAZY_READ].
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
virtual const faceList & faces() const
Return raw faces.
virtual bool execute()
Execute.
static bitSet select(const polyMesh &mesh, const dictionary &dict, const bool verbosity=false)
Return a cell selection according to the dictionary specification of actions.
OBJstream os(runTime.globalPath()/outputName)
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
selectionModeType
Enumeration for selection mode types.
virtual bool read(const dictionary &dict)
Read the cellDecomposer data.
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
label nCells() const noexcept
Number of mesh cells.
Automatically write from objectRegistry::writeObject()
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual bool read(const dictionary &dict)
Read optional controls.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
List< label > labelList
A List of labels.
static bool test(const UList< face > &faces)
Test if given list of faces satisfies criteria for PYR. (4 tri, 1 quad)
static bool test(const UList< face > &faces)
Test if given list of faces satisfies criteria for TET. (4 tri)
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Request registration (bool: true)
List< label > toc(const UList< bool > &bools)
Return the (sorted) values corresponding to 'true' entries.
const fvMesh & mesh_
Reference to the fvMesh.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
static int debug
Flag to execute debug content.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.