SpinParser  1.0
SU2VertexSingleParticle.hpp
Go to the documentation of this file.
1 
9 #pragma once
10 #include <istream>
11 #include "lib/Assert.hpp"
12 #include "FrgCommon.hpp"
13 
18 {
19 public:
24  {
25  //set size
27 
28  //alloc and init memory
29  _data = new float[size];
30  for (int i = 0; i < size; ++i) _data[i] = 0.0f;
31  }
32 
37  {
38  delete[] _data;
39  }
40 
47  void expandIterator(const int iterator, float &w) const
48  {
49  ASSERT(iterator >= 0 && iterator < size);
50 
51  w = FrgCommon::frequency()._data[iterator];
52  }
53 
60  float &getValueRef(const int iterator) const
61  {
62  ASSERT(iterator >= 0 && iterator < size);
63 
64  return _data[iterator];
65  }
66 
73  float getValue(float w) const
74  {
75  int lower, upper;
76  float bias;
77  float sign = 1.0f;
78 
79  if (w < 0)
80  {
81  w = -w;
82  sign = -1.0f;
83  }
84 
85  FrgCommon::frequency().interpolateOffset(w, lower, upper, bias);
86  return sign * ((1 - bias) * _directAccess(lower) + bias * _directAccess(upper));
87  }
88 
95  float &_directAccess(const int wOffset) const
96  {
97  ASSERT(wOffset >= 0 && wOffset < FrgCommon::frequency().size);
98 
99  return _data[wOffset];
100  }
101 
102  int size;
103  float *_data;
104 };
ASSERT
#define ASSERT(...)
Ensure that the first argument is true. Optionally provide a message as the second argument,...
Definition: Assert.hpp:26
FrgCommon::frequency
static const FrequencyDiscretization & frequency()
Retrieve the Matsubara frequency discretization.
Definition: FrgCommon.hpp:36
SU2VertexSingleParticle::_directAccess
float & _directAccess(const int wOffset) const
Access vertex value at given frequency mesh point.
Definition: SU2VertexSingleParticle.hpp:95
FrgCommon.hpp
Hub for central objects in pf-FRG calculations.
SU2VertexSingleParticle::SU2VertexSingleParticle
SU2VertexSingleParticle()
Construct a new SU2VertexSingleParticle object and initialize all values to zero.
Definition: SU2VertexSingleParticle.hpp:23
SU2VertexSingleParticle::~SU2VertexSingleParticle
~SU2VertexSingleParticle()
Destroy the SU2VertexSingleParticle object.
Definition: SU2VertexSingleParticle.hpp:36
FrequencyDiscretization::interpolateOffset
void interpolateOffset(const float w, int &lowerOffset, int &upperOffset, float &bias) const
Perform an interpolation between mesh points for an arbitrary positive frequency.
Definition: FrequencyDiscretization.hpp:326
SU2VertexSingleParticle::_data
float * _data
Vertex data.
Definition: SU2VertexSingleParticle.hpp:103
FrequencyDiscretization::_data
float * _data
Pointer to the first positive mesh point. Stored contiuously after FrequencyDiscretization::_dataNega...
Definition: FrequencyDiscretization.hpp:357
Assert.hpp
Lightweight macro library for assertions.
SU2VertexSingleParticle::size
int size
Total number of vertex elements.
Definition: SU2VertexSingleParticle.hpp:102
SU2VertexSingleParticle::getValueRef
float & getValueRef(const int iterator) const
Directly access a vertex value by reference via a linear iterator in the range [0,...
Definition: SU2VertexSingleParticle.hpp:60
SU2VertexSingleParticle::expandIterator
void expandIterator(const int iterator, float &w) const
Expand a linear iterator in the range [0,SU2VertexSingleParticle::size).
Definition: SU2VertexSingleParticle.hpp:47
FrequencyDiscretization::size
int size
Number of positive mesh points.
Definition: FrequencyDiscretization.hpp:356
SU2VertexSingleParticle::getValue
float getValue(float w) const
Access vertex value at arbitrary frequency value by performing a linear interpolation on the Frequenc...
Definition: SU2VertexSingleParticle.hpp:73
SU2VertexSingleParticle
Single-particle vertex implementation for SU(2) models.
Definition: SU2VertexSingleParticle.hpp:17