From ccc58f97017a73869dae4cccc24a15abf887e380 Mon Sep 17 00:00:00 2001 From: apo Date: Thu, 28 Jul 2005 12:35:31 +0000 Subject: [PATCH] To implement result data assigning to Gauss Points --- src/CONVERTOR/VISU_Convertor_impl.cxx | 220 ++++++++++++++++++-------- src/CONVERTOR/VISU_MedConvertor.cxx | 4 +- 2 files changed, 156 insertions(+), 68 deletions(-) diff --git a/src/CONVERTOR/VISU_Convertor_impl.cxx b/src/CONVERTOR/VISU_Convertor_impl.cxx index 72c0b922..1828afac 100644 --- a/src/CONVERTOR/VISU_Convertor_impl.cxx +++ b/src/CONVERTOR/VISU_Convertor_impl.cxx @@ -58,7 +58,7 @@ static int MYVTKDEBUG = 0; #ifdef _DEBUG_ static int MYDEBUG = 0; -static int MYDEBUGWITHFILES = 1; +static int MYDEBUGWITHFILES = 0; #else static int MYDEBUG = 0; static int MYDEBUGWITHFILES = 0; @@ -681,16 +681,49 @@ namespace //--------------------------------------------------------------- - void - GetTimeStampOnProfile2(vtkFloatArray *theFloatArray, - const vtkIdType& theNumberOfTuples, - const std::string& theFieldName, - VISU::PFieldImpl theField, - VISU::PValForTimeImpl theValForTime) + std::string + GenerateFieldName(const VISU::PFieldImpl theField, + const VISU::PValForTimeImpl theValForTime) { - //theFloatArray->DebugOn(); - theFloatArray->SetNumberOfTuples(theNumberOfTuples); - theFloatArray->SetName(theFieldName.c_str()); + const VISU::TTime& aTime = theValForTime->myTime; + string aFieldName = theField->myMeshName + ", " + theField->myName + ": " + + VISU_Convertor::GenerateName(aTime); + return aFieldName; + } + + + //--------------------------------------------------------------- + void + GetTimeStampOnProfile(VISU::TVTKSource& theSource, + const VISU::PFieldImpl theField, + const VISU::PValForTimeImpl theValForTime) + { + int aNbTuples = theField->myDataSize/theField->myNbComp; + string aFieldName = GenerateFieldName(theField,theValForTime); + INITMSG(MYDEBUG,"GetTimeStampOnProfile - aNbTuples = "<myEntity){ + case VISU::NODE_ENTITY : + aDataSetAttributes = theSource->GetPointData(); + break; + default: + aDataSetAttributes = theSource->GetCellData(); + } + + vtkFloatArray *aFloatArray = vtkFloatArray::New(); + switch(theField->myNbComp) { + case 1: + aFloatArray->SetNumberOfComponents(1); + aDataSetAttributes->SetScalars(aFloatArray); + break; + default: + aFloatArray->SetNumberOfComponents(3); + aDataSetAttributes->SetVectors(aFloatArray); + } + + aFloatArray->SetNumberOfTuples(aNbTuples); + aFloatArray->SetName(aFieldName.c_str()); TGeom2Value& aGeom2Value = theValForTime->myGeom2Value; TGeom2Value::const_iterator anIter = aGeom2Value.begin(); @@ -702,7 +735,8 @@ namespace int aNbGauss = aMeshValue.myNbGauss; int aNbComp = aMeshValue.myNbComp; - INITMSG(MYDEBUG,"GetTimeStampOnProfile2 - aGeom = "<myName + ": " + - VISU_Convertor::GenerateName(aTime); - return aFieldName; - } - - - //--------------------------------------------------------------- - void - GetTimeStampOnProfile(VISU::TVTKSource& theSource, - const VISU::PFieldImpl theField, - const VISU::PValForTimeImpl theValForTime) - { - int aNbTuples = theField->myDataSize/theField->myNbComp; - string aFieldName = GenerateFieldName(theField,theValForTime); - INITMSG(MYDEBUG,"GetTimeStampOnProfile - aNbTuples = "<myEntity){ - case VISU::NODE_ENTITY : - aDataSetAttributes = theSource->GetPointData(); - break; - default: - aDataSetAttributes = theSource->GetCellData(); - } - - vtkFloatArray *aFloatArray = vtkFloatArray::New(); - switch(theField->myNbComp) { - case 1: - aFloatArray->SetNumberOfComponents(1); - aDataSetAttributes->SetScalars(aFloatArray); - break; - default: - aFloatArray->SetNumberOfComponents(3); - aDataSetAttributes->SetVectors(aFloatArray); - } - - GetTimeStampOnProfile2(aFloatArray, - aNbTuples, - aFieldName, - theField, - theValForTime); - } - - //--------------------------------------------------------------- void GetCells(VISU::TVTKSource& theSource, @@ -928,6 +912,105 @@ namespace } + //--------------------------------------------------------------- + void + GetTimeStampOnGaussMesh(VISU::TVTKSource& theSource, + const VISU::PFieldImpl theField, + const VISU::PValForTimeImpl theValForTime) + { + int aNbTuples = theSource->GetNumberOfPoints(); + std::string aFieldName = GenerateFieldName(theField,theValForTime); + INITMSG(MYDEBUG,"GetTimeStampOnGaussMesh - aNbTuples = "<myEntity){ + case VISU::NODE_ENTITY : + aDataSetAttributes = theSource->GetPointData(); + break; + default: + aDataSetAttributes = theSource->GetCellData(); + } + + vtkFloatArray *aFloatArray = vtkFloatArray::New(); + switch(theField->myNbComp) { + case 1: + aFloatArray->SetNumberOfComponents(1); + aDataSetAttributes->SetScalars(aFloatArray); + break; + default: + aFloatArray->SetNumberOfComponents(3); + aDataSetAttributes->SetVectors(aFloatArray); + } + + aFloatArray->SetNumberOfTuples(aNbTuples); + aFloatArray->SetName(aFieldName.c_str()); + + TGeom2Value& aGeom2Value = theValForTime->myGeom2Value; + TGeom2Value::const_iterator anIter = aGeom2Value.begin(); + for(int aTupleId = 0; anIter != aGeom2Value.end(); anIter++){ + const TMeshValue& aMeshValue = anIter->second; + int aGeom = anIter->first; + + int aNbElem = aMeshValue.myNbElem; + int aNbGauss = aMeshValue.myNbGauss; + int aNbComp = aMeshValue.myNbComp; + + if(aNbGauss <= 1) + continue; + + INITMSG(MYDEBUG,"- aGeom = "<GetNumberOfPoints()<GetNumberOfCells()<myIsVTKDone) return; + INITMSG(MYDEBUG,"GetGaussMesh"<myFilter; const TGeom2GaussSubMesh& aGeom2GaussSubMesh = theGaussMesh->myGeom2GaussSubMesh; TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin(); @@ -1032,6 +1116,10 @@ namespace anAppendFilter->AddInput(aSource.GetPointer()); } anAppendFilter->Update(); // Fix on VTK + + vtkDataSet* aSource = anAppendFilter->GetOutput(); + INITMSGA(MYDEBUG,0,"aNbPoints - "<GetNumberOfPoints()<GetNumberOfCells()<myIsVTKDone = true; } @@ -1233,7 +1321,7 @@ VISU_Convertor_impl TVTKAppendFilter& anAppendFilter = aGaussMesh->myFilter; aSource->ShallowCopy(anAppendFilter->GetOutput()); - //GetTimeStampOnProfile(aSource,aField,aValForTime); + GetTimeStampOnGaussMesh(aSource,aField,aValForTime); } aValForTime->myIsVTKDone = true; diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index 0b6f084f..7be4fb06 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -45,7 +45,7 @@ using MED::TFloat; using MED::EBooleen; #ifdef _DEBUG_ -static int MYDEBUG = 1; +static int MYDEBUG = 0; static int MY_FAMILY_DEBUG = 0; static int MY_GROUP_DEBUG = 0; #else @@ -628,7 +628,7 @@ VISU_MedConvertor } } - continue; + //continue; MED::TFamilyGroup aFamilyGroup = MED::GetFamilies(aMed,aMeshInfo); MED::TFamilyByEntity aFamilyByEntity = MED::GetFamiliesByEntity(aMed,aElemGroup,aFamilyGroup); -- 2.39.2