75 integer :: batch_capacity = 1
76 integer :: batch_size = 1
78 real(real64),
pointer,
contiguous :: dRS(:, :, :, :) => null()
79 complex(real64),
pointer,
contiguous :: zRS(:, :, :, :) => null()
80 complex(real64),
pointer,
contiguous :: FS(:, :, :, :) => null()
81 logical :: forced_alloc = .false.
82 logical :: in_device_memory = .false.
83 type(accel_mem_t) :: real_space_buffer
84 type(accel_mem_t) :: fourier_space_buffer
110 type(cube_t),
target,
intent(in) :: cube
111 type(cube_function_t),
intent(inout) :: cf
112 logical,
optional,
intent(in) :: force_alloc
114 integer :: n1, n2, n3
115 logical :: is_allocated
119 assert(.not.
associated(cf%fs))
120 assert(
allocated(cube%fft))
124 cf%batch_capacity = cube%batch_capacity
126 n1 = max(1, cube%fs_n(1))
127 n2 = max(1, cube%fs_n(2))
128 n3 = max(1, cube%fs_n(3))
130 is_allocated = .false.
132 select case (cube%fft%library)
134 if (.not. cf%forced_alloc)
then
135 is_allocated = .
true.
136 if (any(cube%fs_n(1:3) == 0))
then
137 cf%fs => cube%fft%fs_data(1:1,1:1,1:1,1:cf%batch_capacity)
139 cf%fs => cube%fft%fs_data(1:n3,1:n1,1:n2,1:cf%batch_capacity)
142 is_allocated = .
true.
143 safe_allocate(cf%fs(1:n3, 1:n1, 1:n2, 1:cf%batch_capacity))
146 if (cf%in_device_memory)
then
147 is_allocated = .
true.
149 int(cf%batch_capacity, int64) * product(int(cube%fs_n(1:3), int64)))
153 if (.not. cf%forced_alloc)
then
154 is_allocated = .
true.
155 cf%fs => cube%fft%fs_data(1:cube%fs_n(1), 1:cube%fs_n(2), 1:cube%fs_n(3), 1:cf%batch_capacity)
159 if (.not. is_allocated)
then
160 safe_allocate(cf%fs(1:cube%fs_n(1), 1:cube%fs_n(2), 1:cube%fs_n(3), 1:cf%batch_capacity))
169 type(cube_t),
intent(in) :: cube
172 logical :: deallocated
176 assert(
allocated(cube%fft))
178 deallocated = .false.
180 select case (cube%fft%library)
182 if (.not. cf%forced_alloc)
then
187 if (cf%in_device_memory)
then
192 if (.not. cf%forced_alloc)
then
198 if (.not. deallocated)
then
199 assert(
associated(cf%fs))
200 safe_deallocate_p(cf%fs)
214 type(
cube_t),
intent(in) :: cube
215 trivial = cube%cube_map_present .and.
allocated(cube%cube_map%map)
216 if (.not. trivial)
return
220 trivial = cube%cube_map%is_trivial .and. &
221 cube%cube_map%nmap == cube%rs_n(2) * cube%rs_n(3) .and. &
222 cube%cube_map%map(
mcm_count, 1) == cube%rs_n(1) .and. &
223 cube%cube_map%map(1, 1) + cube%center(1) == 1 .and. &
224 cube%cube_map%map(2, 1) + cube%center(2) == 1 .and. &
225 cube%cube_map%map(3, 1) + cube%center(3) == 1
230#include "cube_function_inc.F90"
233#include "complex.F90"
234#include "cube_function_inc.F90"
subroutine, public accel_free_buffer(this, async)
integer, parameter, public accel_mem_read_write
real(real64) function, public dcube_function_surface_average(cube, cf)
This function calculates the surface average of any function.
complex(real64) function, public zcube_function_surface_average(cube, cf)
This function calculates the surface average of any function.
subroutine dcube_to_mesh_1(cube, cf, mesh, mf)
Convert a single function from the cube to the mesh.
subroutine, public dcube_function_rs2fs(cube, cf)
Fourier transform a cube function from real space to Fourier space.
subroutine zcube_to_mesh_2(cube, cf, mesh, mf, mf_buffer)
Convert a set of functions from the cube to the mesh.
subroutine, public dcube_to_submesh(cube, cf, sm, mf)
subroutine, public cube_function_free_fs(cube, cf)
Deallocates the Fourier space buffer of the cube function.
subroutine dmesh_to_cube_2(mesh, mf, cube, cf, mf_buffer)
Convert a set of functions from the mesh to the cube.
subroutine, public dcube_function_allgather(cube, cf, cf_local, order, gatherfs)
subroutine, public zcube_to_mesh_parallel(cube, cf, mesh, mf, map)
subroutine, public dcube_function_alloc_rs(cube, cf, in_device, force_alloc)
Allocates locally the real space grid, if PFFT library is not used. Otherwise, it assigns the PFFT re...
subroutine zmesh_to_cube_1(mesh, mf, cube, cf)
Convert a single function from the mesh to the cube.
subroutine, public zcube_to_submesh(cube, cf, sm, mf)
subroutine, public zmesh_to_cube_parallel(mesh, mf, cube, cf, map)
The next two subroutines convert a function between the normal mesh and the cube in parallel.
subroutine, public dcube_function_free_rs(cube, cf)
Deallocates the real space grid.
subroutine dmesh_to_cube_1(mesh, mf, cube, cf)
Convert a single function from the mesh to the cube.
subroutine, public dsubmesh_to_cube(sm, mf, cube, cf)
The next two subroutines convert a function between a submesh and the cube.
subroutine zmesh_to_cube_2(mesh, mf, cube, cf, mf_buffer)
Convert a set of functions from the mesh to the cube.
subroutine, public cube_function_alloc_fs(cube, cf, force_alloc)
Allocates the local part of the Fourier space grid on the cube function.
subroutine, public zsubmesh_to_cube(sm, mf, cube, cf)
The next two subroutines convert a function between a submesh and the cube.
subroutine, public zcube_function_allgather(cube, cf, cf_local, order, gatherfs)
subroutine, public dmesh_to_cube_parallel(mesh, mf, cube, cf, map)
The next two subroutines convert a function between the normal mesh and the cube in parallel.
subroutine, public zcube_function_fs2rs(cube, cf)
Fourier transform a cube function from Fourier space to real space.
subroutine, public dcube_function_fs2rs(cube, cf)
Fourier transform a cube function from Fourier space to real space.
subroutine dcube_to_mesh_2(cube, cf, mesh, mf, mf_buffer)
Convert a set of functions from the cube to the mesh.
subroutine, public zcube_function_free_rs(cube, cf)
Deallocates the real space grid.
pure logical function cube_map_is_trivial(cube)
True when the cube_map describes a trivial mesh->cube identity: the mesh is X-fastest with one full-X...
subroutine, public dcube_to_mesh_parallel(cube, cf, mesh, mf, map)
subroutine, public zcube_function_rs2fs(cube, cf)
Fourier transform a cube function from real space to Fourier space.
subroutine, public zcube_function_alloc_rs(cube, cf, in_device, force_alloc)
Allocates locally the real space grid, if PFFT library is not used. Otherwise, it assigns the PFFT re...
subroutine zcube_to_mesh_1(cube, cf, mesh, mf)
Convert a single function from the cube to the mesh.
Fast Fourier Transform module. This module provides a single interface that works with different FFT ...
integer, parameter, public fftlib_accel
integer, parameter, public fftlib_pfft
integer, parameter, public fftlib_fftw
This module is intended to contain "only mathematical" functions and procedures.
integer, parameter, public mcm_count
This module defines the meshes, which are used in Octopus.
Some general things and nomenclature:
This module is an helper to perform ring-pattern communications among all states.
type(type_t), parameter, public type_cmplx