VMTK
vtkvmtkSparseMatrix.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: VMTK
4  Module: $RCSfile: vtkvmtkSparseMatrix.h,v $
5  Language: C++
6 
7  Copyright (c) Luca Antiga, David Steinman. All rights reserved.
8  See LICENSE file for details.
9 
10  Portions of this code are covered under the VTK copyright.
11  See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm
12  for details.
13 
14  This software is distributed WITHOUT ANY WARRANTY; without even
15  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16  PURPOSE. See the above copyright notices for more information.
17 
18 =========================================================================*/
28 #ifndef __vtkvmtkSparseMatrix_h
29 #define __vtkvmtkSparseMatrix_h
30 
31 #include "vtkObject.h"
32 #include "vtkvmtkSparseMatrixRow.h"
33 #include "vtkvmtkNeighborhoods.h"
34 #include "vtkvmtkStencils.h"
35 #include "vtkvmtkDoubleVector.h"
36 #include "vtkDataSet.h"
37 #include "vtkvmtkWin32Header.h"
38 
39 class VTK_VMTK_DIFFERENTIAL_GEOMETRY_EXPORT vtkvmtkSparseMatrix : public vtkObject
40 {
41 public:
42 
43  static vtkvmtkSparseMatrix* New();
44  vtkTypeMacro(vtkvmtkSparseMatrix,vtkObject);
45 
46  void Multiply(vtkvmtkDoubleVector* x, vtkvmtkDoubleVector* y);
47  void TransposeMultiply(vtkvmtkDoubleVector* x, vtkvmtkDoubleVector* y);
48 
50  vtkvmtkSparseMatrixRow* GetRow(vtkIdType i) { return this->Array[i]; }
51 
52  vtkGetMacro(NumberOfRows,vtkIdType);
53  void CopyRowsFromStencils(vtkvmtkStencils *stencils);
54  void AllocateRowsFromNeighborhoods(vtkvmtkNeighborhoods *neighborhoods, int numberOfVariables=1);
55  void AllocateRowsFromDataSet(vtkDataSet *dataSet, int numberOfVariables=1);
56 
57  void Initialize();
58  void SetNumberOfRows(vtkIdType numberOfRows);
59 
60  double GetElement(vtkIdType i, vtkIdType j);
61  void SetElement(vtkIdType i, vtkIdType j, double value);
62  void AddElement(vtkIdType i, vtkIdType j, double value);
63 
64  void DeepCopy(vtkvmtkSparseMatrix *src);
65 
66 protected:
69 
71  vtkIdType NumberOfRows;
72 
73 private:
74  vtkvmtkSparseMatrix(const vtkvmtkSparseMatrix&); // Not implemented.
75  void operator=(const vtkvmtkSparseMatrix&); // Not implemented.
76 };
77 
78 #endif
79 
Base class for vectors utilized in finite-element and other PDE evaluations.
Class for constructing sparse matrices from a dataset and performing basic mathematical operations on...
Create an empty, umbrella, area weighted umbrella, finite-element LP, or finite-volume finite-element...
vtkvmtkSparseMatrixRow ** Array
Class to handle operating on rows of a sparse matrix.
vtkvmtkSparseMatrixRow * GetRow(vtkIdType i)
Create an empty, polydata, polydata manifold, polydata manifold extended, or unstructured grid neighb...