Example program to test JTOOLS::JMultiMap.
More...
#include <string>
#include <iostream>
#include <iomanip>
#include "JTools/JMultiMap.hh"
#include "JTools/JMap.hh"
#include "JLang/JManip.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
Go to the source code of this file.
|
int | main (int argc, char **argv) |
|
Example program to test JTOOLS::JMultiMap.
- Author
- mdejong
Definition in file JMultiMap.cc.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 20 of file JMultiMap.cc.
28 JParser<> zap(
"Example program to test multi-dimensional map.");
34 catch(
const exception &error) {
35 FATAL(error.what() << endl);
41 const double xmin = -1.0;
42 const double xmax = +1.0;
45 typedef JMAPLIST<JMap,
47 JMap>::maplist JMaplist_t;
49 typedef JMultiMap<double, double, JMaplist_t> JMultimap_t;
53 for (
double x = xmin;
x <= xmax;
x += (xmax - xmin)/(nx - 1)) {
54 for (
double y = xmin; y <= xmax; y += (xmax - xmin)/(nx - 1)) {
55 for (
double z = xmin; z <= xmax; z += (xmax - xmin)/(nx - 1)) {
56 buffer[
x][y][z] =
x*100 + y*10 + z;
61 const JFormat_t format(6, 1, std::ios::fixed);
63 setFormat< JMultiKey<3, const double> >(format);
64 setFormat< JMultiKey<2, const double> >(format);
65 setFormat< JMultiKey<1, const double> >(format);
67 cout <<
"i->[second]*->(first|second)" << endl;
69 for (JMultimap_t::super_const_iterator i = buffer.super_begin(); i != buffer.super_end(); ++i) {
70 cout << format << i->first <<
' '
71 << format << i->second->first <<
' '
72 << format << i->second->second->first <<
' '
73 << format << i->second->second->second << endl;
76 cout <<
"i.getKey() i.getValue()" << endl;
78 for (JMultimap_t::super_const_iterator i = buffer.super_begin(); i != buffer.super_end(); ++i) {
79 cout << i.getKey() <<
' ' << format << i.getValue() << endl;
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object