Documentation for OpenFLUID 2.2.0
openfluid::fluidx::SpatialDomainDescriptor Class Reference

#include <fluidx/SpatialDomainDescriptor.hpp>

Public Types

typedef std::map< openfluid::core::UnitID_t, SpatialUnitDescriptorSpatialUnitsByID_t
 
typedef std::map< openfluid::core::UnitsClass_t, SpatialUnitsByID_tSpatialUnitsByIDByClass_t
 

Public Member Functions

 SpatialDomainDescriptor ()=default
 
 ~SpatialDomainDescriptor ()
 
SpatialUnitsByIDByClass_tspatialUnits ()
 
const SpatialUnitsByIDByClass_tspatialUnits () const
 
void checkUnitsRelations () const
 
void checkAttributesConsistency () const
 
bool isSpatialUnitExist (const openfluid::core::UnitsClass_t &ClassName, const openfluid::core::UnitID_t &ID) const
 
const SpatialUnitDescriptorspatialUnit (const openfluid::core::UnitsClass_t &ClassName, const openfluid::core::UnitID_t &ID) const
 
std::set< int > getIDsOfClass (const openfluid::core::UnitsClass_t &ClassName) const
 
bool isClassNameExists (const openfluid::core::UnitsClass_t &ClassName) const
 
std::set< std::string > getClassNames () const
 
unsigned int getUnitsCount () const
 
unsigned int getUnitsCount (const openfluid::core::UnitsClass_t &ClassName) const
 
void addUnit (const openfluid::fluidx::SpatialUnitDescriptor &UnitDesc, bool Check=true)
 
void deleteUnit (const openfluid::core::UnitsClass_t &ClassName, const openfluid::core::UnitID_t &ID)
 
const std::list< openfluid::core::UnitClassID_t > & toSpatialUnits (const openfluid::core::UnitClassID_t &Unit) const
 
const std::list< openfluid::core::UnitClassID_t > & parentSpatialUnits (const openfluid::core::UnitClassID_t &Unit) const
 
std::list< openfluid::core::UnitClassID_tgetFromSpatialUnits (const openfluid::core::UnitClassID_t &Unit) const
 
std::list< openfluid::core::UnitClassID_tgetChildSpatialUnits (const openfluid::core::UnitClassID_t &Unit) const
 
void addFromToRelation (const openfluid::core::UnitClassID_t &FromUnit, const openfluid::core::UnitClassID_t &ToUnit)
 
void removeFromToRelation (const openfluid::core::UnitClassID_t &FromUnit, const openfluid::core::UnitClassID_t &ToUnit)
 
void addParentChildRelation (const openfluid::core::UnitClassID_t &ParentUnit, const openfluid::core::UnitClassID_t &ChildUnit)
 
void removeParentChildRelation (const openfluid::core::UnitClassID_t &ParentUnit, const openfluid::core::UnitClassID_t &ChildUnit)
 
void clearRelations (const openfluid::core::UnitClassID_t &Unit)
 
std::string getAttribute (const openfluid::core::UnitsClass_t &ClassName, const openfluid::core::UnitID_t &ID, const openfluid::core::AttributeName_t &AttrName) const
 
void setAttribute (const openfluid::core::UnitsClass_t &ClassName, const openfluid::core::UnitID_t &ID, const openfluid::core::AttributeName_t &AttrName, const std::string &AttrValue)
 
std::set< std::string > getAttributesNames (const openfluid::core::UnitsClass_t &ClassName) const
 
void addAttribute (const openfluid::core::UnitsClass_t &ClassName, const std::string &AttrName, const std::string &DefaultValue, bool Check=true)
 
void deleteAttribute (const openfluid::core::UnitsClass_t &ClassName, const std::string &AttrName)
 
void renameAttribute (const openfluid::core::UnitsClass_t &ClassName, const std::string &OldAttrName, const std::string &NewAttrName)
 
void addEvent (const openfluid::fluidx::EventDescriptor &EvDesc)
 
