35 template<
class Mesh,
template<
class>
class MeshObjectType,
class Type>
38 MeshObjectType<Mesh>(Type::typeName,
mesh.thisDb()),
43 template<
class Mesh,
template<
class>
class MeshObjectType,
class Type>
50 MeshObjectType<Mesh>(objName,
mesh.thisDb()),
57 template<
class Mesh,
template<
class>
class MeshObjectType,
class Type>
58 template<
class... Args>
66 mesh.thisDb().objectRegistry::template
67 getObjectPtr<Type>(Type::typeName);
76 Pout<<
"MeshObject::New(const " << Mesh::typeName
77 <<
"&, ...) : constructing " << Type::typeName
78 <<
" for region " <<
mesh.name() <<
endl;
81 ptr =
new Type(
mesh, std::forward<Args>(
args)...);
83 regIOobject::store(
static_cast<MeshObjectType<Mesh>*
>(ptr));
89 template<
class Mesh,
template<
class>
class MeshObjectType,
class Type>
90 template<
class... Args>
99 mesh.thisDb().objectRegistry::template
100 getObjectPtr<Type>(objName);
109 Pout<<
"MeshObject::New('" << objName
110 <<
"', const " << Mesh::typeName
111 <<
"&, ...) : constructing " << objName
112 <<
" of type " << Type::typeName
113 <<
" for region " <<
mesh.name() <<
endl;
116 ptr =
new Type(objName,
mesh, std::forward<Args>(
args)...);
118 regIOobject::store(
static_cast<MeshObjectType<Mesh>*
>(ptr));
126 template<
class Mesh,
template<
class>
class MeshObjectType,
class Type>
134 mesh.thisDb().objectRegistry::template
135 getObjectPtr<Type>(objName);
141 Pout<<
"MeshObject::Delete(const Mesh&) : deleting " 145 return mesh.thisDb().checkOut(
static_cast<MeshObjectType<Mesh>*
>(ptr));
155 HashTable<GeometricMeshObject<Mesh>*> meshObjects
157 obr.lookupClass<GeometricMeshObject<Mesh>>()
162 Pout<<
"meshObject::movePoints(objectRegistry&) :" 163 <<
" moving " << Mesh::typeName
164 <<
" meshObjects for region " << obr.
name() <<
endl;
170 auto* objectPtr =
dynamic_cast<MoveableMeshObject<Mesh>*
>(*iter);
178 objectPtr->movePoints();
195 HashTable<GeometricMeshObject<Mesh>*> meshObjects
197 obr.lookupClass<GeometricMeshObject<Mesh>>()
202 Pout<<
"meshObject::updateMesh(objectRegistry&, " 203 "const mapPolyMesh& mpm) : updating " << Mesh::typeName
204 <<
" meshObjects for region " << obr.
name() <<
endl;
210 auto* objectPtr =
dynamic_cast<UpdateableMeshObject<Mesh>*
>(*iter);
218 objectPtr->updateMesh(mpm);
232 template<
class Mesh,
template<
class>
class MeshObjectType>
235 HashTable<MeshObjectType<Mesh>*> meshObjects
237 obr.lookupClass<MeshObjectType<Mesh>>()
242 Pout<<
"meshObject::clear(objectRegistry&) :" 243 <<
" clearing " << Mesh::typeName
244 <<
" meshObjects for region " << obr.
name() <<
endl;
261 template<
class>
class FromType,
262 template<
class>
class ToType
273 Pout<<
"meshObject::clearUpto(objectRegistry&) :" 274 <<
" clearing " << Mesh::typeName
275 <<
" meshObjects for region " << obr.
name() <<
endl;
281 auto* objectPtr =
dynamic_cast<ToType<Mesh>*
>(*iter);
virtual const fileName & name() const
Get the name of the output serial stream. (eg, the name of the Fstream file name) ...
static void updateMesh(objectRegistry &obr, const mapPolyMesh &mpm)
static void clearUpto(objectRegistry &obr)
Clear all meshObject derived from FromType up to (but not including) ToType.
const word & name() const noexcept
Return the object name.
static const Type & New(const Mesh &mesh, Args &&... args)
Get existing or create a new MeshObject. Registered with typeName.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool checkOut(regIOobject *io) const
Remove a regIOobject from registry and free memory if the object is ownedByRegistry. A nullptr is ignored.
static void clear(objectRegistry &obr)
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
A class for handling words, derived from Foam::string.
#define forAllIters(container, iter)
Iterate across all elements in the container object.
A HashTable similar to std::unordered_map.
int debug
Static debugging option.
static void movePoints(objectRegistry &obr)
static bool Delete(const word &objName, const Mesh &mesh)
Static destructor using supplied registration name.
Registry of regIOobjects.
Foam::argList args(argc, argv)
MeshObject(const Mesh &mesh)
Construct with Type::typeName on Mesh.
HashTable< const Type * > lookupClass(const bool strict=false) const
Return all objects with a class satisfying isA<Type>
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.