Neko 1.99.9
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
scratch_registry Module Reference

Defines a registry for storing and requesting temporary objects This can be used when you have a function that will be called often and you do not want to create temporary objects (work arrays) inside it on each call.

Data Types

type  scratch_registry_t
 Scratch registry type. More...
 

Functions/Subroutines

subroutine scratch_registry_init (this, size, expansion_size, dof)
 Constructor, optionally taking initial registry and expansion size as argument.
 
subroutine scratch_registry_free (this)
 Destructor.
 
subroutine scratch_registry_set_dofmap (this, dof)
 Assign a dofmap to the scratch registry.
 
subroutine scratch_registry_set_expansion_size (this, expansion_size)
 Assign a new expansion size to the scratch registry.
 
integer function get_n_entries (this)
 Get the number of objects stored in the registry.
 
integer function get_n_inuse (this)
 Get the number of objects currently in use.
 
integer function get_size (this)
 Get the size of the objects array.
 
pure integer function get_expansion_size (this)
 Get the expansion size.
 
logical function get_inuse (this, index)
 Get the inuse status for a given index.
 
subroutine request_host_array (this, scratch_entry, index, n, clear)
 Get a host array from the registry by assigning it to a pointer.
 
subroutine relinquish_host_array_single (this, index)
 Relinquish the use of a host_array in the registry.
 
subroutine relinquish_host_array_multiple (this, indices)
 Relinquish the use of multiple host_arrays in the registry.
 
subroutine request_device_array (this, scratch_entry, index, n, clear)
 Get a device array from the registry by assigning it to a pointer.
 
subroutine relinquish_device_array_single (this, index)
 Relinquish the use of a device_array in the registry.
 
subroutine relinquish_device_array_multiple (this, indices)
 Relinquish the use of multiple device_arrays in the registry.
 
subroutine request_vector (this, scratch_entry, index, n, clear)
 Get a vector from the registry by assigning it to a pointer.
 
subroutine relinquish_vector_single (this, index)
 Relinquish the use of a vector in the registry.
 
subroutine relinquish_vector_multiple (this, indices)
 Relinquish the use of multiple vectors in the registry.
 
subroutine request_matrix (this, scratch_entry, index, nrows, ncols, clear)
 Get a matrix from the registry by assigning it to a pointer.
 
subroutine relinquish_matrix_single (this, index)
 Relinquish the use of a matrix in the registry.
 
subroutine relinquish_matrix_multiple (this, indices)
 Relinquish the use of multiple matrices in the registry.
 
subroutine request_tensor3 (this, scratch_entry, index, n, m, l, clear)
 Get a tensor3 from the registry by assigning it to a pointer.
 
subroutine relinquish_tensor3_single (this, index)
 Relinquish the use of a tensor3 in the registry.
 
subroutine relinquish_tensor3_multiple (this, indices)
 Relinquish the use of multiple tensor3s in the registry.
 
subroutine request_tensor4 (this, scratch_entry, index, n, m, l, k, clear)
 Get a tensor4 from the registry by assigning it to a pointer.
 
subroutine relinquish_tensor4_single (this, index)
 Relinquish the use of a tensor4 in the registry.
 
subroutine relinquish_tensor4_multiple (this, indices)
 Relinquish the use of multiple tensor4s in the registry.
 
subroutine request_field_stored_dof (this, scratch_entry, index, clear)
 Get a field from the registry by assigning it to a pointer.
 
subroutine request_field_free_dof (this, scratch_entry, index, dof, clear)
 Get a field from the registry by assigning it to a pointer.
 
subroutine relinquish_field_single (this, index)
 Relinquish the use of a field in the registry.
 
subroutine relinquish_field_multiple (this, indices)
 Relinquish the use of multiple fields in the registry.
 
subroutine relinquish_single (this, index)
 Relinquish the use of an object in the registry.
 
subroutine relinquish_multiple (this, indices)
 Relinquish the use of multiple objects in the registry.
 
subroutine relinquish_type (this, index, type)
 Relinquish a single index based on a specified type.
 
subroutine expand (this)
 Expand the registry by expansion_size.
 

Variables

type(scratch_registry_t), target, public neko_scratch_registry
 Global scratch registry.
 

Function/Subroutine Documentation

◆ expand()

subroutine scratch_registry::expand ( class(scratch_registry_t), intent(inout)  this)
private

