40 use num_types,
only: rp
41 use point_zone_registry,
only: neko_point_zone_registry
42 use json_module,
only: json_file
54 real(kind=rp) :: weight = 1.0_rp
59 procedure, pass(this) :: init_base => objective_init_base
61 procedure, pass(this) :: free_base => objective_free_base
63 procedure, pass(this) :: get_weight => objective_get_weight
69 class(objective_t),
allocatable :: objective
71 procedure, pass(this) :: free => objective_wrapper_free
84 module subroutine objective_factory(object, json,
design, simulation)
85 class(objective_t),
allocatable,
intent(inout) :: object
86 type(json_file),
intent(inout) :: json
87 class(design_t),
intent(in) :: design
88 type(simulation_t),
target,
optional,
intent(inout) :: simulation
89 end subroutine objective_factory
90 end interface objective_factory
103 subroutine objective_init_base(this, name, design_size, weight, mask_name)
104 class(objective_t),
intent(inout) :: this
105 character(len=*),
intent(in) :: name
106 integer,
intent(in) :: design_size
107 real(kind=rp),
intent(in) :: weight
108 character(len=*),
intent(in),
optional :: mask_name
110 call this%free_base()
113 call this%sensitivity%init(design_size)
114 call this%sensitivity_old%init(design_size)
118 if (
present(mask_name))
then
119 if (mask_name .ne.
"")
then
120 this%has_mask = .true.
121 this%mask => neko_point_zone_registry%get_point_zone(mask_name)
125 end subroutine objective_init_base
128 subroutine objective_free_base(this)
129 class(objective_t),
target,
intent(inout) :: this
135 this%value_old = 0.0_rp
136 call this%sensitivity%free()
137 call this%sensitivity_old%free()
139 this%has_mask = .false.
140 if (
associated(this%mask))
nullify(this%mask)
142 end subroutine objective_free_base
148 subroutine objective_wrapper_free(this)
149 class(objective_wrapper_t),
intent(inout) :: this
150 if (
allocated(this%objective))
then
151 call this%objective%free()
152 deallocate(this%objective)
154 end subroutine objective_wrapper_free
157 pure function objective_get_weight(this)
result(w)
158 class(objective_t),
intent(in) :: this
161 end function objective_get_weight
Factory function Allocates and initializes an objective function object.
Defines the abstract the base_functional_t type.
Implements the objective_t type.
Implements the steady_problem_t type.
The base functional type.
The abstract objective type.
Wrapper for objectives for use in lists.