|
libMesh
|
This class defines a tensor in LIBMESH_DIM dimensional space of type T.
More...
#include <tensor_tools.h>
Public Types | |
| typedef T | value_type |
| Helper typedef for C++98 generic programming. More... | |
| typedef std::tuple< unsigned int, unsigned int > | index_type |
| Helper typedef for generic index programming. More... | |
Public Member Functions | |
| TypeTensor () | |
| Empty constructor. More... | |
| template<typename T2 > | |
| TypeTensor (const TypeTensor< T2 > &p) | |
| Copy-constructor. More... | |
| ~TypeTensor () | |
| Destructor. More... | |
| template<typename T2 > | |
| void | assign (const TypeTensor< T2 > &) |
| Assign to this tensor without creating a temporary. More... | |
| template<typename Scalar > | |
| std::enable_if< ScalarTraits< Scalar >::value, TypeTensor & >::type | operator= (const Scalar &libmesh_dbg_var(p)) |
| Assignment-from-scalar operator. More... | |
| const T & | operator() (const unsigned int i, const unsigned int j) const |
| T & | operator() (const unsigned int i, const unsigned int j) |
| ConstTypeTensorColumn< T > | slice (const unsigned int i) const |
| TypeTensorColumn< T > | slice (const unsigned int i) |
| TypeVector< T > | row (const unsigned int r) const |
| TypeVector< T > | column (const unsigned int r) const |
| template<typename T2 > | |
| TypeTensor< typename CompareTypes< T, T2 >::supertype > | operator+ (const TypeTensor< T2 > &) const |
| Add another tensor to this tensor. More... | |
| template<typename T2 > | |
| const TypeTensor< T > & | operator+= (const TypeTensor< T2 > &) |
| Add to this tensor. More... | |
| template<typename T2 > | |
| void | add (const TypeTensor< T2 > &) |
| Add to this tensor without creating a temporary. More... | |
| template<typename T2 > | |
| void | add_scaled (const TypeTensor< T2 > &, const T &) |
| Add a scaled tensor to this tensor without creating a temporary. More... | |
| template<typename T2 > | |
| TypeTensor< typename CompareTypes< T, T2 >::supertype > | operator- (const TypeTensor< T2 > &) const |
| Subtract a tensor from this tensor. More... | |
| template<typename T2 > | |
| const TypeTensor< T > & | operator-= (const TypeTensor< T2 > &) |
| Subtract from this tensor. More... | |
| template<typename T2 > | |
| void | subtract (const TypeTensor< T2 > &) |
| Subtract from this tensor without creating a temporary. More... | |
| template<typename T2 > | |
| void | subtract_scaled (const TypeTensor< T2 > &, const T &) |
| Subtract a scaled value from this tensor without creating a temporary. More... | |
| TypeTensor< T > | operator- () const |
| template<typename Scalar > | |
| auto | operator* (const Scalar &scalar) const -> typename std::enable_if< ScalarTraits< Scalar >::value, TypeTensor< decltype(T() *scalar)>>::type |
| Multiply this tensor by a scalar value. More... | |
| template<typename Scalar , typename std::enable_if< ScalarTraits< Scalar >::value, int >::type = 0> | |
| const TypeTensor< T > & | operator*= (const Scalar &factor) |
| Multiply this tensor by a scalar value in place. More... | |
| template<typename Scalar > | |
| std::enable_if< ScalarTraits< Scalar >::value, TypeTensor< typename CompareTypes< T, Scalar >::supertype > >::type | operator/ (const Scalar &) const |
| Divide each entry of this tensor by a scalar value. More... | |
| const TypeTensor< T > & | operator/= (const T &) |
| Divide each entry of this tensor by a scalar value. More... | |
| template<typename T2 > | |
| TypeTensor< typename CompareTypes< T, T2 >::supertype > | operator* (const TypeTensor< T2 > &) const |
| Multiply 2 tensors together, i.e. More... | |
| template<typename T2 > | |
| const TypeTensor< T > & | operator*= (const TypeTensor< T2 > &) |
| Multiply this tensor by a tensor value in place. More... | |
| template<typename T2 > | |
| CompareTypes< T, T2 >::supertype | contract (const TypeTensor< T2 > &) const |
| Multiply 2 tensors together to return a scalar, i.e. More... | |
| template<typename T2 > | |
| TypeVector< typename CompareTypes< T, T2 >::supertype > | operator* (const TypeVector< T2 > &) const |
| Right-multiply this tensor by a vector, i.e. More... | |
| template<typename T2 > | |
| TypeVector< typename CompareTypes< T, T2 >::supertype > | left_multiply (const TypeVector< T2 > &p) const |
| Left-multiply this tensor by a vector, i.e. More... | |
| TypeTensor< T > | transpose () const |
| TypeTensor< T > | inverse () const |
| void | solve (const TypeVector< T > &b, TypeVector< T > &x) const |
| Solve the 2x2 or 3x3 system of equations A*x = b for x by directly inverting A and multiplying it by b. More... | |
| auto | norm () const |
| auto | norm_sq () const |
| bool | is_zero () const |
| T | det () const |
| T | tr () const |
| void | zero () |
| Set all entries of the tensor to 0. More... | |
| bool | operator== (const TypeTensor< T > &rhs) const |
| bool | operator< (const TypeTensor< T > &rhs) const |
| bool | operator> (const TypeTensor< T > &rhs) const |
| void | print (std::ostream &os=libMesh::out) const |
Formatted print to a stream which defaults to libMesh::out. More... | |
| void | write_unformatted (std::ostream &out_stream, const bool newline=true) const |
Unformatted print to the stream out. More... | |
| bool | is_hpd (Real rel_tol=TOLERANCE *TOLERANCE) const |
| Returns true if the TypeTensor is Hermitian (or symmetric, when T==Real) and positive-definite to within the provided relative tolerance, false otherwise. More... | |
| template<> | |
| bool | operator< (const TypeTensor< Real > &rhs) const |
| template<> | |
| bool | operator> (const TypeTensor< Real > &rhs) const |
| template<> | |
| bool | operator< (const TypeTensor< Complex > &rhs) const |
| template<> | |
| bool | operator> (const TypeTensor< Complex > &rhs) const |
Protected Member Functions | |
| TypeTensor (const T &xx, const T &xy=0, const T &xz=0, const T &yx=0, const T &yy=0, const T &yz=0, const T &zx=0, const T &zy=0, const T &zz=0) | |
| Constructor-from-T. More... | |
| template<typename Scalar > | |
| TypeTensor (const Scalar &xx, const Scalar &xy=0, const Scalar &xz=0, const Scalar &yx=0, const Scalar &yy=0, const Scalar &yz=0, const Scalar &zx=0, const Scalar &zy=0, typename std::enable_if< ScalarTraits< Scalar >::value, const Scalar >::type &zz=0) | |
| Constructor-from-Scalar. More... | |
| template<typename T2 > | |
| TypeTensor (const TypeVector< T2 > &vx) | |
| Constructor. More... | |
| template<typename T2 > | |
| TypeTensor (const TypeVector< T2 > &vx, const TypeVector< T2 > &vy) | |
| template<typename T2 > | |
| TypeTensor (const TypeVector< T2 > &vx, const TypeVector< T2 > &vy, const TypeVector< T2 > &vz) | |
Protected Attributes | |
| T | _coords [LIBMESH_DIM *LIBMESH_DIM] |
The coordinates of the TypeTensor. More... | |
Friends | |
| template<typename T2 > | |
| class | TypeTensor |
| std::ostream & | operator<< (std::ostream &os, const TypeTensor< T > &t) |
| Formatted print as above but supports the syntax: More... | |
This class defines a tensor in LIBMESH_DIM dimensional space of type T.
T may either be Real or Complex.
Definition at line 36 of file tensor_tools.h.
| typedef std::tuple<unsigned int, unsigned int> libMesh::TypeTensor< T >::index_type |
Helper typedef for generic index programming.
Definition at line 125 of file type_tensor.h.
| typedef T libMesh::TypeTensor< T >::value_type |
Helper typedef for C++98 generic programming.
Definition at line 120 of file type_tensor.h.
|
inline |
Empty constructor.
Gives the tensor 0 in LIBMESH_DIM dimensions.
Definition at line 517 of file type_tensor.h.
|
inlineexplicitprotected |
Constructor-from-T.
By default sets higher dimensional entries to 0. This is a poor constructor for 2D tensors - if the default arguments are to be overridden it requires that the "xz = 0." etc. arguments also be given explicitly.
Definition at line 540 of file type_tensor.h.
References libMesh::libmesh_ignore().
|
inlineexplicitprotected |
Constructor-from-Scalar.
Definition at line 586 of file type_tensor.h.
References libMesh::libmesh_ignore().
|
protected |
Constructor.
Assigns each vector to a different row of the tensor. We're in LIBMESH_DIM space dimensions and so LIBMESH_DIM many vectors are needed.
Definition at line 645 of file type_tensor.h.
|
protected |
Definition at line 653 of file type_tensor.h.
References libMesh::libmesh_ignore().
|
protected |
Definition at line 669 of file type_tensor.h.
References libMesh::libmesh_ignore().
|
inline |
Copy-constructor.
Definition at line 635 of file type_tensor.h.
References libMesh::TypeTensor< T >::_coords.
|
inline |
|
inline |
Add to this tensor without creating a temporary.
Definition at line 847 of file type_tensor.h.
References libMesh::TypeTensor< T >::_coords.
|
inline |
Add a scaled tensor to this tensor without creating a temporary.
Definition at line 858 of file type_tensor.h.
References libMesh::TypeTensor< T >::_coords.
Referenced by libMesh::HPCoarsenTest::add_projection(), LinearElasticityWithContact::compute_stresses(), LargeDeformationElasticity::compute_stresses(), libMesh::MeshFunction::hessian(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::System::point_hessian(), and libMesh::HPCoarsenTest::select_refinement().
|
inline |
Assign to this tensor without creating a temporary.
Definition at line 703 of file type_tensor.h.
References libMesh::TypeTensor< T >::_coords.
|
inline |
Definition at line 786 of file type_tensor.h.
References libMesh::TypeVector< T >::_coords.
Referenced by TypeTensorTest::testRowCol().
|
inline |
Multiply 2 tensors together to return a scalar, i.e.
Multiply 2 tensors together, i.e.
\( \sum_{ij} A_{ij} B_{ij} \) The tensors may contain different numeric types. Also known as the "double inner product" or "double dot product" of tensors.
sum Aij*Bij. The tensors may be of different types.
Definition at line 1275 of file type_tensor.h.
References libMesh::TypeTensor< T >::_coords.
Referenced by libMesh::HPCoarsenTest::add_projection(), libMesh::VariationalSmootherSystem::element_time_derivative(), libMesh::TensorTools::inner_product(), and libMesh::HPCoarsenTest::select_refinement().
|
inline |
Because these are 3x3 tensors at most, we don't do an LU decomposition like DenseMatrix does.
Definition at line 1306 of file type_tensor.h.
Referenced by libMesh::VariationalSmootherSystem::compute_mesh_quality_info(), LargeDeformationElasticity::compute_stresses(), libMesh::VariationalSmootherSystem::element_time_derivative(), libMesh::Hex::quality(), and libMesh::Sphere::Sphere().
|
inline |
Definition at line 1087 of file type_tensor.h.
References b.
Referenced by NonlinearNeoHookeCurrentConfig::calculate_stress(), libMesh::VariationalSmootherSystem::element_time_derivative(), libMesh::VariationalSmootherSystem::get_target_to_reference_jacobian(), and TypeTensorTest::testInverse().
| bool libMesh::TypeTensor< T >::is_hpd | ( | Real | rel_tol = TOLERANCE*TOLERANCE | ) | const |
Returns true if the TypeTensor is Hermitian (or symmetric, when T==Real) and positive-definite to within the provided relative tolerance, false otherwise.
Definition at line 67 of file type_tensor.C.
References libMesh::libmesh_conj(), libMesh::TensorTools::norm(), and std::real().
Referenced by TypeTensorTest::testIsHPD().
|
inline |
Definition at line 1296 of file type_tensor.h.
Referenced by TypeTensorTest::testIsZero().
|
inline |
Left-multiply this tensor by a vector, i.e.
matrix-vector product. The tensor and vector may contain different numeric types.
Definition at line 1218 of file type_tensor.h.
|
inline |
Definition at line 1287 of file type_tensor.h.
References libMesh::TensorTools::norm_sq().
|
inline |
Definition at line 1356 of file type_tensor.h.
References libMesh::TensorTools::norm_sq(), and libMesh::Real.
Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::ExactErrorEstimator::find_squared_element_error(), libMesh::TensorTools::norm_sq(), and libMesh::HPCoarsenTest::select_refinement().
|
inline |
Definition at line 713 of file type_tensor.h.
|
inline |
Definition at line 732 of file type_tensor.h.
|
inline |
Multiply this tensor by a scalar value.
Definition at line 972 of file type_tensor.h.
|
inline |
Multiply 2 tensors together, i.e.
matrix-matrix product. The tensors may contain different numeric types.
Definition at line 1240 of file type_tensor.h.
|
inline |
Right-multiply this tensor by a vector, i.e.
matrix-vector product. The tensor and vector may contain different numeric types.
Definition at line 1204 of file type_tensor.h.
|
inline |
Multiply this tensor by a scalar value in place.
Definition at line 268 of file type_tensor.h.
References libMesh::TypeTensor< T >::_coords.
|
inline |
Multiply this tensor by a tensor value in place.
Definition at line 1254 of file type_tensor.h.
|
inline |
Add another tensor to this tensor.
Definition at line 801 of file type_tensor.h.
References libMesh::TypeTensor< T >::_coords.
|
inline |
Add to this tensor.
Definition at line 835 of file type_tensor.h.
|
inline |
Subtract a tensor from this tensor.
Definition at line 871 of file type_tensor.h.
References libMesh::TypeTensor< T >::_coords.
|
inline |
Definition at line 938 of file type_tensor.h.
|
inline |
Subtract from this tensor.
Definition at line 905 of file type_tensor.h.
|
inline |
Divide each entry of this tensor by a scalar value.
Definition at line 1022 of file type_tensor.h.
|
inline |
Divide each entry of this tensor by a scalar value.
Definition at line 1187 of file type_tensor.h.
| bool libMesh::TypeTensor< Real >::operator< | ( | const TypeTensor< Real > & | rhs | ) | const |
Definition at line 124 of file type_tensor.C.
| bool libMesh::TypeTensor< Complex >::operator< | ( | const TypeTensor< Complex > & | rhs | ) | const |
Definition at line 157 of file type_tensor.C.
References std::imag(), and std::real().
| bool libMesh::TypeTensor< T >::operator< | ( | const TypeTensor< T > & | rhs | ) | const |
true if this tensor is "less" than another. Useful for sorting.
|
inline |
Assignment-from-scalar operator.
Used only to zero out vectors.
Definition at line 153 of file type_tensor.h.
References libMesh::TypeTensor< T >::zero().
|
inline |
true if two tensors are equal, false otherwise. Definition at line 1368 of file type_tensor.h.
References libMesh::TypeTensor< T >::_coords, and libMesh::TOLERANCE.
| bool libMesh::TypeTensor< Real >::operator> | ( | const TypeTensor< Real > & | rhs | ) | const |
Definition at line 140 of file type_tensor.C.
| bool libMesh::TypeTensor< Complex >::operator> | ( | const TypeTensor< Complex > & | rhs | ) | const |
Definition at line 177 of file type_tensor.C.
References std::imag(), and std::real().
| bool libMesh::TypeTensor< T >::operator> | ( | const TypeTensor< T > & | rhs | ) | const |
true if this tensor is "greater" than another. | void libMesh::TypeTensor< T >::print | ( | std::ostream & | os = libMesh::out | ) | const |
Formatted print to a stream which defaults to libMesh::out.
Definition at line 1399 of file type_tensor.h.
|
inline |
Definition at line 772 of file type_tensor.h.
References libMesh::TypeVector< T >::_coords.
Referenced by TypeTensorTest::testRowCol().
|
inline |
Definition at line 752 of file type_tensor.h.
|
inline |
Definition at line 762 of file type_tensor.h.
|
inline |
Solve the 2x2 or 3x3 system of equations A*x = b for x by directly inverting A and multiplying it by b.
x vector. Definition at line 1136 of file type_tensor.h.
References b.
Referenced by InfFERadialTest::base_point(), and libMesh::InfFEMap::inverse_map().
|
inline |
Subtract from this tensor without creating a temporary.
Definition at line 917 of file type_tensor.h.
References libMesh::TypeTensor< T >::_coords.
|
inline |
Subtract a scaled value from this tensor without creating a temporary.
Definition at line 928 of file type_tensor.h.
References libMesh::TypeTensor< T >::_coords.
Referenced by libMesh::HPCoarsenTest::select_refinement().
|
inline |
Definition at line 1329 of file type_tensor.h.
|
inline |
Definition at line 1057 of file type_tensor.h.
Referenced by assemble_shell(), libMesh::VariationalSmootherSystem::compute_mesh_quality_info(), LargeDeformationElasticity::compute_stresses(), libMesh::VariationalSmootherSystem::element_time_derivative(), libMesh::get_jacobian_at_qp(), CurlCurlExactSolution::grad(), GradDivExactSolution::grad(), and TypeTensorTest::testIsHPD().
| void libMesh::TypeTensor< T >::write_unformatted | ( | std::ostream & | out_stream, |
| const bool | newline = true |
||
| ) | const |
Unformatted print to the stream out.
Simply prints the elements of the tensor separated by spaces and newlines.
Definition at line 39 of file type_tensor.C.
References libMesh::libmesh_assert().
|
inline |
Set all entries of the tensor to 0.
Definition at line 1346 of file type_tensor.h.
Referenced by LinearElasticityWithContact::compute_stresses(), LargeDeformationElasticity::compute_stresses(), NonlinearNeoHookeCurrentConfig::init_for_qp(), libMesh::TensorValue< T >::operator=(), and libMesh::TypeTensor< T >::operator=().
|
friend |
Formatted print as above but supports the syntax:
Definition at line 426 of file type_tensor.h.
Definition at line 55 of file type_tensor.h.
|
protected |
The coordinates of the TypeTensor.
Definition at line 451 of file type_tensor.h.
Referenced by libMesh::TypeTensor< T >::add(), libMesh::TypeTensor< T >::add_scaled(), libMesh::TypeTensor< T >::assign(), libMesh::TypeTensor< T >::contract(), libMesh::TypeTensor< T >::operator*=(), libMesh::TypeTensor< T >::operator+(), libMesh::TypeTensor< T >::operator-(), libMesh::TypeTensor< T >::operator==(), libMesh::TypeTensor< T >::subtract(), libMesh::TypeTensor< T >::subtract_scaled(), and libMesh::TypeTensor< T >::TypeTensor().
1.8.14