vtkbone
vtkboneTensor.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkboneTensor.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
28#ifndef vtkboneTensor_h
29#define vtkboneTensor_h
30
31#include "vtkObject.h"
32#include "vtkboneWin32Header.h"
33
34class VTKBONE_EXPORT vtkboneTensor : public vtkObject
35{
36public:
37 static vtkboneTensor *New();
38 vtkTypeMacro(vtkboneTensor,vtkObject);
39 void PrintSelf(ostream& os, vtkIndent indent) override;
40
42 void Initialize();
43
45 double GetComponent(int i, int j) {return this->T[i+3*j];};
46
48
49 void SetComponent(int i, int j, double v) {if (i > 2 || j > 2) {vtkErrorMacro("trying to set tensor component i or j > 2: i = " << i << ", j = " << j); return;}; this->T[i+3*j] = v;};
51
53
54 void AddComponent(int i, int j, double v) { if (i > 2 || j > 2) {vtkErrorMacro("trying to add tensor component i or j > 2: i = " << i << ", j = " << j); return;}; this->T[i+3*j] += v;};
56
58
60 double *GetColumn(int j) { if (j > 2) {vtkErrorMacro("trying to get tensor column j > 2: j = " << j); return NULL;}; return this->T + 3*j;};
62
64 void DeepCopy(vtkboneTensor *t);
65
67 operator double*() {return this->T;};
68
70 double *T;
71
72protected:
75
76 double Storage[9];
77private:
78 vtkboneTensor(const vtkboneTensor&); // Not implemented.
79 void operator=(const vtkboneTensor&); // Not implemented.
80};
81
82//----------------------------------------------------------------------------
84{
85 for (int j=0; j<3; j++)
86 {
87 for (int i=0; i<3; i++)
88 {
89 this->T[i+j*3] = 0.0;
90 }
91 }
92}
93
94//----------------------------------------------------------------------------
96{
97 for (int j=0; j < 3; j++)
98 {
99 for (int i=0; i < 3; i++)
100 {
101 this->T[i+3*j] = t->T[i+3*j];
102 }
103 }
104}
105
106#endif
void operator=(const vtkObjectBase &)
supporting class to enable assignment and referencing of tensors
double * GetColumn(int j)
void AddComponent(int i, int j, double v)
void DeepCopy(vtkboneTensor *t)
void PrintSelf(ostream &os, vtkIndent indent) override
static vtkboneTensor * New()
double GetComponent(int i, int j)
void SetComponent(int i, int j, double v)
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)