[Paraview-developers] good way to wrap different array types?

Mark Olesen Mark.Olesen at esi-group.com
Sat Apr 22 07:39:17 EDT 2017


I was considering some cleanup of the OpenFOAM reader - there are loads of special int32, int64 handling. For example near here:
https://gitlab.kitware.com/vtk/vtk/blob/master/IO/Geometry/vtkOpenFOAMReader.cxx#L5716 ,
which also uses a number of helper functions for retrieving back the correct value from the vtkDataArray.

Since the decision of 32/64-bit input is run-time, I don't see any really elegant means of avoiding explicitly specifying and later checking 32 vs. 64-bit.
What I would like is something along the lines of a wrapped vtkDataArray with additional flag (32/64).
For example,

struct someIntArray : public vtkDataArray
{
bool is64;

// Construct with 32/64?
someIntArray(bool use64Bit)
: is64(use64Bit)
{
   if (use64Bit)
   {
    ... etc
   } 

}

The question is if this approach even makes sense. How the constructor should actually look. Should the constructor use a New, smartpointer, whatever?

Any ideas or comments?

Cheers,
/mark


More information about the Paraview-developers mailing list