]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
*** empty log message ***
authorageay <ageay>
Wed, 13 Oct 2010 07:35:08 +0000 (07:35 +0000)
committerageay <ageay>
Wed, 13 Oct 2010 07:35:08 +0000 (07:35 +0000)
src/MEDCoupling/MEDCouplingMemArray.cxx
src/MEDCoupling/MEDCouplingMemArray.hxx
src/MEDLoader/MEDLoader.cxx
src/MEDLoader/MEDLoader.hxx
src/MEDLoader/Swig/MEDLoaderTest.py
src/MEDLoader/Swig/libMEDLoader_Swig.i
src/MEDLoader/Test/MEDLoaderTest.cxx
src/MEDLoader/Test/MEDLoaderTest.hxx

index e481cd340f164be9502baa706e113293f00cb80e..7ced3782b46665c8c91e8c294685f41f13be8168 100644 (file)
@@ -62,6 +62,28 @@ void DataArray::reprWithoutNameStream(std::ostream& stream) const
   stream << "\n";
 }
 
+std::string DataArray::getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception)
+{
+  if(i<(int)_info_on_compo.size())
+    return _info_on_compo[i];
+  else
+    {
+      std::ostringstream oss; oss << "getInfoOnComponent : Invalid component id transmitted (" << i << ") >= " << (int) _info_on_compo.size();
+      throw INTERP_KERNEL::Exception(oss.str().c_str());
+    }
+}
+
+void DataArray::setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception)
+{
+  if(i<(int)_info_on_compo.size())
+    _info_on_compo[i]=info;
+  else
+    {
+      std::ostringstream oss; oss << "setInfoOnComponent : Invalid component id transmitted (" << i << ") >= " << (int) _info_on_compo.size();
+      throw INTERP_KERNEL::Exception(oss.str().c_str());
+    }
+}
+
 DataArrayDouble *DataArrayDouble::New()
 {
   return new DataArrayDouble;
index 18396d86fc1c2567bb80a2be22d3450e3418fd7b..33b8896b6fb677fee7adc600300c38177675b59a 100644 (file)
@@ -88,8 +88,8 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const;
     MEDCOUPLING_EXPORT std::string getName() const { return _name; }
     MEDCOUPLING_EXPORT const std::vector<std::string> &getInfoOnComponent() const { return _info_on_compo; }
-    MEDCOUPLING_EXPORT std::string getInfoOnComponent(int i) const { return _info_on_compo[i]; }
-    MEDCOUPLING_EXPORT void setInfoOnComponent(int i, const char *info) { _info_on_compo[i]=info; }
+    MEDCOUPLING_EXPORT std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT void setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT int getNumberOfComponents() const { return _info_on_compo.size(); }
     MEDCOUPLING_EXPORT int getNumberOfTuples() const { return _nb_of_tuples; }
     MEDCOUPLING_EXPORT int getNbOfElems() const { return _info_on_compo.size()*_nb_of_tuples; }
index 1b4b88e923341bdd11a710349eb1cd7bc41716d9..0062be8b63baf32086bd2901d078ea1ee5a305e1 100644 (file)
@@ -407,6 +407,155 @@ std::vector<std::string> MEDLoader::GetMeshGroupsNames(const char *fileName, con
   MEDfermer(fid);
   return ret;
 }
+std::vector<ParaMEDMEM::TypeOfField> MEDLoader::GetTypesOfField(const char *fileName, const char *fieldName, const char *meshName) throw(INTERP_KERNEL::Exception)
+{
+  CheckFileForRead(fileName);
+  std::vector<ParaMEDMEM::TypeOfField> ret;
+  med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
+  med_int nbFields=MEDnChamp(fid,0);
+  //
+  med_type_champ typcha;
+  //med_int nbpdtnor=0,pflsize,*pflval,lnsize;
+  med_int ngauss=0;
+  med_int numdt=0,numo=0,nbrefmaa;
+  med_float dt=0.0;
+  med_booleen local;
+  //char pflname[MED_TAILLE_NOM+1]="";
+  //char locname[MED_TAILLE_NOM+1]="";
+  char *maa_ass=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
+  char *dt_unit=MEDLoaderBase::buildEmptyString(MED_TAILLE_PNOM);
+  char *nomcha=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
+  //
+  for(int i=0;i<nbFields;i++)
+    {
+      med_int ncomp=MEDnChamp(fid,i+1);
+      char *comp=new char[ncomp*MED_TAILLE_PNOM+1];
+      char *unit=new char[ncomp*MED_TAILLE_PNOM+1];
+      MEDchampInfo(fid,i+1,nomcha,&typcha,comp,unit,ncomp);
+      std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_TAILLE_NOM+1);
+      delete [] comp;
+      delete [] unit;
+      if(curFieldName==fieldName)
+        {
+          med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_NOEUD,MED_NONE);
+          if(nbPdt>0)
+            {
+              bool found=false;
+              for(int i=0;i<nbPdt && !found;i++)
+                {
+                  MEDpasdetempsInfo(fid,nomcha,MED_NOEUD,MED_NONE,1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
+                  std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_TAILLE_NOM+1);
+                  if(curMeshName==meshName)
+                    {
+                      ret.push_back(ON_NODES);
+                      found=true;
+                    }
+                }
+            }
+          bool found=false;
+          for(int j=0;j<MED_NBR_GEOMETRIE_MAILLE+2 && !found;j++)
+            {
+              med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_MAILLE,typmai[j]);
+              if(nbPdt>0)
+                {
+                  MEDpasdetempsInfo(fid,nomcha,MED_MAILLE,typmai[j],1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
+                  std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_TAILLE_NOM+1);
+                  if(curMeshName==meshName)
+                    {
+                      found=true;
+                      ret.push_back(ON_CELLS);
+                    }
+                }
+            }
+        }
+    }
+  delete [] maa_ass;
+  delete [] dt_unit;
+  delete [] nomcha;
+  MEDfermer(fid);
+  return ret;
+}
+
+std::vector<std::string> MEDLoader::GetAllFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
+{
+  CheckFileForRead(fileName);
+  std::vector<std::string> ret;
+  med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
+  med_int nbFields=MEDnChamp(fid,0);
+  //
+  med_type_champ typcha;
+  //med_int nbpdtnor=0,pflsize,*pflval,lnsize;
+  med_int ngauss=0;
+  med_int numdt=0,numo=0,nbrefmaa;
+  med_float dt=0.0;
+  med_booleen local;
+  //char pflname[MED_TAILLE_NOM+1]="";
+  //char locname[MED_TAILLE_NOM+1]="";
+  char *maa_ass=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
+  char *dt_unit=MEDLoaderBase::buildEmptyString(MED_TAILLE_PNOM);
+  char *nomcha=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
+  //
+  for(int i=0;i<nbFields;i++)
+    {
+      med_int ncomp=MEDnChamp(fid,i+1);
+      char *comp=new char[ncomp*MED_TAILLE_PNOM+1];
+      char *unit=new char[ncomp*MED_TAILLE_PNOM+1];
+      MEDchampInfo(fid,i+1,nomcha,&typcha,comp,unit,ncomp);
+      std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_TAILLE_NOM+1);
+      delete [] comp;
+      delete [] unit;
+      //
+      med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_NOEUD,MED_NONE);
+      bool found=false;
+      if(nbPdt>0)
+        {    
+          for(int i=0;i<nbPdt && !found;i++)
+            {
+              MEDpasdetempsInfo(fid,nomcha,MED_NOEUD,MED_NONE,i+1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
+              std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_TAILLE_NOM+1);
+              if(curMeshName==meshName)
+                {
+                  found=true;
+                  ret.push_back(curFieldName);
+                }
+            }
+        }
+      //
+      for(int j=0;j<MED_NBR_GEOMETRIE_MAILLE+2 && !found;j++)
+        {
+          med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_MAILLE,typmai[j]);
+          if(nbPdt>0)
+            {
+              MEDpasdetempsInfo(fid,nomcha,MED_MAILLE,typmai[j],1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
+              std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_TAILLE_NOM+1);
+              if(curMeshName==meshName)
+                {
+                  found=true;
+                  ret.push_back(curFieldName);
+                }
+            }
+        }
+    }
+  delete [] maa_ass;
+  delete [] dt_unit;
+  delete [] nomcha;
+  MEDfermer(fid);
+  return ret;
+}
+
+std::vector<std::string> MEDLoader::GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
+{
+  CheckFileForRead(fileName);
+  switch(type)
+    {
+    case ON_CELLS:
+      return GetCellFieldNamesOnMesh(fileName,meshName);
+    case ON_NODES:
+      return GetNodeFieldNamesOnMesh(fileName,meshName);
+    default:
+      throw INTERP_KERNEL::Exception("Type of field specified not managed ! manages are ON_NODES or ON_CELLS !");
+    } 
+}
 
 std::vector<std::string> MEDLoader::GetCellFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
 {
@@ -515,7 +664,7 @@ std::vector< std::pair<int,int> > MEDLoader::GetFieldIterations(ParaMEDMEM::Type
       return GetNodeFieldIterations(fileName,meshName,fieldName);
     default:
       throw INTERP_KERNEL::Exception("Type of field specified not managed ! manages are ON_NODES or ON_CELLS !");
-    } 
+    }
 }
 
 std::vector< std::pair<int,int> > MEDLoader::GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
