From 3e48841eaa878a7b84ea6245181ff1f97b5ba858 Mon Sep 17 00:00:00 2001 From: vbd Date: Thu, 31 May 2007 13:36:59 +0000 Subject: [PATCH] addition for debug purposes --- src/ParaMEDMEM/make_cylinder.cxx | 51 +++++ src/ParaMEDMEM/make_plane.cxx | 46 +++++ src/ParaMEDMEM/test_INTERPOL_2D.cxx | 12 ++ src/ParaMEDMEM/test_MEDMEMConstructor.cxx | 169 +++++++++++++++++ src/ParaMEDMEM/test_Seq3DsurfIntersection.cxx | 176 ++++++++++++++++++ src/ParaMEDMEM/test_SeqIntersectionDEC.cxx | 176 ++++++++++++++++++ 6 files changed, 630 insertions(+) create mode 100644 src/ParaMEDMEM/make_cylinder.cxx create mode 100644 src/ParaMEDMEM/make_plane.cxx create mode 100644 src/ParaMEDMEM/test_INTERPOL_2D.cxx create mode 100644 src/ParaMEDMEM/test_MEDMEMConstructor.cxx create mode 100644 src/ParaMEDMEM/test_Seq3DsurfIntersection.cxx create mode 100644 src/ParaMEDMEM/test_SeqIntersectionDEC.cxx diff --git a/src/ParaMEDMEM/make_cylinder.cxx b/src/ParaMEDMEM/make_cylinder.cxx new file mode 100644 index 000000000..3f0689022 --- /dev/null +++ b/src/ParaMEDMEM/make_cylinder.cxx @@ -0,0 +1,51 @@ +#include "MEDMEM_Meshing.hxx" +#include + +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 +#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_NonCoincidentDEC "<=2)"< self_procs; + set procs_source; + set procs_target; + + for (int i=0; icontainsMyRank()) + { + string master = "/home/vb144235/resources/square2_split"; + ostringstream strstream; + strstream < mesh_groups; + // + // for (int i=0; igetName() == "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_"< mesh_groups; + // + // for (int i=0; igetName() == "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"<getNbLocalElements(); + cout << "Source field nb elems on rank : "<setValue(value); + cout <<"creating intersectionDEC"<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; ielemsetValue(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; +} + + diff --git a/src/ParaMEDMEM/test_Seq3DsurfIntersection.cxx b/src/ParaMEDMEM/test_Seq3DsurfIntersection.cxx new file mode 100644 index 000000000..6f77ee6e0 --- /dev/null +++ b/src/ParaMEDMEM/test_Seq3DsurfIntersection.cxx @@ -0,0 +1,176 @@ +#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_NonCoincidentDEC "<=2)"< self_procs; + set procs_source; + set procs_target; + + for (int i=0; icontainsMyRank()) + { + //string master = "/home/vb144235/resources/cylinder_coarse_nosplit"; + //cout <<"loading source"<getBlockTopology(); + ostringstream strstream; + // strstream < mesh_groups; + // + // for (int i=0; igetName() == "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_"< mesh_groups; + // + // for (int i=0; igetName() == "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"<getNbLocalElements(); + cout << "Source field nb elems on rank : "<setValue(value); + cout <<"creating intersectionDEC"<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; ielemsetValue(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; +} + + diff --git a/src/ParaMEDMEM/test_SeqIntersectionDEC.cxx b/src/ParaMEDMEM/test_SeqIntersectionDEC.cxx new file mode 100644 index 000000000..416c9d6c2 --- /dev/null +++ b/src/ParaMEDMEM/test_SeqIntersectionDEC.cxx @@ -0,0 +1,176 @@ +#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_NonCoincidentDEC "<=2)"< self_procs; + set procs_source; + set procs_target; + + for (int i=0; icontainsMyRank()) + { + string master = "/home/vb144235/resources/square128000_nosplit"; + cout <<"loading source"<getBlockTopology(); + ostringstream strstream; + // strstream < mesh_groups; + // + // for (int i=0; igetName() == "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_"< mesh_groups; + // + // for (int i=0; igetName() == "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"<getNbLocalElements(); + cout << "Source field nb elems on rank : "<setValue(value); + cout <<"creating intersectionDEC"<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; ielemsetValue(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; +} + + -- 2.39.2