From 31ecbe79d7406a3b623274cca60ee76eebe74b20 Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Mon, 7 Dec 2009 15:47:36 +0100 Subject: [PATCH] More tests --- sample/testkd2.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sample/testkd2.cpp b/sample/testkd2.cpp index 0688200..375f276 100644 --- a/sample/testkd2.cpp +++ b/sample/testkd2.cpp @@ -2,10 +2,12 @@ #include #include #include +#include +#define __KD_TREE_NUMNODES #include "mykdtree.hpp" #define NTRY 3 -#define ND 2 +#define ND 3 using namespace std; using namespace CosmoTool; @@ -61,6 +63,7 @@ int main() cout << "Check consistency..." << endl; MyCell **ngb = new MyCell *[12]; + ofstream fngb("nearest.txt"); for (int k = 0; k < NTRY; k++) { cout << "Seed = " << xc[k][0] << " " << xc[k][1] << " " << xc[k][2] << endl; tree.getNearestNeighbours(xc[k], 12, ngb); @@ -70,9 +73,9 @@ int main() double d2 = 0; for (int l = 0; l < 3; l++) d2 += ({double delta = xc[k][l] - ngb[i]->coord[l]; delta*delta;}); - cout << ngb[i]->coord[0] << " " << ngb[i]->coord[1] << " " << ngb[i]->coord[2] << " " << sqrt(d2) << endl; + fngb << ngb[i]->coord[0] << " " << ngb[i]->coord[1] << " " << ngb[i]->coord[2] << " " << sqrt(d2) << endl; } } - + return 0; }