IOCloudPoints.hpp
1 /*---------------------------------------------------------------------------*\
2  *
3  * mimmo
4  *
5  * Copyright (C) 2015-2021 OPTIMAD engineering Srl
6  *
7  * -------------------------------------------------------------------------
8  * License
9  * This file is part of mimmo.
10  *
11  * mimmo is free software: you can redistribute it and/or modify it
12  * under the terms of the GNU Lesser General Public License v3 (LGPL)
13  * as published by the Free Software Foundation.
14  *
15  * mimmo is distributed in the hope that it will be useful, but WITHOUT
16  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18  * License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with mimmo. If not, see <http://www.gnu.org/licenses/>.
22  *
23 \*---------------------------------------------------------------------------*/
24 
25 #ifndef __IOCLOUDPOINTS_HPP__
26 #define __IOCLOUDPOINTS_HPP__
27 
28 #include "BaseManipulation.hpp"
29 
30 namespace mimmo{
31 
132 protected:
133  //members
134  bool m_read;
135  std::string m_dir;
136  std::string m_filename;
137  bool m_template;
145 public:
146  IOCloudPoints(bool readMode = true);
147  virtual ~IOCloudPoints();
148  IOCloudPoints(const bitpit::Config::Section & rootXML);
149  IOCloudPoints(const IOCloudPoints & other);
151 
152  void buildPorts();
153 
154  bool isTemplate();
155 
158 
159  void setReadDir(std::string dir);
160  void setReadFilename(std::string filename);
161  void setWriteDir(std::string dir);
162  void setWriteFilename(std::string filename);
163  void setTemplate(bool flag);
164 
166  void setScalarField(dmpvector1D* scalarfield);
167  void setVectorField(dmpvecarr3E* vectorfield);
168 
169  void clear();
170 
171  void execute();
172 
173  virtual void absorbSectionXML(const bitpit::Config::Section & slotXML, std::string name = "");
174  virtual void flushSectionXML(bitpit::Config::Section & slotXML, std::string name= "");
175  void plotOptionalResults();
176 
177 protected:
178  void swap(IOCloudPoints & x) noexcept;
179 
180 private:
181  virtual void read();
182  virtual void write();
183 };
184 
185 REGISTER_PORT(M_SCALARFIELD, MC_SCALAR, MD_MPVECFLOAT_,__IOCLOUDPOINTS_HPP__)
187 REGISTER_PORT(M_GEOM, MC_SCALAR, MD_MIMMO_ ,__IOCLOUDPOINTS_HPP__)
188 
189 REGISTER(BaseManipulation, IOCloudPoints, "mimmo.IOCloudPoints")
190 }
191 
192 #endif /* __IOCLOUDPOINTS_HPP__ */
virtual void absorbSectionXML(const bitpit::Config::Section &slotXML, std::string name="")
void setReadFilename(std::string filename)
void setReadDir(std::string dir)
void setTemplate(bool flag)
#define M_GEOM
dmpvector1D * getScalarField()
void setGeometry(MimmoSharedPointer< MimmoObject > geometry)
std::vector< darray3E > dvecarr3E
std::vector< long > livector1D
dmpvecarr3E * getVectorField()
IOCloudPoints & operator=(IOCloudPoints other)
BaseManipulation is the base class of any manipulation object of the library.
void setVectorField(dmpvecarr3E *vectorfield)
#define M_VECTORFIELD
#define MC_SCALAR
#define MD_MPVECARR3FLOAT_
#define REGISTER_PORT(Name, Container, Datatype, ManipBlock)
void setWriteFilename(std::string filename)
void setScalarField(dmpvector1D *scalarfield)
#define MD_MIMMO_
#define MD_MPVECFLOAT_
#define M_SCALARFIELD
virtual void flushSectionXML(bitpit::Config::Section &slotXML, std::string name="")
IOCloudPoints is the class to read from file a set of cloud 3D points w/ attached a scalar field of f...
MimmoSharedPointer is a custom implementation of shared pointer.
void setWriteDir(std::string dir)
void swap(IOCloudPoints &x) noexcept
IOCloudPoints(bool readMode=true)
#define REGISTER(Base, Derived, name)
Definition: factory.hpp:206