]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Finish to propagate the API modification of ReadField agy/TinyImps
authorAnthony Geay <anthony.geay@edf.fr>
Tue, 28 Aug 2018 15:04:39 +0000 (17:04 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Tue, 28 Aug 2018 15:04:39 +0000 (17:04 +0200)
src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx
src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.cxx
src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.hxx
src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx

index 061bea0010defd0b9067bc822107d7d3804ab4c4..272303a1c2cb7320936dfa622b1435ac5970ff28 100644 (file)
@@ -2273,9 +2273,9 @@ MEDCoupling::DataArrayDouble *MEDPARTITIONER::MeshCollection::getField(std::stri
     std::cout << "proc " << MyGlobals::_Rank << " : in " << fileName << " " << iold << " " << descriptionIold << std::endl;
   FieldShortDescriptionToData(descriptionIold, fieldName, typeField, entity, DT, IT);
   meshName=MyGlobals::_Mesh_Names[iold];
-  
-  MEDCoupling::MCAuto<MEDCoupling::MEDCouplingFieldDouble> f2=ReadField((MEDCoupling::TypeOfField) typeField,
-                                                                        fileName, meshName, 0, fieldName, DT, IT);
+
+  MCAuto<MEDCoupling::MEDCouplingField> f2Tmp(ReadField((MEDCoupling::TypeOfField) typeField, fileName, meshName, 0, fieldName, DT, IT));
+  MCAuto<MEDCoupling::MEDCouplingFieldDouble> f2(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(f2Tmp));
   
   MEDCoupling::DataArrayDouble* res=f2->getArray();
   //to know names of components
index 2a840a350dcc6a16c0cc42f0a6886c47c608f0f5..e496ace68626a97ad442856adf3dae384258f64c 100644 (file)
@@ -285,7 +285,7 @@ int MEDPARTITIONER::ParaDomainSelector::getProcNodeShift() const
 /*!
  * \brief Gather graphs from all processors into one
  */
-std::auto_ptr<MEDPARTITIONER::Graph> MEDPARTITIONER::ParaDomainSelector::gatherGraph(const Graph* graph) const
+std::unique_ptr<MEDPARTITIONER::Graph> MEDPARTITIONER::ParaDomainSelector::gatherGraph(const Graph* graph) const
 {
   Graph* glob_graph = 0;
 
@@ -382,7 +382,7 @@ std::auto_ptr<MEDPARTITIONER::Graph> MEDPARTITIONER::ParaDomainSelector::gatherG
 
 #endif // HAVE_MPI
 
-  return std::auto_ptr<Graph>( glob_graph );
+  return std::unique_ptr<Graph>( glob_graph );
 }
 
 
index 97502406f36cb3ed441c931b90a596adff9433e5..9fde64b3f06db20f0368e0cc347723ed80c59d54 100644 (file)
@@ -77,7 +77,7 @@ namespace MEDPARTITIONER
     int getDomainNodeShift(int domainIndex) const;
 
     //Gather graphs from all processors into one
-    std::auto_ptr<Graph> gatherGraph(const Graph* graph) const;
+    std::unique_ptr<Graph> gatherGraph(const Graph* graph) const;
 
     //Set nb of cell/cell pairs in a joint between domains
     void setNbCellPairs( int nb_cell_pairs, int dist_domain, int loc_domain );
index 2329b41e968f0ef649f85dc42b0469a92a1b620e..6b25be16ffe5d92cb7a849678bcbaa56bd717ec7 100644 (file)
@@ -649,7 +649,8 @@ void MEDPARTITIONERTest::createTestMeshWithVecFieldOnCells()
     if (_verbose) cout<<endl<<name<<" created"<<endl;
     if (_ntot<1000000) //too long
       {
-        MCAuto<MEDCouplingFieldDouble> f2=ReadFieldCell(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1);
+        MCAuto<MEDCoupling::MEDCouplingField> f2Tmp(ReadFieldCell(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1));
+        MCAuto<MEDCoupling::MEDCouplingFieldDouble> f2(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(f2Tmp));
         //DataArrayDouble *res=f2->getArray();
         if (_verbose) cout<<name<<" reread"<<endl;
         //CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12));
@@ -706,7 +707,8 @@ void MEDPARTITIONERTest::createTestMeshWithVecFieldOnCells()
     f1->decrRef();
     if (_ntot<1000000) //too long
       {
-        MCAuto<MEDCouplingFieldDouble> f4=ReadField(ON_GAUSS_NE, name.c_str(), f3->getMesh()->getName().c_str(), 0, "MyFieldOnGaussNE", 5, 6);
+        MCAuto<MEDCoupling::MEDCouplingField> f4Tmp(ReadField(ON_GAUSS_NE, name.c_str(), f3->getMesh()->getName().c_str(), 0, "MyFieldOnGaussNE", 5, 6));
+        MCAuto<MEDCoupling::MEDCouplingFieldDouble> f4(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(f4Tmp));
         if (_verbose) cout<<"MyFieldOnGaussNE reread"<<endl;
       }
     f3->decrRef();
@@ -719,7 +721,8 @@ void MEDPARTITIONERTest::createTestMeshWithVecFieldOnCells()
     if (_verbose) cout<<endl<<name<<" created"<<endl;
     if (_ntot<1000000) //too long
       {
-        MCAuto<MEDCouplingFieldDouble> f2=ReadFieldCell(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1);
+        MCAuto<MEDCouplingField> f2Tmp=ReadFieldCell(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1);
+        MCAuto<MEDCoupling::MEDCouplingFieldDouble> f2(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(f2Tmp));
         if (_verbose) cout<<name<<" reread"<<endl;
         //CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); assertion failed!!
       }
@@ -736,7 +739,7 @@ void MEDPARTITIONERTest::createTestMeshWithVecFieldOnNodes()
   if (_verbose) cout<<endl<<name<<" created"<<endl;
   if (_ntot<1000000) //too long
     {
-      MCAuto<MEDCouplingFieldDouble> f2=ReadFieldNode(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1);
+      MCAuto<MEDCouplingField> f2=ReadFieldNode(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1);
       if (_verbose) cout<<name<<" reread"<<endl;
       //CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); assertion failed!!
     }
@@ -879,7 +882,7 @@ void MEDPARTITIONERTest::testMeshCollectionComplexPartitionMetis()
   for (int ndomains=2 ; ndomains<=16 ; ndomains++)
     {
       //Creating the graph and partitioning it
-      auto_ptr< MEDPARTITIONER::Topology > new_topo;
+      std::unique_ptr< MEDPARTITIONER::Topology > new_topo;
       new_topo.reset( collection.createPartition(ndomains,MEDPARTITIONER::Graph::METIS) );
       //Creating a new mesh collection from the partitioning
       MEDPARTITIONER::MeshCollection new_collection(collection,new_topo.get(),split_family,empty_groups);
@@ -925,7 +928,7 @@ void MEDPARTITIONERTest::testMeshCollectionSinglePartitionScotch()
   MEDPARTITIONER::ParallelTopology* aPT = (MEDPARTITIONER::ParallelTopology*) collection.getTopology();
   aPT->setGlobalNumerotationDefault(collection.getParaDomainSelector());
   //Creating the graph and partitioning it
-  auto_ptr< MEDPARTITIONER::Topology > new_topo;
+  std::unique_ptr< MEDPARTITIONER::Topology > new_topo;
   new_topo.reset( collection.createPartition(ndomains,MEDPARTITIONER::Graph::SCOTCH) );
   //Creating a new mesh collection from the partitioning
   MEDPARTITIONER::MeshCollection new_collection(collection,new_topo.get(),split_family,empty_groups);
@@ -961,7 +964,7 @@ void MEDPARTITIONERTest::testMeshCollectionComplexPartitionScotch()
   for (int ndomains=2 ; ndomains<=16 ; ndomains++)
     {
       //Creating the graph and partitioning it
-      auto_ptr< MEDPARTITIONER::Topology > new_topo;
+      std::unique_ptr< MEDPARTITIONER::Topology > new_topo;
       new_topo.reset( collection.createPartition(ndomains,MEDPARTITIONER::Graph::SCOTCH) );
       //Creating a new mesh collection from the partitioning
       MEDPARTITIONER::MeshCollection new_collection(collection,new_topo.get(),split_family,empty_groups);
@@ -1179,8 +1182,9 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC
   MEDCouplingUMesh* fusedCell=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr);
   CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), fusedCell->getNumberOfCells());
 
-  MCAuto<MEDCouplingFieldDouble> field1=ReadFieldCell(fileName.c_str(),initialMesh->getName().c_str(),0,"VectorFieldOnCells",0,1);
-  MCAuto<MEDCouplingFieldDouble> field2=ReadFieldCell(refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"VectorFieldOnCells",0,1);
+  MCAuto<MEDCouplingField> field1Tmp(ReadFieldCell(fileName.c_str(),initialMesh->getName().c_str(),0,"VectorFieldOnCells",0,1));
+  MCAuto<MEDCouplingField> field2Tmp(ReadFieldCell(refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"VectorFieldOnCells",0,1));
+  MCAuto<MEDCouplingFieldDouble> field1(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(field1Tmp)),field2(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(field2Tmp));
 
   int nbcells=corr[1]->getNumberOfTuples();
   CPPUNIT_ASSERT_EQUAL((int)cellMesh->getNumberOfCells(), nbcells);
@@ -1266,8 +1270,9 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG
   MEDCouplingUMesh* fusedCell=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr);
   CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), fusedCell->getNumberOfCells());
 
