From 8ce503a2135388df436892e1cec0b9551c523c96 Mon Sep 17 00:00:00 2001 From: apo Date: Tue, 13 Sep 2005 04:16:39 +0000 Subject: [PATCH] 1. To remove useless dependecies. 2. To remove unused functions --- src/CONVERTOR/VISU_Convertor.cxx | 47 ----------------------- src/CONVERTOR/VISU_Convertor.hxx | 54 ++------------------------- src/CONVERTOR/VISU_Convertor_impl.cxx | 32 ++++++++++------ src/CONVERTOR/VISU_MedConvertor.cxx | 6 +-- src/VISU_I/VISU_CorbaMedConvertor.cxx | 4 +- 5 files changed, 29 insertions(+), 114 deletions(-) diff --git a/src/CONVERTOR/VISU_Convertor.cxx b/src/CONVERTOR/VISU_Convertor.cxx index 0f9e9b11..0a599cd1 100644 --- a/src/CONVERTOR/VISU_Convertor.cxx +++ b/src/CONVERTOR/VISU_Convertor.cxx @@ -49,53 +49,6 @@ namespace VISU{ default: return -1; } } - - PField - TMesh - ::GetField(const string& theFieldName) const - { - TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = myMeshOnEntityMap.begin(); - for(; aMeshOnEntityMapIter != myMeshOnEntityMap.end(); aMeshOnEntityMapIter++){ - const TFieldMap& aFieldMap = aMeshOnEntityMapIter->second->myFieldMap; - TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin(); - for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++) - if(theFieldName == aFieldMapIter->first) - return aFieldMapIter->second; - } - return PField(); - } - - - PFamily - FindFamily(VISU::PMesh theMesh, - const string& theFamilyName) - { - PFamily aFamily; - const TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap; - TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin(); - for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){ - const PMeshOnEntity aMeshOnEntity = aMeshOnEntityMapIter->second; - aFamily = GetFamily(aMeshOnEntity,theFamilyName); - if(aFamily) - break; - } - return aFamily; - } - - - PFamily - GetFamily(VISU::PMeshOnEntity theMeshOnEntity, - const string& theFamilyName) - { - PFamily aFamily; - if(theFamilyName != ""){ - TFamilyMap& aFamilyMap = theMeshOnEntity->myFamilyMap; - TFamilyMap::iterator aFamilyMapIter = aFamilyMap.find(theFamilyName); - if(aFamilyMapIter != aFamilyMap.end()) - aFamily = aFamilyMapIter->second; - } - return aFamily; - } } diff --git a/src/CONVERTOR/VISU_Convertor.hxx b/src/CONVERTOR/VISU_Convertor.hxx index ef67eb40..14500e14 100644 --- a/src/CONVERTOR/VISU_Convertor.hxx +++ b/src/CONVERTOR/VISU_Convertor.hxx @@ -28,6 +28,7 @@ #define VISU_Convertor_HeaderFile #include "VISU_IDMapper.hxx" +#include "VISU_ConvertorDef.hxx" #include "MED_Vector.hxx" @@ -37,54 +38,15 @@ #include #include -#include - namespace VISU { using MED::TVector; //--------------------------------------------------------------- - enum TEntity {NODE_ENTITY, EDGE_ENTITY, FACE_ENTITY, CELL_ENTITY}; - - struct TMesh; - typedef SharedPtr PMesh; - typedef std::map TMeshMap; - - struct TGaussSubMesh; - typedef SharedPtr PGaussSubMesh; - - struct TGaussMesh; - typedef SharedPtr PGaussMesh; - - struct TSubProfile; - typedef SharedPtr PSubProfile; - - struct TProfile; - typedef SharedPtr PProfile; - - struct TMeshOnEntity; - typedef SharedPtr PMeshOnEntity; - - struct TFamily; - typedef SharedPtr PFamily; - - struct TGroup; - typedef SharedPtr PGroup; - - struct TField; - typedef SharedPtr PField; - - struct TGauss; - typedef SharedPtr PGauss; - - struct TValForTime; - typedef SharedPtr PValForTime; - typedef std::string TName; typedef TVector TNames; - //--------------------------------------------------------------- struct TIntId: virtual TBaseStructure { @@ -108,10 +70,8 @@ namespace VISU TMesh(): myDim(0) {} - - PField - GetField(const std::string& theFieldName) const; }; + typedef std::map TMeshMap; //--------------------------------------------------------------- @@ -235,18 +195,9 @@ namespace VISU //--------------------------------------------------------------- - PFamily - FindFamily(VISU::PMesh theMesh, - const std::string& theFamilyName); - - PFamily - GetFamily(VISU::PMeshOnEntity theMeshOnEntity, - const std::string& theFamilyName); - void WriteToFile(vtkUnstructuredGrid* theDataSet, const std::string& theFileName); - }; @@ -370,4 +321,5 @@ extern "C" CreateConvertor(const std::string& theFileName); }; + #endif diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index 5bec193b..b4dbc4b1 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -57,7 +57,7 @@ static float ERR_SIZE_CALC = 1.00; static int MYVTKDEBUG = 0; #ifdef _DEBUG_ -static int MYDEBUG = 1; +static int MYDEBUG = 0; static int MYDEBUGWITHFILES = 0; //#define _DEXCEPT_ #else @@ -1877,17 +1877,25 @@ VISU_Convertor_impl const VISU::TEntity& theEntity, const string& theFamilyName) { - PMeshImpl aMesh = FindMesh(theMeshName); - VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap; - VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.find(theEntity); - if(aMeshOnEntityMapIter == aMeshOnEntityMap.end()) - EXCEPTION(runtime_error,"FindFamilyOnEntity >> There is no mesh on the entity - "<second; - - return TFindFamilyOnEntity(aMesh, - aMeshOnEntity, - VISU::GetFamily(aMeshOnEntity,theFamilyName)); + if(theFamilyName != ""){ + PMeshImpl aMesh = FindMesh(theMeshName); + VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap; + VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.find(theEntity); + if(aMeshOnEntityMapIter == aMeshOnEntityMap.end()) + EXCEPTION(runtime_error,"FindFamilyOnEntity >> There is no mesh on the entity - "<second; + + TFamilyMap& aFamilyMap = aMeshOnEntity->myFamilyMap; + TFamilyMap::iterator aFamilyMapIter = aFamilyMap.find(theFamilyName); + if(aFamilyMapIter != aFamilyMap.end()){ + const PFamily& aFamily = aFamilyMapIter->second; + return TFindFamilyOnEntity(aMesh, + aMeshOnEntity, + aFamily); + } + } + return TFindFamilyOnEntity(); } diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index a77815f4..eb9222d5 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -44,10 +44,10 @@ using MED::TFloat; using MED::EBooleen; #ifdef _DEBUG_ -static int MYDEBUG = 1; +static int MYDEBUG = 0; static int MYVALUEDEBUG = 0; -static int MY_FAMILY_DEBUG = 1; -static int MY_GROUP_DEBUG = 1; +static int MY_FAMILY_DEBUG = 0; +static int MY_GROUP_DEBUG = 0; //#define _DEXCEPT_ #else static int MYDEBUG = 0; diff --git a/src/VISU_I/VISU_CorbaMedConvertor.cxx b/src/VISU_I/VISU_CorbaMedConvertor.cxx index 6106947b..c580b50e 100644 --- a/src/VISU_I/VISU_CorbaMedConvertor.cxx +++ b/src/VISU_I/VISU_CorbaMedConvertor.cxx @@ -675,7 +675,9 @@ VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED) for(int iFamaily = 0; iFamaily < iFamilyEnd; iFamaily++){ SALOME_MED::FAMILY_var aMEDFamily = aFamilies[iFamaily]; CORBA::String_var aFamilyName = aMEDFamily->getName(); - PCFamily aFamily = FindFamily(aMesh,aFamilyName.in()); + TFindFamilyOnEntity aFindFamilyOnEntity = + FindFamilyOnEntity(aMeshName.in(),aVEntity,aFamilyName.in()); + PCFamily aFamily = boost::get<2>(aFindFamilyOnEntity); if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aGroup - aFamilyName = '"<