2 use,
intrinsic :: iso_fortran_env, only: error_unit
4 use iso_c_binding,
only : c_ptr
24 generic :: get => get_by_index, get_by_name
30 generic :: assign => assign_to_ptr, assign_to_field_ptr
60 integer,
intent(in) :: size
64 allocate(this%items(size))
79 integer,
intent(in) :: i
80 f => this%items(i)%ptr
88 character(len=*),
intent(in) :: name
94 if (this%name(i) .eq. trim(name))
then
95 f => this%items(i)%ptr
101 write(error_unit,*)
"Current field list contents:"
104 write(error_unit,*)
"- ", this%name(i)
108 call neko_error(
"No field with name " // trim(name) //
" found in list")
115 class(
field_t),
intent(in),
target :: f
119 len =
size(this%items)
122 tmp(1:len) = this%items
123 call move_alloc(tmp, this%items)
124 this%items(len+1)%ptr => f
131 integer :: i, n_fields
133 if (
allocated(this%items))
then
134 n_fields = this%size()
136 if (
associated(this%items(i)%ptr))
then
137 call this%items(i)%ptr%free()
139 nullify(this%items(i)%ptr)
141 deallocate(this%items)
150 integer,
intent(in) :: i
153 ptr = this%items(i)%ptr%x_d
158 real(kind=
rp),
pointer :: x(:,:,:,:)
159 integer,
intent(in) :: i
160 x => this%items(i)%ptr%x
167 integer,
intent(in) :: i
170 size = this%items(i)%ptr%size()
179 integer,
intent(in) :: i
180 type(
field_t),
pointer,
intent(in) :: ptr
182 this%items(i)%ptr => ptr
190 integer,
intent(in) :: i
193 this%items(i)%ptr => ptr%ptr
201 integer,
intent(in) :: i
202 type(
field_t),
target,
intent(in) :: fld
204 this%items(i)%ptr => fld
211 integer,
intent(in) :: i
214 result => this%items(i)%ptr%dof
221 integer,
intent(in) :: i
222 type(
space_t),
pointer :: result
224 result => this%items(i)%ptr%Xh
231 integer,
intent(in) :: i
232 type(
mesh_t),
pointer :: result
234 result => this%items(i)%ptr%msh
241 integer,
intent(in) :: i
244 result = this%items(i)%ptr%internal_dofmap
251 integer,
intent(in) :: i
252 character(len=80) :: result
254 result = this%items(i)%ptr%name
integer, public pe_rank
MPI rank.
Defines a mapping of the degrees of freedom.
type(dofmap_t) function, pointer field_list_dof(this, i)
Get the the dofmap for item i.
subroutine field_list_init(this, size)
Constructor. Just allocates the array.
type(space_t) function, pointer field_list_space(this, i)
Get the the space for item i.
subroutine field_list_assign_to_ptr(this, i, ptr)
Point item at a given index.
pure integer function field_list_size(this)
Get number of items in the list.
subroutine field_list_assign_to_field_ptr(this, i, ptr)
Point item at a given index.
integer function field_list_item_size(this, i)
Get the size of the dofmap for item i.
character(len=80) function field_list_name(this, i)
Get the name for an item in the list.
logical function field_list_internal_dofmap(this, i)
Whether the dofmap is internal for item i.
real(kind=rp) function, dimension(:,:,:,:), pointer field_list_x(this, i)
type(field_t) function, pointer field_list_get_by_index(this, i)
Get an item pointer by array index.
type(mesh_t) function, pointer field_list_msh(this, i)
Get the the mesh for item i.
subroutine field_list_assign_to_field(this, i, fld)
Point item at a given index.
type(c_ptr) function field_list_x_d(this, i)
Get device pointer for a given index.
subroutine field_list_free(this)
Destructor.
subroutine field_list_append(this, f)
Append a field to the list.
type(field_t) function, pointer field_list_get_by_name(this, name)
Get an item pointer by array index.
integer, parameter, public rp
Global precision used in computations.
Defines a function space.
field_ptr_t, To easily obtain a pointer to a field
field_list_t, To be able to group fields together
The function space for the SEM solution fields.