# How to interpolate array data using gauss points (quadrature)

**URL:** https://discourse.vtk.org/t/how-to-interpolate-array-data-using-gauss-points-quadrature/7765
**Category:** Support
**Created:** [February 3, 2022, 1:02pm UTC](https://discourse.vtk.org/t/how-to-interpolate-array-data-using-gauss-points-quadrature/7765 "2022-02-03T13:02:11Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Sagues](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/a88e4f/32.png) [@Sagues](https://discourse.vtk.org/u/Sagues)
#### Post date: [February 3, 2022, 1:02pm UTC](https://discourse.vtk.org/t/how-to-interpolate-array-data-using-gauss-points-quadrature/7765/1 "2022-02-03T13:02:11Z")

</div>

I need to interpolate a result (stress) using gauss points.  
I understand that I should use Quadrature Scheme.

I’ve created a quadrature definition:

```auto

vtkNew gauss_points_triangle;
gauss_points_triangle->Initialize(VTK_TRIANGLE, 3, 3, Ngauss3, Wi);

```

where 3 is the number of nodes, 3 the number of quadrature points, Ngauss is an array with the shape functions of each gauss points (dimension=9), Wi is the quadrature weights (dimension 3).

Afterwards I create an offset:

```auto
vtkDataArray* offsets = layer->GetOffsetsArray();

```

Afterwards I create my array with stress results (my unstructured grid contains 2 triangles):

```auto
vtkNew Stress_si;
Stress_si->SetNumberOfComponents(1);
Stress_si->SetName(“Stress Si”);
Stress_si->InsertNextValue(1385);
Stress_si->InsertNextValue(1385);
Stress_si->InsertNextValue(847);
Stress_si->InsertNextValue(1385);
Stress_si->InsertNextValue(1385);
Stress_si->InsertNextValue(847);

```

Afterwards I connect the quadrature scheme with Stress array:

```auto
auto* key = vtkQuadratureSchemeDefinition::DICTIONARY();
key->Append(Stress_si->GetInformation(),gauss_points_triangle);
Stress_si->GetInformation()->Set(vtkQuadratureSchemeDefinition::QUADRATURE_OFFSET_ARRAY_NAME(), offsets->GetName());

```

Afterwards I add stress array into unstructured grid.

```auto
ug->GetCellData()->AddArray(Stress_si);

```

I think that the vtu file is correct:  
[example\_vtk.vtu](https://discourse.paraview.org/uploads/short-url/w8ME3YjzgxSmtP4Wfm4gz9x2FSe.vtu) (2.4 KB)

However when I open this file in paraview I do not know how can I show my stresses interpolated.
