VMTK
vtkvmtkDoubleVector.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: VMTK
4  Module: $RCSfile: vtkvmtkDoubleVector.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 __vtkvmtkDoubleVector_h
29 #define __vtkvmtkDoubleVector_h
30 
31 #include "vtkObject.h"
32 #include "vtkDataArray.h"
33 //#include "vtkvmtkDifferentialGeometryWin32Header.h"
34 #include "vtkvmtkWin32Header.h"
35 
36 #define VTK_VMTK_L2_NORM 0
37 #define VTK_VMTK_LINF_NORM 1
38 
39 class VTK_VMTK_DIFFERENTIAL_GEOMETRY_EXPORT vtkvmtkDoubleVector : public vtkObject
40 {
41 public:
42 
43  static vtkvmtkDoubleVector* New();
44  vtkTypeMacro(vtkvmtkDoubleVector,vtkObject);
45 
46  vtkSetMacro(NormType,int);
47  vtkGetMacro(NormType,int);
49  {this->SetNormType(VTK_VMTK_L2_NORM);};
51  {this->SetNormType(VTK_VMTK_LINF_NORM);};
52 
53  vtkGetMacro(NumberOfElements,vtkIdType);
54  vtkGetMacro(NumberOfElementsPerVariable,vtkIdType);
55  vtkGetMacro(NumberOfVariables,vtkIdType);
56 
57  void Allocate(vtkIdType numberOfElementsPerVariable, vtkIdType numberOfVariables=1);
58  void Fill(double value);
59  void Assign(vtkvmtkDoubleVector *src);
60  void Assign(vtkIdType numberOfElements, const double *array);
61 
62  double GetElement(vtkIdType i) {return this->Array[i];};
63  void SetElement(vtkIdType i, double value) {this->Array[i] = value;};
64  void AddElement(vtkIdType i, double value) {this->Array[i] += value;};
65 
66  //bool GetLocked(vtkIdType i) {return this->Locked[i];}
67  //void SetLocked(vtkIdType i, bool locked) {this->Locked[i] = locked;}
68  //void UnlockAll();
69 
70  const double* GetArray() {return this->Array;};
71  void CopyIntoArrayComponent(vtkDataArray *array, int component);
72  void CopyVariableIntoArrayComponent(vtkDataArray *array, int variable, int component);
73 
74  double ComputeNorm();
75  void Add(vtkvmtkDoubleVector* vectorToAdd);
76  void Subtract(vtkvmtkDoubleVector* vectorToSubtract);
77  void MultiplyBy(double scalar);
78  double Dot(vtkvmtkDoubleVector* vectorToDotWith);
79 
80  void DeepCopy(vtkvmtkDoubleVector *src);
81 
82 protected:
85 
86  vtkIdType NumberOfElements;
88  vtkIdType NumberOfVariables;
89 
90  int NormType;
91 
92  double* Array;
93  //bool* Locked;
94 
95 private:
96  vtkvmtkDoubleVector(const vtkvmtkDoubleVector&); // Not implemented.
97  void operator=(const vtkvmtkDoubleVector&); // Not implemented.
98 };
99 
100 #endif
101 
Base class for vectors utilized in finite-element and other PDE evaluations.
void AddElement(vtkIdType i, double value)
#define VTK_VMTK_L2_NORM
void SetElement(vtkIdType i, double value)
const double * GetArray()
vtkIdType NumberOfElementsPerVariable
#define VTK_VMTK_LINF_NORM
double GetElement(vtkIdType i)