EventID_t addEvent (const openfluid::core::UnitsClass_t &UnitsClass, const openfluid::core::UnitID_t &UnitID, const openfluid::core::Event &Event)
 
void deleteEvent (const openfluid::core::UnitsClass_t &UnitsClass, const openfluid::core::UnitID_t &UnitID, const openfluid::fluidx::EventID_t &EventID)
 
void modifyEvent (const openfluid::fluidx::EventID_t &EventID, const openfluid::core::Event &Event)
 
openfluid::fluidx::EventDescriptorevent (const openfluid::fluidx::EventID_t &ID)
 
const openfluid::fluidx::EventDescriptorevent (const openfluid::fluidx::EventID_t &ID) const
 
void clearDomain ()
 

Member Typedef Documentation

◆ SpatialUnitsByID_t

◆ SpatialUnitsByIDByClass_t

Constructor & Destructor Documentation

◆ SpatialDomainDescriptor()

openfluid::fluidx::SpatialDomainDescriptor::SpatialDomainDescriptor ( )
default

◆ ~SpatialDomainDescriptor()

openfluid::fluidx::SpatialDomainDescriptor::~SpatialDomainDescriptor ( )
inline

Member Function Documentation

◆ addAttribute()

void openfluid::fluidx::SpatialDomainDescriptor::addAttribute ( const openfluid::core::UnitsClass_t ClassName,
const std::string &  AttrName,
const std::string &  DefaultValue,
bool  Check = true 
)
Parameters
[in]ClassNamethe units class of the spatial unit
[in]AttrNamethe name of the attribute
[in]DefaultValuethe value of the attribute
[in]Checkenables internal checks when set to true (default value = true)
Exceptions
openfluid::base::FrameworkExceptionif the spatial unit does not exist, or if Check is true and the attribute already exists

◆ addEvent() [1/2]

EventID_t openfluid::fluidx::SpatialDomainDescriptor::addEvent ( const openfluid::core::UnitsClass_t UnitsClass,
const openfluid::core::UnitID_t UnitID,
const openfluid::core::Event Event 
)

Adds an event from an event definition. If the spatial unit of the event does not exist, the event is ignored

Parameters
[in]UnitsClassthe spatial units class
[in]UnitIDthe spatial unit ID
[in]Eventthe event definition
Returns
the ID assigned to the added event

◆ addEvent() [2/2]

void openfluid::fluidx::SpatialDomainDescriptor::addEvent ( const openfluid::fluidx::EventDescriptor EvDesc)

Adds an event from an event descriptor. If the spatial unit of the event does not exist, the event is ignored

Parameters
[in]EvDescthe event descriptor to add

◆ addFromToRelation()

void openfluid::fluidx::SpatialDomainDescriptor::addFromToRelation ( const openfluid::core::UnitClassID_t FromUnit,
const openfluid::core::UnitClassID_t ToUnit 
)

Adds the ToUnit to the list of "To" relations of FromUnit. It does nothing if the relation already exists.

Parameters
[in]FromUnitthe source spatial unit of the relation
[in]ToUnitthe target spatial unit of the relation
Exceptions
openfluid::base::FrameworkExceptionif FromUnit or ToUnit does not exist

◆ addParentChildRelation()

void openfluid::fluidx::SpatialDomainDescriptor::addParentChildRelation ( const openfluid::core::UnitClassID_t ParentUnit,
const openfluid::core::UnitClassID_t ChildUnit 
)

Adds the ParentUnit to the list of "Parent" relations of ChildUnit. It does nothing if the relation already exists.

Parameters
[in]ParentUnitthe source spatial unit of the relation
[in]ChildUnitthe target spatial unit of the relation
Exceptions
openfluid::base::FrameworkExceptionif ParentUnit or ChildUnit does not exist

◆ addUnit()

void openfluid::fluidx::SpatialDomainDescriptor::addUnit ( const openfluid::fluidx::SpatialUnitDescriptor UnitDesc,
bool  Check = true 
)

