NeoFOAM
WIP Prototype of a modern OpenFOAM core
|
A class representing a collection of field documents in a database. More...
#include <fieldCollection.hpp>
Public Member Functions | |
FieldCollection (NeoFOAM::Database &db, std::string name) | |
Constructs a FieldCollection with the given database and name. | |
FieldCollection (const FieldCollection &)=delete | |
A FieldCollection is not copyable, but moveable. | |
FieldCollection & | operator= (const FieldCollection &)=delete |
A FieldCollection is not copyable, but moveable. | |
FieldCollection (FieldCollection &&)=default | |
A FieldCollection is move constructable, but not copyable. | |
FieldCollection & | operator= (FieldCollection &&)=delete |
A FieldCollection is not move-assign-able, but move-construct-able. | |
bool | contains (const std::string &id) const |
Checks if the collection contains a field with the given ID. | |
std::string | insert (const FieldDocument &fd) |
Inserts a field document into the collection. | |
FieldDocument & | fieldDoc (const std::string &id) |
Retrieves a field document by its ID. | |
const FieldDocument & | fieldDoc (const std::string &id) const |
Retrieves a field document by its ID (const version). | |
template<class FieldType > | |
FieldType & | registerField (CreateFunction createFunc) |
Registers a field in the collection. | |
![]() | |
CollectionMixin (NeoFOAM::Database &db, std::string name) | |
Constructs a CollectionMixin with the given database and collection name. | |
CollectionMixin (const CollectionMixin &)=delete | |
CollectionMixin (CollectionMixin &&)=default | |
CollectionMixin & | operator= (const CollectionMixin &)=delete |
CollectionMixin & | operator= (CollectionMixin &&)=delete |
Document & | doc (const std::string &id) |
Retrieves a document by its ID. | |
const Document & | doc (const std::string &id) const |
Retrieves a document by its ID (const version). | |
std::vector< std::string > | find (const std::function< bool(const Document &)> &predicate) const |
Finds documents that match a given predicate. | |
std::size_t | size () const |
Gets the number of documents in the collection. | |
const NeoFOAM::Database & | db () const |
Gets a const reference to the database. | |
NeoFOAM::Database & | db () |
Gets a reference to the database. | |
const std::string & | name () const |
Gets the name of the collection. | |
std::string | type () const |
Gets the type name of the documents in the collection. | |
std::vector< std::string > | sortedKeys () const |
Gets the sorted keys of the documents in the collection. | |
Static Public Member Functions | |
static FieldCollection & | instance (NeoFOAM::Database &db, std::string name) |
Retrieves the instance of the FieldCollection with the given name. | |
static const FieldCollection & | instance (const NeoFOAM::Database &db, std::string name) |
Retrieves the instance of the FieldCollection with the given name (const version). | |
template<class FieldType > | |
static FieldCollection & | instance (FieldType &field) |
Retrieves the instance of the FieldCollection from a const registered FieldType. | |
template<class FieldType > | |
static const FieldCollection & | instance (const FieldType &field) |
Retrieves the instance of the FieldCollection from a const registered FieldType. | |
Additional Inherited Members | |
![]() | |
std::unordered_map< std::string, FieldDocument > | docs_ |
The map of document IDs to documents. | |
NeoFOAM::Database & | db_ |
The reference to the database. | |
std::string | name_ |
The name of the collection. | |
A class representing a collection of field documents in a database.
The FieldCollection class represents a collection of field documents in a database and provides additional functionality for accessing field-specific data.
Definition at line 205 of file fieldCollection.hpp.
NeoFOAM::finiteVolume::cellCentred::FieldCollection::FieldCollection | ( | NeoFOAM::Database & | db, |
std::string | name | ||
) |
Constructs a FieldCollection with the given database and name.
db | The database to create the collection in. |
name | The name of the collection. |
|
delete |
A FieldCollection is not copyable, but moveable.
|
default |
A FieldCollection is move constructable, but not copyable.
bool NeoFOAM::finiteVolume::cellCentred::FieldCollection::contains | ( | const std::string & | id | ) | const |
Checks if the collection contains a field with the given ID.
id | The ID of the field to check for. |
FieldDocument & NeoFOAM::finiteVolume::cellCentred::FieldCollection::fieldDoc | ( | const std::string & | id | ) |
Retrieves a field document by its ID.
id | The ID of the field document to retrieve. |
const FieldDocument & NeoFOAM::finiteVolume::cellCentred::FieldCollection::fieldDoc | ( | const std::string & | id | ) | const |
Retrieves a field document by its ID (const version).
id | The ID of the field document to retrieve. |
std::string NeoFOAM::finiteVolume::cellCentred::FieldCollection::insert | ( | const FieldDocument & | fd | ) |
Inserts a field document into the collection.
fd | The field document to insert. |
|
inlinestatic |
Retrieves the instance of the FieldCollection from a const registered FieldType.
field | A registered FieldType |
Definition at line 314 of file fieldCollection.hpp.
|
static |
Retrieves the instance of the FieldCollection with the given name (const version).
creates the FieldCollection if it does not exist.
db | The database to retrieve the FieldCollection from. |
name | The name of the FieldCollection. |
|
inlinestatic |
Retrieves the instance of the FieldCollection from a const registered FieldType.
field | A registered FieldType |
Definition at line 299 of file fieldCollection.hpp.
|
static |
Retrieves the instance of the FieldCollection with the given name.
creates the FieldCollection if it does not exist.
db | The database to retrieve the FieldCollection from. |
name | The name of the FieldCollection. |
|
delete |
A FieldCollection is not copyable, but moveable.
|
delete |
A FieldCollection is not move-assign-able, but move-construct-able.
|
inline |
Registers a field in the collection.
FieldType | The type of the field to register. |
createFunc | The function to create the field document. |
Definition at line 333 of file fieldCollection.hpp.