@@ -617,6 +766,11 @@ std::vector< std::pair<int,int> > MEDLoader::GetNodeFieldIterations(const char *
   return ret;
 }
 
+/*!
+ * This method reads all the content of a field 'fieldName' at a time specified by (iteration,order) lying on a mesh 'meshName' with a specified type 'TypeOfOutField'
+ * The returned values are strored in 'field' (sorted by type of cell), time corresponding to field, and 'infos' to load properly little strings.
+ * The principle of this method is to put into 'field' only data that fulfills \b perfectly request.
+ */
 void MEDLoaderNS::readFieldDoubleDataInMedFile(const char *fileName, const char *meshName, const char *fieldName, 
                                                int iteration, int order, ParaMEDMEM::TypeOfField typeOfOutField,
                                                std::list<MEDLoader::MEDFieldDoublePerCellType>& field,
@@ -2334,6 +2488,9 @@ void MEDLoader::WriteUMeshes(const char *fileName, const std::vector<const ParaM
     }
   if(meshes.empty())
     throw INTERP_KERNEL::Exception("List of meshes must be not empty !");
+  std::string meshName(meshes[0]->getName());
+  if(meshName.empty())
+    throw INTERP_KERNEL::Exception("Trying to write a unstructured mesh with no name ! MED file format needs a not empty mesh name : change name of first element of 2nd parameter !");
   DataArrayDouble *coords=meshes.front()->getCoords();
   for(std::vector<const ParaMEDMEM::MEDCouplingUMesh *>::const_iterator iter=meshes.begin();iter!=meshes.end();iter++)
     if(coords!=(*iter)->getCoords())
index f302c023c34987f20e931b61ef2e4a23c754f144..48d95e6c58de1f2de30655f37dde899bc9514236 100644 (file)
@@ -89,6 +89,9 @@ class MEDLOADER_EXPORT MEDLoader
   static std::vector<std::string> GetMeshNames(const char *fileName) throw(INTERP_KERNEL::Exception);
   static std::vector<std::string> GetMeshGroupsNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
   static std::vector<std::string> GetMeshFamiliesNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
+  static std::vector<std::string> GetAllFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
+  static std::vector<ParaMEDMEM::TypeOfField> GetTypesOfField(const char *fileName, const char *fieldName, const char *meshName) throw(INTERP_KERNEL::Exception);
+  static std::vector<std::string> GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
   static std::vector<std::string> GetCellFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
   static std::vector<std::string> GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
   static std::vector< std::pair<int,int> > GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception);
