Hello,
I am new to VTK. Here is what I need to do:
- Read exodusII file. The exodus file contains spatio-temporal data for multiple scalar variables. Choose a particular scalar variable.
- Apply a threshold filter to the chosen scalar variable and extract the mesh nodes satisfying the threshold condition (along with node connectivities)
- Perform the above steps for another exodus file.
- Perform a boolean intersection of the two thresholded sets of nodes.
- Write the resulting nodes to a vtu/exodus file.
I went through the examples and the doxygen pages, but I can’t find an example doing what I want. I am also getting confused by the different data classes. Could someone please give me some hints for this purpose?
Best regards,
Nikhil
I found some examples which wanted to do similar things and I put together the following code:
#include <vtkActor.h>
#include <vtkCamera.h>
#include <vtkLookupTable.h>
#include <vtkNamedColors.h>
#include <vtkPolyData.h>
#include <vtkPolyDataMapper.h>
#include <vtkPolyhedron.h>
#include <vtkProperty.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkSmartPointer.h>
#include <vtkExodusIIReader.h>
#include <vtkExodusIIWriter.h>
#include <vtkThresholdPoints.h>
#include <vtkMultiBlockDataSet.h>
#include <vtkDataSet.h>
int main (int, char *[])
{
int time_step_begin, time_step_end;
vtkSmartPointer reader = vtkExodusIIReader::New();
reader->SetFileName("/home/2014-0004_focal_therapy/PhDs/AdapTT/Nikhil/DwarfElephant/Dodecahedron/AdvectionDiffusionModel_3D_meshConv_0_out.e");
reader->UpdateInformation();
reader->GetTimeStepRange(time_step_begin, time_step_end);
reader->SetTimeStep(time_step_end);
for (int i = 0 ; i < reader->GetNumberOfObjectArrays(reader->NODAL); i++)
{
std::string nname;
nname = reader->GetObjectArrayName(vtkExodusIIReader::NODAL,i);
if (nname == “ThermalDamage”)
reader->SetObjectArrayStatus(vtkExodusIIReader::NODAL,i,1);
}
vtkSmartPointer threshold = vtkThresholdPoints::New();
threshold->SetInputConnection(reader->GetOutputPort());
threshold->ThresholdByLower(1.0);
threshold->SetInputArrayToProcess(0,0,0,vtkDataObject::FIELD_ASSOCIATION_POINTS,“ThermalDamage”);
threshold->Update();
vtkSmartPointer writer = vtkExodusIIWriter::New();
writer->SetFileName(“FinalLesion.e”);
writer->SetInputData(threshold->GetOutput());
writer->WriteAllTimeStepsOn();
writer->Write();
return EXIT_SUCCESS;
}
When I run the code I get the following error message:
vtkExodusIIWriter (0x9964c0): No input provided!
How should I give input to the exodusII writer?
Best
Nikhil