Main Page Class Hierarchy Compound List File List Compound Members Related Pages

# osshftmpl.h

    00001
    00002 namespace sc {
    00003
    00004 class LocalOSSContribution {
    00005   private:
    00006     double * const gmat;
    00007     double * const gmata;
    00008     double * const gmatb;
    00009
    00010     double * const pmat;
    00011     double * const pmata;
    00012     double * const pmatb;
    00013   public:
    00014     LocalOSSContribution(double *g, double *p, double *ga, double *pa,
    00015                          double *gb, double *pb) :
    00016       gmat(g), gmata(ga), gmatb(gb), pmat(p), pmata(pa), pmatb(pb) {}
    00017     ~LocalOSSContribution() {}
    00018
    00019     void set_bound(double,double) {}
    00020
    00021     inline void cont1(int ij, int kl, double val) {
    00022       gmat[ij] += val*pmat[kl];
    00023       gmat[kl] += val*pmat[ij];
    00024     }
    00025
    00026     inline void cont2(int ij, int kl, double val) {
    00027       val *= 0.25;
    00028       gmat[ij] -= val*pmat[kl];
    00029       gmat[kl] -= val*pmat[ij];
    00030
    00031       gmata[ij] += val*pmata[kl];
    00032       gmata[kl] += val*pmata[ij];
    00033
    00034       gmatb[ij] += val*pmatb[kl];
    00035       gmatb[kl] += val*pmatb[ij];
    00036
    00037       val *= -3.0;
    00038       gmatb[ij] += val*pmata[kl];
    00039       gmatb[kl] += val*pmata[ij];
    00040
    00041       gmata[ij] += val*pmatb[kl];
    00042       gmata[kl] += val*pmatb[ij];
    00043     }
    00044
    00045     inline void cont3(int ij, int kl, double val) {
    00046       val *= 0.5;
    00047       gmat[ij] -= val*pmat[kl];
    00048       gmat[kl] -= val*pmat[ij];
    00049
    00050       gmata[ij] += val*pmata[kl];
    00051       gmata[kl] += val*pmata[ij];
    00052
    00053       gmatb[ij] += val*pmatb[kl];
    00054       gmatb[kl] += val*pmatb[ij];
    00055
    00056       val *= -3.0;
    00057       gmata[ij] += val*pmatb[kl];
    00058       gmata[kl] += val*pmatb[ij];
    00059
    00060       gmatb[ij] += val*pmata[kl];
    00061       gmatb[kl] += val*pmata[ij];
    00062     }
    00063
    00064     inline void cont4(int ij, int kl, double val) {
    00065       gmat[ij] += 0.75*val*pmat[kl];
    00066       gmat[kl] += 0.75*val*pmat[ij];
    00067
    00068       gmata[ij] += 0.25*val*pmata[kl];
    00069       gmata[kl] += 0.25*val*pmata[ij];
    00070
    00071       gmatb[ij] += 0.25*val*pmatb[kl];
    00072       gmatb[kl] += 0.25*val*pmatb[ij];
    00073
    00074       gmata[ij] -= 0.75*val*pmatb[kl];
    00075       gmata[kl] -= 0.75*val*pmatb[ij];
    00076
    00077       gmatb[ij] -= 0.75*val*pmata[kl];
    00078       gmatb[kl] -= 0.75*val*pmata[ij];
    00079     }
    00080
    00081     inline void cont5(int ij, int kl, double val) {
    00082       val *= 0.5;
    00083       gmat[ij] += val*pmat[kl];
    00084       gmat[kl] += val*pmat[ij];
    00085
    00086       gmata[ij] += val*pmata[kl];
    00087       gmata[kl] += val*pmata[ij];
    00088
    00089       gmatb[ij] += val*pmatb[kl];
    00090       gmatb[kl] += val*pmatb[ij];
    00091
    00092       val *= -3.0;
    00093       gmata[ij] += val*pmatb[kl];
    00094       gmata[kl] += val*pmatb[ij];
    00095
    00096       gmatb[ij] += val*pmata[kl];
    00097       gmatb[kl] += val*pmata[ij];
    00098     }
    00099 };
    00100
    00101 class LocalOSSEnergyContribution {
    00102   private:
    00103     double * const pmat;
    00104     double * const pmata;
    00105     double * const pmatb;
    00106
    00107   public:
    00108     double ec;
    00109     double ex;
    00110
    00111     void set_bound(double,double) {};
    00112
    00113     LocalOSSEnergyContribution(double *p, double *pa, double *pb) :
    00114       pmat(p), pmata(pa), pmatb(pb) {
    00115       ec=ex=0;
    00116     }
    00117     ~LocalOSSEnergyContribution() {}
    00118
    00119     inline void cont1(int ij, int kl, double val) {
    00120       ec += val*pmat[ij]*pmat[kl];
    00121     }
    00122
    00123     inline void cont2(int ij, int kl, double val) {
    00124       ex -= 0.25*val*(pmat[ij]*pmat[kl] + pmata[ij]*pmata[kl] +
    00125                       pmatb[ij]*pmatb[kl]);
    00126       ex += 0.75*val*(pmata[ij]*pmatb[kl] + pmatb[ij]*pmata[kl]);
    00127     }
    00128
    00129     inline void cont3(int ij, int kl, double val) {
    00130       ex -= 0.5*val*(pmat[ij]*pmat[kl] + pmata[ij]*pmata[kl] +
    00131                       pmatb[ij]*pmatb[kl]);
    00132       ex += 1.5*val*(pmata[ij]*pmatb[kl] + pmatb[ij]*pmata[kl]);
    00133     }
    00134
    00135     inline void cont4(int ij, int kl, double val) {
    00136       ec += val*pmat[ij]*pmat[kl];
    00137       ex -= 0.25*val*(pmat[ij]*pmat[kl] + pmata[ij]*pmata[kl] +
    00138                       pmatb[ij]*pmatb[kl]);
    00139       ex += 0.75*val*(pmata[ij]*pmatb[kl] + pmatb[ij]*pmata[kl]);
    00140     }
    00141
    00142     inline void cont5(int ij, int kl, double val) {
    00143       ec += val*pmat[ij]*pmat[kl];
    00144       ex -= 0.5*val*(pmat[ij]*pmat[kl] + pmata[ij]*pmata[kl] +
    00145                       pmatb[ij]*pmatb[kl]);
    00146       ex += 1.5*val*(pmata[ij]*pmatb[kl] + pmatb[ij]*pmata[kl]);
    00147     }
    00148 };
    00149
    00150 class LocalOSSGradContribution {
    00151   private:
    00152     double * const pmat;
    00153     double * const pmata;
    00154     double * const pmatb;
    00155
    00156   public:
    00157     LocalOSSGradContribution(double *p, double *pa, double *pb) :
    00158       pmat(p), pmata(pa), pmatb(pb) {}
    00159     ~LocalOSSGradContribution() {}
    00160
    00161     inline double cont1(int ij, int kl) {
    00162       return pmat[ij]*pmat[kl] +
    00163         0.5*(pmata[ij]*pmat[kl] + pmat[ij]*pmata[kl] +
    00164              pmatb[ij]*pmat[kl] + pmat[ij]*pmatb[kl]) +
    00165         0.25*(pmata[ij]*pmata[kl] + pmatb[ij]*pmatb[kl] +
    00166               pmata[ij]*pmatb[kl] + pmatb[ij]*pmata[kl]);
    00167     }
    00168
    00169     inline double cont2(int ij, int kl) {
    00170       return pmat[ij]*pmat[kl] +
    00171         0.5*(pmata[ij]*pmat[kl] + pmat[ij]*pmata[kl] +
    00172              pmatb[ij]*pmat[kl] + pmat[ij]*pmatb[kl] +
    00173              pmata[ij]*pmata[kl] + pmatb[ij]*pmatb[kl] -
    00174              pmata[ij]*pmatb[kl] - pmatb[ij]*pmata[kl]);
    00175     }
    00176 };
    00177
    00178 }
    00179