VMTK
Loading...
Searching...
No Matches
vtkvmtkLinearSystem.cxx
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: VMTK
4 Module: $RCSfile: vtkvmtkLinearSystem.cxx,v $
5 Language: C++
6 Date: $Date: 2006/02/23 09:31:41 $
7 Version: $Revision: 1.3 $
8
9 Copyright (c) Luca Antiga, David Steinman. All rights reserved.
10 See LICENSE file for details.
11
12 Portions of this code are covered under the VTK copyright.
13 See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm
14 for details.
15
16 This software is distributed WITHOUT ANY WARRANTY; without even
17 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18 PURPOSE. See the above copyright notices for more information.
19
20=========================================================================*/
21
22#include "vtkvmtkLinearSystem.h"
23#include "vtkObjectFactory.h"
24
25
27
29{
30 this->A = NULL;
31 this->X = NULL;
32 this->B = NULL;
33}
34
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}
55
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}
84
Serves as the base container holding sparse matrix objects that represent a linear system of equation...
vtkvmtkDoubleVector * B
vtkvmtkSparseMatrix * A
vtkvmtkDoubleVector * X
vtkStandardNewMacro(vtkvmtkLinearSystem)