Apply is the class that applies the deformation resulting from a manipulation object to the geometry. More...

#include <Apply.hpp>

Inheritance diagram for mimmo::Apply:
Collaboration diagram for mimmo::Apply:

Public Member Functions

 Apply ()
 
 Apply (const Apply &other)
 
 Apply (const bitpit::Config::Section &rootXML)
 
 ~Apply ()
 
virtual void absorbSectionXML (const bitpit::Config::Section &slotXML, std::string name="")
 
void buildPorts ()
 
void execute ()
 
virtual void flushSectionXML (bitpit::Config::Section &slotXML, std::string name="")
 
MimmoPiercedVector< long > * getAnnotatedCells ()
 
MimmoPiercedVector< long > * getAnnotatedVertices ()
 
dmpvecarr3EgetOutput ()
 
void setAnnotation (bool activate)
 
void setAnnotationThreshold (double threshold)
 
void setCellsAnnotationName (const std::string &label)
 
void setFilter (dmpvector1D *input)
 
void setInput (dmpvecarr3E *input)
 
void setScalarInput (dmpvector1D *input)
 
void setScaling (double alpha)
 
void setVerticesAnnotationName (const std::string &label)
 
- Public Member Functions inherited from mimmo::BaseManipulation
 BaseManipulation ()
 
 BaseManipulation (const BaseManipulation &other)
 
virtual ~BaseManipulation ()
 
void activate ()
 
bool arePortsBuilt ()
 
void clear ()
 
void disable ()
 
void exec ()
 
BaseManipulationgetChild (int i=0)
 
ConnectionType getConnectionType ()
 
MimmoSharedPointer< MimmoObjectgetGeometry ()
 
MimmoSharedPointer< MimmoObject > & getGeometryReference ()
 
int getId ()
 
bitpit::Logger & getLog ()
 
std::string getName ()
 
int getNChild ()
 
int getNParent ()
 
int getNPortsIn ()
 
int getNPortsOut ()
 
BaseManipulationgetParent (int i=0)
 
std::unordered_map< PortID, PortIn * > getPortsIn ()
 
std::unordered_map< PortID, PortOut * > getPortsOut ()
 
uint getPriority ()
 
virtual std::vector< BaseManipulation * > getSubBlocksEmbedded ()
 
bool isActive ()
 
bool isApply ()
 
bool isChild (BaseManipulation *, int &)
 
bool isParent (BaseManipulation *, int &)
 
bool isPlotInExecution ()
 
BaseManipulationoperator= (const BaseManipulation &other)
 
void removePins ()
 
void removePinsIn ()
 
void removePinsOut ()
 
void setApply (bool flag=true)
 
void setGeometry (MimmoSharedPointer< MimmoObject > geometry)
 
void setId (int)
 
void setLog (bitpit::Logger &log)
 
void setName (std::string name)
 
void setOutputPlot (std::string path)
 
void setPlotInExecution (bool)
 
void setPriority (uint priority)
 
void unsetGeometry ()
 

Protected Member Functions

void checkInput ()
 
void swap (Apply &x) noexcept
 
- Protected Member Functions inherited from mimmo::BaseManipulation
void _apply (MimmoPiercedVector< darray3E > &displacements)
 
void addChild (BaseManipulation *child)
 
void addParent (BaseManipulation *parent)
 
void addPinIn (BaseManipulation *objIn, PortID portR)
 
void addPinOut (BaseManipulation *objOut, PortID portS, PortID portR)
 
virtual void apply ()
 
void cleanBufferIn (PortID port)
 
template<typename T , typename O >
bool createPortIn (O *obj, void(O::*setVar_)(T), PortID portR, bool mandatory=false, int family=0)
 
template<typename T , typename O >
bool createPortIn (T *var_, PortID portR, bool mandatory=false, int family=0)
 
template<typename T , typename O >
bool createPortOut (O *obj, T(O::*getVar_)(), PortID portS)
 
template<typename T , typename O >
bool createPortOut (T *var_, PortID portS)
 
void deletePorts ()
 
PortID findPinIn (PortIn &pin)
 
PortID findPinOut (PortOut &pin)
 
void initializeLogger (bool logexists)
 
virtual void plotOptionalResults ()
 
void readBufferIn (PortID port)
 
void removePinIn (BaseManipulation *objIn, PortID portR)
 
void removePinIn (PortID portR, int j)
 
void removePinOut (BaseManipulation *objOut, PortID portS)
 
void removePinOut (PortID portS, int j)
 
