--- /dev/null
+#include "MEDMEM_Meshing.hxx"
+#include <cmath>
+
+using namespace MEDMEM;
+using namespace MED_EN;
+const int N=10;
+int main()
+{
+ MESHING mesh;
+ mesh.setName("cylinder_1");
+ double* coords=new double[N*N*3];
+
+ for (int i=0; i<N; i++)
+ for (int j=0; j<N; j++)
+ {
+ coords[3*(i*N+j)]=cos((double)(i)/double(N)*6.28);
+ coords[3*(i*N+j)+1]=sin((double)(i)/double(N)*6.28);
+ coords[3*(i*N+j)+2]=(double)(j)/double((N-1));
+ }
+ mesh.setCoordinates(3,N*N,coords,"CARTESIAN", MED_FULL_INTERLACE);
+
+ string names[3]={"x","y","z"};
+ mesh.setCoordinatesNames(names);
+ MED_EN::medGeometryElement Type[1]={MED_TRIA3};
+ const int numberOfElements=N*(N-1)*2;
+
+ mesh.setNumberOfTypes(1,MED_CELL);
+ mesh.setTypes(Type,MED_CELL);
+ mesh.setNumberOfElements(&numberOfElements, MED_CELL);
+ int* conn = new int [6*N*(N-1)];
+ for (int i=0; i<N; i++)
+ for (int j=0; j<N-1; j++)
+ {
+ int i1=i+1;
+ if (i1==N)
+ i1=0;
+ conn[(i*(N-1)+j)*6]=i*N+j+1;
+ conn[(i*(N-1)+j)*6+1]=(i1)*N+j+1;
+ conn[(i*(N-1)+j)*6+2]=(i1)*N+j+1+1;
+ conn[(i*(N-1)+j)*6+3]=i*N+j+1;
+ conn[(i*(N-1)+j)*6+4]=i*N+j+1+1;
+ conn[(i*(N-1)+j)*6+5]=(i1)*N+j+1+1;
+
+
+
+ }
+ mesh.setConnectivity(conn, MED_CELL,MED_TRIA3);
+ mesh.setMeshDimension(3);
+ int id=mesh.addDriver(MED_DRIVER,"/home/vb144235/resources/cylinder_3D.med", "cylinder_1");
+ mesh.write(id);
+}
--- /dev/null
+#include "MEDMEM_Meshing.hxx"
+
+int main(int argc, char** argv)
+{
+ if (argc!=3) {cout <<"error in arguments"<<endl; exit(1);}
+ int N;
+ sscanf(argv[1], "%d", &N);
+ cout << "number of nodes "<<N<<endl;
+ string meshname (argv[2]);
+ MEDMEM::MESHING mesh;
+ mesh.setName("cylinder");
+ double* coords=new double[3*N*N];
+
+ int* conn=new int [6*(N-1)*(N-1)];
+ for (int i=0; i<N; i++)
+ for (int j=0; j<N; j++)
+ {
+ coords[3*(j+i*N)]=double(i)/(N-1);
+ coords[3*(j+i*N)+1]=double(i)/(N-1);
+ coords[3*(j+i*N)+2]=double(j)/(N-1);
+ }
+ for (int i=0; i<N-1; i++)
+ for (int j=0; j<N-1; j++)
+ {
+ conn[6*(j+i*(N-1))]=j+i*(N)+1;
+ conn[6*(j+i*(N-1))+1]=j+1+i*(N)+1;
+ conn[6*(j+i*(N-1))+2]=j+1+(i+1)*(N)+1;
+ conn[6*(j+i*(N-1))+3]=j+i*(N)+1;
+ conn[6*(j+i*(N-1))+4]=j+(i+1)*(N)+1;
+ conn[6*(j+i*(N-1))+5]=j+1+(i+1)*(N)+1;
+ }
+
+ mesh.setNumberOfNodes(N*N);
+ mesh.setCoordinates(3, N*N,coords, "CARTESIAN",MED_EN::MED_FULL_INTERLACE);
+ mesh.setNumberOfTypes(1,MED_EN::MED_CELL);
+ MED_EN::medGeometryElement type[1] = {MED_EN::MED_TRIA3};
+ mesh.setTypes(type,MED_EN::MED_CELL);
+ int nb=(N-1)*(N-1)*2;
+ mesh.setNumberOfElements(&nb,MED_EN::MED_CELL);
+ mesh.setMeshDimension(2);
+
+ mesh.setConnectivity(conn,MED_EN::MED_CELL, MED_EN::MED_TRIA3);
+ mesh.setMeshDimension(2);
+ int id=mesh.addDriver(MEDMEM::MED_DRIVER, meshname,"cylinder");
+ mesh.write(id);
+}
--- /dev/null
+#include "INTERPOLATION_2D.hxx"
+#include "MEDMEM_Mesh.hxx"
+
+int main()
+{
+ MEDMEM::MESH source(MED_DRIVER,"/home/vb144235/resources/square128000.med","Mesh_1");
+ MEDMEM::MESH target(MED_DRIVER,"/home/vb144235/resources/square30000.med","Mesh_1");
+
+ ParaMEDMEM::INTERPOLATION_2D interp;
+ // interp.setOptions(1e-6,1,2);
+ interp.interpol_maillages(source,target);
+}
--- /dev/null
+#include <string>
+#include <vector>
+#include <map>
+#include <iostream>
+#include <mpi.h>
+
+#include "ProcessorGroup.hxx"
+#include "Topology.hxx"
+#include "BlockTopology.hxx"
+#include "CommInterface.hxx"
+
+
+#include "MPIProcessorGroup.hxx"
+#include "MEDMEM_Mesh.hxx"
+#include "MEDMEM_Group.hxx"
+#include "MEDMEM_Support.hxx"
+#include "ParaMESH.hxx"
+#include "UnstructuredParaSUPPORT.hxx"
+#include "ComponentTopology.hxx"
+#include "ParaFIELD.hxx"
+#include "IntersectionDEC.cxx"
+
+using namespace std;
+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);
+ if (argc !=2 || size < 2)
+ {
+ cout << "usage :"<<endl;
+ cout << "mpirun -n <nbprocs> test_NonCoincidentDEC <nbprocsource>"<<endl;
+ cout << " (nbprocs >=2)"<<endl;
+ return 1;
+ }
+ int nproc_source = atoi(argv[1]);
+ set<int> self_procs;
+ set<int> procs_source;
+ set<int> procs_target;
+
+ for (int i=0; i<nproc_source; i++)
+ procs_source.insert(i);
+ for (int i=nproc_source; i<size; i++)
+ procs_target.insert(i);
+ self_procs.insert(rank);
+
+ ParaMEDMEM::CommInterface interface;
+
+ ParaMEDMEM::ProcessorGroup* self_group = new ParaMEDMEM::MPIProcessorGroup(interface,self_procs);
+ ParaMEDMEM::ProcessorGroup* target_group = new ParaMEDMEM::MPIProcessorGroup(interface,procs_target);
+ ParaMEDMEM::ProcessorGroup* source_group = new ParaMEDMEM::MPIProcessorGroup(interface,procs_source);
+
+ ParaMEDMEM::ParaMESH* source_mesh=0;
+ ParaMEDMEM::ParaMESH* target_mesh=0;
+
+ Topology* topo_source;
+ Topology* topo_target;
+
+ MEDMEM::SUPPORT* boundary_group;
+ //loading the geometry for the source group
+ if (source_group->containsMyRank())
+ {
+ string master = "/home/vb144235/resources/square2_split";
+ ostringstream strstream;
+ strstream <<master<<rank+1<<".med";
+ //strstream<<"/home/vb144235/resources/square128000.med";
+ ostringstream meshname ;
+ meshname<< "Mesh_3_"<< rank+1;
+ // meshname<<"Mesh_1";
+ MEDMEM::MESH* mesh = new MESH(MED_DRIVER,strstream.str(),meshname.str());
+ source_mesh = new ParaMESH(*mesh,*source_group,"Mesh_3");
+ // const vector <MEDMEM::GROUP*> mesh_groups;
+ //
+ // for (int i=0; i<mesh_groups.size(); i++)
+ // {
+ // if (mesh_groups[i]->getName() == "boundary")
+ // boundary_group = mesh_groups[i];
+ // }
+ //
+ boundary_group = new SUPPORT(mesh, "support on all cells", MED_EN::MED_CELL);
+ }
+
+ //loading the geometry for the target group
+ if (target_group->containsMyRank())
+ {
+ string master = "/home/vb144235/resources/square1_split";
+
+ ostringstream strstream;
+ strstream << master<<(rank-nproc_source+1)<<".med";
+ //strstream<<"/home/vb144235/resources/square30000.med";
+ ostringstream meshname ;
+ meshname<< "Mesh_2_"<<rank-nproc_source+1;
+ //meshname<<"Mesh_1";
+
+ MEDMEM::MESH* mesh= new MESH(MED_DRIVER,strstream.str(),meshname.str());
+ target_mesh = new ParaMESH(*mesh,*target_group, "Mesh_2");
+ // const vector <MEDMEM::GROUP*> mesh_groups;
+ //
+ // for (int i=0; i<mesh_groups.size(); i++)
+ // {
+ // if (mesh_groups[i]->getName() == "boundary")
+ // boundary_group = mesh_groups[i];
+ // }
+ boundary_group = new SUPPORT(mesh, "support on all cells", MED_EN::MED_CELL);
+
+ }
+
+
+ //attaching a DEC to the source group
+ if (source_group->containsMyRank())
+ {
+
+ //UnstructuredParaSUPPORT source_support(boundary_group, source_group);
+ UnstructuredParaSUPPORT source_support(source_mesh, boundary_group);
+ ComponentTopology source_comp(1);
+ cout << "setting up field"<<endl;
+ ParaFIELD source_field (&source_support,source_comp);
+
+ int nb_local = source_field.getTopology()->getNbLocalElements();
+ cout << "Source field nb elems on rank : "<<rank<<" : "<<nb_local<<endl;
+ double * value= new double[nb_local];
+ for(int ielem=0; ielem<nb_local;ielem++)
+ value[ielem]=1.0;
+ source_field.getField()->setValue(value);
+ cout <<"creating intersectionDEC"<<endl;
+ IntersectionDEC dec(*source_group,*target_group);
+ dec.attachSourceField(&source_field);
+ dec.synchronize();
+ cout<<"DEC usage"<<endl;
+ dec.sendData();
+ cout <<"writing"<<endl;
+ source_mesh->write(MED_DRIVER,"/home/vb144235/tmp/sourcesquare");
+ source_field.write(MED_DRIVER,"/home/vb144235/tmp/sourcesquare","toto");
+ delete[] value;
+ }
+
+ //attaching a DEC to the target group
+ if (target_group->containsMyRank())
+ {
+
+ UnstructuredParaSUPPORT target_support(target_mesh, boundary_group);
+ //UnstructuredParaSUPPORT target_support(boundary_group, target_group);
+ ComponentTopology target_comp(1);
+ ParaFIELD target_field(&target_support,target_comp);
+ int nb_local = target_field.getTopology()->getNbLocalElements();
+ double * value= new double[nb_local];
+ for(int ielem=0; ielem<nb_local;ielem++)
+ value[ielem]=0.0;
+ target_field.getField()->setValue(value);
+ IntersectionDEC dec(*source_group,*target_group);
+ dec.attachTargetField(&target_field);
+ dec.synchronize();
+ dec.recvData();
+ target_mesh->write(MED_DRIVER, "/home/vb144235/tmp/targetsquare");
+ target_field.write(MED_DRIVER, "/home/vb144235/tmp/targetsquare", "toto");
+ delete[] value;
+ }
+
+ MPI_Barrier(MPI_COMM_WORLD);
+ MPI_Finalize();
+ return 0;
+}
+
+
--- /dev/null
+#include <string>
+#include <vector>
+#include <map>
+#include <iostream>
+#include <mpi.h>
+
+#include "ProcessorGroup.hxx"
+#include "Topology.hxx"
+#include "BlockTopology.hxx"
+#include "CommInterface.hxx"
+
+
+#include "MPIProcessorGroup.hxx"
+#include "MEDMEM_Mesh.hxx"
+#include "MEDMEM_Group.hxx"
+#include "MEDMEM_Support.hxx"
+#include "ParaMESH.hxx"
+#include "UnstructuredParaSUPPORT.hxx"
+#include "ComponentTopology.hxx"
+#include "ParaFIELD.hxx"
+#include "IntersectionDEC.cxx"
+
+using namespace std;
+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);
+ if (argc !=2 || size < 2)
+ {
+ cout << "usage :"<<endl;
+ cout << "mpirun -n <nbprocs> test_NonCoincidentDEC <nbprocsource>"<<endl;
+ cout << " (nbprocs >=2)"<<endl;
+ return 1;
+ }
+ int nproc_source = atoi(argv[1]);
+ set<int> self_procs;
+ set<int> procs_source;
+ set<int> procs_target;
+
+ for (int i=0; i<nproc_source; i++)
+ procs_source.insert(i);
+ for (int i=nproc_source; i<size; i++)
+ procs_target.insert(i);
+ self_procs.insert(rank);
+
+ ParaMEDMEM::CommInterface interface;
+
+ ParaMEDMEM::ProcessorGroup* self_group = new ParaMEDMEM::MPIProcessorGroup(interface,self_procs);
+ ParaMEDMEM::ProcessorGroup* target_group = new ParaMEDMEM::MPIProcessorGroup(interface,procs_target);
+ ParaMEDMEM::ProcessorGroup* source_group = new ParaMEDMEM::MPIProcessorGroup(interface,procs_source);
+
+ ParaMEDMEM::ParaMESH* source_mesh=0;
+ ParaMEDMEM::ParaMESH* target_mesh=0;
+ ParaMEDMEM::ParaMESH* source_mesh_bis = 0;
+ ParaMEDMEM::ParaMESH* target_mesh_bis = 0;
+
+ Topology* topo_source;
+ Topology* topo_target;
+
+ MEDMEM::SUPPORT* boundary_group;
+ //loading the geometry for the source group
+ if (source_group->containsMyRank())
+ {
+ //string master = "/home/vb144235/resources/cylinder_coarse_nosplit";
+ //cout <<"loading source"<<endl;
+ //source_mesh=new ParaMESH(MED_DRIVER,master,*source_group);
+ //cout <<"end of load"<<endl;
+ //topo_source=source_mesh->getBlockTopology();
+ ostringstream strstream;
+ // strstream <<master<<rank+1<<".med";
+ strstream<<"/home/vb144235/resources/cylinder.med";
+ ostringstream meshname ;
+ // meshname<< "Mesh_1_"<< rank+1;
+ meshname<<"cylinder_1";
+ MEDMEM::MESH* mesh_bis = new MESH(MED_DRIVER,strstream.str(),meshname.str());
+ source_mesh_bis = new ParaMESH(*mesh_bis,*source_group,"cylinder");
+ // const vector <MEDMEM::GROUP*> mesh_groups;
+ //
+ // for (int i=0; i<mesh_groups.size(); i++)
+ // {
+ // if (mesh_groups[i]->getName() == "boundary")
+ // boundary_group = mesh_groups[i];
+ // }
+ //
+ boundary_group = new SUPPORT(mesh_bis, "support on all cells", MED_EN::MED_CELL);
+ }
+
+ //loading the geometry for the target group
+ if (target_group->containsMyRank())
+ {
+ // string master = "/home/vb144235/resources/cylinder_fine_nosplit";
+ //target_mesh=new ParaMESH(MED_DRIVER,master,*target_group);
+ //topo_target=target_mesh->getBlockTopology();
+ ostringstream strstream;
+ //strstream << master<<(rank-nproc_source+1)<<".med";
+ strstream<<"/home/vb144235/resources/fine_cylinder.med";
+ ostringstream meshname ;
+ // meshname<< "Mesh_1_"<<rank-nproc_source+1;
+ meshname<<"cylinder_1";
+
+ MEDMEM::MESH* mesh_bis = new MESH(MED_DRIVER,strstream.str(),meshname.str());
+ target_mesh_bis = new ParaMESH(*mesh_bis,*target_group, "cylinder");
+ // const vector <MEDMEM::GROUP*> mesh_groups;
+ //
+ // for (int i=0; i<mesh_groups.size(); i++)
+ // {
+ // if (mesh_groups[i]->getName() == "boundary")
+ // boundary_group = mesh_groups[i];
+ // }
+ boundary_group = new SUPPORT(mesh_bis, "support on all cells", MED_EN::MED_CELL);
+
+ }
+
+
+ //attaching a DEC to the source group
+ if (source_group->containsMyRank())
+ {
+
+ //UnstructuredParaSUPPORT source_support(boundary_group, source_group);
+ UnstructuredParaSUPPORT source_support(source_mesh_bis, boundary_group);
+ ComponentTopology source_comp(1);
+ cout << "setting up field"<<endl;
+ ParaFIELD source_field (&source_support,source_comp);
+
+ int nb_local = source_field.getTopology()->getNbLocalElements();
+ cout << "Source field nb elems on rank : "<<rank<<" : "<<nb_local<<endl;
+ double * value= new double[nb_local];
+ for(int ielem=0; ielem<nb_local;ielem++)
+ value[ielem]=2.2;
+ source_field.getField()->setValue(value);
+ cout <<"creating intersectionDEC"<<endl;
+ IntersectionDEC dec(*source_group,*target_group);
+ dec.attachSourceField(&source_field);
+ dec.synchronize();
+ cout<<"DEC usage"<<endl;
+ dec.sendData();
+ cout <<"writing"<<endl;
+ source_mesh_bis->write(MED_DRIVER,"/home/vb144235/tmp/sourcecylinder");
+ source_field.write(MED_DRIVER,"/home/vb144235/tmp/sourcecylinder","boundary");
+ delete[] value;
+ }
+
+ //attaching a DEC to the target group
+ if (target_group->containsMyRank())
+ {
+
+ UnstructuredParaSUPPORT target_support(target_mesh_bis, boundary_group);
+ //UnstructuredParaSUPPORT target_support(boundary_group, target_group);
+ ComponentTopology target_comp(1);
+ ParaFIELD target_field(&target_support,target_comp);
+ int nb_local = target_field.getTopology()->getNbLocalElements();
+ double * value= new double[nb_local];
+ for(int ielem=0; ielem<nb_local;ielem++)
+ value[ielem]=0.0;
+ target_field.getField()->setValue(value);
+ IntersectionDEC dec(*source_group,*target_group);
+ dec.attachTargetField(&target_field);
+ dec.synchronize();
+ dec.recvData();
+ target_mesh_bis->write(MED_DRIVER, "/home/vb144235/tmp/targetcylinder");
+ target_field.write(MED_DRIVER, "/home/vb144235/tmp/targetcylinder", "boundary");
+ delete[] value;
+ }
+
+ MPI_Barrier(MPI_COMM_WORLD);
+ MPI_Finalize();
+ return 0;
+}
+
+
--- /dev/null
+#include <string>
+#include <vector>
+#include <map>
+#include <iostream>
+#include <mpi.h>
+
+#include "ProcessorGroup.hxx"
+#include "Topology.hxx"
+#include "BlockTopology.hxx"
+#include "CommInterface.hxx"
+
+
+#include "MPIProcessorGroup.hxx"
+#include "MEDMEM_Mesh.hxx"
+#include "MEDMEM_Group.hxx"
+#include "MEDMEM_Support.hxx"
+#include "ParaMESH.hxx"
+#include "UnstructuredParaSUPPORT.hxx"
+#include "ComponentTopology.hxx"
+#include "ParaFIELD.hxx"
+#include "IntersectionDEC.cxx"
+
+using namespace std;
+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);
+ if (argc !=2 || size < 2)
+ {
+ cout << "usage :"<<endl;
+ cout << "mpirun -n <nbprocs> test_NonCoincidentDEC <nbprocsource>"<<endl;
+ cout << " (nbprocs >=2)"<<endl;
+ return 1;
+ }
+ int nproc_source = atoi(argv[1]);
+ set<int> self_procs;
+ set<int> procs_source;
+ set<int> procs_target;
+
+ for (int i=0; i<nproc_source; i++)
+ procs_source.insert(i);
+ for (int i=nproc_source; i<size; i++)
+ procs_target.insert(i);
+ self_procs.insert(rank);
+
+ ParaMEDMEM::CommInterface interface;
+
+ ParaMEDMEM::ProcessorGroup* self_group = new ParaMEDMEM::MPIProcessorGroup(interface,self_procs);
+ ParaMEDMEM::ProcessorGroup* target_group = new ParaMEDMEM::MPIProcessorGroup(interface,procs_target);
+ ParaMEDMEM::ProcessorGroup* source_group = new ParaMEDMEM::MPIProcessorGroup(interface,procs_source);
+
+ ParaMEDMEM::ParaMESH* source_mesh=0;
+ ParaMEDMEM::ParaMESH* target_mesh=0;
+ ParaMEDMEM::ParaMESH* source_mesh_bis = 0;
+ ParaMEDMEM::ParaMESH* target_mesh_bis = 0;
+
+ Topology* topo_source;
+ Topology* topo_target;
+
+ MEDMEM::SUPPORT* boundary_group;
+ //loading the geometry for the source group
+ if (source_group->containsMyRank())
+ {
+ string master = "/home/vb144235/resources/square128000_nosplit";
+ cout <<"loading source"<<endl;
+ source_mesh=new ParaMESH(MED_DRIVER,master,*source_group);
+ cout <<"end of load"<<endl;
+ topo_source=source_mesh->getBlockTopology();
+ ostringstream strstream;
+ // strstream <<master<<rank+1<<".med";
+ strstream<<"/home/vb144235/resources/square128000.med";
+ ostringstream meshname ;
+ // meshname<< "Mesh_1_"<< rank+1;
+ meshname<<"Mesh_1";
+ MEDMEM::MESH* mesh_bis = new MESH(MED_DRIVER,strstream.str(),meshname.str());
+ source_mesh_bis = new ParaMESH(*mesh_bis,*source_group,"mesh_from_mem");
+ // const vector <MEDMEM::GROUP*> mesh_groups;
+ //
+ // for (int i=0; i<mesh_groups.size(); i++)
+ // {
+ // if (mesh_groups[i]->getName() == "boundary")
+ // boundary_group = mesh_groups[i];
+ // }
+ //
+ boundary_group = new SUPPORT(mesh_bis, "support on all cells", MED_EN::MED_CELL);
+ }
+
+ //loading the geometry for the target group
+ if (target_group->containsMyRank())
+ {
+ string master = "/home/vb144235/resources/square30000_nosplit";
+ target_mesh=new ParaMESH(MED_DRIVER,master,*target_group);
+ topo_target=target_mesh->getBlockTopology();
+ ostringstream strstream;
+ //strstream << master<<(rank-nproc_source+1)<<".med";
+ strstream<<"/home/vb144235/resources/square30000.med";
+ ostringstream meshname ;
+ // meshname<< "Mesh_1_"<<rank-nproc_source+1;
+ meshname<<"Mesh_1";
+
+ MEDMEM::MESH* mesh_bis = new MESH(MED_DRIVER,strstream.str(),meshname.str());
+ target_mesh_bis = new ParaMESH(*mesh_bis,*target_group, "mesh_from_mem");
+ // const vector <MEDMEM::GROUP*> mesh_groups;
+ //
+ // for (int i=0; i<mesh_groups.size(); i++)
+ // {
+ // if (mesh_groups[i]->getName() == "boundary")
+ // boundary_group = mesh_groups[i];
+ // }
+ boundary_group = new SUPPORT(mesh_bis, "support on all cells", MED_EN::MED_CELL);
+
+ }
+
+
+ //attaching a DEC to the source group
+ if (source_group->containsMyRank())
+ {
+
+ //UnstructuredParaSUPPORT source_support(boundary_group, source_group);
+ UnstructuredParaSUPPORT source_support(source_mesh_bis, boundary_group);
+ ComponentTopology source_comp(1);
+ cout << "setting up field"<<endl;
+ ParaFIELD source_field (&source_support,source_comp);
+
+ int nb_local = source_field.getTopology()->getNbLocalElements();
+ cout << "Source field nb elems on rank : "<<rank<<" : "<<nb_local<<endl;
+ double * value= new double[nb_local];
+ for(int ielem=0; ielem<nb_local;ielem++)
+ value[ielem]=1.0;
+ source_field.getField()->setValue(value);
+ cout <<"creating intersectionDEC"<<endl;
+ IntersectionDEC dec(*source_group,*target_group);
+ dec.attachSourceField(&source_field);
+ dec.synchronize();
+ cout<<"DEC usage"<<endl;
+ dec.sendData();
+ cout <<"writing"<<endl;
+ source_mesh->write(MED_DRIVER,"/home/vb144235/tmp/sourcesquare");
+ source_field.write(MED_DRIVER,"/home/vb144235/tmp/sourcesquare","boundary");
+ delete[] value;
+ }
+
+ //attaching a DEC to the target group
+ if (target_group->containsMyRank())
+ {
+
+ UnstructuredParaSUPPORT target_support(target_mesh_bis, boundary_group);
+ //UnstructuredParaSUPPORT target_support(boundary_group, target_group);
+ ComponentTopology target_comp(1);
+ ParaFIELD target_field(&target_support,target_comp);
+ int nb_local = target_field.getTopology()->getNbLocalElements();
+ double * value= new double[nb_local];
+ for(int ielem=0; ielem<nb_local;ielem++)
+ value[ielem]=0.0;
+ target_field.getField()->setValue(value);
+ IntersectionDEC dec(*source_group,*target_group);
+ dec.attachTargetField(&target_field);
+ dec.synchronize();
+ dec.recvData();
+ target_mesh->write(MED_DRIVER, "/home/vb144235/tmp/targetsquare");
+ target_field.write(MED_DRIVER, "/home/vb144235/tmp/targetsquare", "boundary");
+ delete[] value;
+ }
+
+ MPI_Barrier(MPI_COMM_WORLD);
+ MPI_Finalize();
+ return 0;
+}
+
+