NeoFOAM
WIP Prototype of a modern OpenFOAM core
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
NeoFOAM::finiteVolume::cellCentred::FieldCollection Class Reference

A class representing a collection of field documents in a database. More...

#include <fieldCollection.hpp>

Inheritance diagram for NeoFOAM::finiteVolume::cellCentred::FieldCollection:
NeoFOAM::CollectionMixin< FieldDocument >

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.
 
FieldCollectionoperator= (const FieldCollection &)=delete
 A FieldCollection is not copyable, but moveable.
 
 FieldCollection (FieldCollection &&)=default
 A FieldCollection is move constructable, but not copyable.
 
FieldCollectionoperator= (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.
 
FieldDocumentfieldDoc (const std::string &id)
 Retrieves a field document by its ID.
 
const FieldDocumentfieldDoc (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.
 
- Public Member Functions inherited from NeoFOAM::CollectionMixin< FieldDocument >
 CollectionMixin (NeoFOAM::Database &db, std::string name)
 Constructs a CollectionMixin with the given database and collection name.
 
 CollectionMixin (const CollectionMixin &)=delete
 
 CollectionMixin (CollectionMixin &&)=default
 
CollectionMixinoperator= (const CollectionMixin &)=delete
 
CollectionMixinoperator= (CollectionMixin &&)=delete
 
Documentdoc (const std::string &id)
 Retrieves a document by its ID.
 
const Documentdoc (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::Databasedb () const
 Gets a const reference to the database.
 
NeoFOAM::Databasedb ()
 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 FieldCollectioninstance (NeoFOAM::Database &db, std::string name)
 Retrieves the instance of the FieldCollection with the given name.
 
static const FieldCollectioninstance (const NeoFOAM::Database &db, std::string name)
 Retrieves the instance of the FieldCollection with the given name (const version).
 
template<class FieldType >
static FieldCollectioninstance (FieldType &field)
 Retrieves the instance of the FieldCollection from a const registered FieldType.
 
template<class FieldType >
static const FieldCollectioninstance (const FieldType &field)
 Retrieves the instance of the FieldCollection from a const registered FieldType.
 

Additional Inherited Members

- Protected Attributes inherited from NeoFOAM::CollectionMixin< FieldDocument >
std::unordered_map< std::string, FieldDocument > docs_
 The map of document IDs to documents.
 
NeoFOAM::Databasedb_
 The reference to the database.
 
std::string name_
 The name of the collection.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ FieldCollection() [1/3]

NeoFOAM::finiteVolume::cellCentred::FieldCollection::FieldCollection ( NeoFOAM::Database db,
std::string  name 
)

Constructs a FieldCollection with the given database and name.

Parameters
dbThe database to create the collection in.
nameThe name of the collection.

◆ FieldCollection() [2/3]

NeoFOAM::finiteVolume::cellCentred::FieldCollection::FieldCollection ( const FieldCollection )
delete

A FieldCollection is not copyable, but moveable.

◆ FieldCollection() [3/3]

NeoFOAM::finiteVolume::cellCentred::FieldCollection::FieldCollection ( FieldCollection &&  )
default

A FieldCollection is move constructable, but not copyable.

Member Function Documentation

◆ contains()

bool NeoFOAM::finiteVolume::cellCentred::FieldCollection::contains ( const std::string &  id) const

Checks if the collection contains a field with the given ID.

Parameters
idThe ID of the field to check for.
Returns
true if the collection contains the field, false otherwise.

◆ fieldDoc() [1/2]

FieldDocument & NeoFOAM::finiteVolume::cellCentred::FieldCollection::fieldDoc ( const std::string &  id)

Retrieves a field document by its ID.

Parameters
idThe ID of the field document to retrieve.
Returns
FieldDocument& A reference to the field document.

◆ fieldDoc() [2/2]

const FieldDocument & NeoFOAM::finiteVolume::cellCentred::FieldCollection::fieldDoc ( const std::string &  id) const

Retrieves a field document by its ID (const version).

Parameters
idThe ID of the field document to retrieve.
Returns
const FieldDocument& A const reference to the field document.

◆ insert()

std::string NeoFOAM::finiteVolume::cellCentred::FieldCollection::insert ( const FieldDocument fd)

Inserts a field document into the collection.

Parameters
fdThe field document to insert.
Returns
A string representing the unique identifier of the inserted field.

◆ instance() [1/4]

template<class FieldType >
static const FieldCollection & NeoFOAM::finiteVolume::cellCentred::FieldCollection::instance ( const FieldType &  field)
inlinestatic

Retrieves the instance of the FieldCollection from a const registered FieldType.

Parameters
fieldA registered FieldType
Returns
FieldCollection& A reference to the FieldCollection.

Definition at line 314 of file fieldCollection.hpp.

◆ instance() [2/4]

static const FieldCollection & NeoFOAM::finiteVolume::cellCentred::FieldCollection::instance ( const NeoFOAM::Database db,
std::string  name 
)
static

Retrieves the instance of the FieldCollection with the given name (const version).

creates the FieldCollection if it does not exist.

Parameters
dbThe database to retrieve the FieldCollection from.
nameThe name of the FieldCollection.
Returns
const FieldCollection& A const reference to the FieldCollection.

◆ instance() [3/4]

template<class FieldType >
static FieldCollection & NeoFOAM::finiteVolume::cellCentred::FieldCollection::instance ( FieldType &  field)
inlinestatic

Retrieves the instance of the FieldCollection from a const registered FieldType.

Parameters
fieldA registered FieldType
Returns
FieldCollection& A reference to the FieldCollection.

Definition at line 299 of file fieldCollection.hpp.

◆ instance() [4/4]

static FieldCollection & NeoFOAM::finiteVolume::cellCentred::FieldCollection::instance ( NeoFOAM::Database db,
std::string  name 
)
static

Retrieves the instance of the FieldCollection with the given name.

creates the FieldCollection if it does not exist.

Parameters
dbThe database to retrieve the FieldCollection from.
nameThe name of the FieldCollection.
Returns
FieldCollection& A reference to the FieldCollection.

◆ operator=() [1/2]

FieldCollection & NeoFOAM::finiteVolume::cellCentred::FieldCollection::operator= ( const FieldCollection )
delete

A FieldCollection is not copyable, but moveable.

◆ operator=() [2/2]

FieldCollection & NeoFOAM::finiteVolume::cellCentred::FieldCollection::operator= ( FieldCollection &&  )
delete

A FieldCollection is not move-assign-able, but move-construct-able.

◆ registerField()

template<class FieldType >
FieldType & NeoFOAM::finiteVolume::cellCentred::FieldCollection::registerField ( CreateFunction  createFunc)
inline

Registers a field in the collection.

Template Parameters
FieldTypeThe type of the field to register.
Parameters
createFuncThe function to create the field document.
Returns
A reference to the registered field.

Definition at line 333 of file fieldCollection.hpp.


The documentation for this class was generated from the following file: