Skip to content

Re: Uploading data

#2966
fk
Participant

Hi,

lets assume you have following VTI file:

Quote:
dataFile.vti
Code:
<VTKFile byte_order=”LittleEndian” type=”ImageData” version=”0.1″>
<ImageData Origin=”-0.0014 0.01 0.0040″ Spacing=”0.00004 0.00004 1″ WholeExtent=”0 255 0 255 0 0″>
<Piece Extent=”0 255 0 255 0 0″>
<PointData>
<DataArray Name=”physVelocity” NumberOfComponents=”3″ format=”ascii” type=”Float32″>

You can then use the BlockVTIreader, and the BlockDataF3D, using the properties of the VTI file (filename “dataFile.vti” and DataArray name “physVelocity”):

Code:
BlockVTIreader3D<T,BaseType> readerData(“dataFile.vti”, “physVelocity”);
BlockDataF3D<T,BaseType> velocityF(readerData.getBlockData());

Then use the SpecialAnayticalF functor, for non-uniform grids, or the AnalyticalF functor to interpolate your data:

Code:
AnalyticalF3D<T,T>* solution;
solution = new SpecialAnalyticalFfromBlockF3D<T,BaseType>(velocityF, readerData.getCuboid(), spacing);

Where spacing is a Vector object, with the spacing information of the VTI file.

Code:
// Spacing=”0.00004 0.00004 1″
Vector<T,3> spacing(0.00004, 0.00004, 1);

Best,
Fabian