Kindfield
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Friends Pages
Public Member Functions | Protected Attributes | List of all members
HermiteExpansionCoefficient Class Reference

Sets up and solves the recurrence relations for E used in all the integrals. More...

#include <hermiteexpansioncoefficient.h>

Collaboration diagram for HermiteExpansionCoefficient:
Collaboration graph
[legend]

Public Member Functions

 HermiteExpansionCoefficient (int dimension)
 
void reset (int dimension)
 
void set (double a, double b, const Vector3 &A, const Vector3 &B, int iA, int iB, int jA, int jB, int kA, int kB)
 
const cube & operator[] (const uword row) const
 
cube & operator[] (const uword row)
 
void setupE (int iA, int iB, int jA, int jB, int kA, int kB)
 
bool checkIndexCombinationForE (int iA, int iB, int t)
 
double operator() (int iA, int jA, int kA, int iB, int jB, int kB, const uword t, const uword u, const uword v) const
 

Protected Attributes

double m_a
 
double m_b
 
Vector3 m_A
 
Vector3 m_B
 
int m_dimensionMax
 
cube m_E [3]
 
Vector3 m_AB
 
Vector3 m_P
 
Vector3 m_PA
 
Vector3 m_PB
 

Detailed Description

Sets up and solves the recurrence relations for E used in all the integrals.

Definition at line 10 of file hermiteexpansioncoefficient.h.

Constructor & Destructor Documentation

HermiteExpansionCoefficient::HermiteExpansionCoefficient ( int  dimension)
explicit

Definition at line 8 of file hermiteexpansioncoefficient.cpp.

8  :
9  m_a(0),
10  m_b(0),
13 {
14  reset(dimensionMax);
15 }

Member Function Documentation

bool HermiteExpansionCoefficient::checkIndexCombinationForE ( int  iA,
int  iB,
int  t 
)

Definition at line 42 of file hermiteexpansioncoefficient.cpp.

42  {
43  if(t < 0 || t > (iA + iB) || iA < 0 || iB < 0) {
44  return false;
45  } else {
46  return true;
47  }
48 }
double HermiteExpansionCoefficient::operator() ( int  iA,
int  jA,
int  kA,
int  iB,
int  jB,
int  kB,
const uword  t,
const uword  u,
const uword  v 
) const
inline

Definition at line 45 of file hermiteexpansioncoefficient.h.

45  {
46  return m_E[0](iA, iB, t) * m_E[1](jA, jB, u) * m_E[2](kA, kB, v);
47 }
const cube & HermiteExpansionCoefficient::operator[] ( const uword  row) const
inline

Definition at line 36 of file hermiteexpansioncoefficient.h.

36  {
37  return m_E[dimension];
38 }
cube & HermiteExpansionCoefficient::operator[] ( const uword  row)
inline

Definition at line 40 of file hermiteexpansioncoefficient.h.

41 {
42  return const_cast<cube&>(static_cast<const HermiteExpansionCoefficient&>(*this)[row]);
43 }
void HermiteExpansionCoefficient::reset ( int  dimension)

Definition at line 17 of file hermiteexpansioncoefficient.cpp.

18 {
19  m_dimensionMax = dimensionMax;
20  int maxL = m_dimensionMax;
21  int maxiA = m_dimensionMax;
22  int maxiB = m_dimensionMax;
23  // Since we are only going to need E_i_j_0 for the integrals, we cap t to i and j to only have the
24  // needed values available for the algorithm.
25  int maxt = 2 * maxL;
26  for(int dim = 0; dim < 3; dim++) {
27  cube& dim_E = m_E[dim];
28  dim_E = zeros(maxiA, maxiB, maxt + 1);
29  }
30 }
void HermiteExpansionCoefficient::set ( double  a,
double  b,
const Vector3 A,
const Vector3 B,
int  iA,
int  iB,
int  jA,
int  jB,
int  kA,
int  kB 
)

Definition at line 32 of file hermiteexpansioncoefficient.cpp.

34 {
35  m_a = a;
36  m_b = b;
37  m_A = A;
38  m_B = B;
39  setupE(iA, iB, jA, jB, kA, kB);
40 }
void HermiteExpansionCoefficient::setupE ( int  iA,
int  iB,
int  jA,
int  jB,
int  kA,
int  kB 
)

Definition at line 50 of file hermiteexpansioncoefficient.cpp.

