MODFLOW 6  version 6.6.0.dev0
USGS Modular Hydrologic Model
seqvectormodule Module Reference

Data Types

type  seqvectortype
 

Functions/Subroutines

subroutine sqv_create_mm (this, n, name, mem_path)
 Create a sequential vector: the classic MF6 version,. More...
 
subroutine sqv_create (this, n)
 Create a sequential vector: the classic MF6 version. More...
 
subroutine sqv_destroy (this)
 Clean up. More...
 
real(dp) function, dimension(:), pointer, contiguous sqv_get_array (this)
 Get a pointer to the underlying data array. More...
 
subroutine sqv_get_ownership_range (this, start, end)
 
integer(i4b) function sqv_get_size (this)
 
real(dp) function sqv_get_value_local (this, idx)
 Get value at local index. More...
 
subroutine sqv_zero_entries (this)
 set all elements to zero More...
 
subroutine sqv_set_value_local (this, idx, val)
 Set vector value at local index. More...
 
subroutine sqv_axpy (this, alpha, vec_x)
 Caculcates AXPY: y = a*x + y. More...
 
real(dp) function sqv_norm2 (this)
 Calculate the 2-norm. More...
 
subroutine sqv_print (this)
 

Function/Subroutine Documentation

◆ sqv_axpy()

subroutine seqvectormodule::sqv_axpy ( class(seqvectortype this,
real(dp)  alpha,
class(vectorbasetype), pointer  vec_x 
)
private
Parameters
thisthis vector
alphathe factor
vec_xthe vector to add

Definition at line 135 of file SeqVector.f90.

136  class(SeqVectorType) :: this !< this vector
137  real(DP) :: alpha !< the factor
138  class(VectorBaseType), pointer :: vec_x !< the vector to add
139  ! local
140  integer(I4B) :: i
141  real(DP), dimension(:), pointer, contiguous :: x_array
142 
143  x_array => vec_x%get_array()
144  do i = 1, this%size
145  this%array(i) = alpha * x_array(i) + this%array(i)
146  end do
147 

◆ sqv_create()

subroutine seqvectormodule::sqv_create ( class(seqvectortype this,
integer(i4b)  n 
)
private
Parameters
thisthis vector
nthe nr. of elements in the vector

Definition at line 46 of file SeqVector.f90.

47  class(SeqVectorType) :: this !< this vector
48  integer(I4B) :: n !< the nr. of elements in the vector
49 
50  this%size = n
51  this%is_mem_managed = .false.
52  allocate (this%array(n))
53  call this%zero_entries()
54 

◆ sqv_create_mm()

subroutine seqvectormodule::sqv_create_mm ( class(seqvectortype this,
integer(i4b)  n,
character(len=*)  name,
character(len=*)  mem_path 
)
Parameters
thisthis vector
nthe nr. of elements in the vector
namethe variable name (for access through memory manager)
mem_pathmemory path for storing the underlying memory items

Definition at line 31 of file SeqVector.f90.

32  class(SeqVectorType) :: this !< this vector
33  integer(I4B) :: n !< the nr. of elements in the vector
34  character(len=*) :: name !< the variable name (for access through memory manager)
35  character(len=*) :: mem_path !< memory path for storing the underlying memory items
36 
37  this%size = n
38  this%is_mem_managed = .true.
39  call mem_allocate(this%array, n, name, mem_path)
40  call this%zero_entries()
41 

◆ sqv_destroy()

subroutine seqvectormodule::sqv_destroy ( class(seqvectortype this)
private
Parameters
thisthis vector

Definition at line 59 of file SeqVector.f90.

60  class(SeqVectorType) :: this !< this vector
61 
62  if (this%is_mem_managed) then
63  call mem_deallocate(this%array)
64  else
65  deallocate (this%array)
66  end if
67 

◆ sqv_get_array()

real(dp) function, dimension(:), pointer, contiguous seqvectormodule::sqv_get_array ( class(seqvectortype this)
private
Parameters
thisthis vector
Returns
the underlying data array for this vector

Definition at line 72 of file SeqVector.f90.

73  class(SeqVectorType) :: this !< this vector
74  real(DP), dimension(:), pointer, contiguous :: array !< the underlying data array for this vector
75 
76  array => this%array
77 

◆ sqv_get_ownership_range()

subroutine seqvectormodule::sqv_get_ownership_range ( class(seqvectortype this,
integer(i4b)  start,
integer(i4b)  end 
)
private
Parameters
thisthis vector
startthe index of the first element in the vector
endthe index of the last element in the vector

Definition at line 80 of file SeqVector.f90.

81  class(SeqVectorType) :: this !< this vector
82  integer(I4B) :: start !< the index of the first element in the vector
83  integer(I4B) :: end !< the index of the last element in the vector
84 
85  start = 1
86  end = this%size
87 

◆ sqv_get_size()

integer(i4b) function seqvectormodule::sqv_get_size ( class(seqvectortype this)
private
Parameters
thisthis vector
Returns
the vector size

Definition at line 90 of file SeqVector.f90.

91  class(SeqVectorType) :: this !< this vector
92  integer(I4B) :: size !< the vector size
93 
94  size = this%size
95 

◆ sqv_get_value_local()

real(dp) function seqvectormodule::sqv_get_value_local ( class(seqvectortype this,
integer(i4b)  idx 
)
private
Parameters
thisthis vector
idxthe index in local numbering
Returns
the value

Definition at line 100 of file SeqVector.f90.

101  class(SeqVectorType) :: this !< this vector
102  integer(I4B) :: idx !< the index in local numbering
103  real(DP) :: val !< the value
104 
105  val = this%array(idx)
106 

◆ sqv_norm2()

real(dp) function seqvectormodule::sqv_norm2 ( class(seqvectortype this)
private
Parameters
thisthis vector

Definition at line 152 of file SeqVector.f90.

153  class(SeqVectorType) :: this !< this vector
154  real(DP) :: n2
155  ! local
156  integer(I4B) :: i
157 
158  n2 = dzero
159  do i = 1, this%size
160  n2 = n2 + this%array(i)**2
161  end do
162  n2 = sqrt(n2)
163 

◆ sqv_print()

subroutine seqvectormodule::sqv_print ( class(seqvectortype this)
private
Parameters
thisthis vector

Definition at line 166 of file SeqVector.f90.

167  class(SeqVectorType) :: this !< this vector
168 
169  write (*, *) this%array
170 

◆ sqv_set_value_local()

subroutine seqvectormodule::sqv_set_value_local ( class(seqvectortype this,
integer(i4b)  idx,
real(dp)  val 
)
private
Parameters
thisthis vector
idxthe index in local numbering
valthe value to set

Definition at line 124 of file SeqVector.f90.

125  class(SeqVectorType) :: this !< this vector
126  integer(I4B) :: idx !< the index in local numbering
127  real(DP) :: val !< the value to set
128 
129  this%array(idx) = val
130 

◆ sqv_zero_entries()

subroutine seqvectormodule::sqv_zero_entries ( class(seqvectortype this)
private
Parameters
thisthis vector

Definition at line 111 of file SeqVector.f90.

112  class(SeqVectorType) :: this !< this vector
113  ! local
114  integer(I4B) :: i
115 
116  do i = 1, this%size
117  this%array(i) = dzero
118  end do
119