IOCloudPoints is the class to read from file a set of cloud 3D points w/ attached a scalar field of floats and/or a vector field of floats. More...
#include <IOCloudPoints.hpp>
Public Member Functions | |
IOCloudPoints (bool readMode=true) | |
IOCloudPoints (const bitpit::Config::Section &rootXML) | |
IOCloudPoints (const IOCloudPoints &other) | |
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="") |
dmpvector1D * | getScalarField () |
dmpvecarr3E * | getVectorField () |
bool | isTemplate () |
IOCloudPoints & | operator= (IOCloudPoints other) |
void | plotOptionalResults () |
void | setGeometry (MimmoSharedPointer< MimmoObject > geometry) |
void | setReadDir (std::string dir) |
void | setReadFilename (std::string filename) |
void | setScalarField (dmpvector1D *scalarfield) |
void | setTemplate (bool flag) |
void | setVectorField (dmpvecarr3E *vectorfield) |
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 () |
BaseManipulation * | getChild (int i=0) |
ConnectionType | getConnectionType () |
MimmoSharedPointer< MimmoObject > | getGeometry () |
MimmoSharedPointer< MimmoObject > & | getGeometryReference () |
int | getId () |
bitpit::Logger & | getLog () |
std::string | getName () |
int | getNChild () |
int | getNParent () |
int | getNPortsIn () |
int | getNPortsOut () |
BaseManipulation * | getParent (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 () |
BaseManipulation & | operator= (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 (IOCloudPoints &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) |
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 |
std::string | m_filename |
livector1D | m_labels |
dvecarr3E | m_points |
bool | m_read |
dmpvector1D | m_scalarfield |
bool | m_template |
dmpvecarr3E | m_vectorfield |
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< MimmoObject > | m_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
IOCloudPoints is the class to read from file a set of cloud 3D points w/ attached a scalar field of floats and/or a vector field of floats.
The only admissible File format is an ascii list of values, organized as follow:
$POINT l1 0.0 0.0 1.0
$POINT l2 -1.0 0.12 0.0
...
where $POINT keyword identify the row relative to a single point, l1, l2,... the unique int label associated to the point and the following 3 floats represent the point coordinate. If $POINT is missing, the point will not be read. After all points declaration, to set a scalar value on a point define:
$SCALARF l1 12.0
$SCALARF l2 -4.232
...
where l1, l2, are still the unique labels of points. Similarly for vector values on points, define:
$VECTORF l1 3.0 2.1 3.3
$VECTORF l2 -4.2 0.0 0.0
...
Missing keywords or point without field defined will be considered at values {0.0} or {0.0,0.0,0.0};
IOCloudPoints is derived from BaseManipulation class. The class working in both Read and Write mode, that is can read from or write to file, provided that its format requirements are met. When in write mode the class can generate a template file for both scalar and vector fields, that can be filled in a second moment for different purposes. The layout of this file will be:
$SCALARF l1 {sl1}
$VECTORF l2 {xl2} {yl2} {zl2}
...
where {xxx} uniquely naming the component of displacement.
The point cloud is provided as a MimmoObject point cloud. The geometry can be stored internally or given by an external block by set Geometry method/port. In parallel: in read mode only master rank(0) reads the file, i.e. the partition of the Point Cloud Object on the other processors are empty; in write mode all the ranks write on the same file, by filling it in a sequential way in order to export the entire Point Cloud in the same output.
Ports available in IOCloudPoints Class :
Port Input | ||
---|---|---|
PortType | variable/function | DataType |
M_GEOM | setGeometry | (MC_SCALAR,MD_MIMMO_) |
M_SCALARFIELD | setScalarField | (MC_SCALAR,MD_MPVECFLOAT_) |
M_VECTORFIELD | setVectorField | (MC_SCALAR,MD_MPVECARR3FLOAT_) |
Port Output | ||
---|---|---|
PortType | variable/function | DataType |
M_GEOM | getGeometry | (MC_SCALAR,MD_MIMMO_) |
M_SCALARFIELD | getScalarField | (MC_SCALAR,MD_MPVECFLOAT_) |
M_VECTORFIELD | getVectorField | (MC_SCALAR,MD_MPVECARR3FLOAT_) |
The xml available parameters, sections and subsections are the following :
Inherited from BaseManipulation:
- ClassName: name of the class as
mimmo.IOCloudPoints
; - Priority: uint marking priority in multi-chain execution;
- PlotInExecution: boolean 0/1 print optional results of the class;
- OutputPlot: target directory for optional results writing.
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;
- Template: 0/1 option to activate writing file in template mode;
- Examples
- genericinput_example_00004.cpp.
Definition at line 131 of file IOCloudPoints.hpp.
Constructor & Destructor Documentation
◆ IOCloudPoints() [1/3]
mimmo::IOCloudPoints::IOCloudPoints | ( | bool | readMode = true | ) |
Default constructor of IOCloudPoints.
- Parameters
-
[in] readMode True if the object is in read mode, false if in Write mode.
Definition at line 33 of file IOCloudPoints.cpp.
◆ IOCloudPoints() [2/3]
mimmo::IOCloudPoints::IOCloudPoints | ( | const bitpit::Config::Section & | rootXML | ) |
Custom constructor reading xml data
- Parameters
-
[in] rootXML reference to your xml tree section
Definition at line 45 of file IOCloudPoints.cpp.
◆ IOCloudPoints() [3/3]
mimmo::IOCloudPoints::IOCloudPoints | ( | const IOCloudPoints & | other | ) |
Copy constructor of IOCloudPoints. Labels, points and data attached are no copied.
Definition at line 76 of file IOCloudPoints.cpp.
Member Function Documentation
◆ absorbSectionXML()
|
virtual |
It sets infos reading from a XML bitpit::Config::section.
- Parameters
-
[in] slotXML bitpit::Config::Section of XML file [in] name name associated to the slot
Reimplemented from mimmo::BaseManipulation.
Definition at line 267 of file IOCloudPoints.cpp.
◆ buildPorts()
|
virtual |
It builds the input/output ports of the object
Implements mimmo::BaseManipulation.
Definition at line 111 of file IOCloudPoints.cpp.
◆ clear()
void mimmo::IOCloudPoints::clear | ( | ) |
Clear all data stored in the class
Definition at line 240 of file IOCloudPoints.cpp.
◆ execute()
|
virtual |
Execution command. Read data from or Write data on linked filename
Implements mimmo::BaseManipulation.
Definition at line 253 of file IOCloudPoints.cpp.
◆ flushSectionXML()
|
virtual |
It sets infos from class members in a XML bitpit::Config::section.
- Parameters
-
[in] slotXML bitpit::Config::Section of XML file [in] name name associated to the slot
Reimplemented from mimmo::BaseManipulation.
Definition at line 336 of file IOCloudPoints.cpp.
◆ getScalarField()
dmpvector1D * mimmo::IOCloudPoints::getScalarField | ( | ) |
Return the scalar field stored in the class as pointer to MimmoPiercedVector object.
- Returns
- scalar field stored in the class
Definition at line 130 of file IOCloudPoints.cpp.
◆ getVectorField()
dmpvecarr3E * mimmo::IOCloudPoints::getVectorField | ( | ) |
Return the vector field stored in the class as pointer to MimmoPiercedVector object.
- Returns
- vector field stored in the class
Definition at line 139 of file IOCloudPoints.cpp.
◆ isTemplate()
bool mimmo::IOCloudPoints::isTemplate | ( | ) |
Return if template option is active. This method is only meant in class working in Write mode
- Returns
- template flag
Definition at line 148 of file IOCloudPoints.cpp.
◆ operator=()
IOCloudPoints & mimmo::IOCloudPoints::operator= | ( | IOCloudPoints | other | ) |
Assignement operator of IOCloudPoints. Labels, points and data attached are no copied.
Definition at line 85 of file IOCloudPoints.cpp.
◆ plotOptionalResults()
|
virtual |
Plot cloud point and store it in *.vtu file
Reimplemented from mimmo::BaseManipulation.
Definition at line 360 of file IOCloudPoints.cpp.
◆ setGeometry()
void mimmo::IOCloudPoints::setGeometry | ( | MimmoSharedPointer< MimmoObject > | geometry | ) |
It sets the point cloud as a linked MimmoObject.
- Parameters
-
[in] geometry Pointer to point cloud geometry.
Definition at line 187 of file IOCloudPoints.cpp.
◆ setReadDir()
void mimmo::IOCloudPoints::setReadDir | ( | std::string | dir | ) |
It sets the name of the input directory. Active only in read mode.
- Parameters
-
[in] dir directory path
- Examples
- genericinput_example_00004.cpp.
Definition at line 157 of file IOCloudPoints.cpp.
◆ setReadFilename()
void mimmo::IOCloudPoints::setReadFilename | ( | std::string | filename | ) |
It sets the name of the input file. Active only in read mode.
- Parameters
-
[in] filename filename with tag extension included.
- Examples
- genericinput_example_00004.cpp.
Definition at line 167 of file IOCloudPoints.cpp.
◆ setScalarField()
void mimmo::IOCloudPoints::setScalarField | ( | dmpvector1D * | scalarfield | ) |
It sets the scalar field associated to point. The method is not active in Read mode.
- Parameters
-
[in] scalarfield pointer to scalar field
Definition at line 209 of file IOCloudPoints.cpp.
◆ setTemplate()
void mimmo::IOCloudPoints::setTemplate | ( | bool | flag | ) |
Enables the template writing mode. The method is not active in Read mode.
- Parameters
-
[in] flag true to enable the template writing
Definition at line 231 of file IOCloudPoints.cpp.
◆ setVectorField()
void mimmo::IOCloudPoints::setVectorField | ( | dmpvecarr3E * | vectorfield | ) |
It sets the vector field associated to point. The method is not active in Read mode.
- Parameters
-
[in] vectorfield pointer to vector field
Definition at line 220 of file IOCloudPoints.cpp.
◆ setWriteDir()
void mimmo::IOCloudPoints::setWriteDir | ( | std::string | dir | ) |
It sets the name of the output directory. Active only in write mode.
- Parameters
-
[in] dir directory path
Definition at line 177 of file IOCloudPoints.cpp.
◆ setWriteFilename()
void mimmo::IOCloudPoints::setWriteFilename | ( | std::string | filename | ) |
It sets the name of the output file. Active only in write mode.
- Parameters
-
[in] filename filename with tag extension included.
Definition at line 198 of file IOCloudPoints.cpp.
◆ swap()
|
protectednoexcept |
Member Data Documentation
◆ m_dir
|
protected |
Directory path for I/O
Definition at line 135 of file IOCloudPoints.hpp.
◆ m_filename
|
protected |
I/O filename with extension tag
Definition at line 136 of file IOCloudPoints.hpp.
◆ m_labels
|
protected |
Labels associated to displacement, for internal use.
Definition at line 142 of file IOCloudPoints.hpp.
◆ m_points
|
protected |
Cloud points list, for internal use.
Definition at line 143 of file IOCloudPoints.hpp.
◆ m_read
|
protected |
True if in Read mode, False if in Write mode.
Definition at line 134 of file IOCloudPoints.hpp.
◆ m_scalarfield
|
protected |
MimmoPiercedVector scalar field
Definition at line 139 of file IOCloudPoints.hpp.
◆ m_template
|
protected |
True/False enable the writing template mode
Definition at line 137 of file IOCloudPoints.hpp.
◆ m_vectorfield
|
protected |
MimmoPiercedVector vector field
Definition at line 140 of file IOCloudPoints.hpp.
The documentation for this class was generated from the following files:
- src/iogeneric/IOCloudPoints.hpp
- src/iogeneric/IOCloudPoints.cpp