Convert
Convert method changes the storage pattern of matrix.
Interface 1
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE PURE SUBROUTINE convert(From, To, Conversion, nns, tdof)
REAL(DFP), INTENT(IN) :: From(:, :)
!! Matrix in one format
REAL(DFP), INTENT(INOUT), ALLOCATABLE :: To(:, :)
!! Matrix is desired format
INTEGER(I4B), INTENT(IN) :: Conversion
!! `Conversion` can be `NodesToDOF` or `DOFToNodes`
INTEGER(I4B), INTENT(IN) :: nns, tdof
END SUBROUTINE convert
END INTERFACE
This subroutine changes the storage pattern of a 2D matrix.
- Usually element matrix in easifem are stored in
FMT_DOF
- Global matrices/tanmat, however, are stored in
FMT_Nodes
note
All dof should have the same order of interpolation, therefore, this routine works when matrix is square.
Interface 2
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE PURE SUBROUTINE convert(From, To)
REAL(DFP), INTENT(IN) :: From(:, :, :, :)
REAL(DFP), ALLOCATABLE, INTENT(INOUT) :: To(:, :)
END SUBROUTINE convert
END INTERFACE
This subroutine converts a rank-4 matrix to rank-2 matrix.
Interface 3
- ܀ Interface
- ️܀ See example
- ↢
INTERFACE
MODULE PURE SUBROUTINE convert(From, To)
REAL(DFP), INTENT(IN) :: From(:, :, :, :, :, :)
!! I, J, ii, jj, a, b
REAL(DFP), ALLOCATABLE, INTENT(INOUT) :: To(:, :, :, :)
!! I, J, a, b
END SUBROUTINE convert
END INTERFACE
This subroutine converts a rank-6 matrix to rank-4 matrix.
Here we convert a 6D matrix to 4D matrix
PROGRAM main
USE easifemBase
IMPLICIT NONE
real(DFP), allocatable :: m6(:,:,:,:,:,:), m4(:,:, :, :)
CALL Reallocate( m6, 3, 2, 2, 1, 1, 1 )
m6(:,:,1,1,1,1)= 2.0*ones(3,2, TypeDFP)
m6(:,:,2,1,1,1)= 4.0*ones(3,2, TypeDFP)
CALL Convert( from=m6, to=m4 )
CALL Display( MdEncode(m4), 'm4=' )
END PROGRAM main
m4=(:, :, 1, 1) =
2 | 2 |
2 | 2 |
2 | 2 |
4 | 4 |
4 | 4 |
4 | 4 |