Added samples
This commit is contained in:
parent
79ac022e34
commit
8b3e4670dd
7 changed files with 170 additions and 1 deletions
30
sample/testInterpolate.cpp
Normal file
30
sample/testInterpolate.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include <iostream>
|
||||
#include "interpolate3d.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace CosmoTool;
|
||||
|
||||
int main()
|
||||
{
|
||||
VectorField<float,2> *vectors = new VectorField<float,2>[8];
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
for (int j = 0; j < 2; j++)
|
||||
for (int k = 0; k < 2; k++)
|
||||
{
|
||||
int idx = i + 2*(j + 2*k);
|
||||
vectors[idx].vec[0] = i;
|
||||
vectors[idx].vec[1] = j;
|
||||
}
|
||||
|
||||
GridSampler<VectorField<float,2> > sampler(vectors, 2, 2, 2, 2);
|
||||
Interpolate3D<GridSampler<VectorField<float,2> > > inter(sampler);
|
||||
|
||||
VectorField<float,2> v = inter.get(0.5,0.5,0.5);
|
||||
VectorField<float,2> v2 = inter.get(1.5,1.5,1.5);
|
||||
|
||||
cout << v.vec[0] << " " << v.vec[1] << endl;
|
||||
cout << v2.vec[0] << " " << v2.vec[1] << endl;
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue