62void Foam::functionObjects::cellDecomposer::makeMesh
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 "
145 const auto& zones =
mesh_.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);
215 decomposeFace.set(
mesh_.cells()[celli]);
224 orEqOp<unsigned int>()
235 if (decomposeFacePtr)
239 OBJstream
os(
mesh_.time().path()/
"orig_faces.obj");
250 Pout<<
"Written " << meshMod.faces().size()
254 tetDecompPtr_().setRefinement
264 tetDecompPtr_().setRefinement
275 OBJstream
os(
mesh_.time().path()/
"faces.obj");
276 os.write(meshMod.faces(),
pointField(meshMod.points()),
false);
277 Pout<<
"Written " << meshMod.faces().size()
282 autoPtr<fvMesh> tetMeshPtr;
284 mapPtr_ = meshMod.makeMesh
290 mesh_.facesInstance(),
301 tetDecompPtr_().updateMesh(mapPtr_());
303 Info<<
indent <<
"Writing decomposed mesh to "
304 << tetMeshPtr().objectRegistry::objectRelPath()
306 tetMeshPtr().
write();
311 tetMeshPtr.ptr()->polyMesh::store();
327 cacheDecomposition_(false)
343 dict_.readEntry(
"mapRegion", mapRegion_);
344 dict_.readEntry(
"fields", fieldNames_);
345 dict_.readIfPresent(
"cacheDecomposition", cacheDecomposition_);
346 makeMesh(dict_, mapRegion_);
359 if (mesh_.changing())
363 const auto* mapRegionPtr =
364 this->mesh_.time().findObject<
fvMesh>(mapRegion_);
366 if (cacheDecomposition_ && mapRegionPtr && tetDecompPtr_)
394 tetDecompPtr_.clear();
396 const_cast<Time&
>(this->mesh_.time()).
erase(mapRegion_);
397 makeMesh(dict_, mapRegion_);
402 ok = mapFieldType<scalar>() || ok;
403 ok = mapFieldType<vector>() || ok;
404 ok = mapFieldType<sphericalTensor>() || ok;
405 ok = mapFieldType<symmTensor>() || ok;
406 ok = mapFieldType<tensor>() || ok;
411 Log <<
" none" <<
nl;
426 ok = writeFieldType<scalar>() || ok;
427 ok = writeFieldType<vector>() || ok;
428 ok = writeFieldType<sphericalTensor>() || ok;
429 ok = writeFieldType<symmTensor>() || ok;
430 ok = writeFieldType<tensor>() || ok;
435 Log <<
" none" <<
nl;
Field reading functions for post-processing utilities.
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
@ REGISTER
Request registration (bool: true).
@ READ_IF_PRESENT
Reading is optional [identical to LAZY_READ].
@ MUST_READ
Reading required.
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
virtual const fileName & name() const override
Get the name of the output serial stream. (eg, the name of the Fstream file name).
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
static bitSet select(const polyMesh &mesh, const dictionary &dict, const bool verbosity=false)
Return a cell selection according to the dictionary specification of actions.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Abstract base-class for Time/database function objects.
const word & name() const noexcept
Return the name of this functionObject.
virtual bool read(const dictionary &dict)
Read and set the function object if its data have changed.
static int debug
Flag to execute debug content.
Maps input fields from local mesh to a secondary mesh at runtime.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
cellDecomposer(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
virtual bool execute()
Execute the function-object operations.
virtual bool write()
Write the function-object results.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const fvMesh & mesh_
Reference to the fvMesh.
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
Mesh data needed to do the Finite Volume discretisation.
static const Enum< selectionModeType > selectionModeTypeNames_
List of selection mode type names.
selectionModeType
Enumeration for selection mode types.
static bool test(const UList< face > &faces)
Test if given list of faces satisfies criteria for HEX. (6 quad).
bool erase(const iterator &iter)
Erase an entry specified by the given iterator.
Direct mesh changes based on v1.3 polyTopoChange syntax.
label nCells() const noexcept
Number of mesh cells.
static bool test(const UList< face > &faces)
Test if given list of faces satisfies criteria for PYR. (4 tri, 1 quad).
Decomposes polyMesh into tets (or pyramids).
static const Enum< decompositionType > decompositionTypeNames
static bool test(const UList< face > &faces)
Test if given list of faces satisfies criteria for TET. (4 tri).
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
const labelIOList & zoneIDs
List< label > toc(const UList< bool > &bools)
Return the (sorted) values corresponding to 'true' entries.
List< label > sortedToc(const UList< bool > &bools)
Return the (sorted) values corresponding to 'true' entries.
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere).
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & indent(Ostream &os)
Indent stream.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
constexpr char nl
The newline '\n' character (0x0a).