| [8cae4c] | 1 | /*
 | 
|---|
| [1f66c7] | 2 |  * MPQCData_printKeyNames.hpp
 | 
|---|
| [8cae4c] | 3 |  *
 | 
|---|
 | 4 |  *  Created on: 28.07.2012
 | 
|---|
 | 5 |  *      Author: heber
 | 
|---|
 | 6 |  */
 | 
|---|
 | 7 | 
 | 
|---|
| [1f66c7] | 8 | #ifndef MPQCDATA_PRINTKEYNAMES_HPP_
 | 
|---|
 | 9 | #define MPQCDATA_PRINTKEYNAMES_HPP_
 | 
|---|
| [8cae4c] | 10 | 
 | 
|---|
 | 11 | // include config.h
 | 
|---|
 | 12 | #ifdef HAVE_CONFIG_H
 | 
|---|
 | 13 | #include <config.h>
 | 
|---|
 | 14 | #endif
 | 
|---|
 | 15 | 
 | 
|---|
 | 16 | //#include <iosfwd>
 | 
|---|
 | 17 | #include <string>
 | 
|---|
 | 18 | 
 | 
|---|
 | 19 | #include <boost/preprocessor/iteration/local.hpp>
 | 
|---|
 | 20 | #include <boost/preprocessor/seq/elem.hpp>
 | 
|---|
 | 21 | #include <boost/preprocessor/seq/seq.hpp>
 | 
|---|
 | 22 | #include <boost/preprocessor/seq/size.hpp>
 | 
|---|
 | 23 | #include <boost/preprocessor/stringize.hpp>
 | 
|---|
 | 24 | 
 | 
|---|
 | 25 | /** this is the boost::preprocessor::sequence of the keys in the boost::fusion::map
 | 
|---|
 | 26 |  *
 | 
|---|
 | 27 |  * Basically, every key appears here in brackets. If so, then the preprocessor magic
 | 
|---|
 | 28 |  * below will create a template specialization of the printName() function in the
 | 
|---|
| [1f66c7] | 29 |  * namespace printKeyNames.
 | 
|---|
| [8cae4c] | 30 |  */
 | 
|---|
 | 31 | #define tokensequence \
 | 
|---|
 | 32 |   (energy_total) \
 | 
|---|
 | 33 |         (energy_nuclear_repulsion) \
 | 
|---|
| [adccae] | 34 |         (energy_electron_coulomb) \
 | 
|---|
 | 35 |   (energy_electron_exchange) \
 | 
|---|
| [8cae4c] | 36 |         (energy_correlation) \
 | 
|---|
 | 37 |         (energy_overlap) \
 | 
|---|
 | 38 |         (energy_kinetic) \
 | 
|---|
 | 39 |         (energy_hcore) \
 | 
|---|
 | 40 |         (energy_eigenvalues) \
 | 
|---|
 | 41 |         (forces) \
 | 
|---|
| [c37c20] | 42 |         (sampled_grid) \
 | 
|---|
| [4aee30] | 43 |         (times_total_walltime) \
 | 
|---|
 | 44 |         (times_total_cputime) \
 | 
|---|
 | 45 |         (times_total_flops) \
 | 
|---|
 | 46 |   (times_gather_walltime) \
 | 
|---|
 | 47 |   (times_gather_cputime) \
 | 
|---|
 | 48 |   (times_gather_flops)
 | 
|---|
| [8cae4c] | 49 | 
 | 
|---|
 | 50 | /// we take note of the number of keys in tokensequence as (local) loop bounds below
 | 
|---|
 | 51 | #ifndef tokensequence
 | 
|---|
 | 52 | #define MAXTOKENS 0
 | 
|---|
 | 53 | #else
 | 
|---|
 | 54 | #define MAXTOKENS BOOST_PP_SEQ_SIZE(tokensequence)
 | 
|---|
 | 55 | #endif
 | 
|---|
 | 56 | 
 | 
|---|
 | 57 | //!> this is the macro function which prints the specialized template function
 | 
|---|
 | 58 | #define printName_specializer(z, n, NAMESPACE, TOKENSEQ, NAMESEQ ) \
 | 
|---|
 | 59 |   template<> std::string printName< NAMESPACE :: BOOST_PP_SEQ_ELEM( n, TOKENSEQ ) >() { \
 | 
|---|
 | 60 |     return std::string( BOOST_PP_STRINGIZE( BOOST_PP_SEQ_ELEM( n, NAMESEQ ) ) ); \
 | 
|---|
 | 61 |   }
 | 
|---|
 | 62 | 
 | 
|---|
 | 63 | /** Specific namespace for all the specialized template functions that print
 | 
|---|
 | 64 |  * a useful name for each of the boost::fusion::map key.
 | 
|---|
 | 65 |  */
 | 
|---|
| [1f66c7] | 66 | namespace printKeyNames {
 | 
|---|
| [286e36] | 67 |   /* iterate (line-wise) over the sequence and spill out a specialized printName
 | 
|---|
 | 68 |    * for each member in the boost::fusion::map.
 | 
|---|
| [8cae4c] | 69 |    */
 | 
|---|
 | 70 | #if defined tokensequence && defined MAXTOKENS && defined printName_specializer
 | 
|---|
 | 71 | #define BOOST_PP_LOCAL_MACRO(n) printName_specializer(~, n, MPQCDataFused, tokensequence, tokensequence)
 | 
|---|
 | 72 | #define BOOST_PP_LOCAL_LIMITS  (0, MAXTOKENS-1)
 | 
|---|
 | 73 | #include BOOST_PP_LOCAL_ITERATE()
 | 
|---|
 | 74 | #endif
 | 
|---|
 | 75 | 
 | 
|---|
| [1f66c7] | 76 | }; /* namespace printKeyNames */
 | 
|---|
| [8cae4c] | 77 | 
 | 
|---|
 | 78 | #undef tokensequence
 | 
|---|
 | 79 | #undef printName_specializer
 | 
|---|
 | 80 | 
 | 
|---|
 | 81 | #undef MAXTOKENS
 | 
|---|
 | 82 | 
 | 
|---|
| [1f66c7] | 83 | #endif /* MPQCDATA_PRINTKEYNAMES_HPP_ */
 | 
|---|