index 1b1103bed9bd143c23689808ab77ca76e4571c4f..ad9472fd1c98314e91fe97c640f94df99dc764d7 100644 (file)
@@ -387,6 +387,58 @@ class MEDLoaderTest(unittest.TestCase):
         f2=MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),-1,f1.getName(),2,7);
         self.assertTrue(f2.isEqual(f1,1e-12,1e-12));
         pass
+
+    def testMixCellAndNodesFieldRW1(self):
+        fileName="Pyfile21.med";
+        mesh=MEDLoaderDataForTest.build3DSurfMesh_1();
+        f1=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
+        f1.setName("FieldMix");
+        f1.setMesh(mesh);
+        array=DataArrayDouble.New();
+        f1.setArray(array);
+        arr1=[71.,171.,10.,110.,20.,120.,30.,130.,40.,140.,50.,150.]
+        array.setValues(arr1,6,2);
+        array.setInfoOnComponent(0,"plkj (mm)");
+        array.setInfoOnComponent(1,"pqqqss (mm)");
+        f1.setTime(3.14,2,7);
+        f1.checkCoherency();
+        #
+        f2=MEDCouplingFieldDouble.New(ON_NODES,ONE_TIME);
+        f2.setName("FieldMix");
+        f2.setMesh(mesh);
+        array=DataArrayDouble.New();
+        f2.setArray(array);
+        arr2=[1071.,1171.,1010.,1110.,1020.,1120.,1030.,1130.,1040.,1140.,1050.,1150.,
+              1060.,1160.,1070.,1170.,1080.,1180.,1090.,1190.,1091.,1191.,1092.,1192.]
+        array.setValues(arr2,12,2)
+        array.setInfoOnComponent(0,"plkj (mm)");
+        array.setInfoOnComponent(1,"pqqqss (mm)");
+        f2.setTime(3.17,2,7);
+        f2.checkCoherency();
+        #
+        MEDLoader.WriteField(fileName,f1,True);
+        ts=MEDLoader.GetTypesOfField(fileName,f1.getName(),f1.getMesh().getName());
+        self.assertEqual(1,len(ts));
+        self.assertEqual(ON_CELLS,ts[0]);
+        fs=MEDLoader.GetAllFieldNamesOnMesh(fileName,f1.getMesh().getName());
+        self.assertEqual(1,len(fs));
+        self.assertTrue(fs[0]=="FieldMix");
+        MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f2);
+        fs=MEDLoader.GetAllFieldNamesOnMesh(fileName,f1.getMesh().getName());
+        self.assertEqual(1,len(fs));
+        self.assertTrue(fs[0]=="FieldMix");
+        #
+        ts=MEDLoader.GetTypesOfField(fileName,f1.getName(),f1.getMesh().getName());
+        self.assertEqual(2,len(ts));
+        self.assertEqual(ON_NODES,ts[0]);
+        self.assertEqual(ON_CELLS,ts[1]);
+        #
+        f3=MEDLoader.ReadFieldNode(fileName,f1.getMesh().getName(),0,f1.getName(),2,7);
+        self.assertTrue(f3.isEqual(f2,1e-12,1e-12));
+        f3=MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),2,7);
+        self.assertTrue(f3.isEqual(f1,1e-12,1e-12));
+        #
+        pass
     pass
 
 unittest.main()
