43{
   46 
   47  int         numberOfEvents;
   49  double      precision;
   51 
   52  try {
   53 
   54    JParser<> zap(
"Example program to test multi-dimensional interpolation.");
 
   55 
   60 
   61    zap(argc, argv);
   62  }
   63  catch(const exception &error) {
   64    FATAL(error.what() << endl);
 
   65  }
   66 
   67 
   68  const double xmin = -1.0;
 
   69  const double xmax = +1.0;
 
   71 
   72 
   74 
   77 
   79 
   80    
   81  JMultiFunction_t g3;
   82 
   83 
   84  for (
double x = xmin; 
x < 
xmax + 0.5*dx; 
x += dx) {
 
   85    for (
double y = xmin; 
y < 
xmax + 0.5*dx; 
y += dx) {
 
   86      for (
double z = xmin; z < 
xmax + 0.5*dx; z += dx) {
 
   87        g3[
x][
y][z] = 
f3(x,y,z);
 
   88      }
   89    }
   90  }
   91    
   92    
   94  g3.setExceptionHandler(
new JFunction1D_t::JDefaultResult(
JMATH::zero));
 
   95 
   96 
   97  if (numberOfEvents > 0) {
   98 
  100 
  102    
  103    for (int i = 0; i != numberOfEvents; ++i) {
  104      
  105      const double x  = gRandom->Uniform(xmin, xmax);
 
  106      const double y  = gRandom->Uniform(xmin, xmax);
 
  107      const double z  = gRandom->Uniform(xmin, xmax);
  108      
  109      const double v  = 
f3(x,y,z);
 
  110 
  112 
  113      const double w  = g3(x,y,z);
  114 
  116 
  118    }
  119 
  120    if (
debug >= debug_t) {
 
  121 
  123 
  124      timer.
print(cout, 1.0 / numberOfEvents, micro_t);
 
  125    }
  126 
  129 
  130  } else {
  131 
  132    for ( ; ; ) {
  133      
  134      cout << "> " << flush;
  135      
  136      string buffer;
  137      
  138      if (
getline(cin, buffer) && !buffer.empty()) {
 
  139        
  141        
  142        istringstream(buffer) >> 
x >> 
y >> z;
 
  143 
  144        try {
  145          cout << 
f3(x,y,z) << 
' ' << g3(x,y,z) << endl;
 
  146        }
  148          cout << exception << endl;
  149        }
  150 
  151      } else {
  152        break;
  153      }
  154    }
  155  }
  156 
  157  return 0;
  158}
#define ASSERT(A,...)
Assert macro.
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
double f3(const double x, const double y, const double z)
3D function.
 
int numberOfBins
number of bins for average CDF integral of optical module
 
Auxiliary class for CPU timing and usage.
 
void print(std::ostream &out, const JScale_t scale=milli_t) const
Print timer data.
 
Utility class to parse command line options.
 
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
 
static const JZero zero
Function object to assign zero value.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).