NanoStructures  1.0
DMFT solver for layered, strongly correlated nanostructures
integralAB.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 {
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 (*tIntegralABKernel)(double eps, int nOmega, double omega, std::complex<double> fomegaA, std::complex<double> fomegaB, void * parameters);
24  IntegralAB();
25  IntegralAB(const IntegralAB& orig);
26  IntegralAB& operator=(const IntegralAB& orig);
27  ~IntegralAB();
28 
29  void setBounds(int n, ...);
30  void setIntegralKernels(tIntegralABKernel real, tIntegralABKernel imag) { m_kernelReal = real; m_kernelImag = imag; }
31  void setAccuracy(double abs, double rel) { m_accuracy.absolute = abs; m_accuracy.relative = rel; }
32  void setParameterFunctions(const CFunction& pfA, const CFunction& pfB) { m_parameterFunctionA = &pfA; m_parameterFunctionB = &pfB; }
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  tIntegralABKernel m_kernelReal;
48  tIntegralABKernel m_kernelImag;
49  const CFunction* m_parameterFunctionA;
50  const CFunction* m_parameterFunctionB;
51  gsl_function m_gslIntegrationFunctionReal;
52  gsl_function m_gslIntegrationFunctionImag;
53  Accuracy m_accuracy;
54  gsl_integration_workspace* m_integrationWorkspace;
55  int m_n;
56  void * m_integrationParameters;
57 };
58 }
59 #endif // INTEGRAL_H
Definition: integralAB.h:18
Definition: integralAB.h:13
Discretized complex valued function for real arguments.
The MPI singleton is responsible for data exchange between compute nodes via OpenMPI.
Definition: openmpi.h:35