46 type(
field_t),
private,
allocatable :: fields(:)
50 integer,
private :: expansion_size
52 procedure,
private, pass(this) ::
expand
83 integer,
optional,
intent(in) :: size
84 integer,
optional,
intent(in) :: expansion_size
88 if (
present(size))
then
89 allocate (this%fields(size))
91 allocate (this%fields(50))
94 if (
present(expansion_size))
then
95 this%expansion_size = expansion_size
97 this%expansion_size = 50
107 if (
allocated(this%fields))
then
108 do i=1, this%n_fields()
109 call this%fields(i)%free()
111 deallocate(this%fields)
114 this%expansion_size = 0
120 type(
field_t),
allocatable :: temp(:)
122 allocate(temp(this%n + this%expansion_size))
123 temp(1:this%n) = this%fields(1:this%n)
124 call move_alloc(temp, this%fields)
134 subroutine add_field(this, dof, fld_name, ignore_existing)
136 type(
dofmap_t),
target,
intent(in) :: dof
137 character(len=*),
target,
intent(in) :: fld_name
138 logical,
optional,
intent(in) :: ignore_existing
140 if (this%field_exists(fld_name))
then
141 if (
present(ignore_existing) .and. ignore_existing .eqv. .true.)
then
144 call neko_error(
"Field with name " // fld_name // &
145 " is already registered")
149 if (this%n_fields() ==
size(this%fields))
then
156 call this%fields(this%n)%init( dof, fld_name)
178 n =
size(this%fields)
186 n = this%expansion_size
192 integer,
intent(in) :: i
197 else if (i > this%n_fields())
then
198 call neko_error(
"Field index exceeds number of stored fields")
207 character(len=*),
intent(in) ::name
214 do i=1, this%n_fields()
215 if (this%fields(i)%name == name)
then
222 if (.not. found)
then
224 " could not be found in the registry")
231 character(len=*),
intent(in) ::name
236 do i=1, this%n_fields()
237 if (this%fields(i)%name == name)
then
Defines a mapping of the degrees of freedom.
Defines a registry for storing solution fields.
subroutine field_registry_free(this)
Destructor.
subroutine expand(this)
Expand the fields array so as to accomodate more fields.
pure integer function get_expansion_size(this)
Get the expansion size.
type(field_registry_t), target, public neko_field_registry
Global field registry.
pure integer function get_size(this)
Get the size of the fields array.
pure integer function n_fields(this)
Get the number of fields stored in the registry.
logical function field_exists(this, name)
Check if a field with a given name is already in the registry.
type(field_t) function, pointer get_field_by_index(this, i)
Get pointer to a stored field by index.
subroutine field_registry_init(this, size, expansion_size)
Constructor.
type(field_t) function, pointer get_field_by_name(this, name)
Get pointer to a stored field by field name.
subroutine add_field(this, dof, fld_name, ignore_existing)
Add a field to the registry.
Implements a hash table ADT.