FVMeshSelection.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 __FVMESHSELECTION_HPP__
26 #define __FVMESHSELECTION_HPP__
27 
28 #include <BaseManipulation.hpp>
29 #include <MeshSelection.hpp>
30 
31 namespace mimmo{
32 
79 
80 public:
81  FVGenericSelection(int topo = 1);
82  virtual ~FVGenericSelection();
85 
88  void setDual(bool flag=false);
90 
94 
98 
99  bool isDual();
100  void execute();
101 
102 
103 protected:
104  void swap(FVGenericSelection &x) noexcept;
105  void buildPorts();
106  virtual void plotOptionalResults();
108  void cleanUpBoundaryPatch();
110 
111  int m_topo;
112  bool m_dual;
119 private:
120  //interface blocked method.
121  MimmoSharedPointer<MimmoObject> getGeometry(){return nullptr;};
122 
123 };
124 
125 
193 
194 public:
195  FVSelectionByBox(int topo = 1);
196  FVSelectionByBox(const bitpit::Config::Section & rootXML);
197  FVSelectionByBox(int topo, darray3E origin, darray3E span);
198  virtual ~FVSelectionByBox();
199  FVSelectionByBox(const FVSelectionByBox & other);
201 
202  void setOrigin(darray3E origin);
203  void setSpan(darray3E span);
204  void setRefSystem(dmatrix33E axes);
205 
206  virtual void absorbSectionXML(const bitpit::Config::Section & slotXML, std::string name="" );
207  virtual void flushSectionXML(bitpit::Config::Section & slotXML, std::string name="" );
208 
209 protected:
210  void swap(FVSelectionByBox &) noexcept;
211  void buildPorts();
212 
213 private:
214  void setSelection(MimmoSharedPointer<GenericSelection> selectBlock){BITPIT_UNUSED(selectBlock);};
215 };
216 
287 
288 public:
289  FVSelectionByCylinder(int topo = 1);
290  FVSelectionByCylinder(const bitpit::Config::Section & rootXML);
291  FVSelectionByCylinder(int topo, darray3E origin, darray3E span, double infLimTheta, darray3E mainAxis);
292  virtual ~FVSelectionByCylinder();
295 
296  void setOrigin(darray3E origin);
297  void setSpan(darray3E span);
298  void setRefSystem(dmatrix33E axes);
299  void setInfLimits(darray3E val);
300 
301  virtual void absorbSectionXML(const bitpit::Config::Section & slotXML, std::string name="" );
302  virtual void flushSectionXML(bitpit::Config::Section & slotXML, std::string name="" );
303 
304 protected:
305  void swap(FVSelectionByCylinder &) noexcept;
306  void buildPorts();
307 
308 private:
309  void setSelection(MimmoSharedPointer<GenericSelection> selectBlock){BITPIT_UNUSED(selectBlock);};
310 
311 };
312 
313 
387 
388 public:
389  FVSelectionBySphere(int topo = 1);
390  FVSelectionBySphere(const bitpit::Config::Section & rootXML);
391  FVSelectionBySphere(int topo, darray3E origin, darray3E span, double infLimTheta, double infLimPhi);
392  virtual ~FVSelectionBySphere();
395 
396  void setOrigin(darray3E origin);
397  void setSpan(darray3E span);
398  void setRefSystem(dmatrix33E axes);
399  void setInfLimits(darray3E val);
400 
401  virtual void absorbSectionXML(const bitpit::Config::Section & slotXML, std::string name="" );
402  virtual void flushSectionXML(bitpit::Config::Section & slotXML, std::string name="" );
403 
404 protected:
405  void swap(FVSelectionBySphere &) noexcept;
406  void buildPorts();
407 
408 private:
409  void setSelection(MimmoSharedPointer<GenericSelection> selectBlock){BITPIT_UNUSED(selectBlock);};
410 
411 };
412 
413 
414 REGISTER_PORT(M_GEOM, MC_SCALAR, MD_MIMMO_, __FVMESHSELECTION_HPP__)
415 REGISTER_PORT(M_GEOM2, MC_SCALAR, MD_MIMMO_, __FVMESHSELECTION_HPP__)
416 REGISTER_PORT(M_GEOM3, MC_SCALAR, MD_MIMMO_, __FVMESHSELECTION_HPP__)
417 REGISTER_PORT(M_POINT, MC_ARRAY3, MD_FLOAT, __FVMESHSELECTION_HPP__)
418 REGISTER_PORT(M_AXES, MC_ARR3ARR3, MD_FLOAT, __FVMESHSELECTION_HPP__)
419 REGISTER_PORT(M_SPAN, MC_ARRAY3, MD_FLOAT, __FVMESHSELECTION_HPP__)
420 REGISTER_PORT(M_INFLIMITS, MC_ARRAY3, MD_FLOAT, __FVMESHSELECTION_HPP__)
421 
422 
423 REGISTER(BaseManipulation, FVSelectionByBox,"mimmo.FVSelectionByBox")
426 };
427 
428 
429 #endif /* __FVMESHSELECTION_HPP__ */
void swap(FVSelectionByCylinder &) noexcept
FVGenericSelection class specialized for selections with volume spherical primitive shapes.
void swap(FVSelectionBySphere &) noexcept
FVGenericSelection class specialized for selections with volume cylindrical primitive shapes.
void setDual(bool flag=false)
FVSelectionBySphere & operator=(FVSelectionBySphere other)
MimmoSharedPointer< MimmoObject > m_intbndpatch
MimmoSharedPointer< MimmoObject > m_bndgeometry
#define M_GEOM
#define MC_ARRAY3
#define MD_FLOAT
MimmoSharedPointer< MimmoObject > createInternalBoundaryPatch()
virtual void absorbSectionXML(const bitpit::Config::Section &slotXML, std::string name="")
void setOrigin(darray3E origin)
Interface for applying selection methods simultaneously on bulk+boundary compound meshes.
void setSpan(darray3E span)
FVGenericSelection & operator=(FVGenericSelection other)
#define MC_ARR3ARR3
#define M_GEOM2
virtual void flushSectionXML(bitpit::Config::Section &slotXML, std::string name="")
#define M_POINT
BaseManipulation is the base class of any manipulation object of the library.
FVGenericSelection class specialized for selections with volume box primitive shapes.
void setBoundaryGeometry(mimmo::MimmoSharedPointer< MimmoObject >)
#define M_INFLIMITS
void swap(FVSelectionByBox &) noexcept
#define MC_SCALAR
MimmoSharedPointer< MimmoObject > m_bndpatch
#define REGISTER_PORT(Name, Container, Datatype, ManipBlock)
std::array< darray3E, 3 > dmatrix33E
const mimmo::MimmoSharedPointer< MimmoObject > getBoundaryPatch() const
#define M_SPAN
void setOrigin(darray3E origin)
MimmoSharedPointer< GenericSelection > m_selectEngine
#define M_AXES
#define M_GEOM3
virtual void flushSectionXML(bitpit::Config::Section &slotXML, std::string name="")
FVSelectionByCylinder & operator=(FVSelectionByCylinder other)
virtual void absorbSectionXML(const bitpit::Config::Section &slotXML, std::string name="")
#define MD_MIMMO_
FVSelectionByBox & operator=(FVSelectionByBox other)
MimmoSharedPointer< MimmoObject > m_volpatch
void setSelection(MimmoSharedPointer< GenericSelection > selectBlock)
std::array< double, 3 > darray3E
const mimmo::MimmoSharedPointer< MimmoObject > getInternalBoundaryPatch() const
const mimmo::MimmoSharedPointer< MimmoObject > getVolumePatch() const
MimmoSharedPointer is a custom implementation of shared pointer.
void setRefSystem(dmatrix33E axes)
void setRefSystem(dmatrix33E axes)
void setGeometry(mimmo::MimmoSharedPointer< MimmoObject >)
virtual void absorbSectionXML(const bitpit::Config::Section &slotXML, std::string name="")
virtual void flushSectionXML(bitpit::Config::Section &slotXML, std::string name="")
#define REGISTER(Base, Derived, name)
Definition: factory.hpp:206
void swap(FVGenericSelection &x) noexcept