35 use,
intrinsic :: iso_fortran_env, only : error_unit
37 use iso_c_binding,
only : c_ptr
54 generic :: get => get_by_index, get_by_name
60 generic :: assign => assign_to_ptr, assign_to_vector_ptr
62 procedure, pass(this) :: assign_to_vector_ptr => &
83 integer,
intent(in) :: size
87 allocate(this%items(size))
102 integer,
intent(in) :: i
103 f => this%items(i)%ptr
111 character(len=*),
intent(in) :: name
116 do i = 1, this%size()
117 if (this%name(i) .eq. trim(name))
then
118 f => this%items(i)%ptr
124 write(error_unit,*)
"Current vector list contents:"
126 do i = 1, this%size()
127 write(error_unit,*)
"- ", this%name(i)
131 call neko_error(
"No vector with name " // trim(name) //
" found in list")
138 class(
vector_t),
intent(in),
target :: f
142 if (.not.
allocated(this%items))
then
143 allocate(this%items(1))
144 call this%items(1)%init(f)
148 len =
size(this%items)
151 tmp(1:len) = this%items
152 call move_alloc(tmp, this%items)
153 call this%items(len+1)%init(f)
160 integer :: i, n_fields
162 if (
allocated(this%items))
then
163 n_fields = this%size()
165 call this%items(i)%free()
167 deallocate(this%items)
176 integer,
intent(in) :: i
179 ptr = this%items(i)%ptr%x_d
184 real(kind=
rp),
pointer,
contiguous :: x(:)
185 integer,
intent(in) :: i
186 x => this%items(i)%ptr%x
193 integer,
intent(in) :: i
196 size = this%items(i)%ptr%size()
205 integer,
intent(in) :: i
206 type(
vector_t),
pointer,
intent(in) :: ptr
208 call this%items(i)%init(ptr)
217 integer,
intent(in) :: i
220 call this%items(i)%init(ptr%ptr)
228 integer,
intent(in) :: i
229 type(
vector_t),
target,
intent(in) :: vec
231 call this%items(i)%init(vec)
238 integer,
intent(in) :: i
239 character(len=80) :: result
241 result = this%items(i)%ptr%name
integer, public pe_rank
MPI rank.
integer, parameter, public rp
Global precision used in computations.
type(c_ptr) function vector_list_x_d(this, i)
Get device pointer for a given index.
subroutine vector_list_assign_to_vector_ptr(this, i, ptr)
Point item at a given index.
subroutine vector_list_assign_to_vector(this, i, vec)
Point item at a given index.
subroutine vector_list_free(this)
Destructor.
type(vector_t) function, pointer vector_list_get_by_index(this, i)
Get an item pointer by array index.
character(len=80) function vector_list_name(this, i)
Get the name for an item in the list.
integer function vector_list_item_size(this, i)
Get the size of item i.
pure integer function vector_list_size(this)
Get number of items in the list.
subroutine vector_list_assign_to_ptr(this, i, ptr)
Point item at a given index.
subroutine vector_list_append(this, f)
Append a vector to the list.
real(kind=rp) function, dimension(:), pointer, contiguous vector_list_x(this, i)
subroutine vector_list_init(this, size)
Constructor. Just allocates the array.
type(vector_t) function, pointer vector_list_get_by_name(this, name)
Get an item pointer by array index.
vector_list_t, To be able to group vectors together