index 37648ec844542cc8a053820927288093ab7a75f2..f9144f47f9bad0724489262ddebe9b3c22ec0aa5 100644 (file)
@@ -52,6 +52,8 @@ public:
   static std::vector<std::string> GetMeshNames(const char *fileName) throw(INTERP_KERNEL::Exception);
   static std::vector<std::string> GetMeshGroupsNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
   static std::vector<std::string> GetMeshFamiliesNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
+  static std::vector<std::string> GetAllFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
+  static std::vector<std::string> GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
   static std::vector<std::string> GetCellFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
   static std::vector<std::string> GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
   %extend
@@ -122,6 +124,15 @@ public:
          std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v2(v.begin(),v.end());
          MEDLoader::WriteUMeshes(fileName,v2,writeFromScratch);
        }
+       static PyObject *GetTypesOfField(const char *fileName, const char *fieldName, const char *meshName) throw(INTERP_KERNEL::Exception)
+       {
+         std::vector< ParaMEDMEM::TypeOfField > v=MEDLoader::GetTypesOfField(fileName,fieldName,meshName);
+         int size=v.size();
+         PyObject *ret=PyList_New(size);
+         for(int i=0;i<size;i++)
+           PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
+         return ret;
+       }
      }
   static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const char *fileName, const char *meshName, int meshDimRelToMax, const std::vector<std::string>& fams) throw(INTERP_KERNEL::Exception);
   static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const char *fileName, const char *meshName, int meshDimRelToMax, const std::vector<std::string>& grps) throw(INTERP_KERNEL::Exception);
index b5da3bfd5af6d3028386e10e21f97dbf0451b1e4..a62bc1be3b85b15b5acd12c59c70e62c782a4999 100644 (file)
@@ -588,6 +588,72 @@ void MEDLoaderTest::testWriteUMeshesRW1()
   m3d->decrRef();
 }
 
