48 character(len=:),
private,
allocatable :: name
50 character(len=:),
private,
allocatable :: type
52 logical,
private :: allocated = .false.
55 real(kind=
rp),
private :: real_scalar = 0.0_rp
56 integer,
private :: integer_scalar = 0
57 type(
vector_t),
private,
pointer :: vector_ptr => null()
58 type(
matrix_t),
private,
pointer :: matrix_ptr => null()
59 type(
field_t),
private,
pointer :: field_ptr => null()
87 type(
dofmap_t),
target,
intent(in) :: dof
88 character(len=*),
intent(in) :: name
90 if (this%allocated)
then
92 //
"Register entry is already allocated.")
97 allocate(this%field_ptr)
98 call this%field_ptr%init(dof, trim(name))
100 this%name = trim(name)
102 this%allocated = .true.
109 integer,
intent(in) :: n
110 character(len=*),
optional,
intent(in) :: name
112 if (this%allocated)
then
114 //
"Register entry is already allocated.")
119 allocate(this%vector_ptr)
120 call this%vector_ptr%init(n)
122 if (
present(name)) this%name = trim(name)
124 this%allocated = .true.
131 integer,
intent(in) :: nrows, ncols
132 character(len=*),
optional,
intent(in) :: name
134 if (this%allocated)
then
136 //
"Register entry is already allocated.")
141 allocate(this%matrix_ptr)
142 call this%matrix_ptr%init(nrows, ncols)
144 if (
present(name)) this%name = trim(name)
146 this%allocated = .true.
153 real(kind=
rp),
intent(in) :: val
154 character(len=*),
optional,
intent(in) :: name
156 if (this%allocated)
then
157 call neko_error(
"init_register_real_scalar: " &
158 //
"Register entry is already allocated.")
163 this%real_scalar = val
165 if (
present(name)) this%name = trim(name)
166 this%type =
'real_scalar'
167 this%allocated = .true.
174 integer,
intent(in) :: val
175 character(len=*),
optional,
intent(in) :: name
177 if (this%allocated)
then
178 call neko_error(
"init_register_integer_scalar: " &
179 //
"Register entry is already allocated.")
184 this%integer_scalar = val
186 if (
present(name)) this%name = trim(name)
187 this%type =
'integer_scalar'
188 this%allocated = .true.
196 if (
associated(this%field_ptr))
then
197 call this%field_ptr%free()
198 deallocate(this%field_ptr)
201 if (
associated(this%vector_ptr))
then
202 call this%vector_ptr%free()
203 deallocate(this%vector_ptr)
206 if (
associated(this%matrix_ptr))
then
207 call this%matrix_ptr%free()
208 deallocate(this%matrix_ptr)
211 this%real_scalar = 0.0_rp
212 this%integer_scalar = 0
214 if (
allocated(this%name))
deallocate(this%name)
215 if (
allocated(this%type))
deallocate(this%type)
216 this%allocated = .false.
223 character(len=:),
allocatable :: name
224 name = trim(this%name)
230 character(len=:),
allocatable :: type
231 type = trim(this%type)
238 allocated = this%allocated
244 type(
field_t),
pointer :: field_ptr
245 if (this%get_type() .ne.
'field')
then
246 call neko_error(
"registry_entry::get_field: " &
247 //
"Registry entry is not of type 'field'.")
249 field_ptr => this%field_ptr
255 type(
vector_t),
pointer :: vector_ptr
256 if (this%get_type() .ne.
'vector')
then
257 call neko_error(
"registry_entry::get_vector: " &
258 //
"Registry entry is not of type 'vector'.")
260 vector_ptr => this%vector_ptr
266 type(
matrix_t),
pointer :: matrix_ptr
267 if (this%get_type() .ne.
'matrix')
then
268 call neko_error(
"registry_entry::get_field: " &
269 //
"Registry entry is not of type 'matrix'.")
271 matrix_ptr => this%matrix_ptr
277 real(kind=
rp),
pointer :: scalar_ptr
278 if (this%get_type() .ne.
'real_scalar')
then
279 call neko_error(
"registry_entry::get_real_scalar: " &
280 //
"Registry entry is not of type 'real_scalar'.")
282 scalar_ptr => this%real_scalar
288 integer,
pointer :: scalar_ptr
289 if (this%get_type() .ne.
'integer_scalar')
then
290 call neko_error(
"registry_entry::get_integer_scalar: " &
291 //
"Registry entry is not of type 'integer_scalar'.")
293 scalar_ptr => this%integer_scalar
Defines a mapping of the degrees of freedom.
integer, parameter, public rp
Global precision used in computations.
Defines a registry entry for storing and requesting temporary objects This is used in the registries ...
real(kind=rp) function, pointer get_real_scalar(this)
Get the real scalar pointer of the registry entry.
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_real_scalar(this, val, name)
Initialize a scalar register entry.
subroutine init_register_matrix(this, nrows, ncols, name)
Initialize a register entry.
subroutine init_register_vector(this, n, name)
Initialize a register entry.
subroutine init_register_integer_scalar(this, val, name)
Initialize an integer scalar 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.
integer function, pointer get_integer_scalar(this)
Get the integer scalar pointer of the registry entry.