From 6d4146a1cf133cfa9ef2220d4397db30f3816531 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Tue, 24 Jan 2023 14:28:08 +0100 Subject: [PATCH] WIP --- .../GaussPoints/InterpKernelGaussCoords.cxx | 35 +++++++++++++++++++ .../MEDCouplingBasicsTest7.py | 19 ++++++++++ 2 files changed, 54 insertions(+) diff --git a/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx b/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx index f0e0c1eb1..cd57ad9b9 100644 --- a/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx +++ b/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx @@ -914,6 +914,19 @@ void GaussInfo::tria3aInit() funValue[1] = -0.5*(gc[0] + gc[1]); funValue[2] = 0.5*(1.0 + gc[0]); SHAPE_FUN_MACRO_END; + + DEV_SHAPE_FUN_MACRO_BEGIN; + + devFunValue[0] = 0.0 ; + devFunValue[1] = 0.5 ; + + devFunValue[2] = -0.5; + devFunValue[3] = -0.5; + + devFunValue[4] = 0.5; + devFunValue[5] = 0.0; + + DEV_SHAPE_FUN_MACRO_END; } /*! @@ -985,6 +998,28 @@ void GaussInfo::tria6aInit() funValue[4] = -1.0*(1.0 + gc[0])*(gc[0] + gc[1]); funValue[5] = (1.0 + gc[1])*(1.0 + gc[1]); SHAPE_FUN_MACRO_END; + + DEV_SHAPE_FUN_MACRO_BEGIN; + + devFunValue[0] = 0.0; + devFunValue[1] = 0.5*( 2*gc[1] + 1.0 ); + + devFunValue[2] = 0.5*( 2*gc[0] + 2.0*gc[1] + 1.0); + devFunValue[3] = 0.5*( 2*gc[1] + 2.0*gc[0] + 1.0); + + devFunValue[4] = gc[0] + 0.5; + devFunValue[5] = 0.0; + + devFunValue[6] = -1.0*(1.0 + gc[1]); + devFunValue[7] = -1.0*(2*gc[1]+gc[0]+1.0); + + devFunValue[8] = -1.0*(2*gc[0]+gc[1]+1.0); + devFunValue[9] = -1.0*(1.0 + gc[0]); + + devFunValue[10] = 0.0; + devFunValue[11] = (2*gc[1]+2.0); + + DEV_SHAPE_FUN_MACRO_END; } /*! diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest7.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest7.py index ecdc04954..5e7c93e67 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest7.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest7.py @@ -1119,6 +1119,25 @@ class MEDCouplingBasicsTest7(unittest.TestCase): delta_Z.abs() self.assertTrue(delta_Z.findIdsNotInRange(-1e-5,+1e-5).empty()) + # 2D cells + vec = [0.64,0.2] + + for gt in [NORM_QUAD8,NORM_QUAD4,NORM_TRI3,NORM_TRI6]: + ref_coord = [list(elt) for elt in MEDCouplingGaussLocalization.GetDefaultReferenceCoordinatesOf(gt).getValuesAsTuple()] + + der_computed = GetDerivative(ref_coord,vec) + der_computed.rearrange(2) + + der_deduced = ( GetShapeFunc(ref_coord,[vec[0]+eps,vec[1]])-GetShapeFunc(ref_coord,vec) ) / eps + delta_X = der_computed[:,0]-der_deduced + delta_X.abs() + self.assertTrue(delta_X.findIdsNotInRange(-1e-5,+1e-5).empty()) + + der_deduced = ( GetShapeFunc(ref_coord,[vec[0],vec[1]+eps])-GetShapeFunc(ref_coord,vec) ) / eps + delta_Y = der_computed[:,1]-der_deduced + delta_Y.abs() + self.assertTrue(delta_Y.findIdsNotInRange(-1e-5,+1e-5).empty()) + def testComputeTriangleHeight0(self): arr = DataArrayDouble([0,1]) m = MEDCouplingCMesh() ; m.setCoords(arr,arr) -- 2.39.2