~airpollution/fluidity/fluidity_airpollution

« back to all changes in this revision

Viewing changes to femtools/tests/test_tensormul.F90

  • Committer: ziyouzhj
  • Date: 2013-12-09 16:51:29 UTC
  • Revision ID: ziyouzhj@gmail.com-20131209165129-ucoetc3u0atyy05c
airpolution

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
subroutine test_tensormul
 
2
 
 
3
  use tensors
 
4
  use unittest_tools
 
5
  implicit none
 
6
 
 
7
  real, dimension(4, 5, 6, 7) :: tensorA
 
8
  real, dimension(6) :: vec6
 
9
  real, dimension(7) :: vec7
 
10
 
 
11
  real, dimension(4, 5, 7) :: resA
 
12
  real, dimension(4, 5, 6) :: resB
 
13
 
 
14
  real, dimension(2, 2, 2, 2) :: tensorB
 
15
  real, dimension(2) :: vec2
 
16
 
 
17
  real, dimension(2, 2, 2) :: resC
 
18
 
 
19
  logical :: fail
 
20
 
 
21
  tensorA = 1.0 ; vec6 = 1.0 ; vec7 = 1.0
 
22
 
 
23
  resA = tensormul(tensorA, vec6, 3)
 
24
 
 
25
  fail = .false.
 
26
  if (any(resA /= 6.0)) fail = .true.
 
27
 
 
28
  call report_test("[tensormul_4_1]", fail, .false., "Tensormul should give &
 
29
       & known output for known input.")
 
30
 
 
31
  resB = tensormul(tensorA, vec7, 4)
 
32
 
 
33
  fail = .false.
 
34
  if (any(resB /= 7.0)) fail = .true.
 
35
 
 
36
  call report_test("[tensormul_4_1]", fail, .false., "Tensormul should give &
 
37
       & known output for known input.")
 
38
 
 
39
  tensorB = 1.0 ; vec2 = 1.0
 
40
 
 
41
  resC = tensormul(tensorB, vec2, 3)
 
42
 
 
43
  fail = .false.
 
44
  if (any(resC /= 2.0)) fail = .true.
 
45
 
 
46
  call report_test("[tensormul_4_1]", fail, .false., "Tensormul should give &
 
47
       & known output for known input.")
 
48
 
 
49
end subroutine test_tensormul