]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
WIP
authorAnthony Geay <anthony.geay@edf.fr>
Tue, 24 Jan 2023 13:28:08 +0000 (14:28 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Tue, 24 Jan 2023 13:28:08 +0000 (14:28 +0100)
src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx
src/MEDCoupling_Swig/MEDCouplingBasicsTest7.py

index f0e0c1eb1ebcf5115793c1b6b70d5f07d0dac55c..cd57ad9b974e0056c20fb62d69f6e9290eb688e2 100644 (file)
@@ -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;
 }
 
 /*!
index ecdc04954c580c80e9ada812e4b0053a7346845a..5e7c93e6771e8e9a4ed1190b11f0a82cf28ba62f 100644 (file)
@@ -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)