#ifdef _DEBUG_
static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 1;
+static int MYDEBUGWITHFILES = 0;
#else
static int MYDEBUG = 0;
static int MYDEBUGWITHFILES = 0;
//---------------------------------------------------------------
- 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 = "<<aNbTuples<<endl);
+
+ vtkDataSetAttributes* aDataSetAttributes;
+ switch(theField->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();
int aNbGauss = aMeshValue.myNbGauss;
int aNbComp = aMeshValue.myNbComp;
- INITMSG(MYDEBUG,"GetTimeStampOnProfile2 - aGeom = "<<aGeom<<
+ INITMSG(MYDEBUG,
+ "- aGeom = "<<aGeom<<
"; aNbElem = "<<aNbElem<<
"; aNbComp = "<<aNbComp<<
"; aNbGauss = "<<aNbGauss<<
}
aValue[iComp] /= aNbGauss;
}
- theFloatArray->SetTuple1(aTupleId++,aValue[0]);
+ aFloatArray->SetTuple1(aTupleId++,aValue[0]);
}
break;
case 2:
}
aValue[iComp] /= aNbGauss;
}
- theFloatArray->SetTuple3(aTupleId++,aValue[0],aValue[1],0.0);
+ aFloatArray->SetTuple3(aTupleId++,aValue[0],aValue[1],0.0);
}
break;
default:
}
aValue[iComp] /= aNbGauss;
}
- theFloatArray->SetTuple3(aTupleId++,aValue[0],aValue[1],aValue[2]);
+ aFloatArray->SetTuple3(aTupleId++,aValue[0],aValue[1],aValue[2]);
}
}
}
}
- //---------------------------------------------------------------
- std::string
- GenerateFieldName(const VISU::PFieldImpl theField,
- const VISU::PValForTimeImpl theValForTime)
- {
- 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 = "<<aNbTuples<<endl);
-
- vtkDataSetAttributes* aDataSetAttributes;
- switch(theField->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,
}
+ //---------------------------------------------------------------
+ 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 = "<<aNbTuples<<endl);
+
+ vtkDataSetAttributes* aDataSetAttributes;
+ switch(theField->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 = "<<aGeom<<
+ "; aNbElem = "<<aNbElem<<
+ "; aNbComp = "<<aNbComp<<
+ "; aNbGauss = "<<aNbGauss<<
+ endl);
+
+ if(aNbComp == 4)
+ aNbComp = 2;
+
+ switch(aNbComp){
+ case 1:
+ for(int iElem = 0; iElem < aNbElem; iElem++){
+ float aValue[] = {0.0, 0.0, 0.0};
+ TCValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem);
+ for(int iGauss = 0; iGauss < aNbGauss; iGauss++){
+ const TCValueSlice& aValueSlice = aValueSliceArr[iGauss];
+ for(int iComp = 0; iComp < aNbComp; iComp++){
+ aValue[iComp] += aValueSlice[iComp];
+ }
+ aFloatArray->SetTuple1(aTupleId++,aValue[0]);
+ }
+ }
+ break;
+ case 2:
+ for(int iElem = 0; iElem < aNbElem; iElem++){
+ float aValue[] = {0.0, 0.0, 0.0};
+ TCValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem);
+ for(int iGauss = 0; iGauss < aNbGauss; iGauss++){
+ const TCValueSlice& aValueSlice = aValueSliceArr[iGauss];
+ for(int iComp = 0; iComp < aNbComp; iComp++){
+ aValue[iComp] += aValueSlice[iComp];
+ }
+ aFloatArray->SetTuple3(aTupleId++,aValue[0],aValue[1],0.0);
+ }
+ }
+ break;
+ default:
+ for(int iElem = 0; iElem < aNbElem; iElem++){
+ float aValue[] = {0.0, 0.0, 0.0};
+ TCValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem);
+ for(int iGauss = 0; iGauss < aNbGauss; iGauss++){
+ const TCValueSlice& aValueSlice = aValueSliceArr[iGauss];
+ for(int iComp = 0; iComp < aNbComp; iComp++){
+ aValue[iComp] += aValueSlice[iComp];
+ }
+ aFloatArray->SetTuple3(aTupleId++,aValue[0],aValue[1],aValue[2]);
+ }
+ }
+ }
+ }
+ }
+
+
//---------------------------------------------------------------
void
GetSource(VISU::TVTKSource& theSource,
PGaussImpl aGauss = theGaussSubMesh->myGauss;
INITMSG(MYDEBUG,"GetGaussSubMesh - aGeom = "<<aGauss->myGeom<<endl);
- TVTKSource& aSource = theGaussSubMesh->mySource;
if(theGaussSubMesh->myIsVTKDone)
return;
+ TVTKSource& aSource = theGaussSubMesh->mySource;
GetSource(aSource,theGaussSubMesh,theMeshOnEntity);
INITMSGA(MYDEBUG,0,"GetNumberOfPoints - "<<aSource->GetNumberOfPoints()<<endl);
BEGMSG(MYDEBUG,"GetNumberOfCells - "<<aSource->GetNumberOfCells()<<endl);
if(theGaussMesh->myIsVTKDone)
return;
+ INITMSG(MYDEBUG,"GetGaussMesh"<<endl);
TVTKAppendFilter& anAppendFilter = theGaussMesh->myFilter;
const TGeom2GaussSubMesh& aGeom2GaussSubMesh = theGaussMesh->myGeom2GaussSubMesh;
TGeom2GaussSubMesh::const_iterator anIter = aGeom2GaussSubMesh.begin();
anAppendFilter->AddInput(aSource.GetPointer());
}
anAppendFilter->Update(); // Fix on VTK
+
+ vtkDataSet* aSource = anAppendFilter->GetOutput();
+ INITMSGA(MYDEBUG,0,"aNbPoints - "<<aSource->GetNumberOfPoints()<<endl);
+ BEGMSG(MYDEBUG,"aNbCells - "<<aSource->GetNumberOfCells()<<endl);
theGaussMesh->myIsVTKDone = true;
}
TVTKAppendFilter& anAppendFilter = aGaussMesh->myFilter;
aSource->ShallowCopy(anAppendFilter->GetOutput());
- //GetTimeStampOnProfile(aSource,aField,aValForTime);
+ GetTimeStampOnGaussMesh(aSource,aField,aValForTime);
}
aValForTime->myIsVTKDone = true;