TwistGeometry.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 __TWISTGEOMETRY_HPP__
25 #define __TWISTGEOMETRY_HPP__
26 
27 #include "BaseManipulation.hpp"
28 
29 namespace mimmo{
30 
86 private:
87  //members
88  darray3E m_origin;
89  darray3E m_direction;
90  double m_alpha;
91  double m_distance;
92  dmpvector1D m_filter;
93  dmpvecarr3E m_displ;
94  bool m_sym;
96 public:
97  TwistGeometry(darray3E origin = { {0, 0, 0} }, darray3E direction = { {0, 0, 0} });
98  TwistGeometry(const bitpit::Config::Section & rootXML);
100 
101  TwistGeometry(const TwistGeometry & other);
103 
104  void buildPorts();
105 
106  void setAxis(darray3E origin, darray3E direction);
107  void setOrigin(darray3E origin);
108  void setDirection(darray3E direction);
109  void setTwist(double alpha);
110  void setSym(bool sym);
111  void setMaxDistance(double distance);
112  void setFilter(dmpvector1D *filter);
113 
115 
116  void execute();
117  void apply();
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  void swap(TwistGeometry & x) noexcept;
124  void checkFilter();
125 };
126 
127 REGISTER_PORT(M_POINT, MC_ARRAY3, MD_FLOAT,__TWISTGEOMETRY_HPP__)
128 REGISTER_PORT(M_AXIS, MC_ARRAY3, MD_FLOAT,__TWISTGEOMETRY_HPP__)
129 REGISTER_PORT(M_VALUED, MC_SCALAR, MD_FLOAT,__TWISTGEOMETRY_HPP__)
130 REGISTER_PORT(M_VALUED2, MC_SCALAR, MD_FLOAT,__TWISTGEOMETRY_HPP__)
131 REGISTER_PORT(M_FILTER, MC_SCALAR, MD_MPVECFLOAT_,__TWISTGEOMETRY_HPP__)
132 REGISTER_PORT(M_GEOM, MC_SCALAR, MD_MIMMO_,__TWISTGEOMETRY_HPP__)
133 REGISTER_PORT(M_GDISPLS, MC_SCALAR, MD_MPVECARR3FLOAT_,__TWISTGEOMETRY_HPP__)
134 
135 
136 REGISTER(BaseManipulation, TwistGeometry, "mimmo.TwistGeometry")
137 
138 };
139 
140 #endif /* __TWISTGEOMETRY_HPP__ */
#define M_GDISPLS
void setMaxDistance(double distance)
virtual void flushSectionXML(bitpit::Config::Section &slotXML, std::string name="")
void setAxis(darray3E origin, darray3E direction)
TwistGeometry(darray3E origin={ {0, 0, 0} }, darray3E direction={ {0, 0, 0} })
#define M_GEOM
#define MC_ARRAY3
#define MD_FLOAT
void setSym(bool sym)
void setDirection(darray3E direction)
#define M_VALUED2
dmpvecarr3E * getDisplacements()
#define M_POINT
BaseManipulation is the base class of any manipulation object of the library.
TwistGeometry & operator=(TwistGeometry other)
#define MC_SCALAR
virtual void absorbSectionXML(const bitpit::Config::Section &slotXML, std::string name="")
#define MD_MPVECARR3FLOAT_
#define REGISTER_PORT(Name, Container, Datatype, ManipBlock)
#define M_VALUED
#define MD_MIMMO_
#define MD_MPVECFLOAT_
void setTwist(double alpha)
void setFilter(dmpvector1D *filter)
std::array< double, 3 > darray3E
#define M_AXIS
void swap(TwistGeometry &x) noexcept
void setOrigin(darray3E origin)
TwistGeometry is the class that applies a twist to a given geometry patch.
#define M_FILTER
#define REGISTER(Base, Derived, name)
Definition: factory.hpp:206