MeshChecker.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 __MESH_CHECKER_HPP__
26 #define __MESH_CHECKER_HPP__
27 
28 #include <BaseManipulation.hpp>
29 
30 
31 namespace mimmo{
32 
88 
89 public:
90 
104  };
105 
106 
107  MeshChecker();
108  MeshChecker(const bitpit::Config::Section & rootXML);
109  virtual ~MeshChecker();
110 
111  MeshChecker(const MeshChecker & other);
113 
115  void setMinimumVolumeTolerance(double tol);
116  void setMaximumVolumeTolerance(double tol);
117  void setMaximumSkewnessTolerance(double tol);
118  void setMaximumBoundarySkewnessTolerance(double tol);
119  void setMinimumFaceValidityTolerance(double tol);
120  void setMinimumVolumeChangeTolerance(double tol);
121  void setPrintResumeFile(bool flag);
122 
123  bool isGood();
125  int getQualityStatusInt();
126  void execute();
127  void buildPorts();
128 
129  void plotOptionalResults();
130  virtual void absorbSectionXML(const bitpit::Config::Section & slotXML, std::string name="");
131  virtual void flushSectionXML(bitpit::Config::Section & slotXML, std::string name="");
132 
133 
134 protected:
135 
136  void swap(MeshChecker & x) noexcept;
137  void setDefault();
139  bool checkVolume();
140  bool checkSkewness();
141  bool checkFaceValidity();
142  void initializeVolumes();
143  void clear();
144  void printResumeFile();
145 
146 protected:
147 
148  // check values
149  double m_minVolume;
150  double m_maxVolume;
151  double m_maxSkewness;
157  // tolerance values
158  double m_minVolumeTol;
159  double m_maxVolumeTol;
165  bool m_isGood;
170  //Temporary aux variables
173  std::unique_ptr<MimmoObject> m_volume;
174  std::unique_ptr<MimmoObject> m_skewness;
175  std::unique_ptr<MimmoObject> m_facevalidity;
176  std::unique_ptr<MimmoObject> m_volumechange;
180 };
181 
182 REGISTER_PORT(M_GEOM, MC_SCALAR, MD_MIMMO_,__MESH_CHECKER_HPP__)
183 REGISTER_PORT(M_VALUEB, MC_SCALAR, MD_BOOL,__MESH_CHECKER_HPP__)
184 REGISTER_PORT(M_VALUEI, MC_SCALAR, MD_INT,__MESH_CHECKER_HPP__)
185 
186 
187 REGISTER(BaseManipulation, MeshChecker, "mimmo.MeshChecker")
188 }
189 
190 #endif
void setMinimumFaceValidityTolerance(double tol)
#define M_GEOM
CMeshOutput getQualityStatus()
std::unique_ptr< MimmoObject > m_volumechange
CMeshOutput checkMeshQuality()
void setMaximumVolumeTolerance(double tol)
double m_maxSkewnessBoundary
virtual void absorbSectionXML(const bitpit::Config::Section &slotXML, std::string name="")
MimmoPiercedVector< double > m_volumes
#define M_VALUEI
void setMaximumBoundarySkewnessTolerance(double tol)
void setMinimumVolumeChangeTolerance(double tol)
std::unique_ptr< MimmoObject > m_skewness
double m_maxSkewnessBoundaryTol
MeshChecker is the class to evaluate the quality of a volume mesh.
Definition: MeshChecker.hpp:87
void setGeometry(MimmoSharedPointer< MimmoObject > obj)
BaseManipulation is the base class of any manipulation object of the library.
std::unique_ptr< MimmoObject > m_facevalidity
virtual void flushSectionXML(bitpit::Config::Section &slotXML, std::string name="")
void setMaximumSkewnessTolerance(double tol)
#define MC_SCALAR
#define REGISTER_PORT(Name, Container, Datatype, ManipBlock)
std::unique_ptr< MimmoObject > m_volume
MeshChecker & operator=(MeshChecker other)
Definition: MeshChecker.cpp:88
CMeshOutput m_qualityStatus
#define MD_BOOL
virtual ~MeshChecker()
Definition: MeshChecker.cpp:61
void setMinimumVolumeTolerance(double tol)
#define MD_MIMMO_
void swap(MeshChecker &x) noexcept
Definition: MeshChecker.cpp:98
MimmoSharedPointer is a custom implementation of shared pointer.
#define MD_INT
void setPrintResumeFile(bool flag)
#define M_VALUEB
#define REGISTER(Base, Derived, name)
Definition: factory.hpp:206