Adds a spatial unit to the spatial domain

Parameters
[in]UnitDescthe spatial unit descriptor to add
[in]Checkenables internal checks when set to true (default value = true)
Exceptions
openfluid::base::FrameworkExceptionif the spatial unit already exists, or if Check is true and the spatial unit has a wrong spatial relation

◆ checkAttributesConsistency()

void openfluid::fluidx::SpatialDomainDescriptor::checkAttributesConsistency ( ) const

Checks if spatial attributes are consistent.

Exceptions
openfluid::base::FrameworkExceptionif spatial attributes are not consistent

◆ checkUnitsRelations()

void openfluid::fluidx::SpatialDomainDescriptor::checkUnitsRelations ( ) const

Checks if spatial units relations (From-To, Parent-Child) are consistent.

Exceptions
openfluid::base::FrameworkExceptionif spatial units relations are not consistent

◆ clearDomain()

void openfluid::fluidx::SpatialDomainDescriptor::clearDomain ( )

Clears the spatial domain

◆ clearRelations()

void openfluid::fluidx::SpatialDomainDescriptor::clearRelations ( const openfluid::core::UnitClassID_t Unit)

Removes all relations related to the given spatial unit.

Parameters
[in]Unitunits class and ID of the spatial unit
Exceptions
openfluid::base::FrameworkExceptionif the spatial unit does not exist

◆ deleteAttribute()

void openfluid::fluidx::SpatialDomainDescriptor::deleteAttribute ( const openfluid::core::UnitsClass_t ClassName,
const std::string &  AttrName 
)

Deletes an attribute for the given units class

Parameters
[in]ClassNamethe units class of the spatial unit
[in]AttrNamethe name of the attribute
Exceptions
openfluid::base::FrameworkExceptionif the units class or attribute does not exist

◆ deleteEvent()

void openfluid::fluidx::SpatialDomainDescriptor::deleteEvent ( const openfluid::core::UnitsClass_t UnitsClass,
const openfluid::core::UnitID_t UnitID,
const openfluid::fluidx::EventID_t EventID 
)

Deletes an event

Parameters
[in]UnitsClassthe spatial units class
[in]UnitIDthe spatial unit ID
[in]EventIDthe ID of the event to delete
Exceptions
openfluid::base::FrameworkExceptionif the spatial units does not exist

◆ deleteUnit()

void openfluid::fluidx::SpatialDomainDescriptor::deleteUnit ( const openfluid::core::UnitsClass_t ClassName,
const openfluid::core::UnitID_t ID 
)

Removes a spatial unit

Parameters
[in]ClassNamethe units class of the spatial unit to remove
[in]IDthe ID of the spatial unit to remove

◆ event() [1/2]

openfluid::fluidx::EventDescriptor& openfluid::fluidx::SpatialDomainDescriptor::event ( const openfluid::fluidx::EventID_t ID)

Returns a reference to the event descriptor corresponding to the event ID

Parameters
[in]IDThe ID of the event
Exceptions
openfluid::base::FrameworkExceptionif the event ID does not exist

◆ event() [2/2]

const openfluid::fluidx::EventDescriptor& openfluid::fluidx::SpatialDomainDescriptor::event ( const openfluid::fluidx::EventID_t ID) const

Returns a const reference to the event descriptor corresponding to the event ID

Parameters
[in]IDThe ID of the event
Exceptions
openfluid::base::FrameworkExceptionif the event ID does not exist

◆ getAttribute()

std::string openfluid::fluidx::SpatialDomainDescriptor::getAttribute ( const openfluid::core::UnitsClass_t ClassName,
const openfluid::core::UnitID_t ID,
const openfluid::core::AttributeName_t AttrName 
) const

Gets the value of a spatial attribute

Parameters
[in]ClassNamethe units class of the spatial unit
[in]IDthe ID of the spatial unit
[in]AttrNamethe name of the attribute
Returns
the value of the attribute as a string
Exceptions
openfluid::base::FrameworkExceptionif the spatial unit or the attribute does not exist

