From: vbd Date: Fri, 21 Dec 2007 13:17:09 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=aa0de2d2509d312b0b5201eef8978c7fd0daebb2;p=tools%2Fmedcoupling.git *** empty log message *** --- diff --git a/src/ParaMEDMEM/Makefile.in b/src/ParaMEDMEM/Makefile.in index d1aea610d..6242a23c1 100644 --- a/src/ParaMEDMEM/Makefile.in +++ b/src/ParaMEDMEM/Makefile.in @@ -35,7 +35,7 @@ MACHINE=PCLINUX @COMMENCE@ -SUBDIRS= Test +SUBDIRS = Test EXPORT_PYSCRIPTS = \ @@ -58,7 +58,6 @@ MxN_Mapping.hxx\ StructuredCoincidentDEC.hxx\ InterpolationMatrix.hxx\ IntersectionDEC.hxx\ -NonCoincidentDEC.hxx\ UnstructuredParaSUPPORT.hxx\ ExplicitCoincidentDEC.hxx\ ElementLocator.hxx\ @@ -88,7 +87,6 @@ InterpolationMatrix.cxx\ StructuredCoincidentDEC.cxx\ ExplicitCoincidentDEC.cxx\ IntersectionDEC.cxx\ -NonCoincidentDEC.cxx\ UnstructuredParaSUPPORT.cxx\ ElementLocator.cxx\ ExplicitTopology.cxx\ @@ -106,7 +104,7 @@ test_ParaField test_DEC test_UnstructuredDEC test_ExplicitDEC test_IntersectionD LDFLAGS+= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome LDFLAGSFORBIN+= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome -CPPFLAGS+=$(MED2_INCLUDES) $(MPI_INCLUDES) $(FVM_INCLUDES) +CPPFLAGS+=$(MED2_INCLUDES) $(MPI_INCLUDES) CPPFLAGS+=-I${srcdir}/../INTERP_KERNEL @@ -114,7 +112,7 @@ CXXFLAGS+=@CXXTMPDPTHFLAGS@ CPPFLAGS+=$(BOOST_CPPFLAGS) #LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) # change motivated by the bug KERNEL4778. -LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lmed_V2_1 $(STDLIB) -lmedmem $(MPI_LIBS) $(FVM_LIBS) -lutil -linterpkernel +LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lmed_V2_1 $(STDLIB) -lmedmem $(MPI_LIBS) -lutil -linterpkernel #LDFLAGSFORBIN+=$(MED2_LIBS) $(HDF5_LIBS) # change motivated by the bug KERNEL4778. @@ -126,8 +124,18 @@ ifeq ($(MED_WITH_KERNEL),yes) LDFLAGS+= ${KERNEL_LDFLAGS} -lSALOMELocalTrace LDFLAGSFORBIN+= ${KERNEL_LDFLAGS} -lSALOMELocalTrace -lSALOMEBasics endif +LIBSFORBIN=$(BOOSTLIBS) $(MPI_LIBS) -LIBSFORBIN=$(BOOSTLIBS) $(MPI_LIBS) $(FVM_LIBS) + + +ifneq ( $(FVM_LIBS), "") + LIB_SRC += NonCoincidentDEC.cxx + EXPORT_HEADERS += NonCoincidentDEC.hxx + LDFLAGS += $(FVM_LIBS) + LDFLAGSFORBIN += $(FVM_LIBS) + CPPFLAGS += $(FVM_INCLUDES) + LIBSFORBIN+=$(FVM_LIBS) +endif LIBS= diff --git a/src/ParaMEDMEM/Test/Makefile.in b/src/ParaMEDMEM/Test/Makefile.in index 5c77428cb..651d8b1a1 100644 --- a/src/ParaMEDMEM/Test/Makefile.in +++ b/src/ParaMEDMEM/Test/Makefile.in @@ -46,8 +46,8 @@ LIB_SRC = TestParaMEDMEM.cxx \ ParaMEDMEMTest.cxx \ ParaMEDMEMTest_MPIProcessorGroup.cxx \ ParaMEDMEMTest_BlockTopology.cxx \ - ParaMEDMEMTest_IntersectionDEC.cxx\ - ParaMEDMEMTest_NonCoincidentDEC.cxx + ParaMEDMEMTest_IntersectionDEC.cxx + LIB_CLIENT_IDL = @@ -68,9 +68,14 @@ CPPFLAGS += $ @CPPUNIT_INCLUDES@ $(KERNEL_CXXFLAGS) $(LIBXML_CXXFLAGS) $(MPI_INC LDFLAGSFORBIN += $(LDFLAGS) -lm $(MED2_LIBS) $(HDF5_LIBS) $(MPI_LIBS) \ -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome -lmed_V2_1 -lparamed -linterpkernel -lmedmem \ - ${KERNEL_LDFLAGS} ${FVM_LIBS} ${CPPUNIT_LIBS}\ + $(KERNEL_LDFLAGS) $(CPPUNIT_LIBS)\ -lParaMEDMEMTest +ifneq ($(FVM_LIBS),"") + LIB_SRC += ParaMEDMEMTest_NonCoincidentDEC.cxx + LDFLAGSFORBIN += $(FVM_LIBS) +endif + UNIT_TEST_PROG = TestParaMEDMEM @CONCLUDE@ diff --git a/src/ParaMEDMEM/Test/ParaMEDMEMTest.hxx b/src/ParaMEDMEM/Test/ParaMEDMEMTest.hxx index 3fdbe8b1b..b7164b056 100644 --- a/src/ParaMEDMEM/Test/ParaMEDMEMTest.hxx +++ b/src/ParaMEDMEM/Test/ParaMEDMEMTest.hxx @@ -58,7 +58,12 @@ public: void testIntersectionDEC_2D(); void testNonCoincidentDEC_2D(); void testNonCoincidentDEC_3D(); - + void testAsynchronousEqualIntersectionDEC_2D(); + void testAsynchronousFasterSourceIntersectionDEC_2D(); + void testAsynchronousSlowerSourceIntersectionDEC_2D(); + void testAsynchronousSlowSourceIntersectionDEC_2D(); + void testAsynchronousFastSourceIntersectionDEC_2D(); + private: void testNonCoincidentDEC(const std::string& filename1, @@ -66,6 +71,9 @@ private: const std::string& filename2, const std::string& meshname2, int nbprocsource); + void testAsynchronousIntersectionDEC_2D(double dtA, double tmaxA, + double dtB, double tmaxB); + }; // to automatically remove temporary files from disk diff --git a/src/ParaMEDMEM/Test/ParaMEDMEMTest_IntersectionDEC.cxx b/src/ParaMEDMEM/Test/ParaMEDMEMTest_IntersectionDEC.cxx index 59ec0f4ca..7887cbd3a 100644 --- a/src/ParaMEDMEM/Test/ParaMEDMEMTest_IntersectionDEC.cxx +++ b/src/ParaMEDMEM/Test/ParaMEDMEMTest_IntersectionDEC.cxx @@ -83,16 +83,12 @@ void ParaMEDMEMTest::testIntersectionDEC_2D() 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; - //loading the geometry for the source group ParaMEDMEM::IntersectionDEC dec (*source_group,*target_group); MEDMEM::MESH* mesh; MEDMEM::SUPPORT* support; - MEDMEM::FIELD* field; ParaMEDMEM::ParaMESH* paramesh; ParaMEDMEM::ParaFIELD* parafield; @@ -232,6 +228,186 @@ void ParaMEDMEMTest::testIntersectionDEC_2D() delete self_group; + MPI_Barrier(MPI_COMM_WORLD); + cout << "end of IntersectionDEC_2D test"< self_procs; + set procs_source; + set procs_target; + + for (int i=0; i* field; + ParaMEDMEM::ParaMESH* paramesh; + ParaMEDMEM::ParaFIELD* parafield; + + string data_dir = getenv("MED_ROOT_DIR"); + string tmp_dir = getenv("TMP"); + if (tmp_dir == "") + tmp_dir = "/tmp"; + string filename_xml1 = data_dir + "/share/salome/resources/med/square1_split"; + string filename_xml2 = data_dir + "/share/salome/resources/med/square2_split"; + string filename_seq_wr = tmp_dir + "/"; + string filename_seq_med = tmp_dir + "/myWrField_seq_pointe221.med"; + + // To remove tmp files from disk + ParaMEDMEMTest_TmpFilesRemover aRemover; + + MPI_Barrier(MPI_COMM_WORLD); + if (source_group->containsMyRank()) + { + string master = filename_xml1; + + ostringstream strstream; + strstream <getNumberOfElements(MED_EN::MED_ALL_ELEMENTS); + double * value= new double[nb_local]; + for(int ielem=0; ielemgetField()->setValue(value); + + ICoCo::Field* icocofield=new ICoCo::MEDField(paramesh,parafield); + + dec.attachLocalField(icocofield); + } + + //loading the geometry for the target group + if (target_group->containsMyRank()) + { + string master= filename_xml2; + ostringstream strstream; + strstream << master<<(rank-nproc_source+1)<<".med"; + ostringstream meshname ; + meshname<< "Mesh_3_"<getNumberOfElements(MED_EN::MED_ALL_ELEMENTS); + double * value= new double[nb_local]; + for(int ielem=0; ielemgetField()->setValue(value); + ICoCo::Field* icocofield=new ICoCo::MEDField(paramesh,parafield); + + dec.attachLocalField(icocofield); + } + + + //attaching a DEC to the source group + + if (source_group->containsMyRank()) + { + dec.synchronize(); + cout<<"DEC usage"< (parafield->getField()->getValue()); + int nb_local=parafield->getField()->getSupport()->getNumberOfElements(MED_EN::MED_ALL_ELEMENTS); + for (int i=0; icontainsMyRank()) + { + dec.synchronize(); + dec.setOption("ForcedRenormalization",false); + dec.setOption("TimeInterpolation","Linear"); + vector times; + for (double time=0; timegetVolumeIntegral(1),time*10000,0.001); + } + + } + + delete source_group; + delete target_group; + delete self_group; + + MPI_Barrier(MPI_COMM_WORLD); cout << "end of IntersectionDEC_2D test"< + +#include "MEDMEM_Exception.hxx" +#include "CommInterface.hxx" +#include "ProcessorGroup.hxx" +#include "MPIProcessorGroup.hxx" +#include "Topology.hxx" +#include "DEC.hxx" +#include "NonCoincidentDEC.hxx" +#include "ParaMESH.hxx" +#include "ParaFIELD.hxx" +#include "UnstructuredParaSUPPORT.hxx" +#include "ICoCoMEDField.hxx" + +#include + +// use this define to enable lines, execution of which leads to Segmentation Fault +#define ENABLE_FAULTS + +// use this define to enable CPPUNIT asserts and fails, showing bugs +#define ENABLE_FORCED_FAILURES + + +using namespace std; +using namespace ParaMEDMEM; +using namespace MEDMEM; + +/* + * Check methods defined in IntersectionDEC.hxx + * + IntersectionDEC(); + IntersectionDEC(ProcessorGroup& local_group, ProcessorGroup& distant_group); + virtual ~IntersectionDEC(); + void synchronize(); + void recvData(); + void sendData(); + */ + +void ParaMEDMEMTest::testNonCoincidentDEC_2D() +{ + + int size; + MPI_Comm_size(MPI_COMM_WORLD,&size); + + //the test is meant to run on five processors + if (size !=5) return ; + + testNonCoincidentDEC( "/share/salome/resources/med/square1_split", + "Mesh_2", + "/share/salome/resources/med/square2_split", + "Mesh_3", + 3); +} + +void ParaMEDMEMTest::testNonCoincidentDEC_3D() +{ + int size; + MPI_Comm_size(MPI_COMM_WORLD,&size); + + //the test is meant to run on five processors + if (size !=5) return ; + + testNonCoincidentDEC( "/share/salome/resources/med/blade_12000_split2", + "Mesh_1", + "/share/salome/resources/med/blade_3000_split2", + "Mesh_1", + 2); +} + +void ParaMEDMEMTest::testNonCoincidentDEC(const string& filename1, + const string& meshname1, + const string& filename2, + const string& meshname2, + int nproc_source) +{ + int size; + int rank; + MPI_Comm_size(MPI_COMM_WORLD,&size); + MPI_Comm_rank(MPI_COMM_WORLD,&rank); + + set self_procs; + set procs_source; + set procs_target; + + for (int i=0; i* field; + ParaMEDMEM::ParaMESH* paramesh; + ParaMEDMEM::ParaFIELD* parafield; + + string data_dir = getenv("MED_ROOT_DIR"); + string tmp_dir = getenv("TMP"); + if (tmp_dir == "") + tmp_dir = "/tmp"; + string filename_xml1 = data_dir + filename1; + string filename_xml2 = data_dir + filename2; + string filename_seq_wr = tmp_dir + "/"; + string filename_seq_med = tmp_dir + "/myWrField_seq_pointe221.med"; + + // To remove tmp files from disk + ParaMEDMEMTest_TmpFilesRemover aRemover; + //aRemover.Register(filename_seq_wr); + //aRemover.Register(filename_seq_med); + MPI_Barrier(MPI_COMM_WORLD); + ICoCo::Field* icocofield; + if (source_group->containsMyRank()) + { + string master = filename_xml1; + + ostringstream strstream; + strstream <getNumberOfElements(MED_EN::MED_ALL_ELEMENTS); + double * value= new double[nb_local]; + for(int ielem=0; ielemgetField()->setValue(value); + + icocofield=new ICoCo::MEDField(paramesh,parafield); + + dec.attachLocalField(icocofield); + } + + //loading the geometry for the target group + if (target_group->containsMyRank()) + { + string master= filename_xml2; + ostringstream strstream; + strstream << master<<(rank-nproc_source+1)<<".med"; + ostringstream meshname ; + meshname<< meshname2<<"_"<getNumberOfElements(MED_EN::MED_ALL_ELEMENTS); + double * value= new double[nb_local]; + for(int ielem=0; ielemgetField()->setValue(value); + icocofield=new ICoCo::MEDField(paramesh,parafield); + + dec.attachLocalField(icocofield); + } + + + //attaching a DEC to the source group + double field_before_int; + double field_after_int; + + if (source_group->containsMyRank()) + { + field_before_int = parafield->getVolumeIntegral(1); + MPI_Bcast(&field_before_int, 1,MPI_DOUBLE, 0,MPI_COMM_WORLD); + dec.synchronize(); + cout<<"DEC usage"<write(MED_DRIVER,"./sourcesquarenc"); + //parafield->write(MED_DRIVER,"./sourcesquarenc","boundary"); + + + } + + //attaching a DEC to the target group + if (target_group->containsMyRank()) + { + MPI_Bcast(&field_before_int, 1,MPI_DOUBLE, 0,MPI_COMM_WORLD); + + dec.synchronize(); + dec.setOption("ForcedRenormalization",false); + dec.recvData(); + //paramesh->write(MED_DRIVER, "./targetsquarenc"); + //parafield->write(MED_DRIVER, "./targetsquarenc", "boundary"); + field_after_int = parafield->getVolumeIntegral(1); + + } + MPI_Bcast(&field_after_int, 1,MPI_DOUBLE, 4,MPI_COMM_WORLD); + + CPPUNIT_ASSERT_DOUBLES_EQUAL(field_before_int, field_after_int, 1e-6); + + delete source_group; + delete target_group; + delete self_group; + delete icocofield; + MPI_Barrier(MPI_COMM_WORLD); + +}