|
CP2K 2.4 (Revision 12889)
|
DBCSR pointer and unmanaged array utilities. More...
Classes | |
| interface | ensure_array_size |
| interface | pointer_view |
| interface | pointer_replace |
| interface | pointer_rank_remap2 |
| interface | memory_copy |
| interface | memory_zero |
| interface | memory_allocate |
| interface | memory_deallocate |
Functions | |
| subroutine | ensure_array_size_i (array, lb, ub, factor, nocopy, memory_type, zero_pad, error) |
| Ensures that an array is appropriately large. | |
| subroutine | mem_copy_i (dst, src, n) |
| Creates a new array if it doesn't yet exist. | |
| subroutine | mem_zero_i (dst, n) |
| Zeros memory area. | |
| subroutine | mem_alloc_i (mem, n, mem_type, error) |
| Allocates memory. | |
| subroutine | mem_dealloc_i (mem, mem_type, error) |
| Deallocates memory. | |
| subroutine | pointer_replace_i (original_p, new_p) |
| Replaces an existing pointer with a new one, freeing memory as required. | |
| INTEGER, dimension(:), pointer | pointer_view_i (original, lb, ub) |
| Returns a pointer with different bounds. | |
| TYPE(dbcsr_data_obj) | pointer_view_a (new_area, area, offset, len) |
| Repoints a pointer into a part of a data area. | |
Variables | |
| CHARACTER(len=*), parameter, private | moduleN = 'dbcsr_ptr_util' |
| REAL, parameter, public | default_resize_factor = 1.618034 |
| LOGICAL, parameter | careful_mod = .FALSE. |
| LOGICAL, parameter, public | dbcsr_ptr_remapping = .TRUE. |
DBCSR pointer and unmanaged array utilities.
Modification history:
| subroutine dbcsr_ptr_util::ensure_array_size_i | ( | INTEGER,dimension(:),pointer | array, |
| INTEGER,intent(in),optional | lb, | ||
| INTEGER,intent(in) | ub, | ||
| REAL,intent(in),optional | factor, | ||
| LOGICAL,intent(in),optional | nocopy, | ||
| INTEGER,intent(in),optional | memory_type, | ||
| LOGICAL,intent(in),optional | zero_pad, | ||
| TYPE(dbcsr_error_type),intent(inout) | error | ||
| ) | [private] |
Ensures that an array is appropriately large.
| [in,out] | array | array to verify and possibly resize |
| [in] | lb | (optional) desired array lower bound |
| [in] | ub | desired array upper bound |
| [in] | factor | (optional) factor by which to exagerrate enlargements |
| [in] | nocopy | (optional) copy array on enlargement; default is to copy |
| [in] | zero_pad | (optional) zero new allocations; default is to write nothing |
| [in] | memory_type | (optional) type of memory |
| error | cp2k error |
Definition at line 132 of file dbcsr_ptr_util.f90.
References careful_mod, dbcsr_error_handling::dbcsr_error_set(), dbcsr_error_handling::dbcsr_error_stop(), dbcsr_error_handling::dbcsr_failure_level, dbcsr_error_handling::dbcsr_fatal_level, dbcsr_error_handling::dbcsr_internal_error, dbcsr_error_handling::dbcsr_unimplemented_error_nr, error, mem_alloc_i(), mem_copy_i(), mem_dealloc_i(), and mem_zero_i().
Here is the call graph for this function:| subroutine dbcsr_ptr_util::mem_alloc_i | ( | INTEGER,dimension(:),pointer | mem, |
| INTEGER,intent(in) | n, | ||
| INTEGER,intent(in) | mem_type, | ||
| TYPE(dbcsr_error_type),intent(inout) | error | ||
| ) | [private] |
Allocates memory.
| [out] | mem | memory to allocate |
| [in] | n | length of elements to allocate |
| [in] | mem_type | memory type |
| [in,out] | error | error |
Definition at line 285 of file dbcsr_ptr_util.f90.
References careful_mod, dbcsr_error_handling::dbcsr_error_set(), dbcsr_error_handling::dbcsr_error_stop(), dbcsr_error_handling::dbcsr_fatal_level, dbcsr_error_handling::dbcsr_internal_error, dbcsr_error_handling::dbcsr_unimplemented_error_nr, and dbcsr_error_handling::dbcsr_warning_level.
Referenced by ensure_array_size_i().
Here is the call graph for this function:
Here is the caller graph for this function:| subroutine dbcsr_ptr_util::mem_copy_i | ( | INTEGER,dimension(1:n),intent(out) | dst, |
| INTEGER,dimension(1:n),intent(in) | src, | ||
| INTEGER,intent(in) | n | ||
| ) | [private] |
Creates a new array if it doesn't yet exist.
Copies memory area
| [out] | dst | destination memory |
| [in] | src | source memory |
| [in] | n | length of copy |
Definition at line 258 of file dbcsr_ptr_util.f90.
Referenced by ensure_array_size_i().
Here is the caller graph for this function:| subroutine dbcsr_ptr_util::mem_dealloc_i | ( | INTEGER,dimension(:),pointer | mem, |
| INTEGER,intent(in) | mem_type, | ||
| TYPE(dbcsr_error_type),intent(inout) | error | ||
| ) | [private] |
Deallocates memory.
| [out] | mem | memory to allocate |
| [in] | n | length of elements to allocate |
| [in] | mem_type | memory type |
| [in,out] | error | error |
Definition at line 327 of file dbcsr_ptr_util.f90.
References careful_mod, dbcsr_error_handling::dbcsr_error_set(), dbcsr_error_handling::dbcsr_error_stop(), dbcsr_error_handling::dbcsr_fatal_level, dbcsr_error_handling::dbcsr_internal_error, dbcsr_error_handling::dbcsr_unimplemented_error_nr, and dbcsr_error_handling::dbcsr_warning_level.
Referenced by ensure_array_size_i().
Here is the call graph for this function:
Here is the caller graph for this function:| subroutine dbcsr_ptr_util::mem_zero_i | ( | INTEGER,dimension(1:n),intent(out) | dst, |
| INTEGER,intent(in) | n | ||
| ) | [private] |
Zeros memory area.
| [out] | dst | destination memory |
| [in] | n | length of elements to zero |
Definition at line 271 of file dbcsr_ptr_util.f90.
Referenced by ensure_array_size_i().
Here is the caller graph for this function:| subroutine dbcsr_ptr_util::pointer_replace_i | ( | INTEGER,dimension(:),pointer | original_p, |
| INTEGER,dimension(:),pointer | new_p | ||
| ) | [private] |
Replaces an existing pointer with a new one, freeing memory as required.
| [in,out] | original_p | original pointer, to be replaced |
| [in] | new_p | replacement pointer |
Definition at line 368 of file dbcsr_ptr_util.f90.
| TYPE(dbcsr_data_obj) dbcsr_ptr_util::pointer_view_a | ( | TYPE(dbcsr_data_obj),intent(inout) | new_area, |
| TYPE(dbcsr_data_obj),intent(in) | area, | ||
| INTEGER,intent(in) | offset, | ||
| INTEGER,intent(in),optional | len | ||
| ) | [private] |
Repoints a pointer into a part of a data area.
| [in,out] | new_area | repoints this encapsulated pointer |
| [in] | area | area to point into |
| [in] | offset | point to this offset in area |
| [in] | len | (optional) length of data area to point to |
Definition at line 401 of file dbcsr_ptr_util.f90.
References dbcsr_error_handling::dbcsr_fatal_level, and dbcsr_error_handling::dbcsr_wrong_args_error.
| INTEGER,dimension(:),pointer dbcsr_ptr_util::pointer_view_i | ( | INTEGER,dimension(:),pointer | original, |
| INTEGER,intent(in) | lb, | ||
| INTEGER,intent(in) | ub | ||
| ) | [private] |
Returns a pointer with different bounds.
| [in] | original | original data pointer |
| [in] | lb,ub | lower and upper bound for the new pointer view |
| [out] | view | new pointer |
Definition at line 384 of file dbcsr_ptr_util.f90.
| LOGICAL,parameter dbcsr_ptr_util::careful_mod = .FALSE. |
Definition at line 47 of file dbcsr_ptr_util.f90.
Referenced by ensure_array_size_i(), mem_alloc_i(), and mem_dealloc_i().
| LOGICAL,parameter,public dbcsr_ptr_util::dbcsr_ptr_remapping = .TRUE. |
Definition at line 52 of file dbcsr_ptr_util.f90.
Referenced by dbcsr_data_methods::set_data_area_area().
| REAL,parameter,public dbcsr_ptr_util::default_resize_factor = 1.618034 |
Definition at line 45 of file dbcsr_ptr_util.f90.
Referenced by dbcsr_index_operations::dbcsr_addto_index_array().
| CHARACTER(len=*),parameter,private dbcsr_ptr_util::moduleN = 'dbcsr_ptr_util' |
Definition at line 43 of file dbcsr_ptr_util.f90.
1.7.3