34 use,
intrinsic :: iso_fortran_env, only : error_unit
36 use iso_c_binding,
only : c_ptr
56 generic :: get => get_by_index, get_by_name
62 generic :: assign => assign_to_ptr, assign_to_field_ptr, &
65 procedure, pass(this) :: assign_to_field_ptr => &
97 integer,
intent(in) :: size
100 allocate(this%items(size))
109 if (
allocated(this%items))
then
122 integer,
intent(in) :: i
123 f => this%items(i)%ptr
131 character(len=*),
intent(in) :: name
136 do i = 1, this%size()
137 if (this%name(i) .eq. trim(name))
then
138 f => this%items(i)%ptr
144 write(error_unit,*)
"Current field list contents:"
146 do i = 1, this%size()
147 write(error_unit,*)
"- ", this%name(i)
151 call neko_error(
"No field with name " // trim(name) //
" found in list")
158 class(
field_t),
intent(in),
target :: f
162 if (.not.
allocated(this%items))
then
163 allocate(this%items(1))
164 call this%items(1)%init(f)
168 len =
size(this%items)
171 tmp(1:len) = this%items
172 call move_alloc(tmp, this%items)
173 call this%items(len+1)%init(f)
180 integer :: i, n_fields
182 if (
allocated(this%items))
then
183 n_fields = this%size()
185 call this%items(i)%free()
187 deallocate(this%items)
196 integer,
intent(in) :: i
199 ptr = this%items(i)%ptr%x_d
204 real(kind=
rp),
pointer,
contiguous :: x(:,:,:,:)
205 integer,
intent(in) :: i
206 x => this%items(i)%ptr%x
213 integer,
intent(in) :: i
216 size = this%items(i)%ptr%size()
225 integer,
intent(in) :: i
226 type(
field_t),
pointer,
intent(in) :: ptr
228 call this%items(i)%init(ptr)
237 integer,
intent(in) :: i
240 call this%items(i)%init(ptr%ptr)
248 integer,
intent(in) :: i
249 type(
field_t),
target,
intent(in) :: fld
251 call this%items(i)%init(fld)
263 call this%init(other%size())
264 do i = 1, other%size()
265 call this%assign(i, other%items(i)%ptr)
273 integer,
intent(in) :: i
276 result => this%items(i)%ptr%dof
283 integer,
intent(in) :: i
284 type(
space_t),
pointer :: result
286 result => this%items(i)%ptr%Xh
293 integer,
intent(in) :: i
294 type(
mesh_t),
pointer :: result
296 result => this%items(i)%ptr%msh
303 integer,
intent(in) :: i
306 result = this%items(i)%ptr%internal_dofmap
313 integer,
intent(in) :: i
314 character(len=80) :: result
316 result = this%items(i)%ptr%name
326 integer,
intent(in) :: memdir
327 logical,
intent(in) :: sync
334 call this%items(i)%ptr%copy_from(memdir, .false.)
336 call this%items(n)%ptr%copy_from(memdir, sync)
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_field_list(this, other)
Point item at a given index.
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.
subroutine field_list_copy_from(this, memdir, sync)
Copy all fields to or from device.
logical function field_list_internal_dofmap(this, i)
Whether the dofmap is internal for item i.
real(kind=rp) function, dimension(:,:,:,:), pointer, contiguous 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.