23 int main(
int argc,
char **argv)
27 unsigned int numberOfBins;
32 JParser<> zap(
"Example program to test 3D integration of sphere.");
39 catch(
const exception &error) {
40 FATAL(error.what() << endl);
49 typedef JGridPolint3Function1D_t JFunction1D_t;
50 typedef JMapList<JPolint3FunctionalGridMap> JMaplist_t;
51 typedef JMultiFunction<JFunction1D_t, JMaplist_t> JMultiFunction_t;
57 const double xmin = -R * 1.05;
58 const double xmax = +R * 1.05;
59 const double dx = (xmax - xmin) / (numberOfBins - 1);
61 for (
double x = xmin; x < xmax + 0.5*dx; x += dx) {
62 for (
double y = xmin; y < xmax + 0.5*dx; y += dx) {
64 const double z = R*R - x*x - y*y;
79 cout <<
"Volume (real) " <<
SCIENTIFIC(12,4) << 4.0*
PI*R*R*R/3.0 << endl;