-  MCAuto<MEDCouplingFieldDouble> field1=ReadField(ON_GAUSS_NE,fileName.c_str(),initialMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6);
-  MCAuto<MEDCouplingFieldDouble> field2=ReadField(ON_GAUSS_NE,refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6);
+  MCAuto<MEDCouplingField> field1Tmp=ReadField(ON_GAUSS_NE,fileName.c_str(),initialMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6);
+  MCAuto<MEDCouplingField> field2Tmp=ReadField(ON_GAUSS_NE,refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6);
+  MCAuto<MEDCouplingFieldDouble> field1(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(field1Tmp)),field2(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(field2Tmp));
 
   int nbcells=corr[1]->getNumberOfTuples();
   CPPUNIT_ASSERT_EQUAL((int)cellMesh->getNumberOfCells(), nbcells);
@@ -1406,7 +1411,7 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D()
   ParallelTopology* aPT = (ParallelTopology*) collection.getTopology();
   aPT->setGlobalNumerotationDefault(collection.getParaDomainSelector());
 
-  std::auto_ptr< Topology > new_topo;
+  std::unique_ptr< Topology > new_topo;
 #if defined(MED_ENABLE_METIS) || defined(MED_ENABLE_PARMETIS)
   new_topo.reset( collection.createPartition(ndomains,Graph::METIS) );
 #endif