BendGeometry.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 __BENDGEOMETRY_HPP__
25 #define __BENDGEOMETRY_HPP__
26 
27 #include "BaseManipulation.hpp"
28 
29 namespace mimmo{
30 
121 private:
122  darray3E m_origin;
123  dmatrix33E m_system;
124  bool m_local;
125  umatrix33E m_degree;
128  dmat33Evec m_coeffs;
129  dmpvector1D m_filter;
130  dmpvecarr3E m_displ;
132 public:
133  BendGeometry();
134  BendGeometry(const bitpit::Config::Section & rootXML);
135  ~BendGeometry();
136 
137  BendGeometry(const BendGeometry & other);
139  void buildPorts();
140 
146 
147  void setFilter(dmpvector1D *filter);
148  void setOrigin(darray3E origin);
149  void setRefSystem(dmatrix33E axes);
150  void setDegree(umatrix33E degree);
151  void setDegree(int i, int j, uint32_t degree);
152  void setCoeffs(dmat33Evec *coeffs);
153  void setCoeffs(int i, int j, dvector1D coeffs);
154 
155  void execute();
156  void apply();
157 
158  //XML utilities from reading writing settings to file
159  virtual void absorbSectionXML(const bitpit::Config::Section & slotXML, std::string name="");
160  virtual void flushSectionXML(bitpit::Config::Section & slotXML, std::string name="");
161 
162 protected:
163  void swap(BendGeometry & x) noexcept;
164  void checkFilter();
165  static darray3E matmul(const darray3E & vec, const dmatrix33E & mat);
166  static darray3E matmul(const dmatrix33E & mat,const darray3E & vec);
167 
168 private:
169  darray3E toLocalCoord(darray3E point);
170  darray3E toGlobalCoord(darray3E point);
171 
172 };
173 
174 REGISTER_PORT(M_FILTER, MC_SCALAR, MD_MPVECFLOAT_,__BENDGEOMETRY_HPP__)
175 REGISTER_PORT(M_POINT, MC_ARRAY3, MD_FLOAT,__BENDGEOMETRY_HPP__)
176 REGISTER_PORT(M_AXES, MC_ARR3ARR3, MD_FLOAT,__BENDGEOMETRY_HPP__)
177 REGISTER_PORT(M_BMATRIX, MC_ARR3ARR3, MD_INT,__BENDGEOMETRY_HPP__)
178 REGISTER_PORT(M_BCOEFFS, MC_SCALAR, MD_MATRIXCOEFF_,__BENDGEOMETRY_HPP__)
179 REGISTER_PORT(M_GEOM, MC_SCALAR, MD_MIMMO_,__BENDGEOMETRY_HPP__)
180 REGISTER_PORT(M_GDISPLS, MC_SCALAR, MD_MPVECARR3FLOAT_,__BENDGEOMETRY_HPP__)
181 
182 
183 REGISTER(BaseManipulation, BendGeometry, "mimmo.BendGeometry")
184 
185 }
186 
187 #endif /* __BENDGEOMETRY_HPP__ */
#define M_GDISPLS
std::array< darr3Evec, 3 > dmat33Evec
#define M_GEOM
#define MC_ARRAY3
virtual void absorbSectionXML(const bitpit::Config::Section &slotXML, std::string name="")
#define MD_FLOAT
void swap(BendGeometry &x) noexcept
void setDegree(umatrix33E degree)
BendGeometry & operator=(BendGeometry other)
umatrix33E getDegree()
#define MC_ARR3ARR3
#define M_POINT
BendGeometry applies custom bending deformations along axis-directions of a target geometry.
dmpvecarr3E * getDisplacements()
BaseManipulation is the base class of any manipulation object of the library.
#define MD_MATRIXCOEFF_
#define M_BCOEFFS
#define MC_SCALAR
#define MD_MPVECARR3FLOAT_
#define REGISTER_PORT(Name, Container, Datatype, ManipBlock)
dmat33Evec * getCoeffs()
std::array< darray3E, 3 > dmatrix33E
std::vector< double > dvector1D
#define M_BMATRIX
#define M_AXES
static darray3E matmul(const darray3E &vec, const dmatrix33E &mat)
std::array< uarray3E, 3 > umatrix33E
#define MD_MIMMO_
void setOrigin(darray3E origin)
#define MD_MPVECFLOAT_
std::array< double, 3 > darray3E
void setFilter(dmpvector1D *filter)
void setCoeffs(dmat33Evec *coeffs)
dmatrix33E getRefSystem()
virtual void flushSectionXML(bitpit::Config::Section &slotXML, std::string name="")
#define MD_INT
void setRefSystem(dmatrix33E axes)
#define M_FILTER
#define REGISTER(Base, Derived, name)
Definition: factory.hpp:206