48 character(len=:),
private,
allocatable :: name
49 character(len=:),
private,
allocatable :: type
50 logical,
private :: allocated = .false.
52 type(
field_t),
private,
pointer :: field_ptr => null()
53 type(
vector_t),
private,
pointer :: vector_ptr => null()
54 type(
matrix_t),
private,
pointer :: matrix_ptr => null()
75 type(
dofmap_t),
target,
intent(in) :: dof
76 character(len=*),
intent(in) :: name
78 if (this%allocated)
then
79 call neko_error(
"scratch_registry::init_register_field: " &
80 //
"Register entry is already allocated.")
85 allocate(this%field_ptr)
86 call this%field_ptr%init(dof, trim(name))
88 this%name = trim(name)
90 this%allocated = .true.
97 integer,
intent(in) :: n
98 character(len=*),
optional,
intent(in) :: name
100 if (this%allocated)
then
101 call neko_error(
"scratch_registry::init_register_vector: " &
102 //
"Register entry is already allocated.")
107 allocate(this%vector_ptr)
108 call this%vector_ptr%init(n)
110 if (
present(name)) this%name = trim(name)
112 this%allocated = .true.
119 integer,
intent(in) :: nrows, ncols
120 character(len=*),
optional,
intent(in) :: name
122 if (this%allocated)
then
123 call neko_error(
"scratch_registry::init_register_matrix: " &
124 //
"Register entry is already allocated.")
129 allocate(this%matrix_ptr)
130 call this%matrix_ptr%init(nrows, ncols)
132 if (
present(name)) this%name = trim(name)
134 this%allocated = .true.
142 if (
associated(this%field_ptr))
then
143 call this%field_ptr%free()
144 deallocate(this%field_ptr)
147 if (
associated(this%vector_ptr))
then
148 call this%vector_ptr%free()
149 deallocate(this%vector_ptr)
152 if (
associated(this%matrix_ptr))
then
153 call this%matrix_ptr%free()
154 deallocate(this%matrix_ptr)
157 if (
allocated(this%name))
deallocate(this%name)
158 if (
allocated(this%type))
deallocate(this%type)
159 this%allocated = .false.
166 character(len=:),
allocatable :: name
167 name = trim(this%name)
173 character(len=:),
allocatable :: type
174 type = trim(this%type)
181 allocated = this%allocated
187 type(
field_t),
pointer :: field_ptr
188 if (this%get_type() .ne.
'field')
then
189 call neko_error(
"registry_entry::get_field: " &
190 //
"Registry entry is not of type 'field'.")
192 field_ptr => this%field_ptr
198 type(
vector_t),
pointer :: vector_ptr
199 if (this%get_type() .ne.
'vector')
then
200 call neko_error(
"registry_entry::get_vector: " &
201 //
"Registry entry is not of type 'vector'.")
203 vector_ptr => this%vector_ptr
209 type(
matrix_t),
pointer :: matrix_ptr
210 if (this%get_type() .ne.
'matrix')
then
211 call neko_error(
"registry_entry::get_field: " &
212 //
"Registry entry is not of type 'matrix'.")
214 matrix_ptr => this%matrix_ptr
Defines a mapping of the degrees of freedom.
Defines a registry entry for storing and requesting temporary objects This is used in the scratch reg...
subroutine init_register_field(this, dof, name)
Initialize a register entry.
pure character(len=:) function, allocatable get_name(this)
Get the name of the registry entry.
subroutine init_register_matrix(this, nrows, ncols, name)
Initialize a register entry.
subroutine init_register_vector(this, n, name)
Initialize a register entry.
type(field_t) function, pointer get_field(this)
Get the field pointer of the registry entry.
subroutine free_register(this)
Free a register entry.
pure logical function is_allocated(this)
Check if the registry entry is allocated.
type(vector_t) function, pointer get_vector(this)
Get the vector pointer of the registry entry.
type(matrix_t) function, pointer get_matrix(this)
Get the matrix pointer of the registry entry.
pure character(len=:) function, allocatable get_type(this)
Get the type of the registry entry.