50  {
51  int maxiAs[3];
52  maxiAs[0] = iA + 1;
53  maxiAs[1] = jA + 1;
54  maxiAs[2] = kA + 1;
55 
56  int maxiBs[3];
57  maxiBs[0] = iB + 1;
58  maxiBs[1] = jB + 1;
59  maxiBs[2] = kB + 1;
60 
61  // Since we are only going to need E_i_j_0 for the integrals, we cap t to i and j to only have the
62  // needed values available for the algorithm.
63  int maxts[3];
64  maxts[0] = iA + iB + 1;
65  maxts[1] = jA + jB + 1;
66  maxts[2] = kA + kB + 1;
67 
68  double a = m_a;
69  double b = m_b;
70  double p = a + b;
71  double mu = a * b / (a + b);
72  m_AB = m_A - m_B;
73  m_P = (a * m_A + b * m_B) / p;
74  m_PA = m_P - m_A;
75  m_PB = m_P - m_B;
76  for(int dim = 0; dim < 3; dim++) {
77  cube& E = m_E[dim];
78  double AB = m_AB(dim);
79  double PA = m_PA(dim);
80  double PB = m_PB(dim);
81 
82  int maxiA = maxiAs[dim];
83  int maxiB = maxiBs[dim];
84  int maxt = maxts[dim];
85 
86  // First row is special
87  E(0,0,0) = exp(-mu * AB * AB);
88 
89  // Build the first row, iA = 0
90  for(int iB = 0; iB < maxiB; iB++) {
91  for(int t = 0; t < maxt; t++) {
92  int iA = 0;
93  if(iA == 0 && iB == 0 && t == 0) {
94  continue;
95  }
96  // p = previous, n = next
97  // E(t,i,j) = 1 / (2*p) * E(t-1,i,j-1) + XPA * E(t,i,j-1) + (t + 1)*E(t+1,i,j-1)
98  int iBp = iB - 1;
99  int tp = t - 1;
100  int tn = t + 1;
101  double E_iA_iBp_tp = 0;
102  if(checkIndexCombinationForE(iA, iBp, tp)) {
103  E_iA_iBp_tp = E(iA, iBp, tp);
104  }
105  double E_iA_iBp_t = 0;
106  if(checkIndexCombinationForE(iA, iBp, t)) {
107  E_iA_iBp_t = E(iA, iBp, t);
108  }
109  double E_iA_iBp_tn = 0;
110  if(checkIndexCombinationForE(iA, iBp, tn)) {
111  E_iA_iBp_tn = E(iA, iBp, tn);
112  }
113  E(iA,iB,t) = 1 / (2*p) * E_iA_iBp_tp + PB * E_iA_iBp_t + (t + 1)*E_iA_iBp_tn;
114  }
115  }
116 
117  // Iterate over all rows for iA >= 1
118  for(int iA = 1; iA < maxiA; iA++) {
119  for(int iB = 0; iB < maxiB; iB++) {
120  for(int t = 0; t < maxt; t++) {
121  // p = previous, n = next
122  // E(t,i,j) = 1 / (2*p) * E(t-1,i-1,j) + XPA * E(t,i-1,j) + (t + 1)*E(t+1,i-1,j)
123  int iAp = iA - 1;
124  int tp = t - 1;
125  int tn = t + 1;
126  double E_iAp_iB_tp = 0;
127  if(checkIndexCombinationForE(iAp, iB, tp)) {
128  E_iAp_iB_tp = E(iAp, iB, tp);
129  }
130  double E_iAp_iB_t = 0;
131  if(checkIndexCombinationForE(iAp, iB, t)) {
132  E_iAp_iB_t = E(iAp, iB, t);
133  }
134  double E_iAp_iB_tn = 0;
135  if(checkIndexCombinationForE(iAp, iB, tn)) {
136  E_iAp_iB_tn = E(iAp, iB, tn);
137  }
138  E(iA,iB,t) = 1 / (2*p) * E_iAp_iB_tp + PA * E_iAp_iB_t + (t + 1)*E_iAp_iB_tn;
139  }
140  }
141  }
142  }
143 }

Member Data Documentation

double HermiteExpansionCoefficient::m_a
protected

Definition at line 24 of file hermiteexpansioncoefficient.h.

Vector3 HermiteExpansionCoefficient::m_A
protected

Definition at line 26 of file hermiteexpansioncoefficient.h.

Vector3 HermiteExpansionCoefficient::m_AB
protected

Definition at line 30 of file hermiteexpansioncoefficient.h.

double HermiteExpansionCoefficient::m_b
protected

Definition at line 25 of file hermiteexpansioncoefficient.h.

Vector3 HermiteExpansionCoefficient::m_B
protected

Definition at line 27 of file hermiteexpansioncoefficient.h.

int HermiteExpansionCoefficient::m_dimensionMax
protected

Definition at line 28 of file hermiteexpansioncoefficient.h.

cube HermiteExpansionCoefficient::m_E[3]
protected

Definition at line 29 of file hermiteexpansioncoefficient.h.

Vector3 HermiteExpansionCoefficient::m_P
protected

Definition at line 31 of file hermiteexpansioncoefficient.h.

Vector3 HermiteExpansionCoefficient::m_PA
protected

Definition at line 32 of file hermiteexpansioncoefficient.h.

Vector3 HermiteExpansionCoefficient::m_PB
protected

Definition at line 33 of file hermiteexpansioncoefficient.h.


The documentation for this class was generated from the following files: