Report Typos and Errors    
Semi-Lagrangian Library
Modular library for kinetic and gyrokinetic simulations of plasmas in fusion energy devices.
sll_m_vector_space_c1_block.F90
Go to the documentation of this file.
1 
5 !
7 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8 #include "sll_errors.h"
9 
10  use sll_m_working_precision, only: f64
11 
13 
15 
17 
18  implicit none
19 
21 
22  private
23 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
24 
26  integer, parameter :: wp = f64
27 
29 
30  integer :: n1
31  integer :: n2
32  integer :: p1
33  integer :: p2
34 
35  type(sll_t_vector_space_real_array_1d) :: vd ! dense component
36  type(sll_t_vector_space_real_array_2d) :: vs ! stencil component
37 
38  contains
39 
40  procedure :: init => s_vector_space_c1_block__init
41 
43  procedure :: copy => s_vector_space_c1_block__copy
44  procedure :: incr => s_vector_space_c1_block__incr
46 
48  procedure :: add => s_vector_space_c1_block__add
49  procedure :: mult => s_vector_space_c1_block__mult
50  procedure :: mult_add => s_vector_space_c1_block__mult_add
51  procedure :: incr_mult => s_vector_space_c1_block__incr_mult
52  procedure :: lcmb => s_vector_space_c1_block__lcmb
53  procedure :: incr_lcmb => s_vector_space_c1_block__incr_lcmb
54 
56  procedure :: norm => f_vector_space_c1_block__norm
57  procedure :: inner => f_vector_space_c1_block__inner
59 
61 
62  ! Error messages
63  character(len=*), parameter :: wrong_type_x = "x not of type 'sll_t_vector_space_c1_block'"
64  character(len=*), parameter :: wrong_type_y = "y not of type 'sll_t_vector_space_c1_block'"
65 
66 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
67 contains
68 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
69 
70  subroutine s_vector_space_c1_block__init(self, n1, n2, p1, p2)
71  class(sll_t_vector_space_c1_block), intent(inout) :: self
72  integer, intent(in) :: n1
73  integer, intent(in) :: n2
74  integer, intent(in) :: p1
75  integer, intent(in) :: p2
76 
77  self%n1 = n1
78  self%n2 = n2
79  self%p1 = p1
80  self%p2 = p2
81 
82  end subroutine s_vector_space_c1_block__init
83 
84  !-----------------------------------------------------------------------------
85  subroutine s_vector_space_c1_block__copy(self, x)
86  class(sll_t_vector_space_c1_block), intent(inout) :: self
87  class(sll_c_vector_space), intent(in) :: x
88 
89  character(len=*), parameter :: this_sub_name = "sll_t_vector_space_c1_block % copy"
90 
91  select type (x)
92 
94 
95  call self%vd%copy(x%vd)
96  call self%vs%copy(x%vs)
97 
98  class default
99  sll_error(this_sub_name, wrong_type_x)
100 
101  end select
102 
103  end subroutine s_vector_space_c1_block__copy
104 
105  !-----------------------------------------------------------------------------
106  subroutine s_vector_space_c1_block__incr(self, x)
107  class(sll_t_vector_space_c1_block), intent(inout) :: self
108  class(sll_c_vector_space), intent(in) :: x
109 
110  character(len=*), parameter :: this_sub_name = "sll_t_vector_space_c1_block % incr"
111 
112  select type (x)
113 
114  class is (sll_t_vector_space_c1_block)
115 
116  call self%vd%incr(x%vd)
117  call self%vs%incr(x%vs)
118 
119  class default
120  sll_error(this_sub_name, wrong_type_x)
121 
122  end select
123 
124  end subroutine s_vector_space_c1_block__incr
125 
126  !-----------------------------------------------------------------------------
127  subroutine s_vector_space_c1_block__scal(self, a)
128  class(sll_t_vector_space_c1_block), intent(inout) :: self
129  real(wp), intent(in) :: a
130 
131  call self%vd%scal(a)
132  call self%vs%scal(a)
133 
134  end subroutine s_vector_space_c1_block__scal
135 
136  !-----------------------------------------------------------------------------
137  subroutine s_vector_space_c1_block__add(self, x, y)
138  class(sll_t_vector_space_c1_block), intent(inout) :: self
139  class(sll_c_vector_space), intent(in) :: x
140  class(sll_c_vector_space), intent(in) :: y
141 
142  character(len=*), parameter :: this_sub_name = "sll_t_vector_space_c1_block % add"
143 
144  select type (x)
145 
146  class is (sll_t_vector_space_c1_block)
147 
148  select type (y)
149 
150  class is (sll_t_vector_space_c1_block)
151 
152  call self%vd%add(x%vd, y%vd)
153  call self%vs%add(x%vs, y%vs)
154 
155  class default
156 
157  sll_error(this_sub_name, wrong_type_y)
158 
159  end select
160 
161  class default
162 
163  sll_error(this_sub_name, wrong_type_x)
164 
165  end select
166 
167  end subroutine s_vector_space_c1_block__add
168 
169  !-----------------------------------------------------------------------------
170  subroutine s_vector_space_c1_block__mult(self, a, x)
171  class(sll_t_vector_space_c1_block), intent(inout) :: self
172  real(wp), intent(in) :: a
173  class(sll_c_vector_space), intent(in) :: x
174 
175  character(len=*), parameter :: this_sub_name = "sll_t_vector_space_c1_block % mult"
176 
177  select type (x)
178 
179  class is (sll_t_vector_space_c1_block)
180 
181  call self%vd%mult(a, x%vd)
182  call self%vs%mult(a, x%vs)
183 
184  class default
185 
186  sll_error(this_sub_name, wrong_type_x)
187 
188  end select
189 
190  end subroutine s_vector_space_c1_block__mult
191 
192  !-----------------------------------------------------------------------------
193  subroutine s_vector_space_c1_block__mult_add(self, a, x, y)
194  class(sll_t_vector_space_c1_block), intent(inout) :: self
195  real(wp), intent(in) :: a
196  class(sll_c_vector_space), intent(in) :: x
197  class(sll_c_vector_space), intent(in) :: y
198 
199  character(len=*), parameter :: this_sub_name = "sll_t_vector_space_c1_block % mult_add"
200 
201  select type (x)
202 
203  class is (sll_t_vector_space_c1_block)
204 
205  select type (y)
206 
207  class is (sll_t_vector_space_c1_block)
208 
209  call self%vd%mult_add(a, x%vd, y%vd)
210  call self%vs%mult_add(a, x%vs, y%vs)
211 
212  class default
213 
214  sll_error(this_sub_name, wrong_type_y)
215 
216  end select
217 
218  class default
219 
220  sll_error(this_sub_name, wrong_type_x)
221 
222  end select
223 
224  end subroutine s_vector_space_c1_block__mult_add
225 
226  !-----------------------------------------------------------------------------
227  subroutine s_vector_space_c1_block__incr_mult(self, a, x)
228  class(sll_t_vector_space_c1_block), intent(inout) :: self
229  real(wp), intent(in) :: a
230  class(sll_c_vector_space), intent(in) :: x
231 
232  character(len=*), parameter :: this_sub_name = "sll_t_vector_space_c1_block % incr_mult"
233 
234  select type (x)
235 
236  class is (sll_t_vector_space_c1_block)
237 
238  call self%vd%incr_mult(a, x%vd)
239  call self%vs%incr_mult(a, x%vs)
240 
241  class default
242 
243  sll_error(this_sub_name, wrong_type_x)
244 
245  end select
246 
248 
249  !----------------------------------------------------------------------------
250  subroutine s_vector_space_c1_block__lcmb(self, a, x)
251  class(sll_t_vector_space_c1_block), intent(inout) :: self
252  real(wp), intent(in) :: a(:)
253  class(sll_c_vector_space), intent(in) :: x(:)
254 
255  character(len=*), parameter :: this_sub_name = "sll_t_vector_space_c1_block % lcmb"
256 
257  select type (x)
258 
259  class is (sll_t_vector_space_c1_block)
260 
261  call self%vd%lcmb(a, x%vd)
262  call self%vs%lcmb(a, x%vs)
263 
264  class default
265 
266  sll_error(this_sub_name, wrong_type_x)
267 
268  end select
269 
270  end subroutine s_vector_space_c1_block__lcmb
271 
272  !-----------------------------------------------------------------------------
273  subroutine s_vector_space_c1_block__incr_lcmb(self, a, x)
274  class(sll_t_vector_space_c1_block), intent(inout) :: self
275  real(wp), intent(in) :: a(:)
276  class(sll_c_vector_space), intent(in) :: x(:)
277 
278  character(len=*), parameter :: this_sub_name = "sll_t_vector_space_c1_block % incr_lcmb"
279 
280  select type (x)
281 
282  class is (sll_t_vector_space_c1_block)
283 
284  call self%vd%incr_lcmb(a, x%vd)
285  call self%vs%incr_lcmb(a, x%vs)
286 
287  class default
288 
289  sll_error(this_sub_name, wrong_type_x)
290 
291  end select
292 
294 
295  !-----------------------------------------------------------------------------
296  function f_vector_space_c1_block__norm(self) result(res)
297  class(sll_t_vector_space_c1_block), intent(in) :: self
298  real(wp) :: res
299 
300  res = sqrt(self%inner(self))
301 
302  end function f_vector_space_c1_block__norm
303 
304  !-----------------------------------------------------------------------------
305  function f_vector_space_c1_block__inner(self, x) result(res)
306  class(sll_t_vector_space_c1_block), intent(in) :: self
307  class(sll_c_vector_space), intent(in) :: x
308  real(wp) :: res
309 
310  character(len=*), parameter :: this_fun_name = "sll_t_vector_space_c1_block % inner"
311 
312  select type (x)
313 
314  class is (sll_t_vector_space_c1_block)
315 
316  associate(n1 => self%n1, n2 => self%n2)
317  res = self%vd%inner(x%vd) + &
318  sum(self%vs%array(1:n1, 1:n2)*x%vs%array(1:n1, 1:n2))
319  end associate
320 
321  class default
322 
323  sll_error(this_fun_name, wrong_type_x)
324 
325  end select
326 
327  end function f_vector_space_c1_block__inner
328 
Abstract type implementing a generic vector space.
Vector space for wrapping 2D Fortran real arrays.
subroutine s_vector_space_c1_block__mult(self, a, x)
subroutine s_vector_space_c1_block__init(self, n1, n2, p1, p2)
character(len= *), parameter wrong_type_y
subroutine s_vector_space_c1_block__mult_add(self, a, x, y)
subroutine s_vector_space_c1_block__add(self, x, y)
real(wp) function f_vector_space_c1_block__norm(self)
integer, parameter wp
Working precision.
subroutine s_vector_space_c1_block__incr_mult(self, a, x)
subroutine s_vector_space_c1_block__incr_lcmb(self, a, x)
subroutine s_vector_space_c1_block__lcmb(self, a, x)
character(len= *), parameter wrong_type_x
real(wp) function f_vector_space_c1_block__inner(self, x)
Vector space for wrapping 1D Fortran real arrays.
Vector space for wrapping 2D Fortran real arrays.
Module to select the kind parameter.
integer, parameter, public f64
f64 is the kind type for 64-bit reals (double precision)
function scal(x, y, n)
Definition: sol.f:173
Abstract base class for all vector spaces.
    Report Typos and Errors