GenericDispls.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 #ifndef __GENERICDISPLS_HPP__
25 #define __GENERICDISPLS_HPP__
26 
27 #include "BaseManipulation.hpp"
28 
29 namespace mimmo{
30 
108 protected:
109  bool m_read;
110  std::string m_dir;
111  std::string m_filename;
112  int m_nDispl;
115  bool m_template;
117 public:
118  GenericDispls(bool readMode = true);
119  virtual ~GenericDispls();
120  GenericDispls(const bitpit::Config::Section & rootXML);
121  GenericDispls(const GenericDispls & other);
122 
123  void buildPorts();
124 
125  int getNDispl();
128  bool isTemplate();
129 
130  void setReadDir(std::string dir);
131  void setReadFilename(std::string filename);
132  void setWriteDir(std::string dir);
133  void setWriteFilename(std::string filename);
134  void setNDispl(int nD);
135  void setLabels(livector1D labels);
136  void setDispl(dvecarr3E displs);
137  void setTemplate(bool flag);
138 
139  void clear();
140  void execute();
141 
142  virtual void absorbSectionXML(const bitpit::Config::Section & slotXML, std::string name = "");
143  virtual void flushSectionXML(bitpit::Config::Section & slotXML, std::string name= "");
144 
145 protected:
146  void swap(GenericDispls &) noexcept;
147 
148 private:
149  virtual void read();
150  virtual void write();
151 
152 };
153 
154 REGISTER_PORT(M_DISPLS, MC_VECARR3, MD_FLOAT,__GENERICDISPLS_HPP__)
155 REGISTER_PORT(M_VECTORLI, MC_VECTOR, MD_LONG,__GENERICDISPLS_HPP__)
156 REGISTER_PORT(M_VALUEI, MC_SCALAR, MD_INT,__GENERICDISPLS_HPP__)
157 
158 
159 REGISTER(BaseManipulation, GenericDispls, "mimmo.GenericDispls")
160 }
161 
162 #endif /* __GENERICDISPLS_HPP__ */
void setLabels(livector1D labels)
virtual void flushSectionXML(bitpit::Config::Section &slotXML, std::string name="")
void swap(GenericDispls &) noexcept
#define M_DISPLS
#define MD_FLOAT
std::vector< darray3E > dvecarr3E
#define M_VALUEI
std::vector< long > livector1D
BaseManipulation is the base class of any manipulation object of the library.
GenericDispls(bool readMode=true)
#define MC_SCALAR
#define REGISTER_PORT(Name, Container, Datatype, ManipBlock)
#define MD_LONG
#define MC_VECTOR
void setReadFilename(std::string filename)
void setTemplate(bool flag)
void setDispl(dvecarr3E displs)
void setWriteFilename(std::string filename)
void setWriteDir(std::string dir)
GenericDispls is the class to read from file an initial set of displacements as a generic vector fiel...
#define MD_INT
void setReadDir(std::string dir)
#define MC_VECARR3
#define M_VECTORLI
virtual void absorbSectionXML(const bitpit::Config::Section &slotXML, std::string name="")
#define REGISTER(Base, Derived, name)
Definition: factory.hpp:206