54 JParser<> zap(
"Example program to test range operations.");
60 catch(
const exception &error) {
61 FATAL(error.what() << endl);
65 const double xmin = -1.0;
66 const double xmax = +1.0;
67 const double dx = (
xmax -
xmin) / 10;
72 typedef JRange<double> JRange_t;
74 JRange_t
A(JRange_t::DEFAULT_RANGE);
77 for (
double x =
xmin;
x <
xmax + 0.5 * dx;
x += dx) {
79 DEBUG(setw(
WIDTH) << left <<
"inside" <<
' ' << B <<
' ' << setw(5) <<
x <<
' ' << (B(
x) ?
"Y" :
"N") << endl);
86 DEBUG(setw(
WIDTH) << left <<
"range" <<
' ' <<
A << endl);
103 typedef JRange<double> JRange_t;
105 const double x1 = -1.0;
106 const double x2 = +0.5;
107 const double x3 = -0.5;
108 const double x4 = +1.0;
113 DEBUG(setw(
WIDTH) << left <<
"join" <<
' ' <<
A <<
' ' << B <<
" = " <<
join(
A,B) << endl);
120 typedef JRange<double> JRange_t;
122 const double x1 = -1.0;
123 const double x2 = -0.5;
124 const double x3 = +0.5;
125 const double x4 = +1.0;
130 DEBUG(setw(
WIDTH) << left <<
"combine" <<
' ' <<
A <<
' ' << B <<
" = " <<
combine(
A,B) << endl);
136 typedef JRange<double> JRange_t;
138 const double x1 = -1.0;
139 const double x2 = -0.5;
140 const double x3 = +0.5;
141 const double x4 = +1.0;
146 DEBUG(setw(
WIDTH) << left <<
"add" <<
' ' <<
A <<
' ' << B <<
" = " <<
A + B << endl);
148 ASSERT((
A + B) == JRange_t(x1+x3,x2+x4));
152 typedef JRange<double> JRange_t;
155 __A__() : value(0.0) {}
156 __A__(
const double value) : value(value) {}
158 double get()
const {
return value; }
165 for (
double x =
xmin; x <
xmax + 0.5 * dx; x += dx) {
172 A.setRange(
make_array(buffer.begin(), buffer.end(), &__A__::value));
175 DEBUG(setw(
WIDTH) << left <<
"setRange" <<
' ' << A << endl);
176 DEBUG(setw(
WIDTH) << left <<
"setRange" <<
' ' << B << endl);
183 typedef JRange<int> JRange_t;
186 JRange_t B(A.getLowerLimit(), A.getLowerLimit());
187 JRange_t
C(A.getUpperLimit(), A.getUpperLimit());
Auxiliary data structure for alignment of data.
Utility class to parse command line options.
T get(const JHead &header)
Get object from header.
static const double C
Physics constants.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
const array_type< JValue_t > & make_array(const JValue_t(&array)[N])
Method to create array of values.
source $JPP_DIR setenv csh $JPP_DIR &dev null eval JShellParser o a A
#define DEBUG(A)
Message macros.