void setBufferIn (PortID port, mimmo::IBinaryStream &input)
 
void swap (BaseManipulation &x) noexcept
 
void unsetChild (BaseManipulation *child)
 
void unsetParent (BaseManipulation *parent)
 
void write (MimmoSharedPointer< MimmoObject > geometry)
 
template<typename mpv_t >
void write (MimmoSharedPointer< MimmoObject > geometry, MimmoPiercedVector< mpv_t > &data)
 
template<typename mpv_t , typename... Args>
void write (MimmoSharedPointer< MimmoObject > geometry, MimmoPiercedVector< mpv_t > &data, Args ... args)
 
template<typename mpv_t >
void write (MimmoSharedPointer< MimmoObject > geometry, std::vector< MimmoPiercedVector< mpv_t > * > &data)
 
template<typename mpv_t , typename... Args>
void write (MimmoSharedPointer< MimmoObject > geometry, std::vector< MimmoPiercedVector< mpv_t > * > &data, Args ... args)
 
template<typename mpv_t >
void write (MimmoSharedPointer< MimmoObject > geometry, std::vector< MimmoPiercedVector< mpv_t >> &data)
 
template<typename mpv_t , typename... Args>
void write (MimmoSharedPointer< MimmoObject > geometry, std::vector< MimmoPiercedVector< mpv_t >> &data, Args ... args)
 

Protected Attributes

std::string m_annCellLabel
 
bool m_annotation
 
double m_annotationThres
 
std::string m_annVertexLabel
 
MimmoPiercedVector< long > m_cellAnnotation
 
double m_factor
 
dmpvector1D m_filter
 
dmpvecarr3E m_input
 
dmpvecarr3E m_output
 
dmpvector1D m_scalarinput
 
MimmoPiercedVector< long > m_vertexAnnotation
 
- Protected Attributes inherited from mimmo::BaseManipulation
bool m_active
 
bool m_apply
 
bool m_arePortsBuilt
 
bmumap m_child
 
int m_counter
 
bool m_execPlot
 
MimmoSharedPointer< MimmoObjectm_geometry
 
bitpit::Logger * m_log
 
std::string m_name
 
std::string m_outputPlot
 
bmumap m_parent
 
std::unordered_map< PortID, PortIn * > m_portIn
 
std::unordered_map< PortID, PortOut * > m_portOut
 
ConnectionType m_portsType
 
uint m_priority
 

Additional Inherited Members

- Public Types inherited from mimmo::BaseManipulation
typedef std::unordered_map< BaseManipulation *, int > bmumap
 
typedef pin::ConnectionType ConnectionType
 
typedef std::string PortID
 
- Static Protected Attributes inherited from mimmo::BaseManipulation
static int sm_baseManipulationCounter
 

Detailed Description

Apply is the class that applies the deformation resulting from a manipulation object to the geometry.

Apply is derived from BaseManipulation class. It uses the base member m_geometry to apply the result of the parent manipulator to the target mimmo object. The deformation displacements have to be passed to the input member of base class through a pin linking or set by the user, i.e. one has to use setInput method to set the displacements to be applied to the geometry. The displacements can be isotropically scaled by setting a scaling factor. The displacements can be passed as scalar field. In this case the scalar field is used as magnitude of a displacements field with direction along the normal of the surface on each vertex. The Apply block allows to pass a scalar filter field; the filter field is applied to the displacements field before the geometry deformation.

After the execution of an object Apply, the original geometry will be modified. The resulting deformation field is provided as output of the block.


Ports available in Apply Class :


Port Input
PortType variable/function DataType
M_GDISPLS setInput (MC_SCALAR,MD_MPVECARR3FLOAT_)
M_SCALARFIELD setScalarInput (MC_SCALAR,MD_MPVECFLOAT_)
M_FILTER setFilter (MC_SCALAR,MD_MPVECFLOAT_)
M_GEOM setGeometry (MC_SCALAR,MD_MIMMO_)
Port Output
PortType variable/function DataType
M_GEOM getGeometry (MC_SCALAR,MD_MIMMO_)
M_GDISPLS getOutput (MC_SCALAR,MD_MPVECARR3FLOAT_)
M_LONGFIELD getAnnotatedVertices (MC_SCALAR,MD_MPVECLONG_)
M_LONGFIELD2 getAnnotatedCells (MC_SCALAR,MD_MPVECLONG_)


The xml available parameters, sections and subsections are the following :

Inherited from BaseManipulation:

  • ClassName : name of the class as mimmo.Apply;
  • Priority : uint marking priority in multi-chain execution;

