From: apo Date: Fri, 2 Sep 2005 07:28:30 +0000 (+0000) Subject: To unify ID's mapping as for TimeStamp as for Gauss Points X-Git-Tag: BR-D5-38-2003_D2005-12-09~40 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f07e26a7eda6467ee050d7f1a4bcd9b2de5b4ed1;p=modules%2Fvisu.git To unify ID's mapping as for TimeStamp as for Gauss Points --- diff --git a/src/CONVERTOR/Makefile.in b/src/CONVERTOR/Makefile.in index c58487cb..2c434283 100644 --- a/src/CONVERTOR/Makefile.in +++ b/src/CONVERTOR/Makefile.in @@ -42,7 +42,9 @@ EXPORT_HEADERS = \ # Libraries targets LIB = libVisuConvertor.la -LIB_SRC = VISU_Convertor.cxx \ +LIB_SRC = \ + VISU_IDMapper.cxx \ + VISU_Convertor.cxx \ VISU_Convertor_impl.cxx \ VISU_ConvertorUtils.cxx \ VISU_ExtractUnstructuredGrid.cxx \ diff --git a/src/CONVERTOR/VISUConvertor.cxx b/src/CONVERTOR/VISUConvertor.cxx index 8fc31f24..897e7a81 100644 --- a/src/CONVERTOR/VISUConvertor.cxx +++ b/src/CONVERTOR/VISUConvertor.cxx @@ -85,10 +85,9 @@ void parseFile(const char* theFileName) int aTimeStamp = aValFieldIter->first; if(anEntity != VISU::NODE_ENTITY){ - VISU::TVTKOutput* aDataSet = - aCon->GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp); VISU::PGaussMesh aGaussMesh = - aCon->GetGaussMesh(aMeshName,anEntity,aFieldName,aTimeStamp); + aCon->GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp); + VISU::TVTKOutput* aDataSet = aGaussMesh->GetVTKOutput(); int aNbCells = aDataSet->GetNumberOfCells(); for(int anCellId = 0; anCellId < aNbCells; anCellId++){ diff --git a/src/CONVERTOR/VISU_Convertor.hxx b/src/CONVERTOR/VISU_Convertor.hxx index 0240fb08..76e859aa 100644 --- a/src/CONVERTOR/VISU_Convertor.hxx +++ b/src/CONVERTOR/VISU_Convertor.hxx @@ -149,7 +149,7 @@ namespace VISU typedef vtkIdType TLocalPntID; typedef std::pair TGaussPointID; - struct TGaussMesh: virtual TBaseStructure + struct TGaussMesh: virtual TIDMapper { virtual TGaussPointID @@ -323,19 +323,12 @@ public: int theStampsNum) = 0; virtual - TOutput* + VISU::PGaussMesh GetTimeStampOnGaussPts(const std::string& theMeshName, const VISU::TEntity& theEntity, const std::string& theFieldName, int theStampsNum) = 0; - virtual - VISU::PGaussMesh - GetGaussMesh(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFieldName, - int theStampsNum) = 0; - virtual float GetTimeStampSize(const std::string& theMeshName, diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index abd08dc0..fb4058ae 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -1806,7 +1806,7 @@ VISU_Convertor_impl //--------------------------------------------------------------- -VISU_Convertor::TOutput* +VISU::PGaussMesh VISU_Convertor_impl ::GetTimeStampOnGaussPts(const string& theMeshName, const VISU::TEntity& theEntity, @@ -1833,8 +1833,8 @@ VISU_Convertor_impl PFieldImpl aField = boost::get<3>(aFindTimeStamp); //Main part of code - TSource& aGaussPtsSource = aValForTime->myGaussPtsSource; - const TVTKSource& aSource = aGaussPtsSource.GetSource(); + PGaussMeshImpl aGaussMesh = aValForTime->myGaussMesh; + TSource& aGaussPtsSource = aGaussMesh->mySource; #ifndef _DEXCEPT_ try{ #endif @@ -1848,6 +1848,7 @@ VISU_Convertor_impl BuildGaussMesh(aMesh,aVTKMeshOnEntity,aGaussMesh); const TVTKAppendFilter& anAppendFilter = aGaussMesh->GetFilter(); + const TVTKSource& aSource = aGaussPtsSource.GetSource(); aSource->ShallowCopy(anAppendFilter->GetOutput()); GetTimeStampOnGaussMesh(aSource,aField,aValForTime); @@ -1879,30 +1880,9 @@ VISU_Convertor_impl } #endif - return aSource.GetPointer(); -} - -//--------------------------------------------------------------- -VISU::PGaussMesh -VISU_Convertor_impl -::GetGaussMesh(const string& theMeshName, - const VISU::TEntity& theEntity, - const string& theFieldName, - int theStampsNum) -{ - GetTimeStampOnGaussPts(theMeshName, theEntity, theFieldName, theStampsNum); - - TFindTimeStamp aFindTimeStamp = FindTimeStamp(theMeshName, - theEntity, - theFieldName, - theStampsNum); - PValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp); - PGaussMeshImpl aGaussMesh=aValForTime->myGaussMesh; - return aGaussMesh; } - //--------------------------------------------------------------- VISU::PMeshImpl VISU_Convertor_impl diff --git a/src/CONVERTOR/VISU_Convertor_impl.hxx b/src/CONVERTOR/VISU_Convertor_impl.hxx index 44ff2769..dc300b42 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.hxx +++ b/src/CONVERTOR/VISU_Convertor_impl.hxx @@ -62,13 +62,15 @@ namespace VISU const TVTKSource& GetSource() const; + virtual TVTKOutput* GetVTKOutput(); }; //--------------------------------------------------------------- - class TAppendFilter: public virtual TIsVTKDone + class TAppendFilter: public virtual TIsVTKDone, + public virtual TIDMapper { mutable TVTKAppendFilter myFilter; public: @@ -229,13 +231,6 @@ namespace VISU vtkCell* GetElemCell(vtkIdType theObjID); - virtual - TVTKOutput* - GetVTKOutput() - { - return mySource.GetVTKOutput(); - } - TID2ID myElemObj2VTKID; TSubProfileArr mySubProfileArr; PNamedPointCoords myNamedPointCoords; @@ -286,6 +281,8 @@ namespace VISU GetObjID(int theVtkI) const; TGaussSubMeshArr myGaussSubMeshArr; + + TSource mySource; TGeom2GaussSubMesh myGeom2GaussSubMesh; }; typedef SharedPtr PGaussMeshImpl; @@ -336,13 +333,6 @@ namespace VISU vtkIdType GetElemObjID(vtkIdType theID) const; - virtual - TVTKOutput* - GetVTKOutput() - { - return TAppendFilter::GetVTKOutput(); - } - TID2ID myElemObj2VTKID; TSubMeshArr mySubMeshArr; PNamedPointCoords myNamedPointCoords; @@ -503,10 +493,7 @@ namespace VISU TMeshValue& GetMeshValue(vtkIdType theGeom); - TSource myMeshSource; - TSource myGaussPtsSource; - - int myNbGauss; + vtkIdType myNbGauss; virtual int @@ -587,19 +574,12 @@ public: int theStampsNum); virtual - TOutput* + VISU::PGaussMesh GetTimeStampOnGaussPts(const std::string& theMeshName, const VISU::TEntity& theEntity, const std::string& theFieldName, int theStampsNum); - virtual - VISU::PGaussMesh - GetGaussMesh(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFieldName, - int theStampsNum); - virtual float GetFieldOnMeshSize(const std::string& theMeshName, diff --git a/src/CONVERTOR/VISU_IDMapper.cxx b/src/CONVERTOR/VISU_IDMapper.cxx new file mode 100644 index 00000000..c1f07b5b --- /dev/null +++ b/src/CONVERTOR/VISU_IDMapper.cxx @@ -0,0 +1,77 @@ +// VISU OBJECT : interactive object for VISU entities implementation +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// File: +// Author: +// Module : VISU + +#include "VISU_IDMapper.hxx" + +#include + +namespace VISU +{ + //--------------------------------------------------------------- + float* + TIDMapper + ::GetNodeCoord(vtkIdType theObjID) + { + vtkIdType aVTKID = GetNodeVTKID(theObjID); + return GetVTKOutput()->GetPoint(aVTKID); + } + + vtkIdType + TIDMapper + ::GetNodeVTKID(vtkIdType theID) const + { + return theID; + } + + vtkIdType + TIDMapper + ::GetNodeObjID(vtkIdType theID) const + { + return theID; + } + + vtkCell* + TIDMapper + ::GetElemCell(int theObjID) + { + vtkIdType aVtkID = GetElemVTKID(theObjID); + return GetVTKOutput()->GetCell(aVtkID); + } + + vtkIdType + TIDMapper + ::GetElemVTKID(vtkIdType theID) const + { + return theID; + } + + vtkIdType + TIDMapper + ::GetElemObjID(vtkIdType theID) const + { + return theID; + } +} diff --git a/src/CONVERTOR/VISU_IDMapper.hxx b/src/CONVERTOR/VISU_IDMapper.hxx index 6bc0e1b1..6b1e5a50 100644 --- a/src/CONVERTOR/VISU_IDMapper.hxx +++ b/src/CONVERTOR/VISU_IDMapper.hxx @@ -53,27 +53,27 @@ namespace VISU { virtual vtkIdType - GetNodeObjID(vtkIdType theID) const = 0; + GetNodeObjID(vtkIdType theID) const; virtual vtkIdType - GetNodeVTKID(vtkIdType theID) const = 0; + GetNodeVTKID(vtkIdType theID) const; virtual float* - GetNodeCoord(vtkIdType theObjID) = 0; + GetNodeCoord(vtkIdType theObjID); virtual vtkIdType - GetElemObjID(vtkIdType theID) const = 0; + GetElemObjID(vtkIdType theID) const; virtual vtkIdType - GetElemVTKID(vtkIdType theID) const = 0; + GetElemVTKID(vtkIdType theID) const; virtual vtkCell* - GetElemCell(vtkIdType theObjID) = 0; + GetElemCell(vtkIdType theObjID); virtual TVTKOutput* diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index c9d54906..eb9222d5 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -1668,14 +1668,15 @@ VISU_MedConvertor VISU::PMEDField theField, VISU::PMEDValForTime theValForTime) { - TSource& aMeshSource = theValForTime->myMeshSource; + PProfileImpl aProfile = theValForTime->myProfile; + TSource& aProfileSource = aProfile->mySource; return LoadValForTime(theMed, theMesh, theMeshOnEntity, theField, theValForTime, false, - aMeshSource.myIsDone); + aProfileSource.myIsDone); } @@ -1688,7 +1689,8 @@ VISU_MedConvertor VISU::PMEDField theField, VISU::PMEDValForTime theValForTime) { - TSource& aGaussPtsSource = theValForTime->myGaussPtsSource; + PGaussMeshImpl aGaussMesh = theValForTime->myGaussMesh; + TSource& aGaussPtsSource = aGaussMesh->mySource; return LoadValForTime(theMed, theMesh, theMeshOnEntity, diff --git a/src/PIPELINE/VISUPipeLine.cxx b/src/PIPELINE/VISUPipeLine.cxx index 5a7437e5..d5f2024a 100644 --- a/src/PIPELINE/VISUPipeLine.cxx +++ b/src/PIPELINE/VISUPipeLine.cxx @@ -115,14 +115,13 @@ int main(int argc, char** argv){ int aTimeStamp = aValFieldIter->first; VISU::PIDMapper anIDMapper; - VISU::TVTKOutput* aDataSet; - if(anEntity != VISU::NODE_ENTITY) - aDataSet = aConvertor->GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp); - else{ + if(anEntity != VISU::NODE_ENTITY){ + anIDMapper = aConvertor->GetTimeStampOnGaussPts(aMeshName,anEntity,aFieldName,aTimeStamp); + }else{ continue; anIDMapper = aConvertor->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp); - aDataSet = anIDMapper->GetVTKOutput(); } + VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput(); TPresent* aPresent = TPresent::New(); aPresent->SetInput(aDataSet); diff --git a/src/PIPELINE/VISU_GaussPointsPL.cxx b/src/PIPELINE/VISU_GaussPointsPL.cxx index 233d4e24..b11a2ab3 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.cxx +++ b/src/PIPELINE/VISU_GaussPointsPL.cxx @@ -140,3 +140,19 @@ VISU_GaussPointsPL::~VISU_GaussPointsPL() this->myGeomFilter = NULL; } } + +//======================================================================= +void +VISU_GaussPointsPL +::SetGaussMesh(const VISU::PGaussMesh& theGaussMesh) +{ + myGaussMesh = theGaussMesh; + SetIDMapper(myGaussMesh); +} + +const VISU::PGaussMesh& +VISU_GaussPointsPL +::GetGaussMesh() const +{ + return myGaussMesh; +} diff --git a/src/PIPELINE/VISU_GaussPointsPL.hxx b/src/PIPELINE/VISU_GaussPointsPL.hxx index 98b7780c..4d7b0bef 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.hxx +++ b/src/PIPELINE/VISU_GaussPointsPL.hxx @@ -29,6 +29,7 @@ #define VISU_GaussPointsPL_HeaderFile #include "VISU_ScalarMapPL.hxx" +#include "VISU_Convertor.hxx" class VISU_OpenGLPointSpriteMapper; @@ -49,9 +50,16 @@ public: virtual void Build(); virtual void Update(); + void + SetGaussMesh(const VISU::PGaussMesh& theGaussMesh); + + const VISU::PGaussMesh& + GetGaussMesh()const; + protected: VISU_OpenGLPointSpriteMapper* myPSMapper; vtkGeometryFilter* myGeomFilter; + VISU::PGaussMesh myGaussMesh; }; #endif diff --git a/src/VISU_I/VISU_CorbaMedConvertor.cxx b/src/VISU_I/VISU_CorbaMedConvertor.cxx index 26b14fbf..6106947b 100644 --- a/src/VISU_I/VISU_CorbaMedConvertor.cxx +++ b/src/VISU_I/VISU_CorbaMedConvertor.cxx @@ -1258,7 +1258,8 @@ VISU_MEDConvertor::LoadField(VISU::PCMesh theMesh, VISU::PCValForTime theValForTime) { //Check on loading already done - TSource& aMeshSource = theValForTime->myMeshSource; + PProfileImpl aProfile = theValForTime->myProfile; + TSource& aMeshSource = aProfile->mySource; if(aMeshSource.myIsDone) return 0; diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index e915e9d1..5146b570 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -133,17 +133,19 @@ VISU::GaussPoints_i { if(theResult->GetInput() == NULL) throw std::runtime_error("Mesh_i::Build - theResult->GetInput() == NULL !!!"); + myField = theResult->GetInput()->GetField(myMeshName,myEntity,myFieldName); if(myField == NULL) throw std::runtime_error("There is no Field with the parameters !!!"); - VISU_Convertor::TOutput *anOutput = + VISU::PGaussMesh aGaussMesh = theResult->GetInput()->GetTimeStampOnGaussPts(myMeshName,myEntity,myFieldName,myIteration); - if(anOutput == NULL) + if(!aGaussMesh) throw std::runtime_error("There is no TimeStamp with the parameters !!!"); - myScalarMapPL->SetInput(anOutput); - myScalarMapPL->Build(); + + myGaussPointsPL->SetGaussMesh(aGaussMesh); + myGaussPointsPL->Build(); } diff --git a/src/VISU_SWIG/VISU_Gen_s.cc b/src/VISU_SWIG/VISU_Gen_s.cc index 1a499def..ddad586a 100644 --- a/src/VISU_SWIG/VISU_Gen_s.cc +++ b/src/VISU_SWIG/VISU_Gen_s.cc @@ -48,8 +48,9 @@ ScalarMap::ScalarMap(Convertor* theConvertor, const char* theMeshName, int theEn : myScalarMap(NULL) { if(VISU_Convertor* aConvertor = theConvertor->GetImpl()){ - vtkUnstructuredGrid* aDataSet = + VISU::PIDMapper anIDMapper = aConvertor->GetTimeStampOnMesh(theMeshName,VISU::TEntity(theEntity),theFieldName,theIteration); + VISU::TVTKOutput* aDataSet = anIDMapper->GetVTKOutput(); if(aDataSet){ myScalarMap = VISU_ScalarMapPL::New(); myScalarMap->SetInput(aDataSet);