Hello,
I’m trying to read EnSight Gold data using the VTK library for C++.
Unfortunately I didn’t find any example for this files type, and since my global knowledge in C++ is far from being perfect, I didn’t managed so far to solve my issues by going through the VTK manual…
Here is what I did… and which worked
#include <vtkSmartPointer.h>
#include <vtkGenericEnSightReader.h>#include <vtkProperty.h>
#include <vtkCellCenters.h>int main ( int argc, char *argv )
{
//parse command line arguments
if(argc < 2)
{
std::cerr << “Usage: " << argv[0]
<< " Filename(.case)” << std::endl;
return EXIT_FAILURE;
}std::string filename = argv[1];
//read all the data from the file
vtkSmartPointer reader =
vtkSmartPointer::New();
reader->SetCaseFileName(filename.c_str());
reader->Update();//Check for data content
reader->PrintSelf(std::cout, vtkIndent(2));return EXIT_SUCCESS;
}
My goal would be
- First, to extract the cell center coordinates for each cells (the CellCenter filter might be helpful, but I wasn’t able to push data into it…)
- Go through every scalar and vector data (Cell Data) for every cell, one time step at a time
If needed to better understand my case study, here the case file of my data:
FORMAT
type: ensight goldGEOMETRY
model: square.geoVARIABLE
scalar per element: 1 Pressure square.pressure.*****
vector per element: 1 U1 square.u1.*****TIME
time set: 1
number of steps: 3
filename start number: 1
filename increment: 1
time values:
0
10
20
Thank you very much for your help, I’m tried anything possible for a week but I think I reached the maximum of what I can achieve by myself