FrontISTR  6.0.0
Large-scale structural analysis program with finit element method
hecmw_api_result_data.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 !-------------------------------------------------------------------------------
5 
7  use iso_c_binding
8  use hecmw_result, only : hecmwst_result_data
9  implicit none
10 
11 contains
12 
15  function hecmw_api_result_new() bind(C,name='hecmw_api_result_new')
16  implicit none
17  type(c_ptr) :: hecmw_api_result_new
18  type(hecmwst_result_data), target, save :: hecresult
19  hecmw_api_result_new = c_loc(hecresult)
20  end function
21 
24  subroutine hecmw_api_result_delete(result) bind(C,name='hecmw_api_result_delete')
25  implicit none
26  type(c_ptr), value :: result
27  type(hecmwst_result_data), pointer :: hecRESULT
28  call c_f_pointer(cptr=result, fptr=hecresult)
29  call hecmw_result_free(hecresult)
30  end subroutine
31 
35  function hecmw_api_result_ng_component(result) bind(C,name='hecmw_api_result_ng_component')
36  implicit none
37  type(c_ptr), value :: result
38  integer(c_int) :: hecmw_api_result_ng_component
39  type(hecmwst_result_data), pointer :: hecresult
40  call c_f_pointer(cptr=result, fptr=hecresult)
41  hecmw_api_result_ng_component = hecresult%ng_component
42  end function
43 
52  subroutine hecmw_api_result_global_val(result,i,dof,label,label_len,value) bind(C,name='hecmw_api_result_global_val')
53  use hecmw_api_common, only : f_c_str_copy
54  use hecmw_result
55  implicit none
56  type(c_ptr), value :: result
57  integer(c_int), value :: i
58  integer(c_int), intent(out) :: dof
59  character(kind=c_char), intent(inout) :: label(*)
60  integer(c_int), value, intent(in) :: label_len
61  type(c_ptr), intent(out) :: value
62 
63  type(hecmwst_result_data), pointer :: hecRESULT
64  integer :: index, j
65 
66  call c_f_pointer(cptr=result, fptr=hecresult)
67  call f_c_str_copy(hecresult%global_label(i), label, label_len)
68  index = 1
69  do j=1, i-1
70  index = index + hecresult%ng_dof(j)
71  end do
72 
73  dof = hecresult%ng_dof(i)
74  value = c_loc(hecresult%global_val_item(index))
75  end subroutine
76 
80  function hecmw_api_result_nn_component(result) bind(C,name='hecmw_api_result_nn_component')
81  implicit none
82  type(c_ptr), value :: result
83  integer(c_int) :: hecmw_api_result_nn_component
84  type(hecmwst_result_data), pointer :: hecresult
85  call c_f_pointer(cptr=result, fptr=hecresult)
86  hecmw_api_result_nn_component = hecresult%nn_component
87  end function
88 
99  subroutine hecmw_api_result_node_val(result,i,dim,index,dof,label,label_len,value) bind(C,name='hecmw_api_result_node_val')
100  use hecmw_api_common, only : f_c_str_copy
101  use hecmw_result
102  implicit none
103  type(c_ptr), value :: result
104  integer(c_int), value :: i
105  integer(c_int), intent(out) :: dim
106  integer(c_int), intent(out) :: index
107  integer(c_int), intent(out) :: dof
108  character(kind=c_char), intent(inout) :: label(*)
109  integer(c_int), value, intent(in) :: label_len
110  type(c_ptr), intent(out) :: value
111 
112  type(hecmwst_result_data), pointer :: hecRESULT
113  integer :: j
114 
115  call c_f_pointer(cptr=result, fptr=hecresult)
116  call f_c_str_copy(hecresult%node_label(i), label, label_len)
117 
118  dof = hecresult%nn_dof(i)
119  index = 0
120  dim = 0
121  do j=1, i-1
122  index = index + hecresult%nn_dof(j)
123  dim = dim + hecresult%nn_dof(j)
124  end do
125  do j=i, hecresult%nn_component
126  dim = dim + hecresult%nn_dof(j)
127  end do
128  value = c_loc(hecresult%node_val_item)
129  end subroutine
130 
134  function hecmw_api_result_ne_component(result) bind(C,name='hecmw_api_result_ne_component')
135  implicit none
136  type(c_ptr), value :: result
137  integer(c_int) :: hecmw_api_result_ne_component
138  type(hecmwst_result_data), pointer :: hecresult
139  call c_f_pointer(cptr=result, fptr=hecresult)
140  hecmw_api_result_ne_component = hecresult%ne_component
141  end function
142 
153  subroutine hecmw_api_result_elem_val(result,i,dim,index,dof,label,label_len,value) bind(C,name='hecmw_api_result_elem_val')
154  use hecmw_api_common, only : f_c_str_copy
155  use hecmw_result
156  implicit none
157  type(c_ptr), value :: result
158  integer(c_int), value :: i
159  integer(c_int), intent(out) :: dim
160  integer(c_int), intent(out) :: index
161  integer(c_int), intent(out) :: dof
162  character(kind=c_char), intent(inout) :: label(*)
163  integer(c_int), value, intent(in) :: label_len
164  type(c_ptr), intent(out) :: value
165 
166  integer :: j
167  type(hecmwst_result_data), pointer :: hecRESULT
168 
169  call c_f_pointer(cptr=result, fptr=hecresult)
170  call f_c_str_copy(hecresult%elem_label(i), label, label_len)
171 
172  dof = hecresult%ne_dof(i)
173  index = 0
174  dim = 0
175  do j=1, i-1
176  index = index + hecresult%ne_dof(j)
177  dim = dim + hecresult%ne_dof(j)
178  end do
179  do j=i, hecresult%ne_component
180  dim = dim + hecresult%ne_dof(j)
181  end do
182  value = c_loc(hecresult%elem_val_item)
183  end subroutine
184 
185 end module
subroutine f_c_str_copy(f_str, c_str, c_len)
integer(c_int) function hecmw_api_result_ng_component(result)
計算結果に含まれる大域データの個数の取得
integer(c_int) function hecmw_api_result_nn_component(result)
計算結果に含まれる節点データの個数の取得
subroutine hecmw_api_result_node_val(result, i, dim, index, dof, label, label_len, value)
計算結果に含まれる節点データのラベルと値を取得
type(c_ptr) function hecmw_api_result_new()
計算結果ハンドラの生成
subroutine hecmw_api_result_global_val(result, i, dof, label, label_len, value)
計算結果に含まれる大域データのラベルと値を取得
subroutine hecmw_api_result_delete(result)
計算結果ハンドラの破棄
integer(c_int) function hecmw_api_result_ne_component(result)
計算結果に含まれる要素データの個数の取得
subroutine hecmw_api_result_elem_val(result, i, dim, index, dof, label, label_len, value)
計算結果に含まれる要素データのラベルと値を取得
I/O and Utility.