Skip to content

Commit

Permalink
Fixed UnknownType in ParaView
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-tierny committed Jul 2, 2018
1 parent eb49719 commit 7d8c6a5
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 85 deletions.
6 changes: 3 additions & 3 deletions core/vtk/ttkFiberSurface/ttkFiberSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ int ttkFiberSurface::doIt(vector<vtkDataSet *> &inputs,
}

if(!((input->GetDataObjectType() == VTK_UNSTRUCTURED_GRID)
||(input->GetDataObjectType() == TTK_UNSTRUCTURED_GRID)
||(input->GetDataObjectType() == VTK_IMAGE_DATA)
||(input->GetDataObjectType() == TTK_IMAGE_DATA))){
// ||(input->GetDataObjectType() == TTK_UNSTRUCTURED_GRID)
||(input->GetDataObjectType() == VTK_IMAGE_DATA))){
// ||(input->GetDataObjectType() == TTK_IMAGE_DATA))){
stringstream msg;
msg << "[ttkFiberSurface] Error5: Unsupported VTK data-structure ("
<< input->GetDataObjectType() << ")" << endl;
Expand Down
14 changes: 7 additions & 7 deletions core/vtk/ttkProgramBase/ttkProgramBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,20 @@ int ttkProgramBase::save() const{

if(vtkWrapper_->GetOutput(i)){

if((vtkWrapper_->GetOutput(i)->GetDataObjectType() == VTK_IMAGE_DATA)
||(vtkWrapper_->GetOutput(i)->GetDataObjectType() == TTK_IMAGE_DATA)){
if((vtkWrapper_->GetOutput(i)->GetDataObjectType() == VTK_IMAGE_DATA)){
// ||(vtkWrapper_->GetOutput(i)->GetDataObjectType() == TTK_IMAGE_DATA)){
save<vtkXMLImageDataWriter>(i);
}

if((vtkWrapper_->GetOutput(i)->GetDataObjectType() == VTK_POLY_DATA)
||(vtkWrapper_->GetOutput(i)->GetDataObjectType() == TTK_POLY_DATA)){
if((vtkWrapper_->GetOutput(i)->GetDataObjectType() == VTK_POLY_DATA)){
// ||(vtkWrapper_->GetOutput(i)->GetDataObjectType() == TTK_POLY_DATA)){
save<vtkXMLPolyDataWriter>(i);
}

if((vtkWrapper_->GetOutput(i)->GetDataObjectType()
== VTK_UNSTRUCTURED_GRID)
||(vtkWrapper_->GetOutput(i)->GetDataObjectType() ==
TTK_UNSTRUCTURED_GRID)){
== VTK_UNSTRUCTURED_GRID)){
// ||(vtkWrapper_->GetOutput(i)->GetDataObjectType() ==
// TTK_UNSTRUCTURED_GRID)){
save<vtkXMLUnstructuredGridWriter>(i);
}
}
Expand Down
18 changes: 9 additions & 9 deletions core/vtk/ttkProgramBase/ttkProgramBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,23 +127,23 @@ template <class vtkWriterClass>
std::string extension;

if((vtkWrapper_->GetOutput(outputPortId)->GetDataObjectType()
== VTK_IMAGE_DATA)
||(vtkWrapper_->GetOutput(outputPortId)->GetDataObjectType()
== TTK_IMAGE_DATA)){
== VTK_IMAGE_DATA)){
// ||(vtkWrapper_->GetOutput(outputPortId)->GetDataObjectType()
// == TTK_IMAGE_DATA)){
extension = "vti";
}

if((vtkWrapper_->GetOutput(outputPortId)->GetDataObjectType()
== VTK_POLY_DATA)
||(vtkWrapper_->GetOutput(outputPortId)->GetDataObjectType()
== TTK_POLY_DATA)){
== VTK_POLY_DATA)){
// ||(vtkWrapper_->GetOutput(outputPortId)->GetDataObjectType()
// == TTK_POLY_DATA)){
extension = "vtp";
}

if((vtkWrapper_->GetOutput(outputPortId)->GetDataObjectType()
== VTK_UNSTRUCTURED_GRID)
||(vtkWrapper_->GetOutput(outputPortId)->GetDataObjectType()
== TTK_UNSTRUCTURED_GRID)){
== VTK_UNSTRUCTURED_GRID)){
// ||(vtkWrapper_->GetOutput(outputPortId)->GetDataObjectType()
// == TTK_UNSTRUCTURED_GRID)){
extension = "vtu";
}

