33 static double get(
const double R)
51 static double get(
const double R)
69 static double get(
const double R)
83 int main(
int argc,
char **argv)
87 unsigned int numberOfBins;
93 JParser<> zap(
"Example program to test integration of sphere in any number of dimensions.");
101 catch(
const exception &error) {
102 FATAL(error.what() << endl);
110 const double R = 1.0;
112 typedef JGridPolint1Function1D_t JFunction1D_t;
113 typedef JMultipleMap<N-2, JPolint1FunctionalGridMap>::typelist JMaplist_t;
114 typedef JMultiFunction<JFunction1D_t, JMaplist_t> JMultiFunction_t;
117 const JGrid<double> grid(numberOfBins, -R * 1.05, +R * 1.05);
121 gs.configure(make_multigrid<N-2>(grid));
123 for (JMultiFunction_t::super_iterator i = gs.super_begin(); i != gs.super_end(); ++i) {
125 const double x = (*i).getKey().getLength();
127 for (
int __i = 0; __i != grid.getSize(); ++__i) {
129 const double y = grid.getX(__i);
130 const double z = R*R - x*x - y*y;
133 (*i).getValue()[y] = 2.0 * sqrt(z);
135 (*i).getValue()[y] = 0.0;
143 JTimer timer(
"integrator");
151 NOTICE(
"Sphere " << N <<
"D" << endl);
157 ASSERT(fabs(U - W) < precision * U);