Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
mapping.f90
Go to the documentation of this file.
1! Copyright (c) 2023, The Neko Authors
2! All rights reserved.
3!
4! Redistribution and use in source and binary forms, with or without
5! modification, are permitted provided that the following conditions
6! are met:
7!
8! * Redistributions of source code must retain the above copyright
9! notice, this list of conditions and the following disclaimer.
10!
11! * Redistributions in binary form must reproduce the above
12! copyright notice, this list of conditions and the following
13! disclaimer in the documentation and/or other materials provided
14! with the distribution.
15!
16! * Neither the name of the authors nor the names of its
17! contributors may be used to endorse or promote products derived
18! from this software without specific prior written permission.
19!
20! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23! FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24! COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25! INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26! BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28! CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30! ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31! POSSIBILITY OF SUCH DAMAGE.
32!
33!
35module mapping
36 use num_types, only: rp
37 use json_module, only: json_file
38 use coefs, only: coef_t
39 use field, only: field_t
40 implicit none
41 private
42
44 type, abstract, public :: mapping_t
46 type(coef_t), pointer :: coef => null()
47
48 contains
50 procedure, pass(this) :: init_base => mapping_init_base
52 procedure, pass(this) :: free_base => mapping_free_base
54 procedure(mapping_init), pass(this), deferred :: init
56 procedure(mapping_free), pass(this), deferred :: free
58 procedure(mapping_apply), pass(this), deferred :: apply_forward
60 procedure(mapping_apply_backward), pass(this), deferred :: apply_backward
61 end type mapping_t
62
63
64
65
66 abstract interface
67
70 subroutine mapping_init(this, json, coef)
71 import mapping_t, json_file, coef_t
72 class(mapping_t), intent(inout) :: this
73 type(json_file), intent(inout) :: json
74 type(coef_t), intent(inout) :: coef
75 end subroutine mapping_init
76 end interface
77
78 abstract interface
79
80 subroutine mapping_free(this)
81 import mapping_t
82 class(mapping_t), intent(inout) :: this
83 end subroutine mapping_free
84 end interface
85
86 abstract interface
87
90 subroutine mapping_apply(this, X_out, X_in)
91 import mapping_t, field_t
92 class(mapping_t), intent(inout) :: this
93 type(field_t), intent(in) :: X_in
94 type(field_t), intent(inout) :: X_out
95 end subroutine mapping_apply
96 end interface
97
98 abstract interface
99
107 subroutine mapping_apply_backward(this, dF_dX_in, dF_dX_out, X_in)
108 import mapping_t, field_t
109 class(mapping_t), intent(inout) :: this
110 type(field_t), intent(in) :: dF_dX_out
111 type(field_t), intent(in) :: X_in
112 type(field_t), intent(inout) :: dF_dX_in
113 end subroutine mapping_apply_backward
114 end interface
115contains
116
118 subroutine mapping_init_base(this, json, coef)
119 class(mapping_t), intent(inout) :: this
120 type(json_file), intent(inout) :: json
121 type(coef_t), intent(inout), target :: coef
122
123 this%coef => coef
124
125 end subroutine mapping_init_base
126
128 subroutine mapping_free_base(this)
129 class(mapping_t), intent(inout) :: this
130
131 nullify(this%coef)
132 end subroutine mapping_free_base
133
134
135
136end module mapping
The application of the mapping backward with chain rule). $\frac{\partial F}{\partial \tilde{\rho}} \...
Definition mapping.f90:107
The application of the mapping ($\rho \mapsto \tilde{\rho}$).
Definition mapping.f90:90
The common constructor using a JSON dictionary.
Definition mapping.f90:70
Mappings to be applied to a scalar field.
Definition mapping.f90:35
subroutine mapping_init_base(this, json, coef)
Constructor for the mapping_t (base) class.
Definition mapping.f90:119
subroutine mapping_free_base(this)
Destructor for the mapping_t (base) class.
Definition mapping.f90:129
Base abstract class for mapping.
Definition mapping.f90:44