enable to non-transposed tensor data
usually, we store per data per cell, i.e. len(shape(x)) == 3 means x is a tensor. Due to the use of transposed tensors (due to column-major storage order in Fortran), we usually want to store the transpose of (3x3) tensors. Now the default can be changed
This commit is contained in:
parent
008f717c08
commit
b386dc73b2
|
@ -753,7 +753,7 @@ subroutine tElement_init(self,elemType)
|
|||
self%cell = CELL10
|
||||
end select
|
||||
|
||||
self%NcellNodesPerCell = NCELLNODEPERCELL(self%cellType)
|
||||
self%NcellnodesPerCell = NCELLNODEPERCELL(self%cellType)
|
||||
|
||||
select case(self%cellType)
|
||||
case(1)
|
||||
|
|
|
@ -296,21 +296,35 @@ end subroutine results_writeVectorDataset_real
|
|||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief stores a tensor dataset in a group
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
subroutine results_writeTensorDataset_real(group,dataset,label,description,SIunit)
|
||||
subroutine results_writeTensorDataset_real(group,dataset,label,description,SIunit,transposed)
|
||||
|
||||
character(len=*), intent(in) :: label,group,description
|
||||
character(len=*), intent(in), optional :: SIunit
|
||||
logical, intent(in), optional :: transposed
|
||||
real(pReal), intent(in), dimension(:,:,:) :: dataset
|
||||
|
||||
integer :: i
|
||||
logical :: T
|
||||
integer(HID_T) :: groupHandle
|
||||
real(pReal), dimension(:,:,:), allocatable :: dataset_transposed
|
||||
|
||||
|
||||
allocate(dataset_transposed,mold=dataset)
|
||||
do i=1,size(dataset,3)
|
||||
dataset_transposed(1:3,1:3,i) = transpose(dataset(1:3,1:3,i))
|
||||
enddo
|
||||
if(present(transposed)) then
|
||||
T = transposed
|
||||
else
|
||||
T = .true.
|
||||
endif
|
||||
|
||||
if(T) then
|
||||
if(size(dataset_transposed,1) /= size(dataset_transposed,2)) &
|
||||
call IO_error(0,ext_msg='transpose non-symmetric tensor')
|
||||
allocate(dataset_transposed,mold=dataset)
|
||||
do i=1,size(dataset_transposed,3)
|
||||
dataset_transposed(:,:,i) = transpose(dataset(:,:,i))
|
||||
enddo
|
||||
else
|
||||
allocate(dataset_transposed,source=dataset)
|
||||
endif
|
||||
|
||||
groupHandle = results_openGroup(group)
|
||||
|
||||
|
|
Loading…
Reference in New Issue