From 87f8119affd642d608beb9e249f1c4db9164dd04 Mon Sep 17 00:00:00 2001 From: apo Date: Fri, 16 Sep 2005 07:39:29 +0000 Subject: [PATCH] Complete usage of boost-1.33.0 library --- adm_local/unix/make_commence.in | 1 + src/CONVERTOR/Makefile.in | 6 +- src/CONVERTOR/VISU_Convertor.hxx | 3 +- src/CONVERTOR/VISU_MedConvertor.cxx | 230 ++++++++++++++++++++++------ src/CONVERTOR/VISU_MedConvertor.hxx | 8 +- 5 files changed, 197 insertions(+), 51 deletions(-) diff --git a/adm_local/unix/make_commence.in b/adm_local/unix/make_commence.in index 549610f5..574db11c 100644 --- a/adm_local/unix/make_commence.in +++ b/adm_local/unix/make_commence.in @@ -37,6 +37,7 @@ CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@ # BOOST Library BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ +BOOST_LIBS = @BOOST_LIBS@ # JAVA diff --git a/src/CONVERTOR/Makefile.in b/src/CONVERTOR/Makefile.in index 947461a2..e91a493e 100644 --- a/src/CONVERTOR/Makefile.in +++ b/src/CONVERTOR/Makefile.in @@ -61,7 +61,11 @@ CPPFLAGS+= -ftemplate-depth-32 $(VTK_INCLUDES) $(HDF5_INCLUDES) $(QT_INCLUDES) \ -I${GUI_ROOT_DIR}/include/salome \ $(BOOST_CPPFLAGS) -LDFLAGS+= $(VTK_LIBS) $(QT_LIBS) -L${MED_ROOT_DIR}/lib/salome -L${GUI_ROOT_DIR}/lib/salome -lMEDWrapper -lVTKViewer +LDFLAGS+= $(VTK_LIBS) $(QT_LIBS) \ + $(BOOST_LIBS) -lboost_thread-mt \ + -L${MED_ROOT_DIR}/lib/salome -lMEDWrapper \ + -L${GUI_ROOT_DIR}/lib/salome -lVTKViewer + LDFLAGSFORBIN=$(LDFLAGS) -lMEDWrapper_V2_2 -lMEDWrapper_V2_1 -lMEDWrapperBase -lVTKViewer @CONCLUDE@ diff --git a/src/CONVERTOR/VISU_Convertor.hxx b/src/CONVERTOR/VISU_Convertor.hxx index 14500e14..140f2793 100644 --- a/src/CONVERTOR/VISU_Convertor.hxx +++ b/src/CONVERTOR/VISU_Convertor.hxx @@ -162,7 +162,8 @@ namespace VISU //--------------------------------------------------------------- - typedef std::map TValField; + typedef std::map TValField; + typedef std::pair TMinMax; struct TField: virtual TIntId { diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index 1e36439c..dd69788c 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -34,6 +34,8 @@ #include "MED_GaussUtils.hxx" #include "MED_Utilities.hxx" +#include + #include using namespace std; @@ -46,12 +48,14 @@ using MED::EBooleen; #ifdef _DEBUG_ static int MYDEBUG = 0; static int MYVALUEDEBUG = 0; +static int MYTHREADDEBUG = 1; static int MY_FAMILY_DEBUG = 0; static int MY_GROUP_DEBUG = 0; //#define _DEXCEPT_ #else static int MYDEBUG = 0; static int MYVALUEDEBUG = 0; +static int MYTHREADDEBUG = 0; static int MY_FAMILY_DEBUG = 0; static int MY_GROUP_DEBUG = 0; #endif @@ -394,8 +398,8 @@ namespace BuildMeshOnEntityMap(PMEDMesh theMesh, TFamilyCounterMap& theFamilyID2CellsSize, const MED::TEntityInfo& theEntityInfo, - MED::PNodeInfo theNodeInfo, - MED::PWrapper theMEDWrapper) + const MED::PNodeInfo& theNodeInfo, + const MED::PWrapper& theMEDWrapper) { INITMSG(MYDEBUG,"BuildMeshOnEntityMap"<myMeshInfo; @@ -513,55 +517,184 @@ namespace //--------------------------------------------------------------- + struct TFieldMinMax; + void - CalculateMinMax(MED::PTimeStampVal theTimeStampVal, - PMEDField theField, - PMEDValForTime theValForTime) + GetMinMax(TFieldMinMax* theFieldMinMax, + PMEDField theField, + const MED::PFieldInfo& theFieldInfo, + TInt theNbTimeStamps, + MED::EEntiteMaillage theMEntity, + const MED::TGeom2Size& theGeom2Size, + const MED::TMKey2Profile& theMKey2Profile, + const MED::TKey2Gauss& theKey2Gauss, + const MED::PWrapper& theMEDWrapper, + VISU_MedConvertor::TMutex& theMutex) { + //boost::mutex::scoped_lock aLock(theMutex); + INITMSG(MYTHREADDEBUG,"GetMinMax: - "<myStatus != eRemoveAll){ + INITMSG(MYTHREADDEBUG, + "- "<GetMinMax(iComp); + INITMSG(MYTHREADDEBUG,"- "<GetNbFields(); + MED::PMeshInfo aMeshInfo = theMesh->myMeshInfo; + const std::string& aMeshName = theMesh->myName; + INITMSG(MYDEBUG,"MinMaxCalculation: aNbFields = "<GetPFieldInfo(aMeshInfo,iField); + TInt aNbComp = aFieldInfo->GetNbComp(); + std::string aFieldName = aFieldInfo->GetName(); + + MED::TGeom2Size aGeom2Size; + MED::EEntiteMaillage aMEntity; + TInt aNbTimeStamps = theMEDWrapper->GetNbTimeStamps(aFieldInfo, + theEntityInfo, + aMEntity, + aGeom2Size); + if(aNbTimeStamps < 1) + continue; + + TEntity aVEntity = MEDEntityToVTK(aMEntity); + PMEDMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity]; + TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; + PMEDField aField = aFieldMap[aFieldName]; + + TFieldMinMax* aFieldMinMax = new TFieldMinMax(aField, + aFieldInfo, + aNbTimeStamps, + aMEntity, + aGeom2Size, + theMKey2Profile, + theKey2Gauss, + theMEDWrapper, + theMutex); + new boost::thread(*aFieldMinMax); + } } @@ -637,10 +770,6 @@ namespace aMeshOnEntity, aGeom2Size, aValForTime); - - CalculateMinMax(aTimeStampVal, - aField, - aValForTime); } } } @@ -905,6 +1034,13 @@ VISU_MedConvertor aFamilyInfoSet); #endif + MinMaxCalculation(aMesh, + aEntityInfo, + aMKey2Profile, + aKey2Gauss, + aMed, + myMutex); + #ifndef _DEXCEPT_ }catch(std::exception& exc){ MSG(MYDEBUG,"Follow exception was occured in:\n"<GetName(); if(!aSubMeshID.empty()){ const std::string& aProfileName = aSubProfile->myName; - MED::PProfileInfo aProfileInfo = MED::GetProfileInfo(*theMed, + MED::PProfileInfo aProfileInfo = MED::GetProfileInfo(theMed, aProfileName); if(aProfileInfo){ const MED::TElemNum& anElemNum = aProfileInfo->myElemNum; @@ -1548,7 +1684,7 @@ LoadGaussMesh(const MED::PWrapper& theMed, }else{ if(!aSubMeshID.empty()){ const std::string& aProfileName = aSubProfile->myName; - MED::PProfileInfo aProfileInfo = MED::GetProfileInfo(*theMed, + MED::PProfileInfo aProfileInfo = MED::GetProfileInfo(theMed, aProfileName); if(aProfileInfo){ const MED::TElemNum& anElemNum = aProfileInfo->myElemNum; @@ -1630,8 +1766,8 @@ LoadValForTime(const MED::PWrapper& theMed, aGeom2Size, theValForTime->myId); - MED::TKey2Gauss aKey2Gauss = GetKey2Gauss(*theMed); - MED::TMKey2Profile aMKey2Profile = GetMKey2Profile(*theMed); + MED::TKey2Gauss aKey2Gauss = GetKey2Gauss(theMed); + MED::TMKey2Profile aMKey2Profile = GetMKey2Profile(theMed); MED::PTimeStampVal aTimeStampVal = theMed->GetPTimeStampVal(aTimeStampInfo, diff --git a/src/CONVERTOR/VISU_MedConvertor.hxx b/src/CONVERTOR/VISU_MedConvertor.hxx index de23886c..1929587e 100644 --- a/src/CONVERTOR/VISU_MedConvertor.hxx +++ b/src/CONVERTOR/VISU_MedConvertor.hxx @@ -14,6 +14,7 @@ #include "MED_Common.hxx" #include "MED_Structures.hxx" +#include #include namespace VISU @@ -134,11 +135,13 @@ namespace VISU } class VISU_MedConvertor: public VISU_Convertor_impl -{ +{ VISU_MedConvertor(); VISU_MedConvertor(const VISU_MedConvertor&); - + public: + typedef boost::mutex TMutex; + VISU_MedConvertor(const std::string& theFileName); virtual @@ -147,6 +150,7 @@ public: protected: QFileInfo myFileInfo; + TMutex myMutex; virtual int -- 2.39.2