30 use const_gbl,
only: stdout
49 integer :: matrix_type
51 integer :: matrix_mode
52 integer :: excluded_rowcol = 2000000000
54 logical :: constructed = .false.
55 integer :: matrix_dimension
58 logical :: remove_row_column = .false.
59 real(wp),
allocatable :: diagonal(:)
60 logical :: initialized = .false.
103 use precisn,
only: wp
106 integer,
intent(in) :: i, j
107 real(wp),
intent(in) :: coefficient
108 integer,
intent(in) :: class
109 real(wp),
intent(in) :: thresh
115 use precisn,
only: wp
118 integer,
intent(in) :: idx
119 integer,
intent(out) :: i, j
120 real(wp),
intent(out) :: coeff
149 if (.not. this % constructed)
then
150 write (stdout,
"('Vector::constructed - Vector is not constructed')")
151 stop
"Vector::constructed - Vector is not constructed"
163 integer,
intent(in) :: mat_mode
164 real(wp),
optional,
intent(in) :: threshold
168 if (
present(threshold))
then
169 this % threshold = threshold
174 this % matrix_mode = mat_mode
176 call this % construct_self
177 this % remove_row_column = .false.
178 this % constructed = .true.
189 integer,
intent(in) :: row_column
191 this % excluded_rowcol = row_column
192 if (this % excluded_rowcol > 0)
then
193 this % remove_row_column = .true.
205 integer,
intent(in) :: matrix_size, matrix_type, block_size
208 this % initialized = .true.
209 this % matrix_dimension = matrix_size
210 this % matrix_type = matrix_type
211 this % block_size = block_size
213 if (this % remove_row_column .and. this % excluded_rowcol <= this % matrix_dimension)
then
214 this % matrix_dimension = this % matrix_dimension - 1
217 if (
allocated(this % diagonal))
deallocate(this % diagonal)
218 write (stdout,
"('Allocating dimension ',i12)") this % matrix_dimension
220 allocate(this % diagonal(this % matrix_dimension), stat = ierr)
226 call this % initialize_struct_self(this % matrix_dimension, this % matrix_type, this % block_size)
239 class(
options),
intent(in) :: option_val
251 integer,
intent(in) :: matrix_size, matrix_type, block_size
261 integer,
intent(in) :: i, j
262 real(wp),
intent(in) :: coefficient
263 integer,
intent(in),
optional :: class_
264 real(wp),
intent(in),
optional :: thresh_
266 integer ::
class, i_, j_
270 if (.not. this % initialized)
then
271 stop
"Matrix structure not initialized"
274 if (
present(thresh_))
then
277 thresh = this % threshold
280 if (
present(class_))
then
296 if (this % remove_row_column)
then
297 if (i_ == this % excluded_rowcol)
return
298 if (j_ == this % excluded_rowcol)
return
299 if (i_ > this % excluded_rowcol) i_ = i_ - 1
300 if (j_ > this % excluded_rowcol) j_ = j_ - 1
302 if (i == j)
call this % store_diagonal(i, coefficient)
303 if (abs(coefficient) < thresh)
return
305 call this % insert_matelem_self(i_, j_, coefficient,
class, thresh)
316 integer,
intent(in) :: i
317 real(wp),
intent(in) :: coeff
320 this % diagonal(i) = coeff
331 integer,
intent(in) :: idx
332 integer,
intent(out) :: i, j
333 real(wp),
intent(out) :: coeff
335 if (this % check_bounds(idx))
then
336 call this % get_matelem_self(idx, i, j, coeff)
348 logical,
intent(in) :: force_update
358 logical,
intent(in) :: force_update
359 integer,
optional :: count_
378 integer,
intent(in) :: capacity
388 integer,
intent(in) :: i
390 if (i <= 0 .or. i > this % n)
then
391 write (stdout,
"('Vector::check_bounds - Out of Bounds access')")
392 stop
"Vector::check_bounds - Out of Bounds access"
431 call this % clear_self
432 this % initialized = .false.
456 if (.not. this % initialized)
then
457 stop
"Matrix structure not initialized"
475 call this % get_matrix_element(ido, i, j, coeff)
476 write (stdout,
"(i8,i8,D16.8)") i, j, coeff
488 integer :: num_arrays,ido
490 if (
allocated(this % diagonal))
deallocate(this % diagonal)
492 call this % destroy_self
494 this % constructed = .false.