GenericDispls is the class to read from file an initial set of displacements as a generic vector field of floats or write it to file. More...

#include <GenericDispls.hpp>

Inheritance diagram for mimmo::GenericDispls:
Collaboration diagram for mimmo::GenericDispls:

Public Member Functions

 GenericDispls (bool readMode=true)
 
 GenericDispls (const bitpit::Config::Section &rootXML)
 
 GenericDispls (const GenericDispls &other)
 
virtual ~GenericDispls ()
 
virtual void absorbSectionXML (const bitpit::Config::Section &slotXML, std::string name="")
 
void buildPorts ()
 
void clear ()
 
void execute ()
 
virtual void flushSectionXML (bitpit::Config::Section &slotXML, std::string name="")
 
dvecarr3E getDispl ()
 
livector1D getLabels ()
 
int getNDispl ()
 
bool isTemplate ()
 
void setDispl (dvecarr3E displs)
 
void setLabels (livector1D labels)
 
void setNDispl (int nD)
 
void setReadDir (std::string dir)
 
void setReadFilename (std::string filename)
 
void setTemplate (bool flag)
 
void setWriteDir (std::string dir)
 
void setWriteFilename (std::string filename)
 
- 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 swap (GenericDispls &) 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_dir
 
dvecarr3E m_displ
 
std::string m_filename
 
livector1D m_labels
 
int m_nDispl
 
bool m_read
 
bool m_template
 
- 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

GenericDispls is the class to read from file an initial set of displacements as a generic vector field of floats or write it to file.

When parallel support is enabled only master rank 0 reads/writes the file; when reading it communicates the data to the other ranks, so the displacements are shared between all the processors. The only admissible File format is an ascii list of values, organized as follow:

$DISPL l1 0.0 0.0 1.0
$DISPL l2 -1.0 0.12 0.0
...

The $DISPL keyword identify the value, l1, l2 the unique int label associated to the displacement and the following 3 vector coordinate represents the entity of the displacement. If $DISPL is missing, the value will not be read.

GenericDispls is derived from BaseManipulation class. The class working in both Read and Write mode, that is can read displacement values from file (written in the proper format) or write them on it. When in write mode the class can generate a template file for displacements, that can be filled in a second moment for different purposes. The layout of this file will be:

$DISPL l1 {xl1} {yl1} {zl1}
$DISPL l2 {xl2} {yl2} {zl2}
...

where {xxx} uniquely naming the component of displacement


Ports available in GenericDispls Class :


Port Input
PortType variable/function DataType
M_DISPLS setDispl (MC_VECARR3, MD_FLOAT)
M_VECTORLI setLabels (MC_VECTOR, MD_LONG)
M_VALUEI setNDispl (MC_SCALAR, MD_INT)
Port Output
PortType variable/function DataType
M_DISPLS getDispl (MC_VECARR3, MD_FLOAT)
M_VECTORLI getLabels (MC_VECTOR, MD_LONG)
M_VALUEI getNDispl (MC_SCALAR, MD_INT)


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

Inherited from BaseManipulation:

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

Proper of the class:

  • IOmode: 1/0 enable Read and Write mode,respectively;
  • ReadDir: path to input directory in read mode;
  • ReadFilename: name of input file with tag extension in read mode;
  • WriteDir: path to output directory in write mode;
  • WriteFilename: name of output file with tag extension in write mode;
  • NDispl: fixed number of displacements to write on file, from those available in the class ;
  • Template: 0/1 activate writing in template mode;
Examples
genericinput_example_00003.cpp.

Definition at line 107 of file GenericDispls.hpp.

Constructor & Destructor Documentation

◆ GenericDispls() [1/3]

mimmo::GenericDispls::GenericDispls ( bool  readMode = true)

Default constructor of GenericDispls.

Parameters
[in]readModeTrue if the object is in read mode, false if in Write mode.

Definition at line 34 of file GenericDispls.cpp.

◆ ~GenericDispls()

mimmo::GenericDispls::~GenericDispls ( )
virtual

Destructor

Definition at line 76 of file GenericDispls.cpp.

◆ GenericDispls() [2/3]

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

Custom constructor reading xml data

Parameters
[in]rootXMLreference to your xml tree section

Definition at line 47 of file GenericDispls.cpp.

◆ GenericDispls() [3/3]

mimmo::GenericDispls::GenericDispls ( const GenericDispls other)

Copy constructor of GenericDispls.

Definition at line 81 of file GenericDispls.cpp.

Member Function Documentation

◆ absorbSectionXML()

void mimmo::GenericDispls::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.

Definition at line 282 of file GenericDispls.cpp.

◆ buildPorts()

void mimmo::GenericDispls::buildPorts ( )
virtual

It builds the input/output ports of the object

Implements mimmo::BaseManipulation.

Definition at line 110 of file GenericDispls.cpp.

◆ clear()

