CalculiX  2.13
A Free Software Three-Dimensional Structural Finite Element Program
matvec_struct.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine matvec_struct (n, x, y, nelt, ia, ja, a, isym)
 

Function/Subroutine Documentation

◆ matvec_struct()

subroutine matvec_struct ( integer  n,
real*8, dimension(*)  x,
real*8, dimension(*)  y,
integer  nelt,
integer, dimension(*)  ia,
integer, dimension(*)  ja,
real*8, dimension(*)  a,
integer  isym 
)
27  use omp_lib
28 !
29  implicit none
30 !
31  integer ia(*),ja(*),i,j,l,n,nelt,isym,nd,na
32  real*8 y(*),x(*),a(*)
33 !
34 ! number of off-diagonal terms
35 !
36  nd=nelt-n
37 !
38  if(isym.eq.0) then
39  na=nd/2
40 !
41 ! non-symmetric
42 !
43 ! diagonal terms
44 !
45 c$omp parallel default(none)
46 c$omp& shared(n,x,a,y,nd,ja,ia,na)
47 c$omp& private(i,l,j)
48 c$omp do
49  do i=1,n
50  y(i)=a(nd+i)*x(i)
51  enddo
52 c$omp end do
53 !
54 ! off-diagonal terms
55 !
56 ! number of upper triangular terms
57 !
58 c$omp do
59  do j=1,n
60  do l=ja(j),ja(j+1)-1
61  i=ia(l)
62 c$omp atomic
63  y(i)=y(i)+a(l)*x(j)
64  enddo
65  enddo
66 c$omp end do
67 !
68 c$omp do
69  do j=1,n
70  do l=ja(j),ja(j+1)-1
71  i=ia(l)
72  y(j)=y(j)+a(l+na)*x(i)
73  enddo
74  enddo
75 c$omp end do
76 c$omp end parallel
77 !
78  else
79 !
80 ! symmetric
81 !
82 ! diagonal terms
83 !
84 c$omp parallel default(none)
85 c$omp& shared(n,x,a,y,nd,ja,ia)
86 c$omp& private(i,l,j)
87 c$omp do
88  do i=1,n
89  y(i)=a(nd+i)*x(i)
90  enddo
91 c$omp end do
92 !
93 ! off-diagonal terms
94 !
95 c$omp do
96  do j=1,n
97  do l=ja(j),ja(j+1)-1
98  i=ia(l)
99 c$omp atomic
100  y(i)=y(i)+a(l)*x(j)
101  enddo
102  enddo
103 c$omp end do
104 !
105 c$omp do
106  do j=1,n
107  do l=ja(j),ja(j+1)-1
108  i=ia(l)
109  y(j)=y(j)+a(l)*x(i)
110  enddo
111  enddo
112 c$omp end do
113 c$omp end parallel
114  endif
115 !
116  return
Hosted by OpenAircraft.com, (Michigan UAV, LLC)