Expand Down
79 changes: 25 additions & 54 deletions core/vtk/ttkTriangulation/ttkTriangulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,13 @@ int ttkTriangulation::deepCopy(vtkDataObject *other){

allocate();

if(other->GetDataObjectType() == TTK_UNSTRUCTURED_GRID){
// copy the triangulation object from the other
(*triangulation_) =
*(((ttkUnstructuredGrid *) other)->triangulation_);
}
else if(other->GetDataObjectType() == TTK_IMAGE_DATA){
// copy the triangulation object from the other
(*triangulation_) =
*(((ttkImageData *) other)->triangulation_);
}
else if(other->GetDataObjectType() == TTK_POLY_DATA){
ttkTriangulation *otherTriangulation =
dynamic_cast<ttkTriangulation *>(other);

if(otherTriangulation){
// the other object has already been enhanced
// copy the triangulation object from the other
(*triangulation_) =
*(((ttkPolyData *) other)->triangulation_);
(*triangulation_) = *(otherTriangulation->triangulation_);
}

// populate the data-structure
Expand All @@ -66,17 +59,11 @@ Triangulation* ttkTriangulation::getTriangulation(vtkDataSet *other){

string dataType = other->GetClassName();

if((dataType == "ttkUnstructuredGrid")
||(dataType == "vtkUnstructuredGrid")){
return ((ttkUnstructuredGrid *) other)->getTriangulation();
}
else if((dataType == "ttkImageData")
||(dataType == "vtkImageData")){
return ((ttkImageData *) other)->getTriangulation();
}
else if((dataType == "ttkPolyData")
||(dataType == "vtkPolyData")){
return ((ttkPolyData *) other)->getTriangulation();
ttkTriangulation *otherTriangulation =
dynamic_cast<ttkTriangulation *>(other);

if(otherTriangulation){
return otherTriangulation->getTriangulation();
}
else{
Debug d;
Expand All @@ -96,9 +83,7 @@ vtkUnstructuredGrid* ttkTriangulation::getVtkUnstructuredGrid(){
return NULL;

if((inputDataSet_->GetDataObjectType() == VTK_IMAGE_DATA)
||(inputDataSet_->GetDataObjectType() == TTK_IMAGE_DATA)
||(inputDataSet_->GetDataObjectType() == VTK_POLY_DATA)
||(inputDataSet_->GetDataObjectType() == TTK_POLY_DATA)){
||(inputDataSet_->GetDataObjectType() == VTK_POLY_DATA)){

Timer t;

Expand Down Expand Up @@ -144,8 +129,7 @@ vtkUnstructuredGrid* ttkTriangulation::getVtkUnstructuredGrid(){
dMsg(cout, msg.str(), timeMsg);
}
}
else if((inputDataSet_->GetDataObjectType() == VTK_UNSTRUCTURED_GRID)
||(inputDataSet_->GetDataObjectType() == TTK_UNSTRUCTURED_GRID)){
else if((inputDataSet_->GetDataObjectType() == VTK_UNSTRUCTURED_GRID)){
return vtkUnstructuredGrid::SafeDownCast(inputDataSet_);
}
else{
Expand Down Expand Up @@ -175,18 +159,15 @@ bool ttkTriangulation::hasChangedConnectivity(
return false;
#endif

if((dataSet->GetDataObjectType() == VTK_UNSTRUCTURED_GRID)
||(dataSet->GetDataObjectType() == TTK_UNSTRUCTURED_GRID)){
if((dataSet->GetDataObjectType() == VTK_UNSTRUCTURED_GRID)){
return (((vtkUnstructuredGrid *) dataSet)->GetCells()->GetMTime()
> callingObject->GetMTime());
}
else if((dataSet->GetDataObjectType() == VTK_POLY_DATA)
||(dataSet->GetDataObjectType() == TTK_POLY_DATA)){
else if((dataSet->GetDataObjectType() == VTK_POLY_DATA)){
return (((vtkPolyData *) dataSet)->GetPolys()->GetMTime()
> callingObject->GetMTime());
}
else if((dataSet->GetDataObjectType() == VTK_IMAGE_DATA)
||(dataSet->GetDataObjectType() == TTK_IMAGE_DATA)){
else if((dataSet->GetDataObjectType() == VTK_IMAGE_DATA)){

int vtkDimensions[3];
vector<int> ttkDimensions;
Expand Down Expand Up @@ -216,8 +197,7 @@ int ttkTriangulation::setInputData(vtkDataSet* dataSet){
allocate();
}

if((dataSet->GetDataObjectType() == VTK_UNSTRUCTURED_GRID)
||(dataSet->GetDataObjectType() == TTK_UNSTRUCTURED_GRID)){
if((dataSet->GetDataObjectType() == VTK_UNSTRUCTURED_GRID)){

if(((vtkUnstructuredGrid *) dataSet)->GetPoints()){
if(((vtkUnstructuredGrid *) dataSet)->GetPoints()->GetDataType()
Expand Down Expand Up @@ -251,8 +231,7 @@ int ttkTriangulation::setInputData(vtkDataSet* dataSet){
}
inputDataSet_ = dataSet;
}
else if((dataSet->GetDataObjectType() == VTK_POLY_DATA)
||(dataSet->GetDataObjectType() == TTK_POLY_DATA)){
else if((dataSet->GetDataObjectType() == VTK_POLY_DATA)){

if(((vtkPolyData *) dataSet)->GetPoints()){
if(((vtkPolyData *) dataSet)->GetPoints()->GetDataType()
Expand Down Expand Up @@ -289,8 +268,7 @@ int ttkTriangulation::setInputData(vtkDataSet* dataSet){
}
inputDataSet_ = dataSet;
}
else if((dataSet->GetDataObjectType() == VTK_IMAGE_DATA)
||(dataSet->GetDataObjectType() == TTK_IMAGE_DATA)){
else if((dataSet->GetDataObjectType() == VTK_IMAGE_DATA)){
vtkImageData *imageData = (vtkImageData *) dataSet;

int extents[6];
Expand Down Expand Up @@ -337,19 +315,12 @@ int ttkTriangulation::shallowCopy(vtkDataObject *other){
triangulation_ = NULL;

if((other)&&(((vtkDataSet *) other)->GetNumberOfPoints())){
if(other->GetDataObjectType() == TTK_UNSTRUCTURED_GRID){
triangulation_ =
((ttkUnstructuredGrid *) other)->triangulation_;
hasAllocated_ = false;
}
else if(other->GetDataObjectType() == TTK_IMAGE_DATA){
triangulation_ =
((ttkImageData *) other)->triangulation_;
hasAllocated_ = false;
}
else if(other->GetDataObjectType() == TTK_POLY_DATA){
triangulation_ =
((ttkPolyData *) other)->triangulation_;

ttkTriangulation *otherTriangulation =
dynamic_cast<ttkTriangulation *>(other);

if(otherTriangulation){
triangulation_ = otherTriangulation->triangulation_;
hasAllocated_ = false;
}
else{
Expand Down
12 changes: 0 additions & 12 deletions core/vtk/ttkTriangulation/ttkTriangulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@ class ttkTriangulation : public ttk::Debug {
} \
public:\

#define TTK_UNSTRUCTURED_GRID (INT_MAX - VTK_UNSTRUCTURED_GRID)

#ifndef TTK_PLUGIN
class VTKCOMMONDATAMODEL_EXPORT ttkUnstructuredGrid :
#else
Expand All @@ -216,8 +214,6 @@ class ttkUnstructuredGrid :

void DeepCopy(vtkDataObject *other);

int GetDataObjectType(){return TTK_UNSTRUCTURED_GRID;};

void ShallowCopy(vtkDataObject *other);

protected:
Expand All @@ -228,8 +224,6 @@ class ttkUnstructuredGrid :

};

#define TTK_IMAGE_DATA (INT_MAX - VTK_IMAGE_DATA)

#ifndef TTK_PLUGIN
class VTKCOMMONDATAMODEL_EXPORT ttkImageData :
#else
Expand All @@ -246,8 +240,6 @@ class ttkImageData :

void DeepCopy(vtkDataObject *other);

int GetDataObjectType(){return TTK_IMAGE_DATA;};

void ShallowCopy(vtkDataObject *other);

protected:
Expand All @@ -258,8 +250,6 @@ class ttkImageData :

};

#define TTK_POLY_DATA (INT_MAX - VTK_POLY_DATA)

#ifndef TTK_PLUGIN
class VTKCOMMONDATAMODEL_EXPORT ttkPolyData :
#else
Expand All @@ -276,8 +266,6 @@ class ttkPolyData :

void DeepCopy(vtkDataObject *other);

int GetDataObjectType(){return TTK_POLY_DATA;};

void ShallowCopy(vtkDataObject *other);

protected:
Expand Down

0 comments on commit 7d8c6a5

Please sign in to comment.