Salome HOME
Copyright update 2022
[tools/medcoupling.git] / src / ParaMEDMEMTest / ParaMEDMEMTest_InterpKernelDEC.cxx
index 9267c66210577ddcb386c7f49a2d210bb83024ac..740557ba7e93a43df6f5443e31a733d695d527b5 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2020  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2022  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 #include "ParaMESH.hxx"
 #include "ParaFIELD.hxx"
 #include "ComponentTopology.hxx"
-#include "ICoCoMEDField.hxx"
 #include "ParaMEDLoader.hxx"
+#include "ICoCoMEDDoubleField.hxx"
 #include "MEDLoader.hxx"
+#include "MEDCouplingUMesh.hxx"
 #include "TestInterpKernelUtils.hxx"
 
  
@@ -495,7 +496,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2D_(const char *srcMeth, const char *ta
   MEDCoupling::MEDCouplingUMesh* mesh = nullptr;
   MEDCoupling::ParaMESH* paramesh = nullptr;
   MEDCoupling::ParaFIELD* parafield = nullptr;
-  ICoCo::MEDField* icocofield = nullptr;
+  ICoCo::MEDDoubleField* icocofield = nullptr;
   
   string filename_xml1              = "square1_split";
   string filename_xml2              = "square2_split";
@@ -541,7 +542,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2D_(const char *srcMeth, const char *ta
         value[ielem]=1.0;
     
       //      ICoCo::Field* icocofield=new ICoCo::MEDField(paramesh,parafield);
-      icocofield=new ICoCo::MEDField(parafield->getField());
+      icocofield=new ICoCo::MEDDoubleField(parafield->getField());
       dec.setMethod(srcMeth);
       dec.attachLocalField(icocofield);
     }
@@ -577,7 +578,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2D_(const char *srcMeth, const char *ta
       for(int ielem=0; ielem<nb_local;ielem++)
         value[ielem]=0.0;
       //      ICoCo::Field* icocofield=new ICoCo::MEDField(paramesh,parafield);
-      icocofield=new ICoCo::MEDField(parafield->getField());
+      icocofield=new ICoCo::MEDDoubleField(parafield->getField());
       dec.setMethod(targetMeth);
       dec.attachLocalField(icocofield);
     }
@@ -862,7 +863,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_3D_(const char *srcMeth, const char *ta
   MEDCoupling::MEDCouplingUMesh* mesh = nullptr;
   MEDCoupling::ParaMESH* paramesh = nullptr;
   MEDCoupling::ParaFIELD* parafield = nullptr;
-  ICoCo::MEDField* icocofield = nullptr;
+  ICoCo::MEDDoubleField* icocofield = nullptr;
   
   char * tmp_dir_c                    = getenv("TMP");
   string tmp_dir;
@@ -914,7 +915,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_3D_(const char *srcMeth, const char *ta
         value[ielem]=1.0;
     
       //      ICoCo::Field* icocofield=new ICoCo::MEDField(paramesh,parafield);
-      icocofield=new ICoCo::MEDField(parafield->getField());
+      icocofield=new ICoCo::MEDDoubleField(parafield->getField());
       dec.setMethod(srcMeth);
       dec.attachLocalField(icocofield);
     }
@@ -950,7 +951,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_3D_(const char *srcMeth, const char *ta
       for(int ielem=0; ielem<nb_local;ielem++)
         value[ielem]=0.0;
       //      ICoCo::Field* icocofield=new ICoCo::MEDField(paramesh,parafield);
-      icocofield=new ICoCo::MEDField(parafield->getField());
+      icocofield=new ICoCo::MEDDoubleField(parafield->getField());
       dec.setMethod(targetMeth);
       dec.attachLocalField(icocofield);
     }  
@@ -1475,11 +1476,10 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P1P1P0()
           mesh->setCoords(myCoords);
           myCoords->decrRef();
           paramesh=new ParaMESH(mesh,*target_group,targetMeshName);
-          DataArrayIdType *da=DataArrayIdType::New();
-          const mcIdType globalNumberingP2[5]={0,1,2,3,4};
-          da->useArray(globalNumberingP2,false,DeallocType::CPP_DEALLOC,5,1);
+          std::vector<mcIdType> globalNumberingP2 = {0,1,2,3,4};
+          MCAuto<DataArrayIdType> da=DataArrayIdType::New(); da->alloc(5,1);
+          std::copy(globalNumberingP2.begin(), globalNumberingP2.end(), da->rwBegin());
           paramesh->setNodeGlobal(da);
-          da->decrRef();
         }
       if(rank==3)
         {
@@ -1496,11 +1496,10 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P1P1P0()
           mesh->setCoords(myCoords);
           myCoords->decrRef();
           paramesh=new ParaMESH(mesh,*target_group,targetMeshName);
-          DataArrayIdType *da=DataArrayIdType::New();
-          const mcIdType globalNumberingP3[3]={4,2,5};
-          da->useArray(globalNumberingP3,false,DeallocType::CPP_DEALLOC,3,1);
+          std::vector<mcIdType> globalNumberingP3 = {4,2,5};
+          MCAuto<DataArrayIdType> da=DataArrayIdType::New(); da->alloc(3,1);
+          std::copy(globalNumberingP3.begin(), globalNumberingP3.end(), da->rwBegin());
           paramesh->setNodeGlobal(da);
-          da->decrRef();
         }
       if(rank==4)
         {
@@ -1518,11 +1517,10 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P1P1P0()
           mesh->setCoords(myCoords);
           myCoords->decrRef();
           paramesh=new ParaMESH(mesh,*target_group,targetMeshName);
-          DataArrayIdType *da=DataArrayIdType::New();
-          const mcIdType globalNumberingP4[6]={3,6,7,4,8,5};
-          da->useArray(globalNumberingP4,false,DeallocType::CPP_DEALLOC,6,1);
+          std::vector<mcIdType> globalNumberingP4 = {3,6,7,4,8,5};
+          MCAuto<DataArrayIdType> da=DataArrayIdType::New(); da->alloc(6,1);
+          std::copy(globalNumberingP4.begin(), globalNumberingP4.end(), da->rwBegin());
           paramesh->setNodeGlobal(da);
-          da->decrRef();
         }
       MEDCoupling::ComponentTopology comptopo;
       parafieldP0 = new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo);
