From: vbd Date: Wed, 29 Aug 2007 14:16:22 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: trio_trio_coupling~61 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ad1ee7efcbdf61c882b37f091b8def960094df85;p=tools%2Fmedcoupling.git *** empty log message *** --- diff --git a/src/ParaMEDMEM/test_IntersectionDEC3D.cxx b/src/ParaMEDMEM/test_IntersectionDEC3D.cxx new file mode 100644 index 000000000..0602b6677 --- /dev/null +++ b/src/ParaMEDMEM/test_IntersectionDEC3D.cxx @@ -0,0 +1,156 @@ +#include +#include +#include +#include +#include + +#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 :"< test_IntersectionDEC3D "<=2)"< self_procs; + set procs_source; + set procs_target; + + for (int i=0; icontainsMyRank()) + { + // string master = "/home/vb144235/resources/square128000_split"; + string master = "/home/vb144235/resources/blade_3000_split1"; + + cout <<"loading source"<getBlockTopology(); + boundary_group = new SUPPORT(source_mesh->getMesh(), "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_split"; + string master= "/home/vb144235/resources/blade_12000_split1"; + target_mesh=new ParaMESH(MED_DRIVER,master,*target_group); + topo_target=target_mesh->getBlockTopology(); + + boundary_group = new SUPPORT(target_mesh->getMesh(), "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"<getNbLocalElements(); + cout << "Source field nb elems on rank : "<setValue(value); + cout <<"creating intersectionDEC"<write(MED_DRIVER,"/home/vb144235/tmp/sourcesquareb"); + source_field.write(MED_DRIVER,"/home/vb144235/tmp/sourcesquareb","boundary"); + + dec.recvData(); + cout <<"writing"<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, 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; ielemsetValue(value); + IntersectionDEC dec(*source_group,*target_group); + dec.attachLocalField(&target_field); + dec.synchronize(); + dec.recvData(); + target_mesh->write(MED_DRIVER, "/home/vb144235/tmp/targetsquareb"); + target_field.write(MED_DRIVER, "/home/vb144235/tmp/targetsquareb", "boundary"); + dec.sendData(); + 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; +} + +