From 6817b6a5c257b632bd6c3e3c0ee805552e31fda5 Mon Sep 17 00:00:00 2001 From: Jonathan Lambrechts <jonathan.lambrechts@uclouvain.be> Date: Fri, 18 Sep 2015 13:08:37 +0000 Subject: [PATCH] Numeric : fix rounding in Quad and Hex quadrature order --- Numeric/GaussQuadratureHex.cpp | 5 +++-- Numeric/GaussQuadratureQuad.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Numeric/GaussQuadratureHex.cpp b/Numeric/GaussQuadratureHex.cpp index ca9a3f8cf4..08bbaeddf6 100644 --- a/Numeric/GaussQuadratureHex.cpp +++ b/Numeric/GaussQuadratureHex.cpp @@ -69,7 +69,7 @@ IntPt *getGQHPts(int order) if(order < 2) return GQH[order]; if(order == 2) return GQH[3]; if(order == 3) return GQH[3]; - int n = (order+3)/2; + int n = (order + 1) / (float)2 + 0.5; int index = n-2 + 4; if(index >= (int)(sizeof(GQH) / sizeof(IntPt*))){ Msg::Error("Increase size of GQH in gauss quadrature hex"); @@ -100,5 +100,6 @@ int getNGQHPts(int order) if(order == 2)return 8; if(order < 2) return GQHnPt[order]; - return ((order+3)/2)*((order+3)/2)*((order+3)/2); + int n = (order + 1) / (float)2 + 0.5; + return n * n * n; } diff --git a/Numeric/GaussQuadratureQuad.cpp b/Numeric/GaussQuadratureQuad.cpp index 1aeae10efb..9eac4a4578 100644 --- a/Numeric/GaussQuadratureQuad.cpp +++ b/Numeric/GaussQuadratureQuad.cpp @@ -110,7 +110,7 @@ IntPt *getGQQPts(int order) if(order < 2) return GQQ[order]; if(order == 2) return GQQ[3]; if(order == 3) return GQQ[3]; - int n = (order+3)/2; + int n = (order + 1) / (float)2 + 0.5; int index = n-2 + 7; if(index >= (int)(sizeof(GQQ) / sizeof(IntPt*))){ Msg::Error("Increase size of GQQ in gauss quadrature quad"); @@ -139,5 +139,6 @@ int getNGQQPts(int order) if(order == 2) return 4; if(order < 2) return GQQnPt[order]; - return ((order+3)/2)*((order+3)/2); + int n = (order + 1) / (float)2 + 0.5; + return n * n; } -- GitLab