From 3d866abb43fea51ca6b996803a746a36dac4ae56 Mon Sep 17 00:00:00 2001 From: rnv Date: Thu, 22 Mar 2012 10:47:00 +0000 Subject: [PATCH] Win32 compilation. --- src/MEDPartitioner/MEDPARTITIONER.hxx | 4 +- ...RTITIONER_MeshCollectionMedAsciiDriver.hxx | 2 +- ...PARTITIONER_MeshCollectionMedXmlDriver.cxx | 16 +++- ...PARTITIONER_MeshCollectionMedXmlDriver.hxx | 2 +- .../MEDPARTITIONER_ParallelTopology.hxx | 4 +- .../MEDPARTITIONER_Topology.hxx | 2 +- .../MEDPARTITIONER_UserGraph.hxx | 2 +- src/MEDPartitioner/MEDPARTITIONER_Utils.hxx | 74 ++++++++++--------- .../Test/MEDPARTITIONERTest.cxx | 2 +- src/MEDPartitioner/Test/Makefile.am | 7 +- 10 files changed, 68 insertions(+), 47 deletions(-) diff --git a/src/MEDPartitioner/MEDPARTITIONER.hxx b/src/MEDPartitioner/MEDPARTITIONER.hxx index 64d457b4e..dd26c4193 100755 --- a/src/MEDPartitioner/MEDPARTITIONER.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER.hxx @@ -20,8 +20,8 @@ #ifndef __MEDPARTITIONER_HXX__ #define __MEDPARTITIONER_HXX__ -#ifdef WNT -# if defined MEDPARTITIONER_EXPORTS || defined medsplitter_EXPORTS +#ifdef WIN32 +# if defined MEDPARTITIONER_EXPORTS || defined medpartitioner_EXPORTS # define MEDPARTITIONER_EXPORT __declspec( dllexport ) # else # define MEDPARTITIONER_EXPORT __declspec( dllimport ) diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.hxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.hxx index 13b72dd5a..67d7f547e 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.hxx @@ -25,7 +25,7 @@ namespace MEDPARTITIONER { class MeshCollection; - class MeshCollectionMedAsciiDriver : public MeshCollectionDriver + class MEDPARTITIONER_EXPORT MeshCollectionMedAsciiDriver : public MeshCollectionDriver { public: MeshCollectionMedAsciiDriver(MeshCollection*); diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx index 2406505c9..b401c1295 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx @@ -42,6 +42,11 @@ #include #include +#ifdef WIN32 +#include +#include +#endif + using namespace MEDPARTITIONER; /*!\class MeshCollectionMedXmlDriver @@ -194,13 +199,22 @@ void MeshCollectionMedXmlDriver::write(const char* filename, ParaDomainSelector* xmlNewProp(node, BAD_CAST "ver", BAD_CAST "1"); //Description tag + char date[6]; +#ifndef WIN32 time_t present; time( &present); struct tm *time_asc = localtime(&present); - char date[6]; sprintf(date,"%02d%02d%02d",time_asc->tm_year ,time_asc->tm_mon+1 ,time_asc->tm_mday); +#else + SYSTEMTIME st; + GetLocalTime ( &st ); + sprintf(date,"%02d%02d%02d", + st.wYear + ,st.wMonth + ,st.wDay); +#endif node = xmlNewChild(root_node,0, BAD_CAST "description",0); diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.hxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.hxx index 2b269960e..33dde1a71 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.hxx @@ -25,7 +25,7 @@ namespace MEDPARTITIONER { class MeshCollection; - class MeshCollectionMedXmlDriver : public MeshCollectionDriver + class MEDPARTITIONER_EXPORT MeshCollectionMedXmlDriver : public MeshCollectionDriver { public: MeshCollectionMedXmlDriver(MeshCollection*); diff --git a/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.hxx b/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.hxx index 8dcf1207d..4e7539d07 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.hxx @@ -20,6 +20,8 @@ #ifndef __MEDPARTITIONER_PARALLELTOPOLOGY_HXX__ #define __MEDPARTITIONER_PARALLELTOPOLOGY_HXX__ +#include "MEDPARTITIONER.hxx" + #include "MEDPARTITIONER_Topology.hxx" #include "MEDPARTITIONER_ParaDomainSelector.hxx" @@ -34,7 +36,7 @@ namespace MEDPARTITIONER class MeshCollection; class MEDPARTITIONER_FaceModel; - class ParallelTopology : public Topology + class MEDPARTITIONER_EXPORT ParallelTopology : public Topology { public: diff --git a/src/MEDPartitioner/MEDPARTITIONER_Topology.hxx b/src/MEDPartitioner/MEDPARTITIONER_Topology.hxx index 2253ce1cb..f21b6be68 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Topology.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Topology.hxx @@ -36,7 +36,7 @@ namespace MEDPARTITIONER class MeshCollection; class MEDPARTITIONER_FaceModel; - class Topology + class MEDPARTITIONER_EXPORT Topology { public: Topology() { } diff --git a/src/MEDPartitioner/MEDPARTITIONER_UserGraph.hxx b/src/MEDPartitioner/MEDPARTITIONER_UserGraph.hxx index fc1583aa8..c67076599 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_UserGraph.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_UserGraph.hxx @@ -29,7 +29,7 @@ namespace MEDPARTITIONER { class SkyLineArray; class ParaDomainSelector; - class MEDPARTITIONER_EXPORT UserGraph : public Graph + class MEDPARTITIONER_EXPORT MEDPARTITIONER_EXPORT UserGraph : public Graph { public: UserGraph(MEDPARTITIONER::SkyLineArray*, const int*, int); diff --git a/src/MEDPartitioner/MEDPARTITIONER_Utils.hxx b/src/MEDPartitioner/MEDPARTITIONER_Utils.hxx index 8b548df3e..e69cfe91e 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Utils.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Utils.hxx @@ -20,6 +20,8 @@ #ifndef __MEDPARTITIONER_UTILS_HXX__ #define __MEDPARTITIONER_UTILS_HXX__ +#include "MEDPARTITIONER.hxx" + #include "MEDCouplingUMesh.hxx" #include @@ -30,48 +32,48 @@ namespace MEDPARTITIONER { - std::string Trim(const std::string& s,const std::string& drop); - std::string IntToStr(const int i); - std::string DoubleToStr(const double i); - int StrToInt(const std::string& s); - double StrToDouble(const std::string& s); - bool TestArg(const char *arg, const char *argExpected, std::string& argValue); - std::vector CreateRandomSize(const int size); - void RandomizeAdj(int* xadj, int* adjncy, std::vector& ran, std::vector& vx, std::vector& va); - void TestRandomize(); - - std::string ReprVectorOfString(const std::vector& vec); - std::string ReprVectorOfString(const std::vector& vec, const std::string separator); - std::string ReprMapOfStringInt(const std::map& mymap); - std::string ReprMapOfStringVectorOfString(const std::map< std::string,std::vector >& mymap); - std::string ReprFieldDescriptions(const std::vector& vec,const std::string separator); + MEDPARTITIONER_EXPORT std::string Trim(const std::string& s,const std::string& drop); + MEDPARTITIONER_EXPORT std::string IntToStr(const int i); + MEDPARTITIONER_EXPORT std::string DoubleToStr(const double i); + MEDPARTITIONER_EXPORT int StrToInt(const std::string& s); + MEDPARTITIONER_EXPORT double StrToDouble(const std::string& s); + MEDPARTITIONER_EXPORT bool TestArg(const char *arg, const char *argExpected, std::string& argValue); + MEDPARTITIONER_EXPORT std::vector CreateRandomSize(const int size); + MEDPARTITIONER_EXPORT void RandomizeAdj(int* xadj, int* adjncy, std::vector& ran, std::vector& vx, std::vector& va); + MEDPARTITIONER_EXPORT void TestRandomize(); + + MEDPARTITIONER_EXPORT std::string ReprVectorOfString(const std::vector& vec); + MEDPARTITIONER_EXPORT std::string ReprVectorOfString(const std::vector& vec, const std::string separator); + MEDPARTITIONER_EXPORT std::string ReprMapOfStringInt(const std::map& mymap); + MEDPARTITIONER_EXPORT std::string ReprMapOfStringVectorOfString(const std::map< std::string,std::vector >& mymap); + MEDPARTITIONER_EXPORT std::string ReprFieldDescriptions(const std::vector& vec,const std::string separator); - std::string SerializeFromString(const std::string& s); - std::string SerializeFromVectorOfString(const std::vector& vec); - std::vector DeserializeToVectorOfString(const std::string& str); - std::string EraseTagSerialized(const std::string& fromStr, const std::string& tag); + MEDPARTITIONER_EXPORT std::string SerializeFromString(const std::string& s); + MEDPARTITIONER_EXPORT std::string SerializeFromVectorOfString(const std::vector& vec); + MEDPARTITIONER_EXPORT std::vector DeserializeToVectorOfString(const std::string& str); + MEDPARTITIONER_EXPORT std::string EraseTagSerialized(const std::string& fromStr, const std::string& tag); - std::vector VectorizeFromMapOfStringInt(const std::map& mymap); - std::map DevectorizeToMapOfStringInt(const std::vector& vec); + MEDPARTITIONER_EXPORT std::vector VectorizeFromMapOfStringInt(const std::map& mymap); + MEDPARTITIONER_EXPORT std::map DevectorizeToMapOfStringInt(const std::vector& vec); - std::vector VectorizeFromMapOfStringVectorOfString(const std::map< std::string,std::vector >& mymap); - std::map< std::string,std::vector > DevectorizeToMapOfStringVectorOfString(const std::vector& vec); + MEDPARTITIONER_EXPORT std::vector VectorizeFromMapOfStringVectorOfString(const std::map< std::string,std::vector >& mymap); + MEDPARTITIONER_EXPORT std::map< std::string,std::vector > DevectorizeToMapOfStringVectorOfString(const std::vector& vec); - std::vector SelectTagsInVectorOfString(const std::vector& vec, const std::string tag); - std::vector DeleteDuplicatesInVectorOfString(const std::vector& vec); - std::map< std::string,std::vector > DeleteDuplicatesInMapOfStringVectorOfString(const std::map< std::string,std::vector >& mymap); + MEDPARTITIONER_EXPORT std::vector SelectTagsInVectorOfString(const std::vector& vec, const std::string tag); + MEDPARTITIONER_EXPORT std::vector DeleteDuplicatesInVectorOfString(const std::vector& vec); + MEDPARTITIONER_EXPORT std::map< std::string,std::vector > DeleteDuplicatesInMapOfStringVectorOfString(const std::map< std::string,std::vector >& mymap); - std::string Cle1ToStr(const std::string& s, const int inew); - void Cle1ToData(const std::string& cle, std::string& s, int& inew); + MEDPARTITIONER_EXPORT std::string Cle1ToStr(const std::string& s, const int inew); + MEDPARTITIONER_EXPORT void Cle1ToData(const std::string& cle, std::string& s, int& inew); - std::string Cle2ToStr(const std::string& s,const int inew,const int iold); - void Cle2ToData(const std::string& cle, std::string& s, int& inew, int& iold); + MEDPARTITIONER_EXPORT std::string Cle2ToStr(const std::string& s,const int inew,const int iold); + MEDPARTITIONER_EXPORT void Cle2ToData(const std::string& cle, std::string& s, int& inew, int& iold); - std::string ExtractFromDescription(const std::string& description,const std::string& tag); - void FieldDescriptionToData(const std::string& description, + MEDPARTITIONER_EXPORT std::string ExtractFromDescription(const std::string& description,const std::string& tag); + MEDPARTITIONER_EXPORT void FieldDescriptionToData(const std::string& description, int& idomain, std::string& fileName, std::string& meshName, std::string& fieldName, int& typeField, int& DT, int& IT); - void FieldShortDescriptionToData(const std::string& description, + MEDPARTITIONER_EXPORT void FieldShortDescriptionToData(const std::string& description, std::string& fieldName, int& typeField, int& entity, int& DT, int& IT); ParaMEDMEM::DataArrayInt *CreateDataArrayIntFromVector(const std::vector& v); @@ -90,8 +92,8 @@ namespace MEDPARTITIONER //void SendVectorOfString(const std::vector& vec, const int target); //std::vector RecvVectorOfString(const int source); //TODO void sendRecvVectorOfString(const std::vector& vec, const int source, const int target); - std::vector SendAndReceiveVectorOfString(const std::vector& vec, const int source, const int target); - std::vector AllgathervVectorOfString(const std::vector& vec); + MEDPARTITIONER_EXPORT std::vector SendAndReceiveVectorOfString(const std::vector& vec, const int source, const int target); + MEDPARTITIONER_EXPORT std::vector AllgathervVectorOfString(const std::vector& vec); void SendDoubleVec(const std::vector& vec, const int target); std::vector *RecvDoubleVec(const int source); @@ -115,7 +117,7 @@ namespace MEDPARTITIONER void TestPersistantMpiRingOnCommSplit(int taille, int nb); #endif - class MyGlobals + class MEDPARTITIONER_EXPORT MyGlobals { public : static int _Verbose; //0 to 1000 over 200 is debug diff --git a/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx b/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx index e54c26439..25f63b652 100644 --- a/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx +++ b/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx @@ -703,7 +703,7 @@ void MEDPARTITIONERTest::verifyTestMeshWithVecFieldOnNodes() { cout<<"\n types in "<::iterator t=types.begin(); t!=types.end(); ++t) cout<<" "<<*t; - for (std::set::iterator t=types.begin(); t!=types.end(); ++t) + for (std::set::const_iterator t=types.begin(); t!=types.end(); ++t) { //INTERP_KERNEL::CellModel essai=INTERP_KERNEL::CellModel::GetCellModel(*t); cout<<" "<<(INTERP_KERNEL::CellModel::GetCellModel(*t)).getRepr(); diff --git a/src/MEDPartitioner/Test/Makefile.am b/src/MEDPartitioner/Test/Makefile.am index 9d29372ed..02227ea95 100644 --- a/src/MEDPartitioner/Test/Makefile.am +++ b/src/MEDPartitioner/Test/Makefile.am @@ -50,7 +50,9 @@ libMEDPARTITIONERTest_la_LDFLAGS = \ $(MED3_LIBS_C_ONLY) \ $(HDF5_LIBS) \ $(MPI_LIBS) \ - @CPPUNIT_LIBS@ + @CPPUNIT_LIBS@ \ + ../../MEDLoader/libmedloader.la \ + ../libmedpartitioner.la # Executables targets @@ -59,7 +61,8 @@ UNIT_TEST_PROG = bin_PROGRAMS = TestMEDPARTITIONER TestMEDPARTITIONER_SOURCES = TestMEDPARTITIONER.cxx -TestMEDPARTITIONER_CPPFLAGS = $(libMEDPARTITIONERTest_la_CPPFLAGS) +TestMEDPARTITIONER_CPPFLAGS = $(libMEDPARTITIONERTest_la_CPPFLAGS) \ + -I$(srcdir)/../../INTERP_KERNELTest if MPI_IS_OK TestMEDPARTITIONER_CPPFLAGS += -- 2.39.2