40 use num_types,
only: rp
41 use point_zone_registry,
only: neko_point_zone_registry
42 use json_module,
only: json_file
55 procedure, pass(this) :: init_base => constraint_init_base
57 procedure, pass(this) :: free_base => constraint_free_base
63 class(constraint_t),
allocatable :: constraint
65 procedure, pass(this) :: free => constraint_wrapper_free
78 module subroutine constraint_factory(object, json,
design, simulation)
79 class(constraint_t),
allocatable,
intent(inout) :: object
80 type(json_file),
intent(inout) :: json
81 class(design_t),
intent(in) :: design
82 type(simulation_t),
target,
optional,
intent(inout) :: simulation
83 end subroutine constraint_factory
84 end interface constraint_factory
98 subroutine constraint_init_base(this, name, design_size, mask_name, &
100 class(constraint_t),
intent(inout) :: this
101 character(len=*),
intent(in) :: name
102 integer,
intent(in) :: design_size
103 character(len=*),
intent(in),
optional :: mask_name
104 real(kind=rp),
intent(in),
optional :: start_time
105 real(kind=rp),
intent(in),
optional :: end_time
107 call this%free_base()
110 call this%sensitivity%init(design_size)
112 if (
present(mask_name))
then
113 if (mask_name .ne.
"")
then
114 this%has_mask = .true.
115 this%mask => neko_point_zone_registry%get_point_zone(mask_name)
119 if (
present(start_time))
then
120 this%start_time = start_time
122 this%start_time = 0.0_rp
125 if (
present(end_time))
then
126 this%end_time = end_time
128 this%end_time = huge(0.0_rp)
131 end subroutine constraint_init_base
134 subroutine constraint_free_base(this)
135 class(constraint_t),
target,
intent(inout) :: this
140 this%value_weight = 0.0_rp
141 this%sensitivity_weight = 0.0_rp
142 this%start_time = 0.0_rp
143 this%end_time = huge(0.0_rp)
144 call this%sensitivity%free()
146 this%has_mask = .false.
147 if (
associated(this%mask))
nullify(this%mask)
149 end subroutine constraint_free_base
155 subroutine constraint_wrapper_free(this)
156 class(constraint_wrapper_t),
intent(inout) :: this
157 if (
allocated(this%constraint))
then
158 call this%constraint%free()
159 deallocate(this%constraint)
161 end subroutine constraint_wrapper_free
Factory function Allocates and initializes an constraint function object.
Defines the abstract the base_functional_t type.
Implements the constraint_t type.
Implements the steady_problem_t type.
The base functional type.
The abstract constraint type.
Wrapper for constraints for use in lists.