MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
tabletermmodule Module Reference

Data Types

type  tabletermtype
 

Functions/Subroutines

subroutine initialize (this, tag, width, alignment)
 
integer(i4b) function get_width (this)
 
integer(i4b) function get_alignment (this)
 
integer(i4b) function get_header_lines (this)
 
subroutine allocate_scalars (this)
 
subroutine da (this)
 
subroutine set_header (this, nlines)
 
subroutine get_header (this, iline, cval)
 

Function/Subroutine Documentation

◆ allocate_scalars()

subroutine tabletermmodule::allocate_scalars ( class(tabletermtype this)

Definition at line 204 of file TableTerm.f90.

205 ! ******************************************************************************
206 ! allocate_scalars -- allocate table term scalars
207 ! ******************************************************************************
208 !
209 ! SPECIFICATIONS:
210 ! ------------------------------------------------------------------------------
211  ! -- modules
212  ! -- dummy
213  class(TableTermType) :: this
214 ! ------------------------------------------------------------------------------
215  !
216  ! -- allocate scalars
217  allocate (this%tag)
218  allocate (this%alignment)
219  allocate (this%width)
220  allocate (this%nheader_lines)
221  !
222  ! -- initialize scalars
223  this%nheader_lines = 0
224  !
225  ! -- return
226  return

◆ da()

subroutine tabletermmodule::da ( class(tabletermtype this)

Definition at line 229 of file TableTerm.f90.

230 ! ******************************************************************************
231 ! da -- deallocate table terms
232 ! ******************************************************************************
233 !
234 ! SPECIFICATIONS:
235 ! ------------------------------------------------------------------------------
236  ! -- modules
237  ! -- dummy
238  class(TableTermType) :: this
239  ! -- local
240  !integer(I4B) :: n
241 ! ------------------------------------------------------------------------------
242  !
243  ! -- deallocate scalars
244  deallocate (this%tag)
245  deallocate (this%alignment)
246  deallocate (this%width)
247  deallocate (this%nheader_lines)
248  deallocate (this%header_lines)
249  !
250  ! -- return

◆ get_alignment()

integer(i4b) function tabletermmodule::get_alignment ( class(tabletermtype this)

Definition at line 164 of file TableTerm.f90.

165 ! ******************************************************************************
166 ! get_width -- get column width
167 ! ******************************************************************************
168 !
169 ! SPECIFICATIONS:
170 ! ------------------------------------------------------------------------------
171  ! -- return variable
172  integer(I4B) :: get_alignment
173  ! -- modules
174  ! -- dummy
175  class(TableTermType) :: this
176  ! -- local
177 ! ------------------------------------------------------------------------------
178  get_alignment = this%alignment
179  !
180  ! -- return
181  return

◆ get_header()

subroutine tabletermmodule::get_header ( class(tabletermtype this,
integer(i4b), intent(in)  iline,
character(len=*), intent(inout)  cval 
)

Definition at line 301 of file TableTerm.f90.

302 ! ******************************************************************************
303 ! get_header -- get header entry for table term iline
304 ! ******************************************************************************
305 !
306 ! SPECIFICATIONS:
307 ! ------------------------------------------------------------------------------
308  ! -- modules
309  ! -- dummy
310  class(TableTermType) :: this
311  integer(I4B), intent(in) :: iline
312  character(len=*), intent(inout) :: cval
313  ! -- return variable
314  ! -- local
315 ! ------------------------------------------------------------------------------
316  !
317  ! -- set return value
318  cval = this%header_lines(iline) (1:this%width)
319  !
320  ! -- return

◆ get_header_lines()

integer(i4b) function tabletermmodule::get_header_lines ( class(tabletermtype this)

Definition at line 184 of file TableTerm.f90.

185 ! ******************************************************************************
186 ! get_header_lines -- get the number of lines in initial_lines
187 ! ******************************************************************************
188 !
189 ! SPECIFICATIONS:
190 ! ------------------------------------------------------------------------------
191  ! -- return variable
192  integer(I4B) :: get_header_lines
193  ! -- modules
194  ! -- dummy
195  class(TableTermType) :: this
196  ! -- local
197 ! ------------------------------------------------------------------------------
198  get_header_lines = this%nheader_lines
199  !
200  ! -- return
201  return

◆ get_width()

integer(i4b) function tabletermmodule::get_width ( class(tabletermtype this)

Definition at line 144 of file TableTerm.f90.

145 ! ******************************************************************************
146 ! get_width -- get column width
147 ! ******************************************************************************
148 !
149 ! SPECIFICATIONS:
150 ! ------------------------------------------------------------------------------
151  ! -- return variable
152  integer(I4B) :: get_width
153  ! -- modules
154  ! -- dummy
155  class(TableTermType) :: this
156  ! -- local
157 ! ------------------------------------------------------------------------------
158  get_width = this%width
159  !
160  ! -- return
161  return

◆ initialize()

subroutine tabletermmodule::initialize ( class(tabletermtype this,
character(len=*), intent(in)  tag,
integer(i4b), intent(in)  width,
integer(i4b), intent(in), optional  alignment 
)

Definition at line 41 of file TableTerm.f90.

42 ! ******************************************************************************
43 ! initialize -- initialize the table term
44 ! ******************************************************************************
45 !
46 ! SPECIFICATIONS:
47 ! ------------------------------------------------------------------------------
48  ! -- modules
49  ! -- dummy
50  class(TableTermType) :: this
51  character(len=*), intent(in) :: tag
52  integer(I4B), intent(in) :: width
53  integer(I4B), intent(in), optional :: alignment
54  ! -- local
55  character(len=LINELENGTH) :: string
56  character(len=LINELENGTH) :: tstring
57  character(len=LINELENGTH), allocatable, dimension(:) :: words
58  integer(I4B) :: nwords
59  integer(I4B) :: ilen
60  integer(I4B) :: i
61  integer(I4B) :: j
62 
63 ! ------------------------------------------------------------------------------
64  !
65  ! -- allocate scalars
66  call this%allocate_scalars()
67 
68  ! -- process dummy variables
69  this%tag = tag
70 
71  if (present(alignment)) then
72  this%alignment = alignment
73  else
74  this%alignment = tabcenter
75  end if
76 
77  this%width = width
78  !
79  ! -- parse tag into words
80  call parseline(tag, nwords, words, 0)
81  !
82  ! -- abbreviate any words that exceed the specified width
83  ! and trim trailing characters
84  do i = 1, nwords
85  ilen = len(trim(words(i)))
86  if (ilen > width) then
87  words(i) (width:width) = '.'
88  do j = width + 1, ilen
89  words(i) (j:j) = ' '
90  end do
91  end if
92  end do
93  !
94  ! -- combine words that fit into width
95  i = 0
96  do
97  i = i + 1
98  if (i > nwords) then
99  exit
100  end if
101  string = trim(adjustl(words(i)))
102  tstring = string
103  do j = i + 1, nwords
104  if (len(trim(adjustl(string))) > 0) then
105  tstring = trim(adjustl(tstring))//' '//trim(adjustl(words(j)))
106  else
107  tstring = trim(adjustl(words(j)))
108  end if
109  ilen = len(trim(adjustl(tstring)))
110  if (ilen == 0) then
111  continue
112  else if (ilen <= width) then
113  words(j) = ' '
114  string = tstring
115  else
116  exit
117  end if
118  end do
119  words(i) = string
120  end do
121  !
122  ! -- calculate the number of header lines
123  do i = 1, nwords
124  ilen = len(trim(adjustl(words(i))))
125  if (ilen > 0) then
126  this%nheader_lines = this%nheader_lines + 1
127  end if
128  end do
129  !
130  ! allocate initial_lines and fill with words
131  allocate (this%initial_lines(this%nheader_lines))
132  do i = 1, this%nheader_lines
133  this%initial_lines(i) = words(i) (1:width)
134  end do
135  !
136  ! -- deallocate words
137  deallocate (words)
138  !
139  ! -- return
140  return
141 
Here is the call graph for this function:

◆ set_header()

subroutine tabletermmodule::set_header ( class(tabletermtype this,
integer(i4b), intent(in)  nlines 
)

Definition at line 253 of file TableTerm.f90.

254 ! ******************************************************************************
255 ! set_header -- set final header lines for table term
256 ! ******************************************************************************
257 !
258 ! SPECIFICATIONS:
259 ! ------------------------------------------------------------------------------
260  ! -- modules
261  ! -- dummy
262  class(TableTermType) :: this
263  integer(I4B), intent(in) :: nlines
264  ! -- local
265  character(len=this%width) :: string
266  integer(I4B) :: idiff
267  integer(I4B) :: i0
268  integer(I4B) :: i
269  integer(I4B) :: j
270 ! ------------------------------------------------------------------------------
271  !
272  ! -- initialize variables
273  string = ' '
274  !
275  ! allocate header_lines
276  allocate (this%header_lines(nlines))
277  !
278  ! -- initialize header lines
279  do i = 1, nlines
280  this%header_lines(i) = string
281  end do
282  !
283  ! -- fill header_lines with initial_lines from
284  ! bottom to top
285  idiff = nlines - this%nheader_lines
286  i0 = 1 - idiff
287  do i = this%nheader_lines, 1, -1
288  j = i + idiff
289  this%header_lines(j) = this%initial_lines(i)
290  end do
291  !
292  ! -- deallocate temporary header lines
293  deallocate (this%initial_lines)
294  !
295  ! -- reinitialize nheader_lines
296  this%nheader_lines = nlines
297  !
298  ! -- return