Proper of the class:

  • Annotation : 0/1 boolean, if 1 provide list of cell/vertices into deformation as annotation list;
  • CellsAnnotationName : (string) define label to mark annotated cells (list of cell-ids involved into deformation);
  • VerticesAnnotationName : (string) define label to mark annotated vertices (list of vertex-ids involved into deformation);
  • AnnotationThreshold : double val >0, threshold over which all mesh elements with deformation field over it are annotated;

Geometry and one of the Inputs have to be mandatorily passed through port.

Examples
genericinput_example_00005.cpp, geohandlers_example_00003.cpp, iocgns_example_00001.cpp, ioofoam_example_00001.cpp, manipulators_example_00001.cpp, manipulators_example_00002.cpp, manipulators_example_00003.cpp, manipulators_example_00004.cpp, manipulators_example_00005.cpp, manipulators_example_00006.cpp, manipulators_example_00007.cpp, manipulators_example_00008.cpp, and utils_example_00003.cpp.

Definition at line 89 of file Apply.hpp.

Constructor & Destructor Documentation

◆ Apply() [1/3]

mimmo::Apply::Apply ( )

Default constructor of Apply

Definition at line 32 of file Apply.cpp.

◆ Apply() [2/3]

mimmo::Apply::Apply ( const bitpit::Config::Section &  rootXML)

Custom constructor reading xml data

Parameters
[in]rootXMLreference to your xml tree section

Definition at line 47 of file Apply.cpp.

◆ ~Apply()

mimmo::Apply::~Apply ( )

Default destructor of Apply

Definition at line 68 of file Apply.cpp.

◆ Apply() [3/3]

mimmo::Apply::Apply ( const Apply other)

Copy constructor of Apply.

Definition at line 73 of file Apply.cpp.

Member Function Documentation

◆ absorbSectionXML()

void mimmo::Apply::absorbSectionXML ( const bitpit::Config::Section &  slotXML,
std::string  name = "" 
)
virtual

It sets infos reading from a XML bitpit::Config::section.

Parameters
[in]slotXMLbitpit::Config::Section of XML file
[in]namename associated to the slot

Reimplemented from mimmo::BaseManipulation.

Reimplemented in mimmo::ApplyFilter.

Definition at line 310 of file Apply.cpp.

◆ buildPorts()

void mimmo::Apply::buildPorts ( )
virtual

It builds the input/output ports of the object

Implements mimmo::BaseManipulation.

Reimplemented in mimmo::ApplyFilter.

Definition at line 108 of file Apply.cpp.

◆ checkInput()

void mimmo::Apply::checkInput ( )
protected

Check if the input is related to the target geometry. If not create a zero input field.

Definition at line 386 of file Apply.cpp.

◆ execute()

void mimmo::Apply::execute ( )
virtual

Execution command. It applies the deformation stored in the input of base class (casting the input for apply object to dvecarr3E) to the linked geometry. After exec() the original geometry will be permanently modified.

Implements mimmo::BaseManipulation.

Reimplemented in mimmo::ApplyFilter.

Definition at line 245 of file Apply.cpp.

◆ flushSectionXML()

void mimmo::Apply::flushSectionXML ( bitpit::Config::Section &  slotXML,
std::string  name = "" 
)
virtual

It sets infos from class members in a XML bitpit::Config::section.

Parameters
[in]slotXMLbitpit::Config::Section of XML file
[in]namename associated to the slot

Reimplemented from mimmo::BaseManipulation.

Reimplemented in mimmo::ApplyFilter.

Definition at line 369 of file Apply.cpp.

◆ getAnnotatedCells()

MimmoPiercedVector< long > * mimmo::Apply::getAnnotatedCells ( )

Return annotation structure for deformed cells. The structure is filled during class execution and if and only Annotation is active (see setAnnotation method).

Returns
cell annotation structure

Definition at line 235 of file Apply.cpp.

◆ getAnnotatedVertices()

MimmoPiercedVector< long > * mimmo::Apply::getAnnotatedVertices ( )

Return annotation structure for deformed vertices. The structure is filled during class execution and if and only Annotation is active (see setAnnotation method).

Returns
vertex annotation structure

Definition at line 226 of file Apply.cpp.

◆ getOutput()

dmpvecarr3E * mimmo::Apply::getOutput ( )

It get the displacements output.

Returns
Output displacements of the geometry vertices.

Definition at line 216 of file Apply.cpp.

◆ setAnnotation()

