ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
GlobalSim::ap_int< n_dig, T > Struct Template Reference

#include <ap_int.h>

Collaboration diagram for GlobalSim::ap_int< n_dig, T >:

Public Member Functions

 ap_int ()=default
 
 ap_int (const double d)
 
 operator int () const
 
const ap_int operator+ (const ap_int &f) const
 
const ap_intoperator+= (const ap_int &f)
 
ap_int operator- (const ap_int &f) const
 
const ap_intoperator-= (const ap_int &f)
 
ap_int operator* (const ap_int &f) const
 
const ap_intoperator*= (const ap_int &f)
 
ap_int operator/ (const ap_int &f) const
 
const ap_intoperator/= (const ap_int &f)
 
ap_int operator- () const
 
void test_overflow ()
 

Static Public Member Functions

static ap_int form (T v)
 

Public Attributes

m_value {0}
 
bool m_ovflw {false}
 

Detailed Description

template<std::size_t n_dig, typename T = int16_t>
struct GlobalSim::ap_int< n_dig, T >

Definition at line 21 of file ap_int.h.

Constructor & Destructor Documentation

◆ ap_int() [1/2]

template<std::size_t n_dig, typename T = int16_t>
GlobalSim::ap_int< n_dig, T >::ap_int ( )
default

◆ ap_int() [2/2]

template<std::size_t n_dig, typename T = int16_t>
GlobalSim::ap_int< n_dig, T >::ap_int ( const double  d)
inline

Definition at line 28 of file ap_int.h.

28  {
29  m_value = T(d + (d >= 0 ? 0.5 : -0.5));
30  test_overflow();
31  }

Member Function Documentation

◆ form()

template<std::size_t n_dig, typename T = int16_t>
static ap_int GlobalSim::ap_int< n_dig, T >::form ( v)
inlinestatic

Definition at line 38 of file ap_int.h.

38  {
39  ap_int k; k.m_value = v; k.test_overflow(); return k;
40  }

◆ operator int()

template<std::size_t n_dig, typename T = int16_t>
GlobalSim::ap_int< n_dig, T >::operator int ( ) const
inline

Definition at line 33 of file ap_int.h.

33  {
34  return m_value;
35  }

◆ operator*()

template<std::size_t n_dig, typename T = int16_t>
ap_int GlobalSim::ap_int< n_dig, T >::operator* ( const ap_int< n_dig, T > &  f) const
inline

Definition at line 64 of file ap_int.h.

64  {
65  return form((WS(this->value) * WS(f.m_value)));
66  }

◆ operator*=()

template<std::size_t n_dig, typename T = int16_t>
const ap_int& GlobalSim::ap_int< n_dig, T >::operator*= ( const ap_int< n_dig, T > &  f)
inline

Definition at line 68 of file ap_int.h.

68  {
69  this->m_value -= (WS(this->m_value) * WS(f.m_value));
70  test_overflow();
71  return *this;
72  }

◆ operator+()

template<std::size_t n_dig, typename T = int16_t>
const ap_int GlobalSim::ap_int< n_dig, T >::operator+ ( const ap_int< n_dig, T > &  f) const
inline

Definition at line 42 of file ap_int.h.

42  {
43  return form(this->m_value + f.m_value);
44  }

◆ operator+=()

template<std::size_t n_dig, typename T = int16_t>
const ap_int& GlobalSim::ap_int< n_dig, T >::operator+= ( const ap_int< n_dig, T > &  f)
inline

Definition at line 47 of file ap_int.h.

47  {
48  this->m_value +=f.m_value;
49  test_overflow();
50  return *this;
51  }

◆ operator-() [1/2]

template<std::size_t n_dig, typename T = int16_t>
ap_int GlobalSim::ap_int< n_dig, T >::operator- ( ) const
inline

Definition at line 86 of file ap_int.h.

86  {
87  return form(-this->m_value);
88  }

◆ operator-() [2/2]

template<std::size_t n_dig, typename T = int16_t>
ap_int GlobalSim::ap_int< n_dig, T >::operator- ( const ap_int< n_dig, T > &  f) const
inline

Definition at line 53 of file ap_int.h.

53  {
54  return form(this->m_value - f.m_value);
55  }

◆ operator-=()

template<std::size_t n_dig, typename T = int16_t>
const ap_int& GlobalSim::ap_int< n_dig, T >::operator-= ( const ap_int< n_dig, T > &  f)
inline

Definition at line 58 of file ap_int.h.

58  {
59  this->m_value -= f.m_value;
60  test_overflow();
61  return *this;
62  }

◆ operator/()

template<std::size_t n_dig, typename T = int16_t>
ap_int GlobalSim::ap_int< n_dig, T >::operator/ ( const ap_int< n_dig, T > &  f) const
inline

Definition at line 75 of file ap_int.h.

75  {
76  return form((WS(this->value)) / WS(f.m_value));
77  }

◆ operator/=()

template<std::size_t n_dig, typename T = int16_t>
const ap_int& GlobalSim::ap_int< n_dig, T >::operator/= ( const ap_int< n_dig, T > &  f)
inline

Definition at line 79 of file ap_int.h.

79  {
80  this->m_value /= ((WS(this->m_value)) / WS(f.m_value));
81  test_overflow();
82  return *this;
83  }

◆ test_overflow()

template<std::size_t n_dig, typename T = int16_t>
void GlobalSim::ap_int< n_dig, T >::test_overflow ( )
inline

Definition at line 90 of file ap_int.h.

90  {
91  auto val = m_value >= 0 ? m_value : -m_value;
92 
93  if (val > (1<< n_dig)) {
94  m_ovflw=true;
95  throw std::runtime_error("ap_int overflow " + std::to_string(m_value));
96  }
97  }

Member Data Documentation

◆ m_ovflw

template<std::size_t n_dig, typename T = int16_t>
bool GlobalSim::ap_int< n_dig, T >::m_ovflw {false}

Definition at line 24 of file ap_int.h.

◆ m_value

template<std::size_t n_dig, typename T = int16_t>
T GlobalSim::ap_int< n_dig, T >::m_value {0}

Definition at line 22 of file ap_int.h.


The documentation for this struct was generated from the following file:
hist_file_dump.d
d
Definition: hist_file_dump.py:137
GlobalSim::ap_int::m_ovflw
bool m_ovflw
Definition: ap_int.h:24
athena.value
value
Definition: athena.py:124
hist_file_dump.f
f
Definition: hist_file_dump.py:135
GlobalSim::ap_int::test_overflow
void test_overflow()
Definition: ap_int.h:90
GlobalSim::ap_int::ap_int
ap_int()=default
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
GlobalSim::ap_int::form
static ap_int form(T v)
Definition: ap_int.h:38
python.PyAthena.v
v
Definition: PyAthena.py:154
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
GlobalSim::ap_int::m_value
T m_value
Definition: ap_int.h:22
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
fitman.k
k
Definition: fitman.py:528