Report Typos and Errors    
Semi-Lagrangian Library
Modular library for kinetic and gyrokinetic simulations of plasmas in fusion energy devices.
sll_m_linear_operator_abstract.F90
Go to the documentation of this file.
1 
12 
14  !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
15 #include "sll_working_precision.h"
16 
17  implicit none
18 
19  public :: &
21 
22  private
23  ! ..................................................
27  sll_int32 :: n_rows = 0
28  sll_int32 :: n_cols = 0
29  sll_int32 :: n_global_rows = 0
30  sll_int32 :: n_global_cols = 0
31  sll_int32 :: n_block_rows = 1
32  sll_int32 :: n_block_cols = 1
33  sll_int32 :: n_dof = 1
34  logical :: is_allocated = .false.
35 
36  sll_int32, dimension(:), allocatable :: id_rows
37  sll_int32, dimension(:), allocatable :: id_cols
38 
39  contains
40 
41  procedure :: initialize_abstract => initialize_linear_operator_abstract
42  procedure :: print_info_abstract => print_info_linear_operator_abstract
43 
44  procedure(sll_p_dot_linear_operator_abstract), deferred :: dot
45  procedure(sll_p_print_info_linear_operator_abstract), deferred :: print_info
46  procedure(sll_p_free_linear_operator_abstract), deferred :: free
47 
49  ! ..................................................
50 
51  ! ..................................................
52  abstract interface
53  subroutine sll_p_dot_linear_operator_abstract(self, x, y)
56 
57  class(sll_t_linear_operator_abstract), intent(in) :: self
58  sll_real64, dimension(:), intent(in ) :: x
59  sll_real64, dimension(:), intent( out) :: y
61  end interface
62  ! ..................................................
63 
64  ! ..................................................
65  abstract interface
68 
69  class(sll_t_linear_operator_abstract), intent(in) :: self
71  end interface
72  ! ..................................................
73 
74  ! ..................................................
75  abstract interface
78  class(sll_t_linear_operator_abstract), intent(inout) :: self
80  end interface
81  ! ..................................................
82 
83 contains
84  ! ........................................................
98  & other, &
99  & n_rows, n_cols, &
100  & n_global_rows, n_global_cols, &
101  & n_block_rows, n_block_cols, &
102  & id_rows, id_cols)
103  implicit none
104  class(sll_t_linear_operator_abstract), intent(inout) :: self
105  class(sll_t_linear_operator_abstract), optional, intent(in) :: other
106  sll_int32, optional, intent(in) :: n_rows
107  sll_int32, optional, intent(in) :: n_cols
108  sll_int32, optional, intent(in) :: n_global_rows
109  sll_int32, optional, intent(in) :: n_global_cols
110  sll_int32, optional, intent(in) :: n_block_rows
111  sll_int32, optional, intent(in) :: n_block_cols
112  sll_int32, dimension(:), optional, intent(in) :: id_rows
113  sll_int32, dimension(:), optional, intent(in) :: id_cols
114 
115  ! ...
116  if (present(other)) then
117  self % n_rows = other % n_rows
118  self % n_cols = other % n_cols
119 
120  self % n_global_rows = other % n_global_rows
121  self % n_global_cols = other % n_global_cols
122 
123  self % n_block_rows = other % n_block_rows
124  self % n_block_cols = other % n_block_cols
125 
126  else
127  ! ...
128  if (present(n_rows)) then
129  self % n_rows = n_rows
130  end if
131 
132  if (present(n_global_rows)) then
133  self % n_global_rows = n_global_rows
134  end if
135 
136  if ((present(n_rows)) .and. (.not. (present(n_global_rows)))) then
137  self % n_global_rows = n_rows
138  end if
139 
140  if ((present(n_global_rows)) .and. (.not. (present(n_rows)))) then
141  self % n_rows = n_global_rows
142  end if
143  ! ...
144 
145  ! ...
146  if (present(n_cols)) then
147  self % n_cols = n_cols
148  end if
149 
150  if (present(n_global_cols)) then
151  self % n_global_cols = n_global_cols
152  end if
153 
154  if ((present(n_cols)) .and. (.not. (present(n_global_cols)))) then
155  self % n_global_cols = n_cols
156  end if
157 
158  if ((present(n_global_cols)) .and. (.not. (present(n_cols)))) then
159  self % n_cols = n_global_cols
160  end if
161  ! ...
162 
163  ! ...
164  if ((present(n_block_rows))) then
165  self % n_block_rows = n_block_rows
166  end if
167  ! ...
168 
169  ! ...
170  if ((present(n_block_cols))) then
171  self % n_block_cols = n_block_cols
172  end if
173  ! ...
174  end if
175  ! ...
176 
177  if (present(id_rows).and.present(id_cols)) then
178  self % n_rows = size(id_rows)
179  self % n_cols = size(id_cols)
180  allocate( self % id_rows(self % n_rows))
181  allocate( self % id_cols(self % n_cols))
182 
183  self % id_rows = id_rows
184  self % id_cols = id_cols
185  endif
186 
187  ! ...
188  self % n_dof = self % n_block_rows * self % n_block_cols
189  ! ...
191  ! ........................................................
192 
193  ! ........................................................
198  implicit none
199  class(sll_t_linear_operator_abstract), intent(in) :: self
200  ! local
201 
202  print *, "* n_bloc_rows : ", self % n_block_rows
203  print *, "* n_bloc_cols : ", self % n_block_cols
204  print *, "* n_rows : ", self % n_rows
205  print *, "* n_cols : ", self % n_cols
206  print *, "* n_global_rows : ", self % n_global_rows
207  print *, "* n_global_cols : ", self % n_global_cols
208  print *, "* n_dof : ", self % n_dof
209 
211  ! ........................................................
212 
module for abstract linear operator
subroutine initialize_linear_operator_abstract(self, other, n_rows, n_cols, n_global_rows, n_global_cols, n_block_rows, n_block_cols, id_rows, id_cols)
initialize linear solver from a linear operator or given attributs
subroutine print_info_linear_operator_abstract(self)
prints a linear operator
Module to select the kind parameter.
    Report Typos and Errors