Definition at line 968 of file scratch_registry.f90.

◆ get_expansion_size()

pure integer function scratch_registry::get_expansion_size ( class(scratch_registry_t), intent(in)  this)
private

Definition at line 346 of file scratch_registry.f90.

◆ get_inuse()

logical function scratch_registry::get_inuse ( class(scratch_registry_t), intent(in), target  this,
integer, intent(in)  index 
)
private

Definition at line 354 of file scratch_registry.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_n_entries()

integer function scratch_registry::get_n_entries ( class(scratch_registry_t), intent(in)  this)
private

Definition at line 308 of file scratch_registry.f90.

◆ get_n_inuse()

integer function scratch_registry::get_n_inuse ( class(scratch_registry_t), intent(in)  this)
private

Definition at line 318 of file scratch_registry.f90.

◆ get_size()

integer function scratch_registry::get_size ( class(scratch_registry_t), intent(in)  this)
private

Definition at line 332 of file scratch_registry.f90.

◆ relinquish_device_array_multiple()

subroutine scratch_registry::relinquish_device_array_multiple ( class(scratch_registry_t), intent(inout)  this,
integer, dimension(:), intent(in)  indices 
)
private
Parameters
indicesThe indices of the device_arrays to free

Definition at line 502 of file scratch_registry.f90.

Here is the caller graph for this function:

◆ relinquish_device_array_single()

subroutine scratch_registry::relinquish_device_array_single ( class(scratch_registry_t), intent(inout)  this,
integer, intent(in)  index 
)
private
Parameters
indexThe index of the device_array to free

Definition at line 493 of file scratch_registry.f90.

Here is the caller graph for this function:

◆ relinquish_field_multiple()

subroutine scratch_registry::relinquish_field_multiple ( class(scratch_registry_t), intent(inout)  this,
integer, dimension(:), intent(in)  indices 
)
private
Parameters
indicesThe indices of the fields to free

Definition at line 907 of file scratch_registry.f90.

Here is the caller graph for this function:

◆ relinquish_field_single()

subroutine scratch_registry::relinquish_field_single ( class(scratch_registry_t), intent(inout)  this,
integer, intent(in)  index 
)
private
Parameters
indexThe index of the field to free

Definition at line 898 of file scratch_registry.f90.

Here is the caller graph for this function:

◆ relinquish_host_array_multiple()

subroutine scratch_registry::relinquish_host_array_multiple ( class(scratch_registry_t), intent(inout)  this,
integer, dimension(:), intent(in)  indices 
)
private
Parameters
indicesThe indices of the host_arrays to free

Definition at line 429 of file scratch_registry.f90.

Here is the caller graph for this function:

◆ relinquish_host_array_single()

subroutine scratch_registry::relinquish_host_array_single ( class(scratch_registry_t), intent(inout)  this,
integer, intent(in)  index 
)
private
Parameters
indexThe index of the host_array to free

Definition at line 420 of file scratch_registry.f90.

Here is the caller graph for this function:

◆ relinquish_matrix_multiple()

subroutine scratch_registry::relinquish_matrix_multiple ( class(scratch_registry_t), intent(inout)  this,
integer, dimension(:), intent(in)  indices 
)
private
Parameters
indicesThe indices of the matrices to free

Definition at line 637 of file scratch_registry.f90.

Here is the caller graph for this function:

◆ relinquish_matrix_single()

subroutine scratch_registry::relinquish_matrix_single ( class(scratch_registry_t), intent(inout)  this,
integer, intent(in)  index 
)
private
Parameters
indexThe index of the matrix to free

Definition at line 628 of file scratch_registry.f90.

Here is the caller graph for this function:

◆ relinquish_multiple()

subroutine scratch_registry::relinquish_multiple ( class(scratch_registry_t), intent(inout)  this,
integer, dimension(:), intent(in)  indices 
)
private
Parameters
indicesThe indices of the objects to free

Definition at line 934 of file scratch_registry.f90.

Here is the caller graph for this function:

◆ relinquish_single()

subroutine scratch_registry::relinquish_single ( class(scratch_registry_t), intent(inout)  this,
integer, intent(in)  index 
)
private
Parameters
indexThe index of the object to free

Definition at line 922 of file scratch_registry.f90.

Here is the caller graph for this function:

◆ relinquish_tensor3_multiple()

