15 subroutine hecmw_dist_copy_c2f_isalloc_if_c(sname, vname, is_allocated, ierr, len_s, len_v) &
16 bind(c,name=
'hecmw_dist_copy_c2f_isalloc_if')
18 type(c_ptr),
value :: sname, vname
19 integer(c_int) :: is_allocated, ierr
20 integer(c_int),
value :: len_s, len_v
21 end subroutine hecmw_dist_copy_c2f_isalloc_if_c
24 bind(c,name=
'hecmw_dist_copy_c2f_set_if')
26 type(c_ptr),
value :: sname, vname
27 type(c_ptr),
value :: dst
28 integer(c_int) :: ierr
29 integer(c_int),
value :: len_s, len_v
37 character(len=*),
target :: sname,vname
38 integer(c_int) :: is_allocated, ierr
39 call hecmw_dist_copy_c2f_isalloc_if_c(c_loc(sname), c_loc(vname), is_allocated, ierr, len(sname), len(vname))
44 character(len=*),
target :: sname,vname
45 type(*),
dimension(..),
target :: dst
46 integer(c_int) :: ierr
51 integer(kind=kint) :: ierr
54 call get_flags(mesh, ierr)
57 call get_etc(mesh, ierr)
60 call get_node(mesh, ierr)
63 call get_elem(mesh, ierr)
66 call get_comm(mesh, ierr)
69 call get_adapt(mesh, ierr)
72 call get_refine(mesh, ierr)
75 call get_sect(mesh%section, ierr)
78 call get_mat(mesh%material, ierr)
81 call get_mpc(mesh%mpc, ierr)
84 call get_amp(mesh%amp, ierr)
87 call get_ngrp(mesh%node_group, ierr)
90 call get_egrp(mesh%elem_group, ierr)
93 call get_sgrp(mesh%surf_group, ierr)
96 call get_contact_pair(mesh%contact_pair, ierr)
101 subroutine get_flags(mesh, ierr)
102 integer(kind=kint) :: ierr
104 character(len=100) :: sname,vname
106 sname =
'hecmwST_local_mesh'
108 vname =
'hecmw_flag_adapt'
112 vname =
'hecmw_flag_initcon'
116 vname =
'hecmw_flag_parttype'
120 vname =
'hecmw_flag_partdepth'
124 vname =
'hecmw_flag_version'
128 vname =
'hecmw_flag_partcontact'
131 end subroutine get_flags
134 subroutine get_etc(mesh, ierr)
135 integer(kind=kint) :: ierr
137 character(len=100) :: sname,vname
139 sname =
'hecmwST_local_mesh'
145 vname =
'hecmw_n_file'
149 if(mesh%hecmw_n_file > 0)
then
151 allocate(mesh%files(mesh%hecmw_n_file))
163 end subroutine get_etc
166 subroutine get_node(mesh, ierr)
167 integer(kind=kint) :: ierr,is_allocated
169 character(len=100) :: sname,vname
171 sname =
'hecmwST_local_mesh'
177 vname =
'n_node_gross'
185 vname =
'nn_internal'
189 if(mesh%nn_internal > 0)
then
190 vname =
'node_internal_list'
192 if(is_allocated == 1)
then
193 allocate(mesh%node_internal_list(mesh%nn_internal))
199 if(mesh%n_node_gross > 0)
then
201 allocate(mesh%node_ID(mesh%n_node_gross*2))
205 vname =
'global_node_ID'
206 allocate(mesh%global_node_ID(mesh%n_node_gross))
211 allocate(mesh%node(mesh%n_node_gross*3))
228 if(mesh%n_dof_grp > 0)
then
229 vname =
'node_dof_index'
230 allocate(mesh%node_dof_index(0:mesh%n_dof_grp))
234 vname =
'node_dof_item'
235 allocate(mesh%node_dof_item(mesh%n_dof_grp))
240 if(mesh%n_node_gross > 0)
then
241 vname =
'node_val_index'
243 if(is_allocated == 1)
then
244 allocate(mesh%node_val_index(0:mesh%n_node_gross))
249 vname =
'node_val_item'
251 if(is_allocated == 1)
then
252 if(mesh%node_val_index(mesh%n_node_gross) > 0)
then
253 allocate(mesh%node_val_item(mesh%node_val_index(mesh%n_node_gross)))
259 vname =
'node_init_val_index'
261 if(is_allocated == 1)
then
262 allocate(mesh%node_init_val_index(0:mesh%n_node_gross))
267 vname =
'node_init_val_item'
269 if(is_allocated == 1)
then
270 if(mesh%node_init_val_index(mesh%n_node_gross) > 0)
then
271 allocate(mesh%node_init_val_item(mesh%node_init_val_index(mesh%n_node_gross)))
277 end subroutine get_node
280 subroutine get_elem(mesh, ierr)
281 integer(kind=kint) :: ierr,is_allocated
283 character(len=100) :: sname,vname
285 sname =
'hecmwST_local_mesh'
291 vname =
'n_elem_gross'
295 vname =
'ne_internal'
299 if(mesh%ne_internal > 0)
then
300 vname =
'elem_internal_list'
302 if(is_allocated == 1)
then
303 allocate(mesh%elem_internal_list(mesh%ne_internal))
309 if(mesh%n_elem_gross > 0)
then
311 allocate(mesh%elem_ID(mesh%n_elem_gross*2))
315 vname =
'global_elem_ID'
316 allocate(mesh%global_elem_ID(mesh%n_elem_gross))
321 allocate(mesh%elem_type(mesh%n_elem_gross))
326 vname =
'n_elem_type'
330 if(mesh%n_elem_type > 0)
then
331 vname =
'elem_type_index'
332 allocate(mesh%elem_type_index(0:mesh%n_elem_type))
336 vname =
'elem_type_item'
337 allocate(mesh%elem_type_item(mesh%n_elem_type))
342 if(mesh%n_elem_gross > 0)
then
343 vname =
'elem_node_index'
344 allocate(mesh%elem_node_index(0:mesh%n_elem_gross))
348 vname =
'elem_node_item'
349 if(mesh%elem_node_index(mesh%n_elem_gross) > 0)
then
350 allocate(mesh%elem_node_item(mesh%elem_node_index(mesh%n_elem_gross)))
356 allocate(mesh%section_ID(mesh%n_elem_gross))
361 if(mesh%n_elem_gross > 0)
then
362 vname =
'elem_mat_ID_index'
363 allocate(mesh%elem_mat_ID_index(0:mesh%n_elem_gross))
367 if(mesh%elem_mat_ID_index(mesh%n_elem_gross) > 0)
then
368 vname =
'elem_mat_ID_item'
369 allocate(mesh%elem_mat_ID_item(mesh%elem_mat_ID_index(mesh%n_elem_gross)))
375 vname =
'n_elem_mat_ID'
379 if(mesh%n_elem_mat_ID > 0)
then
380 vname =
'elem_mat_int_index'
382 if(is_allocated == 1)
then
383 allocate(mesh%elem_mat_int_index(0:mesh%n_elem_gross))
388 vname =
'elem_mat_int_val'
390 if(is_allocated == 1)
then
391 if(mesh%elem_mat_int_index(mesh%n_elem_gross) > 0)
then
392 allocate(mesh%elem_mat_int_val(mesh%elem_mat_int_index(mesh%n_elem_mat_ID)))
399 if(mesh%n_elem_gross > 0)
then
400 vname =
'elem_val_index'
402 if(is_allocated == 1)
then
403 allocate(mesh%elem_val_index(0:mesh%n_elem_gross))
408 vname =
'elem_val_item'
410 if(is_allocated == 1)
then
411 if(mesh%elem_val_index(mesh%n_elem_gross) > 0)
then
412 allocate(mesh%elem_val_item(mesh%elem_val_index(mesh%n_elem_gross)))
418 end subroutine get_elem
421 subroutine get_comm(mesh, ierr)
422 integer(kind=kint) :: ierr
424 character(len=100) :: sname,vname
427 sname =
'hecmwST_local_mesh'
453 vname =
'n_subdomain'
457 vname =
'n_neighbor_pe'
461 if(mesh%n_neighbor_pe > 0)
then
462 vname =
'neighbor_pe'
463 allocate(mesh%neighbor_pe(mesh%n_neighbor_pe))
468 if(mesh%n_neighbor_pe > 0)
then
469 vname =
'import_index'
470 allocate(mesh%import_index(0:mesh%n_neighbor_pe))
474 if(mesh%import_index(mesh%n_neighbor_pe) > 0)
then
475 vname =
'import_item'
476 allocate(mesh%import_item(mesh%import_index(mesh%n_neighbor_pe)))
481 vname =
'export_index'
482 allocate(mesh%export_index(0:mesh%n_neighbor_pe))
486 if(mesh%export_index(mesh%n_neighbor_pe) > 0)
then
487 vname =
'export_item'
488 allocate(mesh%export_item(mesh%export_index(mesh%n_neighbor_pe)))
493 vname =
'shared_index'
494 allocate(mesh%shared_index(0:mesh%n_neighbor_pe))
498 if(mesh%shared_index(mesh%n_neighbor_pe) > 0)
then
499 vname =
'shared_item'
500 allocate(mesh%shared_item(mesh%shared_index(mesh%n_neighbor_pe)))
505 end subroutine get_comm
508 subroutine get_adapt(mesh, ierr)
509 integer(kind=kint) :: ierr,is_allocated
511 character(len=100) :: sname,vname
514 sname =
'hecmwST_local_mesh'
516 vname =
'coarse_grid_level'
524 if(mesh%n_node_gross > 0)
then
525 vname =
'when_i_was_refined_node'
527 if(is_allocated == 1)
then
528 allocate(mesh%when_i_was_refined_node(mesh%n_node_gross))
534 if(mesh%n_elem_gross > 0)
then
535 vname =
'when_i_was_refined_elem'
537 if(is_allocated == 1)
then
538 allocate(mesh%when_i_was_refined_elem(mesh%n_elem_gross))
543 vname =
'adapt_parent_type'
545 if(is_allocated == 1)
then
546 allocate(mesh%adapt_parent_type(mesh%n_elem_gross))
553 if(is_allocated == 1)
then
554 allocate(mesh%adapt_type(mesh%n_elem_gross))
560 vname =
'adapt_level'
562 if(is_allocated == 1)
then
563 allocate(mesh%adapt_level(mesh%n_elem_gross))
568 vname =
'adapt_parent'
570 if(is_allocated == 1)
then
571 allocate(mesh%adapt_parent(mesh%n_elem_gross*2))
576 vname =
'adapt_children_index'
578 if(is_allocated == 1)
then
579 allocate(mesh%adapt_children_index(0:mesh%n_elem_gross))
584 vname =
'adapt_children_item'
586 if(is_allocated == 1)
then
587 if(mesh%adapt_children_index(mesh%n_elem_gross) > 0)
then
588 allocate(mesh%adapt_children_item(mesh%adapt_children_index(mesh%n_elem_gross)*2))
594 end subroutine get_adapt
597 subroutine get_refine(mesh, ierr)
598 integer(kind=kint) :: ierr,is_allocated
601 character(len=100) :: sname,vname
603 sname =
'hecmwST_local_mesh'
609 if(mesh%n_node_gross > 0)
then
610 vname =
'node_old2new'
612 if(is_allocated == 1)
then
613 allocate(mesh%node_old2new(mesh%n_node_gross))
618 vname =
'node_new2old'
620 if(is_allocated == 1)
then
621 allocate(mesh%node_new2old(mesh%n_node_gross))
627 if(mesh%n_elem_gross > 0)
then
628 vname =
'elem_old2new'
630 if(is_allocated == 1)
then
631 allocate(mesh%elem_old2new(mesh%n_elem_gross))
636 vname =
'elem_new2old'
638 if(is_allocated == 1)
then
639 allocate(mesh%elem_new2old(mesh%n_elem_gross))
645 if(mesh%n_refine > 0)
then
646 vname =
'n_node_refine_hist'
648 if(is_allocated == 1)
then
649 allocate(mesh%n_node_refine_hist(mesh%n_refine))
655 if(mesh%n_refine > 0)
then
656 sname =
'hecmwST_refine_origin'
657 reforg => mesh%refine_origin
660 allocate(reforg%index(0:mesh%n_refine))
665 allocate(reforg%item_index(0:reforg%index(mesh%n_refine)))
670 allocate(reforg%item_item(reforg%item_index(reforg%index(mesh%n_refine))))
674 end subroutine get_refine
677 subroutine get_sect(sect, ierr)
678 integer(kind=kint) :: ierr
680 character(len=100) :: sname,vname
682 sname =
'hecmwST_section'
688 if(sect%n_sect > 0)
then
690 allocate(sect%sect_type(sect%n_sect))
695 allocate(sect%sect_opt(sect%n_sect))
699 vname =
'sect_mat_ID_index'
700 allocate(sect%sect_mat_ID_index(0:sect%n_sect))
704 if(sect%sect_mat_ID_index(sect%n_sect) > 0)
then
705 vname =
'sect_mat_ID_item'
706 allocate(sect%sect_mat_ID_item(sect%sect_mat_ID_index(sect%n_sect)))
711 vname =
'sect_I_index'
712 allocate(sect%sect_I_index(0:sect%n_sect))
716 if(sect%sect_I_index(sect%n_sect) > 0)
then
717 vname =
'sect_I_item'
718 allocate(sect%sect_I_item(sect%sect_I_index(sect%n_sect)))
723 vname =
'sect_R_index'
724 allocate(sect%sect_R_index(0:sect%n_sect))
728 if(sect%sect_R_index(sect%n_sect) > 0)
then
729 vname =
'sect_R_item'
730 allocate(sect%sect_R_item(sect%sect_R_index(sect%n_sect)))
735 allocate(sect%sect_orien_ID(sect%n_sect))
736 sect%sect_orien_ID(:) = -1
738 end subroutine get_sect
741 subroutine get_mat(mat, ierr)
742 integer(kind=kint) :: ierr
744 character(len=100) :: sname,vname
746 sname =
'hecmwST_material'
756 vname =
'n_mat_subitem'
760 vname =
'n_mat_table'
764 if(mat%n_mat > 0)
then
766 allocate(mat%mat_name(mat%n_mat))
771 if(mat%n_mat > 0)
then
772 vname =
'mat_item_index'
773 allocate(mat%mat_item_index(0:mat%n_mat))
778 if(mat%n_mat_item > 0)
then
779 vname =
'mat_subitem_index'
780 allocate(mat%mat_subitem_index(0:mat%n_mat_item))
785 if(mat%n_mat_subitem > 0)
then
786 vname =
'mat_table_index'
787 allocate(mat%mat_table_index(0:mat%n_mat_subitem))
792 if(mat%n_mat_table > 0)
then
794 allocate(mat%mat_val(mat%n_mat_table))
799 allocate(mat%mat_temp(mat%n_mat_table))
803 end subroutine get_mat
806 subroutine get_mpc(mpc, ierr)
807 integer(kind=kint) :: ierr
809 character(len=100) :: sname,vname
811 sname =
'hecmwST_mpc'
817 if(mpc%n_mpc > 0)
then
819 allocate(mpc%mpc_index(0:mpc%n_mpc))
823 if(mpc%mpc_index(mpc%n_mpc) > 0)
then
825 allocate(mpc%mpc_item(mpc%mpc_index(mpc%n_mpc)))
830 allocate(mpc%mpc_dof(mpc%mpc_index(mpc%n_mpc)))
835 allocate(mpc%mpc_val(mpc%mpc_index(mpc%n_mpc)))
840 allocate(mpc%mpc_const(mpc%n_mpc))
845 end subroutine get_mpc
848 subroutine get_amp(amp, ierr)
849 integer(kind=kint) :: ierr
851 character(len=100) :: sname,vname
853 sname =
'hecmwST_amplitude'
859 if(amp%n_amp > 0)
then
861 allocate(amp%amp_name(amp%n_amp))
865 vname =
'amp_type_definition'
866 allocate(amp%amp_type_definition(amp%n_amp))
870 vname =
'amp_type_time'
871 allocate(amp%amp_type_time(amp%n_amp))
875 vname =
'amp_type_value'
876 allocate(amp%amp_type_value(amp%n_amp))
881 allocate(amp%amp_index(0:amp%n_amp))
885 if(amp%amp_index(amp%n_amp) > 0)
then
887 allocate(amp%amp_val(amp%amp_index(amp%n_amp)))
892 allocate(amp%amp_table(amp%amp_index(amp%n_amp)))
897 end subroutine get_amp
900 subroutine get_ngrp(grp, ierr)
901 integer(kind=kint) :: ierr,is_allocated
903 character(len=100) :: sname,vname
905 sname =
'hecmwST_node_grp'
911 if(grp%n_grp > 0)
then
913 allocate(grp%grp_name(grp%n_grp))
918 allocate(grp%grp_index(0:grp%n_grp))
923 if(grp%grp_index(grp%n_grp) > 0)
then
924 allocate(grp%grp_item(grp%grp_index(grp%n_grp)))
934 if(grp%n_bc > 0)
then
937 if(is_allocated == 1)
then
938 allocate(grp%bc_grp_ID(grp%n_bc))
943 vname =
'bc_grp_type'
945 if(is_allocated == 1)
then
946 allocate(grp%bc_grp_type(grp%n_bc))
951 vname =
'bc_grp_index'
953 if(is_allocated == 1)
then
954 allocate(grp%bc_grp_index(grp%n_bc))
961 if(is_allocated == 1)
then
962 allocate(grp%bc_grp_dof(grp%n_bc))
969 if(is_allocated == 1)
then
970 allocate(grp%bc_grp_val(grp%n_bc))
975 end subroutine get_ngrp
978 subroutine get_egrp(grp, ierr)
979 integer(kind=kint) :: ierr,is_allocated
981 character(len=100) :: sname,vname
983 sname =
'hecmwST_elem_grp'
989 if(grp%n_grp > 0)
then
991 allocate(grp%grp_name(grp%n_grp))
996 allocate(grp%grp_index(0:grp%n_grp))
1001 if(grp%grp_index(grp%n_grp) > 0)
then
1002 allocate(grp%grp_item(grp%grp_index(grp%n_grp)))
1004 if(ierr /= 0)
return
1010 if(ierr /= 0)
return
1012 if(grp%n_bc > 0)
then
1015 if(is_allocated == 1)
then
1016 allocate(grp%bc_grp_ID(grp%n_bc))
1018 if(ierr /= 0)
return
1021 vname =
'bc_grp_type'
1023 if(is_allocated == 1)
then
1024 allocate(grp%bc_grp_type(grp%n_bc))
1026 if(ierr /= 0)
return
1029 vname =
'bc_grp_index'
1031 if(is_allocated == 1)
then
1032 allocate(grp%bc_grp_index(grp%n_bc))
1034 if(ierr /= 0)
return
1037 vname =
'bc_grp_val'
1039 if(is_allocated == 1)
then
1040 allocate(grp%bc_grp_val(grp%n_bc))
1042 if(ierr /= 0)
return
1045 end subroutine get_egrp
1048 subroutine get_sgrp(grp, ierr)
1049 integer(kind=kint) :: ierr,is_allocated
1051 character(len=100) :: sname,vname
1053 sname =
'hecmwST_surf_grp'
1057 if(ierr /= 0)
return
1059 if(grp%n_grp > 0)
then
1061 allocate(grp%grp_name(grp%n_grp))
1063 if(ierr /= 0)
return
1066 allocate(grp%grp_index(0:grp%n_grp))
1068 if(ierr /= 0)
return
1071 if(grp%grp_index(grp%n_grp) > 0)
then
1072 allocate(grp%grp_item(grp%grp_index(grp%n_grp)*2))
1074 if(ierr /= 0)
return
1080 if(ierr /= 0)
return
1082 if(grp%n_bc > 0)
then
1085 if(is_allocated == 1)
then
1086 allocate(grp%bc_grp_ID(grp%n_bc))
1088 if(ierr /= 0)
return
1091 vname =
'bc_grp_type'
1093 if(is_allocated == 1)
then
1094 allocate(grp%bc_grp_type(grp%n_bc))
1096 if(ierr /= 0)
return
1099 vname =
'bc_grp_index'
1101 if(is_allocated == 1)
then
1102 allocate(grp%bc_grp_index(grp%n_bc))
1104 if(ierr /= 0)
return
1107 vname =
'bc_grp_val'
1109 if(is_allocated == 1)
then
1110 allocate(grp%bc_grp_val(grp%n_bc))
1112 if(ierr /= 0)
return
1115 end subroutine get_sgrp
1118 subroutine get_contact_pair(cpair, ierr)
1119 integer(kind=kint) :: ierr
1121 character(len=100) :: sname,vname
1123 sname =
'hecmwST_contact_pair'
1127 if(ierr /= 0)
return
1129 if(cpair%n_pair > 0)
then
1131 allocate(cpair%name(cpair%n_pair))
1133 if(ierr /= 0)
return
1136 allocate(cpair%type(cpair%n_pair))
1138 if(ierr /= 0)
return
1140 vname =
'slave_grp_id'
1141 allocate(cpair%slave_grp_id(cpair%n_pair))
1143 if(ierr /= 0)
return
1145 vname =
'slave_orisgrp_id'
1146 allocate(cpair%slave_orisgrp_id(cpair%n_pair))
1148 if(ierr /= 0)
return
1150 vname =
'master_grp_id'
1151 allocate(cpair%master_grp_id(cpair%n_pair))
1153 if(ierr /= 0)
return
1155 end subroutine get_contact_pair
void hecmw_dist_copy_c2f_isalloc_if(char *struct_name, char *var_name, int *is_allocated, int *err, int len_struct, int len_var)
void hecmw_dist_copy_c2f_set_if(char *struct_name, char *var_name, void *dst, int *err, int len_struct, int len_var)
subroutine, public hecmw_dist_copy_c2f(mesh, ierr)