myMeshGeometryList.push_back(theGeometry);
if (MYDEBUG) MESSAGE("this->GetGeometry(0)->GetIDMapper()="<<this->GetGeometry(0)->GetIDMapper());
myIsModified = true;
+
+ this->Execute();
+
return true;
} else
return false;
if(this->checkGeometry(theGeometry)){
myMeshGeometryList.push_back(theGeometry);
myIsModified = true;
+
+ this->Execute();
+
return (myMeshGeometryList.size()-1);
} else {
return -1;
for(;aIter != myMeshGeometryList.end();aIter++){
if( myMeshGeometryList[theId] == (*aIter)){
myMeshGeometryList.erase(aIter);
+ this->Execute();
break;
}
}
VISU_PrsMergerPL
::SetScalars(VISU_PipeLine* theInput)
{
+ if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::SetScalars()");
if ( this->checkScalars( theInput ) ){
myScalars = theInput;
VISU_ScalarMapPL* aScalarMap = dynamic_cast<VISU_ScalarMapPL*>(this->GetScalars());
- aScalarMap->Build();
- aScalarMap->Init();
- aScalarMap->Update();
- myIsModified = true;
- //SetInput(theInput->GetInput());
+ myScalarRanges = aScalarMap->GetScalarRange();
return true;
} else
return false;
}
+void
+VISU_PrsMergerPL
+::Init()
+{
+ Superclass::Init();
+ if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::Init() this="<<this);
+ this->Execute();
+}
+
void
VISU_PrsMergerPL
::Update()
{
- VISU_ScalarMapPL* aScalarMap = dynamic_cast<VISU_ScalarMapPL*>(this->GetScalars());
- VISU_PrsMergerPL* aPrsMerger = dynamic_cast<VISU_PrsMergerPL*>(this->GetScalars());
- if(aScalarMap != NULL && aPrsMerger == NULL){
- SetInput(myScalars->GetInput());
- Superclass::Update();
- }
+ if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::Update()");
+ Superclass::Update();
+}
+
+void
+VISU_PrsMergerPL
+::Build()
+{
+ if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::Build()");
+ //this->Execute();
+ TSupperClass::Build(); // call DoHook method
}
void
::SetInitialRange()
{
myMapper->UseLookupTableScalarRangeOff();
- VISU_ScalarMapPL* aScalarMap = dynamic_cast<VISU_ScalarMapPL*>(this->GetScalars());
- if(aScalarMap != NULL){
- myScalarRanges = aScalarMap->GetScalarRange();
+}
+
+// VISU_ScalarMapPL::THook*
+// VISU_PrsMergerPL
+// ::DoHook()
+// {
+// if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::DoHook()");
+// Execute();
+// return myOutput;
+// }
+
+bool
+VISU_PrsMergerPL
+::checkGeometry(const VISU_PipeLine* thePipeLine)
+{
+ const VISU::PIDMapper& aMapper = thePipeLine->GetIDMapper();
+ int aNbPoints = aMapper->GetVTKOutput()->GetNumberOfPoints();
+ if (this->GetNbGeometry() > 0){
+ const VISU::PIDMapper& aMapper2 = this->GetGeometry(0)->GetIDMapper();
+ int aNbPoints2 = aMapper2->GetVTKOutput()->GetNumberOfPoints();
+ if(aNbPoints2 != aNbPoints)
+ return false;
+ } else if (this->GetScalars()) {
+ const VISU::PIDMapper& aMapper2 = this->GetScalars()->GetIDMapper();
+ int aNbPoints2 = aMapper2->GetVTKOutput()->GetNumberOfPoints();
+ if(aNbPoints2 != aNbPoints)
+ return false;
}
+ return true;
}
-VISU_ScalarMapPL::THook*
+bool
VISU_PrsMergerPL
-::DoHook()
+::checkScalars(const VISU_PipeLine* thePipeLine)
{
- if(!myIsModified) return myOutput;
+ const VISU::PIDMapper& aMapper = thePipeLine->GetIDMapper();
+ int aNbPoints = aMapper->GetVTKOutput()->GetNumberOfPoints();
+ if (this->GetNbGeometry() > 0){
+ const VISU::PIDMapper& aMapper2 = this->GetGeometry(0)->GetIDMapper();
+ int aNbPoints2 = aMapper2->GetVTKOutput()->GetNumberOfPoints();
+ if(aNbPoints2 != aNbPoints)
+ return false;
+ }
+ return true;
+}
+
+void
+VISU_PrsMergerPL
+::Execute(){
+ if(MYDEBUG) MESSAGE("VISU_PrsMergerPL::Execute()");
- myOutput = NULL;
- myIsModified = false;
-
if(myMeshGeometryList.size() != 0)
{
// Build mesh
TVec aObjIds;// object ids from geometries
int anbGeoms;
int aGeomNbCells,aAllGeomNbCells,aScalarNbCells;
- int aScalarNodeTuplesNum,aScalarCellTuplesNum;
+ int aScalarNodeTuplesNum,aScalarCellTuplesNum,aScalarCellComponentNum;
vtkFloatArray* aOutputCellScalars;
VTKViewer_AppendFilter* aMergeGeoms;
aAllGeomNbCells = 0;
+ myMergeFilter->RemoveAllInputs();
+
aMergeGeoms = VTKViewer_AppendFilter::New();
+
myMergeFilter->SetGeometry(aMergeGeoms->GetOutput());
+
VISU_ScalarMapPL* aScalarMap = dynamic_cast<VISU_ScalarMapPL*>(this->GetScalars());
VISU_PrsMergerPL* aPrsMergerPL = dynamic_cast<VISU_PrsMergerPL*>(this->GetScalars());
if (aPrsMergerPL) {
if (MYDEBUG) MESSAGE("\t this=" << this << " aPrsMergerPL=" << aPrsMergerPL);
}
if(aScalarMap != NULL){
- myMergeFilter->SetScalars(aScalarMap->GetOutput());
+ myMergeFilter->GetOutput()->GetPointData()->SetScalars(aScalarMap->GetOutput()->GetPointData()->GetScalars());
}
anbGeoms = this->GetNbGeometry();
aCurrGeometry->Update();
const VISU::PIDMapper& aGM = aCurrGeometry->GetIDMapper();
int aNbCells = aGM->GetVTKOutput()->GetNumberOfCells();
+ if(MYDEBUG) MESSAGE("Geom["<<i<<"] aNbCells="<<aNbCells);
if (aNbCells >0 )
if (aGM->GetVTKOutput()->GetCell(0)->GetCellType() == VTK_VERTEX )
continue;
aObjIds.push_back(aGM->GetElemObjID(j));
}
}
- aMergeGeoms->Update();
+
myMergeFilter->Update();
if (MYDEBUG){
}
}
- aScalarCellTuplesNum = aScalarMapper->GetVTKOutput()->GetCellData()->GetNumberOfTuples();
+ aScalarCellTuplesNum = aScalarMapper->GetVTKOutput()->GetCellData()->GetNumberOfTuples();
+ aScalarCellComponentNum = aScalarMapper->GetVTKOutput()->GetCellData()->GetNumberOfComponents();
+
+
+ if(MYDEBUG) MESSAGE("aScalarMapper NumberOfTuples ="<<aScalarCellTuplesNum);
+ if(MYDEBUG) MESSAGE("aScalarMapper NumberOfArrays ="<<aScalarMapper->GetVTKOutput()->GetCellData()->GetNumberOfArrays());
+ if(MYDEBUG) MESSAGE("aScalarMapper NumberOfComponents="<<aScalarCellComponentNum);
if (aScalarCellTuplesNum > 0) {
// copy scalars from cell data
aOutputCellScalars = vtkFloatArray::New();
aOutputCellScalars->SetNumberOfTuples(aAllGeomNbCells);
- if(MYDEBUG) cout << "Output:" << endl;
+ if(MYDEBUG) cout << "Output: ObjId,VtkId,newId" << endl;
TVec::const_iterator aIdsIter = aObjIds.begin();
for(int i=0; aIdsIter != aObjIds.end(); aIdsIter++){
int anObjID = *aIdsIter;
int aVTKID = aScalarMapper->GetElemVTKID(anObjID);
float* aTuple = aScalarMapper->GetVTKOutput()->GetCellData()->GetTuple(aVTKID);
- if(MYDEBUG)
- cout <<"\t\t" << anObjID << ";"<<aVTKID<<";"<<i<<endl;
+ if(MYDEBUG){
+ cout <<"\t\t" << anObjID << ";"<<aVTKID<<";"<<i<<" tuples:";
+ for(int k=0;k<aScalarCellComponentNum;k++)
+ cout << aTuple[i] << ",";
+ cout << endl;
+ }
aOutputCellScalars->SetTuple(i,aTuple);
i++;
}
if (MYDEBUG) cout << "\tmyMergeFilter->GetUnstructuredGridOutput()="
<<myMergeFilter->GetUnstructuredGridOutput()<<endl;
+ if(MYDEBUG) MESSAGE("myMergeFilter NumberOfTuples ="<<myMergeFilter->GetUnstructuredGridOutput()->GetCellData()->GetNumberOfTuples());
+ if(MYDEBUG) MESSAGE("myMergeFilter NumberOfArrays ="<<myMergeFilter->GetUnstructuredGridOutput()->GetCellData()->GetNumberOfArrays());
+ if(MYDEBUG) MESSAGE("myMergeFilter NumberOfComponents="<<myMergeFilter->GetUnstructuredGridOutput()->GetCellData()->GetNumberOfComponents());
+
SetInput(myMergeFilter->GetUnstructuredGridOutput());
if (MYDEBUG) cout << "\tmyMergeFilter->GetOutput()="
aMergeGeoms->Delete();
myOutput = myMergeFilter->GetOutput();
- return myOutput;
}
else
{
VISU_PrsMergerPL* aPrsMerger = dynamic_cast<VISU_PrsMergerPL*>(this->GetScalars());
if(aPrsMerger != NULL){
myOutput = NULL;
- return myOutput;
}
if(aScalarMap != NULL){
SetInput(aScalarMap->GetInput());
vtkDataSet* aOut = aScalarMap->GetOutput();
myOutput = aOut;
- return myOutput;
}
- return myOutput;
}
- else
- return myOutput;
}
-
- return myOutput;
-}
-
-bool
-VISU_PrsMergerPL
-::checkGeometry(const VISU_PipeLine* thePipeLine)
-{
- const VISU::PIDMapper& aMapper = thePipeLine->GetIDMapper();
- int aNbPoints = aMapper->GetVTKOutput()->GetNumberOfPoints();
- if (this->GetNbGeometry() > 0){
- const VISU::PIDMapper& aMapper2 = this->GetGeometry(0)->GetIDMapper();
- int aNbPoints2 = aMapper2->GetVTKOutput()->GetNumberOfPoints();
- if(aNbPoints2 != aNbPoints)
- return false;
- } else if (this->GetScalars()) {
- const VISU::PIDMapper& aMapper2 = this->GetScalars()->GetIDMapper();
- int aNbPoints2 = aMapper2->GetVTKOutput()->GetNumberOfPoints();
- if(aNbPoints2 != aNbPoints)
- return false;
- }
- return true;
-}
-
-bool
-VISU_PrsMergerPL
-::checkScalars(const VISU_PipeLine* thePipeLine)
-{
- const VISU::PIDMapper& aMapper = thePipeLine->GetIDMapper();
- int aNbPoints = aMapper->GetVTKOutput()->GetNumberOfPoints();
- if (this->GetNbGeometry() > 0){
- const VISU::PIDMapper& aMapper2 = this->GetGeometry(0)->GetIDMapper();
- int aNbPoints2 = aMapper2->GetVTKOutput()->GetNumberOfPoints();
- if(aNbPoints2 != aNbPoints)
- return false;
- }
- return true;
}