◆ getAttributesNames()

std::set<std::string> openfluid::fluidx::SpatialDomainDescriptor::getAttributesNames ( const openfluid::core::UnitsClass_t ClassName) const

Returns the attributes names for a given units class

Parameters
ClassNamethe units class of the spatial unit
Returns
a set of attributes names for the given class, an empty set if the units class does not exist.

◆ getChildSpatialUnits()

std::list<openfluid::core::UnitClassID_t> openfluid::fluidx::SpatialDomainDescriptor::getChildSpatialUnits ( const openfluid::core::UnitClassID_t Unit) const

Builds a list of units class and ID linked with a "Child" relation to the given spatial unit

Parameters
[in]Unitunits class and ID of the spatial unit
Exceptions
openfluid::base::FrameworkExceptionif the spatial unit does not exists
Returns
the list of the "Child" spatial units, may be empty

◆ getClassNames()

std::set<std::string> openfluid::fluidx::SpatialDomainDescriptor::getClassNames ( ) const

Returns the names of units classes of the spatial domain

Returns
a set of units class names

◆ getFromSpatialUnits()

std::list<openfluid::core::UnitClassID_t> openfluid::fluidx::SpatialDomainDescriptor::getFromSpatialUnits ( const openfluid::core::UnitClassID_t Unit) const

Builds a list of units class and ID linked with a "From" relation to the given spatial unit

Parameters
[in]Unitunits class and ID of the spatial unit
Exceptions
openfluid::base::FrameworkExceptionif the spatial unit does not exists
Returns
the list of the "From" spatial units, may be empty

◆ getIDsOfClass()

std::set<int> openfluid::fluidx::SpatialDomainDescriptor::getIDsOfClass ( const openfluid::core::UnitsClass_t ClassName) const

Returns the spatial units IDs for a given units class

Parameters
[in]ClassNamethe name of the spatial units class
Returns
a set of IDs for the given class, an empty set if the units class does not exist.

◆ getUnitsCount() [1/2]

unsigned int openfluid::fluidx::SpatialDomainDescriptor::getUnitsCount ( ) const

Returns the count of all spatial units in the spatial domain

Returns
the count of spatial units

◆ getUnitsCount() [2/2]

unsigned int openfluid::fluidx::SpatialDomainDescriptor::getUnitsCount ( const openfluid::core::UnitsClass_t ClassName) const

Returns the count of spatial units for a given units class in the spatial domain

Returns
the count of spatial units

◆ isClassNameExists()

bool openfluid::fluidx::SpatialDomainDescriptor::isClassNameExists ( const openfluid::core::UnitsClass_t ClassName) const

Returns true if the spatial units class exists

Parameters
[in]ClassNamethe name of the units class
Returns
true if the units class exists

◆ isSpatialUnitExist()

bool openfluid::fluidx::SpatialDomainDescriptor::isSpatialUnitExist ( const openfluid::core::UnitsClass_t ClassName,
const openfluid::core::UnitID_t ID 
) const

Returns true if the spatial unit descriptor exists for the given units class and unit ID

Parameters
[in]ClassNamethe name of the units class
[in]IDthe ID of the spatial
Returns
true if the spatial unit descriptor exists

◆ modifyEvent()

void openfluid::fluidx::SpatialDomainDescriptor::modifyEvent ( const openfluid::fluidx::EventID_t EventID,
const openfluid::core::Event Event 
)

Modify an event

Parameters
[in]EventIDthe ID of the event to modify
[in]Eventthe new definition of the event

◆ parentSpatialUnits()

const std::list<openfluid::core::UnitClassID_t>& openfluid::fluidx::SpatialDomainDescriptor::parentSpatialUnits ( const openfluid::core::UnitClassID_t Unit) const

Returns a const reference to the list of units class and ID linked with a "Parent" relation to the given spatial unit

