Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
constraint_factory.f90
1
34
36submodule(constraint) constraint_factory_mod
37 use json_utils, only: json_get
38 use utils, only: neko_type_error
39
40 ! Import the constraint function types
42
43 implicit none
44
46 character(len=25), parameter :: KNOWN_TYPES(1) = [ character(len=25) :: &
47 "volume"]
48
49contains
50
51 ! -------------------------------------------------------------------------- !
52 ! Factory function
53
55 module subroutine constraint_factory(object, json, design, simulation)
56 class(constraint_t), allocatable, intent(inout) :: object
57 type(json_file), intent(inout) :: json
58 class(design_t), intent(in) :: design
59 type(simulation_t), target, optional, intent(inout) :: simulation
60 character(len=:), allocatable :: type
61
62 if (allocated(object)) then
63 call object%free()
64 deallocate(object)
65 end if
66
67 call json_get(json, "type", type)
68 select case (trim(type))
69 case ("volume")
70 allocate(volume_constraint_t::object)
71 case default
72 call neko_type_error("Constraint", type, KNOWN_TYPES)
73 end select
74
75 call object%init(json, design, simulation)
76 end subroutine constraint_factory
77
78end submodule constraint_factory_mod
Implements the constraint_t type.
Implements the design_t.
Definition design.f90:36
Implements the volume_constraint_t type. Either .
A constraint on the volume of the design.