From: Anthony Geay Date: Tue, 28 Aug 2018 15:04:39 +0000 (+0200) Subject: Finish to propagate the API modification of ReadField X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=937b9204c0a5e87f57a48757a054215e0fab2155;p=tools%2Fmedcoupling.git Finish to propagate the API modification of ReadField --- diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx index 061bea001..272303a1c 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx @@ -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 f2=ReadField((MEDCoupling::TypeOfField) typeField, - fileName, meshName, 0, fieldName, DT, IT); + + MCAuto f2Tmp(ReadField((MEDCoupling::TypeOfField) typeField, fileName, meshName, 0, fieldName, DT, IT)); + MCAuto f2(MEDCoupling::DynamicCast(f2Tmp)); MEDCoupling::DataArrayDouble* res=f2->getArray(); //to know names of components diff --git a/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.cxx b/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.cxx index 2a840a350..e496ace68 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.cxx @@ -285,7 +285,7 @@ int MEDPARTITIONER::ParaDomainSelector::getProcNodeShift() const /*! * \brief Gather graphs from all processors into one */ -std::auto_ptr MEDPARTITIONER::ParaDomainSelector::gatherGraph(const Graph* graph) const +std::unique_ptr MEDPARTITIONER::ParaDomainSelector::gatherGraph(const Graph* graph) const { Graph* glob_graph = 0; @@ -382,7 +382,7 @@ std::auto_ptr MEDPARTITIONER::ParaDomainSelector::gatherG #endif // HAVE_MPI - return std::auto_ptr( glob_graph ); + return std::unique_ptr( glob_graph ); } diff --git a/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.hxx b/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.hxx index 97502406f..9fde64b3f 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.hxx @@ -77,7 +77,7 @@ namespace MEDPARTITIONER int getDomainNodeShift(int domainIndex) const; //Gather graphs from all processors into one - std::auto_ptr gatherGraph(const Graph* graph) const; + std::unique_ptr 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 ); diff --git a/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx b/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx index 2329b41e9..6b25be16f 100644 --- a/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx +++ b/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx @@ -649,7 +649,8 @@ void MEDPARTITIONERTest::createTestMeshWithVecFieldOnCells() if (_verbose) cout< f2=ReadFieldCell(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1); + MCAuto f2Tmp(ReadFieldCell(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1)); + MCAuto f2(MEDCoupling::DynamicCast(f2Tmp)); //DataArrayDouble *res=f2->getArray(); if (_verbose) cout<isEqual(f2,1e-12,1e-12)); @@ -706,7 +707,8 @@ void MEDPARTITIONERTest::createTestMeshWithVecFieldOnCells() f1->decrRef(); if (_ntot<1000000) //too long { - MCAuto f4=ReadField(ON_GAUSS_NE, name.c_str(), f3->getMesh()->getName().c_str(), 0, "MyFieldOnGaussNE", 5, 6); + MCAuto f4Tmp(ReadField(ON_GAUSS_NE, name.c_str(), f3->getMesh()->getName().c_str(), 0, "MyFieldOnGaussNE", 5, 6)); + MCAuto f4(MEDCoupling::DynamicCast(f4Tmp)); if (_verbose) cout<<"MyFieldOnGaussNE reread"<decrRef(); @@ -719,7 +721,8 @@ void MEDPARTITIONERTest::createTestMeshWithVecFieldOnCells() if (_verbose) cout< f2=ReadFieldCell(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1); + MCAuto f2Tmp=ReadFieldCell(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1); + MCAuto f2(MEDCoupling::DynamicCast(f2Tmp)); if (_verbose) cout<isEqual(f2,1e-12,1e-12)); assertion failed!! } @@ -736,7 +739,7 @@ void MEDPARTITIONERTest::createTestMeshWithVecFieldOnNodes() if (_verbose) cout< f2=ReadFieldNode(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1); + MCAuto f2=ReadFieldNode(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1); if (_verbose) cout<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 field1=ReadFieldCell(fileName.c_str(),initialMesh->getName().c_str(),0,"VectorFieldOnCells",0,1); - MCAuto field2=ReadFieldCell(refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"VectorFieldOnCells",0,1); + MCAuto field1Tmp(ReadFieldCell(fileName.c_str(),initialMesh->getName().c_str(),0,"VectorFieldOnCells",0,1)); + MCAuto field2Tmp(ReadFieldCell(refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"VectorFieldOnCells",0,1)); + MCAuto field1(MEDCoupling::DynamicCast(field1Tmp)),field2(MEDCoupling::DynamicCast(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 field1=ReadField(ON_GAUSS_NE,fileName.c_str(),initialMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6); - MCAuto field2=ReadField(ON_GAUSS_NE,refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6); + MCAuto field1Tmp=ReadField(ON_GAUSS_NE,fileName.c_str(),initialMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6); + MCAuto field2Tmp=ReadField(ON_GAUSS_NE,refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6); + MCAuto field1(MEDCoupling::DynamicCast(field1Tmp)),field2(MEDCoupling::DynamicCast(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