Updated test
This commit is contained in:
parent
f04e7dd41b
commit
a16945bc6b
@ -6,25 +6,26 @@ using namespace CosmoTool;
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
VectorField<float,2> *vectors = new VectorField<float,2>[8];
|
VectorField<float,3> *vectors = new VectorField<float,3>[27];
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
for (int j = 0; j < 2; j++)
|
for (int j = 0; j < 3; j++)
|
||||||
for (int k = 0; k < 2; k++)
|
for (int k = 0; k < 3; k++)
|
||||||
{
|
{
|
||||||
int idx = i + 2*(j + 2*k);
|
int idx = i + 3*(j + 3*k);
|
||||||
vectors[idx].vec[0] = i;
|
vectors[idx].vec[0] = i;
|
||||||
vectors[idx].vec[1] = j;
|
vectors[idx].vec[1] = j;
|
||||||
|
vectors[idx].vec[2] = k;
|
||||||
}
|
}
|
||||||
|
|
||||||
GridSampler<VectorField<float,2> > sampler(vectors, 2, 2, 2, 2);
|
GridSampler<VectorField<float,3> > sampler(vectors, 3, 3, 3, 1);
|
||||||
Interpolate3D<GridSampler<VectorField<float,2> > > inter(sampler);
|
Interpolate3D<GridSampler<VectorField<float,3> > > inter(sampler);
|
||||||
|
|
||||||
VectorField<float,2> v = inter.get(0.5,0.5,0.5);
|
VectorField<float,3> v = inter.get(0.5,0.15,0.5);
|
||||||
VectorField<float,2> v2 = inter.get(1.5,1.5,1.5);
|
VectorField<float,3> v2 = inter.get(1.5,1.65,1.5);
|
||||||
|
|
||||||
cout << v.vec[0] << " " << v.vec[1] << endl;
|
cout << v.vec[0] << " " << v.vec[1] << " " << v.vec[2] << endl;
|
||||||
cout << v2.vec[0] << " " << v2.vec[1] << endl;
|
cout << v2.vec[0] << " " << v2.vec[1] << " " << v2.vec[2] << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ SimuData *CosmoTool::loadGadgetMulti(const char *fname, int id, int loadflags)
|
|||||||
int k = snprintf(0, 0, "%s.%d", fname, id)+1;
|
int k = snprintf(0, 0, "%s.%d", fname, id)+1;
|
||||||
char *out_fname = new char[k];
|
char *out_fname = new char[k];
|
||||||
snprintf(out_fname, k, "%s.%d", fname, id);
|
snprintf(out_fname, k, "%s.%d", fname, id);
|
||||||
|
|
||||||
f = new UnformattedRead(out_fname);
|
f = new UnformattedRead(out_fname);
|
||||||
if (f == 0)
|
if (f == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user