1#ifndef AMPGEN_INTEGRATOR_H
2#define AMPGEN_INTEGRATOR_H
24 QueuedIntegral() =
default;
25 QueuedIntegral(
complex_t* result,
const unsigned& i,
const unsigned& j)
26 : result(result), i(i), j(j) {}
34 template <
typename EventList_type,
typename T>
Integrator(
const EventList_type*
events,
const std::vector<T>& expressions ={}) : m_events(
events)
37 WARNING(
"No events specified, returning");
40 m_cache.allocate(
events, expressions);
41 m_weight.resize(
events->nBlocks() );
43 for(
size_t i = 0 ; i < events->nBlocks(); ++i )
46 norm_acc += m_weight[i];
55 template <
class return_type> return_type
get(
const unsigned& index,
const unsigned& evt )
const ;
56 template <
class T>
unsigned getCacheIndex(
const T& t )
const {
return m_cache.find(t.name())[0] ; }
57 double norm()
const {
return m_norm; }
59 template <
class T>
void updateCache(
const T& expression){
if(
isReady() ) m_cache.update(expression); }
60 template <
class T>
const T*
events()
const {
return static_cast<const T*
>(m_events); }
62 const auto&
cache()
const {
return m_cache; }
64 static constexpr size_t N = {8};
65 size_t m_counter = {0};
66 std::array<QueuedIntegral, N> m_integrals;
67 const void* m_events = {
nullptr};
68 std::vector<real_v> m_weight;
69 FunctionCache<EventList_t, complex_v, Alignment::SoA> m_cache;
71 void integrateBlock();
79 std::vector<complex_t> norms;
80 std::vector<bool> markAsZero;
81 std::vector<bool> calculate;
83 Bilinears(
const size_t& r = 0,
const size_t& c = 0 );
85 complex_t get(
const size_t& x,
const size_t& y,
Integrator* integ =
nullptr,
const size_t& kx=0,
const size_t& ky=0){
86 if( integ !=
nullptr ) integ->queueIntegral(&norms[x*cols+y], kx, ky );
88 return norms[x*cols+y];
91 void setZero(
const size_t& x,
const size_t& y);
94 bool isZero(
const size_t& x,
const size_t& y);
95 bool workToDo(
const size_t& x,
const size_t& y)
const;
96 void resize(
const size_t& r,
const size_t& c = 1 );
Bilinears(const size_t &r=0, const size_t &c=0)
bool workToDo(const size_t &x, const size_t &y) const
void resetCalculateFlags()
complex_t get(const size_t &x, const size_t &y) const
complex_t & operator()(const size_t &x, const size_t &y)
void resize(const size_t &r, const size_t &c=1)
void set(const size_t &x, const size_t &y, const complex_t &f)
void setZero(const size_t &x, const size_t &y)
complex_t get(const size_t &x, const size_t &y, Integrator *integ=nullptr, const size_t &kx=0, const size_t &ky=0)
bool isZero(const size_t &x, const size_t &y)
unsigned getCacheIndex(const T &t) const
return_type get(const unsigned &index, const unsigned &evt) const
void updateCache(const T &expression)
Integrator(const EventList_type *events, const std::vector< T > &expressions={})
const auto & cache() const
void queueIntegral(complex_t *result, const unsigned &i, const unsigned &j)
#define WARNING(X)
Used for printing warning messages, can be switched off using WARNINGLEVEL.
auto sum_elements(const simd_type &obj)
std::complex< real_t > complex_t