From 6b4a080137bb653c2d7e8d3e9b3e366f8c30e0b9 Mon Sep 17 00:00:00 2001 From: cvw Date: Wed, 21 Mar 2012 14:06:07 +0000 Subject: [PATCH] *** empty log message *** --- .../MEDPARTITIONER_MeshCollection.cxx | 44 ++++++++++++++++++- .../MEDPARTITIONER_MeshCollection.hxx | 5 +++ src/MEDPartitioner/Makefile.am | 43 ++++++++++++++---- src/MEDPartitioner/medpartitioner.cxx | 2 +- src/MEDPartitioner/medpartitioner_para.cxx | 2 +- 5 files changed, 84 insertions(+), 12 deletions(-) diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx index 472bacdeb..ef6f8c323 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx @@ -167,6 +167,18 @@ MEDPARTITIONER::MeshCollection::MeshCollection(MeshCollection& initialCollection if (MyGlobals::_Is0verbose) std::cout << "treating fields" << std::endl; castAllFields(initialCollection,"cellFieldDouble"); + if (_i_non_empty_mesh<0) + { + for (int i=0; i<_mesh.size(); i++) + { + if (_mesh[i]) + { + _i_non_empty_mesh=i; //first existing one local + break; + } + } + } + } /*! @@ -1139,7 +1151,7 @@ MEDPARTITIONER::MeshCollection::~MeshCollection() delete _driver; if (_topology!=0 && _owns_topology) delete _topology; -#ifdef HAVE_MPI2 +#ifdef HAVE_MPI2 delete _joint_finder; #endif } @@ -1203,6 +1215,36 @@ int MEDPARTITIONER::MeshCollection::getMeshDimension() const return _i_non_empty_mesh < 0 ? -1 : _mesh[_i_non_empty_mesh]->getMeshDimension(); } +int MEDPARTITIONER::MeshCollection::getNbOfLocalMeshes() const +{ + int nb=0; + for (int i=0; i<_mesh.size(); i++) + { + if (_mesh[i]) nb++; + } + return nb; +} + +int MEDPARTITIONER::MeshCollection::getNbOfLocalCells() const +{ + int nb=0; + for (int i=0; i<_mesh.size(); i++) + { + if (_mesh[i]) nb=nb+_mesh[i]->getNumberOfCells(); + } + return nb; +} + +int MEDPARTITIONER::MeshCollection::getNbOfLocalFaces() const +{ + int nb=0; + for (int i=0; i<_face_mesh.size(); i++) + { + if (_face_mesh[i]) nb=nb+_face_mesh[i]->getNumberOfCells(); + } + return nb; +} + std::vector& MEDPARTITIONER::MeshCollection::getMesh() { return _mesh; diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx index 989e895cb..cd964147a 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx @@ -82,6 +82,11 @@ namespace MEDPARTITIONER //getting mesh dimension int getMeshDimension() const; + int getNbOfLocalMeshes() const; + int getNbOfGlobalMeshes() const { return _mesh.size(); } + int getNbOfLocalCells() const; + int getNbOfLocalFaces() const; + //getting a reference to mesh vector std::vector& getMesh(); std::vector& getFaceMesh(); diff --git a/src/MEDPartitioner/Makefile.am b/src/MEDPartitioner/Makefile.am index 278c7e56d..06db0a502 100644 --- a/src/MEDPartitioner/Makefile.am +++ b/src/MEDPartitioner/Makefile.am @@ -66,9 +66,15 @@ MEDPARTITIONER_ParaDomainSelector.cxx \ MEDPARTITIONER_ConnectZone.cxx \ MEDPARTITIONER_SkyLineArray.cxx -libmedpartitioner_la_CPPFLAGS = $(MPI_INCLUDES) $(MED3_INCLUDES) $(HDF5_INCLUDES) \ - $(LIBXML_INCLUDES) -I$(srcdir)/../INTERP_KERNEL/Bases -I$(srcdir)/../MEDCoupling \ - -I$(srcdir)/../MEDLoader -I$(srcdir)/../INTERP_KERNEL +libmedpartitioner_la_CPPFLAGS = \ + $(MPI_INCLUDES) \ + $(MED3_INCLUDES) \ + $(HDF5_INCLUDES) \ + $(LIBXML_INCLUDES) \ + -I$(srcdir)/../INTERP_KERNEL/Bases \ + -I$(srcdir)/../MEDCoupling \ + -I$(srcdir)/../MEDLoader \ + -I$(srcdir)/../INTERP_KERNEL libmedpartitioner_la_LDFLAGS = @@ -98,21 +104,40 @@ if MED_ENABLE_SCOTCH libmedpartitioner_la_LDFLAGS += $(SCOTCH_LIBS) endif -libmedpartitioner_la_LDFLAGS += $(MED3_LIBS_C_ONLY) $(HDF5_LIBS) $(STDLIB) $(LIBXML_LIBS) $(MPI_LIBS) \ - ../INTERP_KERNEL/libinterpkernel.la ../MEDCoupling/libmedcoupling.la ../MEDLoader/libmedloader.la +libmedpartitioner_la_LDFLAGS += \ + $(MED3_LIBS_C_ONLY) \ + $(HDF5_LIBS) \ + $(STDLIB) \ + $(LIBXML_LIBS) \ + $(MPI_LIBS) \ + ../INTERP_KERNEL/libinterpkernel.la \ + ../MEDCoupling/libmedcoupling.la \ + ../MEDLoader/libmedloader.la # Executables targets if MPI_IS_OK + bin_PROGRAMS = medpartitioner_para dist_medpartitioner_para_SOURCES = medpartitioner_para.cxx - medpartitioner_para_CPPFLAGS = -I$(srcdir)/../INTERP_KERNEL/Bases -I$(srcdir)/../MEDCoupling \ - -I$(srcdir)/../MEDLoader -I$(srcdir)/../INTERP_KERNEL $(MPI_INCLUDES) $(PARMETIS_CPPFLAGS) + medpartitioner_para_CPPFLAGS = \ + -I$(srcdir)/../INTERP_KERNEL/Bases \ + -I$(srcdir)/../MEDCoupling \ + -I$(srcdir)/../MEDLoader \ + -I$(srcdir)/../INTERP_KERNEL \ + $(MPI_INCLUDES) \ + $(PARMETIS_CPPFLAGS) + medpartitioner_para_LDADD = libmedpartitioner.la + else !MPI_IS_OK + bin_PROGRAMS = medpartitioner dist_medpartitioner_SOURCES = medpartitioner.cxx - medpartitioner_CPPFLAGS = -I$(srcdir)/../INTERP_KERNEL/Bases -I$(srcdir)/../MEDCoupling \ - -I$(srcdir)/../MEDLoader -I$(srcdir)/../INTERP_KERNEL + medpartitioner_CPPFLAGS = \ + -I$(srcdir)/../INTERP_KERNEL/Bases \ + -I$(srcdir)/../MEDCoupling \ + -I$(srcdir)/../MEDLoader \ + -I$(srcdir)/../INTERP_KERNEL if MED_ENABLE_METIS medpartitioner_CPPFLAGS += $(METIS_CPPFLAGS) diff --git a/src/MEDPartitioner/medpartitioner.cxx b/src/MEDPartitioner/medpartitioner.cxx index 8469d70a3..470d8164d 100644 --- a/src/MEDPartitioner/medpartitioner.cxx +++ b/src/MEDPartitioner/medpartitioner.cxx @@ -245,7 +245,7 @@ int main(int argc, char** argv) { if (MyGlobals::_Rank==0) cerr<<"Problem on final meshName : set at 'Merge'"<