void mimmo::GenericDispls::clear ( )

Clear all data stored in the class

Definition at line 255 of file GenericDispls.cpp.

◆ execute()

void mimmo::GenericDispls::execute ( )
virtual

Execution command. Read data from or Write data on linked filename

Implements mimmo::BaseManipulation.

Definition at line 268 of file GenericDispls.cpp.

◆ flushSectionXML()

void mimmo::GenericDispls::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.

Definition at line 360 of file GenericDispls.cpp.

◆ getDispl()

dvecarr3E mimmo::GenericDispls::getDispl ( )

Return the list of displacements actually stored into the class

Returns
list of displacements

Definition at line 139 of file GenericDispls.cpp.

◆ getLabels()

livector1D mimmo::GenericDispls::getLabels ( )

Return the labels attached to displacements actually stored into the class. Labels are always checked and automatically fit to displacements during the class execution

Returns
list of labels

Definition at line 149 of file GenericDispls.cpp.

◆ getNDispl()

int mimmo::GenericDispls::getNDispl ( )

Return the number of displacements actually stored into the class

Returns
number of displacements

Definition at line 130 of file GenericDispls.cpp.

◆ isTemplate()

bool mimmo::GenericDispls::isTemplate ( )

Return if template option is active. This method is only meant in class working in Write mode

Returns
template flag

Definition at line 158 of file GenericDispls.cpp.

◆ setDispl()

void mimmo::GenericDispls::setDispl ( dvecarr3E  displs)

It sets the displacements. The method is not active in Read mode.

Parameters
[in]displslist of displacements

Definition at line 234 of file GenericDispls.cpp.

◆ setLabels()

void mimmo::GenericDispls::setLabels ( livector1D  labels)

It sets the labels attached to each displacements. The method is not active in Read mode.

Parameters
[in]labelslist of label ids

Definition at line 221 of file GenericDispls.cpp.

◆ setNDispl()

void mimmo::GenericDispls::setNDispl ( int  nD)

It sets the number of displacements desired. This method does nothing if displacements or labels are available already into the class. The method is not active in Read mode.

Parameters
[in]nDnumber of displacements

Definition at line 210 of file GenericDispls.cpp.

◆ setReadDir()

void mimmo::GenericDispls::setReadDir ( std::string  dir)

It sets the name of the input directory. Active only in read mode.

Parameters
[in]dirdirectory path
Examples
genericinput_example_00003.cpp.

Definition at line 168 of file GenericDispls.cpp.

◆ setReadFilename()

void mimmo::GenericDispls::setReadFilename ( std::string  filename)

It sets the name of the input file. Active only in read mode.

Parameters
[in]filenamefilename with tag extension included.
Examples
genericinput_example_00003.cpp.

Definition at line 178 of file GenericDispls.cpp.

◆ setTemplate()

void mimmo::GenericDispls::setTemplate ( bool  flag)

Enables the template writing mode. The method is not active in Read mode.

Parameters
[in]flagtrue to enable the template writing

Definition at line 246 of file GenericDispls.cpp.

◆ setWriteDir()

void mimmo::GenericDispls::setWriteDir ( std::string  dir)

It sets the name of the output directory. Active only in write mode.

Parameters
[in]dirdirectory path

Definition at line 188 of file GenericDispls.cpp.

◆ setWriteFilename()

void mimmo::GenericDispls::setWriteFilename ( std::string  filename)

It sets the name of the output file. Active only in write mode.

Parameters
[in]filenamefilename with tag extension included.

Definition at line 198 of file GenericDispls.cpp.

◆ swap()

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

Swap method.

Parameters
[in]xobject to be swapped

Definition at line 95 of file GenericDispls.cpp.

Member Data Documentation

◆ m_dir

std::string mimmo::GenericDispls::m_dir
protected

Source/Destination directory path

Definition at line 110 of file GenericDispls.hpp.

◆ m_displ

dvecarr3E mimmo::GenericDispls::m_displ
protected

Displacement list

Definition at line 113 of file GenericDispls.hpp.

◆ m_filename

std::string mimmo::GenericDispls::m_filename
protected

Source/Destination filename with extension tag

Definition at line 111 of file GenericDispls.hpp.

◆ m_labels

livector1D mimmo::GenericDispls::m_labels
protected

Labels associated to displacement

Definition at line 114 of file GenericDispls.hpp.

◆ m_nDispl

int mimmo::GenericDispls::m_nDispl
protected

Number of displacement hold by the class

Definition at line 112 of file GenericDispls.hpp.

◆ m_read

bool mimmo::GenericDispls::m_read
protected

True if in Read mode, False if in Write mode.

Definition at line 109 of file GenericDispls.hpp.

◆ m_template

bool mimmo::GenericDispls::m_template
protected

True/False enable the writing template mode

Definition at line 115 of file GenericDispls.hpp.


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