FrontISTR  6.0.0
Large-scale structural analysis program with finit element method
hecmw_mf_graph.f90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
2 ! Copyright (c) 2026 FrontISTR Commons
3 ! This software is released under the MIT License, see LICENSE.txt
4 !-------------------------------------------------------------------------------
7  use hecmw_util
8  implicit none
9 
10  private
11  public :: hecmwst_mf_graph
13  public :: hecmw_mf_graph_set
14  public :: hecmw_mf_graph_finalize
15 
19  type hecmwst_mf_graph
20  integer(kind=kint) :: nnode = 0
21  integer(kind=kint), allocatable :: ndof(:)
22  integer(kind=kint), allocatable :: dofptr(:)
23  integer(kind=kint), allocatable :: xadj(:)
24  integer(kind=kint), allocatable :: adjncy(:)
25  end type hecmwst_mf_graph
26 
27 contains
28 
32  subroutine hecmw_mf_graph_from_hecmat(hecMAT, graph)
33  implicit none
34  type(hecmwst_matrix), intent(in) :: hecmat
35  type(hecmwst_mf_graph), intent(out) :: graph
36  integer(kind=kint) :: n, i, k, l
37 
38  n = hecmat%NP
39  graph%nnode = n
40  allocate(graph%ndof(n))
41  allocate(graph%dofptr(n+1))
42  allocate(graph%xadj(n+1))
43  graph%ndof(1:n) = hecmat%NDOF
44  graph%dofptr(1) = 1
45  graph%xadj(1) = 1
46  do i = 1, n
47  graph%dofptr(i+1) = graph%dofptr(i) + graph%ndof(i)
48  graph%xadj(i+1) = graph%xadj(i) &
49  + (hecmat%indexL(i) - hecmat%indexL(i-1)) + (hecmat%indexU(i) - hecmat%indexU(i-1))
50  enddo
51  allocate(graph%adjncy(graph%xadj(n+1)-1))
52  l = 0
53  do i = 1, n
54  do k = hecmat%indexL(i-1)+1, hecmat%indexL(i)
55  l = l + 1
56  graph%adjncy(l) = hecmat%itemL(k)
57  enddo
58  do k = hecmat%indexU(i-1)+1, hecmat%indexU(i)
59  l = l + 1
60  graph%adjncy(l) = hecmat%itemU(k)
61  enddo
62  enddo
63  end subroutine hecmw_mf_graph_from_hecmat
64 
66  subroutine hecmw_mf_graph_set(graph, nnode, ndof, xadj, adjncy)
67  implicit none
68  type(hecmwst_mf_graph), intent(out) :: graph
69  integer(kind=kint), intent(in) :: nnode
70  integer(kind=kint), intent(in) :: ndof(:)
71  integer(kind=kint), intent(in) :: xadj(:)
72  integer(kind=kint), intent(in) :: adjncy(:)
73  integer(kind=kint) :: i
74 
75  graph%nnode = nnode
76  allocate(graph%ndof(nnode))
77  allocate(graph%dofptr(nnode+1))
78  allocate(graph%xadj(nnode+1))
79  allocate(graph%adjncy(xadj(nnode+1)-1))
80  graph%ndof(1:nnode) = ndof(1:nnode)
81  graph%dofptr(1) = 1
82  do i = 1, nnode
83  graph%dofptr(i+1) = graph%dofptr(i) + graph%ndof(i)
84  enddo
85  graph%xadj(1:nnode+1) = xadj(1:nnode+1)
86  graph%adjncy(1:xadj(nnode+1)-1) = adjncy(1:xadj(nnode+1)-1)
87  end subroutine hecmw_mf_graph_set
88 
89  subroutine hecmw_mf_graph_finalize(graph)
90  implicit none
91  type(hecmwst_mf_graph), intent(inout) :: graph
92 
93  graph%nnode = 0
94  if (allocated(graph%ndof)) deallocate(graph%ndof)
95  if (allocated(graph%dofptr)) deallocate(graph%dofptr)
96  if (allocated(graph%xadj)) deallocate(graph%xadj)
97  if (allocated(graph%adjncy)) deallocate(graph%adjncy)
98  end subroutine hecmw_mf_graph_finalize
99 
100 end module hecmw_mf_graph
Compressed (node level) graph of a block sparse matrix for the multifrontal solver.
subroutine, public hecmw_mf_graph_from_hecmat(hecMAT, graph)
Build the node graph from the nonzero pattern of hecMAT (values are not referenced)....
subroutine, public hecmw_mf_graph_finalize(graph)
subroutine, public hecmw_mf_graph_set(graph, nnode, ndof, xadj, adjncy)
Build the node graph from explicit arrays (synthetic graphs in tests).
I/O and Utility.
Definition: hecmw_util_f.F90:7