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)
111 call this%sensitivity_old%init(design_size)
113 if (
present(mask_name))
then
114 if (mask_name .ne.
"")
then
115 this%has_mask = .true.
116 this%mask => neko_point_zone_registry%get_point_zone(mask_name)
120 if (
present(start_time))
then
121 this%start_time = start_time
123 this%start_time = 0.0_rp
126 if (
present(end_time))
then
127 this%end_time = end_time
129 this%end_time = huge(0.0_rp)
132 end subroutine constraint_init_base
135 subroutine constraint_free_base(this)
136 class(constraint_t),
target,
intent(inout) :: this
141 this%value_old = 0.0_rp
142 this%start_time = 0.0_rp
143 this%end_time = huge(0.0_rp)
144 call this%sensitivity%free()
145 call this%sensitivity_old%free()
147 this%has_mask = .false.
148 if (
associated(this%mask))
nullify(this%mask)
150 end subroutine constraint_free_base
156 subroutine constraint_wrapper_free(this)
157 class(constraint_wrapper_t),
intent(inout) :: this
158 if (
allocated(this%constraint))
then
159 call this%constraint%free()
160 deallocate(this%constraint)
162 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.