diff --git a/Geo/MHexahedron.cpp b/Geo/MHexahedron.cpp index 557113a6720a6332be4373b4c7fafa10347fc4a4..615a23d2091af589489823d8cc117d243b794eb0 100644 --- a/Geo/MHexahedron.cpp +++ b/Geo/MHexahedron.cpp @@ -2,12 +2,12 @@ // // See the LICENSE.txt file for license information. Please report all // bugs and problems to <gmsh@geuz.org>. - +#include <limits> #include "MHexahedron.h" #include "Numeric.h" #include "Context.h" #include "polynomialBasis.h" - +#include "MQuadrangle.h" int MHexahedron::getVolumeSign() { double mat[3][3]; @@ -32,6 +32,17 @@ void MHexahedron::getIntegrationPoints(int pOrder, int *npts, IntPt **pts) *pts = getGQHPts(pOrder); } +double MHexahedron::getInnerRadius() +{ + //Only for vertically aligned elements (not inclined) + double innerRadius=std::numeric_limits<double>::max(); + for (int i=0; i<getNumFaces(); i++){ + MQuadrangle quad(getFace(i).getVertex(0), getFace(i).getVertex(1), getFace(i).getVertex(2), getFace(i).getVertex(3)); + innerRadius=std::min(innerRadius,quad.getInnerRadius()); + } + return innerRadius; +} + void MHexahedron::getFaceInfo(const MFace &face, int &ithFace, int &sign, int &rot) const { for (ithFace = 0; ithFace < 6; ithFace++){ diff --git a/Geo/MHexahedron.h b/Geo/MHexahedron.h index 9c552acbab7138ad1f1aec74c09e062fa9ada2a7..c50db1af48e4b0837405436d52a7cdd82be06eff 100644 --- a/Geo/MHexahedron.h +++ b/Geo/MHexahedron.h @@ -88,6 +88,7 @@ class MHexahedron : public MElement { _v[faces_hexa(num, 2)], _v[faces_hexa(num, 3)]); } + virtual double getInnerRadius(); virtual void getFaceInfo (const MFace & face, int &ithFace, int &sign, int &rot)const; virtual int getNumFacesRep(){ return 12; } virtual void getFaceRep(int num, double *x, double *y, double *z, SVector3 *n)