Gridap.TensorValues
Gridap.TensorValues
— ModuleThis module provides concrete implementations of Number
that represent 1st, 2nd and general order tensors.
Why
The main feature of this module is that the provided types do not extend from AbstractArray
, but from Number
!
This allows one to work with them as if they were scalar values in broadcasted operations on arrays of VectorValue
objects (also for TensorValue
or MultiValue
objects). For instance, one can perform the following manipulations:
# Assing a VectorValue to all the entries of an Array of VectorValues
A = zeros(VectorValue{2,Int}, (4,5))
v = VectorValue(12,31)
A .= v # This is posible since VectorValue <: Number
# Broatcasing of tensor operations in arrays of TensorValues
t = TensorValue(13,41,53,17) # creates a 2x2 TensorValue
g = TensorValue(32,41,3,14) # creates another 2x2 TensorValue
B = fill(t,(1,5))
C = inner.(g,B) # inner product of g against all TensorValues in the array B
@show C
# C = [2494 2494 2494 2494 2494]
The exported names are:
Exported types
Gridap.TensorValues.MultiValue
— TypeType representing a multi-dimensional value
Gridap.TensorValues.VectorValue
— TypeType representing a first-order tensor
Gridap.TensorValues.TensorValue
— TypeType representing a second-order tensor
Constructors
Gridap.TensorValues.mutable
— FunctionGridap.TensorValues.change_eltype
— FunctionGridap.TensorValues.diagonal_tensor
— FunctionInfo getters
Gridap.TensorValues.n_components
— Functionn_components(::Type)
Returns the number of components stored in the given type. Implemented for types <:Real
and <:MultiValue
. Also available for instances of these types.
Operations
Gridap.TensorValues.inner
— FunctionGridap.TensorValues.outer
— Functionouter(∇,f)
Equivalent to
gradient(f)
outer(f,∇)
Equivalent to
transpose(gradient(f))
Gridap.TensorValues.meas
— FunctionGridap.TensorValues.symmetic_part
— Function