File: TestTracer.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 (66 lines) | stat: -rw-r--r-- 1,630 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
57
58
59
60
61
62
63
64
65
66
program main
   use Values_mod
   use AttributeMap_mod
   use Tracer_mod
   implicit none
   class(AbstractValue),pointer :: vp
   type (AttributeMap) :: aMap
   type (Tracer) :: aTracer,bTracer
   integer :: k
   integer,allocatable :: k1d(:)

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

   logical :: l
   logical,allocatable :: l1d(:)

   character(len=MAX_LEN_ATTRIBUTE_STRING) :: s
   character(len=MAX_LEN_ATTRIBUTE_STRING),allocatable :: s1d(:)
   character(len=:), allocatable :: name

   ! test init and addAttribute
   call aTracer%init('atrcer')
   call aTracer%addAttribute('r',1.0d0)
   call aTracer%addAttribute('l1d',[.true.,.true.,.false.])
   call aTracer%addAttribute('s1d',['.true.','.true.','.fals.'])

   ! test getAttribute .
  ! vp=>null()
  ! L=aTracer%getAttribute('l1d',vp)
    L=aTracer%attributes%get('l1d',vp)
    call vp%print()

   ! test setAttribute .
   allocate(l1d(3))
   l1d=[.false.,.false.,.false.]
   call aTracer%setAttribute('l1d',l1d)
   l1d=[.true.,.true.,.true.]
   L= aTracer%getAttribute('l1d',l1d)
   print*,"should be F F F :",l1d

   ! test getName
   name=aTracer%getName()
   print*,name

   ! test hasAttribute
   L= aTracer%hasAttribute('r')
   print*,"should be T :", L
   L= aTracer%hasAttribute('rr')
   print*, "should be F:", L

   ! test =
   bTracer = aTracer
   l1d=[.true.,.true.,.true.]
   L= bTracer%getAttribute('l1d',l1d)
   if(L) print*,l1d
   allocate(s1d(3))
   L= bTracer%getAttribute('s1d',s1d)
   if(L) print*,'should be .true.,.true.,.fals. :',s1d
   
   call bTracer%print()

   ! test clear()
   call bTracer%clear()

end program main