@@ -2119,7 +2117,7 @@ void ParaMEDMEMTest::testAsynchronousInterpKernelDEC_2D(double dtA, double tmaxA
   MEDCoupling::MEDCouplingUMesh* mesh = nullptr;
   MEDCoupling::ParaMESH* paramesh = nullptr;
   MEDCoupling::ParaFIELD* parafield = nullptr;
-  ICoCo::MEDField* icocofield = nullptr;
+  ICoCo::MEDDoubleField* icocofield = nullptr;
 
   char * tmp_dir_c                    = getenv("TMP");
   string tmp_dir;
@@ -2172,7 +2170,7 @@ void ParaMEDMEMTest::testAsynchronousInterpKernelDEC_2D(double dtA, double tmaxA
         value[ielem]=0.0;
     
       //      ICoCo::Field* icocofield=new ICoCo::MEDField(paramesh,parafield);
-      icocofield=new ICoCo::MEDField(parafield->getField());
+      icocofield=new ICoCo::MEDDoubleField(parafield->getField());
      
       dec.attachLocalField(icocofield);
 
@@ -2212,7 +2210,7 @@ void ParaMEDMEMTest::testAsynchronousInterpKernelDEC_2D(double dtA, double tmaxA
       for(int ielem=0; ielem<nb_local;ielem++)
         value[ielem]=0.0;
       //      ICoCo::Field* icocofield=new ICoCo::MEDField(paramesh,parafield);
-      icocofield=new ICoCo::MEDField(parafield->getField());
+      icocofield=new ICoCo::MEDDoubleField(parafield->getField());
       
       dec.attachLocalField(icocofield);
     }