From: apo Date: Tue, 30 Aug 2005 13:17:24 +0000 (+0000) Subject: To improve Group to Family bindings X-Git-Tag: BR-D5-38-2003_D2005-12-09~69 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6c78876f2a1d69aa9d7d33fff377d30e02566bf8;p=modules%2Fvisu.git To improve Group to Family bindings --- diff --git a/src/CONVERTOR/VISUConvertor.cxx b/src/CONVERTOR/VISUConvertor.cxx index 34c4de0b..b789f480 100644 --- a/src/CONVERTOR/VISUConvertor.cxx +++ b/src/CONVERTOR/VISUConvertor.cxx @@ -111,7 +111,7 @@ void parseFile(const char* theFileName) VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin(); for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){ const string& aFamilyName = aFamilyMapIter->first; - aCon->GetMeshOnEntity(aMeshName,anEntity,aFamilyName); + aCon->GetFamilyOnEntity(aMeshName,anEntity,aFamilyName); } } diff --git a/src/CONVERTOR/VISU_Convertor.hxx b/src/CONVERTOR/VISU_Convertor.hxx index f788a3e5..dcf3b10c 100644 --- a/src/CONVERTOR/VISU_Convertor.hxx +++ b/src/CONVERTOR/VISU_Convertor.hxx @@ -40,10 +40,9 @@ #include "MED_Vector.hxx" #include -//pkv f -class vtkCell; -//pkv t + class vtkUnstructuredGrid; +class vtkCell; namespace VISU { @@ -145,7 +144,6 @@ namespace VISU vtkIdType GetElemObjID(int theVtkI) const = 0; - //pkv f virtual vtkCell* GetElemCell(int theObjID) = 0; @@ -153,7 +151,6 @@ namespace VISU virtual float* GetNodeCoord(int theObjID) = 0; - //pkv t }; @@ -220,16 +217,17 @@ namespace VISU struct TFamily: virtual TIntId { TEntity myEntity; + TName myName; }; //--------------------------------------------------------------- typedef std::pair TFamilyAndEntity; - typedef std::set TFamilyAndEntitySet; + typedef std::set TFamilySet; struct TGroup: virtual TBaseStructure { - TFamilyAndEntitySet myFamilyAndEntitySet; + TFamilySet myFamilySet; }; @@ -320,15 +318,23 @@ public: virtual TOutput* GetMeshOnEntity(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFamilyName = "") = 0; + const VISU::TEntity& theEntity) = 0; + virtual + TOutput* + GetFamilyOnEntity(const std::string& theMeshName, + const VISU::TEntity& theEntity, + const std::string& theFamilyName) = 0; virtual float GetMeshOnEntitySize(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFamilyName = "") = 0; + const VISU::TEntity& theEntity) = 0; + virtual + float + GetFamilyOnEntitySize(const std::string& theMeshName, + const VISU::TEntity& theEntity, + const std::string& theFamilyName) = 0; virtual TOutput* GetMeshOnGroup(const std::string& theMeshName, diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index acac4c18..e552fd7f 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -759,33 +759,28 @@ namespace void GetCellsOnGroup(const TVTKSource& theSource, const PMeshImpl& theMesh, - const TFamilyAndEntitySet& theFamilyAndEntitySet) + const TFamilySet& theFamilySet) { //Calculate dimentions of the group INITMSG(MYDEBUG,"GetCellsOnGroup\n"); int aNbCells = 0, aCellsSize = 0; - VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin(); - for(; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){ - const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter; - const string& aFamilyName = aFamilyAndEntity.first; - VISU::TEntity anEntity = aFamilyAndEntity.second; - VISU::PMeshOnEntityImpl aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity]; - pair aCellsDim = aMeshOnEntity->GetCellsDims(aFamilyName); - aNbCells += aCellsDim.first; - aCellsSize += aCellsDim.second; + VISU::TFamilySet::const_iterator aFamilyIter = theFamilySet.begin(); + for(; aFamilyIter != theFamilySet.end(); aFamilyIter++){ + VISU::PFamilyImpl aFamily = *aFamilyIter; + aCellsSize += aFamily->myCellsSize; + aNbCells += aFamily->myNbCells; } vtkCellArray* aConnectivity = vtkCellArray::New(); aConnectivity->Allocate(aCellsSize,0); vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New(); aCellTypesArray->SetNumberOfComponents(1); aCellTypesArray->SetNumberOfTuples(aNbCells); - aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin(); - for(int i = 0, j = 0; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){ - const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter; - const string& aFamilyName = aFamilyAndEntity.first; - const VISU::TEntity& anEntity = aFamilyAndEntity.second; + aFamilyIter = theFamilySet.begin(); + for(int i = 0, j = 0; aFamilyIter != theFamilySet.end(); aFamilyIter++){ + VISU::PFamilyImpl aFamily = *aFamilyIter; + const std::string& aFamilyName = aFamily->myName; + const VISU::TEntity& anEntity = aFamily->myEntity; PMeshOnEntityImpl aMeshOnEntity = theMesh->myMeshOnEntityMap[anEntity]; - PFamilyImpl aFamily = GetFamily(aMeshOnEntity,aFamilyName); const VISU::TGeom2Cell2Connect &aGeom2Cell2Connect = aMeshOnEntity->myGeom2Cell2Connect; VISU::TGeom2Cell2Connect::const_iterator aGeom2Cell2ConnectIter = aGeom2Cell2Connect.begin(); for(; aGeom2Cell2ConnectIter != aGeom2Cell2Connect.end(); aGeom2Cell2ConnectIter++){ @@ -1330,23 +1325,9 @@ VISU_Convertor_impl VISU_Convertor::TOutput* VISU_Convertor_impl ::GetMeshOnEntity(const string& theMeshName, - const VISU::TEntity& theEntity, - const string& theFamilyName) + const VISU::TEntity& theEntity) { - if(theFamilyName == "") - return GetMeshOnEntity2(theMeshName,theEntity); - else - return GetFamilyOnEntity(theMeshName,theEntity,theFamilyName); -} - - -//--------------------------------------------------------------- -VISU_Convertor::TOutput* -VISU_Convertor_impl -::GetMeshOnEntity2(const string& theMeshName, - const VISU::TEntity& theEntity) -{ - INITMSG(MYDEBUG,"GetMeshOnEntity2"<< + INITMSG(MYDEBUG,"GetMeshOnEntity"<< "; theMeshName = '"<first; - aResult += GetMeshOnEntitySize(aMeshName,anEntity,aFamilyName); + aResult += GetFamilyOnEntitySize(aMeshName,anEntity,aFamilyName); } //Import mesh on entity aResult += GetMeshOnEntitySize(aMeshName,anEntity); @@ -1818,21 +1799,7 @@ VISU_Convertor_impl float VISU_Convertor_impl ::GetMeshOnEntitySize(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFamilyName) -{ - if(theFamilyName == "") - return GetMeshOnEntitySize2(theMeshName,theEntity); - else - return GetFamilyOnEntitySize(theMeshName,theEntity,theFamilyName); -} - - -//--------------------------------------------------------------- -float -VISU_Convertor_impl -::GetMeshOnEntitySize2(const std::string& theMeshName, - const VISU::TEntity& theEntity) + const VISU::TEntity& theEntity) { TFindMeshOnEntity aFindMeshOnEntity = FindMeshOnEntity(theMeshName,theEntity); @@ -1853,7 +1820,7 @@ VISU_Convertor_impl aLinksSize = 0; vtkIdType aResult = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize + aLinksSize; - MSG(MYDEBUG,"GetMeshOnEntitySize2 "<< + MSG(MYDEBUG,"GetMeshOnEntitySize "<< "- aResult = "<myId = anId; aFamily->myEntity = aVEntity; + aFamily->myName = aFamilyName; aFamily->myNbCells = aSize; aFamily->myCellsSize = 0; @@ -686,7 +687,8 @@ namespace INITMSG(MY_GROUP_DEBUG,"aGroupName = '"<myFamilySet; + const MED::TFamilyInfoSet& aFamilyInfoSet = aGroupInfoIter->second; MED::TFamilyInfoSet::const_iterator aFamilyIter = aFamilyInfoSet.begin(); for(; aFamilyIter != aFamilyInfoSet.end(); aFamilyIter++){ @@ -711,10 +713,10 @@ namespace goto exit_lable; } } - } + } exit_lable: if(aFamily && aVEntity >= 0){ - aGroup->myFamilyAndEntitySet.insert(TFamilyAndEntity(aFamilyName,aVEntity)); + aFamilySet.insert(aFamily); INITMSG(MY_GROUP_DEBUG, "- aFamilyName = '"<myEntity); - aFamilyAndEntitySet.insert(aFamilyAndEntity); + aFamilySet.insert(aFamily); aGroup->myNbCells += aFamily->myNbCells; aGroup->myCellsSize += aFamily->myCellsSize; } } - if(!aGroup->myFamilyAndEntitySet.empty()){ + if(!aFamilySet.empty()){ TGroupMap& aGroupMap = aMesh->myGroupMap; aGroupMap[aSupportName.in()] = aGroup; } @@ -907,17 +906,16 @@ VISU_MEDConvertor int VISU_MEDConvertor ::LoadMeshOnGroup(VISU::PMeshImpl theMesh, - const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet) + const VISU::TFamilySet& theFamilySet) { //Main part of code int isPointsUpdated = 0; int isCellsOnEntityUpdated = 0; - VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin(); - for(; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){ - const string& aFamilyName = aFamilyAndEntitySetIter->first; - const VISU::TEntity& aVEntity = aFamilyAndEntitySetIter->second; + TFamilySet::const_iterator aFamilyIter = theFamilySet.begin(); + for(; aFamilyIter != theFamilySet.end(); aFamilyIter++){ + PCFamily aFamily = *aFamilyIter; + const VISU::TEntity& aVEntity = aFamily->myEntity; PCMeshOnEntity aMeshOnEntity = theMesh->myMeshOnEntityMap[aVEntity]; - PCFamily aFamily = VISU::GetFamily(aMeshOnEntity,aFamilyName); if(aVEntity == VISU::NODE_ENTITY){ isPointsUpdated += LoadPointsOnFamily(theMesh,aFamily); isCellsOnEntityUpdated += LoadCellsOnEntity(theMesh,aMeshOnEntity); diff --git a/src/VISU_I/VISU_CorbaMedConvertor.hxx b/src/VISU_I/VISU_CorbaMedConvertor.hxx index f6f3b7d7..b0282c75 100644 --- a/src/VISU_I/VISU_CorbaMedConvertor.hxx +++ b/src/VISU_I/VISU_CorbaMedConvertor.hxx @@ -124,7 +124,7 @@ class VISU_MEDConvertor: public VISU_Convertor_impl{ virtual int LoadMeshOnGroup(VISU::PMeshImpl theMesh, - const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet); + const VISU::TFamilySet& theFamilySet); virtual int diff --git a/src/VISU_I/VISU_Mesh_i.cc b/src/VISU_I/VISU_Mesh_i.cc index 6d885102..10462c6a 100644 --- a/src/VISU_I/VISU_Mesh_i.cc +++ b/src/VISU_I/VISU_Mesh_i.cc @@ -92,7 +92,7 @@ int VISU::Mesh_i::IsPossible (Result_i* theResult, const char* theMeshName, try{ MESSAGE("Mesh_i::IsPossible - theMeshName = '"<GetInput()->GetMeshOnEntitySize(theMeshName,(VISU::TEntity)theEntity,theFamilyName); + theResult->GetInput()->GetMeshOnEntitySize(theMeshName,(VISU::TEntity)theEntity); bool aResult = VISU_PipeLine::CheckAvailableMemory(aSize); MESSAGE("Mesh_i::IsPossible - CheckAvailableMemory = "<first; try{ - myInput->GetMeshOnEntity(aMeshName,anEntity,aFamilyName); + myInput->GetFamilyOnEntity(aMeshName,anEntity,aFamilyName); }catch(std::exception& exc){ INFOS("Follow exception was occured :\n"<second; - const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup->myFamilyAndEntitySet; - VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = aFamilyAndEntitySet.begin(); - for(; aFamilyAndEntitySetIter != aFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){ - const VISU::TFamilyAndEntity& aFamilyAndEntity = *aFamilyAndEntitySetIter; - const string& aFamilyName = aFamilyAndEntity.first; - const VISU::TEntity& anEntity = aFamilyAndEntity.second; + const VISU::TFamilySet& aFamilySet = aGroup->myFamilySet; + VISU::TFamilySet::const_iterator aFamilyIter = aFamilySet.begin(); + for(; aFamilyIter != aFamilySet.end(); aFamilyIter++){ + const VISU::PFamily& aFamily = *aFamilyIter; + const string& aFamilyName = aFamily->myName; + const VISU::TEntity& anEntity = aFamily->myEntity; aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s", VISU::TFAMILY, aMeshName.c_str(),