Salome HOME
6th step : Remove the additional MEDLoader level from MEDLoader.
[tools/medcoupling.git] / src / MEDPartitioner / MEDPARTITIONER_Utils.cxx
index 6fd6a42eaffe11ecf38f16f9d110e7034a4ea555..51543f52f97c52ac37423abdf1a066a87f21ccac 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2015  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
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -45,6 +45,7 @@ int MEDPARTITIONER::MyGlobals::_World_Size=-1;
 int MEDPARTITIONER::MyGlobals::_Randomize=0;
 int MEDPARTITIONER::MyGlobals::_Atomize=0;
 int MEDPARTITIONER::MyGlobals::_Creates_Boundary_Faces=0;
+int MEDPARTITIONER::MyGlobals::_Create_Joints=0;
 std::vector<std::string> MEDPARTITIONER::MyGlobals::_File_Names;
 std::vector<std::string> MEDPARTITIONER::MyGlobals::_Mesh_Names;
 std::vector<std::string> MEDPARTITIONER::MyGlobals::_Field_Descriptions;
@@ -505,17 +506,17 @@ void MEDPARTITIONER::FieldShortDescriptionToData(const std::string& description,
   IT=StrToInt(ExtractFromDescription(description,"IT="));
 }
 
-ParaMEDMEM::DataArrayInt *MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector<int>& v)
+MEDCoupling::DataArrayInt *MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector<int>& v)
 {
-  ParaMEDMEM::DataArrayInt* p=ParaMEDMEM::DataArrayInt::New();
+  MEDCoupling::DataArrayInt* p=MEDCoupling::DataArrayInt::New();
   p->alloc(v.size(),1);
   std::copy(v.begin(),v.end(),p->getPointer());
   return p;
 }
 
