Line data Source code
1 : # NOTE: The following methods are not part of PMeshAttributes to avoid 2 : # a dependency on BaseUtilities. 3 : 4 : """ 5 : X = scmat(attr) 6 : Xmat = X[] 7 : XVec = X[:] 8 : 9 : Short for `X = BaseUtilities.scmatrix(vec(attr))`. Provides **views** of 10 : mesh attribute `x` as `Matrix` with vectors in columns or `Vector` of 11 : vectors. 12 : 13 : See also [`mat`](@ref), [`cols`](@ref) 14 : """ 15 4 : scmat(a::PMeshAttributes.Attribute) = scmatrix(vec(a)) 16 : 17 : """ 18 : X = mat(attr) 19 : xj = X[:, j] # equals vec(attr)[j] 20 : 21 : Short for `X = BaseUtilities.scmatrix(vec(attr))`. Provides **view** of 22 : mesh attribute `x` as `Matrix` with vectors in columns. 23 : 24 : !!! tip 25 : [`cols`](@ref) provides the transposed `mat(attr)'`, e.g., for 26 : use as solution or rhs on a linear system. 27 : 28 : !!! note 29 : A change of 30 : 31 : See also [`scmat`](@ref), [`cols`](@ref) 32 : """ 33 4 : mat(a::PMeshAttributes.Attribute) = scmat(a)[] 34 : 35 : """ 36 : X = cols(attr) 37 : x1 = X[:, 1] # == first.(vec(cols(attr))) 38 : 39 : Short for `X = BaseUtilities.scmatrix(vec(attr))`. Provides **view** of 40 : mesh attribute `x` as `Adjoint{Matrix}` with vectors in rows. This is 41 : the transposed of [`mat`](@ref). 42 : 43 : !!! note 44 : One use case is `cols(attr) .= A \\ b`, which changes `attr`. 45 : 46 : See also [`mat`](@ref), [`scmat`](@ref) 47 : """ 48 : 49 2 : cols(a::PMeshAttributes.Attribute) = mat(a)'