subroutine scratch_registry::relinquish_tensor3_multiple ( class(scratch_registry_t), intent(inout)  this,
integer, dimension(:), intent(in)  indices 
)
private
Parameters
indicesThe indices of the tensor3s to free

Definition at line 712 of file scratch_registry.f90.

Here is the caller graph for this function:

◆ relinquish_tensor3_single()

subroutine scratch_registry::relinquish_tensor3_single ( class(scratch_registry_t), intent(inout)  this,
integer, intent(in)  index 
)
private
Parameters
indexThe index of the tensor3 to free

Definition at line 703 of file scratch_registry.f90.

Here is the caller graph for this function:

◆ relinquish_tensor4_multiple()

subroutine scratch_registry::relinquish_tensor4_multiple ( class(scratch_registry_t), intent(inout)  this,
integer, dimension(:), intent(in)  indices 
)
private
Parameters
indicesThe indices of the tensor4s to free

Definition at line 788 of file scratch_registry.f90.

Here is the caller graph for this function:

◆ relinquish_tensor4_single()

subroutine scratch_registry::relinquish_tensor4_single ( class(scratch_registry_t), intent(inout)  this,
integer, intent(in)  index 
)
private
Parameters
indexThe index of the tensor4 to free

Definition at line 779 of file scratch_registry.f90.

Here is the caller graph for this function:

◆ relinquish_type()

subroutine scratch_registry::relinquish_type ( class(scratch_registry_t), intent(inout)  this,
integer, intent(in)  index,
character(len=*), intent(in)  type 
)
private
Parameters
indexThe index of the object to free
typeThe type of the object to free

Definition at line 950 of file scratch_registry.f90.

◆ relinquish_vector_multiple()

subroutine scratch_registry::relinquish_vector_multiple ( class(scratch_registry_t), intent(inout)  this,
integer, dimension(:), intent(in)  indices 
)
private
Parameters
indicesThe indices of the vectors to free

Definition at line 569 of file scratch_registry.f90.

Here is the caller graph for this function:

◆ relinquish_vector_single()

subroutine scratch_registry::relinquish_vector_single ( class(scratch_registry_t), intent(inout)  this,
integer, intent(in)  index 
)
private
Parameters
indexThe index of the vector to free

Definition at line 560 of file scratch_registry.f90.

Here is the caller graph for this function:

◆ request_device_array()

subroutine scratch_registry::request_device_array ( class(scratch_registry_t), intent(inout), target  this,
type(c_ptr), intent(inout)  scratch_entry,
integer, intent(inout)  index,
integer, intent(in)  n,
logical, intent(in)  clear 
)
private
Parameters
scratch_entryPointer to the requested device array.
indexIndex of the device array in the registry (for relinquishing later).
nSize of the requested device array.
clearIf true, the device array values are set to zero upon request.

Definition at line 445 of file scratch_registry.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ request_field_free_dof()

subroutine scratch_registry::request_field_free_dof ( class(scratch_registry_t), intent(inout), target  this,
type(field_t), intent(inout), pointer  scratch_entry,
integer, intent(inout)  index,
type(dofmap_t), intent(in), target  dof,
logical, intent(in)  clear 
)
private
Parameters
scratch_entryPointer to the requested field.
indexIndex of the field in the registry (for relinquishing later).
dofDofmap to use for the field.
clearIf true, the field values are set to zero upon request.

Definition at line 854 of file scratch_registry.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ request_field_stored_dof()

subroutine scratch_registry::request_field_stored_dof ( class(scratch_registry_t), intent(inout), target  this,
type(field_t), intent(inout), pointer  scratch_entry,
integer, intent(inout)  index,
logical, intent(in)  clear 
)
private
Parameters
scratch_entryPointer to the requested field.
indexIndex of the field in the registry (for relinquishing later).
clearIf true, the field values are set to zero upon request.

Definition at line 802 of file scratch_registry.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ request_host_array()

subroutine scratch_registry::request_host_array ( class(scratch_registry_t), intent(inout), target  this,
real(kind=rp), dimension(:), intent(inout), pointer  scratch_entry,
integer, intent(inout)  index,
integer, intent(in)  n,
logical, intent(in)  clear 
)
private
Parameters
scratch_entryPointer to the requested host array.
indexIndex of the host array in the registry (for relinquishing later).
nSize of the requested host_array.
clearIf true, the host_array values are set to zero upon request.

Definition at line 372 of file scratch_registry.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ request_matrix()