-ParaMEDMEM::DataArrayInt *MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector<int>& v,const int nbComponents)
+MEDCoupling::DataArrayInt *MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector<int>& v,const int nbComponents)
 {
-  ParaMEDMEM::DataArrayInt* p=ParaMEDMEM::DataArrayInt::New();
+  MEDCoupling::DataArrayInt* p=MEDCoupling::DataArrayInt::New();
   if (v.size()%nbComponents!=0)
     throw INTERP_KERNEL::Exception("Problem size modulo nbComponents != 0");
   p->alloc(v.size()/nbComponents,nbComponents);
@@ -523,9 +524,9 @@ ParaMEDMEM::DataArrayInt *MEDPARTITIONER::CreateDataArrayIntFromVector(const std
   return p;
 }
 
-ParaMEDMEM::DataArrayDouble* MEDPARTITIONER::CreateDataArrayDoubleFromVector(const std::vector<double>& v)
+MEDCoupling::DataArrayDouble* MEDPARTITIONER::CreateDataArrayDoubleFromVector(const std::vector<double>& v)
 {
-  ParaMEDMEM::DataArrayDouble* p=ParaMEDMEM::DataArrayDouble::New();
+  MEDCoupling::DataArrayDouble* p=MEDCoupling::DataArrayDouble::New();
   p->alloc(v.size(),1);
   std::copy(v.begin(),v.end(),p->getPointer());
   return p;
@@ -533,7 +534,7 @@ ParaMEDMEM::DataArrayDouble* MEDPARTITIONER::CreateDataArrayDoubleFromVector(con
 
 /*!
  */
-std::vector<std::string> MEDPARTITIONER::BrowseFieldDouble(const ParaMEDMEM::MEDCouplingFieldDouble* fd)
+std::vector<std::string> MEDPARTITIONER::BrowseFieldDouble(const MEDCoupling::MEDCouplingFieldDouble* fd)
 {
   std::vector<std::string> res;
   if (fd->getArray())
@@ -559,20 +560,20 @@ std::vector<std::string> MEDPARTITIONER::BrowseFieldDouble(const ParaMEDMEM::MED
 std::vector<std::string> MEDPARTITIONER::BrowseAllFields(const std::string& myfile)
 {
   std::vector<std::string> res;
-  std::vector<std::string> meshNames=MEDLoader::GetMeshNames(myfile);
+  std::vector<std::string> meshNames=MEDCoupling::GetMeshNames(myfile);
   
   for (std::size_t i=0; i<meshNames.size(); i++)
     {
       std::vector<std::string> fieldNames=
-        MEDLoader::GetAllFieldNamesOnMesh(myfile,meshNames[i]);
+        MEDCoupling::GetAllFieldNamesOnMesh(myfile,meshNames[i]);
       for (std::size_t j = 0; j < fieldNames.size(); j++)
         {
-          std::vector< ParaMEDMEM::TypeOfField > typeFields=
-            MEDLoader::GetTypesOfField(myfile, meshNames[i], fieldNames[j]);
+          std::vector< MEDCoupling::TypeOfField > typeFields=
+            MEDCoupling::GetTypesOfField(myfile, meshNames[i], fieldNames[j]);
           for (std::size_t k = 0; k < typeFields.size(); k++)
             {
               std::vector< std::pair< int, int > > its=
-                MEDLoader::GetFieldIterations(typeFields[k], myfile, meshNames[i], fieldNames[j]);
+                GetFieldIterations(typeFields[k], myfile, meshNames[i], fieldNames[j]);
               if (MyGlobals::_Is0verbose>100)
                 std::cout<< "fieldName " << fieldNames[j] << " typeField " << typeFields[k] << " its.size() " << its.size() << std::endl;
               for (std::size_t m = 0; m < its.size(); m++)
@@ -726,7 +727,7 @@ std::vector<std::string> MEDPARTITIONER::GetInfosOfField(const char *fileName, c
                           resi.push_back("fileName="); resi.back()+=fileName;
                           resi.push_back("meshName="); resi.back()+=curMeshName;
                           resi.push_back("fieldName="); resi.back()+=curFieldName;
-                          resi.push_back("typeField="); resi.back()+=IntToStr((int)ParaMEDMEM::ON_NODES);
+                          resi.push_back("typeField="); resi.back()+=IntToStr((int)MEDCoupling::ON_NODES);
                           resi.push_back("typeData="); resi.back()+=IntToStr((int)typcha);  //6 for double?
                           resi.push_back("nbComponent="); resi.back()+=IntToStr((int)ncomp);
                           resi.push_back("DT="); resi.back()+=IntToStr((int)numdt);
@@ -756,9 +757,9 @@ std::vector<std::string> MEDPARTITIONER::GetInfosOfField(const char *fileName, c
                               nbOfVal << " profilName '" << pflname << "' profileSize " << profilesize << " nbPtGauss " << nbi << std::endl;
                           int typeField=-1; //unknown
                           if (enttype==MED_CELL)
-                            typeField=ParaMEDMEM::ON_CELLS;
+                            typeField=MEDCoupling::ON_CELLS;
                           if (enttype==MED_NODE_ELEMENT)
-                            typeField=ParaMEDMEM::ON_GAUSS_NE;
+                            typeField=MEDCoupling::ON_GAUSS_NE;
                           //if (enttype==??) typeField=ON_GAUSS_PT;
                           std::vector<std::string> resi;
                           resi.push_back("idomain="); resi.back()+=IntToStr(idomain);
@@ -812,13 +813,13 @@ std::vector<std::string> MEDPARTITIONER::BrowseAllFieldsOnMesh(const std::string
 /*!
  * create empty MEDCouplingUMesh* dim 3
  */
-ParaMEDMEM::MEDCouplingUMesh* MEDPARTITIONER::CreateEmptyMEDCouplingUMesh()
+MEDCoupling::MEDCouplingUMesh* MEDPARTITIONER::CreateEmptyMEDCouplingUMesh()
 {
-  ParaMEDMEM::MEDCouplingUMesh* umesh=ParaMEDMEM::MEDCouplingUMesh::New();
+  MEDCoupling::MEDCouplingUMesh* umesh=MEDCoupling::MEDCouplingUMesh::New();
   umesh->setMeshDimension(3);
   umesh->allocateCells(0);
   umesh->finishInsertingCells();
-  ParaMEDMEM::DataArrayDouble *myCoords=ParaMEDMEM::DataArrayDouble::New();
+  MEDCoupling::DataArrayDouble *myCoords=MEDCoupling::DataArrayDouble::New();
   myCoords->alloc(0,3);
   umesh->setCoords(myCoords);
   umesh->setName("EMPTY");