39 use num_types,
only: rp
40 use point_zone_registry,
only: neko_point_zone_registry
41 use json_module,
only: json_file
52 real(kind=rp) :: weight = 1.0_rp
59 procedure, pass(this) :: free_base => objective_free_base
61 procedure, pass(this) :: get_weight => objective_get_weight
67 class(objective_t),
allocatable :: objective
69 procedure, pass(this) :: free => objective_wrapper_free
77 module subroutine objective_factory(object, json,
design, simulation)
78 class(objective_t),
allocatable,
intent(inout) :: object
79 type(json_file),
intent(inout) :: json
81 type(
simulation_t),
target,
optional,
intent(inout) :: simulation
82 end subroutine objective_factory
96 subroutine objective_init_base(this, name, design_size, weight, mask_name)
97 class(objective_t),
intent(inout) :: this
98 character(len=*),
intent(in) :: name
99 integer,
intent(in) :: design_size
100 real(kind=rp),
intent(in) :: weight
101 character(len=*),
intent(in),
optional :: mask_name
105 call this%sensitivity%init(design_size)
109 this%has_mask = .false.
110 if (trim(mask_name) .ne.
"")
then
111 this%has_mask = .true.
112 this%mask => neko_point_zone_registry%get_point_zone(mask_name)
115 end subroutine objective_init_base
118 subroutine objective_free_base(this)
119 class(objective_t),
target,
intent(inout) :: this
122 call this%sensitivity%free()
124 this%has_mask = .false.
125 if (
associated(this%mask))
nullify(this%mask)
127 end subroutine objective_free_base
133 subroutine objective_wrapper_free(this)
134 class(objective_wrapper_t),
intent(inout) :: this
135 if (
allocated(this%objective))
then
136 call this%objective%free()
137 deallocate(this%objective)
139 end subroutine objective_wrapper_free
142 pure function objective_get_weight(this)
result(w)
143 class(objective_t),
intent(in) :: this
146 end function objective_get_weight
Defines the abstract the base_functional_t type.
Implements the objective_t type.
subroutine objective_init_base(this, name, design_size, weight, mask_name)
Factory function interface.
Implements the steady_problem_t type.
The base functional type.
The abstract objective type.
Wrapper for objectives for use in lists.