subroutine scratch_registry::request_matrix ( class(scratch_registry_t), intent(inout), target  this,
type(matrix_t), intent(inout), pointer  scratch_entry,
integer, intent(inout)  index,
integer, intent(in)  nrows,
integer, intent(in)  ncols,
logical, intent(in)  clear 
)
private
Parameters
scratch_entryPointer to the requested matrix.
indexIndex of the matrix in the registry (for relinquishing later).
nrowsNumber of rows of the requested matrix.
ncolsNumber of columns of the requested matrix.
clearIf true, the matrix values are set to zero upon request.

Definition at line 585 of file scratch_registry.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ request_tensor3()

subroutine scratch_registry::request_tensor3 ( class(scratch_registry_t), intent(inout), target  this,
type(tensor3_t), intent(inout), pointer  scratch_entry,
integer, intent(inout)  index,
integer, intent(in)  n,
integer, intent(in)  m,
integer, intent(in)  l,
logical, intent(in)  clear 
)
private
Parameters
scratch_entryPointer to the requested tensor3.
indexIndex of the tensor3 in the registry (for relinquishing later).
nNumber of rows of the requested tensor3.
mNumber of columns of the requested tensor3.
lNumber of layers of the requested tensor3.
clearIf true, the tensor3 values are set to zero upon request.

Definition at line 654 of file scratch_registry.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ request_tensor4()

subroutine scratch_registry::request_tensor4 ( class(scratch_registry_t), intent(inout), target  this,
type(tensor4_t), intent(inout), pointer  scratch_entry,
integer, intent(inout)  index,
integer, intent(in)  n,
integer, intent(in)  m,
integer, intent(in)  l,
integer, intent(in)  k,
logical, intent(in)  clear 
)
private
Parameters
scratch_entryPointer to the requested tensor4.
indexIndex of the tensor4 in the registry (for relinquishing later).
nNumber of rows of the requested tensor4.
scratch_entryNumber of columns of the requested tensor4.
lNumber of layers of the requested tensor4.
kNumber of slices of the requested tensor4.
clearIf true, the tensor4 values are set to zero upon request.

Definition at line 730 of file scratch_registry.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ request_vector()

subroutine scratch_registry::request_vector ( class(scratch_registry_t), intent(inout), target  this,
type(vector_t), intent(inout), pointer  scratch_entry,
integer, intent(inout)  index,
integer, intent(in)  n,
logical, intent(in)  clear 
)
private
Parameters
scratch_entryPointer to the requested vector.
indexIndex of the vector in the registry (for relinquishing later).
nSize of the requested vector.
clearIf true, the vector values are set to zero upon request.

Definition at line 517 of file scratch_registry.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scratch_registry_free()

subroutine scratch_registry::scratch_registry_free ( class(scratch_registry_t), intent(inout)  this)
private

Definition at line 250 of file scratch_registry.f90.

◆ scratch_registry_init()

subroutine scratch_registry::scratch_registry_init ( class(scratch_registry_t), intent(inout)  this,
integer, intent(in), optional  size,
integer, intent(in), optional  expansion_size,
type(dofmap_t), intent(in), optional, target  dof 
)
private
Parameters
sizeInitial size of the registry
expansion_sizeSize to expand the registry by when needed
dofDofmap to associate with the scratch registry
Note
If no DOF map is provided here, it must be set later using scratch_registry_t::set_dofmap before requesting fields without specifying a DOF map.

Definition at line 217 of file scratch_registry.f90.

◆ scratch_registry_set_dofmap()

subroutine scratch_registry::scratch_registry_set_dofmap ( class(scratch_registry_t), intent(inout)  this,
type(dofmap_t), intent(in), target  dof 
)
private
Parameters
dofDofmap to assign
Note
First check if a dofmap is already assigned, and throw an error, unless it's the same dofmap.

Definition at line 279 of file scratch_registry.f90.

◆ scratch_registry_set_expansion_size()

subroutine scratch_registry::scratch_registry_set_expansion_size ( class(scratch_registry_t), intent(inout)  this,
integer, intent(in)  expansion_size 
)
private
Parameters
expansion_sizeNew expansion size to assign.

Definition at line 295 of file scratch_registry.f90.

Variable Documentation

◆ neko_scratch_registry

type(scratch_registry_t), target, public scratch_registry::neko_scratch_registry

Definition at line 201 of file scratch_registry.f90.