From 59f5b666612aa1f2cd11e0e7a3e67d2c9533244f Mon Sep 17 00:00:00 2001 From: apo Date: Thu, 1 May 2008 13:13:41 +0000 Subject: [PATCH] To unify the assembling of the ELNO related data --- src/CONVERTOR/VISU_ElnoMeshValue.hxx | 2 +- src/CONVERTOR/VISU_MeshValue.cxx | 149 +++++++++------------------ 2 files changed, 49 insertions(+), 102 deletions(-) diff --git a/src/CONVERTOR/VISU_ElnoMeshValue.hxx b/src/CONVERTOR/VISU_ElnoMeshValue.hxx index 2de6b424..0130d907 100644 --- a/src/CONVERTOR/VISU_ElnoMeshValue.hxx +++ b/src/CONVERTOR/VISU_ElnoMeshValue.hxx @@ -136,7 +136,7 @@ namespace VISU InsertNextCellData() { myElnoDataMapper->InsertNextTupleValue( myElemInfo ); - myElemInfo[ 0 ] = myElemInfo[ 2 ]; + myElemInfo[ 0 ] += myElemInfo[ 2 ] * myElemInfo[ 1 ]; myElemInfo[ 2 ] = 0; } diff --git a/src/CONVERTOR/VISU_MeshValue.cxx b/src/CONVERTOR/VISU_MeshValue.cxx index 42c3eb3d..84719b36 100644 --- a/src/CONVERTOR/VISU_MeshValue.cxx +++ b/src/CONVERTOR/VISU_MeshValue.cxx @@ -25,6 +25,7 @@ // Module : VISU #include "VISU_MeshValue.hxx" +#include "VISU_ElnoMeshValue.hxx" #include "VISU_Structures_impl.hxx" #include "VISU_ConvertorUtils.hxx" @@ -267,88 +268,6 @@ 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( aComponentMapper ); + // To create corresponding VTK representation for the ELNO data + TSetElnoNodeData< EDataType > aSetElnoNodeData( anEffectNbComp, + aNbComp, + aNbTuples, + "ELNO_FIELD", + "ELNO_COMPONENT_MAPPER" ); + + std::vector< TVTKBasicType > aDataValues( aNbComp ); // To reserve a temproary value holder + + // To initilize these VTK representation for the ELNO data from the MED + 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( aFullDataArray ); - - typedef TDataArrayHolder< EDataType > TTDataArrayHolder; - PDataArrayHolder aDataArrayHolder( new TTDataArrayHolder( aFullDataArray ) ); - TTimeStampOnElnoInitArray< EDataType >( aDataArrayHolder, aComponentMapper, aEffectNbComp ).Execute(theField, theValForTime); - - aComponentMapper->Delete(); - aFullDataArray->Delete(); + // Assign the ELNO data on the corresponding VTK data set attribute + aSetElnoNodeData.AddData( aDataSetAttributes ); } + //------------------------------- } -- 2.39.2