def gen_int(self):
    for m in range(0, (self.max_m + 1)):
        if (m == 0):
            self.fhc.write(('\n/* PF true integral, m=%d */ \n' % m))
            self.fhd.write(('\n/* PF true integral, m=%d */ \n' % m))
        else:
            self.fhc.write(('\n/* PF auxilary integral, m=%d */ \n' % m))
            self.fhd.write(('\n/* PF auxilary integral, m=%d */ \n' % m))
        self.fhc.write(('class PFint_%d{ \n' % m))
        self.fhc.write('public: \n')
        self.fhc.write('#ifdef REG_PF \n')
        for i in range(0, 10):
            for j in range(0, 3):
                self.fhc.write(('  QUICKDouble x_%d_%d; // %s, %s \n' % ((j + 1), (i + 10), self.p_lbl[j], self.f_lbl[i])))
        self.fhc.write('#endif \n')
        self.fhc.write(('  %s PFint_%d(QUICKDouble PAx, QUICKDouble PAy, QUICKDouble PAz,\n                QUICKDouble PBx, QUICKDouble PBy, QUICKDouble PBz, QUICKDouble PCx, QUICKDouble PCy, QUICKDouble PCz,\n                QUICKDouble TwoZetaInv, QUICKDouble* store, QUICKDouble* YVerticalTemp); \n' % (self.func_qualifier, m)))
        self.fhc.write('}; \n')
        for i in range(0, 10):
            self.fhc.write(('\n/* PF integral partial class, - Part %d, m=%d */ \n' % ((i + 1), m)))
            self.fhc.write(('class PFint_%d_%d{ \n' % (m, (i + 1))))
            self.fhc.write('public: \n')
            for j in range(0, 3):
                self.fhc.write(('  QUICKDouble x_%d_%d; // %s, %s \n' % ((j + 1), (i + 10), self.p_lbl[j], self.f_lbl[i])))
            self.fhc.write(('  %s PFint_%d_%d(QUICKDouble PAx, QUICKDouble PAy, QUICKDouble PAz,\n                QUICKDouble PBx, QUICKDouble PBy, QUICKDouble PBz, QUICKDouble PCx, QUICKDouble PCy, QUICKDouble PCz,\n                QUICKDouble TwoZetaInv, QUICKDouble* store, QUICKDouble* YVerticalTemp); \n' % (self.func_qualifier, m, (i + 1))))
            self.fhc.write('}; \n')
        self.fhd.write(('%s PFint_%d::PFint_%d(QUICKDouble PAx, QUICKDouble PAy, QUICKDouble PAz,\n                QUICKDouble PBx, QUICKDouble PBy, QUICKDouble PBz, QUICKDouble PCx, QUICKDouble PCy, QUICKDouble PCz,\n                QUICKDouble TwoZetaInv, QUICKDouble* store, QUICKDouble* YVerticalTemp){ \n\n' % (self.func_qualifier, m, m)))
        self.fhd.write(('  SDint_%d sd_%d(PBx, PBy, PBz, PCx, PCy, PCz, TwoZetaInv, store, YVerticalTemp); // construct [s|d] for m=%d \n' % (m, m, m)))
        self.fhd.write(('  SDint_%d sd_%d(PBx, PBy, PBz, PCx, PCy, PCz, TwoZetaInv, store, YVerticalTemp); // construct [s|d] for m=%d \n' % ((m + 1), (m + 1), (m + 1))))
        self.fhd.write(('  SFint_%d sf_%d(PBx, PBy, PBz, PCx, PCy, PCz, TwoZetaInv, store, YVerticalTemp); // construct [s|f] for m=%d \n' % (m, m, m)))
        self.fhd.write(('  SFint_%d sf_%d(PBx, PBy, PBz, PCx, PCy, PCz, TwoZetaInv, store, YVerticalTemp); // construct [s|f] for m=%d \n\n' % ((m + 1), (m + 1), (m + 1))))
        self.fhd.write('#ifdef REG_PF \n')
        for i in range(0, 10):
            for j in range(0, 3):
                tmp_mcal = [params.Mcal[(i + 10)][0], params.Mcal[(i + 10)][1], params.Mcal[(i + 10)][2]]
                for k in range(0, 3):
                    if (params.Mcal[(j + 1)][k] != 0):
                        self.fhd.write('#ifdef REG_SF \n')
                        self.fhd.write(('  x_%d_%d = %s * sf_%d.x_%d_%d - %s * sf_%d.x_%d_%d; \n' % ((j + 1), (i + 10), self.PA[k], m, 0, (i + 10), self.PC[k], (m + 1), 0, (i + 10))))
                        self.fhd.write('#else \n')
                        self.fhd.write(('  x_%d_%d = %s * LOCSTOREFULL(store, %d, %d, STOREDIM, STOREDIM, %d)- %s * LOCSTOREFULL(store, %d, %d, STOREDIM, STOREDIM, %d); \n' % ((j + 1), (i + 10), self.PA[k], 0, (i + 10), m, self.PC[k], 0, (i + 10), (m + 1))))
                        self.fhd.write('#endif \n')
                        if (tmp_mcal[k] != 0):
                            tmp_mcal[k] -= 1
                            tmp_i = params.trans[tmp_mcal[0]][tmp_mcal[1]][tmp_mcal[2]]
                            self.fhd.write(('  x_%d_%d += TwoZetaInv * %f * (sd_%d.x_%d_%d - sd_%d.x_%d_%d); \n' % ((j + 1), (i + 10), params.Mcal[(i + 10)][k], m, 0, (tmp_i - 1), (m + 1), 0, (tmp_i - 1))))
                        break
        self.fhd.write('#else \n')
        self.fhd.write('  QUICKDouble val; \n')
        for i in range(0, 10):
            for j in range(0, 3):
                tmp_mcal = [params.Mcal[(i + 10)][0], params.Mcal[(i + 10)][1], params.Mcal[(i + 10)][2]]
                for k in range(0, 3):
                    if (params.Mcal[(j + 1)][k] != 0):
                        self.fhd.write('#ifdef REG_SF \n')
                        self.fhd.write(('  val = %s * sf_%d.x_%d_%d - %s * sf_%d.x_%d_%d; \n' % (self.PA[k], m, 0, (i + 10), self.PC[k], (m + 1), 0, (i + 10))))
                        self.fhd.write('#else \n')
                        self.fhd.write(('  val = %s * LOCSTOREFULL(store, %d, %d, STOREDIM, STOREDIM, %d) - %s * LOCSTOREFULL(store, %d, %d, STOREDIM, STOREDIM, %d); \n' % (self.PA[k], 0, (i + 10), m, self.PC[k], 0, (i + 10), (m + 1))))
                        self.fhd.write('#endif \n')
                        if (tmp_mcal[k] != 0):
                            tmp_mcal[k] -= 1
                            tmp_i = params.trans[tmp_mcal[0]][tmp_mcal[1]][tmp_mcal[2]]
                            self.fhd.write(('  val += TwoZetaInv * %f * (sd_%d.x_%d_%d - sd_%d.x_%d_%d); \n' % (params.Mcal[(i + 10)][k], m, 0, (tmp_i - 1), (m + 1), 0, (tmp_i - 1))))
                        self.fhd.write(('  LOCSTOREFULL(store, %d, %d, STOREDIM, STOREDIM, %d) = val; \n' % ((j + 1), (i + 10), m)))
                        break
        self.fhd.write('#endif \n')
        self.fhd.write('\n } \n')
        for i in range(0, 10):
            self.fhd.write(('\n/* PF integral partial class - Part %d, m=%d */ \n' % ((i + 1), m)))
            self.fhd.write(('%s PFint_%d_%d::PFint_%d_%d(QUICKDouble PAx, QUICKDouble PAy, QUICKDouble PAz,\n                QUICKDouble PBx, QUICKDouble PBy, QUICKDouble PBz, QUICKDouble PCx, QUICKDouble PCy, QUICKDouble PCz,\n                QUICKDouble TwoZetaInv, QUICKDouble* store, QUICKDouble* YVerticalTemp){ \n\n' % (self.func_qualifier, m, (i + 1), m, (i + 1))))
            self.fhd.write(('  SDint_%d sd_%d(PBx, PBy, PBz, PCx, PCy, PCz, TwoZetaInv, store, YVerticalTemp); // construct [s|d] for m=%d \n' % (m, m, m)))
            self.fhd.write(('  SDint_%d sd_%d(PBx, PBy, PBz, PCx, PCy, PCz, TwoZetaInv, store, YVerticalTemp); // construct [s|d] for m=%d \n' % ((m + 1), (m + 1), (m + 1))))
            self.fhd.write(('  SFint_%d sf_%d(PBx, PBy, PBz, PCx, PCy, PCz, TwoZetaInv, store, YVerticalTemp); // construct [s|f] for m=%d \n' % (m, m, m)))
            self.fhd.write(('  SFint_%d sf_%d(PBx, PBy, PBz, PCx, PCy, PCz, TwoZetaInv, store, YVerticalTemp); // construct [s|f] for m=%d \n\n' % ((m + 1), (m + 1), (m + 1))))
            for j in range(0, 3):
                tmp_mcal = [params.Mcal[(i + 10)][0], params.Mcal[(i + 10)][1], params.Mcal[(i + 10)][2]]
                for k in range(0, 3):
                    if (params.Mcal[(j + 1)][k] != 0):
                        self.fhd.write('#ifdef REG_SF \n')
                        self.fhd.write(('  x_%d_%d = %s * sf_%d.x_%d_%d - %s * sf_%d.x_%d_%d; \n' % ((j + 1), (i + 10), self.PA[k], m, 0, (i + 10), self.PC[k], (m + 1), 0, (i + 10))))
                        self.fhd.write('#else \n')
                        self.fhd.write(('  x_%d_%d = %s * LOCSTOREFULL(store, %d, %d, STOREDIM, STOREDIM, %d)- %s * LOCSTOREFULL(store, %d, %d, STOREDIM, STOREDIM, %d); \n' % ((j + 1), (i + 10), self.PA[k], 0, (i + 10), m, self.PC[k], 0, (i + 10), (m + 1))))
                        self.fhd.write('#endif \n')
                        if (tmp_mcal[k] != 0):
                            tmp_mcal[k] -= 1
                            tmp_i = params.trans[tmp_mcal[0]][tmp_mcal[1]][tmp_mcal[2]]
                            self.fhd.write(('  x_%d_%d += TwoZetaInv * %f * (sd_%d.x_%d_%d - sd_%d.x_%d_%d); \n' % ((j + 1), (i + 10), params.Mcal[(i + 10)][k], m, 0, (tmp_i - 1), (m + 1), 0, (tmp_i - 1))))
                        break
            self.fhd.write('\n } \n')
