42 use json_module,
only: json_file, json_core, json_value
50 integer,
private :: n = 0
52 integer,
private :: expansion_size
55 procedure,
private, pass(this) ::
expand
96 type(json_file),
intent(inout) :: json
97 type(
mesh_t),
target,
intent(inout) :: msh
98 integer,
optional,
intent(in) :: expansion_size
101 type(json_core) :: core
103 type(json_value),
pointer :: source_object, source_pointer
105 character(len=:),
allocatable :: buffer
107 type(json_file) :: source_subdict
109 integer :: n_zones, i
117 call json_get(json,
'case.numerics.polynomial_order', order)
120 if (msh%gdim .eq. 2)
then
121 call xh%init(
gll, order, order)
123 call xh%init(
gll, order, order, order)
129 if (
present(expansion_size))
then
130 this%expansion_size = expansion_size
132 this%expansion_size = 10
140 if(json%valid_path(
'case.point_zones'))
then
142 call json%get_core(core)
143 call json%get(
'case.point_zones', source_object, found)
145 n_zones = core%count(source_object)
148 allocate(this%point_zones(n_zones))
153 call core%get_child(source_object, i, source_pointer, found)
154 call core%print_to_string(source_pointer, buffer)
155 call source_subdict%load_from_string(buffer)
168 if (
allocated(this%point_zones))
then
170 do i=1, this%n_point_zones()
171 call this%point_zones(i)%pz%free()
174 deallocate(this%point_zones)
179 this%expansion_size = 0
188 allocate(temp(this%n + this%expansion_size))
189 temp(1:this%n) = this%point_zones(1:this%n)
190 call move_alloc(temp, this%point_zones)
199 type(json_file),
intent(inout) :: json
200 type(
dofmap_t),
target,
intent(inout) :: dof
202 character(len=:),
allocatable :: str_read
209 if (.not.
allocated(this%point_zones))
then
210 allocate(this%point_zones(this%expansion_size))
213 call json_get(json,
"name", str_read)
216 if (this%point_zone_exists(trim(str_read)))
then
217 call neko_error(
"Field with name " // trim(str_read) // &
218 " is already registered")
225 if (this%n_point_zones() .eq. this%get_size())
then
257 n =
size(this%point_zones)
266 n = this%expansion_size
274 integer,
intent(in) :: i
279 else if (i > this%n_point_zones())
then
280 call neko_error(
"Field index exceeds number of stored point_zones")
283 pz => this%point_zones(i)%pz
290 character(len=*),
intent(in) :: name
296 do i=1, this%n_point_zones()
297 if (trim(this%point_zones(i)%pz%name) .eq. trim(name))
then
298 pz => this%point_zones(i)%pz
304 if (.not. found)
then
305 call neko_error(
"Point zone " // trim(name) // &
306 " could not be found in the registry")
314 character(len=*),
intent(in) :: name
319 do i=1, this%n_point_zones()
320 if (trim(this%point_zones(i)%pz%name) .eq. trim(name))
then
Retrieves a parameter by name or throws an error.
Defines a mapping of the degrees of freedom.
Utilities for retrieving parameters from the case files.
Defines a factory subroutine for point zones.
subroutine, public point_zone_factory(point_zone, json, dof)
Point zone factory. Constructs, initializes, and maps the point zone object.
subroutine expand(this)
Expand the point_zones array so as to accomodate more point_zones.
subroutine point_zone_registry_free(this)
Destructor.
pure integer function n_point_zones(this)
Returns the number of point zones in the registry.
subroutine point_zone_registry_init(this, json, msh, expansion_size)
Constructor, reading from json point zones.
logical function point_zone_exists(this, name)
Checks if a point zone exists in the registry.
pure integer function get_size(this)
Returns the total size of the point_zones array (not the number of point zones in the registry!...
type(point_zone_registry_t), target, public neko_point_zone_registry
Global point_zone registry.
subroutine add_point_zone_from_json(this, json, dof)
Adds a point zone object to the registry from a json object.
class(point_zone_t) function, pointer get_point_zone_by_name(this, name)
Retrieves a point zone in the registry by its name.
pure integer function get_expansion_size(this)
Returns the expansion size with which the point_zone_registry_t was initialized.
class(point_zone_t) function, pointer get_point_zone_by_index(this, i)
Retrieves a point zone in the registry by its index in the point_zones array.
Defines a function space.
integer, parameter, public gll
Base abstract type for point zones.
A helper type to build a list of polymorphic point_zones.
The function space for the SEM solution fields.