+void MEDLoaderTest::testMixCellAndNodesFieldRW1()
+{
+  const char fileName[]="file21.med";
+  MEDCouplingUMesh *mesh=build3DSurfMesh_1();
+  MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+  f1->setName("FieldMix");
+  f1->setMesh(mesh);
+  DataArrayDouble *array=DataArrayDouble::New();
+  array->alloc(6,2);
+  f1->setArray(array);
+  array->setInfoOnComponent(0,"plkj (mm)");
+  array->setInfoOnComponent(1,"pqqqss (mm)");
+  array->decrRef();
+  double *tmp=array->getPointer();
+  const double arr1[12]={71.,171.,10.,110.,20.,120.,30.,130.,40.,140.,50.,150.};
+  std::copy(arr1,arr1+12,tmp);
+  f1->setTime(3.14,2,7);
+  f1->checkCoherency();
+  //
+  MEDCouplingFieldDouble *f2=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME);
+  f2->setName("FieldMix");
+  f2->setMesh(mesh);
+  array=DataArrayDouble::New();
+  array->alloc(12,2);
+  f2->setArray(array);
+  array->setInfoOnComponent(0,"plkj (mm)");
+  array->setInfoOnComponent(1,"pqqqss (mm)");
+  array->decrRef();
+  tmp=array->getPointer();
+  const double arr2[24]={
+    1071.,1171.,1010.,1110.,1020.,1120.,1030.,1130.,1040.,1140.,1050.,1150.,
+    1060.,1160.,1070.,1170.,1080.,1180.,1090.,1190.,1091.,1191.,1092.,1192.
+  };
+  std::copy(arr2,arr2+24,tmp);
+  f2->setTime(3.17,2,7);
+  f2->checkCoherency();
+  //
+  MEDLoader::WriteField(fileName,f1,true);
+  std::vector<ParaMEDMEM::TypeOfField> ts=MEDLoader::GetTypesOfField(fileName,f1->getName(),f1->getMesh()->getName());
+  CPPUNIT_ASSERT_EQUAL(1,(int)ts.size());
+  CPPUNIT_ASSERT_EQUAL(ON_CELLS,ts[0]);
+  std::vector<std::string> fs=MEDLoader::GetAllFieldNamesOnMesh(fileName,f1->getMesh()->getName());
+  CPPUNIT_ASSERT_EQUAL(1,(int)fs.size());
+  CPPUNIT_ASSERT(fs[0]=="FieldMix");
+  MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f2);
+  fs=MEDLoader::GetAllFieldNamesOnMesh(fileName,f1->getMesh()->getName());
+  CPPUNIT_ASSERT_EQUAL(1,(int)fs.size());
+  CPPUNIT_ASSERT(fs[0]=="FieldMix");
+  //
+  ts=MEDLoader::GetTypesOfField(fileName,f1->getName(),f1->getMesh()->getName());
+  CPPUNIT_ASSERT_EQUAL(2,(int)ts.size());
+  CPPUNIT_ASSERT_EQUAL(ON_NODES,ts[0]);
+  CPPUNIT_ASSERT_EQUAL(ON_CELLS,ts[1]);
+  //
+  MEDCouplingFieldDouble *f3=MEDLoader::ReadFieldNode(fileName,f1->getMesh()->getName(),0,f1->getName(),2,7);
+  CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12));
+  f3->decrRef();
+  f3=MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName(),0,f1->getName(),2,7);
+  CPPUNIT_ASSERT(f3->isEqual(f1,1e-12,1e-12));
+  f3->decrRef();
+  //
+  f1->decrRef();
+  f2->decrRef();
+  mesh->decrRef();
+}
+
 MEDCouplingUMesh *MEDLoaderTest::build1DMesh_1()
 {
   double coords[6]={ 0.0, 0.3, 0.75, 1.0, 1.4, 1.3 };
index 2b508205ad13740eb0946ba628f30d226b138541..0863ad1dfa6874e444c55fe409721d431ffc4bfd 100644 (file)
@@ -48,6 +48,7 @@ namespace ParaMEDMEM
     CPPUNIT_TEST( testFieldShuffleRW1 );
     CPPUNIT_TEST( testMultiFieldShuffleRW1 );
     CPPUNIT_TEST( testWriteUMeshesRW1 );
+    CPPUNIT_TEST( testMixCellAndNodesFieldRW1 );
     CPPUNIT_TEST_SUITE_END();
   public:
     void testMesh1DRW();
@@ -68,6 +69,7 @@ namespace ParaMEDMEM
     void testFieldShuffleRW1();
     void testMultiFieldShuffleRW1();
     void testWriteUMeshesRW1();
+    void testMixCellAndNodesFieldRW1();
   private:
     MEDCouplingUMesh *build1DMesh_1();
     MEDCouplingUMesh *build2DCurveMesh_1();