From 7b9bcafa9c4c66c3713733e34cdd03d45278b721 Mon Sep 17 00:00:00 2001 From: pkv Date: Fri, 26 Aug 2005 09:48:20 +0000 Subject: [PATCH] To intorduce ID's mapping --- src/CONVERTOR/Makefile.in | 6 ++-- src/CONVERTOR/VISUConvertor.cxx | 27 ++++++++++++-- src/CONVERTOR/VISU_Convertor.hxx | 11 +++++- src/CONVERTOR/VISU_Convertor_impl.cxx | 52 ++++++++++++++++++++++----- src/CONVERTOR/VISU_Convertor_impl.hxx | 14 ++++++-- 5 files changed, 93 insertions(+), 17 deletions(-) diff --git a/src/CONVERTOR/Makefile.in b/src/CONVERTOR/Makefile.in index fcbad7b7..1e204619 100644 --- a/src/CONVERTOR/Makefile.in +++ b/src/CONVERTOR/Makefile.in @@ -53,10 +53,10 @@ BIN_SRC = CPPFLAGS+= -ftemplate-depth-32 $(VTK_INCLUDES) $(HDF5_INCLUDES) $(QT_INCLUDES) \ -I${KERNEL_ROOT_DIR}/include/salome \ -I${MED_ROOT_DIR}/include/salome \ + -I${GUI_ROOT_DIR}/include/salome \ $(BOOST_CPPFLAGS) -LDFLAGS+= $(VTK_LIBS) $(QT_LIBS) -L${MED_ROOT_DIR}/lib/salome -lMEDWrapper - -LDFLAGSFORBIN=$(LDFLAGS) -lMEDWrapper_V2_2 -lMEDWrapper_V2_1 -lMEDWrapperBase +LDFLAGS+= $(VTK_LIBS) $(QT_LIBS) -L${MED_ROOT_DIR}/lib/salome -L${GUI_ROOT_DIR}/lib/salome -lMEDWrapper -lVTKViewer +LDFLAGSFORBIN=$(LDFLAGS) -lMEDWrapper_V2_2 -lMEDWrapper_V2_1 -lMEDWrapperBase -lVTKViewer @CONCLUDE@ diff --git a/src/CONVERTOR/VISUConvertor.cxx b/src/CONVERTOR/VISUConvertor.cxx index 5c95f60d..716ab8e6 100644 --- a/src/CONVERTOR/VISUConvertor.cxx +++ b/src/CONVERTOR/VISUConvertor.cxx @@ -34,6 +34,9 @@ #include #include #include +#include "VISU_Convertor_impl.hxx" + +#include using namespace std; @@ -45,7 +48,10 @@ static int MYDEBUG = 0; #define _DEXCEPT_ -void parseFile(const char* theFileName) { +typedef vtkUnstructuredGrid TOutput; + +void parseFile(const char* theFileName) +{ #ifndef _DEXCEPT_ try{ #endif @@ -77,7 +83,24 @@ void parseFile(const char* theFileName) { VISU::TValField::const_iterator aValFieldIter = aValField.begin(); for(; aValFieldIter != aValField.end(); aValFieldIter++){ int aTimeStamp = aValFieldIter->first; - aCon->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp); + // + vtkUnstructuredGrid *aOut; + //int aNbNodes, aNbCells, i; + //VISU::TGaussPointID aID; + // + aOut=aCon->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp); + + //aNbNodes=aOut->GetNumberOfPoints(); + //aNbCells=aOut->GetNumberOfCells(); + //printf("aNbNodes =%d\n", aNbNodes); + //printf("aNbCells =%d\n", aNbCells); + // + //VISU::PGaussMesh pGaussMesh=aCon->GetGaussMesh(aMeshName,anEntity,aFieldName,aTimeStamp); + // + //for (i=0; iGetObjId(i); + // } + // //goto OK; } } diff --git a/src/CONVERTOR/VISU_Convertor.hxx b/src/CONVERTOR/VISU_Convertor.hxx index 2426356d..73bba7e2 100644 --- a/src/CONVERTOR/VISU_Convertor.hxx +++ b/src/CONVERTOR/VISU_Convertor.hxx @@ -169,7 +169,9 @@ namespace VISU typedef std::pair TGaussPointID; struct TGaussMesh: virtual TBaseStructure - {}; + { + virtual TGaussPointID GetObjId(int theVtkI)=0; + }; //--------------------------------------------------------------- @@ -345,6 +347,13 @@ public: 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 4f96c751..f8b627fd 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -48,6 +48,7 @@ #include #include +#include "VTKViewer_AppendFilter.h" using namespace std; using namespace VISU; @@ -107,7 +108,7 @@ namespace VISU ::GetFilter() const { if(!myFilter.GetPointer()){ - myFilter = vtkAppendFilter::New(); + myFilter = VTKViewer_AppendFilter::New(); myFilter->Delete(); } return myFilter; @@ -246,6 +247,21 @@ namespace VISU ::TGaussMeshImpl() {} + //--------------------------------------------------------------- + TGaussPointID TGaussMeshImpl::GetObjId(int theVtkI) + { + TGaussPointID aRetVID; + int aID, anIndexDS; + vtkIdType aVID;//, aRetVID=-1; + // + const TVTKAppendFilter& anAppendFilter = GetFilter(); + aID=anAppendFilter->GetElemObjId(theVtkI, anIndexDS); + // + TGaussSubMeshImpl& aSubMeshImpl=myGaussSubMeshArr[anIndexDS]; + aVID=(vtkIdType)aID; + aRetVID=aSubMeshImpl.GetObjID(aVID); + return aRetVID; + } //--------------------------------------------------------------- pair @@ -1142,17 +1158,17 @@ namespace theGaussSubMesh->myIsVTKDone = true; } - + //--------------------------------------------------------------- void - GetGaussMesh(const PMeshImpl& theMesh, + BuildGaussMesh(const PMeshImpl& theMesh, const PMeshOnEntityImpl& theMeshOnEntity, const PGaussMeshImpl& theGaussMesh) { if(theGaussMesh->myIsVTKDone) return; - - INITMSG(MYDEBUG,"GetGaussMesh"<GetFilter(); const TGeom2GaussSubMesh& aGeom2GaussSubMesh = theGaussMesh->myGeom2GaussSubMesh; TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin(); @@ -1167,6 +1183,7 @@ namespace aGaussSubMesh); const TVTKSource& aSource = aGaussSubMesh->GetSource(); + anAppendFilter->AddInput(aSource.GetPointer()); } anAppendFilter->Update(); // Fix on VTK @@ -1177,8 +1194,8 @@ namespace theGaussMesh->myIsVTKDone = true; } - - + + } @@ -1441,7 +1458,8 @@ VISU_Convertor_impl PGaussMeshImpl aGaussMesh = aValForTime->myGaussMesh; INITMSG(MYDEBUG,"aGaussMesh = "<myGeom2GaussSubMesh; - GetGaussMesh(aMesh,aVTKMeshOnEntity,aGaussMesh); + BuildGaussMesh(aMesh,aVTKMeshOnEntity,aGaussMesh); + //GetGaussMesh(aMesh,aVTKMeshOnEntity,aGaussMesh); const TVTKAppendFilter& anAppendFilter = aGaussMesh->GetFilter(); aSource->ShallowCopy(anAppendFilter->GetOutput()); @@ -1478,6 +1496,24 @@ VISU_Convertor_impl return aSource.GetPointer(); } +//--------------------------------------------------------------- +VISU::PGaussMesh VISU_Convertor_impl::GetGaussMesh(const string& theMeshName, + const VISU::TEntity& theEntity, + const string& theFieldName, + int theStampsNum) +{ + GetTimeStampOnMesh(theMeshName, theEntity, theFieldName, theStampsNum); + + TFindTimeStamp aFindTimeStamp = FindTimeStamp(theMeshName, + theEntity, + theFieldName, + theStampsNum); + PGaussPtsValForTimeImpl aValForTime = boost::get<4>(aFindTimeStamp); + PGaussMeshImpl aGaussMesh=aValForTime->myGaussMesh; + + return aGaussMesh; +} + //--------------------------------------------------------------- VISU::PMeshImpl diff --git a/src/CONVERTOR/VISU_Convertor_impl.hxx b/src/CONVERTOR/VISU_Convertor_impl.hxx index 1bb1f443..df319f0f 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.hxx +++ b/src/CONVERTOR/VISU_Convertor_impl.hxx @@ -13,8 +13,10 @@ #include + + class vtkPoints; -class vtkAppendFilter; +class VTKViewer_AppendFilter; class vtkUnstructuredGrid; #include "VISU_Convertor.hxx" @@ -28,8 +30,7 @@ namespace VISU typedef vtkSmartPointer TVTKPoints; typedef vtkSmartPointer TVTKSource; - typedef vtkSmartPointer TVTKAppendFilter; - + typedef vtkSmartPointer TVTKAppendFilter; typedef float TCoord; //--------------------------------------------------------------- @@ -210,6 +211,7 @@ namespace VISU struct TGaussMeshImpl: virtual TGaussMesh, virtual TAppendFilter { TGaussMeshImpl(); + virtual TGaussPointID GetObjId(int theVtkI); TGaussSubMeshArr myGaussSubMeshArr; TGeom2GaussSubMesh myGeom2GaussSubMesh; }; @@ -410,6 +412,12 @@ public: 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 TOutput* -- 2.39.2