NanoStructures  1.0
DMFT solver for layered, strongly correlated nanostructures
integral.h
1 #ifndef INTEGRAL_H
2 #define INTEGRAL_H
3 
4 #include "cfunction.h"
5 
6 #include <gsl/gsl_integration.h>
7 
8 namespace mpi {
9  class OpenMPI;
10 }
11 
12 namespace math {
13 class Integral
14 {
15  typedef void (*tIntegrationErrorHandler)(const char*, const char*, int, int);
16 public:
17  static void integrationErrorHandler(const char * x, const char * y, int a, int b);
18  typedef struct {
19  double absolute;
20  double relative;
21  } Accuracy;
22 public:
23  typedef double (*tIntegralKernel)(double eps, int nOmega, double omega, std::complex<double> fomega, void * parameters);
24  Integral();
25  Integral(const Integral& orig);
26  Integral& operator=(const Integral& orig);
27  ~Integral();
28 
29  void setBounds(int n, ...);
30  void setIntegralKernels(tIntegralKernel real, tIntegralKernel imag) { m_kernelReal = real; m_kernelImag = imag; }
31  void setAccuracy(double abs, double rel) { m_accuracy.absolute = abs; m_accuracy.relative = rel; }
32  void setParameterFunction(const CFunction& pf) { m_parameterFunction = &pf; }
33  void setIntegrationParameters(void * parameters) { m_integrationParameters = parameters; }
34  void setIntegrals(bool real, bool imag) { m_real = real; m_imag = imag; }
35 
36  void operator()(CFunction& result);
37  void operator()(CFunction& result, mpi::OpenMPI& com);
38 protected:
39  static double integrationHelper_real(double eps, void * integral);
40  static double integrationHelper_imag(double eps, void * integral);
41 
42  bool m_real;
43  bool m_imag;
44 
45  double * m_bounds;
46  int m_nBounds;
47  tIntegralKernel m_kernelReal;
48  tIntegralKernel m_kernelImag;
49  const CFunction* m_parameterFunction;
50  gsl_function m_gslIntegrationFunctionReal;
51  gsl_function m_gslIntegrationFunctionImag;
52  Accuracy m_accuracy;
53  gsl_integration_workspace* m_integrationWorkspace;
54  int m_n;
55  void * m_integrationParameters;
56 };
57 }
58 #endif // INTEGRAL_H
Discretized complex valued function for real arguments.
Definition: integral.h:13
The MPI singleton is responsible for data exchange between compute nodes via OpenMPI.
Definition: openmpi.h:35
Definition: integral.h:18