Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
design_factory.f90
1
34
36submodule(design) design_factory_mod
37 use json_utils, only: json_get
38 use utils, only: neko_type_error
39
40 ! Import the design function types
41 use brinkman_design, only: brinkman_design_t
42 use simple_design, only: simple_design_t
43
44 implicit none
45
47 character(len=25), parameter :: KNOWN_TYPES(2) = [ character(len=25) :: &
48 "brinkman", &
49 "simple"]
50
51contains
52
53 ! -------------------------------------------------------------------------- !
54 ! Factory function
55
62 module subroutine design_factory(object, parameters, simulation)
63 class(design_t), allocatable, intent(inout) :: object
64 type(json_file), intent(inout) :: parameters
65 type(simulation_t), intent(inout), optional :: simulation
66 character(len=:), allocatable :: type
67
68 if (allocated(object)) then
69 call object%free()
70 deallocate(object)
71 end if
72
73 call json_get(parameters, "type", type)
74 select case (trim(type))
75 case ("brinkman")
76 allocate(brinkman_design_t::object)
77 case ("simple")
78 allocate(simple_design_t::object)
79
80 case default
81 call neko_type_error("design", type, KNOWN_TYPES)
82 end select
83
84 if (present(simulation)) then
85 call object%init_from_json_sim(parameters, simulation)
86 else
87 call object%init_from_json(parameters)
88 end if
89 end subroutine design_factory
90
91end submodule design_factory_mod
Implements the design_t.
Definition design.f90:36
A topology optimization design variable.
A topology optimization design variable.