Workspace 6.21.5
Public Member Functions | List of all members
ElementMapper Class Referenceabstract

Base class defining an interface for mapping a model's elements to values.

#include <Mesh/DataStructures/elementmapper.h>

Inheritance diagram for ElementMapper:
[legend]

Public Member Functions

bool canSerialize () const override
 
ElementMapperclone () const override=0
 
virtual Application::Memento::DatacreateMementoData (const MeshModelInterface &model, const ElementType::List &supportedElementTypes={&ElementType::Tri::getInstance(), &ElementType::Quad::getInstance(), &ElementType::Tetrahedron::getInstance(), &ElementType::Hexahedron::getInstance()}) const =0
 
virtual double getValue (const ElementType::Type &elementType, const ElementHandle &element, Application::Memento::Data &mementoData) const =0
 
virtual bool getValueDataObject (const ElementType::Type &, const ElementHandle &, Application::Memento::Data &, DataExecution::DataObject *) const
 
bool load (const DataExecution::SerializedItem &item) override
 
void logText (const QString &msg) const
 
bool save (DataExecution::SerializedItem &item) const override
 
- Public Member Functions inherited from Clonable
virtual ~Clonable ()=default
 
virtual Clonableclone () const =0
 
- Public Member Functions inherited from Serialize
virtual ~Serialize ()=default
 
virtual bool canSerialize () const =0
 
virtual bool load (const SerializedItem &item)=0
 
virtual bool save (SerializedItem &item) const =0
 

Member Function Documentation

◆ canSerialize()

bool canSerialize ( ) const
overridevirtual
Returns
True if this object can be serialized.

For objects that can be serialized, the save and load functions will be used to do the serialization. If this function returns false, both load() and save() must also return false.

Implements Serialize.

Reimplemented in ElementStateMapper.

◆ clone()

ElementMapper * clone ( ) const
overridepure virtual
Returns
A clone of this object.
Note
Subclasses would normally return their own type rather than the Clonable type. The C++ language rules allow a more derived type to be returned from a virtual function and the compiler will still treat it as a valid override.

Implements Clonable.

Implemented in ElementScriptMapper, and ElementStateMapper.

◆ createMementoData()

virtual Application::Memento::Data * createMementoData ( const MeshModelInterface model,
const ElementType::List supportedElementTypes = {&ElementType::Tri::getInstance(), &ElementType::Quad::getInstance(), &ElementType::Tetrahedron::getInstance(), &ElementType::Hexahedron::getInstance()} 
) const
pure virtual

◆ getValue()

virtual double getValue ( const ElementType::Type elementType,
const ElementHandle element,
Application::Memento::Data mementoData 
) const
pure virtual

◆ getValueDataObject()

virtual bool getValueDataObject ( const ElementType::Type ,
const ElementHandle ,
Application::Memento::Data ,
DataExecution::DataObject  
) const
inlinevirtual

Reimplemented in ElementStateMapper.

◆ load()

bool load ( const DataExecution::SerializedItem item)
overridevirtual
Parameters
itemSupplies the state to be loaded into this object.

This function will load the state of this object from item. For many object types, this is most easily implemented in terms of the object's input operator (>>).

It would be reasonable for subclass implementations to assume that the data provided in item is in the same form as would have been saved from a call to save.

Returns
If the state of the object could not be loaded, the function returns false. A return value of true implies that the object state was successfully loaded. If canSerialize() returns false, this function must do nothing except return false as well.

Implements Serialize.

Reimplemented in ElementStateMapper.

◆ logText()

void logText ( const QString &  msg) const
Parameters
msgThe message to log.

This function forwards the msg to the main application log stream.

◆ save()

bool save ( DataExecution::SerializedItem item) const
overridevirtual
Parameters
itemWhere to save the state of this object.

This function will serialise the object by saving it to item. For most object types, this is most easily implemented in terms of the object's output operator (<<).

It is allowable for an object to only serialize part of itself. This would be useful if the data it represents has a set of defaults and only those values different to the defaults need to be serialized. Such an implementation then needs to be careful how it handles the complimentary load member function.

Returns
If an object could not be serialised or if the underlying object type does not support serialisation, this function should return false. A return value of true implies that the object was successfully saved to item. If canSerialize() returns false, this function must do nothing except return false as well.

Implements Serialize.

Reimplemented in ElementStateMapper.