From: jfa Date: Wed, 16 Sep 2009 05:59:18 +0000 (+0000) Subject: IMP 0017328: min and max scalar map of results given at gauss points. A fix for the... X-Git-Tag: V5_1_main_20090918~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=96e4e80db07d82b18c86c5ca6e7880cba573626b;p=modules%2Fvisu.git IMP 0017328: min and max scalar map of results given at gauss points. A fix for the modulus case. --- diff --git a/src/CONVERTOR/VISU_MeshValue.cxx b/src/CONVERTOR/VISU_MeshValue.cxx index b26b95ff..bf103815 100644 --- a/src/CONVERTOR/VISU_MeshValue.cxx +++ b/src/CONVERTOR/VISU_MeshValue.cxx @@ -23,7 +23,7 @@ // File: // Author: // Module : VISU -// + #include "VISU_MeshValue.hxx" #include "VISU_ElnoMeshValue.hxx" #include "VISU_Structures_impl.hxx" @@ -45,9 +45,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include @@ -63,10 +63,10 @@ namespace VISU //--------------------------------------------------------------- std::string GenerateFieldName(const PFieldImpl& theField, - const PValForTimeImpl& theValForTime) + const PValForTimeImpl& theValForTime) { const VISU::TTime& aTime = theValForTime->myTime; - std::string aFieldName = theField->myMeshName + ", " + theField->myName + ": " + + std::string aFieldName = theField->myMeshName + ", " + theField->myName + ": " + VISU_Convertor::GenerateName(aTime); return aFieldName; } @@ -76,8 +76,8 @@ namespace VISU void TMeshValueBase ::Init(vtkIdType theNbElem, - vtkIdType theNbGauss, - vtkIdType theNbComp) + vtkIdType theNbGauss, + vtkIdType theNbComp) { myNbElem = theNbElem; myNbGauss = theNbGauss; @@ -85,28 +85,28 @@ namespace VISU myStep = theNbComp*theNbGauss; } - vtkIdType + vtkIdType TMeshValueBase ::GetNbElem() const { return myNbElem; } - vtkIdType + vtkIdType TMeshValueBase ::GetNbComp() const { return myNbComp; } - vtkIdType + vtkIdType TMeshValueBase ::GetNbGauss() const { return myNbGauss; } - size_t + size_t TMeshValueBase ::size() const { @@ -116,19 +116,19 @@ namespace VISU //---------------------------------------------------------------------------- template - void + void InitTimeStampOnProfile(const PUnstructuredGrid& theSource, - const PFieldImpl& theField, - const PValForTimeImpl& theValForTime, - const VISU::TEntity& theEntity); + const PFieldImpl& theField, + const PValForTimeImpl& theValForTime, + const VISU::TEntity& theEntity); //---------------------------------------------------------------------------- - void + void GetTimeStampOnProfile(const PUnstructuredGrid& theSource, - const PFieldImpl& theField, - const PValForTimeImpl& theValForTime, - const VISU::TEntity& theEntity) + const PFieldImpl& theField, + const PValForTimeImpl& theValForTime, + const VISU::TEntity& theEntity) { vtkIdType aDataType = theField->GetDataType(); switch(aDataType){ @@ -146,7 +146,7 @@ namespace VISU break; default: EXCEPTION(std::runtime_error, - "GetTimeStampOnProfile - handling unsupported data type - "<GetNumberOfComponents(); vtkIdType aPosition = theTupleId * aNumberOfComponents; TVTKBasicType *aPtr = theDataArray->WritePointer(aPosition, aNumberOfComponents); for(vtkIdType anId = 0; anId < aNumberOfComponents; anId++) - *aPtr++ = *thePointer++; + *aPtr++ = *thePointer++; } virtual void - SetTuple(vtkIdType theTupleId, - TVTKBasicType* thePointer) + SetTuple(vtkIdType theTupleId, + TVTKBasicType* thePointer) { this->WritePointer(myDataArray, theTupleId, thePointer); } @@ -195,15 +195,15 @@ namespace VISU TVTKDataArray* myDataArray2; TDataArrayHolder2(TVTKDataArray* theDataArray, - TVTKDataArray* theDataArray2): + TVTKDataArray* theDataArray2): TSuperClass(theDataArray), myDataArray2(theDataArray2) {} - + virtual void - SetTuple(vtkIdType theTupleId, - TVTKBasicType* thePointer) + SetTuple(vtkIdType theTupleId, + TVTKBasicType* thePointer) { this->WritePointer(this->myDataArray, theTupleId, thePointer); this->WritePointer(this->myDataArray2, theTupleId, thePointer); @@ -227,53 +227,137 @@ namespace VISU TTimeStampOnProfileInitArray(const PDataArrayHolder& theDataArrayHolder): myDataArrayHolder(theDataArrayHolder) {} - + void Execute(const PFieldImpl& theField, - const PValForTimeImpl& theValForTime, - const TGaussMetric theGaussMetric = VISU::AVERAGE_METRIC) + const PValForTimeImpl& theValForTime, + const TGaussMetric theGaussMetric = VISU::AVERAGE_METRIC) { vtkIdType aNbComp = theField->myNbComp; vtkIdType aSize = std::max(vtkIdType(3), aNbComp); - TVector aDataValues(aSize); - + TVector aDataValues (aSize); + + const TGeom2MeshValue& aGeom2MeshValue = theValForTime->GetGeom2MeshValue(); + TGeom2MeshValue::const_iterator anIter = aGeom2MeshValue.begin(); + for (int aTupleId = 0; anIter != aGeom2MeshValue.end(); anIter++) { + EGeometry aEGeom = anIter->first; + const TMeshValuePtr aMeshValue = anIter->second; + + vtkIdType aNbElem = aMeshValue->GetNbElem(); + vtkIdType aNbGauss = aMeshValue->GetNbGauss(); + + INITMSG(MYDEBUG, + "- aEGeom = "<GetGeom2MeshValue(); typedef typename TL::TEnum2VTKBasicType< EDataType >::TResult TVTKBasicType; typedef TTMeshValue< TVTKBasicType > TMeshValue; @@ -340,43 +424,57 @@ namespace VISU TMeshValuePtr aMeshValue = theValForTime->GetFirstMeshValue(); if ( aGeom2MeshValue.size() == 1 && aMeshValue->GetNbGauss() == 1 ) { aFullDataArray->SetVoidArray(aMeshValue->GetPointer(), - aMeshValue->size(), - true); + aMeshValue->size(), + true); INITMSG(MYDEBUG,"InitTimeStampOnProfile - aFullDataArray->SetVoidArray()"<SetVoidArray( aMeshValue->GetPointer(), - aMeshValue->size(), - true ); - INITMSG(MYDEBUG,"InitTimeStampOnProfile - aSelectedDataArray->SetVoidArray()"<SetVoidArray( aMeshValue->GetPointer(), + aMeshValue->size(), + true ); + INITMSG(MYDEBUG,"InitTimeStampOnProfile - aSelectedDataArray->SetVoidArray()"<(aDataArrayHolder).Execute(theField, theValForTime); + PDataArrayHolder aDataArrayHolder(new TTDataArrayHolder(aSelectedDataArray)); + TTimeStampOnProfileInitArray(aDataArrayHolder).Execute(theField, theValForTime); } - }else{ + } + else { typedef TDataArrayHolder2 TTDataArrayHolder2; PDataArrayHolder aDataArrayHolder(new TTDataArrayHolder2(aSelectedDataArray, aFullDataArray)); TTimeStampOnProfileInitArray(aDataArrayHolder).Execute(theField, theValForTime); if ( theValForTime->GetMaxNbGauss() > 1 ) { // at least one of geometry contains multiple gauss points - TVTKDataArray *aGaussMinDataArray = TVTKDataArray::New(); - aGaussMinDataArray->SetNumberOfComponents( aNbComp ); - aGaussMinDataArray->SetNumberOfTuples( aNbTuples ); - aGaussMinDataArray->SetName( "VISU_FIELD_GAUSS_MIN" ); - aDataSetAttributes->AddArray( aGaussMinDataArray ); - - PDataArrayHolder aGaussMinDataArrayHolder(new TTDataArrayHolder(aGaussMinDataArray)); - TTimeStampOnProfileInitArray(aGaussMinDataArrayHolder).Execute(theField, theValForTime, VISU::MINIMUM_METRIC); - aGaussMinDataArray->Delete(); - - TVTKDataArray *aGaussMaxDataArray = TVTKDataArray::New(); - aGaussMaxDataArray->SetNumberOfComponents( aNbComp ); - aGaussMaxDataArray->SetNumberOfTuples( aNbTuples ); - aGaussMaxDataArray->SetName( "VISU_FIELD_GAUSS_MAX" ); - aDataSetAttributes->AddArray( aGaussMaxDataArray ); - - PDataArrayHolder aGaussMaxDataArrayHolder(new TTDataArrayHolder(aGaussMaxDataArray)); - TTimeStampOnProfileInitArray(aGaussMaxDataArrayHolder).Execute(theField, theValForTime, VISU::MAXIMUM_METRIC); - aGaussMaxDataArray->Delete(); + TVTKDataArray *aGaussMinDataArray = TVTKDataArray::New(); + aGaussMinDataArray->SetNumberOfComponents( aNbComp ); + aGaussMinDataArray->SetNumberOfTuples( aNbTuples ); + aGaussMinDataArray->SetName( "VISU_FIELD_GAUSS_MIN" ); + aDataSetAttributes->AddArray( aGaussMinDataArray ); + + PDataArrayHolder aGaussMinDataArrayHolder(new TTDataArrayHolder(aGaussMinDataArray)); + TTimeStampOnProfileInitArray(aGaussMinDataArrayHolder).Execute + (theField, theValForTime, VISU::MINIMUM_METRIC); + aGaussMinDataArray->Delete(); + + TVTKDataArray *aGaussMaxDataArray = TVTKDataArray::New(); + aGaussMaxDataArray->SetNumberOfComponents( aNbComp ); + aGaussMaxDataArray->SetNumberOfTuples( aNbTuples ); + aGaussMaxDataArray->SetName( "VISU_FIELD_GAUSS_MAX" ); + aDataSetAttributes->AddArray( aGaussMaxDataArray ); + + PDataArrayHolder aGaussMaxDataArrayHolder(new TTDataArrayHolder(aGaussMaxDataArray)); + TTimeStampOnProfileInitArray(aGaussMaxDataArrayHolder).Execute + (theField, theValForTime, VISU::MAXIMUM_METRIC); + aGaussMaxDataArray->Delete(); + + TVTKDataArray *aGaussModulusDataArray = TVTKDataArray::New(); + aGaussModulusDataArray->SetNumberOfComponents( 3 ); // Min, Max and Average + aGaussModulusDataArray->SetNumberOfTuples( aNbTuples ); + aGaussModulusDataArray->SetName( "VISU_FIELD_GAUSS_MOD" ); + aDataSetAttributes->AddArray( aGaussModulusDataArray ); + + PDataArrayHolder aGaussModulusDataArrayHolder(new TTDataArrayHolder(aGaussModulusDataArray)); + TTimeStampOnProfileInitModulus(aGaussModulusDataArrayHolder).Execute + (theField, theValForTime); + aGaussModulusDataArray->Delete(); } } @@ -390,39 +488,40 @@ namespace VISU vtkIdType aEffectNbTuples = 0; TGeom2MeshValue::const_iterator anIter = aGeom2MeshValue.begin(); for ( ; anIter != aGeom2MeshValue.end(); anIter++ ) { - const PMeshValue& aMeshValue = anIter->second; - aEffectNbTuples += aMeshValue->GetNbElem() * aMeshValue->GetNbGauss(); + const PMeshValue& aMeshValue = anIter->second; + aEffectNbTuples += aMeshValue->GetNbElem() * aMeshValue->GetNbGauss(); } vtkIdType anEffectNbComp = ( aEffectNbTuples * aNbComp ) / aNbTuples + 1; - + // To create corresponding VTK representation for the ELNO data TSetElnoNodeData< EDataType > aSetElnoNodeData( anEffectNbComp, - aNbComp, - aNbTuples, - "ELNO_FIELD", - "ELNO_COMPONENT_MAPPER" ); + 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 = "<myNbComp; vtkIdType aSize = std::max(vtkIdType(3), aNbComp); @@ -508,68 +607,68 @@ namespace VISU const TGeom2GaussSubMesh& aGeom2GaussSubMesh = aGaussMesh->myGeom2GaussSubMesh; TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin(); for(int aTupleId = 0; anIter != aGeom2GaussSubMesh.end(); anIter++){ - EGeometry aEGeom = anIter->first; - - PGaussSubMeshImpl aGaussSubMesh = anIter->second; - if(!aGaussSubMesh->myIsDone) - continue; - - TGeom2MeshValue::const_iterator anIter2 = aGeom2MeshValue.find(aEGeom); - if(anIter2 == aGeom2MeshValue.end()){ - EXCEPTION(std::runtime_error, - "TTimeStampOnGaussMeshInitArray >> Can't find values for corresponding Gauss Points SubMesh"); - } - TMeshValuePtr aMeshValue = anIter2->second; - vtkIdType aNbGauss = aMeshValue->GetNbGauss(); - vtkIdType aNbElem = aMeshValue->GetNbElem(); - - if(aNbGauss < 1) - continue; - - const TPointCoords& aCoords = aGaussSubMesh->myPointCoords; - - INITMSG(MYDEBUG, - "- aEGeom = "<> Can't find values for corresponding Gauss Points SubMesh"); + } + TMeshValuePtr aMeshValue = anIter2->second; + vtkIdType aNbGauss = aMeshValue->GetNbGauss(); + vtkIdType aNbElem = aMeshValue->GetNbElem(); + + if(aNbGauss < 1) + continue; + + const TPointCoords& aCoords = aGaussSubMesh->myPointCoords; + + INITMSG(MYDEBUG, + "- aEGeom = "<GetGeom2MeshValue(); typedef typename TL::TEnum2VTKBasicType::TResult TVTKBasicType; typedef TTMeshValue TMeshValue; @@ -614,17 +713,17 @@ namespace VISU TMeshValuePtr aMeshValue = theValForTime->GetFirstMeshValue(); if(aGeom2MeshValue.size() == 1){ aFullDataArray->SetVoidArray(aMeshValue->GetPointer(), - aMeshValue->size(), - true); + aMeshValue->size(), + true); INITMSG(MYDEBUG,"InitTimeStampOnGaussMesh - aFullDataArray->SetVoidArray()"<SetVoidArray(aMeshValue->GetPointer(), - aMeshValue->size(), - true); - INITMSG(MYDEBUG,"InitTimeStampOnGaussMesh - aSelectedDataArray->SetVoidArray()"<SetVoidArray(aMeshValue->GetPointer(), + aMeshValue->size(), + true); + INITMSG(MYDEBUG,"InitTimeStampOnGaussMesh - aSelectedDataArray->SetVoidArray()"<(aDataArrayHolder).Execute(theField, theValForTime); + PDataArrayHolder aDataArrayHolder(new TTDataArrayHolder(aSelectedDataArray)); + TTimeStampOnGaussMeshInitArray(aDataArrayHolder).Execute(theField, theValForTime); } }else{ typedef TDataArrayHolder2 TTDataArrayHolder2; @@ -636,7 +735,7 @@ namespace VISU aFullDataArray->Delete(); } - + //---------------------------------------------------------------------------- void InitMed2VisuArray(std::vector& anArray, EGeometry aEGeom){ @@ -644,7 +743,7 @@ namespace VISU #if !(defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC) case eSEG3: anArray[0] = 0; - anArray[2] = 1; + anArray[2] = 1; anArray[1] = 2; break; #endif @@ -652,11 +751,11 @@ namespace VISU #if !(defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC) case eTRIA6: anArray[0] = 0; - anArray[2] = 1; - anArray[4] = 2; - + anArray[2] = 1; + anArray[4] = 2; + anArray[1] = 3; - anArray[3] = 4; + anArray[3] = 4; anArray[5] = 5; break; #endif @@ -664,42 +763,42 @@ namespace VISU #if !(defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC) case eQUAD8: anArray[0] = 0; - anArray[2] = 1; - anArray[4] = 2; - anArray[6] = 3; - + anArray[2] = 1; + anArray[4] = 2; + anArray[6] = 3; + anArray[1] = 4; - anArray[3] = 5; - anArray[5] = 6; + anArray[3] = 5; + anArray[5] = 6; anArray[7] = 7; break; #endif case eTETRA4: anArray[0] = 0; anArray[1] = 2; - anArray[2] = 1; + anArray[2] = 1; anArray[3] = 3; break; case ePYRA5: anArray[0] = 0; - anArray[1] = 3; + anArray[1] = 3; anArray[2] = 2; - anArray[3] = 1; + anArray[3] = 1; anArray[4] = 4; break; #if (defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC)) && defined(VISU_ENABLE_QUADRATIC) case eTETRA10: anArray[0] = 0; anArray[1] = 2; - anArray[2] = 1; - anArray[3] = 3; - + anArray[2] = 1; + anArray[3] = 3; + anArray[4] = 6; anArray[5] = 5; - anArray[6] = 4; - - anArray[7] = 7; - anArray[8] = 9; + anArray[6] = 4; + + anArray[7] = 7; + anArray[8] = 9; anArray[9] = 8; break; #endif @@ -708,19 +807,19 @@ namespace VISU case ePYRA13: anArray[0] = 0; anArray[1] = 3; - anArray[2] = 2; - anArray[3] = 1; + anArray[2] = 2; + anArray[3] = 1; anArray[4] = 4; - + anArray[5] = 8; - anArray[6] = 7; - anArray[7] = 6; - anArray[8] = 5; - - anArray[9] = 9; - anArray[10] = 12; - anArray[11] = 11; - anArray[12] = 10; + anArray[6] = 7; + anArray[7] = 6; + anArray[8] = 5; + + anArray[9] = 9; + anArray[10] = 12; + anArray[11] = 11; + anArray[12] = 10; break; #endif default: diff --git a/src/CONVERTOR/VISU_Structures_impl.cxx b/src/CONVERTOR/VISU_Structures_impl.cxx index 3931c1e9..eb797c47 100644 --- a/src/CONVERTOR/VISU_Structures_impl.cxx +++ b/src/CONVERTOR/VISU_Structures_impl.cxx @@ -19,10 +19,10 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: +// File: // Author: Alexey PETROV // Module : VISU -// + #include "VISU_Structures_impl.hxx" #include "VISU_PointCoords.hxx" #include "VISU_MeshValue.hxx" @@ -43,26 +43,26 @@ namespace VISU { /* vtkIdType VISUGeom2NbNodes(EGeometry theGeom) - { + { switch(theGeom){ #ifndef VISU_ENABLE_QUADRATIC - case VISU::eSEG3: + case VISU::eSEG3: return 2; - case VISU::eTRIA6: + case VISU::eTRIA6: return 3; - case VISU::eQUAD8: + case VISU::eQUAD8: return 4; - case VISU::eTETRA10: + case VISU::eTETRA10: return 4; - case VISU::eHEXA20: + case VISU::eHEXA20: return 8; - case VISU::ePENTA15: + case VISU::ePENTA15: return 6; - case VISU::ePYRA13: + case VISU::ePYRA13: return 5; #endif - case VISU::ePOLYGONE: - case VISU::ePOLYEDRE: + case VISU::ePOLYGONE: + case VISU::ePOLYEDRE: return -1; default: return theGeom % 100; @@ -71,91 +71,91 @@ namespace VISU vtkIdType VISUGeom2VTK(EGeometry theGeom) - { + { switch(theGeom){ - case VISU::ePOINT1: + case VISU::ePOINT1: return VTK_VERTEX; - case VISU::eSEG2: + case VISU::eSEG2: return VTK_LINE; - case VISU::eTRIA3: + case VISU::eTRIA3: return VTK_TRIANGLE; - case VISU::eQUAD4: + case VISU::eQUAD4: return VTK_QUAD; - case VISU::eTETRA4: + case VISU::eTETRA4: return VTK_TETRA; - case VISU::eHEXA8: + case VISU::eHEXA8: return VTK_HEXAHEDRON; - case VISU::ePENTA6: + case VISU::ePENTA6: return VTK_WEDGE; - case VISU::ePYRA5: + case VISU::ePYRA5: return VTK_PYRAMID; - case VISU::ePOLYGONE: + case VISU::ePOLYGONE: return VTK_POLYGON; - case VISU::ePOLYEDRE: + case VISU::ePOLYEDRE: return VTK_CONVEX_POINT_SET; #ifndef VISU_ENABLE_QUADRATIC - case VISU::eSEG3: + case VISU::eSEG3: return VTK_LINE; - case VISU::eTRIA6: + case VISU::eTRIA6: return VTK_TRIANGLE; - case VISU::eQUAD8: + case VISU::eQUAD8: return VTK_QUAD; - case VISU::eTETRA10: + case VISU::eTETRA10: return VTK_TETRA; - case VISU::eHEXA20: + case VISU::eHEXA20: return VTK_HEXAHEDRON; - case VISU::ePENTA15: + case VISU::ePENTA15: return VTK_WEDGE; - case VISU::ePYRA13: + case VISU::ePYRA13: return VTK_PYRAMID; #else - case VISU::eSEG3: + case VISU::eSEG3: #if defined(VTK_QUADRATIC_EDGE) && defined(VISU_USE_VTK_QUADRATIC) return VTK_QUADRATIC_EDGE; #else return VTK_POLY_LINE; #endif - case VISU::eTRIA6: + case VISU::eTRIA6: #if defined(VTK_QUADRATIC_TRIANGLE) && defined(VISU_USE_VTK_QUADRATIC) return VTK_QUADRATIC_TRIANGLE; #else return VTK_POLYGON; #endif - case VISU::eQUAD8: + case VISU::eQUAD8: #if defined(VTK_QUADRATIC_QUAD) && defined(VISU_USE_VTK_QUADRATIC) return VTK_QUADRATIC_QUAD; #else return VTK_POLYGON; #endif - case VISU::eTETRA10: + case VISU::eTETRA10: #if defined(VTK_QUADRATIC_TETRA) && defined(VISU_USE_VTK_QUADRATIC) return VTK_QUADRATIC_TETRA; #else return VTK_CONVEX_POINT_SET; #endif - case VISU::eHEXA20: + case VISU::eHEXA20: #if defined(VTK_QUADRATIC_HEXAHEDRON) && defined(VISU_USE_VTK_QUADRATIC) return VTK_QUADRATIC_HEXAHEDRON; #else return VTK_CONVEX_POINT_SET; #endif - case VISU::ePENTA15: + case VISU::ePENTA15: #if defined(VTK_QUADRATIC_WEDGE) && defined(VISU_USE_VTK_QUADRATIC) return VTK_QUADRATIC_WEDGE; #else return VTK_CONVEX_POINT_SET; #endif - case VISU::ePYRA13: + case VISU::ePYRA13: #if defined(VTK_QUADRATIC_PYRAMID) && defined(VISU_USE_VTK_QUADRATIC) return VTK_QUADRATIC_PYRAMID; #else @@ -172,63 +172,63 @@ namespace VISU EGeometry VTKGeom2VISU(vtkIdType theGeom) - { + { switch(theGeom){ - case VTK_VERTEX: + case VTK_VERTEX: return VISU::ePOINT1; - case VTK_LINE: + case VTK_LINE: return VISU::eSEG2; - case VTK_TRIANGLE: + case VTK_TRIANGLE: return VISU::eTRIA3; - case VTK_QUAD: + case VTK_QUAD: return VISU::eQUAD4; - case VTK_TETRA: + case VTK_TETRA: return VISU::eTETRA4; - case VTK_HEXAHEDRON: + case VTK_HEXAHEDRON: return VISU::eHEXA8; - case VTK_WEDGE: + case VTK_WEDGE: return VISU::ePENTA6; - case VTK_PYRAMID: + case VTK_PYRAMID: return VISU::ePYRA5; - case VTK_POLYGON: + case VTK_POLYGON: return VISU::ePOLYGONE; - case VTK_CONVEX_POINT_SET: + case VTK_CONVEX_POINT_SET: return VISU::ePOLYEDRE; #if defined(VISU_ENABLE_QUADRATIC) && defined(VISU_USE_VTK_QUADRATIC) #if defined(VTK_QUADRATIC_EDGE) - case VTK_QUADRATIC_EDGE: + case VTK_QUADRATIC_EDGE: return VISU::eSEG3; #endif #if defined(VTK_QUADRATIC_TRIANGLE) - case VTK_QUADRATIC_TRIANGLE: + case VTK_QUADRATIC_TRIANGLE: return VISU::eTRIA6; #endif #if defined(VTK_QUADRATIC_QUAD) - case VTK_QUADRATIC_QUAD: + case VTK_QUADRATIC_QUAD: return VISU::eQUAD8; #endif #if defined(VTK_QUADRATIC_TETRA) - case VTK_QUADRATIC_TETRA: + case VTK_QUADRATIC_TETRA: return VISU::eTETRA10; #endif #if defined(VTK_QUADRATIC_HEXAHEDRON) - case VTK_QUADRATIC_HEXAHEDRON: + case VTK_QUADRATIC_HEXAHEDRON: return VISU::eHEXA20; #endif #if defined(VTK_QUADRATIC_WEDGE) - case VTK_QUADRATIC_WEDGE: + case VTK_QUADRATIC_WEDGE: return VISU::ePENTA15; #endif #if defined(VTK_QUADRATIC_PYRAMID) - case VTK_QUADRATIC_PYRAMID: + case VTK_QUADRATIC_PYRAMID: return VISU::ePYRA13; #endif @@ -255,9 +255,9 @@ namespace VISU */ size_t GetDataSetSize(size_t theNbOfPoints, - size_t theNbOfCells, - size_t theCellsSize, - bool theComputeLinks) + size_t theNbOfCells, + size_t theCellsSize, + bool theComputeLinks) { size_t aPointsSize = 3*theNbOfPoints*sizeof(VISU::TCoord); size_t aConnectivityAndTypesSize = theCellsSize*sizeof(vtkIdType); @@ -283,7 +283,7 @@ namespace VISU ::TPolyDataHolder() {} - const PPolyData& + const PPolyData& TPolyDataHolder ::GetSource() const { @@ -294,7 +294,7 @@ namespace VISU return mySource; } - vtkPolyData* + vtkPolyData* TPolyDataHolder ::GetPolyDataOutput() { @@ -322,7 +322,7 @@ namespace VISU ::TUnstructuredGridHolder() {} - const PUnstructuredGrid& + const PUnstructuredGrid& TUnstructuredGridHolder ::GetSource() const { @@ -333,7 +333,7 @@ namespace VISU return mySource; } - vtkUnstructuredGrid* + vtkUnstructuredGrid* TUnstructuredGridHolder ::GetUnstructuredGridOutput() { @@ -363,8 +363,8 @@ namespace VISU { if(myIsVTKDone){ if(vtkDataSet* anOutput = GetOutput()){ - anOutput->Update(); - return anOutput->GetActualMemorySize() * 1024; + anOutput->Update(); + return anOutput->GetActualMemorySize() * 1024; } } throw std::runtime_error("TMemoryCheckIDMapper::GetMemorySize - myIsVTKDone == false !!!"); @@ -377,7 +377,7 @@ namespace VISU ::TAppendFilterHolder() {} - const PAppendFilter& + const PAppendFilter& TAppendFilterHolder ::GetFilter() const { @@ -389,7 +389,7 @@ namespace VISU return myFilter; } - vtkUnstructuredGrid* + vtkUnstructuredGrid* TAppendFilterHolder ::GetUnstructuredGridOutput() { @@ -402,7 +402,7 @@ namespace VISU ::TAppendPolyDataHolder() {} - const PAppendPolyData& + const PAppendPolyData& TAppendPolyDataHolder ::GetFilter() const { @@ -414,7 +414,7 @@ namespace VISU return myFilter; } - vtkPolyData* + vtkPolyData* TAppendPolyDataHolder ::GetPolyDataOutput() { @@ -428,7 +428,7 @@ namespace VISU ::TMergeFilterHolder() {} - const PMergeFilter& + const PMergeFilter& TMergeFilterHolder ::GetFilter() const { @@ -439,7 +439,7 @@ namespace VISU return myFilter; } - vtkDataSet* + vtkDataSet* TMergeFilterHolder ::GetOutput() { @@ -450,7 +450,7 @@ namespace VISU //--------------------------------------------------------------- TMeshImpl - ::TMeshImpl(): + ::TMeshImpl(): myNbPoints(0) {} @@ -460,14 +460,14 @@ namespace VISU { return myNbPoints; } - + vtkIdType TMeshImpl:: GetDim() const { return myDim; } - + vtkPointSet* TMeshImpl:: GetPointSet() @@ -489,7 +489,7 @@ namespace VISU { if ( !mySubMeshID.empty() ) return mySubMeshID[theID]; - + return theID; } @@ -499,9 +499,9 @@ namespace VISU ::GetElemVTKID(vtkIdType theID) const { if ( !mySubMeshID.empty() ) - for ( size_t anId = 0; anId < mySubMeshID.size(); anId++ ) - if ( mySubMeshID[ anId ] == theID ) - return anId; + for ( size_t anId = 0; anId < mySubMeshID.size(); anId++ ) + if ( mySubMeshID[ anId ] == theID ) + return anId; return theID; } @@ -545,7 +545,7 @@ namespace VISU { return myNamedPointCoords->GetObjID(theID); } - + vtkIdType TProfileImpl ::GetNodeVTKID(vtkIdType theID) const @@ -553,7 +553,7 @@ namespace VISU return myNamedPointCoords->GetVTKID(theID); } - vtkFloatingPointType* + vtkFloatingPointType* TProfileImpl ::GetNodeCoord(vtkIdType theObjID) { @@ -578,7 +578,7 @@ namespace VISU return VISU::GetElemVTKID(GetFilter()->GetOutput(), theID); } - vtkCell* + vtkCell* TProfileImpl ::GetElemCell(vtkIdType theObjID) { @@ -588,8 +588,8 @@ namespace VISU vtkIdType aVtkID = GetElemVTKID(theObjID); return GetFilter()->GetOutput()->GetCell(aVtkID); } - - vtkUnstructuredGrid* + + vtkUnstructuredGrid* TProfileImpl ::GetUnstructuredGridOutput() { @@ -614,14 +614,14 @@ namespace VISU return aSize; } - std::string + std::string TProfileImpl ::GetNodeName(vtkIdType theObjID) const { return myNamedPointCoords->GetNodeName(theObjID); } - std::string + std::string TProfileImpl ::GetElemName(vtkIdType theObjID) const { @@ -645,7 +645,7 @@ namespace VISU { return myIDMapper->GetNodeObjID(theID); } - + vtkIdType TUnstructuredGridIDMapperImpl ::GetNodeVTKID(vtkIdType theID) const @@ -653,7 +653,7 @@ namespace VISU return myIDMapper->GetNodeVTKID(theID); } - vtkFloatingPointType* + vtkFloatingPointType* TUnstructuredGridIDMapperImpl ::GetNodeCoord(vtkIdType theObjID) { @@ -674,21 +674,21 @@ namespace VISU return myIDMapper->GetElemVTKID(theID); } - vtkCell* + vtkCell* TUnstructuredGridIDMapperImpl ::GetElemCell(vtkIdType theObjID) { return myIDMapper->GetElemCell(theObjID); } - - void + + void TUnstructuredGridIDMapperImpl ::SetReferencedMesh( const PNamedIDMapper& theNamedIDMapper ) { myCommonCellsFilter->SetCellsUG( theNamedIDMapper->GetUnstructuredGridOutput() ); } - void + void TUnstructuredGridIDMapperImpl ::Build() { @@ -707,16 +707,17 @@ namespace VISU aFilter->AddField( "VISU_FIELD", aDataSet ); aFilter->AddField( "VISU_FIELD_GAUSS_MIN", aDataSet ); aFilter->AddField( "VISU_FIELD_GAUSS_MAX", aDataSet ); + aFilter->AddField( "VISU_FIELD_GAUSS_MOD", 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() ); - } + } } - vtkUnstructuredGrid* + vtkUnstructuredGrid* TUnstructuredGridIDMapperImpl ::GetUnstructuredGridOutput() { @@ -724,14 +725,14 @@ namespace VISU return myCommonCellsFilter->GetOutput(); } - vtkDataSet* + vtkDataSet* TUnstructuredGridIDMapperImpl ::GetOutput() { return GetUnstructuredGridOutput(); } - PUnstructuredGrid + PUnstructuredGrid TUnstructuredGridIDMapperImpl ::GetSource() { @@ -760,7 +761,7 @@ namespace VISU { return myIDMapper->GetNodeObjID(theID); } - + vtkIdType TPolyDataIDMapperImpl ::GetNodeVTKID(vtkIdType theID) const @@ -768,7 +769,7 @@ namespace VISU return myIDMapper->GetNodeVTKID(theID); } - vtkFloatingPointType* + vtkFloatingPointType* TPolyDataIDMapperImpl ::GetNodeCoord(vtkIdType theObjID) { @@ -789,25 +790,25 @@ namespace VISU return myIDMapper->GetElemVTKID(theID); } - vtkCell* + vtkCell* TPolyDataIDMapperImpl ::GetElemCell(vtkIdType theObjID) { return myIDMapper->GetElemCell(theObjID); } - - void + + void TPolyDataIDMapperImpl ::Build() { if ( !myFilter.GetPointer() ) { const PAppendPolyData& anAppendFilter = myIDMapper->GetFilter(); vtkPolyData* aGeometry = anAppendFilter->GetOutput(); - + const PPolyData& aSource = mySource.GetSource(); vtkPolyData* aDataSet = aSource.GetPointer(); aDataSet->ShallowCopy( aGeometry ); - + const PMergeFilter& aFilter = GetFilter(); aFilter->SetGeometry( aGeometry ); aFilter->SetScalars( aDataSet ); @@ -815,12 +816,13 @@ namespace VISU aFilter->AddField( "VISU_FIELD", aDataSet ); aFilter->AddField( "VISU_FIELD_GAUSS_MIN", aDataSet ); aFilter->AddField( "VISU_FIELD_GAUSS_MAX", aDataSet ); + aFilter->AddField( "VISU_FIELD_GAUSS_MOD", aDataSet ); aFilter->AddField( "VISU_CELLS_MAPPER", aDataSet ); aFilter->AddField( "VISU_POINTS_MAPPER", aDataSet ); } } - vtkPolyData* + vtkPolyData* TPolyDataIDMapperImpl ::GetPolyDataOutput() { @@ -828,14 +830,14 @@ namespace VISU return myFilter->GetPolyDataOutput(); } - vtkDataSet* + vtkDataSet* TPolyDataIDMapperImpl ::GetOutput() { return GetPolyDataOutput(); } - PPolyData + PPolyData TPolyDataIDMapperImpl ::GetSource() { @@ -859,11 +861,11 @@ namespace VISU myGeom(EGeometry(-1)), myNbPoints(0) {} - + void TGaussImpl ::LessThan(const PGaussImpl& theGauss, - bool& theResult) const + bool& theResult) const { theResult = false; } @@ -876,14 +878,14 @@ namespace VISU myStatus(eNone), myStartID(0) {} - + TGaussPointID TGaussSubMeshImpl ::GetObjID(vtkIdType theID) const { TCellID aCellID = myStartID + theID / myGauss->myNbPoints; TLocalPntID aLocalPntID = theID % myGauss->myNbPoints; - + return TGaussPointID(aCellID, aLocalPntID); } @@ -895,7 +897,7 @@ namespace VISU TCellID aCellID = theID.first; TLocalPntID aLocalPntID = theID.second; - + vtkIdType aNbPoints = myGauss->myNbPoints; if ( aLocalPntID >= aNbPoints ) return aResult; @@ -909,8 +911,8 @@ namespace VISU { return mySubProfile->GetElemObjID( theID ); } - - + + vtkIdType VISU::TGaussSubMeshImpl ::GetElemVTKID(vtkIdType theID) const @@ -918,7 +920,7 @@ namespace VISU return mySubProfile->GetElemVTKID( theID ); } - vtkIdType + vtkIdType TGaussSubMeshImpl ::GetGlobalID(vtkIdType theID) const { @@ -941,7 +943,7 @@ namespace VISU PGaussSubMeshImpl aLeft(theLeft), aRight(theRight); const PGaussImpl& aGaussLeft = aLeft->myGauss; const PGaussImpl& aGaussRight = aRight->myGauss; - + if(aGaussLeft->myGeom != aGaussRight->myGeom) return aGaussLeft->myGeom < aGaussRight->myGeom; @@ -961,7 +963,7 @@ namespace VISU myParent(NULL) {} - TGaussPointID + TGaussPointID TGaussMeshImpl ::GetObjID(vtkIdType theID) const { @@ -969,7 +971,7 @@ namespace VISU return VISU::GetObjID(aFilter->GetOutput(), theID); } - vtkIdType + vtkIdType TGaussMeshImpl ::GetVTKID(const TGaussPointID& theID) const { @@ -978,34 +980,34 @@ namespace VISU TCellID aCellID = theID.first; vtkIdType aVTKCellId = GetParent()->GetElemVTKID( aCellID ); - if ( aVTKCellId < 0 ) + if ( aVTKCellId < 0 ) return aResult; - + vtkCell* aCell = GetParent()->GetElemCell( aCellID ); if ( !aCell ) return aResult; EGeometry aVGeom = VISU::VTKGeom2VISU( aCell->GetCellType() ); - if ( aVGeom < EGeometry(0) ) + if ( aVGeom < EGeometry(0) ) return aResult; - + TGeom2GaussSubMesh::const_iterator anIter = myGeom2GaussSubMesh.find( aVGeom ); if ( anIter == myGeom2GaussSubMesh.end() ) return aResult; - + size_t aSubMeshEnd = myGaussSubMeshArr.size(); const PGaussSubMeshImpl& aGaussSubMesh = anIter->second; for ( size_t aSubMeshId = 0; aSubMeshId < aSubMeshEnd; aSubMeshId++ ) { const PGaussSubMeshImpl& aSubMesh = myGaussSubMeshArr[aSubMeshId]; if ( aGaussSubMesh.get() == aSubMesh.get() ) { - return aGaussSubMesh->GetVTKID(theID); + return aGaussSubMesh->GetVTKID(theID); } } return aResult; } - vtkPolyData* + vtkPolyData* TGaussMeshImpl ::GetPolyDataOutput() { @@ -1027,7 +1029,7 @@ namespace VISU return aSize; } - TNamedIDMapper* + TNamedIDMapper* TGaussMeshImpl ::GetParent() const { @@ -1036,35 +1038,35 @@ namespace VISU //--------------------------------------------------------------- - TGaussPointID + TGaussPointID TGaussPtsIDFilter ::GetObjID(vtkIdType theID) const { return myGaussPtsIDMapper->GetObjID(theID); } - vtkIdType + vtkIdType TGaussPtsIDFilter ::GetVTKID(const TGaussPointID& theID) const { return myGaussPtsIDMapper->GetVTKID(theID); } - - TNamedIDMapper* + + TNamedIDMapper* TGaussPtsIDFilter ::GetParent() const { return myGaussPtsIDMapper->GetParent(); } - vtkPolyData* + vtkPolyData* TGaussPtsIDFilter ::GetPolyDataOutput() { return TPolyDataIDMapperImpl::GetPolyDataOutput(); } - vtkDataSet* + vtkDataSet* TGaussPtsIDFilter ::GetOutput() { @@ -1084,8 +1086,8 @@ namespace VISU { TStructured::CopyStructure( theStructured ); - if ( PMeshImpl aMesh = theStructured ) - GetSource()->ShallowCopy( aMesh->GetPointSet() ); + if ( PMeshImpl aMesh = theStructured ) + GetSource()->ShallowCopy( aMesh->GetPointSet() ); } vtkIdType @@ -1095,7 +1097,7 @@ namespace VISU return myStartID + theID; } - std::string + std::string TSubMeshImpl ::GetElemName(vtkIdType theObjID) const { @@ -1128,8 +1130,8 @@ namespace VISU { TStructured::CopyStructure( theStructured ); - if ( PMeshImpl aMesh = theStructured ) - myNamedPointCoords = aMesh->myNamedPointCoords; + if ( PMeshImpl aMesh = theStructured ) + myNamedPointCoords = aMesh->myNamedPointCoords; } vtkIdType @@ -1160,14 +1162,14 @@ namespace VISU return VISU::GetElemObjID(GetFilter()->GetOutput(), theID); } - std::string + std::string TMeshOnEntityImpl ::GetNodeName(vtkIdType theObjID) const { return myNamedPointCoords->GetNodeName(theObjID); } - std::string + std::string TMeshOnEntityImpl ::GetElemName(vtkIdType theObjID) const { @@ -1176,7 +1178,7 @@ namespace VISU return aSubMesh->GetElemName(anInputCellID.second); } - vtkUnstructuredGrid* + vtkUnstructuredGrid* TMeshOnEntityImpl ::GetUnstructuredGridOutput() { @@ -1222,7 +1224,7 @@ namespace VISU else{ TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID); if(anIter != myElemObj2VTKID.end()) - return anIter->second; + return anIter->second; } return -1; } @@ -1234,21 +1236,21 @@ namespace VISU return myMeshID[theID]; } - vtkIdType + vtkIdType TFamilyImpl - ::GetNodeObjID(vtkIdType theID) const + ::GetNodeObjID(vtkIdType theID) const { return myNamedPointCoords->GetObjID(theID); } vtkIdType TFamilyImpl - ::GetNodeVTKID(vtkIdType theID) const + ::GetNodeVTKID(vtkIdType theID) const { return myNamedPointCoords->GetVTKID(theID); } - vtkUnstructuredGrid* + vtkUnstructuredGrid* TFamilyImpl ::GetUnstructuredGridOutput() { @@ -1281,18 +1283,18 @@ namespace VISU { TStructured::CopyStructure( theStructured ); - if ( PMeshImpl aMesh = theStructured ) + if ( PMeshImpl aMesh = theStructured ) myNamedPointCoords = aMesh->myNamedPointCoords; } - TNbASizeCells + TNbASizeCells TGroupImpl ::GetNbASizeCells() const { vtkIdType aNbCells = 0, aCellsSize = 0; TFamilySet::const_iterator anIter = myFamilySet.begin(); for(; anIter != myFamilySet.end(); anIter++){ - PFamilyImpl aFamily = *anIter; + PFamilyImpl aFamily = *anIter; aNbCells += aFamily->myNbCells; aCellsSize += aFamily->myCellsSize; } @@ -1308,7 +1310,7 @@ namespace VISU else{ TID2ID::const_iterator anIter = myElemObj2VTKID.find(theID); if(anIter != myElemObj2VTKID.end()) - return anIter->second; + return anIter->second; } return -1; } @@ -1320,21 +1322,21 @@ namespace VISU return VISU::GetElemObjID(GetFilter()->GetOutput(), theID); } - vtkIdType + vtkIdType TGroupImpl - ::GetNodeObjID(vtkIdType theID) const + ::GetNodeObjID(vtkIdType theID) const { return myNamedPointCoords->GetObjID(theID); } vtkIdType TGroupImpl - ::GetNodeVTKID(vtkIdType theID) const + ::GetNodeVTKID(vtkIdType theID) const { return myNamedPointCoords->GetVTKID(theID); } - vtkUnstructuredGrid* + vtkUnstructuredGrid* TGroupImpl ::GetUnstructuredGridOutput() { @@ -1356,7 +1358,7 @@ namespace VISU } - + //--------------------------------------------------------------- TFieldImpl ::TFieldImpl() @@ -1364,10 +1366,10 @@ namespace VISU , myDataType( 0 ) {} - void + void TFieldImpl ::Init(vtkIdType theNbComp, - vtkIdType theDataType) + vtkIdType theDataType) { myNbComp = theNbComp; myDataType = theDataType; @@ -1389,24 +1391,24 @@ namespace VISU aComp2Group2MinMax.resize(theNbComp + 1); aComp2Group2AverageMinMax.resize(theNbComp + 1); for(vtkIdType iComp = 0; iComp <= theNbComp; iComp++){ - TMinMax& aMinMax = aComp2MinMax[iComp]; - aMinMax.first = VTK_LARGE_FLOAT; - aMinMax.second = -VTK_LARGE_FLOAT; - TMinMax& anAverageMinMax = aComp2AverageMinMax[iComp]; - anAverageMinMax.first = VTK_LARGE_FLOAT; - anAverageMinMax.second = -VTK_LARGE_FLOAT; + TMinMax& aMinMax = aComp2MinMax[iComp]; + aMinMax.first = VTK_LARGE_FLOAT; + aMinMax.second = -VTK_LARGE_FLOAT; + TMinMax& anAverageMinMax = aComp2AverageMinMax[iComp]; + anAverageMinMax.first = VTK_LARGE_FLOAT; + anAverageMinMax.second = -VTK_LARGE_FLOAT; } } } - vtkIdType + vtkIdType TFieldImpl ::GetDataType() const { return myDataType; } - TMinMax + TMinMax TFieldImpl ::GetMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric) { @@ -1419,13 +1421,13 @@ namespace VISU const TGroup2MinMax& aGroup2MinMax = myMetric2Comp2Group2MinMax[theGaussMetric][theCompID]; TNames::const_iterator aNameIter = theGroupNames.begin(); for( ; aNameIter != theGroupNames.end(); aNameIter++ ) { - TGroup2MinMax::const_iterator aGroup2MinMaxIter = aGroup2MinMax.find( *aNameIter ); - if( aGroup2MinMaxIter != aGroup2MinMax.end() ) { - const TMinMax& aGroupMinMax = aGroup2MinMaxIter->second; - aMinMax.first = std::min( aMinMax.first, aGroupMinMax.first ); - aMinMax.second = std::max( aMinMax.second, aGroupMinMax.second ); - anIsMinMaxInitialized = true; - } + TGroup2MinMax::const_iterator aGroup2MinMaxIter = aGroup2MinMax.find( *aNameIter ); + if( aGroup2MinMaxIter != aGroup2MinMax.end() ) { + const TMinMax& aGroupMinMax = aGroup2MinMaxIter->second; + aMinMax.first = std::min( aMinMax.first, aGroupMinMax.first ); + aMinMax.second = std::max( aMinMax.second, aGroupMinMax.second ); + anIsMinMaxInitialized = true; + } } } @@ -1436,7 +1438,7 @@ namespace VISU } - TMinMax + TMinMax TFieldImpl ::GetAverageMinMax(vtkIdType theCompID, const TNames& theGroupNames, TGaussMetric theGaussMetric) { @@ -1449,13 +1451,13 @@ namespace VISU const TGroup2MinMax& aGroup2MinMax = myMetric2Comp2Group2AverageMinMax[theGaussMetric][theCompID]; TNames::const_iterator aNameIter = theGroupNames.begin(); for( ; aNameIter != theGroupNames.end(); aNameIter++ ) { - TGroup2MinMax::const_iterator aGroup2MinMaxIter = aGroup2MinMax.find( *aNameIter ); - if( aGroup2MinMaxIter != aGroup2MinMax.end() ) { - const TMinMax& aGroupMinMax = aGroup2MinMaxIter->second; - aMinMax.first = std::min( aMinMax.first, aGroupMinMax.first ); - aMinMax.second = std::max( aMinMax.second, aGroupMinMax.second ); - anIsMinMaxInitialized = true; - } + TGroup2MinMax::const_iterator aGroup2MinMaxIter = aGroup2MinMax.find( *aNameIter ); + if( aGroup2MinMaxIter != aGroup2MinMax.end() ) { + const TMinMax& aGroupMinMax = aGroup2MinMaxIter->second; + aMinMax.first = std::min( aMinMax.first, aGroupMinMax.first ); + aMinMax.second = std::max( aMinMax.second, aGroupMinMax.second ); + anIsMinMaxInitialized = true; + } } } @@ -1464,9 +1466,9 @@ namespace VISU return aMinMax; } - + //---------------------------------------------------------------------------- - const PMeshValue& + const PMeshValue& TGeom2Value ::GetMeshValue(EGeometry theGeom) const { @@ -1475,8 +1477,8 @@ namespace VISU EXCEPTION(std::runtime_error,"TGeom2Value::GetMeshValue - myGeom2MeshValue.find(theGeom) fails"); return anIter->second; } - - PMeshValue& + + PMeshValue& TGeom2Value ::GetMeshValue(EGeometry theGeom) { @@ -1485,21 +1487,21 @@ namespace VISU //---------------------------------------------------------------------------- - TGeom2MeshValue& + TGeom2MeshValue& TGeom2Value ::GetGeom2MeshValue() { return myGeom2MeshValue; } - - const TGeom2MeshValue& + + const TGeom2MeshValue& TGeom2Value ::GetGeom2MeshValue() const { return myGeom2MeshValue; } - PMeshValue + PMeshValue TGeom2Value ::GetFirstMeshValue() const { @@ -1516,35 +1518,35 @@ namespace VISU myUnstructuredGridIDMapper(new TUnstructuredGridIDMapperImpl()) {} - const PMeshValue& + const PMeshValue& TValForTimeImpl ::GetMeshValue(EGeometry theGeom) const { return myGeom2Value.GetMeshValue(theGeom); } - - PMeshValue& + + PMeshValue& TValForTimeImpl ::GetMeshValue(EGeometry theGeom) { return myGeom2Value.GetMeshValue(theGeom); } - TGeom2MeshValue& + TGeom2MeshValue& TValForTimeImpl ::GetGeom2MeshValue() { return myGeom2Value.GetGeom2MeshValue(); } - const TGeom2MeshValue& + const TGeom2MeshValue& TValForTimeImpl ::GetGeom2MeshValue() const { return myGeom2Value.GetGeom2MeshValue(); } - PMeshValue + PMeshValue TValForTimeImpl ::GetFirstMeshValue() const { @@ -1561,7 +1563,7 @@ namespace VISU } return anIter->second; } - + int TValForTimeImpl ::GetMaxNbGauss() const @@ -1573,7 +1575,7 @@ namespace VISU } return aNbGauss; } - + unsigned long int TValForTimeImpl ::GetMemorySize() @@ -1590,6 +1592,5 @@ namespace VISU return aSize; } - //--------------------------------------------------------------- } diff --git a/src/PIPELINE/VISU_Extractor.cxx b/src/PIPELINE/VISU_Extractor.cxx index 575f787d..105e7f5f 100644 --- a/src/PIPELINE/VISU_Extractor.cxx +++ b/src/PIPELINE/VISU_Extractor.cxx @@ -22,7 +22,7 @@ // VISU OBJECT : interactive object for VISU entities implementation // File : VISU_Extractor.cxx // Module : VISU -// + #include "VISU_Extractor.hxx" #include "VISU_PipeLineUtils.hxx" #include "VISU_ConvertorUtils.hxx" @@ -39,7 +39,6 @@ #include - //---------------------------------------------------------------------------- vtkStandardNewMacro(VISU_Extractor); @@ -99,34 +98,37 @@ VISU_Extractor //---------------------------------------------------------------------------- -template +template void Module2Scalars(vtkDataArray *theInputDataArray, - TValueType* theOutputPtr, - vtkIdType theNbOfTuples) + TValueType* theOutputPtr, + vtkIdType theNbOfTuples, + VISU::TGaussMetric theGaussMetric) { vtkIdType aNbComp = theInputDataArray->GetNumberOfComponents(); - std::vector anArray(aNbComp < 3? 3: aNbComp); - for(vtkIdType aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++){ + if (aNbComp != 3) // Min, Max, Avg + return; + std::vector anArray (3); + for (vtkIdType aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++) { theInputDataArray->GetTuple(aTupleId, &anArray[0]); - vtkFloatingPointType aVector[3] = {anArray[0], anArray[1], anArray[2]}; - vtkFloatingPointType aScalar = sqrt(aVector[0]*aVector[0] + - aVector[1]*aVector[1] + - aVector[2]*aVector[2]); - *theOutputPtr = TValueType(aScalar); + switch (theGaussMetric) { + case VISU::MINIMUM_METRIC: *theOutputPtr = TValueType(anArray[0]); break; + case VISU::MAXIMUM_METRIC: *theOutputPtr = TValueType(anArray[1]); break; + case VISU::AVERAGE_METRIC: *theOutputPtr = TValueType(anArray[2]); break; + } theOutputPtr++; } } //---------------------------------------------------------------------------- -template +template void Component2Scalars(vtkDataArray *theInputDataArray, - TValueType* theInputPtr, - TValueType* theOutputPtr, - vtkIdType theNbOfTuples, - vtkIdType theComponentId) + TValueType* theInputPtr, + TValueType* theOutputPtr, + vtkIdType theNbOfTuples, + vtkIdType theComponentId) { vtkIdType aNbComp = theInputDataArray->GetNumberOfComponents(); for(vtkIdType aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++){ @@ -139,17 +141,17 @@ Component2Scalars(vtkDataArray *theInputDataArray, //---------------------------------------------------------------------------- template void -ExecuteScalars(vtkIdType theNbOfTuples, - vtkIdType theScalarMode, - VISU::TGaussMetric theGaussMetric, - TDataSetAttributesType* theInputData, - TDataSetAttributesType* theOutputData) +ExecuteScalars(vtkIdType theNbOfTuples, + vtkIdType theScalarMode, + VISU::TGaussMetric theGaussMetric, + TDataSetAttributesType* theInputData, + TDataSetAttributesType* theOutputData) { - if(theNbOfTuples < 1) + if (theNbOfTuples < 1) return; vtkDataArray* aFieldArray = NULL; - switch( theGaussMetric ) { + switch (theGaussMetric) { case VISU::AVERAGE_METRIC: aFieldArray = theInputData->GetArray("VISU_FIELD"); break; case VISU::MINIMUM_METRIC: aFieldArray = theInputData->GetArray("VISU_FIELD_GAUSS_MIN"); break; case VISU::MAXIMUM_METRIC: aFieldArray = theInputData->GetArray("VISU_FIELD_GAUSS_MAX"); break; @@ -165,28 +167,32 @@ ExecuteScalars(vtkIdType theNbOfTuples, void *anInputPtr = aFieldArray->GetVoidPointer(0); void *anOutputPtr = anOutputScalars->GetVoidPointer(0); - if(theScalarMode == 0){ - switch(anInputDataType){ - vtkTemplateMacro3(Module2Scalars, - aFieldArray, - (VTK_TT *)(anOutputPtr), - theNbOfTuples); + if (theScalarMode == 0) { + aFieldArray = theInputData->GetArray("VISU_FIELD_GAUSS_MOD"); + if (!aFieldArray) + return; + switch (anInputDataType) { + vtkTemplateMacro4(Module2Scalars, + aFieldArray, + (VTK_TT *)(anOutputPtr), + theNbOfTuples, + theGaussMetric); default: break; } - }else{ - switch(anInputDataType){ + } else { + switch (anInputDataType) { vtkTemplateMacro5(Component2Scalars, - aFieldArray, - (VTK_TT *)(anInputPtr), - (VTK_TT *)(anOutputPtr), - theNbOfTuples, - theScalarMode - 1); + aFieldArray, + (VTK_TT *)(anInputPtr), + (VTK_TT *)(anOutputPtr), + theNbOfTuples, + theScalarMode - 1); default: break; } } - + theOutputData->SetScalars(anOutputScalars); anOutputScalars->Delete(); } @@ -196,8 +202,8 @@ ExecuteScalars(vtkIdType theNbOfTuples, int VISU_Extractor ::RequestData(vtkInformation *theRequest, - vtkInformationVector **theInputVector, - vtkInformationVector *theOutputVector) + vtkInformationVector **theInputVector, + vtkInformationVector *theOutputVector) { vtkDataSet *anInput = VISU::GetInput( theInputVector, 0 ); vtkDataSet *anOutput = VISU::GetOutput( theOutputVector ); @@ -206,16 +212,16 @@ VISU_Extractor vtkPointData *anInputPointData = anInput->GetPointData(); vtkPointData *anOutputPointData = anOutput->GetPointData(); - anOutputPointData->PassData( anInputPointData ); + anOutputPointData->PassData( anInputPointData ); if ( VISU::IsDataOnPoints( anInput ) ) { int aNbElems = anInput->GetNumberOfPoints(); if ( anInputPointData->GetAttribute( vtkDataSetAttributes::VECTORS ) ) ExecuteScalars( aNbElems, myScalarMode, myGaussMetric, anInputPointData, anOutputPointData ); } - + vtkCellData *anInputCellData = anInput->GetCellData(); vtkCellData *anOutputCellData = anOutput->GetCellData(); - anOutputCellData->PassData( anInputCellData ); + anOutputCellData->PassData( anInputCellData ); if ( VISU::IsDataOnCells( anInput ) ) { int aNbElems = anInput->GetNumberOfCells(); if ( anInputCellData->GetAttribute( vtkDataSetAttributes::VECTORS ) ) diff --git a/src/PIPELINE/VISU_ScalarMapPL.cxx b/src/PIPELINE/VISU_ScalarMapPL.cxx index 35a0a1d2..e15d9434 100644 --- a/src/PIPELINE/VISU_ScalarMapPL.cxx +++ b/src/PIPELINE/VISU_ScalarMapPL.cxx @@ -20,10 +20,11 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // VISU OBJECT : interactive object for VISU entities implementation -// File: VISU_ScalarMapPL.cxx -// Author: Alexey PETROV -// Module : VISU // +// File: VISU_ScalarMapPL.cxx +// Author: Alexey PETROV +// Module : VISU + #include "VISU_ScalarMapPL.hxx" #include "VISU_DataSetMapperHolder.hxx" #include "VISU_ElnoAssembleFilter.hxx" @@ -76,7 +77,7 @@ VISU_ScalarMapPL //---------------------------------------------------------------------------- -unsigned long int +unsigned long int VISU_ScalarMapPL ::GetMTime() { @@ -90,7 +91,7 @@ VISU_ScalarMapPL //---------------------------------------------------------------------------- -void +void VISU_ScalarMapPL ::OnCreateMapperHolder() { @@ -101,7 +102,7 @@ VISU_ScalarMapPL //---------------------------------------------------------------------------- void VISU_ScalarMapPL -::Build() +::Build() { Superclass::Build(); @@ -117,6 +118,7 @@ VISU_ScalarMapPL myMergeFilter->AddField("VISU_FIELD", aDataSet); myMergeFilter->AddField("VISU_FIELD_GAUSS_MIN", aDataSet); myMergeFilter->AddField("VISU_FIELD_GAUSS_MAX", aDataSet); + myMergeFilter->AddField("VISU_FIELD_GAUSS_MOD", aDataSet); myMergeFilter->AddField("VISU_CELLS_MAPPER", aDataSet); myMergeFilter->AddField("VISU_POINTS_MAPPER", aDataSet); myMergeFilter->AddField("ELNO_POINT_COORDS", aDataSet); @@ -130,7 +132,7 @@ VISU_ScalarMapPL //---------------------------------------------------------------------------- void VISU_ScalarMapPL -::Update() +::Update() { Superclass::Update(); //{ @@ -152,7 +154,7 @@ VISU_ScalarMapPL void VISU_ScalarMapPL ::DoShallowCopy(VISU_PipeLine *thePipeLine, - bool theIsCopyInput) + bool theIsCopyInput) { Superclass::DoShallowCopy(thePipeLine, theIsCopyInput); VISU_MergedPL::DoShallowCopy(thePipeLine, theIsCopyInput); @@ -171,6 +173,7 @@ VISU_ScalarMapPL myElnoAssembleFilter->SetElnoAssembleState( theIsShrunk ); } + //---------------------------------------------------------------------------- void VISU_ScalarMapPL @@ -189,7 +192,7 @@ VISU_ScalarMapPL ::AddGeometry(vtkDataSet* theGeometry, const VISU::TName& theGeomName) { // rnv: to fix issue 0020167 (AddMeshOnGroup is not fully taken into account) - // clear all inpust of the this->myAppendFilter in case if presentation + // clear all inpust of the this->myAppendFilter in case if presentation // constructed on the entire mesh. if(!IsExternalGeometryUsed()) ClearGeometry(); @@ -252,7 +255,7 @@ VISU_ScalarMapPL //---------------------------------------------------------------------------- void VISU_ScalarMapPL -::SetGaussMetric(VISU::TGaussMetric theGaussMetric) +::SetGaussMetric(VISU::TGaussMetric theGaussMetric) { if(GetGaussMetric() == theGaussMetric) return; @@ -264,14 +267,14 @@ VISU_ScalarMapPL //---------------------------------------------------------------------------- VISU::TGaussMetric VISU_ScalarMapPL -::GetGaussMetric() +::GetGaussMetric() { return GetExtractorFilter()->GetGaussMetric(); } //---------------------------------------------------------------------------- -vtkDataSet* +vtkDataSet* VISU_ScalarMapPL ::InsertCustomPL() { @@ -280,7 +283,7 @@ VISU_ScalarMapPL //---------------------------------------------------------------------------- -vtkPointSet* +vtkPointSet* VISU_ScalarMapPL ::GetMergedInput() {