FrontISTR  5.7.0
Large-scale structural analysis program with finit element method
hecmw_mat_con.f90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
2 ! Copyright (c) 2019 FrontISTR Commons
3 ! This software is released under the MIT License, see LICENSE.txt
4 !-------------------------------------------------------------------------------
5 
7  use hecmw_util
9  use hecmw_etype
10  implicit none
11 
12  private
13 
14  public :: hecmw_mat_con
15 
16 contains
17  !C***
18  !C*** MAT_CON for solver
19  !C***
20  !C
21  subroutine hecmw_mat_con ( hecMESH, hecMAT )
22  type (hecmwst_matrix) :: hecmat
23  type (hecmwst_local_mesh) :: hecmesh
24 
25  type (hecmwst_varray_int), allocatable :: clu(:), cll(:)
26  integer(kind=kint) :: itype, is, ie, iss, ise, ic_type, icel
27  integer(kind=kint) :: i, j, k, kk
28  integer(kind=kint) :: nn, nid(2048), nid1, nid2
29 
30  !C
31  !C +-------+
32  !C | INIT. |
33  !C +-------+
34  !C===
35  hecmat%NP= hecmesh%n_node
36  hecmat%N = hecmesh%nn_internal
37 
38  !C===
39  !C
40  !C +----------------------------------------+
41  !C | CONNECTIVITY according to ELEMENT TYPE |
42  !C +----------------------------------------+
43  !C===
44  call hecmw_varray_int_initialize_all( clu, hecmat%NP, 27 )
45  call hecmw_varray_int_initialize_all( cll, hecmat%NP, 27 )
46  do itype= 1, hecmesh%n_elem_type
47  is= hecmesh%elem_type_index(itype-1) + 1
48  ie= hecmesh%elem_type_index(itype )
49  ic_type= hecmesh%elem_type_item(itype)
50  if( hecmw_is_etype_patch(ic_type) ) cycle
51  !C element loop
52  do icel= is, ie
53  iss = hecmesh%elem_node_index(icel-1)
54  ise = hecmesh%elem_node_index(icel )
55  nn = ise-iss
56  do j=1,nn
57  nid(j) = hecmesh%elem_node_item (iss+j)
58  enddo
59  do j=1,nn
60  nid1 = nid(j)
61  do k=1,nn
62  nid2 = nid(k)
63  if( nid1 < nid2 ) then
64  call hecmw_varray_int_insert_if_not_exists( clu(nid1), nid2 )
65  else if( nid1 > nid2 ) then
66  call hecmw_varray_int_insert_if_not_exists( cll(nid1), nid2 )
67  end if
68  enddo
69  enddo
70  enddo
71  enddo
72 
73  !C===
74  !C
75  !C +---------------------------+
76  !C | ALLOCATE hecMAT structure |
77  !C +---------------------------+
78  !C===
79  allocate (hecmat%indexL(0:hecmat%NP), hecmat%indexU(0:hecmat%NP))
80 
81  hecmat%indexL = 0
82  hecmat%indexU = 0
83  do i = 1, hecmat%NP
84  hecmat%indexL(i) = hecmat%indexL(i-1) + hecmw_varray_int_get_nitem(cll(i))
85  hecmat%indexU(i) = hecmat%indexU(i-1) + hecmw_varray_int_get_nitem(clu(i))
86  enddo
87 
88  hecmat%NPL = hecmat%indexL(hecmat%NP)
89  hecmat%NPU = hecmat%indexU(hecmat%NP)
90 
91  allocate (hecmat%itemL(hecmat%NPL), hecmat%itemU(hecmat%NPU))
92 
93  do i=1,hecmat%NP
94  do k=1,hecmw_varray_int_get_nitem(cll(i))
95  kk = k + hecmat%indexL(i-1)
96  hecmat%itemL(kk) = hecmw_varray_int_get_item(cll(i), k)
97  enddo
98  do k=1,hecmw_varray_int_get_nitem(clu(i))
99  kk = k + hecmat%indexU(i-1)
100  hecmat%itemU(kk) = hecmw_varray_int_get_item(clu(i), k)
101  enddo
102  enddo
103 
106 
107  end subroutine
108 
109 end module hecmw_matrix_con
hecmw_varray_int
Definition: hecmw_varray_int.h:9
hecmw_varray_int::hecmw_varray_int_initialize_all
subroutine, public hecmw_varray_int_initialize_all(ilists, nlists, n_init_in)
Definition: hecmw_varray_int_f.f90:52
hecmw_matrix_con
Definition: hecmw_mat_con.f90:6
hecmw_varray_int::hecmw_varray_int_get_item
integer(kind=kint) function, public hecmw_varray_int_get_item(ilist, n)
Definition: hecmw_varray_int_f.f90:215
hecmw_varray_int::hecmw_varray_int_finalize_all
subroutine, public hecmw_varray_int_finalize_all(ilists)
Definition: hecmw_varray_int_f.f90:72
hecmw_util
I/O and Utility.
Definition: hecmw_util_f.F90:7
hecmw_util::hecmwst_local_mesh
Definition: hecmw_util_f.F90:234
hecmw_etype::hecmw_is_etype_patch
logical function hecmw_is_etype_patch(etype)
Definition: hecmw_etype_f.f90:128
hecmw_varray_int::hecmw_varray_int_insert_if_not_exists
subroutine, public hecmw_varray_int_insert_if_not_exists(ilist, ival)
Definition: hecmw_varray_int_f.f90:153
hecmw_varray_int::hecmw_varray_int_get_nitem
integer(kind=kint) function, public hecmw_varray_int_get_nitem(ilist)
Definition: hecmw_varray_int_f.f90:209
hecmw_matrix_con::hecmw_mat_con
subroutine, public hecmw_mat_con(hecMESH, hecMAT)
Definition: hecmw_mat_con.f90:22
hecmw_etype
I/O and Utility.
Definition: hecmw_etype_f.f90:7
hecmw_util::hecmwst_matrix
Definition: hecmw_util_f.F90:444