ReconstructFields.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 __RECONSTRUCTSCALAR_HPP__
26 #define __RECONSTRUCTSCALAR_HPP__
27 
28 #include "BaseManipulation.hpp"
29 
30 namespace mimmo{
31 
36 enum class OverlapMethod{
37  MAX = 1,
38  MIN = 2,
39  AVERAGE = 3,
40  SUM = 4
41 };
42 
92 
93 private:
94  MPVLocation m_loc;
95  OverlapMethod m_overlapCriterium;
96  std::vector<dmpvector1D> m_subpatch;
97  std::vector<dmpvector1D> m_subresults;
98  dmpvector1D m_result;
100 public:
102  ReconstructScalar(const bitpit::Config::Section & rootXML);
103  virtual ~ReconstructScalar();
104  ReconstructScalar(const ReconstructScalar & other);
105 
106  //get-set methods
108  int getOverlapCriterium();
109  int getNData();
111  std::vector<dmpvector1D*> getResultFields();
112 
114  void setOverlapCriterium( int);
115  void addData( dmpvector1D * );
117  void removeAllData();
118  void buildPorts();
119  //cleaners
120  void clear();
121 
122  //plotting
123 
124  void plotData();
125  void plotSubData(int i);
126 
127  //execute
128  void execute();
129 
130  //XML utilities from reading writing settings to file
131  virtual void absorbSectionXML(const bitpit::Config::Section & slotXML, std::string name="");
132  virtual void flushSectionXML(bitpit::Config::Section & slotXML, std::string name="");
133 protected:
134  virtual void plotOptionalResults();
135  void swap(ReconstructScalar &) noexcept;
136 
137 private:
138  void overlapFields(long int ID, double & locField);
140 };
141 
189 
190 private:
191  MPVLocation m_loc;
192  OverlapMethod m_overlapCriterium;
193  std::vector<dmpvecarr3E> m_subpatch;
194  std::vector<dmpvecarr3E> m_subresults;
195  dmpvecarr3E m_result;
197 public:
199  ReconstructVector(const bitpit::Config::Section & rootXML);
200  virtual ~ReconstructVector();
201  ReconstructVector(const ReconstructVector & other);
202 
203  //get-set methods
205  int getOverlapCriterium();
206  int getNData();
208  std::vector<dmpvecarr3E*> getResultFields();
209 
211  void setOverlapCriterium(int );
212  void addData( dmpvecarr3E * );
214  void removeAllData();
215  void buildPorts();
216  //cleaners
217  void clear();
218 
219 
220  //plotting
221  void plotData();
222  void plotSubData(int i);
223 
224  //execute
225  void execute();
226 
227  //XML utilities from reading writing settings to file
228  virtual void absorbSectionXML(const bitpit::Config::Section & slotXML, std::string name="");
229  virtual void flushSectionXML(bitpit::Config::Section & slotXML, std::string name="");
230 
231 protected:
232  virtual void plotOptionalResults();
233  void swap(ReconstructVector &) noexcept;
234 private:
235  void overlapFields(long int ID, darray3E & locField);
237 };
238 
239 REGISTER_PORT(M_GEOM, MC_SCALAR, MD_MIMMO_, __RECONSTRUCTSCALAR_HPP__)
240 REGISTER_PORT(M_SCALARFIELD, MC_SCALAR, MD_MPVECFLOAT_, __RECONSTRUCTSCALAR_HPP__)
241 REGISTER_PORT(M_VECTORFIELD, MC_SCALAR, MD_MPVECARR3FLOAT_, __RECONSTRUCTSCALAR_HPP__)
242 REGISTER_PORT(M_VECSCALARFIELDS, MC_VECTOR, MD_MPVECFLOAT_, __RECONSTRUCTSCALAR_HPP__)
243 REGISTER_PORT(M_VECVECTORFIELDS, MC_VECTOR, MD_MPVECARR3FLOAT_, __RECONSTRUCTSCALAR_HPP__)
244 
245 
246 REGISTER(BaseManipulation, ReconstructScalar,"mimmo.ReconstructScalar")
248 
249 };
250 
251 #endif /* __RECONSTRUCTFIELDS_HPP__ */
Reconstruct a scalar field from daughter meshes to mother mesh.
OverlapMethod
class for setting overlapping criterium for two different fields
#define M_GEOM
#define M_VECVECTORFIELDS
MPVLocation
Define data location for the MimmoPiercedVector field.
OverlapMethod getOverlapCriteriumENUM()
std::vector< dmpvecarr3E * > getResultFields()
void setOverlapCriteriumENUM(OverlapMethod)
std::vector< long > livector1D
virtual void flushSectionXML(bitpit::Config::Section &slotXML, std::string name="")
void swap(ReconstructVector &) noexcept
ReconstructVector(MPVLocation loc=MPVLocation::POINT)
BaseManipulation is the base class of any manipulation object of the library.
virtual void flushSectionXML(bitpit::Config::Section &slotXML, std::string name="")
MimmoPiercedVector is the basic data container for mimmo library.
#define M_VECTORFIELD
#define MC_SCALAR
#define MD_MPVECARR3FLOAT_
#define REGISTER_PORT(Name, Container, Datatype, ManipBlock)
ReconstructScalar(MPVLocation loc=MPVLocation::POINT)
std::vector< dmpvector1D * > getResultFields()
void removeData(mimmo::MimmoSharedPointer< MimmoObject >)
#define MC_VECTOR
Reconstruct a vector field from daughter mesh to mother mesh.
void removeData(mimmo::MimmoSharedPointer< MimmoObject >)
OverlapMethod getOverlapCriteriumENUM()
void swap(ReconstructScalar &) noexcept
#define MD_MIMMO_
#define MD_MPVECFLOAT_
#define M_SCALARFIELD
std::array< double, 3 > darray3E
void addData(dmpvecarr3E *)
#define M_VECSCALARFIELDS
virtual void absorbSectionXML(const bitpit::Config::Section &slotXML, std::string name="")
void addData(dmpvector1D *)
MimmoSharedPointer is a custom implementation of shared pointer.
virtual void absorbSectionXML(const bitpit::Config::Section &slotXML, std::string name="")
void setOverlapCriteriumENUM(OverlapMethod)
#define REGISTER(Base, Derived, name)
Definition: factory.hpp:206