VMTK
Loading...
Searching...
No Matches
vtkvmtkLinearSystem Class Reference

Serves as the base container holding sparse matrix objects that represent a linear system of equations Ax = B. More...

#include <vtkvmtkLinearSystem.h>

Inheritance diagram for vtkvmtkLinearSystem:
[legend]
Collaboration diagram for vtkvmtkLinearSystem:
[legend]

Public Types

typedef vtkObject Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkLinearSystem * NewInstance () const
int CheckSystem ()
virtual void SetA (vtkvmtkSparseMatrix *)
virtual vtkvmtkSparseMatrix * GetA ()
virtual void SetX (vtkvmtkDoubleVector *)
virtual vtkvmtkDoubleVector * GetX ()
virtual void SetB (vtkvmtkDoubleVector *)
virtual vtkvmtkDoubleVector * GetB ()

Static Public Member Functions

static vtkvmtkLinearSystem * New ()
static int IsTypeOf (const char *type)
static vtkvmtkLinearSystem * SafeDownCast (vtkObjectBase *o)

Protected Member Functions

virtual vtkObjectBase * NewInstanceInternal () const
 vtkvmtkLinearSystem ()
 ~vtkvmtkLinearSystem ()

Protected Attributes

vtkvmtkSparseMatrix * A
vtkvmtkDoubleVector * X
vtkvmtkDoubleVector * B

Detailed Description

Serves as the base container holding sparse matrix objects that represent a linear system of equations Ax = B.

vtkvmtkLinearSystem is a plain container for the three pieces of a linear system A x = B: the sparse system matrix A, the unknown vector X, and the right-hand side vector B. CheckSystem() validates that all three are set and that their sizes are mutually consistent (number of rows of A matches the number of elements of X and B). It carries no solution logic itself; it is passed to a vtkvmtkLinearSystemSolver (which reads/writes A, X, B) and is the type of system that vtkvmtkBoundaryConditions/vtkvmtkDirichletBoundaryConditions modify to impose boundary conditions, and that vtkvmtkFEAssembler subclasses populate during assembly.

See also
vtkvmtkLinearSystemSolver, vtkvmtkFEAssembler, vtkvmtkBoundaryConditions

Definition at line 43 of file vtkvmtkLinearSystem.h.

Member Typedef Documentation

◆ Superclass

Definition at line 47 of file vtkvmtkLinearSystem.h.

Constructor & Destructor Documentation

◆ vtkvmtkLinearSystem()

vtkvmtkLinearSystem::vtkvmtkLinearSystem ( )
protected

Definition at line 28 of file vtkvmtkLinearSystem.cxx.

29{
30 this->A = NULL;
31 this->X = NULL;
32 this->B = NULL;
33}
vtkvmtkDoubleVector * B
vtkvmtkSparseMatrix * A
vtkvmtkDoubleVector * X

◆ ~vtkvmtkLinearSystem()

vtkvmtkLinearSystem::~vtkvmtkLinearSystem ( )
protected

Definition at line 35 of file vtkvmtkLinearSystem.cxx.

36{
37 if (this->A)
38 {
39 this->A->Delete();
40 this->A = NULL;
41 }
42
43 if (this->X)
44 {
45 this->X->Delete();
46 this->X = NULL;
47 }
48
49 if (this->B)
50 {
51 this->B->Delete();
52 this->B = NULL;
53 }
54}

Member Function Documentation

◆ New()

vtkvmtkLinearSystem * vtkvmtkLinearSystem::New ( )
static

◆ IsTypeOf()

int vtkvmtkLinearSystem::IsTypeOf ( const char * type)
static

◆ IsA()

virtual int vtkvmtkLinearSystem::IsA ( const char * type)
virtual

◆ SafeDownCast()

vtkvmtkLinearSystem * vtkvmtkLinearSystem::SafeDownCast ( vtkObjectBase * o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkLinearSystem::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkvmtkLinearSystem * vtkvmtkLinearSystem::NewInstance ( ) const

◆ SetA()

virtual void vtkvmtkLinearSystem::SetA ( vtkvmtkSparseMatrix * )
virtual

Set/get the sparse system matrix A.

◆ GetA()

virtual vtkvmtkSparseMatrix * vtkvmtkLinearSystem::GetA ( )
virtual

Set/get the sparse system matrix A.

◆ SetX()

virtual void vtkvmtkLinearSystem::SetX ( vtkvmtkDoubleVector * )
virtual

Set/get the unknown vector X (i.e. the solution of A x = B, filled in by a vtkvmtkLinearSystemSolver).

◆ GetX()

virtual vtkvmtkDoubleVector * vtkvmtkLinearSystem::GetX ( )
virtual

Set/get the unknown vector X (i.e. the solution of A x = B, filled in by a vtkvmtkLinearSystemSolver).

◆ SetB()

virtual void vtkvmtkLinearSystem::SetB ( vtkvmtkDoubleVector * )
virtual

Set/get the right-hand side vector B.

◆ GetB()

virtual vtkvmtkDoubleVector * vtkvmtkLinearSystem::GetB ( )
virtual

Set/get the right-hand side vector B.

◆ CheckSystem()

int vtkvmtkLinearSystem::CheckSystem ( )

Verify that A, X and B are all set and that their sizes are consistent (number of rows of A equals the number of elements of both X and B). Returns 0 if the system is valid, -1 otherwise (also emitting an error message describing the problem).

Definition at line 56 of file vtkvmtkLinearSystem.cxx.

57{
58 if (this->A==NULL)
59 {
60 vtkErrorMacro(<< "System matrix (A) not set!");
61 return -1;
62 }
63
64 if (this->X==NULL)
65 {
66 vtkErrorMacro(<< "Unknown vector (x) not provided!");
67 return -1;
68 }
69
70 if (this->B==NULL)
71 {
72 vtkErrorMacro(<< "Right-hand side vector (b) not set!");
73 return -1;
74 }
75
76 if ((this->A->GetNumberOfRows()!=this->X->GetNumberOfElements())||(this->B->GetNumberOfElements()!=this->X->GetNumberOfElements()))
77 {
78 vtkErrorMacro(<< "System matrix size, unknown vector size and right-hand side vector size do not match!");
79 return -1;
80 }
81
82 return 0;
83}

Member Data Documentation

◆ A

vtkvmtkSparseMatrix* vtkvmtkLinearSystem::A
protected

Definition at line 85 of file vtkvmtkLinearSystem.h.

◆ X

vtkvmtkDoubleVector* vtkvmtkLinearSystem::X
protected

Definition at line 86 of file vtkvmtkLinearSystem.h.

◆ B

vtkvmtkDoubleVector* vtkvmtkLinearSystem::B
protected

Definition at line 87 of file vtkvmtkLinearSystem.h.


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