Append a new auxiliaryField variable to the variable system.
Note that the actual data on how to access the state has to be encoded in the method_data pointer. The callers therefore have to ensure the consistency of those access definitions. nComponents has to be at least 1.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_varSys_type), | intent(inout) | :: | me |
Variable system to append the state variable to. |
||
character(len=*), | intent(in) | :: | varname |
Variable to append to the state. |
||
integer, | intent(in) | :: | nComponents |
Number of components in this variable. |
||
type(c_ptr), | intent(in) | :: | method_data |
Data that is required by the methods to obtain the variable. |
||
procedure(tem_varSys_proc_point), | pointer | :: | get_point |
Procedure which allows the retrieval of the variable at given points. |
||
procedure(tem_varSys_proc_element), | pointer | :: | get_element |
Procedure which allows the retrieval of the variable in an element. |
||
procedure(tem_varSys_proc_setParams), | optional, | pointer | :: | set_params |
Procedure which allows to set parameter in method_data |
|
procedure(tem_varSys_proc_getParams), | optional, | pointer | :: | get_params |
Procedure which allows to get parameter in method_data |
|
procedure(tem_varSys_proc_setupIndices), | pointer | :: | setup_indices |
Procedure to setup growing array of points, variable value in method_data and return index of points set |
||
procedure(tem_varSys_proc_getValOfIndex), | pointer | :: | get_valOfIndex |
Procedure which allows to retrieval of the variable at point or val array index |
||
integer, | intent(out), | optional | :: | pos |
Position of the variable in the system. |
|
logical, | intent(out), | optional | :: | wasAdded |
Indicator, if the variable was actually added to the system. |
subroutine tem_varSys_append_auxFieldVar(me, varname, nComponents, &
& method_data, get_point, get_element, set_params, get_params, &
& setup_indices, get_valOfIndex, pos, wasAdded)
! --------------------------------------------------------------------------!
!> Variable system to append the state variable to.
type(tem_varSys_type), intent(inout) :: me
!> Variable to append to the state.
character(len=*), intent(in) :: varname
!> Number of components in this variable.
integer, intent(in) :: nComponents
!> Data that is required by the methods to obtain the variable.
type(c_ptr), intent(in) :: method_data
!> Procedure which allows the retrieval of the variable at given points.
procedure(tem_varSys_proc_point), pointer :: get_point
!> Procedure which allows the retrieval of the variable in an element.
procedure(tem_varSys_proc_element), pointer :: get_element
!> Procedure which allows to set parameter in method_data
procedure(tem_varSys_proc_setParams), optional, pointer :: set_params
!> Procedure which allows to get parameter in method_data
procedure(tem_varSys_proc_getParams), optional, pointer :: get_params
!> Procedure to setup growing array of points, variable value
!! in method_data and return index of points set
procedure(tem_varSys_proc_setupIndices), pointer :: setup_indices
!> Procedure which allows to retrieval of the variable at point or val
!! array index
procedure(tem_varSys_proc_getValOfIndex), pointer :: get_valOfIndex
!> Position of the variable in the system.
integer, optional, intent(out) :: pos
!> Indicator, if the variable was actually added to the system.
logical, optional, intent(out) :: wasAdded
! --------------------------------------------------------------------------!
logical :: newVar
type(tem_varSys_op_type) :: auxField_access
integer :: iComp, varPos
! --------------------------------------------------------------------------!
call append( me = me%varname, &
& val = varname, &
& pos = varPos, &
& wasAdded = newVar )
if (newVar) then
auxField_access%mypos = varPos
auxField_access%operType = 'auxfield'
auxField_access%nInputs = 0
auxField_access%nComponents = nComponents
allocate(auxField_access%auxField_varPos(nComponents))
do iComp = 1, nComponents
auxField_access%auxField_varPos(iComp) = me%nAuxScalars + iComp
end do
allocate(auxField_access%input_varPos(0))
auxField_access%method_data = method_data
auxField_access%get_point => get_point
auxField_access%get_element => get_element
if (present(set_params)) then
auxField_access%set_params => set_params
else
auxField_access%set_params => tem_varSys_setParams_dummy
end if
if (present(get_params)) then
auxField_access%get_params => get_params
else
auxField_access%get_params => tem_varSys_getParams_dummy
end if
auxField_access%setup_indices => setup_indices
auxField_access%get_valOfIndex => get_valOfIndex
call append( me = me%method, &
& val = auxField_access )
me%nAuxVars = me%nAuxVars+1
me%nAuxScalars = me%nAuxScalars + nComponents
end if
if (present(pos)) pos = varPos
if (present(wasAdded)) wasAdded = newVar
end subroutine tem_varSys_append_auxFieldVar