41 real(real64),
allocatable :: pos(:, :)
47 type(lookup_t),
intent(inout) :: this
48 integer,
intent(in) :: dim
49 integer,
intent(in) :: nobjs
50 real(real64),
intent(in) :: pos(:, :)
56 safe_allocate(this%pos(1:this%dim, 1:this%nobjs))
58 this%pos(1:this%dim, 1:this%nobjs) = pos(1:this%dim, 1:this%nobjs)
65 type(lookup_t),
intent(inout) :: this
68 safe_deallocate_a(this%pos)
75 type(lookup_t),
intent(in) :: cin
76 type(lookup_t),
intent(inout) :: cout
81 cout%nobjs = cin%nobjs
83 safe_allocate_source_a(cout%pos, cin%pos)
91 type(lookup_t),
intent(in) :: this
92 integer,
intent(in) :: npoint
93 real(real64),
intent(in) :: points(:, :)
94 real(real64),
intent(in) :: radius
95 integer,
intent(out) :: nlist(:)
96 integer,
optional,
allocatable,
intent(out) :: list(:, :)
103 if (
present(list))
then
104 safe_allocate(list(1:this%nobjs, 1:npoint))
109 do ii = 1, this%nobjs
110 do ipoint = 1, npoint
111 r2 = sum((this%pos(1:this%dim, ii) - points(ipoint, 1:this%dim))**2)
112 if (r2 < radius**2)
then
113 nlist(ipoint) = nlist(ipoint) + 1
118 if (
present(list)) list(nlist(ipoint), ipoint) = ii
subroutine, public lookup_end(this)
subroutine, public lookup_init(this, dim, nobjs, pos)
subroutine, public lookup_copy(cin, cout)
subroutine, public lookup_get_list(this, npoint, points, radius, nlist, list)