Parameters
[in]Unitunits class and ID of the spatial unit
Exceptions
openfluid::base::FrameworkExceptionif the spatial unit does not exists
Returns
a const reference to the list of the "Parent" spatial units

◆ removeFromToRelation()

void openfluid::fluidx::SpatialDomainDescriptor::removeFromToRelation ( const openfluid::core::UnitClassID_t FromUnit,
const openfluid::core::UnitClassID_t ToUnit 
)

Removes the ToUnit from the list of "To" relations of FromUnit. It does nothing if the relation does not exists.

Parameters
[in]FromUnitthe source spatial unit of the relation
[in]ToUnitthe target spatial unit of the relation
Exceptions
openfluid::base::FrameworkExceptionif FromUnit does not exist

◆ removeParentChildRelation()

void openfluid::fluidx::SpatialDomainDescriptor::removeParentChildRelation ( const openfluid::core::UnitClassID_t ParentUnit,
const openfluid::core::UnitClassID_t ChildUnit 
)

Removes the ParentUnit from the list of "Parent" relations of ChildUnit. It does nothing if the relation does not exists.

Parameters
[in]ParentUnitthe source spatial unit of the relation
[in]ChildUnitthe target spatial unit of the relation
Exceptions
openfluid::base::FrameworkExceptionif ChildUnit does not exist

◆ renameAttribute()

void openfluid::fluidx::SpatialDomainDescriptor::renameAttribute ( const openfluid::core::UnitsClass_t ClassName,
const std::string &  OldAttrName,
const std::string &  NewAttrName 
)

Renames an attribute

Parameters
[in]ClassNamethe units class of the spatial unit
[in]OldAttrNamethe old name of the attribute
[in]NewAttrNamethe new name of the attribute
Exceptions
openfluid::base::FrameworkExceptionif the units class or attribute does not exist

◆ setAttribute()

void openfluid::fluidx::SpatialDomainDescriptor::setAttribute ( const openfluid::core::UnitsClass_t ClassName,
const openfluid::core::UnitID_t ID,
const openfluid::core::AttributeName_t AttrName,
const std::string &  AttrValue 
)

Sets the value of an attribute on a spatial unit

Parameters
[in]ClassNamethe units class of the spatial unit
[in]IDthe ID of the spatial unit
[in]AttrNamethe name of the attribute
[in]AttrValuethe value of the attribute
Exceptions
openfluid::base::FrameworkExceptionif the spatial unit or the attribute does not exist

◆ spatialUnit()

const SpatialUnitDescriptor& openfluid::fluidx::SpatialDomainDescriptor::spatialUnit ( const openfluid::core::UnitsClass_t ClassName,
const openfluid::core::UnitID_t ID 
) const

Returns a const reference to the spatial unit descriptor identified by a units class and a unit ID

Parameters
[in]ClassNamethe name of the units class
[in]IDthe ID of the spatial
Returns
a const reference to the spatial unit if found
Exceptions
openfluid::base::FrameworkExceptionif spatial unit is not found

◆ spatialUnits() [1/2]

SpatialUnitsByIDByClass_t& openfluid::fluidx::SpatialDomainDescriptor::spatialUnits ( )
inline

Returns a reference to the structure of spatial units descriptors

Returns
a reference to the structure

◆ spatialUnits() [2/2]

const SpatialUnitsByIDByClass_t& openfluid::fluidx::SpatialDomainDescriptor::spatialUnits ( ) const
inline

Returns a const reference to the structure of spatial units descriptors

Returns
a constreference to the structure

◆ toSpatialUnits()

const std::list<openfluid::core::UnitClassID_t>& openfluid::fluidx::SpatialDomainDescriptor::toSpatialUnits ( const openfluid::core::UnitClassID_t Unit) const

Returns a const reference to the list of units class and ID linked with a "To" relation to the given spatial unit

Parameters
[in]Unitunits class and ID of the spatial unit
Exceptions
openfluid::base::FrameworkExceptionif the spatial unit does not exists
Returns
a const reference to the list of the "To" spatial units

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