Add ADD_ATTRIBUTE macro to atrip

This commit is contained in:
Alejandro Gallo 2021-10-19 13:47:56 +02:00
parent f514b70b4e
commit 2bcffb96f2

View File

@ -2686,6 +2686,13 @@ namespace atrip {
#include <ctf.hpp> #include <ctf.hpp>
#define ADD_ATTRIBUTE(_type, _name, _default) \
_type _name = _default; \
Input& with_ ## _name(_type i) { \
_name = i; \
return *this; \
}
namespace atrip { namespace atrip {
struct Atrip { struct Atrip {
@ -2703,9 +2710,6 @@ namespace atrip {
, *Vhhhp = nullptr , *Vhhhp = nullptr
, *Vppph = nullptr , *Vppph = nullptr
; ;
int maxIterations = 0, iterationMod = -1;
bool barrier = false;
bool chrono = false;
Input& with_epsilon_i(CTF::Tensor<double> * t) { ei = t; return *this; } Input& with_epsilon_i(CTF::Tensor<double> * t) { ei = t; return *this; }
Input& with_epsilon_a(CTF::Tensor<double> * t) { ea = t; return *this; } Input& with_epsilon_a(CTF::Tensor<double> * t) { ea = t; return *this; }
Input& with_Tai(CTF::Tensor<double> * t) { Tph = t; return *this; } Input& with_Tai(CTF::Tensor<double> * t) { Tph = t; return *this; }
@ -2713,10 +2717,19 @@ namespace atrip {
Input& with_Vabij(CTF::Tensor<double> * t) { Vpphh = t; return *this; } Input& with_Vabij(CTF::Tensor<double> * t) { Vpphh = t; return *this; }
Input& with_Vijka(CTF::Tensor<double> * t) { Vhhhp = t; return *this; } Input& with_Vijka(CTF::Tensor<double> * t) { Vhhhp = t; return *this; }
Input& with_Vabci(CTF::Tensor<double> * t) { Vppph = t; return *this; } Input& with_Vabci(CTF::Tensor<double> * t) { Vppph = t; return *this; }
Input& with_maxIterations(int i) { maxIterations = i; return *this; }
Input& with_iterationMod(int i) { iterationMod = i; return *this; } enum TuplesDistribution {
Input& with_barrier(bool i) { barrier = i; return *this; } NAIVE,
Input& with_chrono(bool i) { chrono = i; return *this; } GROUP_AND_SORT,
};
ADD_ATTRIBUTE(bool, chrono, false)
ADD_ATTRIBUTE(bool, barrier, false)
ADD_ATTRIBUTE(int, maxIterations, 0)
ADD_ATTRIBUTE(int, iterationMod, -1)
ADD_ATTRIBUTE(TuplesDistribution, tuplesDistribution, NAIVE)
}; };
struct Output { struct Output {
@ -2726,6 +2739,8 @@ namespace atrip {
}; };
} }
#undef ADD_ATTRIBUTE
#+end_src #+end_src
*** Main *** Main