AABBox.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 __AABBox_HPP__
25 #define __AABBox_HPP__
26 
27 #include "BaseManipulation.hpp"
28 
29 namespace mimmo{
30 
84 class AABBox: public BaseManipulation {
85 
86 protected:
91  std::unordered_map<MimmoSharedPointer<MimmoObject>, int> m_listgeo;
92  bool m_writeInfo;
94 public:
95  AABBox();
96  AABBox(const bitpit::Config::Section & rootXML);
97  virtual ~AABBox();
98 
99  //copy operators/constructors
100  AABBox(const AABBox & other);
101 
102  void buildPorts();
103 
104  //clean structure;
105  void clearAABBox();
106 
107  //internal methods
108  std::vector<MimmoSharedPointer<MimmoObject> > getGeometries();
110  darray3E getSpan();
112 
114  void setGeometries(std::vector<MimmoSharedPointer<MimmoObject> > listgeo);
115  void setAxes(dmatrix33E axes);
116  void setWriteInfo(bool flag);
117 
118  //plotting wrappers
119  void plot(std::string directory, std::string filename, int counter, bool binary);
120 
121  //building method
122  void execute();
123 
124  virtual void absorbSectionXML(const bitpit::Config::Section & slotXML, std::string name = "");
125  virtual void flushSectionXML(bitpit::Config::Section & slotXML, std::string name= "");
126 
127 
128 protected:
129  virtual void plotOptionalResults();
130  void swap(AABBox & x) noexcept;
131  dmatrix33E transpose(const dmatrix33E & mat);
132  dmatrix33E inverse (const dmatrix33E & mat);
133 
134 };
135 
136 REGISTER_PORT(M_GEOM, MC_SCALAR, MD_MIMMO_,__AABBox_HPP__)
137 REGISTER_PORT(M_VECGEOM, MC_VECTOR, MD_MIMMO_,__AABBox_HPP__)
138 REGISTER_PORT(M_POINT, MC_ARRAY3, MD_FLOAT,__AABBox_HPP__)
139 REGISTER_PORT(M_AXES, MC_ARR3ARR3, MD_FLOAT,__AABBox_HPP__)
140 REGISTER_PORT(M_SPAN, MC_ARRAY3, MD_FLOAT,__AABBox_HPP__)
141 
142 
143 REGISTER(BaseManipulation, AABBox, "mimmo.AABBox")
144 
145 };
146 
147 #endif /* __LATTICE_HPP__ */
virtual ~AABBox()
Definition: AABBox.cpp:71
virtual void flushSectionXML(bitpit::Config::Section &slotXML, std::string name="")
Definition: AABBox.cpp:433
darray3E getOrigin()
Definition: AABBox.cpp:134
dmatrix33E m_axes
Definition: AABBox.hpp:89
std::unordered_map< MimmoSharedPointer< MimmoObject >, int > m_listgeo
Definition: AABBox.hpp:91
#define M_GEOM
darray3E m_span
Definition: AABBox.hpp:88
#define MC_ARRAY3
#define MD_FLOAT
void setGeometries(std::vector< MimmoSharedPointer< MimmoObject > > listgeo)
Definition: AABBox.cpp:175
void setGeometry(MimmoSharedPointer< MimmoObject > geo)
Definition: AABBox.cpp:188
void clearAABBox()
Definition: AABBox.cpp:116
#define MC_ARR3ARR3
void swap(AABBox &x) noexcept
Definition: AABBox.cpp:88
#define M_POINT
Axis Aligned Bounding Box calculator.
Definition: AABBox.hpp:84
BaseManipulation is the base class of any manipulation object of the library.
darray3E getSpan()
Definition: AABBox.cpp:142
void buildPorts()
Definition: AABBox.cpp:101
virtual void plotOptionalResults()
Definition: AABBox.cpp:359
virtual void absorbSectionXML(const bitpit::Config::Section &slotXML, std::string name="")
Definition: AABBox.cpp:371
void plot(std::string directory, std::string filename, int counter, bool binary)
Definition: AABBox.cpp:224
#define MC_SCALAR
darray3E m_origin
Definition: AABBox.hpp:87
#define REGISTER_PORT(Name, Container, Datatype, ManipBlock)
dmatrix33E getAxes()
Definition: AABBox.cpp:151
dmatrix33E inverse(const dmatrix33E &mat)
Definition: AABBox.cpp:473
std::array< darray3E, 3 > dmatrix33E
std::vector< MimmoSharedPointer< MimmoObject > > getGeometries()
Definition: AABBox.cpp:161
#define M_SPAN
void setWriteInfo(bool flag)
Definition: AABBox.cpp:213
#define M_AXES
#define MC_VECTOR
dmatrix33E transpose(const dmatrix33E &mat)
Definition: AABBox.cpp:457
void setAxes(dmatrix33E axes)
Definition: AABBox.cpp:204
#define MD_MIMMO_
void execute()
Definition: AABBox.cpp:270
bool m_writeInfo
Definition: AABBox.hpp:92
std::array< double, 3 > darray3E
MimmoSharedPointer is a custom implementation of shared pointer.
#define M_VECGEOM
#define REGISTER(Base, Derived, name)
Definition: factory.hpp:206