From: apo Date: Wed, 30 Apr 2008 07:46:47 +0000 (+0000) Subject: To improve handling of ELNO data X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=48688c8a28a480e3eb700e8e73f4771dfcdb4382;p=modules%2Fvisu.git To improve handling of ELNO data --- diff --git a/src/CONVERTOR/VISU_Convertor.hxx b/src/CONVERTOR/VISU_Convertor.hxx index 0ee92fe3..cad044cb 100644 --- a/src/CONVERTOR/VISU_Convertor.hxx +++ b/src/CONVERTOR/VISU_Convertor.hxx @@ -138,10 +138,10 @@ public: //! Get mesh with attached values for corresponding MED TIMESTAMP virtual VISU::PUnstructuredGridIDMapper - GetTimeStampOnMesh(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFieldName, - int theTimeStampNumber) = 0; + GetTimeStampOnMesh( const std::string& theMeshName, + const VISU::TEntity& theEntity, + const std::string& theFieldName, + int theTimeStampNumber ) = 0; //! Get Gauss Points mesh with attached values for corresponding MED TIMESTAMP virtual diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index ad0f502a..e9ecb27b 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -847,82 +847,63 @@ VISU_Convertor_impl //--------------------------------------------------------------- vtkUnstructuredGrid* VISU_Convertor_impl -::GetTimeStampOnProfile(const VISU::PMeshImpl& theMesh, - const VISU::PMeshOnEntityImpl& theMeshOnEntity, - const VISU::PFieldImpl& theField, - const VISU::PValForTimeImpl& theValForTime, - const VISU::PUnstructuredGridIDMapperImpl& theUnstructuredGridIDMapper, - const VISU::PProfileImpl& theProfile, - const VISU::TEntity& theEntity) +::GetTimeStampOnProfile( const VISU::PMeshImpl& theMesh, + const VISU::PMeshOnEntityImpl& theMeshOnEntity, + const VISU::PFieldImpl& theField, + const VISU::PValForTimeImpl& theValForTime, + const VISU::PUnstructuredGridIDMapperImpl& theUnstructuredGridIDMapper, + const VISU::PProfileImpl& theProfile, + const VISU::TEntity& theEntity ) { - vtkUnstructuredGrid* anOutput = NULL; - - LoadMeshOnEntity(theMesh, theMeshOnEntity); - GetMeshOnEntity(theMeshOnEntity->myMeshName, theMeshOnEntity->myEntity); - GetMeshOnProfile(theMesh, theMeshOnEntity, theProfile); - - bool isNeedInCells = false; + LoadMeshOnEntity( theMesh, theMeshOnEntity ); + GetMeshOnEntity( theMeshOnEntity->myMeshName, theMeshOnEntity->myEntity ); + GetMeshOnProfile( theMesh, theMeshOnEntity, theProfile ); theUnstructuredGridIDMapper->myIDMapper = theProfile; - if(theMeshOnEntity->myEntity == VISU::NODE_ENTITY){ + + if ( theMeshOnEntity->myEntity == VISU::NODE_ENTITY ) { // add geometry elements to output, // if timestamp on NODE_ENTITY and // on profiles with status eAddPart - VISU::TGeom2SubProfile::const_iterator anIter = theProfile->myGeom2SubProfile.begin(); - for(; anIter != (theProfile->myGeom2SubProfile).end(); anIter++){ - const VISU::EGeometry aGeom = anIter->first; - const VISU::PSubProfileImpl aSubProfile = anIter->second; - if(aSubProfile->myStatus == VISU::eAddPart && aGeom == VISU::ePOINT1){ - isNeedInCells = true; - break; + const VISU::TGeom2SubProfile& aGeom2SubProfile = theProfile->myGeom2SubProfile; + VISU::TGeom2SubProfile::const_iterator aSubProfileIter = aGeom2SubProfile.begin(); + for ( ; aSubProfileIter != aGeom2SubProfile.end(); aSubProfileIter++ ) { + const VISU::EGeometry& aGeom = aSubProfileIter->first; + const VISU::PSubProfileImpl& aSubProfile = aSubProfileIter->second; + if ( aSubProfile->myStatus == VISU::eAddPart && aGeom == VISU::ePOINT1 ) { + const VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap; + VISU::TMeshOnEntityMap::const_reverse_iterator aMeshOnEntityIter = aMeshOnEntityMap.rbegin(); + for( ; aMeshOnEntityIter != aMeshOnEntityMap.rend(); aMeshOnEntityIter++ ) { + VISU::TEntity anEntity = aMeshOnEntityIter->first; + if ( anEntity == VISU::NODE_ENTITY ) + continue; + VISU::PNamedIDMapper aNamedIDMapper = GetMeshOnEntity( theMesh->myName, anEntity ); + if( aNamedIDMapper ) { + theUnstructuredGridIDMapper->SetReferencedMesh( aNamedIDMapper ); + VISU::PUnstructuredGrid aSource = theUnstructuredGridIDMapper->GetSource(); + VISU::GetTimeStampOnProfile( aSource, theField, theValForTime, theEntity ); + + return theUnstructuredGridIDMapper->GetUnstructuredGridOutput(); + } + } } } - if(isNeedInCells){ - theUnstructuredGridIDMapper->myIsSpecialKey = true; - GetTimeStampOnNodalProfile(theMesh,theUnstructuredGridIDMapper,theField,theValForTime,theEntity); - anOutput = theUnstructuredGridIDMapper->GetUnstructuredGridOutput(); - } - } - if(!isNeedInCells){ - vtkUnstructuredGrid* anOutput = theUnstructuredGridIDMapper->GetUnstructuredGridOutput(); - const VISU::PUnstructuredGrid& aSource = theUnstructuredGridIDMapper->mySource.GetSource(); - //VISU::GetTimeStampOnProfile(aSource, theField, theValForTime, theEntity); - VISU::GetElnoTimeStamp(aSource, theField, theValForTime, theEntity); } - return anOutput; -} -void -VISU_Convertor_impl -::GetTimeStampOnNodalProfile(const VISU::PMeshImpl& theMesh, - const VISU::PUnstructuredGridIDMapperImpl& theIDMapperFilter, - const VISU::PFieldImpl& theField, - const VISU::PValForTimeImpl& theValForTime, - const VISU::TEntity& theEntity) -{ - const VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap; - VISU::TMeshOnEntityMap::const_iterator aIter = aMeshOnEntityMap.begin(); - for(;aIter!=aMeshOnEntityMap.end();aIter++){ - VISU::TEntity aEntity = aIter->first; - if(aEntity != VISU::NODE_ENTITY){ - VISU::PNamedIDMapper aMapper = GetMeshOnEntity(theMesh->myName,aEntity); - if(aMapper) - theIDMapperFilter->myMappers[aEntity] = aMapper; - } - } + VISU::PUnstructuredGrid aSource = theUnstructuredGridIDMapper->GetSource(); + VISU::GetTimeStampOnProfile( aSource, theField, theValForTime, theEntity ); - theIDMapperFilter->GetUnstructuredGridOutput(); - const VISU::PUnstructuredGrid& aSource = theIDMapperFilter->mySource.GetSource(); - VISU::GetTimeStampOnProfile(aSource,theField,theValForTime,theEntity); + return theUnstructuredGridIDMapper->GetUnstructuredGridOutput(); } + //--------------------------------------------------------------- VISU::PUnstructuredGridIDMapper VISU_Convertor_impl -::GetTimeStampOnMesh(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFieldName, - int theStampsNum) +::GetTimeStampOnMesh( const std::string& theMeshName, + const VISU::TEntity& theEntity, + const std::string& theFieldName, + int theStampsNum ) { INITMSG(MYDEBUG,"GetTimeStampOnMesh"<< "; theMeshName = '"<myIDMapper = aGaussMesh; aGaussPtsIDFilter->myGaussPtsIDMapper = aGaussMesh; - vtkPolyData* anOutput = aGaussPtsIDFilter->GetPolyDataOutput(); - const VISU::PPolyData& aSource = aGaussPtsIDFilter->mySource.GetSource(); + VISU::PPolyData aSource = aGaussPtsIDFilter->GetSource(); VISU::GetTimeStampOnGaussMesh(aSource, aField, aValForTime); + vtkPolyData* anOutput = aGaussPtsIDFilter->GetPolyDataOutput(); aGaussPtsIDFilter->myIsVTKDone = true; @@ -1361,29 +1342,29 @@ VISU_Convertor_impl VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh->myMeshOnEntityMap; VISU::PMeshOnEntityImpl aVTKMeshOnEntity = aMeshOnEntity; - if(theEntity == VISU::NODE_ENTITY){ - if(aMeshOnEntityMap.find(VISU::CELL_ENTITY) != aMeshOnEntityMap.end()) - aVTKMeshOnEntity = aMeshOnEntityMap[VISU::CELL_ENTITY]; - else if(aMeshOnEntityMap.find(VISU::FACE_ENTITY) != aMeshOnEntityMap.end()) - aVTKMeshOnEntity = aMeshOnEntityMap[VISU::FACE_ENTITY]; - else if(aMeshOnEntityMap.find(VISU::EDGE_ENTITY) != aMeshOnEntityMap.end()) - aVTKMeshOnEntity = aMeshOnEntityMap[VISU::EDGE_ENTITY]; - else if(aMeshOnEntityMap.find(VISU::NODE_ENTITY) != aMeshOnEntityMap.end()) - aVTKMeshOnEntity = aMeshOnEntityMap[VISU::NODE_ENTITY]; + if ( theEntity == VISU::NODE_ENTITY ) { + if(aMeshOnEntityMap.find( VISU::CELL_ENTITY ) != aMeshOnEntityMap.end()) + aVTKMeshOnEntity = aMeshOnEntityMap[ VISU::CELL_ENTITY ]; + else if (aMeshOnEntityMap.find( VISU::FACE_ENTITY ) != aMeshOnEntityMap.end() ) + aVTKMeshOnEntity = aMeshOnEntityMap[ VISU::FACE_ENTITY ]; + else if (aMeshOnEntityMap.find( VISU::EDGE_ENTITY ) != aMeshOnEntityMap.end() ) + aVTKMeshOnEntity = aMeshOnEntityMap[ VISU::EDGE_ENTITY ]; + else if ( aMeshOnEntityMap.find( VISU::NODE_ENTITY ) != aMeshOnEntityMap.end() ) + aVTKMeshOnEntity = aMeshOnEntityMap[ VISU::NODE_ENTITY ]; }else aVTKMeshOnEntity = aMeshOnEntity; VISU::TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; - VISU::TFieldMap::const_iterator aFieldIter= aFieldMap.find(theFieldName); + VISU::TFieldMap::const_iterator aFieldIter= aFieldMap.find( theFieldName ); if(aFieldIter == aFieldMap.end()) EXCEPTION(std::runtime_error,"FindField >> There is no field on the mesh!!!"); VISU::PFieldImpl aField = aFieldIter->second; - return TFindField(aMesh, - aMeshOnEntity, - aVTKMeshOnEntity, - aField); + return TFindField( aMesh, + aMeshOnEntity, + aVTKMeshOnEntity, + aField ); } diff --git a/src/CONVERTOR/VISU_Convertor_impl.hxx b/src/CONVERTOR/VISU_Convertor_impl.hxx index f6cffc0e..14beaf5e 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.hxx +++ b/src/CONVERTOR/VISU_Convertor_impl.hxx @@ -120,10 +120,10 @@ public: //! Implemention of the VISU_Convertor::GetTimeStampOnMesh virtual VISU::PUnstructuredGridIDMapper - GetTimeStampOnMesh(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFieldName, - int theTimeStampNumber); + GetTimeStampOnMesh( const std::string& theMeshName, + const VISU::TEntity& theEntity, + const std::string& theFieldName, + int theTimeStampNumber ); //! Get amount of memory to build vtkDataSet for corresponding MED TIMESTAMP on mesh virtual @@ -206,9 +206,9 @@ protected: VISU::PMeshOnEntityImpl, VISU::PFieldImpl> TFindField; TFindField - FindField(const std::string& theMeshName, - const VISU::TEntity& theEntity, - const std::string& theFieldName); + FindField( const std::string& theMeshName, + const VISU::TEntity& theEntity, + const std::string& theFieldName ); //! An utility method to find TTimeStamp by name of its parent mesh, corresponding entity, field name and its number typedef boost::tupleGetType() != MED::eFLOAT64){ + if ( aFieldInfo->GetType() != MED::eFLOAT64 ) { #if defined(HAVE_F77INT64) aDataType = VTK_LONG; #else @@ -775,6 +788,7 @@ namespace aField->myName = aFieldName; aField->myMeshName = aMeshName; aField->myDataSize = aMeshOnEntity->myNbCells * aNbComp; + aField->myIsELNO = true; // To set it true by default INITMSG(MYDEBUG,"myName = '"<myName<<"'"<< "; myId = "<myId<< @@ -816,11 +830,18 @@ namespace MED::TGeom2NbGauss::const_iterator anIter = aMGeom2NbGauss.begin(); for(; anIter != aMGeom2NbGauss.end(); anIter++){ const MED::EGeometrieElement& aMGeom = anIter->first; - VISU::EGeometry aEGeom = MEDGeom2VISU(aMGeom); + VISU::EGeometry aEGeom = MEDGeom2VISU( aMGeom ); TInt aNbGauss = anIter->second; - aVGeom2NbGauss[aEGeom] = aNbGauss; + aVGeom2NbGauss[ aEGeom ] = aNbGauss; + + // ELNO data should satisfy the following condition ( implcitly ) + vtkIdType aNbNodes = MEDGeom2NbNodes( aMGeom ); + aField->myIsELNO &= ( aNbGauss == aNbNodes ); } } + + // ELNO data should satisfy the following condition ( explicitly ) + aField->myIsELNO |= ( aMEntity == MED::eNOEUD_ELEMENT ); } } diff --git a/src/CONVERTOR/VISU_MeshValue.cxx b/src/CONVERTOR/VISU_MeshValue.cxx index 195f333c..ac4bc0f4 100644 --- a/src/CONVERTOR/VISU_MeshValue.cxx +++ b/src/CONVERTOR/VISU_MeshValue.cxx @@ -337,6 +337,88 @@ namespace VISU }; + //---------------------------------------------------------------------------- + template + struct TTimeStampOnElnoInitArray + { + typedef typename TL::TEnum2VTKArrayType::TResult TVTKDataArray; + typedef typename TL::TEnum2VTKBasicType::TResult TVTKBasicType; + typedef TTMeshValue TMeshValue; + typedef MED::SharedPtr TMeshValuePtr; + + typedef TDataArrayHolder TTDataArrayHolder; + typedef MED::SharedPtr PDataArrayHolder; + PDataArrayHolder myDataArrayHolder; + vtkIntArray *myComponentMapper; + vtkIdType myComponentStep; + + TTimeStampOnElnoInitArray( const PDataArrayHolder& theDataArrayHolder, + vtkIntArray* theComponentMapper, + vtkIdType theComponentStep ) + : myDataArrayHolder(theDataArrayHolder) + , myComponentMapper( theComponentMapper ) + , myComponentStep( theComponentStep ) + {} + + void + Execute( const PFieldImpl& theField, + const PValForTimeImpl& theValForTime ) + { + TVector aDataValues( myComponentStep ); + + vtkIdType aNextStartId = 0; + vtkIdType aNbComp = theField->myNbComp; + int aTuples[3] = { aNextStartId, aNbComp, -1 }; + + vtkIdType aComponentCount = 0, aTupleId = 0, aComponentTupleId = 0; + const TGeom2MeshValue& aGeom2MeshValue = theValForTime->GetGeom2MeshValue(); + TGeom2MeshValue::const_iterator anIter = aGeom2MeshValue.begin(); + for ( ; anIter != aGeom2MeshValue.end(); anIter++ ) { + EGeometry aEGeom = anIter->first; + const TMeshValuePtr aMeshValue = anIter->second; + + vtkIdType aNbElem = aMeshValue->GetNbElem(); + vtkIdType aNbGauss = aMeshValue->GetNbGauss(); + aTuples[ 2 ] = aNbGauss; + + INITMSG(MYDEBUG, + "- aEGeom = "<AddArray(aFullDataArray); + aFullDataArray->SetNumberOfComponents( aNbComp ); + aFullDataArray->SetNumberOfTuples( aNbTuples ); + aFullDataArray->SetName( "VISU_FIELD" ); + aDataSetAttributes->AddArray( aFullDataArray ); INITMSG(MYDEBUG,"InitTimeStampOnProfile "<< "- theEntity = "<GetGeom2MeshValue(); - typedef typename TL::TEnum2VTKBasicType::TResult TVTKBasicType; - typedef TTMeshValue TMeshValue; - typedef MED::SharedPtr TMeshValuePtr; + typedef typename TL::TEnum2VTKBasicType< EDataType >::TResult TVTKBasicType; + typedef TTMeshValue< TVTKBasicType > TMeshValue; + typedef MED::SharedPtr< TMeshValue > TMeshValuePtr; - typedef TDataArrayHolder TTDataArrayHolder; - typedef MED::SharedPtr PDataArrayHolder; + typedef TDataArrayHolder< EDataType > TTDataArrayHolder; + typedef MED::SharedPtr< TTDataArrayHolder > PDataArrayHolder; TMeshValuePtr aMeshValue = theValForTime->GetFirstMeshValue(); - if(aGeom2MeshValue.size() == 1 && aMeshValue->GetNbGauss() == 1){ + if ( aGeom2MeshValue.size() == 1 && aMeshValue->GetNbGauss() == 1 ) { aFullDataArray->SetVoidArray(aMeshValue->GetPointer(), aMeshValue->size(), true); INITMSG(MYDEBUG,"InitTimeStampOnProfile - aFullDataArray->SetVoidArray()"<SetVoidArray(aMeshValue->GetPointer(), aMeshValue->size(), true); @@ -416,6 +499,37 @@ namespace VISU aSelectedDataArray->Delete(); aFullDataArray->Delete(); + + // Process the case for ELNO data + if ( theField->myIsELNO ) { + vtkIdType aEffectNbTuples = 0; + TGeom2MeshValue::const_iterator anIter = aGeom2MeshValue.begin(); + for ( ; anIter != aGeom2MeshValue.end(); anIter++ ) { + const PMeshValue& aMeshValue = anIter->second; + aEffectNbTuples += aMeshValue->GetNbElem() * aMeshValue->GetNbGauss(); + } + vtkIdType aEffectNbComp = ( aEffectNbTuples * aNbComp ) / aNbTuples + 1; + + vtkIntArray *aComponentMapper = vtkIntArray::New(); + aComponentMapper->SetNumberOfComponents( 3 ); + aComponentMapper->SetNumberOfTuples( aNbTuples ); + //{ [ aStartId , aNbComp, aNbRefPoints ], ..., ... , [ ... ] } + aComponentMapper->SetName( "ELNO_COMPONENT_MAPPER" ); + aDataSetAttributes->AddArray( aComponentMapper ); + + TVTKDataArray *aFullDataArray = TVTKDataArray::New(); + aFullDataArray->SetNumberOfComponents( aEffectNbComp ); + aFullDataArray->SetNumberOfTuples( aNbTuples ); + aFullDataArray->SetName( "ELNO_FIELD" ); + aDataSetAttributes->AddArray( aFullDataArray ); + + typedef TDataArrayHolder< EDataType > TTDataArrayHolder; + PDataArrayHolder aDataArrayHolder( new TTDataArrayHolder( aFullDataArray ) ); + TTimeStampOnElnoInitArray< EDataType >( aDataArrayHolder, aComponentMapper, aEffectNbComp ).Execute(theField, theValForTime); + + aComponentMapper->Delete(); + aFullDataArray->Delete(); + } } @@ -611,201 +725,5 @@ namespace VISU } - //--------------------------------------------------------------- - template - void - InitElnoTimeStamp(const PUnstructuredGrid& theSource, - const PFieldImpl& theField, - const PValForTimeImpl& theValForTime, - const VISU::TEntity& theEntity); - - //---------------------------------------------------------------------------- - void - GetElnoTimeStamp(const PUnstructuredGrid& theSource, - const PFieldImpl& theField, - const PValForTimeImpl& theValForTime, - const VISU::TEntity& theEntity) - { - vtkIdType aDataType = theField->GetDataType(); - switch(aDataType){ - case VTK_DOUBLE: - InitElnoTimeStamp(theSource, theField, theValForTime, theEntity); - break; - case VTK_FLOAT: - InitElnoTimeStamp(theSource, theField, theValForTime, theEntity); - break; - case VTK_INT: - InitElnoTimeStamp(theSource, theField, theValForTime, theEntity); - break; - case VTK_LONG: - InitElnoTimeStamp(theSource, theField, theValForTime, theEntity); - break; - default: - EXCEPTION(std::runtime_error, - "GetElnoTimeStamp - handling unsupported data type - "< - struct TTimeStampOnElnoInitArray - { - typedef typename TL::TEnum2VTKArrayType::TResult TVTKDataArray; - typedef typename TL::TEnum2VTKBasicType::TResult TVTKBasicType; - typedef TTMeshValue TMeshValue; - typedef MED::SharedPtr TMeshValuePtr; - - typedef TDataArrayHolder TTDataArrayHolder; - typedef MED::SharedPtr PDataArrayHolder; - PDataArrayHolder myDataArrayHolder; - vtkIntArray *myComponentMapper; - vtkIdType myComponentStep; - - TTimeStampOnElnoInitArray(const PDataArrayHolder& theDataArrayHolder, vtkIntArray * aComponentMapper=0): - myDataArrayHolder(theDataArrayHolder), - myComponentStep(0), - myComponentMapper(aComponentMapper) - {} - - void SetComponentStep(vtkIdType& theStep){ - myComponentStep = theStep; - } - - void - Execute(const PFieldImpl& theField, - const PValForTimeImpl& theValForTime) - { - vtkIdType aNbComp = theField->myNbComp; - TVector aDataValues(myComponentStep+1); - - vtkIdType componentCount=0,aTupleId=0,aNextStartId=0,aComponentTupleId=0; - int theTuple[3] = {aNextStartId, - theField->myNbComp, - 0}; - - const TGeom2MeshValue& aGeom2MeshValue = theValForTime->GetGeom2MeshValue(); - TGeom2MeshValue::const_iterator anIter = aGeom2MeshValue.begin(); - for(; anIter != aGeom2MeshValue.end(); anIter++){ - EGeometry aEGeom = anIter->first; - const TMeshValuePtr aMeshValue = anIter->second; - - vtkIdType aNbElem = aMeshValue->GetNbElem(); - vtkIdType aNbGauss = aMeshValue->GetNbGauss(); - - INITMSG(MYDEBUG, - "- aEGeom = "<AddArray(aComponentMapper); - - TVTKDataArray *aFullDataArray = TVTKDataArray::New(); - aFullDataArray->SetNumberOfComponents(aEffectNbComp); - aFullDataArray->SetNumberOfTuples(aNbTuples); - aFullDataArray->SetName("ELNO_FIELD"); - - aDataSetAttributes->AddArray(aFullDataArray); - - INITMSG(MYDEBUG,"InitElnoTimeStamp "<< - "- theEntity = "<::TResult TVTKBasicType; - typedef TTMeshValue TMeshValue; - typedef MED::SharedPtr TMeshValuePtr; - - typedef TDataArrayHolder TTDataArrayHolder; - typedef MED::SharedPtr PDataArrayHolder; - - TMeshValuePtr aMeshValue = theValForTime->GetFirstMeshValue(); - - typedef TDataArrayHolder2 TTDataArrayHolder2; - PDataArrayHolder aDataArrayHolder(new TTDataArrayHolder2(aSelectedDataArray, aFullDataArray)); - TTimeStampOnElnoInitArray aArrayInitializer(aDataArrayHolder,aComponentMapper); - aArrayInitializer.SetComponentStep(aEffectNbComp); - aArrayInitializer.Execute(theField, theValForTime); - - - aSelectedDataArray->Delete(); - aFullDataArray->Delete(); - } - } diff --git a/src/CONVERTOR/VISU_MeshValue.hxx b/src/CONVERTOR/VISU_MeshValue.hxx index 1748c1a4..f09fb783 100644 --- a/src/CONVERTOR/VISU_MeshValue.hxx +++ b/src/CONVERTOR/VISU_MeshValue.hxx @@ -214,13 +214,6 @@ namespace VISU //--------------------------------------------------------------- - // Initilize corresponding vtkDataSetAttributes for TValForTime - void - GetElnoTimeStamp(const PUnstructuredGrid& theSource, - const PFieldImpl& theField, - const PValForTimeImpl& theValForTime, - const VISU::TEntity& theEntity); - } #endif diff --git a/src/CONVERTOR/VISU_Structures.hxx b/src/CONVERTOR/VISU_Structures.hxx index 06d2fadc..31f3e626 100644 --- a/src/CONVERTOR/VISU_Structures.hxx +++ b/src/CONVERTOR/VISU_Structures.hxx @@ -90,8 +90,6 @@ namespace VISU std::string myGroupsEntry; //!< To simplify publication of the groups in a data tree std::string myFieldsEntry; //!< To simplify publication of the fiels in a data tree - - // MULTIPR std::string myPartsEntry; //!< To simplify publication of the parts in a data tree TMesh(); @@ -99,8 +97,6 @@ namespace VISU typedef std::map TMeshMap; - typedef std::map PNamedIDMapperMap; - //--------------------------------------------------------------- //! Define a basic class which corresponds to MED PROFILE entity struct VISU_CONVERTOR_EXPORT TSubProfile: virtual TBaseStructure diff --git a/src/CONVERTOR/VISU_Structures_impl.cxx b/src/CONVERTOR/VISU_Structures_impl.cxx index 88da9b1d..1b69db66 100644 --- a/src/CONVERTOR/VISU_Structures_impl.cxx +++ b/src/CONVERTOR/VISU_Structures_impl.cxx @@ -632,10 +632,9 @@ namespace VISU //--------------------------------------------------------------- TUnstructuredGridIDMapperImpl - ::TUnstructuredGridIDMapperImpl(): - myIsSpecialKey(false) + ::TUnstructuredGridIDMapperImpl() { - if(!myCommonCellsFilter.GetPointer()){ + if ( !myCommonCellsFilter.GetPointer() ) { myCommonCellsFilter = VISU_CommonCellsFilter::New(); myCommonCellsFilter->Delete(); } @@ -683,48 +682,44 @@ namespace VISU return myIDMapper->GetElemCell(theObjID); } - vtkUnstructuredGrid* + void TUnstructuredGridIDMapperImpl - ::GetUnstructuredGridOutput() + ::SetReferencedMesh( const PNamedIDMapper& theNamedIDMapper ) { - if(!myFilter.GetPointer()){ - + myCommonCellsFilter->SetCellsUG( theNamedIDMapper->GetUnstructuredGridOutput() ); + } + + void + TUnstructuredGridIDMapperImpl + ::Build() + { + if ( !myFilter.GetPointer() ) { const PAppendFilter& anAppendFilter = myIDMapper->GetFilter(); - vtkUnstructuredGrid* aGeometry; + vtkUnstructuredGrid* aGeometry = anAppendFilter->GetOutput(); const PUnstructuredGrid& aSource = mySource.GetSource(); - vtkUnstructuredGrid* aDataSet; - - if(myIsSpecialKey){ - PNamedIDMapperMap::iterator aIter; - aIter = myMappers.find(VISU::CELL_ENTITY); - if(aIter!=myMappers.end()) myCommonCellsFilter->SetCellsUG((aIter->second)->GetUnstructuredGridOutput()); - else { - aIter = myMappers.find(VISU::FACE_ENTITY); - if(aIter!=myMappers.end()) myCommonCellsFilter->SetCellsUG((aIter->second)->GetUnstructuredGridOutput()); - else { - aIter = myMappers.find(VISU::EDGE_ENTITY); - if(aIter!=myMappers.end()) myCommonCellsFilter->SetCellsUG((aIter->second)->GetUnstructuredGridOutput()); - } - } - } - - aGeometry = anAppendFilter->GetOutput(); - aDataSet = aSource.GetPointer(); - aDataSet->ShallowCopy(aGeometry); + vtkUnstructuredGrid* aDataSet = aSource.GetPointer(); + aDataSet->ShallowCopy( aGeometry ); const PMergeFilter& aFilter = GetFilter(); - aFilter->SetGeometry(aGeometry); - aFilter->SetScalars(aDataSet); - aFilter->SetVectors(aDataSet); - aFilter->AddField("VISU_FIELD",aDataSet); - aFilter->AddField("VISU_CELLS_MAPPER",aDataSet); - aFilter->AddField("ELNO_FIELD",aDataSet); - aFilter->AddField("ELNO_COMPONENT_MAPPER",aDataSet); - aFilter->AddField("VISU_POINTS_MAPPER",aDataSet); + aFilter->SetGeometry( aGeometry ); + aFilter->SetScalars( aDataSet ); + aFilter->SetVectors( aDataSet ); + aFilter->AddField( "VISU_FIELD", aDataSet ); + aFilter->AddField( "VISU_CELLS_MAPPER", aDataSet ); + aFilter->AddField( "ELNO_FIELD", aDataSet ); + aFilter->AddField( "ELNO_COMPONENT_MAPPER", aDataSet ); + aFilter->AddField( "VISU_POINTS_MAPPER", aDataSet ); - myCommonCellsFilter->SetProfileUG(aFilter->GetUnstructuredGridOutput()); + myCommonCellsFilter->SetProfileUG( aFilter->GetUnstructuredGridOutput() ); } + } + + vtkUnstructuredGrid* + TUnstructuredGridIDMapperImpl + ::GetUnstructuredGridOutput() + { + Build(); return myCommonCellsFilter->GetOutput(); } @@ -735,17 +730,25 @@ namespace VISU return GetUnstructuredGridOutput(); } + PUnstructuredGrid + TUnstructuredGridIDMapperImpl + ::GetSource() + { + Build(); + return mySource.GetSource(); + } + unsigned long int TUnstructuredGridIDMapperImpl ::GetMemorySize() { size_t aSize = myIDMapper->GetMemorySize(); + aSize += mySource.GetMemorySize(); - if(vtkUnstructuredGrid* anOutput = myCommonCellsFilter->GetOutput()) + + if ( vtkUnstructuredGrid* anOutput = myCommonCellsFilter->GetOutput() ) aSize += anOutput->GetActualMemorySize() * 1024; - PNamedIDMapperMap::const_iterator aIter = myMappers.begin(); - for(;aIter!=myMappers.end();aIter++) - aSize += (aIter->second)->GetMemorySize(); + return aSize; } @@ -792,26 +795,33 @@ namespace VISU return myIDMapper->GetElemCell(theObjID); } - vtkPolyData* + void TPolyDataIDMapperImpl - ::GetPolyDataOutput() + ::Build() { - if(!myFilter.GetPointer()){ + if ( !myFilter.GetPointer() ) { const PAppendPolyData& anAppendFilter = myIDMapper->GetFilter(); vtkPolyData* aGeometry = anAppendFilter->GetOutput(); const PPolyData& aSource = mySource.GetSource(); vtkPolyData* aDataSet = aSource.GetPointer(); - aDataSet->ShallowCopy(aGeometry); + aDataSet->ShallowCopy( aGeometry ); const PMergeFilter& aFilter = GetFilter(); - aFilter->SetGeometry(aGeometry); - aFilter->SetScalars(aDataSet); - aFilter->SetVectors(aDataSet); - aFilter->AddField("VISU_FIELD",aDataSet); - aFilter->AddField("VISU_CELLS_MAPPER",aDataSet); - aFilter->AddField("VISU_POINTS_MAPPER",aDataSet); + aFilter->SetGeometry( aGeometry ); + aFilter->SetScalars( aDataSet ); + aFilter->SetVectors( aDataSet ); + aFilter->AddField( "VISU_FIELD", aDataSet ); + aFilter->AddField( "VISU_CELLS_MAPPER", aDataSet ); + aFilter->AddField( "VISU_POINTS_MAPPER", aDataSet ); } + } + + vtkPolyData* + TPolyDataIDMapperImpl + ::GetPolyDataOutput() + { + Build(); return myFilter->GetPolyDataOutput(); } @@ -822,6 +832,14 @@ namespace VISU return GetPolyDataOutput(); } + PPolyData + TPolyDataIDMapperImpl + ::GetSource() + { + Build(); + return mySource.GetSource(); + } + unsigned long int TPolyDataIDMapperImpl ::GetMemorySize() @@ -973,7 +991,6 @@ namespace VISU return aResult; size_t aSubMeshEnd = myGaussSubMeshArr.size(); - const PAppendFilter& anAppendFilter = GetFilter(); const PGaussSubMeshImpl& aGaussSubMesh = anIter->second; for ( size_t aSubMeshId = 0; aSubMeshId < aSubMeshEnd; aSubMeshId++ ) { const PGaussSubMeshImpl& aSubMesh = myGaussSubMeshArr[aSubMeshId]; @@ -1339,9 +1356,10 @@ namespace VISU //--------------------------------------------------------------- TFieldImpl - ::TFieldImpl(): - myDataSize(0), - myDataType(0) + ::TFieldImpl() + : myDataSize( 0 ) + , myDataType( 0 ) + , myIsELNO( false ) {} void diff --git a/src/CONVERTOR/VISU_Structures_impl.hxx b/src/CONVERTOR/VISU_Structures_impl.hxx index 35bbc9e3..6b4bc01d 100644 --- a/src/CONVERTOR/VISU_Structures_impl.hxx +++ b/src/CONVERTOR/VISU_Structures_impl.hxx @@ -157,14 +157,6 @@ namespace VISU virtual unsigned long int GetMemorySize(); - - //! if false, TIDCommonCellsFilter - same as TIDMapperFilter - //! if true, TIDCommonCellsFilter - use VISU_CommonCellsFilter - bool myIsSpecialKey; - - //! Vector of id mappers, which consist of meshonentity in next sequence: - //! CELL_ENTITY,FACE_ENTITY,EDGE_ENTITY - PNamedIDMapperMap myMappers; }; //--------------------------------------------------------------- @@ -348,9 +340,8 @@ namespace VISU struct TUnstructuredGridIDMapperImpl: virtual TMergeFilterHolder, virtual TUnstructuredGridIDMapper { - PAppendFilterHolder myIDMapper; //!< Responsible for numbering - PCommonCellsFilter myCommonCellsFilter; - TUnstructuredGridHolder mySource; //!< Keeps assigned data + PAppendFilterHolder myIDMapper; //!< Responsible for numbering + PCommonCellsFilter myCommonCellsFilter; TUnstructuredGridIDMapperImpl(); @@ -399,13 +390,16 @@ namespace VISU unsigned long int GetMemorySize(); - //! if false, Not using CommonCellsFilter - //! if true, Using CommonCellsFilter - bool myIsSpecialKey; + void + SetReferencedMesh( const PNamedIDMapper& theNamedIDMapper ); + + PUnstructuredGrid + GetSource(); + + protected: + void Build(); - //! Vector of id mappers, which consist of meshonentity in next sequence: - //! CELL_ENTITY,FACE_ENTITY,EDGE_ENTITY - PNamedIDMapperMap myMappers; + TUnstructuredGridHolder mySource; //!< Keeps assigned data }; //--------------------------------------------------------------- @@ -414,7 +408,6 @@ namespace VISU virtual TPolyDataIDMapper { PAppendPolyDataHolder myIDMapper; //!< Responsible for numbering - TPolyDataHolder mySource; //!< Keeps assigned data //! Reimplement the TIDMapper::GetNodeObjID virtual @@ -460,6 +453,14 @@ namespace VISU virtual unsigned long int GetMemorySize(); + + PPolyData + GetSource(); + + protected: + void Build(); + + TPolyDataHolder mySource; //!< Keeps assigned data }; @@ -829,6 +830,7 @@ namespace VISU vtkIdType myDataSize; //!< Keeps size of the assigned data vtkIdType myDataType; //!< Keeps type idetificator of the mesh data TMinMaxArr myMinMaxArr; //!< Keeps min/max values for each component of the MED FIELD + bool myIsELNO; //!< Defines whether this field contains specific "ELNO" data or not };