def gen_int(self):
    for m in range(0, (self.max_m + 1)):
        if (m == 0):
            self.fhc.write(('\n/* PF true integral, m=%d */ \n' % m))
            self.fhd.write(('\n/* PF true integral, m=%d */ \n' % m))
        else:
            self.fhc.write(('\n/* PF auxilary integral, m=%d */ \n' % m))
            self.fhd.write(('\n/* PF auxilary integral, m=%d */ \n' % m))
        self.fhc.write(('class PFint_%d{ \n' % m))
        self.fhc.write('public: \n')
        self.fhc.write('#ifdef REG_PF \n')
        for i in range(0, 10):
            for j in range(0, 3):
                self.fhc.write(('  QUICKDouble x_%d_%d; // %s, %s \n' % ((j + 1), (i + 10), self.p_lbl[j], self.f_lbl[i])))
        self.fhc.write('#endif \n')
        self.fhc.write(('  %s PFint_%d(QUICKDouble PAx, QUICKDouble PAy, QUICKDouble PAz,\n                QUICKDouble PBx, QUICKDouble PBy, QUICKDouble PBz, QUICKDouble PCx, QUICKDouble PCy, QUICKDouble PCz,\n                QUICKDouble TwoZetaInv, QUICKDouble* store, QUICKDouble* YVerticalTemp); \n' % (self.func_qualifier, m)))
        self.fhc.write('}; \n')
        for i in range(0, 10):
            self.fhc.write(('\n/* PF integral partial class, - Part %d, m=%d */ \n' % ((i + 1), m)))
            self.fhc.write(('class PFint_%d_%d{ \n' % (m, (i + 1))))
            self.fhc.write('public: \n')
            for j in range(0, 3):
                self.fhc.write(('  QUICKDouble x_%d_%d; // %s, %s \n' % ((j + 1), (i + 10), self.p_lbl[j], self.f_lbl[i])))
            self.fhc.write(('  %s PFint_%d_%d(QUICKDouble PAx, QUICKDouble PAy, QUICKDouble PAz,\n                QUICKDouble PBx, QUICKDouble PBy, QUICKDouble PBz, QUICKDouble PCx, QUICKDouble PCy, QUICKDouble PCz,\n                QUICKDouble TwoZetaInv, QUICKDouble* store, QUICKDouble* YVerticalTemp); \n' % (self.func_qualifier, m, (i + 1))))
            self.fhc.write('}; \n')
        self.fhd.write(('%s PFint_%d::PFint_%d(QUICKDouble PAx, QUICKDouble PAy, QUICKDouble PAz,\n                QUICKDouble PBx, QUICKDouble PBy, QUICKDouble PBz, QUICKDouble PCx, QUICKDouble PCy, QUICKDouble PCz,\n                QUICKDouble TwoZetaInv, QUICKDouble* store, QUICKDouble* YVerticalTemp){ \n\n' % (self.func_qualifier, m, m)))
        self.fhd.write(('  SDint_%d sd_%d(PBx, PBy, PBz, PCx, PCy, PCz, TwoZetaInv, store, YVerticalTemp); // construct [s|d] for m=%d \n' % (m, m, m)))
        self.fhd.write(('  SDint_%d sd_%d(PBx, PBy, PBz, PCx, PCy, PCz, TwoZetaInv, store, YVerticalTemp); // construct [s|d] for m=%d \n' % ((m + 1), (m + 1), (m + 1))))
        self.fhd.write(('  SFint_%d sf_%d(PBx, PBy, PBz, PCx, PCy, PCz, TwoZetaInv, store, YVerticalTemp); // construct [s|f] for m=%d \n' % (m, m, m)))
        self.fhd.write(('  SFint_%d sf_%d(PBx, PBy, PBz, PCx, PCy, PCz, TwoZetaInv, store, YVerticalTemp); // construct [s|f] for m=%d \n\n' % ((m + 1), (m + 1), (m + 1))))
        self.fhd.write('#ifdef REG_PF \n')
        for i in range(0, 10):
            for j in range(0, 3):
                tmp_mcal = [params.Mcal[(i + 10)][0], params.Mcal[(i + 10)][1], params.Mcal[(i + 10)][2]]
                for k in range(0, 3):
                    if (params.Mcal[(j + 1)][k] != 0):
                        self.fhd.write('#ifdef REG_SF \n')
                        self.fhd.write(('  x_%d_%d = %s * sf_%d.x_%d_%d - %s * sf_%d.x_%d_%d; \n' % ((j + 1), (i + 10), self.PA[k], m, 0, (i + 10), self.PC[k], (m + 1), 0, (i + 10))))
                        self.fhd.write('#else \n')
                        self.fhd.write(('  x_%d_%d = %s * LOCSTOREFULL(store, %d, %d, STOREDIM, STOREDIM, %d)- %s * LOCSTOREFULL(store, %d, %d, STOREDIM, STOREDIM, %d); \n' % ((j + 1), (i + 10), self.PA[k], 0, (i + 10), m, self.PC[k], 0, (i + 10), (m + 1))))
                        self.fhd.write('#endif \n')
                        if (tmp_mcal[k] != 0):
                            tmp_mcal[k] -= 1
                            tmp_i = params.trans[tmp_mcal[0]][tmp_mcal[1]][tmp_mcal[2]]
                            self.fhd.write(('  x_%d_%d += TwoZetaInv * %f * (sd_%d.x_%d_%d - sd_%d.x_%d_%d); \n' % ((j + 1), (i + 10), params.Mcal[(i + 10)][k], m, 0, (tmp_i - 1), (m + 1), 0, (tmp_i - 1))))
                        break
        self.fhd.write('#else \n')
        self.fhd.write('  QUICKDouble val; \n')
        for i in range(0, 10):
            for j in range(0, 3):
                tmp_mcal = [params.Mcal[(i + 10)][0], params.Mcal[(i + 10)][1], params.Mcal[(i + 10)][2]]
                for k in range(0, 3):
                    if (params.Mcal[(j + 1)][k] != 0):
                        self.fhd.write('#ifdef REG_SF \n')
                        self.fhd.write(('  val = %s * sf_%d.x_%d_%d - %s * sf_%d.x_%d_%d; \n' % (self.PA[k], m, 0, (i + 10), self.PC[k], (m + 1), 0, (i + 10))))
                        self.fhd.write('#else \n')
                        self.fhd.write(('  val = %s * LOCSTOREFULL(store, %d, %d, STOREDIM, STOREDIM, %d) - %s * LOCSTOREFULL(store, %d, %d, STOREDIM, STOREDIM, %d); \n' % (self.PA[k], 0, (i + 10), m, self.PC[k], 0, (i + 10), (m + 1))))
                        self.fhd.write('#endif \n')
                        if (tmp_mcal[k] != 0):
                            tmp_mcal[k] -= 1
                            tmp_i = params.trans[tmp_mcal[0]][tmp_mcal[1]][tmp_mcal[2]]
                            self.fhd.write(('  val += TwoZetaInv * %f * (sd_%d.x_%d_%d - sd_%d.x_%d_%d); \n' % (params.Mcal[(i + 10)][k], m, 0, (tmp_i - 1), (m + 1), 0, (tmp_i - 1))))
                        self.fhd.write(('  LOCSTOREFULL(store, %d, %d, STOREDIM, STOREDIM, %d) = val; \n' % ((j + 1), (i + 10), m)))
                        break
        self.fhd.write('#endif \n')
        self.fhd.write('\n } \n')
        for i in range(0, 10):
            self.fhd.write(('\n/* PF integral partial class - Part %d, m=%d */ \n' % ((i + 1), m)))
            self.fhd.write(('%s PFint_%d_%d::PFint_%d_%d(QUICKDouble PAx, QUICKDouble PAy, QUICKDouble PAz,\n                QUICKDouble PBx, QUICKDouble PBy, QUICKDouble PBz, QUICKDouble PCx, QUICKDouble PCy, QUICKDouble PCz,\n                QUICKDouble TwoZetaInv, QUICKDouble* store, QUICKDouble* YVerticalTemp){ \n\n' % (self.func_qualifier, m, (i + 1), m, (i + 1))))
            self.fhd.write(('  SDint_%d sd_%d(PBx, PBy, PBz, PCx, PCy, PCz, TwoZetaInv, store, YVerticalTemp); // construct [s|d] for m=%d \n' % (m, m, m)))
            self.fhd.write(('  SDint_%d sd_%d(PBx, PBy, PBz, PCx, PCy, PCz, TwoZetaInv, store, YVerticalTemp); // construct [s|d] for m=%d \n' % ((m + 1), (m + 1), (m + 1))))
            self.fhd.write(('  SFint_%d sf_%d(PBx, PBy, PBz, PCx, PCy, PCz, TwoZetaInv, store, YVerticalTemp); // construct [s|f] for m=%d \n' % (m, m, m)))
            self.fhd.write(('  SFint_%d sf_%d(PBx, PBy, PBz, PCx, PCy, PCz, TwoZetaInv, store, YVerticalTemp); // construct [s|f] for m=%d \n\n' % ((m + 1), (m + 1), (m + 1))))
            for j in range(0, 3):
                tmp_mcal = [params.Mcal[(i + 10)][0], params.Mcal[(i + 10)][1], params.Mcal[(i + 10)][2]]
                for k in range(0, 3):
                    if (params.Mcal[(j + 1)][k] != 0):
                        self.fhd.write('#ifdef REG_SF \n')
                        self.fhd.write(('  x_%d_%d = %s * sf_%d.x_%d_%d - %s * sf_%d.x_%d_%d; \n' % ((j + 1), (i + 10), self.PA[k], m, 0, (i + 10), self.PC[k], (m + 1), 0, (i + 10))))
                        self.fhd.write('#else \n')
                        self.fhd.write(('  x_%d_%d = %s * LOCSTOREFULL(store, %d, %d, STOREDIM, STOREDIM, %d)- %s * LOCSTOREFULL(store, %d, %d, STOREDIM, STOREDIM, %d); \n' % ((j + 1), (i + 10), self.PA[k], 0, (i + 10), m, self.PC[k], 0, (i + 10), (m + 1))))
                        self.fhd.write('#endif \n')
                        if (tmp_mcal[k] != 0):
                            tmp_mcal[k] -= 1
                            tmp_i = params.trans[tmp_mcal[0]][tmp_mcal[1]][tmp_mcal[2]]
                            self.fhd.write(('  x_%d_%d += TwoZetaInv * %f * (sd_%d.x_%d_%d - sd_%d.x_%d_%d); \n' % ((j + 1), (i + 10), params.Mcal[(i + 10)][k], m, 0, (tmp_i - 1), (m + 1), 0, (tmp_i - 1))))
                        break
            self.fhd.write('\n } \n')