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);
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;
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;
}