53 namespace functionObjects
63 void Foam::functionObjects::cellDecomposer::makeMesh
65 const dictionary&
dict,
85 polyTopoChange meshMod(
mesh_);
91 autoPtr<bitSet> decomposeFacePtr;
98 switch (selectionMode)
104 decomposeCell =
true;
117 const word selectionName(
dict.get<word>(
"cellSet"));
120 <<
"- selecting cells using cellSet " 121 << selectionName <<
endl;
131 wordRes selectionNames;
134 !
dict.readIfPresent(
"cellZones", selectionNames)
135 || selectionNames.empty()
138 selectionNames.resize(1);
139 dict.readEntry(
"cellZone", selectionNames.first());
143 <<
"- selecting cells using cellZones " 154 <<
"No matching cellZones: " 166 decomposeCell.set(zones[
zoneIDs.first()]);
171 decomposeCell.set(zones.selection(
zoneIDs).sortedToc());
178 <<
"Unsupported selectionMode " 180 <<
". Valid selectionMode types are " 187 if (
dict.readIfPresent(
"decomposeType", decompTypeName))
189 if (decompTypeName ==
"polyhedral")
195 decomposeFacePtr.reset(
new bitSet(
mesh_.
nFaces()));
196 auto& decomposeFace = decomposeFacePtr();
199 bitSet oldDecomposeCell(decomposeCell);
200 decomposeCell =
false;
205 for (
const label celli : oldDecomposeCell)
212 && !prism.isA(
mesh_, celli)
215 decomposeCell.set(celli);
225 orEqOp<unsigned int>()
236 if (decomposeFacePtr)
246 decomposeFacePtr().sortedToc()
251 Pout<<
"Written " << meshMod.faces().size()
252 <<
" faces to " <<
os.name() <<
endl;
255 tetDecompPtr_().setRefinement
265 tetDecompPtr_().setRefinement
277 os.write(meshMod.faces(),
pointField(meshMod.points()),
false);
278 Pout<<
"Written " << meshMod.faces().size()
279 <<
" faces to " <<
os.name() <<
endl;
283 autoPtr<fvMesh> tetMeshPtr;
285 mapPtr_ = meshMod.makeMesh
302 tetDecompPtr_().updateMesh(mapPtr_());
304 Info<<
indent <<
"Writing decomposed mesh to " 305 << tetMeshPtr().objectRegistry::objectRelPath()
307 tetMeshPtr().
write();
312 tetMeshPtr.ptr()->polyMesh::store();
342 dict_ =
dict.optionalSubDict(typeName +
"Coeffs");
343 dict_.readEntry(
"mapRegion", mapRegion_);
344 dict_.readEntry(
"fields", fieldNames_);
345 makeMesh(dict_, mapRegion_);
358 if (mesh_.changing())
362 tetDecompPtr_.clear();
364 const_cast<Time&
>(this->mesh_.time()).
erase(mapRegion_);
365 makeMesh(dict_, mapRegion_);
370 ok = mapFieldType<scalar>() || ok;
371 ok = mapFieldType<vector>() || ok;
372 ok = mapFieldType<sphericalTensor>() || ok;
373 ok = mapFieldType<symmTensor>() || ok;
374 ok = mapFieldType<tensor>() || ok;
395 ok = writeFieldType<scalar>() || ok;
396 ok = writeFieldType<vector>() || ok;
397 ok = writeFieldType<sphericalTensor>() || ok;
398 ok = writeFieldType<symmTensor>() || ok;
399 ok = writeFieldType<tensor>() || ok;
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.
dimensionedScalar log(const dimensionedScalar &ds)
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.