42 integer,
allocatable :: boxdim(:)
48 type(hypercube_t),
intent(out) :: this
49 integer,
intent(in) :: ndim
50 integer,
intent(in) :: nr(:, :)
51 integer,
intent(in) :: enlarge
53 integer,
allocatable :: npoints(:)
58 safe_allocate(this%boxdim(1:ndim + 1))
59 safe_allocate(npoints(1:ndim))
62 npoints(ii) = nr(2,ii) - nr(1,ii) + 1
70 this%boxdim(1) = this%boxdim(1)*(npoints(jj)-2*enlarge)
77 this%boxdim(ii)=this%boxdim(ii)*(npoints(jj)-2*enlarge)
79 this%boxdim(ii)=this%boxdim(ii)*2*enlarge
81 this%boxdim(ii)=this%boxdim(ii)*npoints(jj)
85 safe_deallocate_a(npoints)
93 type(hypercube_t),
intent(inout) :: this
97 safe_deallocate_a(this%boxdim)
105 type(hypercube_t),
intent(in) :: this
106 integer,
intent(in) :: ndim
107 integer,
intent(in) :: nr(:,:)
108 integer,
intent(in) :: enlarge
109 integer,
intent(in) :: coord(:)
110 integer,
intent(out) :: icoord
113 integer :: border(1:ndim), npoints(1:ndim), lowerb(1:ndim), tempcoord(1:ndim)
119 npoints(ii) = nr(2, ii) - nr(1, ii) + 1
120 border(ii) = nr(1, ii) + 2*enlarge
121 lowerb(ii) = nr(1, ii)
126 tempcoord(ii) = coord(ii)
127 tempcoord(ii) = tempcoord(ii) + enlarge - nr(1,ii)
128 tempcoord(ii) = mod(tempcoord(ii), npoints(ii))
129 tempcoord(ii) = tempcoord(ii) + nr(1,ii)
135 if (tempcoord(ii) < border(ii))
then
144 if (boxnumb == 1)
then
145 npoints = npoints - 2*enlarge
147 icoord = icoord*npoints(ii)
148 icoord = icoord + tempcoord(ii) - border(ii)
151 if (icoord > this%boxdim(1) .or. icoord < 1)
then
152 message(1) =
"hypercube box point outside box"
156 do jj = 1, boxnumb - 2
157 npoints(jj) = npoints(jj) - 2*enlarge
158 lowerb(jj) = nr(1, jj) + 2*enlarge
160 npoints(boxnumb-1) = 2*enlarge
162 icoord = icoord*npoints(jj)
163 icoord = icoord + (tempcoord(jj) - lowerb(jj))
166 if (icoord > this%boxdim(boxnumb) .or. icoord < 1)
then
167 message(1) =
"hypercube box point outside box"
170 do jj = 1, boxnumb - 1
171 icoord = icoord + this%boxdim(jj)
182 integer,
intent(in) :: ndim
183 integer,
intent(in) :: nr(:,:)
184 integer,
intent(in) :: enlarge
185 integer,
intent(in) :: icoord
186 integer,
intent(out) :: coord(:)
188 integer :: boxnumb, tempcoord
189 integer :: border(ndim), npoints(ndim), lowerb(ndim)
197 jj = jj + this%boxdim(ii)
198 if (icoord > jj)
then
204 npoints(ii) = nr(2, ii) - nr(1, ii)+1
205 border(ii) = nr(1, ii) + 2*enlarge
206 lowerb(ii) = nr(1, ii)
211 if (boxnumb == 1)
then
212 npoints = npoints - 2*enlarge
213 tempcoord = tempcoord - 1
215 coord(ii) = mod(tempcoord, npoints(ii))
216 tempcoord = tempcoord - coord(ii)
217 tempcoord = tempcoord/npoints(ii)
218 coord(ii) = coord(ii) + border(ii)
221 do ii = 1, boxnumb - 2
222 npoints(ii) = npoints(ii) - 2*enlarge
223 lowerb(ii) = nr(1,ii) + 2*enlarge
224 tempcoord = tempcoord - this%boxdim(ii)
226 npoints(boxnumb - 1) = 2*enlarge
227 tempcoord = tempcoord - this%boxdim(boxnumb-1)
228 tempcoord = tempcoord - 1
230 coord(ii) = mod(tempcoord, npoints(ii))
231 tempcoord = tempcoord - coord(ii)
232 tempcoord = tempcoord/npoints(ii)
233 coord(ii) = coord(ii) + lowerb(ii)
238 npoints(ii) = nr(2,ii) - nr(1,ii) + 1
244 coord(ii) = coord(ii) - nr(1,ii) - enlarge
245 if (coord(ii) < 0)
then
246 coord(ii) = coord(ii) + npoints(ii)
248 coord(ii) = coord(ii) + nr(1,ii)
258 number = this%boxdim(1)
266 number = sum(this%boxdim)
subroutine, public hypercube_x_to_i(this, ndim, nr, enlarge, coord, icoord)
subroutine, public hypercube_init(this, ndim, nr, enlarge)
pure integer function, public hypercube_number_total_points(this)
pure integer function, public hypercube_number_inner_points(this)
pure subroutine, public hypercube_i_to_x(this, ndim, nr, enlarge, icoord, coord)
subroutine, public hypercube_end(this)
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)