Overture  Version 25
Macros | Functions
TridiagonalSolver.C File Reference
#include "TridiagonalSolver.h"
#include "OvertureInit.h"
#include "mathutil.h"
Include dependency graph for TridiagonalSolver.C:

Macros

#define pentaFactor   EXTERN_C_NAME(pentafactor)
 
#define pentaSolve   EXTERN_C_NAME(pentasolve)
 
#define triFactor   EXTERN_C_NAME(trifactor)
 
#define triSolve   EXTERN_C_NAME(trisolve)
 
#define FACTOR(I)
 
#define FACTOR(I)
 
#define SOLVE(I)
 
#define SOLVE(I)
 
#define SOLVE(I)
 
#define FACTOR(I)
 
#define SOLVE(I)
 
#define A(m, i)   ap[m+stride*(i)]
 
#define B(m, i)   bp[m+stride*(i)]
 
#define C(m, i)   cp[m+stride*(i)]
 
#define W1(m, i)   w1p[m+wStride*(i)]
 
#define W2(m, i)   w2p[m+wStride*(i)]
 
#define INVERT(B, i)
 
#define INVERT(B, i)
 
#define A(m, i)   ap[m+stride*(i)]
 
#define B(m, i)   bp[m+stride*(i)]
 
#define C(m, i)   cp[m+stride*(i)]
 
#define R(m, i)   rp[m+rStride*(i)]
 
#define W1(m, i)   w1p[m+wStride*(i)]
 
#define W2(m, i)   w2p[m+wStride*(i)]
 

Functions

void pentaFactor (const int &nd1a, const int &nd1b, const int &nd2a, const int &nd2b, const int &nd3a, const int &nd3b, const int &ipar, real &a, real &b, real &c, real &d, real &e, real &w1, real &w2, real &w3, real &w4)
 
void pentaSolve (const int &nd1a, const int &nd1b, const int &nd2a, const int &nd2b, const int &nd3a, const int &nd3b, const int &ndf1a, const int &ndf1b, const int &ndf2a, const int &ndf2b, const int &ndf3a, const int &ndf3b, const int &ipar, real &a, real &b, real &c, real &d, real &e, real &f, real &w1, real &w2, real &w3, real &w4)
 

Macro Definition Documentation

