From d8dd74b9b7ac8298d12505151b7ce7186cb07057 Mon Sep 17 00:00:00 2001 From: Sebastien Blaise <sebastien.blaise@uclouvain.be> Date: Mon, 21 May 2012 09:11:27 +0000 Subject: [PATCH] Added inner radius for hexahedrons --- Geo/MHexahedron.cpp | 15 +++++++++++++-- Geo/MHexahedron.h | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Geo/MHexahedron.cpp b/Geo/MHexahedron.cpp index 557113a672..615a23d209 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 9c552acbab..c50db1af48 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) -- GitLab