VTK
|
helper class that stores a tensor of arbitrary rank and dimension More...
#include <vtkMomentsTensor.h>
Public Member Functions | |
vtkMomentsTensor () | |
empty constructor More... | |
vtkMomentsTensor (size_t dimension, size_t rank, size_t fieldRank) | |
constructor allocating the data vector More... | |
vtkMomentsTensor (vtkMomentsTensor *tensor) | |
copy constructor More... | |
vtkMomentsTensor (size_t dimension, size_t rank, size_t fieldRank, size_t momentRank) | |
constructor allocating the data vector More... | |
vtkMomentsTensor (Eigen::MatrixXd data) | |
copy constructor from eigen matrix More... | |
size_t | getIndex (const std::vector< size_t > &indices) |
inverse function to getIndices More... | |
size_t | getRank () |
get rank of the tensor, i.e. More... | |
size_t | getFieldRank () |
get field rank, 0 for scalars, 1 for vectors, 3 for matrices More... | |
size_t | getMomentRank () |
get moment rank, order of the moment tensor More... | |
size_t | getDimension () |
get dimension, e.g. More... | |
std::vector< double > | getData () |
get data vector More... | |
std::vector< size_t > | getContractionInfo () |
get the vector with the indices that indicate which tensor this one was produced from through contraction More... | |
std::vector< size_t > | getProductInfo () |
get the vector with the indices that indicate which tensor this one was produced from through multiplication More... | |
size_t | size () |
get the number of entries of this tensor More... | |
std::vector< size_t > | getIndices (size_t index) |
inverse function to getIndex More... | |
std::vector< size_t > | getIndexSum (size_t index) |
this function adds the numbers of zeros, ones, and twos in the tensor index it is used to determine the tensor's properties under reflection iff the sum is odd, the sign of the entry changes More... | |
std::vector< size_t > | getMomentIndices (size_t index) |
the moment tensors have two types of indices fieldIndices and momentIndices fieldIndices of length fieldRank refer to the components of the original data (3 for vector, 9 for matrix) momentIndices of length momentRank refer to the basis function More... | |
std::vector< size_t > | getFieldIndices (size_t index) |
the moment tensors have two types of indices fieldIndices and momentIndices fieldIndices of length fieldRank refer to the components of the original data (3 for vector, 9 for matrix) momentIndices of length momentRank refer to the basis function More... | |
size_t | getFieldIndex (size_t index) |
IMPORTANT this function forms the bridge to vtk it translates the order of the fieldIndices to vtk's order as used by vtkDoubleArray.SetTuple() there the values are stored as follows: 2D and 3D: scalar: 0, vector: 0,1,2 matrix: 00,10,20,01,11,21,02,12,22 2D has zeros in the indices containing a 2. More... | |
double | get (const std::vector< size_t > &indices) |
Get data entry for given tensor indices. More... | |
double | get (size_t index) |
Get data entry for given flat c++ vector index. More... | |
void | set (const std::vector< size_t > &indices, double value) |
Set data entry for given tensor indices. More... | |
void | set (size_t index, double value) |
Set data entry for given tensor indices. More... | |
void | set (const std::vector< double > &data) |
Set the whole data vector. More... | |
vtkMomentsTensor | contract () |
This function produces a tensor contraction of the last two indices T'i = sum{j=k} T_ijk (i is multiindex) for arbitrary contractions, use the transpose function and move the indices there prior to calling this function. More... | |
vtkMomentsTensor | contract (size_t i, size_t j) |
This function produces a tensor contraction of the indices i and k T'i = sum{j=k} T_ijk (i is multiindex) we use the transpose function and move the indices i and k to the end and then call the contract() function. More... | |
vtkMomentsTensor | contract (std::vector< size_t > contractor) |
This function produces a tensor contraction of the indices stored in contractor. More... | |
void | print () |
This function prints the properties of this tensor. More... | |
std::vector< vtkMomentsTensor > | contractAll () |
This function produces a list of all possible 2-index combinations, which is used to generate all possible contractions. More... | |
double | norm () |
This function computes the Euclidean norm of the tensor. More... | |
std::vector< size_t > | getOrders (size_t index) |
for vector and matrix fields, the last indizes don't belong to the moment-indices, but the fieldIndex the number of zeros in the moment-indices equals p in the basis function x^p*y^q*z^r the number of one in a tensor-multiindex equals q in the basis function x^p*y^q*z^r the number of twos in a tensor-multiindex equals r in the basis function x^p*y^q*z^r More... | |
vtkMomentsTensor | rotate (Eigen::MatrixXd rotMat) |
rotate the tensor More... | |
Eigen::VectorXd | getVector () |
convenience function converting a rank 1 tensor into a vector More... | |
Eigen::MatrixXd | getMatrix () |
convenience function converting a rank 2 tensor into a matrix More... | |
std::vector< vtkMomentsTensor > | eigenVectors () |
this function computes the eigenvectors of a rank 2 tensor they are not normalized, but weighted with how distinct their corresponding eigenvalues are e.g. More... | |
void | otherEV () |
if we have a rank 1 tensor that was made from an eigenvector, its sign is arbitrary that means for the standard position, we need to take it and its negative into account this function generates the negative its contractionInfo is encoded as the eigenvector index plus the dimension e.g. More... | |
Static Public Member Functions | |
static vtkMomentsTensor | tensorProduct (vtkMomentsTensor tensor1, vtkMomentsTensor tensor2) |
multiply two tensors. More... | |
static vtkMomentsTensor | tensorSum (vtkMomentsTensor tensor1, vtkMomentsTensor tensor2, double a, double b) |
sum two tensors. More... | |
static double | tensorDistance (vtkMomentsTensor tensor1, vtkMomentsTensor tensor2) |
Euclidean distance between two tensors. More... | |
static vtkMomentsTensor | getEpsilon (size_t dimension) |
this function produces the anti-symmetric Levi-Civita tensor More... | |
helper class that stores a tensor of arbitrary rank and dimension
A tensor in general is a multidimensional array its rank gives the number of indices to reference its entries the number of entries is dimension^rank the application of this class is the moment invariant pattern detection the theory and the algorithm is described in Roxana Bujack and Hans Hagen: "Moment Invariants for Multi-Dimensional Data" http://www.informatik.uni-leipzig.de/~bujack/2017TensorDagstuhl.pdf for this purpose, we split the rank into fieldrank and moment rank the class mainly first multiplies and the contracts moment tensors and tracks these processes.
Definition at line 89 of file vtkMomentsTensor.h.
|
inline |
empty constructor
Definition at line 226 of file vtkMomentsTensor.h.
|
inline |
constructor allocating the data vector
dimension | e.g. 2D or 3D |
rank | rank of the tensor, i.e. number of indices to reference its entries |
fieldRank | 0 for scalars, 1 for vectors, 3 for matrices |
Definition at line 240 of file vtkMomentsTensor.h.
|
inline |
copy constructor
Definition at line 253 of file vtkMomentsTensor.h.
|
inline |
constructor allocating the data vector
dimension | e.g. 2D or 3D |
rank | rank of the tensor, i.e. number of indices to reference its entries |
fieldRank | 0 for scalars, 1 for vectors, 3 for matrices |
momentRank | order of the moment tensor |
Definition at line 271 of file vtkMomentsTensor.h.
|
inline |
copy constructor from eigen matrix
Definition at line 284 of file vtkMomentsTensor.h.
|
inline |
inverse function to getIndices
indices | vector of tensor indices that identify an entry |
Definition at line 302 of file vtkMomentsTensor.h.
|
inline |
get rank of the tensor, i.e.
number of indices to reference its entries
Definition at line 317 of file vtkMomentsTensor.h.
|
inline |
get field rank, 0 for scalars, 1 for vectors, 3 for matrices
Definition at line 322 of file vtkMomentsTensor.h.
|
inline |
get moment rank, order of the moment tensor
Definition at line 327 of file vtkMomentsTensor.h.
|
inline |
|
inline |
get data vector
Definition at line 337 of file vtkMomentsTensor.h.
|
inline |
get the vector with the indices that indicate which tensor this one was produced from through contraction
Definition at line 343 of file vtkMomentsTensor.h.
|
inline |
get the vector with the indices that indicate which tensor this one was produced from through multiplication
Definition at line 349 of file vtkMomentsTensor.h.
|
inline |
get the number of entries of this tensor
Definition at line 354 of file vtkMomentsTensor.h.
|
inline |
inverse function to getIndex
index | the place in the flat c++ std vector |
Definition at line 361 of file vtkMomentsTensor.h.
|
inline |
this function adds the numbers of zeros, ones, and twos in the tensor index it is used to determine the tensor's properties under reflection iff the sum is odd, the sign of the entry changes
Definition at line 378 of file vtkMomentsTensor.h.
|
inline |
the moment tensors have two types of indices fieldIndices and momentIndices fieldIndices of length fieldRank refer to the components of the original data (3 for vector, 9 for matrix) momentIndices of length momentRank refer to the basis function
index | the place in the flat c++ std vector |
Definition at line 396 of file vtkMomentsTensor.h.
|
inline |
the moment tensors have two types of indices fieldIndices and momentIndices fieldIndices of length fieldRank refer to the components of the original data (3 for vector, 9 for matrix) momentIndices of length momentRank refer to the basis function
index | the place in the flat c++ std vector |
Definition at line 421 of file vtkMomentsTensor.h.
|
inline |
IMPORTANT this function forms the bridge to vtk it translates the order of the fieldIndices to vtk's order as used by vtkDoubleArray.SetTuple() there the values are stored as follows: 2D and 3D: scalar: 0, vector: 0,1,2 matrix: 00,10,20,01,11,21,02,12,22 2D has zeros in the indices containing a 2.
index | the place in the flat c++ std vector of this class |
Definition at line 454 of file vtkMomentsTensor.h.
|
inline |
Get data entry for given tensor indices.
Definition at line 467 of file vtkMomentsTensor.h.
|
inline |
Get data entry for given flat c++ vector index.
Definition at line 472 of file vtkMomentsTensor.h.
|
inline |
Set data entry for given tensor indices.
Definition at line 477 of file vtkMomentsTensor.h.
|
inline |
Set data entry for given tensor indices.
Definition at line 485 of file vtkMomentsTensor.h.
|
inline |
Set the whole data vector.
Definition at line 490 of file vtkMomentsTensor.h.
|
inline |
This function produces a tensor contraction of the last two indices T'i = sum{j=k} T_ijk (i is multiindex) for arbitrary contractions, use the transpose function and move the indices there prior to calling this function.
Definition at line 499 of file vtkMomentsTensor.h.
|
inline |
This function produces a tensor contraction of the indices i and k T'i = sum{j=k} T_ijk (i is multiindex) we use the transpose function and move the indices i and k to the end and then call the contract() function.
i index for contraction | |
k index for contraction |
Definition at line 536 of file vtkMomentsTensor.h.
|
inline |
This function produces a tensor contraction of the indices stored in contractor.
contractor | list of indices to be contracted |
Definition at line 569 of file vtkMomentsTensor.h.
|
inline |
This function prints the properties of this tensor.
Definition at line 616 of file vtkMomentsTensor.h.
|
inline |
This function produces a list of all possible 2-index combinations, which is used to generate all possible contractions.
Definition at line 667 of file vtkMomentsTensor.h.
|
inline |
This function computes the Euclidean norm of the tensor.
Definition at line 684 of file vtkMomentsTensor.h.
|
inline |
for vector and matrix fields, the last indizes don't belong to the moment-indices, but the fieldIndex the number of zeros in the moment-indices equals p in the basis function x^p*y^q*z^r the number of one in a tensor-multiindex equals q in the basis function x^p*y^q*z^r the number of twos in a tensor-multiindex equals r in the basis function x^p*y^q*z^r
index | the place in the flat c++ std vector |
Definition at line 702 of file vtkMomentsTensor.h.
|
inline |
rotate the tensor
rotMat | rotation matrix that is applied |
Definition at line 719 of file vtkMomentsTensor.h.
|
inlinestatic |
multiply two tensors.
the rank of the result is the sum of the ranks of its parents
tensor1 | factor |
tensor2 | factor |
Definition at line 754 of file vtkMomentsTensor.h.
|
inlinestatic |
sum two tensors.
the rank of the result is the same as the rank of its parents
tensor1 | summand |
tensor2 | summand |
Definition at line 786 of file vtkMomentsTensor.h.
|
inlinestatic |
Euclidean distance between two tensors.
tensor1 | tensor |
tensor2 | tensor |
Definition at line 818 of file vtkMomentsTensor.h.
|
inline |
convenience function converting a rank 1 tensor into a vector
Definition at line 827 of file vtkMomentsTensor.h.
|
inline |
convenience function converting a rank 2 tensor into a matrix
Definition at line 846 of file vtkMomentsTensor.h.
|
inlinestatic |
this function produces the anti-symmetric Levi-Civita tensor
Definition at line 864 of file vtkMomentsTensor.h.
|
inline |
this function computes the eigenvectors of a rank 2 tensor they are not normalized, but weighted with how distinct their corresponding eigenvalues are e.g.
if an eigenvalue appears twice, the corresponding vectors will be weighted with zero
Definition at line 892 of file vtkMomentsTensor.h.
|
inline |
if we have a rank 1 tensor that was made from an eigenvector, its sign is arbitrary that means for the standard position, we need to take it and its negative into account this function generates the negative its contractionInfo is encoded as the eigenvector index plus the dimension e.g.
the largest 3D EV will have a 0 andits negative a 3
Definition at line 987 of file vtkMomentsTensor.h.