#define A (   m,
 
)    ap[m+stride*(i)]
#define A (   m,
 
)    ap[m+stride*(i)]
#define B (   m,
 
)    bp[m+stride*(i)]
#define B (   m,
 
)    bp[m+stride*(i)]
#define C (   m,
 
)    cp[m+stride*(i)]
#define C (   m,
 
)    cp[m+stride*(i)]
#define FACTOR (   I)
Value:
int base =I.getBase(); \
int bound=I.getBound(); \
if( systemType==extended ) \
{ \
/* eliminate c[n] */ \
c(LI bound RI)/=a(LI bound-1 RI); /* save the factor here */ \
a(LI bound RI)-=b(LI bound-1 RI)*c(LI bound RI); \
b(LI bound RI)-=c(LI bound-1 RI)*c(LI bound RI); \
\
} \
for( int i=base+1; i<=bound; i++ ) \
{ \
a(LI i RI)/=b(LI i-1 RI); \
b(LI i RI)-=a(LI i RI)*c(LI i-1 RI); \
if( i==base+1 && systemType==extended ) \
c(LI base+1 RI)-=a(LI base+1 RI)*a(LI base RI); /* adjust c[1] */ \
} \
#define FACTOR (   I)
Value:
int base =I.getBase(); \
int bound=I.getBound(); \
for( int i=base+1; i<=bound; i++ ) \
{ \
a(LI i RI)/=b(LI i-1 RI); \
b(LI i RI)-=a(LI i RI)*c(LI i-1 RI); \
if( systemType==extended ) \
{ \
if( i==base+1 ) \
c(LI base+1 RI)-=a(LI base+1 RI)*a(LI base RI); /* adjust c[1] */ \
if( i==bound-1 ) \
{ /* adjust row n at step n-1 */ \
c(LI bound RI)/=b(LI i-1 RI); /* save the factor here */ \
a(LI bound RI)-=c(LI bound RI)*c(LI i-1 RI); \
} \
} \
}
#define FACTOR (   I)
Value:
int base =I.getBase(); \
int bound=I.getBound(); \
if( bound-base+1<3 ) \
{ \
cout << "periodicTridiagonalFactor:ERROR bound-base+1<3 \n"; \
Overture::abort("error"); \
} \
w2(LI base RI)=a(LI base RI); \
for( int i=base+1; i<=bound-1; i++ ) \
{ \
a(LI i RI)/=b(LI i-1 RI); \
b(LI i RI)-=a(LI i RI)*c(LI i-1 RI); \
w2(LI i RI)=-a(LI i RI)*w2(LI i-1 RI); \
w1(LI i RI)=c(LI bound RI)/b(LI i-1 RI); \
c(LI bound RI)=-w1(LI i RI)*c(LI i-1 RI); \
b(LI bound RI)-=w1(LI i RI)*w2(LI i-1 RI); \
} \
w2(LI bound-1 RI)+=c(LI bound-1 RI); \
a(LI bound RI)+=c(LI bound RI); \
a(LI bound RI)/=b(LI bound-1 RI); \
b(LI bound RI)-=a(LI bound RI)*w2(LI bound-1 RI);
#define INVERT (   B,
 
)
Value:
deti = 1./(B(0,i)*B(3,i)-B(2,i)*B(1,i)); \
temp= B(0,i)*deti; \
B(0,i)=B(3,i)*deti; \
B(1,i)*=-deti; \
B(2,i)*=-deti; \
B(3,i)=temp;
#define INVERT (   B,
 
)
Value:
b00=B(0,i), b10=B(1,i), b20=B(2,i); \
b01=B(3,i), b11=B(4,i), b21=B(5,i); \
b02=B(6,i), b12=B(7,i), b22=B(8,i); \
deti = 1./(b00*(b11*b22-b12*b21)+ \
b10*(b21*b02-b22*b01)+ \
b20*(b01*b12-b02*b11) ); \
d00= (b11*b22-b12*b21)*deti; \
d01= (b21*b02-b22*b01)*deti; \
d02= (b01*b12-b02*b11)*deti; \
d10= (b12*b20-b10*b22)*deti; \
d11= (b22*b00-b20*b02)*deti; \
d12= (b02*b10-b00*b12)*deti; \
d20= (b10*b21-b11*b20)*deti; \
d21= (b20*b01-b21*b00)*deti; \
d22= (b00*b11-b01*b10)*deti; \
B(0,i)=d00; \
B(1,i)=d10; \
B(2,i)=d20; \
B(3,i)=d01; \
B(4,i)=d11; \
B(5,i)=d21; \
B(6,i)=d02; \
B(7,i)=d12; \
B(8,i)=d22;
#define pentaFactor   EXTERN_C_NAME(pentafactor)
#define pentaSolve   EXTERN_C_NAME(pentasolve)
#define R (   m,
 
)    rp[m+rStride*(i)]
#define SOLVE (   I)
Value:
int base =I.getBase(); \
int bound=I.getBound(); \
/* forward elimination */ \
for( i=base+1; i<=bound; i++ ) \
{ \
r(LI i RI)-=a(LI i RI)*r(LI i-1 RI); \
if( systemType==extended && i==bound-1 ) \
r(LI bound RI)-=c(LI bound RI)*r(LI i-1 RI); /* adjust r[n] at step n-1 */ \
} \
\
/* back substitution */ \
r(LI bound RI)/=b(LI bound RI); \
for( i=bound-1; i>=base; i-- ) \
r(LI i RI)=( r(LI i RI)-c(LI i RI)*r(LI i+1 RI))/b(LI i RI); \
if( systemType==extended ) \
r(LI base RI)-=a(LI base RI)*r(LI base+2 RI)/b(LI base RI); \
#define SOLVE (   I)
Value:
int base =I.getBase(); \
int bound=I.getBound(); \
/* forward elimination */ \
if( systemType==extended ) \
r(LI bound RI)-=c(LI bound RI)*r(LI bound-1 RI); \
\
for( i=base+1; i<=bound; i++ ) \
r(LI i RI)-=a(LI i RI)*r(LI i-1 RI); \
\
/* back substitution */ \
r(LI bound RI)/=b(LI bound RI); \
for( i=bound-1; i>=base; i-- ) \
r(LI i RI)=( r(LI i RI)-c(LI i RI)*r(LI i+1 RI))/b(LI i RI); \
if( systemType==extended ) \
r(LI base RI)-=a(LI base RI)*r(LI base+2 RI)/b(LI base RI); \
#define SOLVE (   I)
Value:
int base =I.getBase(); \
int bound=I.getBound(); \
/* forward elimination */ \
for( i=base+1; i<=bound; i++ ) \
{ \
r(LI i RI)-=a(LI i RI)*r(LI i-1 RI); \
if( systemType==extended && i==bound-1 ) \
r(LI bound RI)-=c(LI bound RI)*r(LI i-1 RI); /* adjust r[n] at step n-1 */ \
} \
\
/* back substitution */ \
r(LI bound RI)/=b(LI bound RI); \
for( i=bound-1; i>=base; i-- ) \
r(LI i RI)=( r(LI i RI)-c(LI i RI)*r(LI i+1 RI))/b(LI i RI); \
if( systemType==extended ) \
r(LI base RI)-=a(LI base RI)*r(LI base+2 RI)/b(LI base RI); \
#define SOLVE (   I)
Value:
int base =I.getBase(); \
int bound=I.getBound(); \
if( bound-base+1<3 ) \
{ \
cout << "periodicTridiagonalSolve:ERROR bound-base+1<3 \n"; \
Overture::abort("error"); \
} \
for( i=base+1; i<bound; i++ ) \
{ \
r(LI i RI)-=a(LI i RI)*r(LI i-1 RI); \
r(LI bound RI)-=w1(LI i RI)*r(LI i-1 RI); \
} \
r(LI bound RI)=(r(LI bound RI)-a(LI bound RI)*r(LI bound-1 RI))/b(LI bound RI); \
i=bound-1; \
r(LI i RI)=(r(LI i RI)-w2(LI i RI)*r(LI bound RI))/b(LI i RI); \
for( i=bound-2; i>=base; i-- ) \
r(LI i RI)=(r(LI i RI)-c(LI i RI)*r(LI i+1 RI)-w2(LI i RI)*r(LI bound RI))/b(LI i RI);
#define triFactor   EXTERN_C_NAME(trifactor)
#define triSolve   EXTERN_C_NAME(trisolve)
#define W1 (   m,
 
)    w1p[m+wStride*(i)]
#define W1 (   m,
 
)    w1p[m+wStride*(i)]
#define W2 (   m,
 
)    w2p[m+wStride*(i)]
#define W2 (   m,
 
)    w2p[m+wStride*(i)]

Function Documentation

void pentaFactor ( const int &  nd1a,
const int &  nd1b,
const int &  nd2a,
const int &  nd2b,
const int &  nd3a,
const int &  nd3b,
const int &  ipar,
real a,
real b,
real c,
real d,
real e,
real w1,
real w2,
real w3,
real w4 
)
void pentaSolve ( const int &  nd1a,
const int &  nd1b,
const int &  nd2a,
const int &  nd2b,
const int &  nd3a,
const int &  nd3b,
const int &  ndf1a,
const int &  ndf1b,
const int &  ndf2a,
const int &  ndf2b,
const int &  ndf3a,
const int &  ndf3b,
const int &  ipar,
real a,
real b,
real c,
real d,
real e,
real f,
real w1,
real w2,
real w3,
real w4 
)