Imported Healpix, cfitsio, cosmotool. Added cmake tool to build dependencies (cfitsio, hdf5, netcdf, boost, healpix, gsl, ..). Adjusted CMakeLists.txt

This commit is contained in:
Guilhem Lavaux 2012-10-30 14:17:11 -04:00
parent 4bfb62f177
commit 51f6798f88
241 changed files with 243806 additions and 0 deletions

83
external/cosmotool/src/field.hpp vendored Normal file
View file

@ -0,0 +1,83 @@
#ifndef __COSMOTOOL_FIELD
#define __COSMOTOOL_FIELD
#include "config.hpp"
#include <iostream>
#include <cassert>
namespace CosmoTool {
template<typename BaseType>
struct ScalarField
{
BaseType value;
};
template<typename BaseType, int N>
struct VectorField
{
BaseType vec[N];
VectorField& operator=(const VectorField& a)
{
for (int i = 0; i < N; i++)
vec[i] = a.vec[i];
return *this;
}
VectorField()
{
for (int i = 0; i < N; i++)
vec[i] = 0;
}
VectorField(double a)
{
assert(a == 0);
for (int i = 0; i < N; i++)
vec[i] = 0;
}
};
template<typename BaseType, int N>
VectorField<BaseType,N> operator*(BaseType s, const VectorField<BaseType,N>& a)
{
VectorField<BaseType,N> v;
for (int i = 0; i < N; i++)
v.vec[i] = a.vec[i]*s;
return v;
}
template<typename BaseType, int N>
VectorField<BaseType,N> operator+(const VectorField<BaseType,N>& a, const VectorField<BaseType,N>& b)
{
VectorField<BaseType,N> v;
for (int i = 0; i < N; i++)
v.vec[i] = a.vec[i]+b.vec[i];
return v;
}
template<typename BaseType, int N>
VectorField<BaseType,N>& operator+=(VectorField<BaseType,N>& a, const VectorField<BaseType,N>& b)
{
for (int i = 0; i < N; i++)
a.vec[i]+=b.vec[i];
return a;
}
};
template<typename BaseType, int N>
std::ostream& operator<<(std::ostream& s, const CosmoTool::VectorField<BaseType,N>& a)
{
for (int i = 0; i < N; i++)
s << a.vec[i] << " " ;
return s;
}
#endif