Added samples
This commit is contained in:
parent
79ac022e34
commit
8b3e4670dd
7 changed files with 170 additions and 1 deletions
28
sample/testDelaunay.cpp
Normal file
28
sample/testDelaunay.cpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
#include <iostream>
|
||||
#include "dinterpolate.hpp"
|
||||
|
||||
#define NX 10
|
||||
#define NY 10
|
||||
|
||||
using namespace std;
|
||||
using namespace CosmoTool;
|
||||
|
||||
typedef DelaunayInterpolate<double,double,2> myTriangle;
|
||||
|
||||
int main()
|
||||
{
|
||||
myTriangle::CoordType pos[] = { {0,0}, {1,0}, {0,1}, {1, 1} } ;
|
||||
double vals[] = { 0, 1, 1, 0 };
|
||||
uint32_t simplex[] = { 0, 1, 2, 3, 1, 2 };
|
||||
|
||||
myTriangle t(&pos[0], &vals[0], &simplex[0], 4, 2);
|
||||
|
||||
for (uint32_t iy = 0; iy <= NY; iy++) {
|
||||
for (uint32_t ix = 0; ix <= NX; ix++) {
|
||||
myTriangle::CoordType inter = { ix *1.0/ NX, iy *1.0/NY };
|
||||
cout << inter[1] << " " << inter[0] << " " << t.computeValue(inter) << endl;
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue