Initialize reduction objects according to the variable systems
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_reduction_spatial_type), | intent(out), | allocatable | :: | me(:) |
array of reductions to initialize |
|
type(tem_reduction_spatial_config_type), | intent(in) | :: | redSpatial_config | |||
type(tem_varSys_type), | intent(in) | :: | varSys |
global variable system defined in solver |
||
integer, | intent(in) | :: | varPos(:) |
position of variable to reduce in the global varSys |
subroutine tem_reduction_spatial_init( me, redSpatial_config, varSys, varPos ) ! --------------------------------------------------------------------------- !> array of reductions to initialize type( tem_reduction_spatial_type ), intent(out), allocatable :: me(:) type( tem_reduction_spatial_config_type ), intent(in) :: redSpatial_config !> global variable system defined in solver type( tem_varSys_type ), intent(in) :: varSys !> position of variable to reduce in the global varSys integer, intent(in) :: varPos(:) ! --------------------------------------------------------------------------- ! type( tem_reduction_spatial_type ), allocatable :: tmpRdc(:) integer :: iRdc, nVars ! --------------------------------------------------------------------------- write(logUnit(1),*) 'Initializing reduction ...' nVars = size(varPos) ! check if the amount of reduction greater than amount of variables if( size( redSpatial_config%reduceType ) > nVars ) then write(logUnit(1),*) 'The number of reduction is more than the '// & & 'number of variables!' write(logUnit(1),*) 'Ignore the additional reductions!' endif ! allocate( tmpRdc( nVars )) ! do iRdc = 1, nVars ! tmpRdc( iRdc ) = me( iRdc ) ! end do ! deallocate( me ) ! allocate( me( nVars )) ! do iRdc = 1, nVars ! me( iRdc ) = tmpRdc( iRdc ) ! end do ! deallocate( tmpRdc ) allocate( me( nVars ) ) do iRdc = 1, nVars me( iRdc )%reduceType = trim( redSpatial_config%reduceType( iRdc ) ) me( iRdc )%nComponents = varSys%method%val( varPos(iRdc) )%nComponents allocate( me( iRdc )%val( me(iRdc)%nComponents )) me( iRdc )%val(:) = 0._rk end do end subroutine tem_reduction_spatial_init