Apply.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 __APPLYDEFORMATION_HPP__
25 #define __APPLYDEFORMATION_HPP__
26 
27 #include "BaseManipulation.hpp"
28 
29 namespace mimmo{
89 class Apply: public BaseManipulation{
90 
91 public:
92 
93  Apply();
94  Apply(const bitpit::Config::Section & rootXML);
95 
96  ~Apply();
97 
98  Apply(const Apply & other);
99 
100  void buildPorts();
101 
102  void setInput(dmpvecarr3E *input);
103  void setScalarInput(dmpvector1D* input);
104  void setFilter(dmpvector1D* input);
105 
106  void setScaling(double alpha);
107 
108  void setAnnotation(bool activate);
109  void setCellsAnnotationName(const std::string & label);
110  void setVerticesAnnotationName(const std::string & label);
111  void setAnnotationThreshold(double threshold);
112 
113  void execute();
114 
118 
119  virtual void absorbSectionXML(const bitpit::Config::Section & slotXML, std::string name="");
120  virtual void flushSectionXML(bitpit::Config::Section & slotXML, std::string name="");
121 
122 protected:
123 
127  double m_factor;
131  std::string m_annCellLabel;
132  std::string m_annVertexLabel;
138  void swap(Apply & x) noexcept;
139  void checkInput();
140 
141 };
142 
143 REGISTER_PORT(M_GDISPLS, MC_SCALAR, MD_MPVECARR3FLOAT_, __APPLYDEFORMATION_HPP__)
144 REGISTER_PORT(M_SCALARFIELD, MC_SCALAR, MD_MPVECFLOAT_, __APPLYDEFORMATION_HPP__)
145 REGISTER_PORT(M_FILTER, MC_SCALAR, MD_MPVECFLOAT_, __APPLYDEFORMATION_HPP__)
146 REGISTER_PORT(M_GEOM, MC_SCALAR, MD_MIMMO_, __APPLYDEFORMATION_HPP__)
147 REGISTER_PORT(M_LONGFIELD, MC_SCALAR, MD_MPVECLONG_, __APPLYDEFORMATION_HPP__)
148 REGISTER_PORT(M_LONGFIELD2, MC_SCALAR, MD_MPVECLONG_, __APPLYDEFORMATION_HPP__)
149 
150 REGISTER(BaseManipulation, Apply, "mimmo.Apply")
151 
152 };
153 
154 #endif /* __APPLYDEFORMATION_HPP__ */
std::string m_annCellLabel
Definition: Apply.hpp:131
#define M_LONGFIELD
#define M_GDISPLS
dmpvecarr3E m_input
Definition: Apply.hpp:124
MimmoPiercedVector< long > * getAnnotatedVertices()
Definition: Apply.cpp:226
void setAnnotationThreshold(double threshold)
Definition: Apply.cpp:179
#define M_GEOM
Apply is the class that applies the deformation resulting from a manipulation object to the geometry.
Definition: Apply.hpp:89
void setCellsAnnotationName(const std::string &label)
Definition: Apply.cpp:189
void execute()
Definition: Apply.cpp:245
void setScaling(double alpha)
Definition: Apply.cpp:158
MimmoPiercedVector< long > m_vertexAnnotation
Definition: Apply.hpp:135
dmpvecarr3E m_output
Definition: Apply.hpp:128
#define M_LONGFIELD2
bool m_annotation
Definition: Apply.hpp:130
BaseManipulation is the base class of any manipulation object of the library.
virtual void absorbSectionXML(const bitpit::Config::Section &slotXML, std::string name="")
Definition: Apply.cpp:310
#define MC_SCALAR
#define MD_MPVECARR3FLOAT_
void setInput(dmpvecarr3E *input)
Definition: Apply.cpp:128
#define REGISTER_PORT(Name, Container, Datatype, ManipBlock)
double m_factor
Definition: Apply.hpp:127
double m_annotationThres
Definition: Apply.hpp:133
void setAnnotation(bool activate)
Definition: Apply.cpp:169
void checkInput()
Definition: Apply.cpp:386
MimmoPiercedVector< long > * getAnnotatedCells()
Definition: Apply.cpp:235
dmpvector1D m_filter
Definition: Apply.hpp:126
#define MD_MIMMO_
#define MD_MPVECFLOAT_
#define M_SCALARFIELD
void setScalarInput(dmpvector1D *input)
Definition: Apply.cpp:138
std::string m_annVertexLabel
Definition: Apply.hpp:132
MimmoPiercedVector< long > m_cellAnnotation
Definition: Apply.hpp:134
void swap(Apply &x) noexcept
Definition: Apply.cpp:88
dmpvecarr3E * getOutput()
Definition: Apply.cpp:216
#define MD_MPVECLONG_
void setFilter(dmpvector1D *input)
Definition: Apply.cpp:148
void buildPorts()
Definition: Apply.cpp:108
virtual void flushSectionXML(bitpit::Config::Section &slotXML, std::string name="")
Definition: Apply.cpp:369
dmpvector1D m_scalarinput
Definition: Apply.hpp:125
void setVerticesAnnotationName(const std::string &label)
Definition: Apply.cpp:203
#define M_FILTER
#define REGISTER(Base, Derived, name)
Definition: factory.hpp:206