void mimmo::Apply::setAnnotation ( bool  activate)

If true, annotate vertices and cells involved into mesh deformation and store it into the class. Annotations are acessible through methods getAnnotatedVertices/getAnnotatedCells.

Parameters
[in]activatetrue/false to enable annotation creation.

Definition at line 169 of file Apply.cpp.

◆ setAnnotationThreshold()

void mimmo::Apply::setAnnotationThreshold ( double  threshold)

Set threshold for deformation field norm, over which a cell/vertex interested by it is eligible for annotation.

Parameters
[in]thresholdvalue (double, >0.0)

Definition at line 179 of file Apply.cpp.

◆ setCellsAnnotationName()

void mimmo::Apply::setCellsAnnotationName ( const std::string &  label)

Provide the string label to uniquely name the deformed cells annotation. Class default label is DeformedCells.

Parameters
[in]labelcells annotation name.

Definition at line 189 of file Apply.cpp.

◆ setFilter()

void mimmo::Apply::setFilter ( dmpvector1D input)

It sets the filter to be applied during the deformation of the geometry. The deformation field will be multiplied by the scalar filter field passed as input.

Parameters
[in]inputInput filter field used during the deformation.

Definition at line 148 of file Apply.cpp.

◆ setInput()

void mimmo::Apply::setInput ( dmpvecarr3E input)

It sets the displacements input.

Parameters
[in]inputInput displacements of the geometry vertices.

Definition at line 128 of file Apply.cpp.

◆ setScalarInput()

void mimmo::Apply::setScalarInput ( dmpvector1D input)

It sets the displacements given as scalar input. It makes sense only for surface geometries. The displacements will be directed as the surface normals.

Parameters
[in]inputInput displacements of the geometry vertices given as module of normal directed vectors.

Definition at line 138 of file Apply.cpp.

◆ setScaling()

void mimmo::Apply::setScaling ( double  alpha)

It sets the displacements scalar factor. The displacements will be scaled by using this factor.

Parameters
[in]alphaScale factor of displacements field.
Examples
ioofoam_example_00001.cpp.

Definition at line 158 of file Apply.cpp.

◆ setVerticesAnnotationName()

void mimmo::Apply::setVerticesAnnotationName ( const std::string &  label)

Provide the string label to uniquely name the deformed vertices annotation. Class default label is DeformedVertices.

Parameters
[in]labelvertices annotation name.

Definition at line 203 of file Apply.cpp.

◆ swap()

void mimmo::Apply::swap ( Apply x)
protectednoexcept

Swap function

Parameters
[in]xobject to be swapped

Definition at line 88 of file Apply.cpp.

Member Data Documentation

◆ m_annCellLabel

std::string mimmo::Apply::m_annCellLabel
protected

label marking cell annotation

Definition at line 131 of file Apply.hpp.

◆ m_annotation

bool mimmo::Apply::m_annotation
protected

boolean to activate annotation providing

Definition at line 130 of file Apply.hpp.

◆ m_annotationThres

double mimmo::Apply::m_annotationThres
protected

annotation threshold

Definition at line 133 of file Apply.hpp.

◆ m_annVertexLabel

std::string mimmo::Apply::m_annVertexLabel
protected

label marking cell annotation

Definition at line 132 of file Apply.hpp.

◆ m_cellAnnotation

MimmoPiercedVector<long> mimmo::Apply::m_cellAnnotation
protected

structure to store the list of cells involved into deformation

Definition at line 134 of file Apply.hpp.

◆ m_factor

double mimmo::Apply::m_factor
protected

scaling factor of deformation field.

Definition at line 127 of file Apply.hpp.

◆ m_filter

dmpvector1D mimmo::Apply::m_filter
protected

storing filter multiplying to the deformation field

Definition at line 126 of file Apply.hpp.

◆ m_input

dmpvecarr3E mimmo::Apply::m_input
protected

storing vector fields of floats

Definition at line 124 of file Apply.hpp.

◆ m_output

dmpvecarr3E mimmo::Apply::m_output
protected

storing vector fields of floats for output (input modified with filter and factor)

Definition at line 128 of file Apply.hpp.

◆ m_scalarinput

dmpvector1D mimmo::Apply::m_scalarinput
protected

storing scalar fields of floats

Definition at line 125 of file Apply.hpp.

◆ m_vertexAnnotation

MimmoPiercedVector<long> mimmo::Apply::m_vertexAnnotation
protected

structure to store the list of vertices involved into deformation

Definition at line 135 of file Apply.hpp.


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