File: TestValues.F90

package info (click to toggle)
gftl 1.3.0%2Bis-really-1.2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 1,328 kB
  • sloc: pascal: 4,163; f90: 3,551; sh: 27; fortran: 16; makefile: 2
file content (56 lines) | stat: -rw-r--r-- 1,190 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
program main
   use Values_mod
   implicit none
   class(AbstractValue),pointer :: vp
   integer :: k
   integer,allocatable :: k1(:)

   logical :: L
   logical,allocatable :: L1(:)

   real(kind=DP) :: r
   real(kind=DP),allocatable :: r1(:)

   character(len=MAX_LEN_ATTRIBUTE_STRING) :: s
   character(len=MAX_LEN_ATTRIBUTE_STRING),allocatable :: s1(:)

   class(AbstractValue),allocatable :: AbV

   allocate(AbV, source=newValue(1000))
   call AbV%getValue(k)
   print*,k
   call AbV%setValue(k+1000)
   call AbV%getValue(k)
   print*,k
   deallocate(Abv)
   
   allocate(AbV, source=newValue(.false.))
   call AbV%getValue(l)
   print*,l
   call AbV%setValue(.true.)
   call AbV%getValue(l)
   print*,l

   deallocate(Abv)
   allocate(AbV,source=newValue([10.0d0,20.0d0,200.0d0]))
   allocate(r1(Abv%dims(1)))
   call AbV%getValue(r1)
   print*,r1
   r1(3)= 10000.d0
   call AbV%setValue(r1)
   call AbV%getValue(r1)
   print*,r1

  
   deallocate(Abv)
   allocate(AbV,source=newValue(['0.0d0','1.1d0','2.2d0']))
   allocate(s1(Abv%dims(1)))
   call AbV%getValue(s1)
   print*,s1
   s1= '10000.d0'
   call AbV%setValue(s1)
   call AbV%getValue(s1)
   print*,s1

   
end program main