Package pulse.problem.schemes
Class TridiagonalMatrixAlgorithm
- java.lang.Object
-
- pulse.problem.schemes.TridiagonalMatrixAlgorithm
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
BlockMatrixAlgorithm
public class TridiagonalMatrixAlgorithm extends Object implements Serializable
Implements the tridiagonal matrix algorithm (Thomas algorithms) for solving systems of linear equations. Applicable to such systems where the forming matrix has a tridiagonal form: Ai*xi-1 - Bi xi + Ci xi+1 = -Fi.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TridiagonalMatrixAlgorithm(Grid grid)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublebeta(double f, double phi, int i)voidevaluateAlpha()Calculates thealphacoefficients as part of the tridiagonal matrix algorithm.voidevaluateBeta(double[] U)voidevaluateBeta(double[] U, int start, int endExclusive)Calculates thebetacoefficients as part of the tridiagonal matrix algorithm.double[]getAlpha()double[]getBeta()protected doublegetCoefA()protected doublegetCoefB()protected doublegetCoefC()intgetGridPoints()doublegetGridStep()doublegetTimeStep()doublephi(int i)voidsetAlpha(int i, double alpha)voidsetBeta(int i, double beta)voidsetCoefA(double a)voidsetCoefB(double b)voidsetCoefC(double c)voidsweep(double[] V)Calculates the solutionVusing the tridiagonal matrix algorithm.
-
-
-
Constructor Detail
-
TridiagonalMatrixAlgorithm
public TridiagonalMatrixAlgorithm(Grid grid)
-
-
Method Detail
-
sweep
public void sweep(double[] V)
Calculates the solutionVusing the tridiagonal matrix algorithm. This performs a backwards sweep fromN - 1to0whereNis the grid density value. The coefficientsalphaandbetashould have been precalculated- Parameters:
V- the array containing theNth value previously calculated from the respective boundary condition
-
evaluateAlpha
public void evaluateAlpha()
Calculates thealphacoefficients as part of the tridiagonal matrix algorithm.
-
evaluateBeta
public void evaluateBeta(double[] U)
-
evaluateBeta
public void evaluateBeta(double[] U, int start, int endExclusive)Calculates thebetacoefficients as part of the tridiagonal matrix algorithm.- Parameters:
U-start-endExclusive-
-
beta
public double beta(double f, double phi, int i)
-
phi
public double phi(int i)
-
setAlpha
public void setAlpha(int i, double alpha)
-
setBeta
public void setBeta(int i, double beta)
-
getAlpha
public double[] getAlpha()
-
getBeta
public double[] getBeta()
-
setCoefA
public void setCoefA(double a)
-
setCoefB
public void setCoefB(double b)
-
setCoefC
public void setCoefC(double c)
-
getCoefA
protected double getCoefA()
-
getCoefB
protected double getCoefB()
-
getCoefC
protected double getCoefC()
-
getTimeStep
public final double getTimeStep()
-
getGridPoints
public final int getGridPoints()
-
getGridStep
public final double getGridStep()
-
-