]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
improvement of base classes
authorvbd <vbd>
Fri, 2 Feb 2007 08:31:59 +0000 (08:31 +0000)
committervbd <vbd>
Fri, 2 Feb 2007 08:31:59 +0000 (08:31 +0000)
src/ParaMEDMEM/ExplicitCoincidentDEC.cxx
src/ParaMEDMEM/MPIProcessorGroup.cxx
src/ParaMEDMEM/ParaFIELD.hxx
src/ParaMEDMEM/ParaGRID.cxx
src/ParaMEDMEM/ParaSUPPORT.hxx
src/ParaMEDMEM/StructuredParaSUPPORT.cxx
src/ParaMEDMEM/StructuredParaSUPPORT.hxx
src/ParaMEDMEM/UnstructuredParaSUPPORT.hxx
src/ParaMEDMEM/test_ParaField.cxx

index c1f2bb7cca640d1e039040423379462e5b4a7d6c..aa930902921fb9c1f92ecf36b36155addcc02455 100644 (file)
@@ -190,16 +190,16 @@ void ExplicitCoincidentDEC::broadcastTopology(const ExplicitTopology& toposend,
        else
        {
                vector <int> size (group->size());
-               
+               int myrank=toporecv.getProcGroup()->myRank();
                for (int iproc=0; iproc<group->size();iproc++)
                {
                        int isource = iproc;
                        if (!toporecv.getProcGroup()->contains(isource))
                        {
                                int nbelem;
-                               _comm_interface->recv(&nbelem, 1, MPI_INTEGER, isource, tag+isource, *(group->getComm()), &status);
+                               _comm_interface->recv(&nbelem, 1, MPI_INTEGER, isource, tag+myrank, *(group->getComm()), &status);
                                int* buffer = new int[nbelem];
-                               _comm_interface->recv(buffer, nbelem, MPI_INTEGER, isource,tag+isource, *(group->getComm()), &status);                          
+                               _comm_interface->recv(buffer, nbelem, MPI_INTEGER, isource,tag+myrank, *(group->getComm()), &status);                           
                        
                                ExplicitTopology* topotemp=new ExplicitTopology();
                                topotemp->unserialize(buffer, *_comm_interface);
index 84a176fa44d3b8a548997bbbf5dc8f660d517a75..34a84019e00e411094f34c0e31a89ec35a5afe05 100644 (file)
@@ -38,7 +38,9 @@ ProcessorGroup(interface, proc_ids)
    
   // copying proc_ids in ranks
   copy<set<int>::const_iterator,int*> (proc_ids.begin(), proc_ids.end(), ranks);
-  
+  for (int i=0; i<proc_ids.size();i++)
+    cout << "proc id " << ranks[i]<<endl;
+
   _comm_interface.groupIncl(group_world, proc_ids.size(), ranks, &_group);
   
   _comm_interface.commCreate(MPI_COMM_WORLD, _group, &_comm);
index dcb6c288e6cf3cb1bbba41c2d4408742ee4f8fa7..88348e59da5dfdbf22de6088f0393bcbc867d8b5 100644 (file)
@@ -19,7 +19,6 @@ class ParaFIELD
 {
 public:
        ParaFIELD(ParaSUPPORT* support, const ComponentTopology& component_topology); 
-       ParaFIELD(ParaSUPPORT* support);
        ParaFIELD(MEDMEM::driverTypes driver_type, const string& file_name, 
                const string& driver_name, const ComponentTopology& component_topology) 
                throw (MEDMEM::MEDEXCEPTION);
index b60c63f47f54af07dc1d7a708af5e050706bdefd..5649bb453b9d2bb8d6f7bc6822bad9e2a38617ad 100644 (file)
@@ -19,7 +19,7 @@ _name(global_grid->getName())
        if (!_block_topology->getProcGroup()->containsMyRank()) return;
        
        int dimension=_block_topology->getDimension() ;
-       if (dimension != global_grid->getMeshDimension())
+       if (dimension != global_grid->getSpaceDimension())
                throw MEDEXCEPTION(LOCALIZED("ParaGrid::ParaGrid incompatible topology"));
        
        vector<vector<double> > xyz_array(dimension);
index 7ff301a6f64138391a5a27794f0728041116909f..73a22cb191d234bf040f6042e4196ab94393e2e2 100644 (file)
@@ -18,7 +18,7 @@ namespace ParaMEDMEM
     virtual const Topology* getTopology() const {};
     virtual const MEDMEM::SUPPORT* getSupport() const {return _support;}
     virtual const ParaMESH* getMesh() const {return _mesh;}
-  private :
+  protected :
     const MEDMEM::SUPPORT* _support;
     const ParaMESH* _mesh;
   };
index 3af5bca0ba1d790564bc69f5ba7e44d969f13aa0..b431efeb790beadbf61cf819c2d84f4807b1c14b 100644 (file)
@@ -12,22 +12,20 @@ namespace ParaMEDMEM
 StructuredParaSUPPORT::StructuredParaSUPPORT(const ParaGRID* const grid, const MED_EN::medEntityMesh entity):
 _block_topology(grid->getBlockTopology()),
 _grid(grid), 
-_mesh(0),
-_entity(entity),
-_support(new SUPPORT(grid->getGrid(), "support on all entities", entity))
+_entity(entity)
 {
-       
+  _support=new SUPPORT(grid->getGrid(), "support on all entities", entity);
 }
 /*! Constructor on all elements from a GRID */
 StructuredParaSUPPORT::StructuredParaSUPPORT(const ParaMESH* const mesh, const MED_EN::medEntityMesh entity):
 _block_topology(mesh->getBlockTopology()),
 _grid(0),
-_mesh(mesh), 
-_entity(entity),
-_support(new SUPPORT(mesh->getMesh(), "support on all entities", entity))
+_entity(entity)
 {
-       
+  _mesh=mesh;
+  _support=new SUPPORT(mesh->getMesh(), "support on all entities", entity);
 }
+
 StructuredParaSUPPORT::~StructuredParaSUPPORT()
 {
        delete _support;
index 8072cc2b6c2dc1452be64f1aeb1094c7f9e0e629..a9008f816c216cbe81b3862f7c707703cffb15d9 100644 (file)
@@ -31,9 +31,9 @@ public:
 private:
        const BlockTopology* const  _block_topology;
        const ParaGRID* const _grid;
-       const ParaMESH* const _mesh;
+  //   const ParaMESH* const _mesh;
        const MED_EN::medEntityMesh _entity;
-       const MEDMEM::SUPPORT* _support;
+  //   const MEDMEM::SUPPORT* _support;
        
 };
 
index 4f663f255ee1c2d9e9ee9b42528e96cbb86c4abb..7d30c5de4dc92360bb22d6647b40ec8ff77d7eb7 100644 (file)
@@ -22,12 +22,11 @@ public:
        UnstructuredParaSUPPORT(const ParaMESH* const mesh, SUPPORT* support );
        virtual ~UnstructuredParaSUPPORT();
        const Topology* getTopology() const {return _block_topology;}
-       const MEDMEM::SUPPORT* getSupport() {return _support;}
+   
 private:
        const BlockTopology* const  _block_topology;
-       const ParaMESH* const _mesh;
        const MED_EN::medEntityMesh _entity;
-       const MEDMEM::SUPPORT* _support;
+       
        
 };
 
index 42f4b482b7824261e58a34b7d9f2670f11ec8d8c..2c4be32b8ac8ad193bff92e1013b278d654be4b6 100644 (file)
@@ -23,54 +23,57 @@ using namespace ParaMEDMEM;
 using namespace MEDMEM;
 int main(int argc, char** argv)
 {
-       string testname="ParaMEDMEM - test #1 -";
-       MPI_Init(&argc, &argv); 
-       int size;
-       int rank;
-       MPI_Comm_size(MPI_COMM_WORLD,&size);
-       MPI_Comm_rank(MPI_COMM_WORLD,&rank);
-       
-       set<int> self_procs;
-       set<int> procs;
-       for (int i=0; i<size-1; i++)
-               procs.insert(i);
-       self_procs.insert(rank);
-       
-       ParaMEDMEM::CommInterface interface;
-               
-       ParaMEDMEM::ProcessorGroup* self_group = new ParaMEDMEM::MPIProcessorGroup(interface,self_procs);
-       ParaMEDMEM::ProcessorGroup* group = new ParaMEDMEM::MPIProcessorGroup(interface,procs);
-       
-       
-       double xmin=0.0, xmax=1.0, ymin=0.0, ymax=1.0;
-       int nx=10, ny=10;
-       std::vector<std::vector<double> > axes(2);
-       axes[0].resize(nx);
-       axes[1].resize(ny);
-       for (int i=0; i<nx; i++)
-               axes[0][i]=xmin+((xmax-xmin)*i)/(nx-1);
-       for (int i=0; i<ny; i++)
-               axes[1][i]=ymin+((ymax-ymin)*i)/(ny-1);
-       vector <string> coord_name;
-       vector <string> coord_unit;
-       coord_name.push_back("x");coord_name.push_back("y");
-       coord_unit.push_back("m");coord_unit.push_back("m");
-       
-       MEDMEM::GRID grid(axes, coord_name,coord_unit);
-       
-       grid.setName("grid_10_10");
-       grid.setDescription("10 by 10 square grid");
-       Topology* topo = new BlockTopology(*self_group, grid);
+  string testname="ParaMEDMEM - test #1 -";
+  MPI_Init(&argc, &argv); 
+  int size;
+  int rank;
+  MPI_Comm_size(MPI_COMM_WORLD,&size);
+  MPI_Comm_rank(MPI_COMM_WORLD,&rank);
+  
+  set<int> self_procs;
+  set<int> procs;
+  for (int i=0; i<size-1; i++)
+    procs.insert(i);
+  self_procs.insert(rank);
+  
+  ParaMEDMEM::CommInterface interface;
+  
+  ParaMEDMEM::ProcessorGroup* self_group = new ParaMEDMEM::MPIProcessorGroup(interface,self_procs);
+  ParaMEDMEM::ProcessorGroup* group = new ParaMEDMEM::MPIProcessorGroup(interface,procs);
+  
+  if (group->containsMyRank())
+    {
+      double xmin=0.0, xmax=1.0, ymin=0.0, ymax=1.0;
+      int nx=10, ny=10;
+      std::vector<std::vector<double> > axes(2);
+      axes[0].resize(nx);
+      axes[1].resize(ny);
+      for (int i=0; i<nx; i++)
+       axes[0][i]=xmin+((xmax-xmin)*i)/(nx-1);
+      for (int i=0; i<ny; i++)
+       axes[1][i]=ymin+((ymax-ymin)*i)/(ny-1);
+      vector <string> coord_name;
+      vector <string> coord_unit;
+      coord_name.push_back("x");coord_name.push_back("y");
+      coord_unit.push_back("m");coord_unit.push_back("m");
+      
+      MEDMEM::GRID grid(axes, coord_name,coord_unit);
+      
+      grid.setName("grid_10_10");
+      grid.setDescription("10 by 10 square grid");
+      Topology* topo = new BlockTopology(*self_group, grid);
+      
+      ParaGRID local_grid(&grid, topo);
+      StructuredParaSUPPORT support(&local_grid,MED_EN::MED_CELL);
+      //       local_grid.write (MED_DRIVER, "/tmp/toto");
+      
+      ComponentTopology comp_topo(5, group);
+      ParaFIELD field(&support, comp_topo);
 
-       ParaGRID local_grid(&grid, topo);
-       StructuredParaSUPPORT support(&local_grid,MED_EN::MED_CELL);
-       local_grid.write (MED_DRIVER, "/tmp/toto");
-       
-       ComponentTopology comp_topo(5, group);
-       ParaFIELD field(&support, comp_topo);
-       
-       MPI_Finalize();
-       return 0;
+      delete topo;
+    }  
+  MPI_Finalize();
+  return 0;
 }