!+ ! Fortran side of the Tao / C++ structure interface. ! ! This file is generated by the Tao/C++ interface code generation. ! The code generation files can be found in cpp_tao_interface. ! ! DO NOT EDIT THIS FILE DIRECTLY! !- module tao_cpp_convert_mod use tao_struct use equality_mod use bmad_cpp_convert_mod use fortran_cpp_utils use, intrinsic :: iso_c_binding !-------------------------------------------------------------------------- interface subroutine qp_rect_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine qp_line_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine qp_symbol_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine qp_point_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine qp_axis_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_cmd_history_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_real_pointer_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_logical_array_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_integer_array_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_expression_info_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_eval_stack1_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_ele_shape_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_pattern_point_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_pattern_curve_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_shape_pattern_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_drawing_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_wave_kick_pt_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_wave_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_title_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_data_var_component_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_histogram_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_curve_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_graph_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_plot_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_plot_region_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_plot_page_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_plot_array_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_graph_array_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_curve_array_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_data_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_d1_data_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_d2_data_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_data_array_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_d1_data_array_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_d2_data_array_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_var_slave_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_var_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_v1_var_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_var_array_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_v1_var_array_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_building_wall_point_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_building_wall_section_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_building_wall_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_global_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_alias_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_command_file_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_common_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_lat_mode_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_sigma_mat_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_lattice_branch_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_lattice_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_element_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_ping_scale_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_universe_branch_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_beam_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_universe_calc_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_mpi_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_dynamic_aperture_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_universe_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface !-------------------------------------------------------------------------- interface subroutine tao_super_universe_to_f (C, Fp) bind(c) import c_ptr type(c_ptr), value :: C, Fp end subroutine end interface contains !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine qp_rect_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao qp_rect_struct to a C++ CPP_qp_rect structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao qp_rect_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_qp_rect struct. !- subroutine qp_rect_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine qp_rect_to_c2 (C, z_x1, z_x2, z_y1, z_y2, z_units) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_units(*) real(c_double) :: z_x1, z_x2, z_y1, z_y2 end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(qp_rect_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call qp_rect_to_c2 (C, F%x1, F%x2, F%y1, F%y2, trim(F%units) // c_null_char) end subroutine qp_rect_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine qp_rect_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_qp_rect structure to a Tao qp_rect_struct structure. ! This routine is called by qp_rect_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the qp_rect_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao qp_rect_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine qp_rect_to_f2 (Fp, z_x1, z_x2, z_y1, z_y2, z_units) bind(c) implicit none type(c_ptr), value :: Fp type(qp_rect_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_units(*) real(c_double) :: z_x1, z_x2, z_y1, z_y2 call c_f_pointer (Fp, F) !! f_side.to_f2_trans[real, 0, NOT] F%x1 = z_x1 !! f_side.to_f2_trans[real, 0, NOT] F%x2 = z_x2 !! f_side.to_f2_trans[real, 0, NOT] F%y1 = z_y1 !! f_side.to_f2_trans[real, 0, NOT] F%y2 = z_y2 !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_units, F%units) end subroutine qp_rect_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine qp_line_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao qp_line_struct to a C++ CPP_qp_line structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao qp_line_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_qp_line struct. !- subroutine qp_line_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine qp_line_to_c2 (C, z_width, z_color, z_pattern) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C integer(c_int) :: z_width, z_color, z_pattern end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(qp_line_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call qp_line_to_c2 (C, F%width, F%color, F%pattern) end subroutine qp_line_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine qp_line_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_qp_line structure to a Tao qp_line_struct structure. ! This routine is called by qp_line_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the qp_line_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao qp_line_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine qp_line_to_f2 (Fp, z_width, z_color, z_pattern) bind(c) implicit none type(c_ptr), value :: Fp type(qp_line_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name integer(c_int) :: z_width, z_color, z_pattern call c_f_pointer (Fp, F) !! f_side.to_f2_trans[integer, 0, NOT] F%width = z_width !! f_side.to_f2_trans[integer, 0, NOT] F%color = z_color !! f_side.to_f2_trans[integer, 0, NOT] F%pattern = z_pattern end subroutine qp_line_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine qp_symbol_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao qp_symbol_struct to a C++ CPP_qp_symbol structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao qp_symbol_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_qp_symbol struct. !- subroutine qp_symbol_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine qp_symbol_to_c2 (C, z_type, z_height, z_color, z_fill_pattern, z_line_width) & bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C integer(c_int) :: z_type, z_color, z_fill_pattern, z_line_width real(c_double) :: z_height end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(qp_symbol_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call qp_symbol_to_c2 (C, F%type, F%height, F%color, F%fill_pattern, F%line_width) end subroutine qp_symbol_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine qp_symbol_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_qp_symbol structure to a Tao qp_symbol_struct structure. ! This routine is called by qp_symbol_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the qp_symbol_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao qp_symbol_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine qp_symbol_to_f2 (Fp, z_type, z_height, z_color, z_fill_pattern, z_line_width) & bind(c) implicit none type(c_ptr), value :: Fp type(qp_symbol_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name integer(c_int) :: z_type, z_color, z_fill_pattern, z_line_width real(c_double) :: z_height call c_f_pointer (Fp, F) !! f_side.to_f2_trans[integer, 0, NOT] F%type = z_type !! f_side.to_f2_trans[real, 0, NOT] F%height = z_height !! f_side.to_f2_trans[integer, 0, NOT] F%color = z_color !! f_side.to_f2_trans[integer, 0, NOT] F%fill_pattern = z_fill_pattern !! f_side.to_f2_trans[integer, 0, NOT] F%line_width = z_line_width end subroutine qp_symbol_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine qp_point_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao qp_point_struct to a C++ CPP_qp_point structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao qp_point_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_qp_point struct. !- subroutine qp_point_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine qp_point_to_c2 (C, z_x, z_y, z_units) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_units(*) real(c_double) :: z_x, z_y end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(qp_point_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call qp_point_to_c2 (C, F%x, F%y, trim(F%units) // c_null_char) end subroutine qp_point_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine qp_point_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_qp_point structure to a Tao qp_point_struct structure. ! This routine is called by qp_point_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the qp_point_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao qp_point_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine qp_point_to_f2 (Fp, z_x, z_y, z_units) bind(c) implicit none type(c_ptr), value :: Fp type(qp_point_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_units(*) real(c_double) :: z_x, z_y call c_f_pointer (Fp, F) !! f_side.to_f2_trans[real, 0, NOT] F%x = z_x !! f_side.to_f2_trans[real, 0, NOT] F%y = z_y !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_units, F%units) end subroutine qp_point_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine qp_axis_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao qp_axis_struct to a C++ CPP_qp_axis structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao qp_axis_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_qp_axis struct. !- subroutine qp_axis_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine qp_axis_to_c2 (C, z_label, z_min, z_max, z_number_offset, z_label_offset, & z_major_tick_len, z_minor_tick_len, z_label_color, z_major_div, z_major_div_nominal, & z_minor_div, z_minor_div_max, z_places, z_type, z_bounds, z_tick_side, z_number_side, & z_draw_label, z_draw_numbers) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_label(*), z_type(*), z_bounds(*) integer(c_int) :: z_label_color, z_major_div, z_major_div_nominal, z_minor_div, z_minor_div_max, z_places, z_tick_side integer(c_int) :: z_number_side real(c_double) :: z_min, z_max, z_number_offset, z_label_offset, z_major_tick_len, z_minor_tick_len logical(c_bool) :: z_draw_label, z_draw_numbers end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(qp_axis_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call qp_axis_to_c2 (C, trim(F%label) // c_null_char, F%min, F%max, F%number_offset, & F%label_offset, F%major_tick_len, F%minor_tick_len, F%label_color, F%major_div, & F%major_div_nominal, F%minor_div, F%minor_div_max, F%places, trim(F%type) // c_null_char, & trim(F%bounds) // c_null_char, F%tick_side, F%number_side, c_logic(F%draw_label), & c_logic(F%draw_numbers)) end subroutine qp_axis_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine qp_axis_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_qp_axis structure to a Tao qp_axis_struct structure. ! This routine is called by qp_axis_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the qp_axis_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao qp_axis_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine qp_axis_to_f2 (Fp, z_label, z_min, z_max, z_number_offset, z_label_offset, & z_major_tick_len, z_minor_tick_len, z_label_color, z_major_div, z_major_div_nominal, & z_minor_div, z_minor_div_max, z_places, z_type, z_bounds, z_tick_side, z_number_side, & z_draw_label, z_draw_numbers) bind(c) implicit none type(c_ptr), value :: Fp type(qp_axis_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_label(*), z_type(*), z_bounds(*) integer(c_int) :: z_label_color, z_major_div, z_major_div_nominal, z_minor_div, z_minor_div_max, z_places, z_tick_side integer(c_int) :: z_number_side real(c_double) :: z_min, z_max, z_number_offset, z_label_offset, z_major_tick_len, z_minor_tick_len logical(c_bool) :: z_draw_label, z_draw_numbers call c_f_pointer (Fp, F) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_label, F%label) !! f_side.to_f2_trans[real, 0, NOT] F%min = z_min !! f_side.to_f2_trans[real, 0, NOT] F%max = z_max !! f_side.to_f2_trans[real, 0, NOT] F%number_offset = z_number_offset !! f_side.to_f2_trans[real, 0, NOT] F%label_offset = z_label_offset !! f_side.to_f2_trans[real, 0, NOT] F%major_tick_len = z_major_tick_len !! f_side.to_f2_trans[real, 0, NOT] F%minor_tick_len = z_minor_tick_len !! f_side.to_f2_trans[integer, 0, NOT] F%label_color = z_label_color !! f_side.to_f2_trans[integer, 0, NOT] F%major_div = z_major_div !! f_side.to_f2_trans[integer, 0, NOT] F%major_div_nominal = z_major_div_nominal !! f_side.to_f2_trans[integer, 0, NOT] F%minor_div = z_minor_div !! f_side.to_f2_trans[integer, 0, NOT] F%minor_div_max = z_minor_div_max !! f_side.to_f2_trans[integer, 0, NOT] F%places = z_places !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_type, F%type) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_bounds, F%bounds) !! f_side.to_f2_trans[integer, 0, NOT] F%tick_side = z_tick_side !! f_side.to_f2_trans[integer, 0, NOT] F%number_side = z_number_side !! f_side.to_f2_trans[logical, 0, NOT] F%draw_label = f_logic(z_draw_label) !! f_side.to_f2_trans[logical, 0, NOT] F%draw_numbers = f_logic(z_draw_numbers) end subroutine qp_axis_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_cmd_history_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_cmd_history_struct to a C++ CPP_tao_cmd_history structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_cmd_history_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_cmd_history struct. !- subroutine tao_cmd_history_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_cmd_history_to_c2 (C, z_cmd, n_cmd, z_ix, z_cmd_file) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_cmd(*) integer(c_int) :: z_ix integer(c_int), value :: n_cmd logical(c_bool) :: z_cmd_file end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_cmd_history_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var character(:+1), target :: f_cmd integer(c_int) :: n_cmd ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[character, 0, ALLOC] n_cmd = 0 if (allocated(F%cmd)) then n_cmd = 1 f_cmd = trim(F%cmd) // c_null_char endif !! f_side.to_c2_call call tao_cmd_history_to_c2 (C, f_cmd, n_cmd, F%ix, c_logic(F%cmd_file)) end subroutine tao_cmd_history_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_cmd_history_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_cmd_history structure to a Tao tao_cmd_history_struct structure. ! This routine is called by tao_cmd_history_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_cmd_history_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_cmd_history_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_cmd_history_to_f2 (Fp, z_cmd, n_cmd, z_ix, z_cmd_file) bind(c) implicit none type(c_ptr), value :: Fp type(tao_cmd_history_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_cmd(*) integer(c_int) :: z_ix integer(c_int), pointer :: f_cmd integer(c_int), value :: n_cmd logical(c_bool) :: z_cmd_file call c_f_pointer (Fp, F) !! f_side.to_f2_trans[character, 0, ALLOC] if (n_cmd == 0) then if (allocated(F%cmd)) deallocate(F%cmd) else if (.not. allocated(F%cmd)) allocate(F%cmd) call to_f_str(z_cmd, F%cmd) endif !! f_side.to_f2_trans[integer, 0, NOT] F%ix = z_ix !! f_side.to_f2_trans[logical, 0, NOT] F%cmd_file = f_logic(z_cmd_file) end subroutine tao_cmd_history_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_real_pointer_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_real_pointer_struct to a C++ CPP_tao_real_pointer structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_real_pointer_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_real_pointer struct. !- subroutine tao_real_pointer_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_real_pointer_to_c2 (C, z_r, n_r, z_good_value, n_good_value, z_good_user, & n_good_user) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C integer(c_int), value :: n_r, n_good_value, n_good_user real(c_double) :: z_r logical(c_bool) :: z_good_value, z_good_user end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_real_pointer_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var integer(c_int) :: n_r integer(c_int) :: n_good_value integer(c_int) :: n_good_user ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[real, 0, PTR] n_r = 0 if (associated(F%r)) n_r = 1 !! f_side.to_c_trans[logical, 0, PTR] n_good_value = 0 if (associated(F%good_value)) n_good_value = 1 !! f_side.to_c_trans[logical, 0, PTR] n_good_user = 0 if (associated(F%good_user)) n_good_user = 1 !! f_side.to_c2_call call tao_real_pointer_to_c2 (C, F%r, n_r, fscalar2scalar(F%good_value, n_good_value), & n_good_value, fscalar2scalar(F%good_user, n_good_user), n_good_user) end subroutine tao_real_pointer_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_real_pointer_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_real_pointer structure to a Tao tao_real_pointer_struct structure. ! This routine is called by tao_real_pointer_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_real_pointer_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_real_pointer_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_real_pointer_to_f2 (Fp, z_r, n_r, z_good_value, n_good_value, z_good_user, & n_good_user) bind(c) implicit none type(c_ptr), value :: Fp type(tao_real_pointer_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name real(c_double), pointer :: f_r integer(c_int), value :: n_r, n_good_value, n_good_user logical(c_bool), pointer :: f_good_value, f_good_user type(c_ptr), value :: z_r, z_good_value, z_good_user call c_f_pointer (Fp, F) !! f_side.to_f2_trans[real, 0, PTR] if (n_r == 0) then if (associated(F%r)) deallocate(F%r) else call c_f_pointer (z_r, f_r) if (.not. associated(F%r)) allocate(F%r) F%r = f_r endif !! f_side.to_f2_trans[logical, 0, PTR] if (n_good_value == 0) then if (associated(F%good_value)) deallocate(F%good_value) else call c_f_pointer (z_good_value, f_good_value) if (.not. associated(F%good_value)) allocate(F%good_value) F%good_value = f_logic(f_good_value) endif !! f_side.to_f2_trans[logical, 0, PTR] if (n_good_user == 0) then if (associated(F%good_user)) deallocate(F%good_user) else call c_f_pointer (z_good_user, f_good_user) if (.not. associated(F%good_user)) allocate(F%good_user) F%good_user = f_logic(f_good_user) endif end subroutine tao_real_pointer_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_logical_array_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_logical_array_struct to a C++ CPP_tao_logical_array structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_logical_array_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_logical_array struct. !- subroutine tao_logical_array_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_logical_array_to_c2 (C, z_l, n_l) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C integer(c_int), value :: n_l logical(c_bool) :: z_l end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_logical_array_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var integer(c_int) :: n_l ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[logical, 0, PTR] n_l = 0 if (associated(F%l)) n_l = 1 !! f_side.to_c2_call call tao_logical_array_to_c2 (C, fscalar2scalar(F%l, n_l), n_l) end subroutine tao_logical_array_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_logical_array_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_logical_array structure to a Tao tao_logical_array_struct structure. ! This routine is called by tao_logical_array_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_logical_array_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_logical_array_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_logical_array_to_f2 (Fp, z_l, n_l) bind(c) implicit none type(c_ptr), value :: Fp type(tao_logical_array_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name integer(c_int), value :: n_l logical(c_bool), pointer :: f_l type(c_ptr), value :: z_l call c_f_pointer (Fp, F) !! f_side.to_f2_trans[logical, 0, PTR] if (n_l == 0) then if (associated(F%l)) deallocate(F%l) else call c_f_pointer (z_l, f_l) if (.not. associated(F%l)) allocate(F%l) F%l = f_logic(f_l) endif end subroutine tao_logical_array_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_integer_array_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_integer_array_struct to a C++ CPP_tao_integer_array structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_integer_array_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_integer_array struct. !- subroutine tao_integer_array_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_integer_array_to_c2 (C, z_i, n_i) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C integer(c_int) :: z_i integer(c_int), value :: n_i end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_integer_array_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var integer(c_int) :: n_i ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[integer, 0, PTR] n_i = 0 if (associated(F%i)) n_i = 1 !! f_side.to_c2_call call tao_integer_array_to_c2 (C, F%i, n_i) end subroutine tao_integer_array_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_integer_array_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_integer_array structure to a Tao tao_integer_array_struct structure. ! This routine is called by tao_integer_array_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_integer_array_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_integer_array_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_integer_array_to_f2 (Fp, z_i, n_i) bind(c) implicit none type(c_ptr), value :: Fp type(tao_integer_array_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name integer(c_int), pointer :: f_i integer(c_int), value :: n_i type(c_ptr), value :: z_i call c_f_pointer (Fp, F) !! f_side.to_f2_trans[integer, 0, PTR] if (n_i == 0) then if (associated(F%i)) deallocate(F%i) else call c_f_pointer (z_i, f_i) if (.not. associated(F%i)) allocate(F%i) F%i = f_i endif end subroutine tao_integer_array_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_expression_info_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_expression_info_struct to a C++ CPP_tao_expression_info structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_expression_info_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_expression_info struct. !- subroutine tao_expression_info_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_expression_info_to_c2 (C, z_good, z_ix_ele, z_s) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C integer(c_int) :: z_ix_ele real(c_double) :: z_s logical(c_bool) :: z_good end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_expression_info_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call tao_expression_info_to_c2 (C, c_logic(F%good), F%ix_ele, F%s) end subroutine tao_expression_info_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_expression_info_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_expression_info structure to a Tao tao_expression_info_struct structure. ! This routine is called by tao_expression_info_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_expression_info_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_expression_info_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_expression_info_to_f2 (Fp, z_good, z_ix_ele, z_s) bind(c) implicit none type(c_ptr), value :: Fp type(tao_expression_info_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name integer(c_int) :: z_ix_ele real(c_double) :: z_s logical(c_bool) :: z_good call c_f_pointer (Fp, F) !! f_side.to_f2_trans[logical, 0, NOT] F%good = f_logic(z_good) !! f_side.to_f2_trans[integer, 0, NOT] F%ix_ele = z_ix_ele !! f_side.to_f2_trans[real, 0, NOT] F%s = z_s end subroutine tao_expression_info_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_eval_stack1_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_eval_stack1_struct to a C++ CPP_tao_eval_stack1 structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_eval_stack1_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_eval_stack1 struct. !- subroutine tao_eval_stack1_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_eval_stack1_to_c2 (C, z_type, z_name, z_scale, z_value, n1_value, z_info, & n1_info, z_value_ptr, n1_value_ptr) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_name(*) integer(c_int) :: z_type type(c_ptr) :: z_info(*), z_value_ptr(*) integer(c_int), value :: n1_value, n1_info, n1_value_ptr real(c_double) :: z_scale, z_value(*) end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_eval_stack1_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var integer(c_int) :: n1_value type(c_ptr), allocatable :: z_info(:) integer(c_int) :: n1_info type(c_ptr), allocatable :: z_value_ptr(:) integer(c_int) :: n1_value_ptr ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[real, 1, ALLOC] n1_value = 0 if (allocated(F%value)) then n1_value = size(F%value, 1) endif !! f_side.to_c_trans[type, 1, ALLOC] n1_info = 0 if (allocated(F%info)) then n1_info = size(F%info); lb1 = lbound(F%info, 1) - 1 allocate (z_info(n1_info)) do jd1 = 1, n1_info z_info(jd1) = c_loc(F%info(jd1+lb1)) enddo endif !! f_side.to_c_trans[type, 1, ALLOC] n1_value_ptr = 0 if (allocated(F%value_ptr)) then n1_value_ptr = size(F%value_ptr); lb1 = lbound(F%value_ptr, 1) - 1 allocate (z_value_ptr(n1_value_ptr)) do jd1 = 1, n1_value_ptr z_value_ptr(jd1) = c_loc(F%value_ptr(jd1+lb1)) enddo endif !! f_side.to_c2_call call tao_eval_stack1_to_c2 (C, F%type, trim(F%name) // c_null_char, F%scale, fvec2vec(F%value, & n1_value), n1_value, z_info, n1_info, z_value_ptr, n1_value_ptr) end subroutine tao_eval_stack1_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_eval_stack1_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_eval_stack1 structure to a Tao tao_eval_stack1_struct structure. ! This routine is called by tao_eval_stack1_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_eval_stack1_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_eval_stack1_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_eval_stack1_to_f2 (Fp, z_type, z_name, z_scale, z_value, n1_value, z_info, & n1_info, z_value_ptr, n1_value_ptr) bind(c) implicit none type(c_ptr), value :: Fp type(tao_eval_stack1_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_name(*) integer(c_int) :: z_type type(c_ptr) :: z_info(*), z_value_ptr(*) integer(c_int), value :: n1_value, n1_info, n1_value_ptr real(c_double), pointer :: f_value(:) real(c_double) :: z_scale type(c_ptr), value :: z_value call c_f_pointer (Fp, F) !! f_side.to_f2_trans[integer, 0, NOT] F%type = z_type !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_name, F%name) !! f_side.to_f2_trans[real, 0, NOT] F%scale = z_scale !! f_side.to_f2_trans[real, 1, ALLOC] if (allocated(F%value)) then if (n1_value == 0 .or. any(shape(F%value) /= [n1_value])) deallocate(F%value) if (any(lbound(F%value) /= 1)) deallocate(F%value) endif if (n1_value /= 0) then call c_f_pointer (z_value, f_value, [n1_value]) if (.not. allocated(F%value)) allocate(F%value(n1_value)) F%value = f_value(1:n1_value) else if (allocated(F%value)) deallocate(F%value) endif !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_info == 0) then if (allocated(F%info)) deallocate(F%info) else if (allocated(F%info)) then if (n1_info == 0 .or. any(shape(F%info) /= [n1_info])) deallocate(F%info) if (any(lbound(F%info) /= 1)) deallocate(F%info) endif if (.not. allocated(F%info)) allocate(F%info(1:n1_info+1-1)) do jd1 = 1, n1_info call tao_expression_info_to_f (z_info(jd1), c_loc(F%info(jd1+1-1))) enddo endif !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_value_ptr == 0) then if (allocated(F%value_ptr)) deallocate(F%value_ptr) else if (allocated(F%value_ptr)) then if (n1_value_ptr == 0 .or. any(shape(F%value_ptr) /= [n1_value_ptr])) deallocate(F%value_ptr) if (any(lbound(F%value_ptr) /= 1)) deallocate(F%value_ptr) endif if (.not. allocated(F%value_ptr)) allocate(F%value_ptr(1:n1_value_ptr+1-1)) do jd1 = 1, n1_value_ptr call tao_real_pointer_to_f (z_value_ptr(jd1), c_loc(F%value_ptr(jd1+1-1))) enddo endif end subroutine tao_eval_stack1_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_ele_shape_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_ele_shape_struct to a C++ CPP_tao_ele_shape structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_ele_shape_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_ele_shape struct. !- subroutine tao_ele_shape_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_ele_shape_to_c2 (C, z_ele_id, z_shape, z_color, z_size, z_label, z_draw, & z_multi, z_ix_ele_key, z_name_ele) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_ele_id(*), z_shape(*), z_color(*), z_label(*), z_name_ele(*) integer(c_int) :: z_ix_ele_key real(c_double) :: z_size logical(c_bool) :: z_draw, z_multi end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_ele_shape_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call tao_ele_shape_to_c2 (C, trim(F%ele_id) // c_null_char, trim(F%shape) // c_null_char, & trim(F%color) // c_null_char, F%size, trim(F%label) // c_null_char, c_logic(F%draw), & c_logic(F%multi), F%ix_ele_key, trim(F%name_ele) // c_null_char) end subroutine tao_ele_shape_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_ele_shape_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_ele_shape structure to a Tao tao_ele_shape_struct structure. ! This routine is called by tao_ele_shape_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_ele_shape_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_ele_shape_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_ele_shape_to_f2 (Fp, z_ele_id, z_shape, z_color, z_size, z_label, z_draw, & z_multi, z_ix_ele_key, z_name_ele) bind(c) implicit none type(c_ptr), value :: Fp type(tao_ele_shape_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_ele_id(*), z_shape(*), z_color(*), z_label(*), z_name_ele(*) integer(c_int) :: z_ix_ele_key real(c_double) :: z_size logical(c_bool) :: z_draw, z_multi call c_f_pointer (Fp, F) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_ele_id, F%ele_id) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_shape, F%shape) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_color, F%color) !! f_side.to_f2_trans[real, 0, NOT] F%size = z_size !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_label, F%label) !! f_side.to_f2_trans[logical, 0, NOT] F%draw = f_logic(z_draw) !! f_side.to_f2_trans[logical, 0, NOT] F%multi = f_logic(z_multi) !! f_side.to_f2_trans[integer, 0, NOT] F%ix_ele_key = z_ix_ele_key !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_name_ele, F%name_ele) end subroutine tao_ele_shape_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_pattern_point_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_pattern_point_struct to a C++ CPP_tao_pattern_point structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_pattern_point_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_pattern_point struct. !- subroutine tao_pattern_point_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_pattern_point_to_c2 (C, z_s, z_x, z_radius) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C real(c_double) :: z_s, z_x, z_radius end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_pattern_point_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call tao_pattern_point_to_c2 (C, F%s, F%x, F%radius) end subroutine tao_pattern_point_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_pattern_point_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_pattern_point structure to a Tao tao_pattern_point_struct structure. ! This routine is called by tao_pattern_point_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_pattern_point_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_pattern_point_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_pattern_point_to_f2 (Fp, z_s, z_x, z_radius) bind(c) implicit none type(c_ptr), value :: Fp type(tao_pattern_point_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name real(c_double) :: z_s, z_x, z_radius call c_f_pointer (Fp, F) !! f_side.to_f2_trans[real, 0, NOT] F%s = z_s !! f_side.to_f2_trans[real, 0, NOT] F%x = z_x !! f_side.to_f2_trans[real, 0, NOT] F%radius = z_radius end subroutine tao_pattern_point_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_pattern_curve_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_pattern_curve_struct to a C++ CPP_tao_pattern_curve structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_pattern_curve_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_pattern_curve struct. !- subroutine tao_pattern_curve_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_pattern_curve_to_c2 (C, z_line, z_pt, n1_pt, z_scale) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_scale(*) type(c_ptr) :: z_pt(*) integer(c_int), value :: n1_pt type(c_ptr), value :: z_line end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_pattern_curve_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var type(c_ptr), allocatable :: z_pt(:) integer(c_int) :: n1_pt ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 1, ALLOC] n1_pt = 0 if (allocated(F%pt)) then n1_pt = size(F%pt); lb1 = lbound(F%pt, 1) - 1 allocate (z_pt(n1_pt)) do jd1 = 1, n1_pt z_pt(jd1) = c_loc(F%pt(jd1+lb1)) enddo endif !! f_side.to_c2_call call tao_pattern_curve_to_c2 (C, c_loc(F%line), z_pt, n1_pt, trim(F%scale) // c_null_char) end subroutine tao_pattern_curve_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_pattern_curve_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_pattern_curve structure to a Tao tao_pattern_curve_struct structure. ! This routine is called by tao_pattern_curve_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_pattern_curve_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_pattern_curve_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_pattern_curve_to_f2 (Fp, z_line, z_pt, n1_pt, z_scale) bind(c) implicit none type(c_ptr), value :: Fp type(tao_pattern_curve_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_scale(*) type(c_ptr) :: z_pt(*) integer(c_int), value :: n1_pt type(c_ptr), value :: z_line call c_f_pointer (Fp, F) !! f_side.to_f2_trans[type, 0, NOT] call qp_line_to_f(z_line, c_loc(F%line)) !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_pt == 0) then if (allocated(F%pt)) deallocate(F%pt) else if (allocated(F%pt)) then if (n1_pt == 0 .or. any(shape(F%pt) /= [n1_pt])) deallocate(F%pt) if (any(lbound(F%pt) /= 1)) deallocate(F%pt) endif if (.not. allocated(F%pt)) allocate(F%pt(1:n1_pt+1-1)) do jd1 = 1, n1_pt call tao_pattern_point_to_f (z_pt(jd1), c_loc(F%pt(jd1+1-1))) enddo endif !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_scale, F%scale) end subroutine tao_pattern_curve_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_shape_pattern_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_shape_pattern_struct to a C++ CPP_tao_shape_pattern structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_shape_pattern_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_shape_pattern struct. !- subroutine tao_shape_pattern_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_shape_pattern_to_c2 (C, z_name, z_curve, n1_curve) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_name(*) type(c_ptr) :: z_curve(*) integer(c_int), value :: n1_curve end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_shape_pattern_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var type(c_ptr), allocatable :: z_curve(:) integer(c_int) :: n1_curve ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 1, ALLOC] n1_curve = 0 if (allocated(F%curve)) then n1_curve = size(F%curve); lb1 = lbound(F%curve, 1) - 1 allocate (z_curve(n1_curve)) do jd1 = 1, n1_curve z_curve(jd1) = c_loc(F%curve(jd1+lb1)) enddo endif !! f_side.to_c2_call call tao_shape_pattern_to_c2 (C, trim(F%name) // c_null_char, z_curve, n1_curve) end subroutine tao_shape_pattern_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_shape_pattern_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_shape_pattern structure to a Tao tao_shape_pattern_struct structure. ! This routine is called by tao_shape_pattern_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_shape_pattern_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_shape_pattern_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_shape_pattern_to_f2 (Fp, z_name, z_curve, n1_curve) bind(c) implicit none type(c_ptr), value :: Fp type(tao_shape_pattern_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_name(*) type(c_ptr) :: z_curve(*) integer(c_int), value :: n1_curve call c_f_pointer (Fp, F) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_name, F%name) !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_curve == 0) then if (allocated(F%curve)) deallocate(F%curve) else if (allocated(F%curve)) then if (n1_curve == 0 .or. any(shape(F%curve) /= [n1_curve])) deallocate(F%curve) if (any(lbound(F%curve) /= 1)) deallocate(F%curve) endif if (.not. allocated(F%curve)) allocate(F%curve(1:n1_curve+1-1)) do jd1 = 1, n1_curve call tao_pattern_curve_to_f (z_curve(jd1), c_loc(F%curve(jd1+1-1))) enddo endif end subroutine tao_shape_pattern_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_drawing_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_drawing_struct to a C++ CPP_tao_drawing structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_drawing_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_drawing struct. !- subroutine tao_drawing_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_drawing_to_c2 (C, z_ele_shape, n1_ele_shape) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C type(c_ptr) :: z_ele_shape(*) integer(c_int), value :: n1_ele_shape end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_drawing_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var type(c_ptr), allocatable :: z_ele_shape(:) integer(c_int) :: n1_ele_shape ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 1, ALLOC] n1_ele_shape = 0 if (allocated(F%ele_shape)) then n1_ele_shape = size(F%ele_shape); lb1 = lbound(F%ele_shape, 1) - 1 allocate (z_ele_shape(n1_ele_shape)) do jd1 = 1, n1_ele_shape z_ele_shape(jd1) = c_loc(F%ele_shape(jd1+lb1)) enddo endif !! f_side.to_c2_call call tao_drawing_to_c2 (C, z_ele_shape, n1_ele_shape) end subroutine tao_drawing_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_drawing_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_drawing structure to a Tao tao_drawing_struct structure. ! This routine is called by tao_drawing_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_drawing_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_drawing_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_drawing_to_f2 (Fp, z_ele_shape, n1_ele_shape) bind(c) implicit none type(c_ptr), value :: Fp type(tao_drawing_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name type(c_ptr) :: z_ele_shape(*) integer(c_int), value :: n1_ele_shape call c_f_pointer (Fp, F) !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_ele_shape == 0) then if (allocated(F%ele_shape)) deallocate(F%ele_shape) else if (allocated(F%ele_shape)) then if (n1_ele_shape == 0 .or. any(shape(F%ele_shape) /= [n1_ele_shape])) deallocate(F%ele_shape) if (any(lbound(F%ele_shape) /= 1)) deallocate(F%ele_shape) endif if (.not. allocated(F%ele_shape)) allocate(F%ele_shape(1:n1_ele_shape+1-1)) do jd1 = 1, n1_ele_shape call tao_ele_shape_to_f (z_ele_shape(jd1), c_loc(F%ele_shape(jd1+1-1))) enddo endif end subroutine tao_drawing_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_wave_kick_pt_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_wave_kick_pt_struct to a C++ CPP_tao_wave_kick_pt structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_wave_kick_pt_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_wave_kick_pt struct. !- subroutine tao_wave_kick_pt_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_wave_kick_pt_to_c2 (C, z_phi_s, z_phi_r, z_phi, z_amp, z_ix_dat) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C integer(c_int) :: z_ix_dat real(c_double) :: z_phi_s, z_phi_r, z_phi, z_amp end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_wave_kick_pt_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call tao_wave_kick_pt_to_c2 (C, F%phi_s, F%phi_r, F%phi, F%amp, F%ix_dat) end subroutine tao_wave_kick_pt_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_wave_kick_pt_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_wave_kick_pt structure to a Tao tao_wave_kick_pt_struct structure. ! This routine is called by tao_wave_kick_pt_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_wave_kick_pt_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_wave_kick_pt_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_wave_kick_pt_to_f2 (Fp, z_phi_s, z_phi_r, z_phi, z_amp, z_ix_dat) bind(c) implicit none type(c_ptr), value :: Fp type(tao_wave_kick_pt_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name integer(c_int) :: z_ix_dat real(c_double) :: z_phi_s, z_phi_r, z_phi, z_amp call c_f_pointer (Fp, F) !! f_side.to_f2_trans[real, 0, NOT] F%phi_s = z_phi_s !! f_side.to_f2_trans[real, 0, NOT] F%phi_r = z_phi_r !! f_side.to_f2_trans[real, 0, NOT] F%phi = z_phi !! f_side.to_f2_trans[real, 0, NOT] F%amp = z_amp !! f_side.to_f2_trans[integer, 0, NOT] F%ix_dat = z_ix_dat end subroutine tao_wave_kick_pt_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_wave_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_wave_struct to a C++ CPP_tao_wave structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_wave_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_wave struct. !- subroutine tao_wave_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_wave_to_c2 (C, z_data_type, z_rms_rel_a, z_rms_rel_b, z_rms_rel_as, & z_rms_rel_bs, z_rms_rel_ar, z_rms_rel_br, z_rms_rel_k, z_rms_rel_ks, z_rms_rel_kr, & z_rms_phi, z_rms_phi_s, z_rms_phi_r, z_amp_ba_s, z_amp_ba_r, z_chi_a, z_chi_c, z_chi_ba, & z_amp_a, z_amp_b, z_amp_ba, z_coef_a, z_coef_b, z_coef_ba, z_n_func, z_ix_a1, z_ix_a2, & z_ix_b1, z_ix_b2, z_i_a1, z_i_a2, z_i_b1, z_i_b2, z_n_a, z_n_b, z_i_wrap_pt, z_ix_data, & n1_ix_data, z_n_kick, z_kick, n1_kick, z_graph, z_ele) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_data_type(*) integer(c_int) :: z_n_func, z_ix_a1, z_ix_a2, z_ix_b1, z_ix_b2, z_i_a1, z_i_a2 integer(c_int) :: z_i_b1, z_i_b2, z_n_a, z_n_b, z_i_wrap_pt, z_ix_data(*), z_n_kick type(c_ptr) :: z_kick(*) integer(c_int), value :: n1_ix_data, n1_kick real(c_double) :: z_rms_rel_a, z_rms_rel_b, z_rms_rel_as, z_rms_rel_bs, z_rms_rel_ar, z_rms_rel_br, z_rms_rel_k real(c_double) :: z_rms_rel_ks, z_rms_rel_kr, z_rms_phi, z_rms_phi_s, z_rms_phi_r, z_amp_ba_s, z_amp_ba_r real(c_double) :: z_chi_a, z_chi_c, z_chi_ba, z_amp_a(*), z_amp_b(*), z_amp_ba(*), z_coef_a(*) real(c_double) :: z_coef_b(*), z_coef_ba(*) type(c_ptr), value :: z_graph, z_ele end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_wave_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var integer(c_int) :: n1_ix_data type(c_ptr), allocatable :: z_kick(:) integer(c_int) :: n1_kick ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[integer, 1, ALLOC] n1_ix_data = 0 if (allocated(F%ix_data)) then n1_ix_data = size(F%ix_data, 1) endif !! f_side.to_c_trans[type, 1, ALLOC] n1_kick = 0 if (allocated(F%kick)) then n1_kick = size(F%kick); lb1 = lbound(F%kick, 1) - 1 allocate (z_kick(n1_kick)) do jd1 = 1, n1_kick z_kick(jd1) = c_loc(F%kick(jd1+lb1)) enddo endif !! f_side.to_c2_call call tao_wave_to_c2 (C, trim(F%data_type) // c_null_char, F%rms_rel_a, F%rms_rel_b, & F%rms_rel_as, F%rms_rel_bs, F%rms_rel_ar, F%rms_rel_br, F%rms_rel_k, F%rms_rel_ks, & F%rms_rel_kr, F%rms_phi, F%rms_phi_s, F%rms_phi_r, F%amp_ba_s, F%amp_ba_r, F%chi_a, & F%chi_c, F%chi_ba, fvec2vec(F%amp_a, 2), fvec2vec(F%amp_b, 2), fvec2vec(F%amp_ba, 2), & fvec2vec(F%coef_a, 4), fvec2vec(F%coef_b, 4), fvec2vec(F%coef_ba, 4), F%n_func, F%ix_a1, & F%ix_a2, F%ix_b1, F%ix_b2, F%i_a1, F%i_a2, F%i_b1, F%i_b2, F%n_a, F%n_b, F%i_wrap_pt, & fvec2vec(F%ix_data, n1_ix_data), n1_ix_data, F%n_kick, z_kick, n1_kick, c_loc(F%graph), & c_loc(F%ele)) end subroutine tao_wave_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_wave_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_wave structure to a Tao tao_wave_struct structure. ! This routine is called by tao_wave_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_wave_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_wave_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_wave_to_f2 (Fp, z_data_type, z_rms_rel_a, z_rms_rel_b, z_rms_rel_as, & z_rms_rel_bs, z_rms_rel_ar, z_rms_rel_br, z_rms_rel_k, z_rms_rel_ks, z_rms_rel_kr, & z_rms_phi, z_rms_phi_s, z_rms_phi_r, z_amp_ba_s, z_amp_ba_r, z_chi_a, z_chi_c, z_chi_ba, & z_amp_a, z_amp_b, z_amp_ba, z_coef_a, z_coef_b, z_coef_ba, z_n_func, z_ix_a1, z_ix_a2, & z_ix_b1, z_ix_b2, z_i_a1, z_i_a2, z_i_b1, z_i_b2, z_n_a, z_n_b, z_i_wrap_pt, z_ix_data, & n1_ix_data, z_n_kick, z_kick, n1_kick, z_graph, z_ele) bind(c) implicit none type(c_ptr), value :: Fp type(tao_wave_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_data_type(*) integer(c_int) :: z_n_func, z_ix_a1, z_ix_a2, z_ix_b1, z_ix_b2, z_i_a1, z_i_a2 integer(c_int) :: z_i_b1, z_i_b2, z_n_a, z_n_b, z_i_wrap_pt, z_n_kick type(c_ptr) :: z_kick(*) integer(c_int), value :: n1_ix_data, n1_kick integer(c_int), pointer :: f_ix_data(:) real(c_double) :: z_rms_rel_a, z_rms_rel_b, z_rms_rel_as, z_rms_rel_bs, z_rms_rel_ar, z_rms_rel_br, z_rms_rel_k real(c_double) :: z_rms_rel_ks, z_rms_rel_kr, z_rms_phi, z_rms_phi_s, z_rms_phi_r, z_amp_ba_s, z_amp_ba_r real(c_double) :: z_chi_a, z_chi_c, z_chi_ba, z_amp_a(*), z_amp_b(*), z_amp_ba(*), z_coef_a(*) real(c_double) :: z_coef_b(*), z_coef_ba(*) type(c_ptr), value :: z_ix_data, z_graph, z_ele call c_f_pointer (Fp, F) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_data_type, F%data_type) !! f_side.to_f2_trans[real, 0, NOT] F%rms_rel_a = z_rms_rel_a !! f_side.to_f2_trans[real, 0, NOT] F%rms_rel_b = z_rms_rel_b !! f_side.to_f2_trans[real, 0, NOT] F%rms_rel_as = z_rms_rel_as !! f_side.to_f2_trans[real, 0, NOT] F%rms_rel_bs = z_rms_rel_bs !! f_side.to_f2_trans[real, 0, NOT] F%rms_rel_ar = z_rms_rel_ar !! f_side.to_f2_trans[real, 0, NOT] F%rms_rel_br = z_rms_rel_br !! f_side.to_f2_trans[real, 0, NOT] F%rms_rel_k = z_rms_rel_k !! f_side.to_f2_trans[real, 0, NOT] F%rms_rel_ks = z_rms_rel_ks !! f_side.to_f2_trans[real, 0, NOT] F%rms_rel_kr = z_rms_rel_kr !! f_side.to_f2_trans[real, 0, NOT] F%rms_phi = z_rms_phi !! f_side.to_f2_trans[real, 0, NOT] F%rms_phi_s = z_rms_phi_s !! f_side.to_f2_trans[real, 0, NOT] F%rms_phi_r = z_rms_phi_r !! f_side.to_f2_trans[real, 0, NOT] F%amp_ba_s = z_amp_ba_s !! f_side.to_f2_trans[real, 0, NOT] F%amp_ba_r = z_amp_ba_r !! f_side.to_f2_trans[real, 0, NOT] F%chi_a = z_chi_a !! f_side.to_f2_trans[real, 0, NOT] F%chi_c = z_chi_c !! f_side.to_f2_trans[real, 0, NOT] F%chi_ba = z_chi_ba !! f_side.to_f2_trans[real, 1, NOT] F%amp_a = z_amp_a(1:2) !! f_side.to_f2_trans[real, 1, NOT] F%amp_b = z_amp_b(1:2) !! f_side.to_f2_trans[real, 1, NOT] F%amp_ba = z_amp_ba(1:2) !! f_side.to_f2_trans[real, 1, NOT] F%coef_a = z_coef_a(1:4) !! f_side.to_f2_trans[real, 1, NOT] F%coef_b = z_coef_b(1:4) !! f_side.to_f2_trans[real, 1, NOT] F%coef_ba = z_coef_ba(1:4) !! f_side.to_f2_trans[integer, 0, NOT] F%n_func = z_n_func !! f_side.to_f2_trans[integer, 0, NOT] F%ix_a1 = z_ix_a1 !! f_side.to_f2_trans[integer, 0, NOT] F%ix_a2 = z_ix_a2 !! f_side.to_f2_trans[integer, 0, NOT] F%ix_b1 = z_ix_b1 !! f_side.to_f2_trans[integer, 0, NOT] F%ix_b2 = z_ix_b2 !! f_side.to_f2_trans[integer, 0, NOT] F%i_a1 = z_i_a1 !! f_side.to_f2_trans[integer, 0, NOT] F%i_a2 = z_i_a2 !! f_side.to_f2_trans[integer, 0, NOT] F%i_b1 = z_i_b1 !! f_side.to_f2_trans[integer, 0, NOT] F%i_b2 = z_i_b2 !! f_side.to_f2_trans[integer, 0, NOT] F%n_a = z_n_a !! f_side.to_f2_trans[integer, 0, NOT] F%n_b = z_n_b !! f_side.to_f2_trans[integer, 0, NOT] F%i_wrap_pt = z_i_wrap_pt !! f_side.to_f2_trans[integer, 1, ALLOC] if (allocated(F%ix_data)) then if (n1_ix_data == 0 .or. any(shape(F%ix_data) /= [n1_ix_data])) deallocate(F%ix_data) if (any(lbound(F%ix_data) /= 1)) deallocate(F%ix_data) endif if (n1_ix_data /= 0) then call c_f_pointer (z_ix_data, f_ix_data, [n1_ix_data]) if (.not. allocated(F%ix_data)) allocate(F%ix_data(n1_ix_data)) F%ix_data = f_ix_data(1:n1_ix_data) else if (allocated(F%ix_data)) deallocate(F%ix_data) endif !! f_side.to_f2_trans[integer, 0, NOT] F%n_kick = z_n_kick !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_kick == 0) then if (allocated(F%kick)) deallocate(F%kick) else if (allocated(F%kick)) then if (n1_kick == 0 .or. any(shape(F%kick) /= [n1_kick])) deallocate(F%kick) if (any(lbound(F%kick) /= 1)) deallocate(F%kick) endif if (.not. allocated(F%kick)) allocate(F%kick(1:n1_kick+1-1)) do jd1 = 1, n1_kick call tao_wave_kick_pt_to_f (z_kick(jd1), c_loc(F%kick(jd1+1-1))) enddo endif !! f_side.to_f2_trans[type, 0, NOT] call tao_graph_to_f(z_graph, c_loc(F%graph)) !! f_side.to_f2_trans[type, 0, NOT] call ele_to_f(z_ele, c_loc(F%ele)) end subroutine tao_wave_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_title_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_title_struct to a C++ CPP_tao_title structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_title_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_title struct. !- subroutine tao_title_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_title_to_c2 (C, z_string, z_x, z_y, z_units, z_justify, z_draw_it) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_string(*), z_units(*), z_justify(*) real(c_double) :: z_x, z_y logical(c_bool) :: z_draw_it end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_title_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call tao_title_to_c2 (C, trim(F%string) // c_null_char, F%x, F%y, trim(F%units) // c_null_char, & trim(F%justify) // c_null_char, c_logic(F%draw_it)) end subroutine tao_title_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_title_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_title structure to a Tao tao_title_struct structure. ! This routine is called by tao_title_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_title_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_title_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_title_to_f2 (Fp, z_string, z_x, z_y, z_units, z_justify, z_draw_it) bind(c) implicit none type(c_ptr), value :: Fp type(tao_title_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_string(*), z_units(*), z_justify(*) real(c_double) :: z_x, z_y logical(c_bool) :: z_draw_it call c_f_pointer (Fp, F) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_string, F%string) !! f_side.to_f2_trans[real, 0, NOT] F%x = z_x !! f_side.to_f2_trans[real, 0, NOT] F%y = z_y !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_units, F%units) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_justify, F%justify) !! f_side.to_f2_trans[logical, 0, NOT] F%draw_it = f_logic(z_draw_it) end subroutine tao_title_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_data_var_component_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_data_var_component_struct to a C++ CPP_tao_data_var_component structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_data_var_component_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_data_var_component struct. !- subroutine tao_data_var_component_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_data_var_component_to_c2 (C, z_name, z_sign) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_name(*) real(c_double) :: z_sign end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_data_var_component_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call tao_data_var_component_to_c2 (C, trim(F%name) // c_null_char, F%sign) end subroutine tao_data_var_component_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_data_var_component_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_data_var_component structure to a Tao tao_data_var_component_struct structure. ! This routine is called by tao_data_var_component_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_data_var_component_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_data_var_component_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_data_var_component_to_f2 (Fp, z_name, z_sign) bind(c) implicit none type(c_ptr), value :: Fp type(tao_data_var_component_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_name(*) real(c_double) :: z_sign call c_f_pointer (Fp, F) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_name, F%name) !! f_side.to_f2_trans[real, 0, NOT] F%sign = z_sign end subroutine tao_data_var_component_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_histogram_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_histogram_struct to a C++ CPP_tao_histogram structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_histogram_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_histogram struct. !- subroutine tao_histogram_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_histogram_to_c2 (C, z_density_normalized, z_weight_by_charge, z_minimum, & z_maximum, z_width, z_center, z_number) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C integer(c_int) :: z_number real(c_double) :: z_minimum, z_maximum, z_width, z_center logical(c_bool) :: z_density_normalized, z_weight_by_charge end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_histogram_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call tao_histogram_to_c2 (C, c_logic(F%density_normalized), c_logic(F%weight_by_charge), & F%minimum, F%maximum, F%width, F%center, F%number) end subroutine tao_histogram_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_histogram_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_histogram structure to a Tao tao_histogram_struct structure. ! This routine is called by tao_histogram_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_histogram_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_histogram_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_histogram_to_f2 (Fp, z_density_normalized, z_weight_by_charge, z_minimum, & z_maximum, z_width, z_center, z_number) bind(c) implicit none type(c_ptr), value :: Fp type(tao_histogram_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name integer(c_int) :: z_number real(c_double) :: z_minimum, z_maximum, z_width, z_center logical(c_bool) :: z_density_normalized, z_weight_by_charge call c_f_pointer (Fp, F) !! f_side.to_f2_trans[logical, 0, NOT] F%density_normalized = f_logic(z_density_normalized) !! f_side.to_f2_trans[logical, 0, NOT] F%weight_by_charge = f_logic(z_weight_by_charge) !! f_side.to_f2_trans[real, 0, NOT] F%minimum = z_minimum !! f_side.to_f2_trans[real, 0, NOT] F%maximum = z_maximum !! f_side.to_f2_trans[real, 0, NOT] F%width = z_width !! f_side.to_f2_trans[real, 0, NOT] F%center = z_center !! f_side.to_f2_trans[integer, 0, NOT] F%number = z_number end subroutine tao_histogram_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_curve_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_curve_struct to a C++ CPP_tao_curve structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_curve_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_curve struct. !- subroutine tao_curve_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_curve_to_c2 (C, z_name, z_data_source, z_data_index, z_data_type_x, & z_data_type_z, z_data_type, z_ele_ref_name, z_legend_text, z_message_text, z_units, & z_component, z_g, n_g, z_hist, z_x_line, n1_x_line, z_y_line, n1_y_line, z_y2_line, & n1_y2_line, z_ix_line, n1_ix_line, z_x_symb, n1_x_symb, z_y_symb, n1_y_symb, z_z_symb, & n1_z_symb, z_symb_size, n1_symb_size, z_ix_symb, n1_ix_symb, z_y_axis_scale_factor, z_s, & z_z_color0, z_z_color1, z_line, z_symbol, z_ix_universe, z_symbol_every, z_ix_branch, & z_ix_ele_ref, z_ix_ele_ref_track, z_ix_bunch, z_use_y2, z_draw_line, z_draw_symbols, & z_draw_symbol_index, z_smooth_line_calc, z_use_z_color, z_autoscale_z_color) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_name(*), z_data_source(*), z_data_index(*), z_data_type_x(*), z_data_type_z(*), z_data_type(*), z_ele_ref_name(*) character(c_char) :: z_legend_text(*), z_message_text(*), z_units(*), z_component(*) integer(c_int) :: z_ix_line(*), z_ix_symb(*), z_ix_universe, z_symbol_every, z_ix_branch, z_ix_ele_ref, z_ix_ele_ref_track integer(c_int) :: z_ix_bunch integer(c_int), value :: n_g, n1_x_line, n1_y_line, n1_y2_line, n1_ix_line, n1_x_symb, n1_y_symb integer(c_int), value :: n1_z_symb, n1_symb_size, n1_ix_symb logical(c_bool) :: z_use_y2, z_draw_line, z_draw_symbols, z_draw_symbol_index, z_smooth_line_calc, z_use_z_color, z_autoscale_z_color real(c_double) :: z_x_line(*), z_y_line(*), z_y2_line(*), z_x_symb(*), z_y_symb(*), z_z_symb(*), z_symb_size(*) real(c_double) :: z_y_axis_scale_factor, z_s, z_z_color0, z_z_color1 type(c_ptr), value :: z_g, z_hist, z_line, z_symbol end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_curve_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var integer(c_int) :: n_g integer(c_int) :: n1_x_line integer(c_int) :: n1_y_line integer(c_int) :: n1_y2_line integer(c_int) :: n1_ix_line integer(c_int) :: n1_x_symb integer(c_int) :: n1_y_symb integer(c_int) :: n1_z_symb integer(c_int) :: n1_symb_size integer(c_int) :: n1_ix_symb ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 0, PTR] n_g = 0 if (associated(F%g)) n_g = 1 !! f_side.to_c_trans[real, 1, ALLOC] n1_x_line = 0 if (allocated(F%x_line)) then n1_x_line = size(F%x_line, 1) endif !! f_side.to_c_trans[real, 1, ALLOC] n1_y_line = 0 if (allocated(F%y_line)) then n1_y_line = size(F%y_line, 1) endif !! f_side.to_c_trans[real, 1, ALLOC] n1_y2_line = 0 if (allocated(F%y2_line)) then n1_y2_line = size(F%y2_line, 1) endif !! f_side.to_c_trans[integer, 1, ALLOC] n1_ix_line = 0 if (allocated(F%ix_line)) then n1_ix_line = size(F%ix_line, 1) endif !! f_side.to_c_trans[real, 1, ALLOC] n1_x_symb = 0 if (allocated(F%x_symb)) then n1_x_symb = size(F%x_symb, 1) endif !! f_side.to_c_trans[real, 1, ALLOC] n1_y_symb = 0 if (allocated(F%y_symb)) then n1_y_symb = size(F%y_symb, 1) endif !! f_side.to_c_trans[real, 1, ALLOC] n1_z_symb = 0 if (allocated(F%z_symb)) then n1_z_symb = size(F%z_symb, 1) endif !! f_side.to_c_trans[real, 1, ALLOC] n1_symb_size = 0 if (allocated(F%symb_size)) then n1_symb_size = size(F%symb_size, 1) endif !! f_side.to_c_trans[integer, 1, ALLOC] n1_ix_symb = 0 if (allocated(F%ix_symb)) then n1_ix_symb = size(F%ix_symb, 1) endif !! f_side.to_c2_call call tao_curve_to_c2 (C, trim(F%name) // c_null_char, trim(F%data_source) // c_null_char, & trim(F%data_index) // c_null_char, trim(F%data_type_x) // c_null_char, trim(F%data_type_z) & // c_null_char, trim(F%data_type) // c_null_char, trim(F%ele_ref_name) // c_null_char, & trim(F%legend_text) // c_null_char, trim(F%message_text) // c_null_char, trim(F%units) // & c_null_char, trim(F%component) // c_null_char, c_loc(F%g), n_g, c_loc(F%hist), & fvec2vec(F%x_line, n1_x_line), n1_x_line, fvec2vec(F%y_line, n1_y_line), n1_y_line, & fvec2vec(F%y2_line, n1_y2_line), n1_y2_line, fvec2vec(F%ix_line, n1_ix_line), n1_ix_line, & fvec2vec(F%x_symb, n1_x_symb), n1_x_symb, fvec2vec(F%y_symb, n1_y_symb), n1_y_symb, & fvec2vec(F%z_symb, n1_z_symb), n1_z_symb, fvec2vec(F%symb_size, n1_symb_size), & n1_symb_size, fvec2vec(F%ix_symb, n1_ix_symb), n1_ix_symb, F%y_axis_scale_factor, F%s, & F%z_color0, F%z_color1, c_loc(F%line), c_loc(F%symbol), F%ix_universe, F%symbol_every, & F%ix_branch, F%ix_ele_ref, F%ix_ele_ref_track, F%ix_bunch, c_logic(F%use_y2), & c_logic(F%draw_line), c_logic(F%draw_symbols), c_logic(F%draw_symbol_index), & c_logic(F%smooth_line_calc), c_logic(F%use_z_color), c_logic(F%autoscale_z_color)) end subroutine tao_curve_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_curve_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_curve structure to a Tao tao_curve_struct structure. ! This routine is called by tao_curve_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_curve_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_curve_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_curve_to_f2 (Fp, z_name, z_data_source, z_data_index, z_data_type_x, & z_data_type_z, z_data_type, z_ele_ref_name, z_legend_text, z_message_text, z_units, & z_component, z_g, n_g, z_hist, z_x_line, n1_x_line, z_y_line, n1_y_line, z_y2_line, & n1_y2_line, z_ix_line, n1_ix_line, z_x_symb, n1_x_symb, z_y_symb, n1_y_symb, z_z_symb, & n1_z_symb, z_symb_size, n1_symb_size, z_ix_symb, n1_ix_symb, z_y_axis_scale_factor, z_s, & z_z_color0, z_z_color1, z_line, z_symbol, z_ix_universe, z_symbol_every, z_ix_branch, & z_ix_ele_ref, z_ix_ele_ref_track, z_ix_bunch, z_use_y2, z_draw_line, z_draw_symbols, & z_draw_symbol_index, z_smooth_line_calc, z_use_z_color, z_autoscale_z_color) bind(c) implicit none type(c_ptr), value :: Fp type(tao_curve_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_name(*), z_data_source(*), z_data_index(*), z_data_type_x(*), z_data_type_z(*), z_data_type(*), z_ele_ref_name(*) character(c_char) :: z_legend_text(*), z_message_text(*), z_units(*), z_component(*) real(c_double), pointer :: f_x_line(:), f_y_line(:), f_y2_line(:), f_x_symb(:), f_y_symb(:), f_z_symb(:), f_symb_size(:) type(tao_graph_struct), pointer :: f_g integer(c_int), value :: n_g, n1_x_line, n1_y_line, n1_y2_line, n1_ix_line, n1_x_symb, n1_y_symb integer(c_int), value :: n1_z_symb, n1_symb_size, n1_ix_symb integer(c_int) :: z_ix_universe, z_symbol_every, z_ix_branch, z_ix_ele_ref, z_ix_ele_ref_track, z_ix_bunch logical(c_bool) :: z_use_y2, z_draw_line, z_draw_symbols, z_draw_symbol_index, z_smooth_line_calc, z_use_z_color, z_autoscale_z_color integer(c_int), pointer :: f_ix_line(:), f_ix_symb(:) real(c_double) :: z_y_axis_scale_factor, z_s, z_z_color0, z_z_color1 type(c_ptr), value :: z_g, z_hist, z_x_line, z_y_line, z_y2_line, z_ix_line, z_x_symb type(c_ptr), value :: z_y_symb, z_z_symb, z_symb_size, z_ix_symb, z_line, z_symbol call c_f_pointer (Fp, F) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_name, F%name) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_data_source, F%data_source) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_data_index, F%data_index) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_data_type_x, F%data_type_x) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_data_type_z, F%data_type_z) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_data_type, F%data_type) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_ele_ref_name, F%ele_ref_name) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_legend_text, F%legend_text) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_message_text, F%message_text) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_units, F%units) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_component, F%component) !! f_side.to_f2_trans[type, 0, PTR] if (n_g == 0) then if (associated(F%g)) deallocate(F%g) else if (.not. associated(F%g)) allocate(F%g) call tao_graph_to_f (z_g, c_loc(F%g)) endif !! f_side.to_f2_trans[type, 0, NOT] call tao_histogram_to_f(z_hist, c_loc(F%hist)) !! f_side.to_f2_trans[real, 1, ALLOC] if (allocated(F%x_line)) then if (n1_x_line == 0 .or. any(shape(F%x_line) /= [n1_x_line])) deallocate(F%x_line) if (any(lbound(F%x_line) /= 1)) deallocate(F%x_line) endif if (n1_x_line /= 0) then call c_f_pointer (z_x_line, f_x_line, [n1_x_line]) if (.not. allocated(F%x_line)) allocate(F%x_line(n1_x_line)) F%x_line = f_x_line(1:n1_x_line) else if (allocated(F%x_line)) deallocate(F%x_line) endif !! f_side.to_f2_trans[real, 1, ALLOC] if (allocated(F%y_line)) then if (n1_y_line == 0 .or. any(shape(F%y_line) /= [n1_y_line])) deallocate(F%y_line) if (any(lbound(F%y_line) /= 1)) deallocate(F%y_line) endif if (n1_y_line /= 0) then call c_f_pointer (z_y_line, f_y_line, [n1_y_line]) if (.not. allocated(F%y_line)) allocate(F%y_line(n1_y_line)) F%y_line = f_y_line(1:n1_y_line) else if (allocated(F%y_line)) deallocate(F%y_line) endif !! f_side.to_f2_trans[real, 1, ALLOC] if (allocated(F%y2_line)) then if (n1_y2_line == 0 .or. any(shape(F%y2_line) /= [n1_y2_line])) deallocate(F%y2_line) if (any(lbound(F%y2_line) /= 1)) deallocate(F%y2_line) endif if (n1_y2_line /= 0) then call c_f_pointer (z_y2_line, f_y2_line, [n1_y2_line]) if (.not. allocated(F%y2_line)) allocate(F%y2_line(n1_y2_line)) F%y2_line = f_y2_line(1:n1_y2_line) else if (allocated(F%y2_line)) deallocate(F%y2_line) endif !! f_side.to_f2_trans[integer, 1, ALLOC] if (allocated(F%ix_line)) then if (n1_ix_line == 0 .or. any(shape(F%ix_line) /= [n1_ix_line])) deallocate(F%ix_line) if (any(lbound(F%ix_line) /= 1)) deallocate(F%ix_line) endif if (n1_ix_line /= 0) then call c_f_pointer (z_ix_line, f_ix_line, [n1_ix_line]) if (.not. allocated(F%ix_line)) allocate(F%ix_line(n1_ix_line)) F%ix_line = f_ix_line(1:n1_ix_line) else if (allocated(F%ix_line)) deallocate(F%ix_line) endif !! f_side.to_f2_trans[real, 1, ALLOC] if (allocated(F%x_symb)) then if (n1_x_symb == 0 .or. any(shape(F%x_symb) /= [n1_x_symb])) deallocate(F%x_symb) if (any(lbound(F%x_symb) /= 1)) deallocate(F%x_symb) endif if (n1_x_symb /= 0) then call c_f_pointer (z_x_symb, f_x_symb, [n1_x_symb]) if (.not. allocated(F%x_symb)) allocate(F%x_symb(n1_x_symb)) F%x_symb = f_x_symb(1:n1_x_symb) else if (allocated(F%x_symb)) deallocate(F%x_symb) endif !! f_side.to_f2_trans[real, 1, ALLOC] if (allocated(F%y_symb)) then if (n1_y_symb == 0 .or. any(shape(F%y_symb) /= [n1_y_symb])) deallocate(F%y_symb) if (any(lbound(F%y_symb) /= 1)) deallocate(F%y_symb) endif if (n1_y_symb /= 0) then call c_f_pointer (z_y_symb, f_y_symb, [n1_y_symb]) if (.not. allocated(F%y_symb)) allocate(F%y_symb(n1_y_symb)) F%y_symb = f_y_symb(1:n1_y_symb) else if (allocated(F%y_symb)) deallocate(F%y_symb) endif !! f_side.to_f2_trans[real, 1, ALLOC] if (allocated(F%z_symb)) then if (n1_z_symb == 0 .or. any(shape(F%z_symb) /= [n1_z_symb])) deallocate(F%z_symb) if (any(lbound(F%z_symb) /= 1)) deallocate(F%z_symb) endif if (n1_z_symb /= 0) then call c_f_pointer (z_z_symb, f_z_symb, [n1_z_symb]) if (.not. allocated(F%z_symb)) allocate(F%z_symb(n1_z_symb)) F%z_symb = f_z_symb(1:n1_z_symb) else if (allocated(F%z_symb)) deallocate(F%z_symb) endif !! f_side.to_f2_trans[real, 1, ALLOC] if (allocated(F%symb_size)) then if (n1_symb_size == 0 .or. any(shape(F%symb_size) /= [n1_symb_size])) deallocate(F%symb_size) if (any(lbound(F%symb_size) /= 1)) deallocate(F%symb_size) endif if (n1_symb_size /= 0) then call c_f_pointer (z_symb_size, f_symb_size, [n1_symb_size]) if (.not. allocated(F%symb_size)) allocate(F%symb_size(n1_symb_size)) F%symb_size = f_symb_size(1:n1_symb_size) else if (allocated(F%symb_size)) deallocate(F%symb_size) endif !! f_side.to_f2_trans[integer, 1, ALLOC] if (allocated(F%ix_symb)) then if (n1_ix_symb == 0 .or. any(shape(F%ix_symb) /= [n1_ix_symb])) deallocate(F%ix_symb) if (any(lbound(F%ix_symb) /= 1)) deallocate(F%ix_symb) endif if (n1_ix_symb /= 0) then call c_f_pointer (z_ix_symb, f_ix_symb, [n1_ix_symb]) if (.not. allocated(F%ix_symb)) allocate(F%ix_symb(n1_ix_symb)) F%ix_symb = f_ix_symb(1:n1_ix_symb) else if (allocated(F%ix_symb)) deallocate(F%ix_symb) endif !! f_side.to_f2_trans[real, 0, NOT] F%y_axis_scale_factor = z_y_axis_scale_factor !! f_side.to_f2_trans[real, 0, NOT] F%s = z_s !! f_side.to_f2_trans[real, 0, NOT] F%z_color0 = z_z_color0 !! f_side.to_f2_trans[real, 0, NOT] F%z_color1 = z_z_color1 !! f_side.to_f2_trans[type, 0, NOT] call qp_line_to_f(z_line, c_loc(F%line)) !! f_side.to_f2_trans[type, 0, NOT] call qp_symbol_to_f(z_symbol, c_loc(F%symbol)) !! f_side.to_f2_trans[integer, 0, NOT] F%ix_universe = z_ix_universe !! f_side.to_f2_trans[integer, 0, NOT] F%symbol_every = z_symbol_every !! f_side.to_f2_trans[integer, 0, NOT] F%ix_branch = z_ix_branch !! f_side.to_f2_trans[integer, 0, NOT] F%ix_ele_ref = z_ix_ele_ref !! f_side.to_f2_trans[integer, 0, NOT] F%ix_ele_ref_track = z_ix_ele_ref_track !! f_side.to_f2_trans[integer, 0, NOT] F%ix_bunch = z_ix_bunch !! f_side.to_f2_trans[logical, 0, NOT] F%use_y2 = f_logic(z_use_y2) !! f_side.to_f2_trans[logical, 0, NOT] F%draw_line = f_logic(z_draw_line) !! f_side.to_f2_trans[logical, 0, NOT] F%draw_symbols = f_logic(z_draw_symbols) !! f_side.to_f2_trans[logical, 0, NOT] F%draw_symbol_index = f_logic(z_draw_symbol_index) !! f_side.to_f2_trans[logical, 0, NOT] F%smooth_line_calc = f_logic(z_smooth_line_calc) !! f_side.to_f2_trans[logical, 0, NOT] F%use_z_color = f_logic(z_use_z_color) !! f_side.to_f2_trans[logical, 0, NOT] F%autoscale_z_color = f_logic(z_autoscale_z_color) end subroutine tao_curve_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_graph_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_graph_struct to a C++ CPP_tao_graph structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_graph_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_graph struct. !- subroutine tao_graph_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_graph_to_c2 (C, z_name, z_type, z_title, z_title_suffix, z_text_legend, & z_component, z_why_invalid, z_floor_plan_view, z_floor_plan_orbit_color, z_curve, & n1_curve, z_p, n_p, z_text_legend_origin, z_curve_legend_origin, z_x, z_y, z_y2, & z_margin, z_scale_margin, z_x_axis_scale_factor, z_symbol_size_scale, & z_floor_plan_rotation, z_floor_plan_orbit_scale, z_box, z_ix_branch, z_ix_universe, & z_clip, z_valid, z_y2_mirrors_y, z_limited, z_draw_axes, z_correct_xy_distortion, & z_floor_plan_size_is_absolute, z_floor_plan_draw_only_first_pass, z_draw_curve_legend, & z_draw_grid, z_allow_wrap_around, z_draw_only_good_user_data_or_vars) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_name(*), z_type(*), z_title(*), z_title_suffix(*), z_component(*), z_why_invalid(*), z_floor_plan_view(*) character(c_char) :: z_floor_plan_orbit_color(*) integer(c_int) :: z_box(*), z_ix_branch, z_ix_universe type(c_ptr) :: z_text_legend(*), z_curve(*) integer(c_int), value :: n1_curve, n_p logical(c_bool) :: z_clip, z_valid, z_y2_mirrors_y, z_limited, z_draw_axes, z_correct_xy_distortion, z_floor_plan_size_is_absolute logical(c_bool) :: z_floor_plan_draw_only_first_pass, z_draw_curve_legend, z_draw_grid, z_allow_wrap_around, z_draw_only_good_user_data_or_vars real(c_double) :: z_x_axis_scale_factor, z_symbol_size_scale, z_floor_plan_rotation, z_floor_plan_orbit_scale type(c_ptr), value :: z_p, z_text_legend_origin, z_curve_legend_origin, z_x, z_y, z_y2, z_margin type(c_ptr), value :: z_scale_margin end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_graph_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var type(c_ptr) :: z_text_legend(10) character(100+1), target :: a_text_legend(10) type(c_ptr), allocatable :: z_curve(:) integer(c_int) :: n1_curve integer(c_int) :: n_p ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[character, 1, NOT] do jd1 = 1, size(F%text_legend,1); lb1 = lbound(F%text_legend,1) - 1 a_text_legend(jd1) = trim(F%text_legend(jd1+lb1)) // c_null_char z_text_legend(jd1) = c_loc(a_text_legend(jd1)) enddo !! f_side.to_c_trans[type, 1, ALLOC] n1_curve = 0 if (allocated(F%curve)) then n1_curve = size(F%curve); lb1 = lbound(F%curve, 1) - 1 allocate (z_curve(n1_curve)) do jd1 = 1, n1_curve z_curve(jd1) = c_loc(F%curve(jd1+lb1)) enddo endif !! f_side.to_c_trans[type, 0, PTR] n_p = 0 if (associated(F%p)) n_p = 1 !! f_side.to_c2_call call tao_graph_to_c2 (C, trim(F%name) // c_null_char, trim(F%type) // c_null_char, & trim(F%title) // c_null_char, trim(F%title_suffix) // c_null_char, z_text_legend, & trim(F%component) // c_null_char, trim(F%why_invalid) // c_null_char, & trim(F%floor_plan_view) // c_null_char, trim(F%floor_plan_orbit_color) // c_null_char, & z_curve, n1_curve, c_loc(F%p), n_p, c_loc(F%text_legend_origin), & c_loc(F%curve_legend_origin), c_loc(F%x), c_loc(F%y), c_loc(F%y2), c_loc(F%margin), & c_loc(F%scale_margin), F%x_axis_scale_factor, F%symbol_size_scale, F%floor_plan_rotation, & F%floor_plan_orbit_scale, fvec2vec(F%box, 4), F%ix_branch, F%ix_universe, c_logic(F%clip), & c_logic(F%valid), c_logic(F%y2_mirrors_y), c_logic(F%limited), c_logic(F%draw_axes), & c_logic(F%correct_xy_distortion), c_logic(F%floor_plan_size_is_absolute), & c_logic(F%floor_plan_draw_only_first_pass), c_logic(F%draw_curve_legend), & c_logic(F%draw_grid), c_logic(F%allow_wrap_around), & c_logic(F%draw_only_good_user_data_or_vars)) end subroutine tao_graph_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_graph_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_graph structure to a Tao tao_graph_struct structure. ! This routine is called by tao_graph_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_graph_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_graph_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_graph_to_f2 (Fp, z_name, z_type, z_title, z_title_suffix, z_text_legend, & z_component, z_why_invalid, z_floor_plan_view, z_floor_plan_orbit_color, z_curve, n1_curve, & z_p, n_p, z_text_legend_origin, z_curve_legend_origin, z_x, z_y, z_y2, z_margin, & z_scale_margin, z_x_axis_scale_factor, z_symbol_size_scale, z_floor_plan_rotation, & z_floor_plan_orbit_scale, z_box, z_ix_branch, z_ix_universe, z_clip, z_valid, & z_y2_mirrors_y, z_limited, z_draw_axes, z_correct_xy_distortion, & z_floor_plan_size_is_absolute, z_floor_plan_draw_only_first_pass, z_draw_curve_legend, & z_draw_grid, z_allow_wrap_around, z_draw_only_good_user_data_or_vars) bind(c) implicit none type(c_ptr), value :: Fp type(tao_graph_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_name(*), z_type(*), z_title(*), z_title_suffix(*), z_component(*), z_why_invalid(*), z_floor_plan_view(*) character(c_char) :: z_floor_plan_orbit_color(*) integer(c_int) :: z_box(*), z_ix_branch, z_ix_universe type(c_ptr) :: z_text_legend(*), z_curve(*) integer(c_int), value :: n1_curve, n_p logical(c_bool) :: z_clip, z_valid, z_y2_mirrors_y, z_limited, z_draw_axes, z_correct_xy_distortion, z_floor_plan_size_is_absolute logical(c_bool) :: z_floor_plan_draw_only_first_pass, z_draw_curve_legend, z_draw_grid, z_allow_wrap_around, z_draw_only_good_user_data_or_vars character(c_char), pointer :: f_text_legend type(tao_plot_struct), pointer :: f_p real(c_double) :: z_x_axis_scale_factor, z_symbol_size_scale, z_floor_plan_rotation, z_floor_plan_orbit_scale type(c_ptr), value :: z_p, z_text_legend_origin, z_curve_legend_origin, z_x, z_y, z_y2, z_margin type(c_ptr), value :: z_scale_margin call c_f_pointer (Fp, F) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_name, F%name) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_type, F%type) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_title, F%title) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_title_suffix, F%title_suffix) !! f_side.to_f2_trans[character, 1, NOT] do jd1 = 1, size(F%text_legend,1); lb1 = lbound(F%text_legend,1) - 1 call c_f_pointer (z_text_legend(jd1), f_text_legend) call to_f_str(f_text_legend, F%text_legend(jd1+lb1)) enddo !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_component, F%component) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_why_invalid, F%why_invalid) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_floor_plan_view, F%floor_plan_view) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_floor_plan_orbit_color, F%floor_plan_orbit_color) !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_curve == 0) then if (allocated(F%curve)) deallocate(F%curve) else if (allocated(F%curve)) then if (n1_curve == 0 .or. any(shape(F%curve) /= [n1_curve])) deallocate(F%curve) if (any(lbound(F%curve) /= 1)) deallocate(F%curve) endif if (.not. allocated(F%curve)) allocate(F%curve(1:n1_curve+1-1)) do jd1 = 1, n1_curve call tao_curve_to_f (z_curve(jd1), c_loc(F%curve(jd1+1-1))) enddo endif !! f_side.to_f2_trans[type, 0, PTR] if (n_p == 0) then if (associated(F%p)) deallocate(F%p) else if (.not. associated(F%p)) allocate(F%p) call tao_plot_to_f (z_p, c_loc(F%p)) endif !! f_side.to_f2_trans[type, 0, NOT] call qp_point_to_f(z_text_legend_origin, c_loc(F%text_legend_origin)) !! f_side.to_f2_trans[type, 0, NOT] call qp_point_to_f(z_curve_legend_origin, c_loc(F%curve_legend_origin)) !! f_side.to_f2_trans[type, 0, NOT] call qp_axis_to_f(z_x, c_loc(F%x)) !! f_side.to_f2_trans[type, 0, NOT] call qp_axis_to_f(z_y, c_loc(F%y)) !! f_side.to_f2_trans[type, 0, NOT] call qp_axis_to_f(z_y2, c_loc(F%y2)) !! f_side.to_f2_trans[type, 0, NOT] call qp_rect_to_f(z_margin, c_loc(F%margin)) !! f_side.to_f2_trans[type, 0, NOT] call qp_rect_to_f(z_scale_margin, c_loc(F%scale_margin)) !! f_side.to_f2_trans[real, 0, NOT] F%x_axis_scale_factor = z_x_axis_scale_factor !! f_side.to_f2_trans[real, 0, NOT] F%symbol_size_scale = z_symbol_size_scale !! f_side.to_f2_trans[real, 0, NOT] F%floor_plan_rotation = z_floor_plan_rotation !! f_side.to_f2_trans[real, 0, NOT] F%floor_plan_orbit_scale = z_floor_plan_orbit_scale !! f_side.to_f2_trans[integer, 1, NOT] F%box = z_box(1:4) !! f_side.to_f2_trans[integer, 0, NOT] F%ix_branch = z_ix_branch !! f_side.to_f2_trans[integer, 0, NOT] F%ix_universe = z_ix_universe !! f_side.to_f2_trans[logical, 0, NOT] F%clip = f_logic(z_clip) !! f_side.to_f2_trans[logical, 0, NOT] F%valid = f_logic(z_valid) !! f_side.to_f2_trans[logical, 0, NOT] F%y2_mirrors_y = f_logic(z_y2_mirrors_y) !! f_side.to_f2_trans[logical, 0, NOT] F%limited = f_logic(z_limited) !! f_side.to_f2_trans[logical, 0, NOT] F%draw_axes = f_logic(z_draw_axes) !! f_side.to_f2_trans[logical, 0, NOT] F%correct_xy_distortion = f_logic(z_correct_xy_distortion) !! f_side.to_f2_trans[logical, 0, NOT] F%floor_plan_size_is_absolute = f_logic(z_floor_plan_size_is_absolute) !! f_side.to_f2_trans[logical, 0, NOT] F%floor_plan_draw_only_first_pass = f_logic(z_floor_plan_draw_only_first_pass) !! f_side.to_f2_trans[logical, 0, NOT] F%draw_curve_legend = f_logic(z_draw_curve_legend) !! f_side.to_f2_trans[logical, 0, NOT] F%draw_grid = f_logic(z_draw_grid) !! f_side.to_f2_trans[logical, 0, NOT] F%allow_wrap_around = f_logic(z_allow_wrap_around) !! f_side.to_f2_trans[logical, 0, NOT] F%draw_only_good_user_data_or_vars = f_logic(z_draw_only_good_user_data_or_vars) end subroutine tao_graph_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_plot_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_plot_struct to a C++ CPP_tao_plot structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_plot_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_plot struct. !- subroutine tao_plot_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_plot_to_c2 (C, z_name, z_description, z_graph, n1_graph, z_x, z_r, n_r, & z_n_curve_pts, z_type, z_x_axis_type, z_autoscale_x, z_autoscale_y, z_autoscale_gang_x, & z_autoscale_gang_y, z_list_with_show_plot_command, z_phantom) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_name(*), z_description(*), z_type(*), z_x_axis_type(*) integer(c_int) :: z_n_curve_pts type(c_ptr) :: z_graph(*) integer(c_int), value :: n1_graph, n_r logical(c_bool) :: z_autoscale_x, z_autoscale_y, z_autoscale_gang_x, z_autoscale_gang_y, z_list_with_show_plot_command, z_phantom type(c_ptr), value :: z_x, z_r end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_plot_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var type(c_ptr), allocatable :: z_graph(:) integer(c_int) :: n1_graph integer(c_int) :: n_r ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 1, ALLOC] n1_graph = 0 if (allocated(F%graph)) then n1_graph = size(F%graph); lb1 = lbound(F%graph, 1) - 1 allocate (z_graph(n1_graph)) do jd1 = 1, n1_graph z_graph(jd1) = c_loc(F%graph(jd1+lb1)) enddo endif !! f_side.to_c_trans[type, 0, PTR] n_r = 0 if (associated(F%r)) n_r = 1 !! f_side.to_c2_call call tao_plot_to_c2 (C, trim(F%name) // c_null_char, trim(F%description) // c_null_char, & z_graph, n1_graph, c_loc(F%x), c_loc(F%r), n_r, F%n_curve_pts, trim(F%type) // c_null_char, & trim(F%x_axis_type) // c_null_char, c_logic(F%autoscale_x), c_logic(F%autoscale_y), & c_logic(F%autoscale_gang_x), c_logic(F%autoscale_gang_y), & c_logic(F%list_with_show_plot_command), c_logic(F%phantom)) end subroutine tao_plot_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_plot_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_plot structure to a Tao tao_plot_struct structure. ! This routine is called by tao_plot_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_plot_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_plot_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_plot_to_f2 (Fp, z_name, z_description, z_graph, n1_graph, z_x, z_r, n_r, & z_n_curve_pts, z_type, z_x_axis_type, z_autoscale_x, z_autoscale_y, z_autoscale_gang_x, & z_autoscale_gang_y, z_list_with_show_plot_command, z_phantom) bind(c) implicit none type(c_ptr), value :: Fp type(tao_plot_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_name(*), z_description(*), z_type(*), z_x_axis_type(*) integer(c_int) :: z_n_curve_pts type(c_ptr) :: z_graph(*) integer(c_int), value :: n1_graph, n_r type(tao_plot_region_struct), pointer :: f_r logical(c_bool) :: z_autoscale_x, z_autoscale_y, z_autoscale_gang_x, z_autoscale_gang_y, z_list_with_show_plot_command, z_phantom type(c_ptr), value :: z_x, z_r call c_f_pointer (Fp, F) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_name, F%name) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_description, F%description) !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_graph == 0) then if (allocated(F%graph)) deallocate(F%graph) else if (allocated(F%graph)) then if (n1_graph == 0 .or. any(shape(F%graph) /= [n1_graph])) deallocate(F%graph) if (any(lbound(F%graph) /= 1)) deallocate(F%graph) endif if (.not. allocated(F%graph)) allocate(F%graph(1:n1_graph+1-1)) do jd1 = 1, n1_graph call tao_graph_to_f (z_graph(jd1), c_loc(F%graph(jd1+1-1))) enddo endif !! f_side.to_f2_trans[type, 0, NOT] call qp_axis_to_f(z_x, c_loc(F%x)) !! f_side.to_f2_trans[type, 0, PTR] if (n_r == 0) then if (associated(F%r)) deallocate(F%r) else if (.not. associated(F%r)) allocate(F%r) call tao_plot_region_to_f (z_r, c_loc(F%r)) endif !! f_side.to_f2_trans[integer, 0, NOT] F%n_curve_pts = z_n_curve_pts !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_type, F%type) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_x_axis_type, F%x_axis_type) !! f_side.to_f2_trans[logical, 0, NOT] F%autoscale_x = f_logic(z_autoscale_x) !! f_side.to_f2_trans[logical, 0, NOT] F%autoscale_y = f_logic(z_autoscale_y) !! f_side.to_f2_trans[logical, 0, NOT] F%autoscale_gang_x = f_logic(z_autoscale_gang_x) !! f_side.to_f2_trans[logical, 0, NOT] F%autoscale_gang_y = f_logic(z_autoscale_gang_y) !! f_side.to_f2_trans[logical, 0, NOT] F%list_with_show_plot_command = f_logic(z_list_with_show_plot_command) !! f_side.to_f2_trans[logical, 0, NOT] F%phantom = f_logic(z_phantom) end subroutine tao_plot_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_plot_region_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_plot_region_struct to a C++ CPP_tao_plot_region structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_plot_region_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_plot_region struct. !- subroutine tao_plot_region_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_plot_region_to_c2 (C, z_name, z_plot, z_location, z_visible, & z_list_with_show_plot_command) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_name(*) logical(c_bool) :: z_visible, z_list_with_show_plot_command real(c_double) :: z_location(*) type(c_ptr), value :: z_plot end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_plot_region_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call tao_plot_region_to_c2 (C, trim(F%name) // c_null_char, c_loc(F%plot), fvec2vec(F%location, & 4), c_logic(F%visible), c_logic(F%list_with_show_plot_command)) end subroutine tao_plot_region_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_plot_region_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_plot_region structure to a Tao tao_plot_region_struct structure. ! This routine is called by tao_plot_region_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_plot_region_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_plot_region_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_plot_region_to_f2 (Fp, z_name, z_plot, z_location, z_visible, & z_list_with_show_plot_command) bind(c) implicit none type(c_ptr), value :: Fp type(tao_plot_region_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_name(*) logical(c_bool) :: z_visible, z_list_with_show_plot_command real(c_double) :: z_location(*) type(c_ptr), value :: z_plot call c_f_pointer (Fp, F) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_name, F%name) !! f_side.to_f2_trans[type, 0, NOT] call tao_plot_to_f(z_plot, c_loc(F%plot)) !! f_side.to_f2_trans[real, 1, NOT] F%location = z_location(1:4) !! f_side.to_f2_trans[logical, 0, NOT] F%visible = f_logic(z_visible) !! f_side.to_f2_trans[logical, 0, NOT] F%list_with_show_plot_command = f_logic(z_list_with_show_plot_command) end subroutine tao_plot_region_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_plot_page_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_plot_page_struct to a C++ CPP_tao_plot_page structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_plot_page_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_plot_page struct. !- subroutine tao_plot_page_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_plot_page_to_c2 (C, z_title, z_border, z_floor_plan, z_lat_layout, z_pattern, & n1_pattern, z_template, n1_template, z_region, n1_region, z_plot_display_type, & z_ps_scale, z_size, z_text_height, z_main_title_text_scale, z_graph_title_text_scale, & z_axis_number_text_scale, z_axis_label_text_scale, z_legend_text_scale, & z_key_table_text_scale, z_curve_legend_line_len, z_curve_legend_text_offset, & z_floor_plan_shape_scale, z_lat_layout_shape_scale, z_n_curve_pts, z_id_window, & z_delete_overlapping_plots) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_plot_display_type(*), z_ps_scale(*) integer(c_int) :: z_n_curve_pts, z_id_window type(c_ptr) :: z_title(*), z_pattern(*), z_template(*), z_region(*) integer(c_int), value :: n1_pattern, n1_template, n1_region logical(c_bool) :: z_delete_overlapping_plots real(c_double) :: z_size(*), z_text_height, z_main_title_text_scale, z_graph_title_text_scale, z_axis_number_text_scale, z_axis_label_text_scale, z_legend_text_scale real(c_double) :: z_key_table_text_scale, z_curve_legend_line_len, z_curve_legend_text_offset, z_floor_plan_shape_scale, z_lat_layout_shape_scale type(c_ptr), value :: z_border, z_floor_plan, z_lat_layout end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_plot_page_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var type(c_ptr) :: z_title(2) type(c_ptr), allocatable :: z_pattern(:) integer(c_int) :: n1_pattern type(c_ptr), allocatable :: z_template(:) integer(c_int) :: n1_template type(c_ptr), allocatable :: z_region(:) integer(c_int) :: n1_region ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 1, NOT] do jd1 = 1, size(F%title,1); lb1 = lbound(F%title,1) - 1 z_title(jd1) = c_loc(F%title(jd1+lb1)) enddo !! f_side.to_c_trans[type, 1, ALLOC] n1_pattern = 0 if (allocated(F%pattern)) then n1_pattern = size(F%pattern); lb1 = lbound(F%pattern, 1) - 1 allocate (z_pattern(n1_pattern)) do jd1 = 1, n1_pattern z_pattern(jd1) = c_loc(F%pattern(jd1+lb1)) enddo endif !! f_side.to_c_trans[type, 1, ALLOC] n1_template = 0 if (allocated(F%template)) then n1_template = size(F%template); lb1 = lbound(F%template, 1) - 1 allocate (z_template(n1_template)) do jd1 = 1, n1_template z_template(jd1) = c_loc(F%template(jd1+lb1)) enddo endif !! f_side.to_c_trans[type, 1, ALLOC] n1_region = 0 if (allocated(F%region)) then n1_region = size(F%region); lb1 = lbound(F%region, 1) - 1 allocate (z_region(n1_region)) do jd1 = 1, n1_region z_region(jd1) = c_loc(F%region(jd1+lb1)) enddo endif !! f_side.to_c2_call call tao_plot_page_to_c2 (C, z_title, c_loc(F%border), c_loc(F%floor_plan), & c_loc(F%lat_layout), z_pattern, n1_pattern, z_template, n1_template, z_region, n1_region, & trim(F%plot_display_type) // c_null_char, trim(F%ps_scale) // c_null_char, fvec2vec(F%size, & 2), F%text_height, F%main_title_text_scale, F%graph_title_text_scale, & F%axis_number_text_scale, F%axis_label_text_scale, F%legend_text_scale, & F%key_table_text_scale, F%curve_legend_line_len, F%curve_legend_text_offset, & F%floor_plan_shape_scale, F%lat_layout_shape_scale, F%n_curve_pts, F%id_window, & c_logic(F%delete_overlapping_plots)) end subroutine tao_plot_page_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_plot_page_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_plot_page structure to a Tao tao_plot_page_struct structure. ! This routine is called by tao_plot_page_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_plot_page_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_plot_page_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_plot_page_to_f2 (Fp, z_title, z_border, z_floor_plan, z_lat_layout, z_pattern, & n1_pattern, z_template, n1_template, z_region, n1_region, z_plot_display_type, z_ps_scale, & z_size, z_text_height, z_main_title_text_scale, z_graph_title_text_scale, & z_axis_number_text_scale, z_axis_label_text_scale, z_legend_text_scale, & z_key_table_text_scale, z_curve_legend_line_len, z_curve_legend_text_offset, & z_floor_plan_shape_scale, z_lat_layout_shape_scale, z_n_curve_pts, z_id_window, & z_delete_overlapping_plots) bind(c) implicit none type(c_ptr), value :: Fp type(tao_plot_page_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_plot_display_type(*), z_ps_scale(*) integer(c_int) :: z_n_curve_pts, z_id_window type(c_ptr) :: z_title(*), z_pattern(*), z_template(*), z_region(*) integer(c_int), value :: n1_pattern, n1_template, n1_region logical(c_bool) :: z_delete_overlapping_plots real(c_double) :: z_size(*), z_text_height, z_main_title_text_scale, z_graph_title_text_scale, z_axis_number_text_scale, z_axis_label_text_scale, z_legend_text_scale real(c_double) :: z_key_table_text_scale, z_curve_legend_line_len, z_curve_legend_text_offset, z_floor_plan_shape_scale, z_lat_layout_shape_scale type(c_ptr), value :: z_border, z_floor_plan, z_lat_layout call c_f_pointer (Fp, F) !! f_side.to_f2_trans[type, 1, NOT] do jd1 = 1, size(F%title,1); lb1 = lbound(F%title,1) - 1 call tao_title_to_f(z_title(jd1), c_loc(F%title(jd1+lb1))) enddo !! f_side.to_f2_trans[type, 0, NOT] call qp_rect_to_f(z_border, c_loc(F%border)) !! f_side.to_f2_trans[type, 0, NOT] call tao_drawing_to_f(z_floor_plan, c_loc(F%floor_plan)) !! f_side.to_f2_trans[type, 0, NOT] call tao_drawing_to_f(z_lat_layout, c_loc(F%lat_layout)) !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_pattern == 0) then if (allocated(F%pattern)) deallocate(F%pattern) else if (allocated(F%pattern)) then if (n1_pattern == 0 .or. any(shape(F%pattern) /= [n1_pattern])) deallocate(F%pattern) if (any(lbound(F%pattern) /= 1)) deallocate(F%pattern) endif if (.not. allocated(F%pattern)) allocate(F%pattern(1:n1_pattern+1-1)) do jd1 = 1, n1_pattern call tao_shape_pattern_to_f (z_pattern(jd1), c_loc(F%pattern(jd1+1-1))) enddo endif !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_template == 0) then if (allocated(F%template)) deallocate(F%template) else if (allocated(F%template)) then if (n1_template == 0 .or. any(shape(F%template) /= [n1_template])) deallocate(F%template) if (any(lbound(F%template) /= 1)) deallocate(F%template) endif if (.not. allocated(F%template)) allocate(F%template(1:n1_template+1-1)) do jd1 = 1, n1_template call tao_plot_to_f (z_template(jd1), c_loc(F%template(jd1+1-1))) enddo endif !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_region == 0) then if (allocated(F%region)) deallocate(F%region) else if (allocated(F%region)) then if (n1_region == 0 .or. any(shape(F%region) /= [n1_region])) deallocate(F%region) if (any(lbound(F%region) /= 1)) deallocate(F%region) endif if (.not. allocated(F%region)) allocate(F%region(1:n1_region+1-1)) do jd1 = 1, n1_region call tao_plot_region_to_f (z_region(jd1), c_loc(F%region(jd1+1-1))) enddo endif !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_plot_display_type, F%plot_display_type) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_ps_scale, F%ps_scale) !! f_side.to_f2_trans[real, 1, NOT] F%size = z_size(1:2) !! f_side.to_f2_trans[real, 0, NOT] F%text_height = z_text_height !! f_side.to_f2_trans[real, 0, NOT] F%main_title_text_scale = z_main_title_text_scale !! f_side.to_f2_trans[real, 0, NOT] F%graph_title_text_scale = z_graph_title_text_scale !! f_side.to_f2_trans[real, 0, NOT] F%axis_number_text_scale = z_axis_number_text_scale !! f_side.to_f2_trans[real, 0, NOT] F%axis_label_text_scale = z_axis_label_text_scale !! f_side.to_f2_trans[real, 0, NOT] F%legend_text_scale = z_legend_text_scale !! f_side.to_f2_trans[real, 0, NOT] F%key_table_text_scale = z_key_table_text_scale !! f_side.to_f2_trans[real, 0, NOT] F%curve_legend_line_len = z_curve_legend_line_len !! f_side.to_f2_trans[real, 0, NOT] F%curve_legend_text_offset = z_curve_legend_text_offset !! f_side.to_f2_trans[real, 0, NOT] F%floor_plan_shape_scale = z_floor_plan_shape_scale !! f_side.to_f2_trans[real, 0, NOT] F%lat_layout_shape_scale = z_lat_layout_shape_scale !! f_side.to_f2_trans[integer, 0, NOT] F%n_curve_pts = z_n_curve_pts !! f_side.to_f2_trans[integer, 0, NOT] F%id_window = z_id_window !! f_side.to_f2_trans[logical, 0, NOT] F%delete_overlapping_plots = f_logic(z_delete_overlapping_plots) end subroutine tao_plot_page_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_plot_array_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_plot_array_struct to a C++ CPP_tao_plot_array structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_plot_array_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_plot_array struct. !- subroutine tao_plot_array_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_plot_array_to_c2 (C, z_p, n_p) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C integer(c_int), value :: n_p type(c_ptr), value :: z_p end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_plot_array_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var integer(c_int) :: n_p ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 0, PTR] n_p = 0 if (associated(F%p)) n_p = 1 !! f_side.to_c2_call call tao_plot_array_to_c2 (C, c_loc(F%p), n_p) end subroutine tao_plot_array_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_plot_array_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_plot_array structure to a Tao tao_plot_array_struct structure. ! This routine is called by tao_plot_array_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_plot_array_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_plot_array_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_plot_array_to_f2 (Fp, z_p, n_p) bind(c) implicit none type(c_ptr), value :: Fp type(tao_plot_array_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name type(tao_plot_struct), pointer :: f_p integer(c_int), value :: n_p type(c_ptr), value :: z_p call c_f_pointer (Fp, F) !! f_side.to_f2_trans[type, 0, PTR] if (n_p == 0) then if (associated(F%p)) deallocate(F%p) else if (.not. associated(F%p)) allocate(F%p) call tao_plot_to_f (z_p, c_loc(F%p)) endif end subroutine tao_plot_array_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_graph_array_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_graph_array_struct to a C++ CPP_tao_graph_array structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_graph_array_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_graph_array struct. !- subroutine tao_graph_array_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_graph_array_to_c2 (C, z_g, n_g) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C integer(c_int), value :: n_g type(c_ptr), value :: z_g end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_graph_array_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var integer(c_int) :: n_g ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 0, PTR] n_g = 0 if (associated(F%g)) n_g = 1 !! f_side.to_c2_call call tao_graph_array_to_c2 (C, c_loc(F%g), n_g) end subroutine tao_graph_array_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_graph_array_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_graph_array structure to a Tao tao_graph_array_struct structure. ! This routine is called by tao_graph_array_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_graph_array_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_graph_array_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_graph_array_to_f2 (Fp, z_g, n_g) bind(c) implicit none type(c_ptr), value :: Fp type(tao_graph_array_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name type(tao_graph_struct), pointer :: f_g integer(c_int), value :: n_g type(c_ptr), value :: z_g call c_f_pointer (Fp, F) !! f_side.to_f2_trans[type, 0, PTR] if (n_g == 0) then if (associated(F%g)) deallocate(F%g) else if (.not. associated(F%g)) allocate(F%g) call tao_graph_to_f (z_g, c_loc(F%g)) endif end subroutine tao_graph_array_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_curve_array_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_curve_array_struct to a C++ CPP_tao_curve_array structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_curve_array_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_curve_array struct. !- subroutine tao_curve_array_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_curve_array_to_c2 (C, z_c, n_c) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C integer(c_int), value :: n_c type(c_ptr), value :: z_c end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_curve_array_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var integer(c_int) :: n_c ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 0, PTR] n_c = 0 if (associated(F%c)) n_c = 1 !! f_side.to_c2_call call tao_curve_array_to_c2 (C, c_loc(F%c), n_c) end subroutine tao_curve_array_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_curve_array_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_curve_array structure to a Tao tao_curve_array_struct structure. ! This routine is called by tao_curve_array_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_curve_array_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_curve_array_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_curve_array_to_f2 (Fp, z_c, n_c) bind(c) implicit none type(c_ptr), value :: Fp type(tao_curve_array_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name type(tao_curve_struct), pointer :: f_c integer(c_int), value :: n_c type(c_ptr), value :: z_c call c_f_pointer (Fp, F) !! f_side.to_f2_trans[type, 0, PTR] if (n_c == 0) then if (associated(F%c)) deallocate(F%c) else if (.not. associated(F%c)) allocate(F%c) call tao_curve_to_f (z_c, c_loc(F%c)) endif end subroutine tao_curve_array_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_data_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_data_struct to a C++ CPP_tao_data structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_data_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_data struct. !- subroutine tao_data_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_data_to_c2 (C, z_ele_name, z_ele_start_name, z_ele_ref_name, z_data_type, & z_merit_type, z_data_source, z_ix_bunch, z_ix_branch, z_ix_ele, z_ix_ele_start, & z_ix_ele_ref, z_ix_ele_merit, z_ix_d1, z_ix_data, z_ix_dmodel, z_eval_point, & z_meas_value, z_ref_value, z_model_value, z_design_value, z_old_value, z_base_value, & z_delta_merit, z_weight, z_invalid_value, z_merit, z_s, z_s_offset, z_exists, & z_good_model, z_good_base, z_good_design, z_good_meas, z_good_ref, z_good_user, & z_good_opt, z_good_plot, z_useit_plot, z_useit_opt, z_d1, n_d1, z_stack, n1_stack) & bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_ele_name(*), z_ele_start_name(*), z_ele_ref_name(*), z_data_type(*), z_merit_type(*), z_data_source(*) integer(c_int) :: z_ix_bunch, z_ix_branch, z_ix_ele, z_ix_ele_start, z_ix_ele_ref, z_ix_ele_merit, z_ix_d1 integer(c_int) :: z_ix_data, z_ix_dmodel, z_eval_point type(c_ptr) :: z_stack(*) integer(c_int), value :: n_d1, n1_stack logical(c_bool) :: z_exists, z_good_model, z_good_base, z_good_design, z_good_meas, z_good_ref, z_good_user logical(c_bool) :: z_good_opt, z_good_plot, z_useit_plot, z_useit_opt real(c_double) :: z_meas_value, z_ref_value, z_model_value, z_design_value, z_old_value, z_base_value, z_delta_merit real(c_double) :: z_weight, z_invalid_value, z_merit, z_s, z_s_offset type(c_ptr), value :: z_d1 end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_data_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var integer(c_int) :: n_d1 type(c_ptr), allocatable :: z_stack(:) integer(c_int) :: n1_stack ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 0, PTR] n_d1 = 0 if (associated(F%d1)) n_d1 = 1 !! f_side.to_c_trans[type, 1, ALLOC] n1_stack = 0 if (allocated(F%stack)) then n1_stack = size(F%stack); lb1 = lbound(F%stack, 1) - 1 allocate (z_stack(n1_stack)) do jd1 = 1, n1_stack z_stack(jd1) = c_loc(F%stack(jd1+lb1)) enddo endif !! f_side.to_c2_call call tao_data_to_c2 (C, trim(F%ele_name) // c_null_char, trim(F%ele_start_name) // c_null_char, & trim(F%ele_ref_name) // c_null_char, trim(F%data_type) // c_null_char, trim(F%merit_type) & // c_null_char, trim(F%data_source) // c_null_char, F%ix_bunch, F%ix_branch, F%ix_ele, & F%ix_ele_start, F%ix_ele_ref, F%ix_ele_merit, F%ix_d1, F%ix_data, F%ix_dmodel, & F%eval_point, F%meas_value, F%ref_value, F%model_value, F%design_value, F%old_value, & F%base_value, F%delta_merit, F%weight, F%invalid_value, F%merit, F%s, F%s_offset, & c_logic(F%exists), c_logic(F%good_model), c_logic(F%good_base), c_logic(F%good_design), & c_logic(F%good_meas), c_logic(F%good_ref), c_logic(F%good_user), c_logic(F%good_opt), & c_logic(F%good_plot), c_logic(F%useit_plot), c_logic(F%useit_opt), c_loc(F%d1), n_d1, & z_stack, n1_stack) end subroutine tao_data_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_data_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_data structure to a Tao tao_data_struct structure. ! This routine is called by tao_data_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_data_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_data_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_data_to_f2 (Fp, z_ele_name, z_ele_start_name, z_ele_ref_name, z_data_type, & z_merit_type, z_data_source, z_ix_bunch, z_ix_branch, z_ix_ele, z_ix_ele_start, & z_ix_ele_ref, z_ix_ele_merit, z_ix_d1, z_ix_data, z_ix_dmodel, z_eval_point, z_meas_value, & z_ref_value, z_model_value, z_design_value, z_old_value, z_base_value, z_delta_merit, & z_weight, z_invalid_value, z_merit, z_s, z_s_offset, z_exists, z_good_model, z_good_base, & z_good_design, z_good_meas, z_good_ref, z_good_user, z_good_opt, z_good_plot, z_useit_plot, & z_useit_opt, z_d1, n_d1, z_stack, n1_stack) bind(c) implicit none type(c_ptr), value :: Fp type(tao_data_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_ele_name(*), z_ele_start_name(*), z_ele_ref_name(*), z_data_type(*), z_merit_type(*), z_data_source(*) integer(c_int) :: z_ix_bunch, z_ix_branch, z_ix_ele, z_ix_ele_start, z_ix_ele_ref, z_ix_ele_merit, z_ix_d1 integer(c_int) :: z_ix_data, z_ix_dmodel, z_eval_point type(tao_d1_data_struct), pointer :: f_d1 type(c_ptr) :: z_stack(*) integer(c_int), value :: n_d1, n1_stack logical(c_bool) :: z_exists, z_good_model, z_good_base, z_good_design, z_good_meas, z_good_ref, z_good_user logical(c_bool) :: z_good_opt, z_good_plot, z_useit_plot, z_useit_opt real(c_double) :: z_meas_value, z_ref_value, z_model_value, z_design_value, z_old_value, z_base_value, z_delta_merit real(c_double) :: z_weight, z_invalid_value, z_merit, z_s, z_s_offset type(c_ptr), value :: z_d1 call c_f_pointer (Fp, F) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_ele_name, F%ele_name) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_ele_start_name, F%ele_start_name) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_ele_ref_name, F%ele_ref_name) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_data_type, F%data_type) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_merit_type, F%merit_type) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_data_source, F%data_source) !! f_side.to_f2_trans[integer, 0, NOT] F%ix_bunch = z_ix_bunch !! f_side.to_f2_trans[integer, 0, NOT] F%ix_branch = z_ix_branch !! f_side.to_f2_trans[integer, 0, NOT] F%ix_ele = z_ix_ele !! f_side.to_f2_trans[integer, 0, NOT] F%ix_ele_start = z_ix_ele_start !! f_side.to_f2_trans[integer, 0, NOT] F%ix_ele_ref = z_ix_ele_ref !! f_side.to_f2_trans[integer, 0, NOT] F%ix_ele_merit = z_ix_ele_merit !! f_side.to_f2_trans[integer, 0, NOT] F%ix_d1 = z_ix_d1 !! f_side.to_f2_trans[integer, 0, NOT] F%ix_data = z_ix_data !! f_side.to_f2_trans[integer, 0, NOT] F%ix_dmodel = z_ix_dmodel !! f_side.to_f2_trans[integer, 0, NOT] F%eval_point = z_eval_point !! f_side.to_f2_trans[real, 0, NOT] F%meas_value = z_meas_value !! f_side.to_f2_trans[real, 0, NOT] F%ref_value = z_ref_value !! f_side.to_f2_trans[real, 0, NOT] F%model_value = z_model_value !! f_side.to_f2_trans[real, 0, NOT] F%design_value = z_design_value !! f_side.to_f2_trans[real, 0, NOT] F%old_value = z_old_value !! f_side.to_f2_trans[real, 0, NOT] F%base_value = z_base_value !! f_side.to_f2_trans[real, 0, NOT] F%delta_merit = z_delta_merit !! f_side.to_f2_trans[real, 0, NOT] F%weight = z_weight !! f_side.to_f2_trans[real, 0, NOT] F%invalid_value = z_invalid_value !! f_side.to_f2_trans[real, 0, NOT] F%merit = z_merit !! f_side.to_f2_trans[real, 0, NOT] F%s = z_s !! f_side.to_f2_trans[real, 0, NOT] F%s_offset = z_s_offset !! f_side.to_f2_trans[logical, 0, NOT] F%exists = f_logic(z_exists) !! f_side.to_f2_trans[logical, 0, NOT] F%good_model = f_logic(z_good_model) !! f_side.to_f2_trans[logical, 0, NOT] F%good_base = f_logic(z_good_base) !! f_side.to_f2_trans[logical, 0, NOT] F%good_design = f_logic(z_good_design) !! f_side.to_f2_trans[logical, 0, NOT] F%good_meas = f_logic(z_good_meas) !! f_side.to_f2_trans[logical, 0, NOT] F%good_ref = f_logic(z_good_ref) !! f_side.to_f2_trans[logical, 0, NOT] F%good_user = f_logic(z_good_user) !! f_side.to_f2_trans[logical, 0, NOT] F%good_opt = f_logic(z_good_opt) !! f_side.to_f2_trans[logical, 0, NOT] F%good_plot = f_logic(z_good_plot) !! f_side.to_f2_trans[logical, 0, NOT] F%useit_plot = f_logic(z_useit_plot) !! f_side.to_f2_trans[logical, 0, NOT] F%useit_opt = f_logic(z_useit_opt) !! f_side.to_f2_trans[type, 0, PTR] if (n_d1 == 0) then if (associated(F%d1)) deallocate(F%d1) else if (.not. associated(F%d1)) allocate(F%d1) call tao_d1_data_to_f (z_d1, c_loc(F%d1)) endif !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_stack == 0) then if (allocated(F%stack)) deallocate(F%stack) else if (allocated(F%stack)) then if (n1_stack == 0 .or. any(shape(F%stack) /= [n1_stack])) deallocate(F%stack) if (any(lbound(F%stack) /= 1)) deallocate(F%stack) endif if (.not. allocated(F%stack)) allocate(F%stack(1:n1_stack+1-1)) do jd1 = 1, n1_stack call tao_eval_stack1_to_f (z_stack(jd1), c_loc(F%stack(jd1+1-1))) enddo endif end subroutine tao_data_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_d1_data_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_d1_data_struct to a C++ CPP_tao_d1_data structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_d1_data_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_d1_data struct. !- subroutine tao_d1_data_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_d1_data_to_c2 (C, z_name, z_d2, n_d2, z_d, n1_d) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_name(*) type(c_ptr) :: z_d(*) integer(c_int), value :: n_d2, n1_d type(c_ptr), value :: z_d2 end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_d1_data_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var integer(c_int) :: n_d2 type(c_ptr), allocatable :: z_d(:) integer(c_int) :: n1_d ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 0, PTR] n_d2 = 0 if (associated(F%d2)) n_d2 = 1 !! f_side.to_c_trans[type, 1, PTR] n1_d = 0 if (associated(F%d)) then n1_d = size(F%d); lb1 = lbound(F%d, 1) - 1 allocate (z_d(n1_d)) do jd1 = 1, n1_d z_d(jd1) = c_loc(F%d(jd1+lb1)) enddo endif !! f_side.to_c2_call call tao_d1_data_to_c2 (C, trim(F%name) // c_null_char, c_loc(F%d2), n_d2, z_d, n1_d) end subroutine tao_d1_data_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_d1_data_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_d1_data structure to a Tao tao_d1_data_struct structure. ! This routine is called by tao_d1_data_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_d1_data_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_d1_data_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_d1_data_to_f2 (Fp, z_name, z_d2, n_d2, z_d, n1_d) bind(c) implicit none type(c_ptr), value :: Fp type(tao_d1_data_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_name(*) type(tao_d2_data_struct), pointer :: f_d2 type(c_ptr) :: z_d(*) integer(c_int), value :: n_d2, n1_d type(c_ptr), value :: z_d2 call c_f_pointer (Fp, F) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_name, F%name) !! f_side.to_f2_trans[type, 0, PTR] if (n_d2 == 0) then if (associated(F%d2)) deallocate(F%d2) else if (.not. associated(F%d2)) allocate(F%d2) call tao_d2_data_to_f (z_d2, c_loc(F%d2)) endif !! f_side.to_f2_trans[type, 1, PTR] if (n1_d == 0) then if (associated(F%d)) deallocate(F%d) else if (associated(F%d)) then if (n1_d == 0 .or. any(shape(F%d) /= [n1_d])) deallocate(F%d) if (any(lbound(F%d) /= 1)) deallocate(F%d) endif if (.not. associated(F%d)) allocate(F%d(1:n1_d+1-1)) do jd1 = 1, n1_d call tao_data_to_f (z_d(jd1), c_loc(F%d(jd1+1-1))) enddo endif end subroutine tao_d1_data_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_d2_data_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_d2_data_struct to a C++ CPP_tao_d2_data structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_d2_data_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_d2_data struct. !- subroutine tao_d2_data_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_d2_data_to_c2 (C, z_name, z_data_file_name, z_ref_file_name, z_data_date, & z_ref_date, z_descrip, z_d1, n1_d1, z_ix_uni, z_ix_d2_data, z_ix_data, z_ix_ref, & z_data_read_in, z_ref_read_in) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_name(*), z_data_file_name(*), z_ref_file_name(*), z_data_date(*), z_ref_date(*) integer(c_int) :: z_ix_uni, z_ix_d2_data, z_ix_data, z_ix_ref type(c_ptr) :: z_descrip(*), z_d1(*) integer(c_int), value :: n1_d1 logical(c_bool) :: z_data_read_in, z_ref_read_in end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_d2_data_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var type(c_ptr) :: z_descrip(10) character(80+1), target :: a_descrip(10) type(c_ptr), allocatable :: z_d1(:) integer(c_int) :: n1_d1 ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[character, 1, NOT] do jd1 = 1, size(F%descrip,1); lb1 = lbound(F%descrip,1) - 1 a_descrip(jd1) = trim(F%descrip(jd1+lb1)) // c_null_char z_descrip(jd1) = c_loc(a_descrip(jd1)) enddo !! f_side.to_c_trans[type, 1, ALLOC] n1_d1 = 0 if (allocated(F%d1)) then n1_d1 = size(F%d1); lb1 = lbound(F%d1, 1) - 1 allocate (z_d1(n1_d1)) do jd1 = 1, n1_d1 z_d1(jd1) = c_loc(F%d1(jd1+lb1)) enddo endif !! f_side.to_c2_call call tao_d2_data_to_c2 (C, trim(F%name) // c_null_char, trim(F%data_file_name) // c_null_char, & trim(F%ref_file_name) // c_null_char, trim(F%data_date) // c_null_char, trim(F%ref_date) // & c_null_char, z_descrip, z_d1, n1_d1, F%ix_uni, F%ix_d2_data, F%ix_data, F%ix_ref, & c_logic(F%data_read_in), c_logic(F%ref_read_in)) end subroutine tao_d2_data_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_d2_data_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_d2_data structure to a Tao tao_d2_data_struct structure. ! This routine is called by tao_d2_data_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_d2_data_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_d2_data_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_d2_data_to_f2 (Fp, z_name, z_data_file_name, z_ref_file_name, z_data_date, & z_ref_date, z_descrip, z_d1, n1_d1, z_ix_uni, z_ix_d2_data, z_ix_data, z_ix_ref, & z_data_read_in, z_ref_read_in) bind(c) implicit none type(c_ptr), value :: Fp type(tao_d2_data_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_name(*), z_data_file_name(*), z_ref_file_name(*), z_data_date(*), z_ref_date(*) integer(c_int) :: z_ix_uni, z_ix_d2_data, z_ix_data, z_ix_ref type(c_ptr) :: z_descrip(*), z_d1(*) integer(c_int), value :: n1_d1 character(c_char), pointer :: f_descrip logical(c_bool) :: z_data_read_in, z_ref_read_in call c_f_pointer (Fp, F) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_name, F%name) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_data_file_name, F%data_file_name) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_ref_file_name, F%ref_file_name) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_data_date, F%data_date) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_ref_date, F%ref_date) !! f_side.to_f2_trans[character, 1, NOT] do jd1 = 1, size(F%descrip,1); lb1 = lbound(F%descrip,1) - 1 call c_f_pointer (z_descrip(jd1), f_descrip) call to_f_str(f_descrip, F%descrip(jd1+lb1)) enddo !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_d1 == 0) then if (allocated(F%d1)) deallocate(F%d1) else if (allocated(F%d1)) then if (n1_d1 == 0 .or. any(shape(F%d1) /= [n1_d1])) deallocate(F%d1) if (any(lbound(F%d1) /= 1)) deallocate(F%d1) endif if (.not. allocated(F%d1)) allocate(F%d1(1:n1_d1+1-1)) do jd1 = 1, n1_d1 call tao_d1_data_to_f (z_d1(jd1), c_loc(F%d1(jd1+1-1))) enddo endif !! f_side.to_f2_trans[integer, 0, NOT] F%ix_uni = z_ix_uni !! f_side.to_f2_trans[integer, 0, NOT] F%ix_d2_data = z_ix_d2_data !! f_side.to_f2_trans[integer, 0, NOT] F%ix_data = z_ix_data !! f_side.to_f2_trans[integer, 0, NOT] F%ix_ref = z_ix_ref !! f_side.to_f2_trans[logical, 0, NOT] F%data_read_in = f_logic(z_data_read_in) !! f_side.to_f2_trans[logical, 0, NOT] F%ref_read_in = f_logic(z_ref_read_in) end subroutine tao_d2_data_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_data_array_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_data_array_struct to a C++ CPP_tao_data_array structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_data_array_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_data_array struct. !- subroutine tao_data_array_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_data_array_to_c2 (C, z_d, n_d) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C integer(c_int), value :: n_d type(c_ptr), value :: z_d end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_data_array_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var integer(c_int) :: n_d ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 0, PTR] n_d = 0 if (associated(F%d)) n_d = 1 !! f_side.to_c2_call call tao_data_array_to_c2 (C, c_loc(F%d), n_d) end subroutine tao_data_array_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_data_array_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_data_array structure to a Tao tao_data_array_struct structure. ! This routine is called by tao_data_array_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_data_array_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_data_array_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_data_array_to_f2 (Fp, z_d, n_d) bind(c) implicit none type(c_ptr), value :: Fp type(tao_data_array_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name type(tao_data_struct), pointer :: f_d integer(c_int), value :: n_d type(c_ptr), value :: z_d call c_f_pointer (Fp, F) !! f_side.to_f2_trans[type, 0, PTR] if (n_d == 0) then if (associated(F%d)) deallocate(F%d) else if (.not. associated(F%d)) allocate(F%d) call tao_data_to_f (z_d, c_loc(F%d)) endif end subroutine tao_data_array_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_d1_data_array_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_d1_data_array_struct to a C++ CPP_tao_d1_data_array structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_d1_data_array_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_d1_data_array struct. !- subroutine tao_d1_data_array_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_d1_data_array_to_c2 (C, z_d1, n_d1) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C integer(c_int), value :: n_d1 type(c_ptr), value :: z_d1 end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_d1_data_array_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var integer(c_int) :: n_d1 ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 0, PTR] n_d1 = 0 if (associated(F%d1)) n_d1 = 1 !! f_side.to_c2_call call tao_d1_data_array_to_c2 (C, c_loc(F%d1), n_d1) end subroutine tao_d1_data_array_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_d1_data_array_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_d1_data_array structure to a Tao tao_d1_data_array_struct structure. ! This routine is called by tao_d1_data_array_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_d1_data_array_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_d1_data_array_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_d1_data_array_to_f2 (Fp, z_d1, n_d1) bind(c) implicit none type(c_ptr), value :: Fp type(tao_d1_data_array_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name type(tao_d1_data_struct), pointer :: f_d1 integer(c_int), value :: n_d1 type(c_ptr), value :: z_d1 call c_f_pointer (Fp, F) !! f_side.to_f2_trans[type, 0, PTR] if (n_d1 == 0) then if (associated(F%d1)) deallocate(F%d1) else if (.not. associated(F%d1)) allocate(F%d1) call tao_d1_data_to_f (z_d1, c_loc(F%d1)) endif end subroutine tao_d1_data_array_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_d2_data_array_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_d2_data_array_struct to a C++ CPP_tao_d2_data_array structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_d2_data_array_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_d2_data_array struct. !- subroutine tao_d2_data_array_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_d2_data_array_to_c2 (C, z_d2, n_d2) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C integer(c_int), value :: n_d2 type(c_ptr), value :: z_d2 end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_d2_data_array_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var integer(c_int) :: n_d2 ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 0, PTR] n_d2 = 0 if (associated(F%d2)) n_d2 = 1 !! f_side.to_c2_call call tao_d2_data_array_to_c2 (C, c_loc(F%d2), n_d2) end subroutine tao_d2_data_array_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_d2_data_array_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_d2_data_array structure to a Tao tao_d2_data_array_struct structure. ! This routine is called by tao_d2_data_array_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_d2_data_array_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_d2_data_array_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_d2_data_array_to_f2 (Fp, z_d2, n_d2) bind(c) implicit none type(c_ptr), value :: Fp type(tao_d2_data_array_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name type(tao_d2_data_struct), pointer :: f_d2 integer(c_int), value :: n_d2 type(c_ptr), value :: z_d2 call c_f_pointer (Fp, F) !! f_side.to_f2_trans[type, 0, PTR] if (n_d2 == 0) then if (associated(F%d2)) deallocate(F%d2) else if (.not. associated(F%d2)) allocate(F%d2) call tao_d2_data_to_f (z_d2, c_loc(F%d2)) endif end subroutine tao_d2_data_array_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_var_slave_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_var_slave_struct to a C++ CPP_tao_var_slave structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_var_slave_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_var_slave struct. !- subroutine tao_var_slave_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_var_slave_to_c2 (C, z_ix_uni, z_ix_branch, z_ix_ele, z_model_value, & n_model_value, z_base_value, n_base_value) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C integer(c_int) :: z_ix_uni, z_ix_branch, z_ix_ele integer(c_int), value :: n_model_value, n_base_value real(c_double) :: z_model_value, z_base_value end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_var_slave_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var integer(c_int) :: n_model_value integer(c_int) :: n_base_value ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[real, 0, PTR] n_model_value = 0 if (associated(F%model_value)) n_model_value = 1 !! f_side.to_c_trans[real, 0, PTR] n_base_value = 0 if (associated(F%base_value)) n_base_value = 1 !! f_side.to_c2_call call tao_var_slave_to_c2 (C, F%ix_uni, F%ix_branch, F%ix_ele, F%model_value, n_model_value, & F%base_value, n_base_value) end subroutine tao_var_slave_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_var_slave_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_var_slave structure to a Tao tao_var_slave_struct structure. ! This routine is called by tao_var_slave_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_var_slave_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_var_slave_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_var_slave_to_f2 (Fp, z_ix_uni, z_ix_branch, z_ix_ele, z_model_value, & n_model_value, z_base_value, n_base_value) bind(c) implicit none type(c_ptr), value :: Fp type(tao_var_slave_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name real(c_double), pointer :: f_model_value, f_base_value integer(c_int) :: z_ix_uni, z_ix_branch, z_ix_ele integer(c_int), value :: n_model_value, n_base_value type(c_ptr), value :: z_model_value, z_base_value call c_f_pointer (Fp, F) !! f_side.to_f2_trans[integer, 0, NOT] F%ix_uni = z_ix_uni !! f_side.to_f2_trans[integer, 0, NOT] F%ix_branch = z_ix_branch !! f_side.to_f2_trans[integer, 0, NOT] F%ix_ele = z_ix_ele !! f_side.to_f2_trans[real, 0, PTR] if (n_model_value == 0) then if (associated(F%model_value)) deallocate(F%model_value) else call c_f_pointer (z_model_value, f_model_value) if (.not. associated(F%model_value)) allocate(F%model_value) F%model_value = f_model_value endif !! f_side.to_f2_trans[real, 0, PTR] if (n_base_value == 0) then if (associated(F%base_value)) deallocate(F%base_value) else call c_f_pointer (z_base_value, f_base_value) if (.not. associated(F%base_value)) allocate(F%base_value) F%base_value = f_base_value endif end subroutine tao_var_slave_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_var_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_var_struct to a C++ CPP_tao_var structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_var_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_var struct. !- subroutine tao_var_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_var_to_c2 (C, z_ele_name, z_attrib_name, z_slave, n1_slave, z_common_slave, & z_ix_v1, z_ix_var, z_ix_dvar, z_ix_attrib, z_ix_key_table, z_model_value, n_model_value, & z_base_value, n_base_value, z_design_value, z_scratch_value, z_old_value, z_meas_value, & z_ref_value, z_correction_value, z_high_lim, z_low_lim, z_step, z_weight, z_delta_merit, & z_merit, z_dmerit_dvar, z_key_val0, z_key_delta, z_s, z_merit_type, z_exists, z_good_var, & z_good_user, z_good_opt, z_good_plot, z_useit_opt, z_useit_plot, z_key_bound, z_v1, n_v1) & bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_ele_name(*), z_attrib_name(*), z_merit_type(*) integer(c_int) :: z_ix_v1, z_ix_var, z_ix_dvar, z_ix_attrib, z_ix_key_table type(c_ptr) :: z_slave(*) integer(c_int), value :: n1_slave, n_model_value, n_base_value, n_v1 logical(c_bool) :: z_exists, z_good_var, z_good_user, z_good_opt, z_good_plot, z_useit_opt, z_useit_plot logical(c_bool) :: z_key_bound real(c_double) :: z_model_value, z_base_value, z_design_value, z_scratch_value, z_old_value, z_meas_value, z_ref_value real(c_double) :: z_correction_value, z_high_lim, z_low_lim, z_step, z_weight, z_delta_merit, z_merit real(c_double) :: z_dmerit_dvar, z_key_val0, z_key_delta, z_s type(c_ptr), value :: z_common_slave, z_v1 end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_var_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var type(c_ptr), allocatable :: z_slave(:) integer(c_int) :: n1_slave integer(c_int) :: n_model_value integer(c_int) :: n_base_value integer(c_int) :: n_v1 ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 1, ALLOC] n1_slave = 0 if (allocated(F%slave)) then n1_slave = size(F%slave); lb1 = lbound(F%slave, 1) - 1 allocate (z_slave(n1_slave)) do jd1 = 1, n1_slave z_slave(jd1) = c_loc(F%slave(jd1+lb1)) enddo endif !! f_side.to_c_trans[real, 0, PTR] n_model_value = 0 if (associated(F%model_value)) n_model_value = 1 !! f_side.to_c_trans[real, 0, PTR] n_base_value = 0 if (associated(F%base_value)) n_base_value = 1 !! f_side.to_c_trans[type, 0, PTR] n_v1 = 0 if (associated(F%v1)) n_v1 = 1 !! f_side.to_c2_call call tao_var_to_c2 (C, trim(F%ele_name) // c_null_char, trim(F%attrib_name) // c_null_char, & z_slave, n1_slave, c_loc(F%common_slave), F%ix_v1, F%ix_var, F%ix_dvar, F%ix_attrib, & F%ix_key_table, F%model_value, n_model_value, F%base_value, n_base_value, F%design_value, & F%scratch_value, F%old_value, F%meas_value, F%ref_value, F%correction_value, F%high_lim, & F%low_lim, F%step, F%weight, F%delta_merit, F%merit, F%dmerit_dvar, F%key_val0, & F%key_delta, F%s, trim(F%merit_type) // c_null_char, c_logic(F%exists), & c_logic(F%good_var), c_logic(F%good_user), c_logic(F%good_opt), c_logic(F%good_plot), & c_logic(F%useit_opt), c_logic(F%useit_plot), c_logic(F%key_bound), c_loc(F%v1), n_v1) end subroutine tao_var_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_var_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_var structure to a Tao tao_var_struct structure. ! This routine is called by tao_var_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_var_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_var_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_var_to_f2 (Fp, z_ele_name, z_attrib_name, z_slave, n1_slave, z_common_slave, & z_ix_v1, z_ix_var, z_ix_dvar, z_ix_attrib, z_ix_key_table, z_model_value, n_model_value, & z_base_value, n_base_value, z_design_value, z_scratch_value, z_old_value, z_meas_value, & z_ref_value, z_correction_value, z_high_lim, z_low_lim, z_step, z_weight, z_delta_merit, & z_merit, z_dmerit_dvar, z_key_val0, z_key_delta, z_s, z_merit_type, z_exists, z_good_var, & z_good_user, z_good_opt, z_good_plot, z_useit_opt, z_useit_plot, z_key_bound, z_v1, n_v1) & bind(c) implicit none type(c_ptr), value :: Fp type(tao_var_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_ele_name(*), z_attrib_name(*), z_merit_type(*) integer(c_int) :: z_ix_v1, z_ix_var, z_ix_dvar, z_ix_attrib, z_ix_key_table type(c_ptr) :: z_slave(*) integer(c_int), value :: n1_slave, n_model_value, n_base_value, n_v1 type(tao_v1_var_struct), pointer :: f_v1 logical(c_bool) :: z_exists, z_good_var, z_good_user, z_good_opt, z_good_plot, z_useit_opt, z_useit_plot logical(c_bool) :: z_key_bound real(c_double), pointer :: f_model_value, f_base_value real(c_double) :: z_design_value, z_scratch_value, z_old_value, z_meas_value, z_ref_value, z_correction_value, z_high_lim real(c_double) :: z_low_lim, z_step, z_weight, z_delta_merit, z_merit, z_dmerit_dvar, z_key_val0 real(c_double) :: z_key_delta, z_s type(c_ptr), value :: z_common_slave, z_model_value, z_base_value, z_v1 call c_f_pointer (Fp, F) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_ele_name, F%ele_name) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_attrib_name, F%attrib_name) !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_slave == 0) then if (allocated(F%slave)) deallocate(F%slave) else if (allocated(F%slave)) then if (n1_slave == 0 .or. any(shape(F%slave) /= [n1_slave])) deallocate(F%slave) if (any(lbound(F%slave) /= 1)) deallocate(F%slave) endif if (.not. allocated(F%slave)) allocate(F%slave(1:n1_slave+1-1)) do jd1 = 1, n1_slave call tao_var_slave_to_f (z_slave(jd1), c_loc(F%slave(jd1+1-1))) enddo endif !! f_side.to_f2_trans[type, 0, NOT] call tao_var_slave_to_f(z_common_slave, c_loc(F%common_slave)) !! f_side.to_f2_trans[integer, 0, NOT] F%ix_v1 = z_ix_v1 !! f_side.to_f2_trans[integer, 0, NOT] F%ix_var = z_ix_var !! f_side.to_f2_trans[integer, 0, NOT] F%ix_dvar = z_ix_dvar !! f_side.to_f2_trans[integer, 0, NOT] F%ix_attrib = z_ix_attrib !! f_side.to_f2_trans[integer, 0, NOT] F%ix_key_table = z_ix_key_table !! f_side.to_f2_trans[real, 0, PTR] if (n_model_value == 0) then if (associated(F%model_value)) deallocate(F%model_value) else call c_f_pointer (z_model_value, f_model_value) if (.not. associated(F%model_value)) allocate(F%model_value) F%model_value = f_model_value endif !! f_side.to_f2_trans[real, 0, PTR] if (n_base_value == 0) then if (associated(F%base_value)) deallocate(F%base_value) else call c_f_pointer (z_base_value, f_base_value) if (.not. associated(F%base_value)) allocate(F%base_value) F%base_value = f_base_value endif !! f_side.to_f2_trans[real, 0, NOT] F%design_value = z_design_value !! f_side.to_f2_trans[real, 0, NOT] F%scratch_value = z_scratch_value !! f_side.to_f2_trans[real, 0, NOT] F%old_value = z_old_value !! f_side.to_f2_trans[real, 0, NOT] F%meas_value = z_meas_value !! f_side.to_f2_trans[real, 0, NOT] F%ref_value = z_ref_value !! f_side.to_f2_trans[real, 0, NOT] F%correction_value = z_correction_value !! f_side.to_f2_trans[real, 0, NOT] F%high_lim = z_high_lim !! f_side.to_f2_trans[real, 0, NOT] F%low_lim = z_low_lim !! f_side.to_f2_trans[real, 0, NOT] F%step = z_step !! f_side.to_f2_trans[real, 0, NOT] F%weight = z_weight !! f_side.to_f2_trans[real, 0, NOT] F%delta_merit = z_delta_merit !! f_side.to_f2_trans[real, 0, NOT] F%merit = z_merit !! f_side.to_f2_trans[real, 0, NOT] F%dmerit_dvar = z_dmerit_dvar !! f_side.to_f2_trans[real, 0, NOT] F%key_val0 = z_key_val0 !! f_side.to_f2_trans[real, 0, NOT] F%key_delta = z_key_delta !! f_side.to_f2_trans[real, 0, NOT] F%s = z_s !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_merit_type, F%merit_type) !! f_side.to_f2_trans[logical, 0, NOT] F%exists = f_logic(z_exists) !! f_side.to_f2_trans[logical, 0, NOT] F%good_var = f_logic(z_good_var) !! f_side.to_f2_trans[logical, 0, NOT] F%good_user = f_logic(z_good_user) !! f_side.to_f2_trans[logical, 0, NOT] F%good_opt = f_logic(z_good_opt) !! f_side.to_f2_trans[logical, 0, NOT] F%good_plot = f_logic(z_good_plot) !! f_side.to_f2_trans[logical, 0, NOT] F%useit_opt = f_logic(z_useit_opt) !! f_side.to_f2_trans[logical, 0, NOT] F%useit_plot = f_logic(z_useit_plot) !! f_side.to_f2_trans[logical, 0, NOT] F%key_bound = f_logic(z_key_bound) !! f_side.to_f2_trans[type, 0, PTR] if (n_v1 == 0) then if (associated(F%v1)) deallocate(F%v1) else if (.not. associated(F%v1)) allocate(F%v1) call tao_v1_var_to_f (z_v1, c_loc(F%v1)) endif end subroutine tao_var_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_v1_var_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_v1_var_struct to a C++ CPP_tao_v1_var structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_v1_var_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_v1_var struct. !- subroutine tao_v1_var_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_v1_var_to_c2 (C, z_name, z_ix_v1_var, z_v, n1_v) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_name(*) integer(c_int) :: z_ix_v1_var type(c_ptr) :: z_v(*) integer(c_int), value :: n1_v end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_v1_var_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var type(c_ptr), allocatable :: z_v(:) integer(c_int) :: n1_v ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 1, PTR] n1_v = 0 if (associated(F%v)) then n1_v = size(F%v); lb1 = lbound(F%v, 1) - 1 allocate (z_v(n1_v)) do jd1 = 1, n1_v z_v(jd1) = c_loc(F%v(jd1+lb1)) enddo endif !! f_side.to_c2_call call tao_v1_var_to_c2 (C, trim(F%name) // c_null_char, F%ix_v1_var, z_v, n1_v) end subroutine tao_v1_var_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_v1_var_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_v1_var structure to a Tao tao_v1_var_struct structure. ! This routine is called by tao_v1_var_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_v1_var_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_v1_var_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_v1_var_to_f2 (Fp, z_name, z_ix_v1_var, z_v, n1_v) bind(c) implicit none type(c_ptr), value :: Fp type(tao_v1_var_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_name(*) integer(c_int) :: z_ix_v1_var type(c_ptr) :: z_v(*) integer(c_int), value :: n1_v call c_f_pointer (Fp, F) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_name, F%name) !! f_side.to_f2_trans[integer, 0, NOT] F%ix_v1_var = z_ix_v1_var !! f_side.to_f2_trans[type, 1, PTR] if (n1_v == 0) then if (associated(F%v)) deallocate(F%v) else if (associated(F%v)) then if (n1_v == 0 .or. any(shape(F%v) /= [n1_v])) deallocate(F%v) if (any(lbound(F%v) /= 1)) deallocate(F%v) endif if (.not. associated(F%v)) allocate(F%v(1:n1_v+1-1)) do jd1 = 1, n1_v call tao_var_to_f (z_v(jd1), c_loc(F%v(jd1+1-1))) enddo endif end subroutine tao_v1_var_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_var_array_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_var_array_struct to a C++ CPP_tao_var_array structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_var_array_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_var_array struct. !- subroutine tao_var_array_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_var_array_to_c2 (C, z_v, n_v) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C integer(c_int), value :: n_v type(c_ptr), value :: z_v end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_var_array_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var integer(c_int) :: n_v ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 0, PTR] n_v = 0 if (associated(F%v)) n_v = 1 !! f_side.to_c2_call call tao_var_array_to_c2 (C, c_loc(F%v), n_v) end subroutine tao_var_array_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_var_array_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_var_array structure to a Tao tao_var_array_struct structure. ! This routine is called by tao_var_array_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_var_array_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_var_array_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_var_array_to_f2 (Fp, z_v, n_v) bind(c) implicit none type(c_ptr), value :: Fp type(tao_var_array_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name type(tao_var_struct), pointer :: f_v integer(c_int), value :: n_v type(c_ptr), value :: z_v call c_f_pointer (Fp, F) !! f_side.to_f2_trans[type, 0, PTR] if (n_v == 0) then if (associated(F%v)) deallocate(F%v) else if (.not. associated(F%v)) allocate(F%v) call tao_var_to_f (z_v, c_loc(F%v)) endif end subroutine tao_var_array_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_v1_var_array_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_v1_var_array_struct to a C++ CPP_tao_v1_var_array structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_v1_var_array_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_v1_var_array struct. !- subroutine tao_v1_var_array_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_v1_var_array_to_c2 (C, z_v1, n_v1) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C integer(c_int), value :: n_v1 type(c_ptr), value :: z_v1 end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_v1_var_array_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var integer(c_int) :: n_v1 ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 0, PTR] n_v1 = 0 if (associated(F%v1)) n_v1 = 1 !! f_side.to_c2_call call tao_v1_var_array_to_c2 (C, c_loc(F%v1), n_v1) end subroutine tao_v1_var_array_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_v1_var_array_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_v1_var_array structure to a Tao tao_v1_var_array_struct structure. ! This routine is called by tao_v1_var_array_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_v1_var_array_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_v1_var_array_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_v1_var_array_to_f2 (Fp, z_v1, n_v1) bind(c) implicit none type(c_ptr), value :: Fp type(tao_v1_var_array_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name type(tao_v1_var_struct), pointer :: f_v1 integer(c_int), value :: n_v1 type(c_ptr), value :: z_v1 call c_f_pointer (Fp, F) !! f_side.to_f2_trans[type, 0, PTR] if (n_v1 == 0) then if (associated(F%v1)) deallocate(F%v1) else if (.not. associated(F%v1)) allocate(F%v1) call tao_v1_var_to_f (z_v1, c_loc(F%v1)) endif end subroutine tao_v1_var_array_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_building_wall_point_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_building_wall_point_struct to a C++ CPP_tao_building_wall_point structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_building_wall_point_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_building_wall_point struct. !- subroutine tao_building_wall_point_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_building_wall_point_to_c2 (C, z_z, z_x, z_radius, z_z_center, z_x_center) & bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C real(c_double) :: z_z, z_x, z_radius, z_z_center, z_x_center end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_building_wall_point_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call tao_building_wall_point_to_c2 (C, F%z, F%x, F%radius, F%z_center, F%x_center) end subroutine tao_building_wall_point_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_building_wall_point_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_building_wall_point structure to a Tao tao_building_wall_point_struct structure. ! This routine is called by tao_building_wall_point_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_building_wall_point_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_building_wall_point_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_building_wall_point_to_f2 (Fp, z_z, z_x, z_radius, z_z_center, z_x_center) & bind(c) implicit none type(c_ptr), value :: Fp type(tao_building_wall_point_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name real(c_double) :: z_z, z_x, z_radius, z_z_center, z_x_center call c_f_pointer (Fp, F) !! f_side.to_f2_trans[real, 0, NOT] F%z = z_z !! f_side.to_f2_trans[real, 0, NOT] F%x = z_x !! f_side.to_f2_trans[real, 0, NOT] F%radius = z_radius !! f_side.to_f2_trans[real, 0, NOT] F%z_center = z_z_center !! f_side.to_f2_trans[real, 0, NOT] F%x_center = z_x_center end subroutine tao_building_wall_point_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_building_wall_section_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_building_wall_section_struct to a C++ CPP_tao_building_wall_section structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_building_wall_section_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_building_wall_section struct. !- subroutine tao_building_wall_section_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_building_wall_section_to_c2 (C, z_constraint, z_point, n1_point) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_constraint(*) type(c_ptr) :: z_point(*) integer(c_int), value :: n1_point end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_building_wall_section_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var type(c_ptr), allocatable :: z_point(:) integer(c_int) :: n1_point ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 1, ALLOC] n1_point = 0 if (allocated(F%point)) then n1_point = size(F%point); lb1 = lbound(F%point, 1) - 1 allocate (z_point(n1_point)) do jd1 = 1, n1_point z_point(jd1) = c_loc(F%point(jd1+lb1)) enddo endif !! f_side.to_c2_call call tao_building_wall_section_to_c2 (C, trim(F%constraint) // c_null_char, z_point, n1_point) end subroutine tao_building_wall_section_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_building_wall_section_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_building_wall_section structure to a Tao tao_building_wall_section_struct structure. ! This routine is called by tao_building_wall_section_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_building_wall_section_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_building_wall_section_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_building_wall_section_to_f2 (Fp, z_constraint, z_point, n1_point) bind(c) implicit none type(c_ptr), value :: Fp type(tao_building_wall_section_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_constraint(*) type(c_ptr) :: z_point(*) integer(c_int), value :: n1_point call c_f_pointer (Fp, F) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_constraint, F%constraint) !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_point == 0) then if (allocated(F%point)) deallocate(F%point) else if (allocated(F%point)) then if (n1_point == 0 .or. any(shape(F%point) /= [n1_point])) deallocate(F%point) if (any(lbound(F%point) /= 1)) deallocate(F%point) endif if (.not. allocated(F%point)) allocate(F%point(1:n1_point+1-1)) do jd1 = 1, n1_point call tao_building_wall_point_to_f (z_point(jd1), c_loc(F%point(jd1+1-1))) enddo endif end subroutine tao_building_wall_section_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_building_wall_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_building_wall_struct to a C++ CPP_tao_building_wall structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_building_wall_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_building_wall struct. !- subroutine tao_building_wall_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_building_wall_to_c2 (C, z_section, n1_section) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C type(c_ptr) :: z_section(*) integer(c_int), value :: n1_section end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_building_wall_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var type(c_ptr), allocatable :: z_section(:) integer(c_int) :: n1_section ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 1, ALLOC] n1_section = 0 if (allocated(F%section)) then n1_section = size(F%section); lb1 = lbound(F%section, 1) - 1 allocate (z_section(n1_section)) do jd1 = 1, n1_section z_section(jd1) = c_loc(F%section(jd1+lb1)) enddo endif !! f_side.to_c2_call call tao_building_wall_to_c2 (C, z_section, n1_section) end subroutine tao_building_wall_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_building_wall_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_building_wall structure to a Tao tao_building_wall_struct structure. ! This routine is called by tao_building_wall_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_building_wall_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_building_wall_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_building_wall_to_f2 (Fp, z_section, n1_section) bind(c) implicit none type(c_ptr), value :: Fp type(tao_building_wall_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name type(c_ptr) :: z_section(*) integer(c_int), value :: n1_section call c_f_pointer (Fp, F) !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_section == 0) then if (allocated(F%section)) deallocate(F%section) else if (allocated(F%section)) then if (n1_section == 0 .or. any(shape(F%section) /= [n1_section])) deallocate(F%section) if (any(lbound(F%section) /= 1)) deallocate(F%section) endif if (.not. allocated(F%section)) allocate(F%section(1:n1_section+1-1)) do jd1 = 1, n1_section call tao_building_wall_section_to_f (z_section(jd1), c_loc(F%section(jd1+1-1))) enddo endif end subroutine tao_building_wall_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_global_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_global_struct to a C++ CPP_tao_global structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_global_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_global struct. !- subroutine tao_global_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_global_to_c2 (C, z_y_axis_plot_dmin, z_lm_opt_deriv_reinit, & z_de_lm_step_ratio, z_de_var_to_population_factor, z_lmdif_eps, z_svd_cutoff, & z_unstable_penalty, z_merit_stop_value, z_random_sigma_cutoff, z_delta_e_chrom, & z_n_opti_cycles, z_n_opti_loops, z_phase_units, z_bunch_to_plot, z_random_seed, & z_n_top10, z_random_engine, z_random_gauss_converter, z_track_type, z_prompt_string, & z_prompt_color, z_optimizer, z_print_command, z_var_out_file, z_initialized, & z_opt_with_ref, z_opt_with_base, z_label_lattice_elements, z_label_keys, & z_derivative_recalc, z_derivative_uses_design, z_init_plot_needed, z_orm_analysis, & z_plot_on, z_lattice_calc_on, z_svd_retreat_on_merit_increase, z_stop_on_error, & z_command_file_print_on, z_box_plots, z_beam_timer_on, z_var_limits_on, & z_only_limit_opt_vars, z_optimizer_var_limit_warn, z_rf_on, z_draw_curve_off_scale_warn, & z_wait_for_cr_in_single_mode, z_disable_smooth_line_calc, z_debug_on, z_single_step, & z_optimizer_allow_user_abort, z_quiet) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_random_engine(*), z_random_gauss_converter(*), z_track_type(*), z_prompt_string(*), z_prompt_color(*), z_optimizer(*), z_print_command(*) character(c_char) :: z_var_out_file(*) integer(c_int) :: z_n_opti_cycles, z_n_opti_loops, z_phase_units, z_bunch_to_plot, z_random_seed, z_n_top10 real(c_double) :: z_y_axis_plot_dmin, z_lm_opt_deriv_reinit, z_de_lm_step_ratio, z_de_var_to_population_factor, z_lmdif_eps, z_svd_cutoff, z_unstable_penalty real(c_double) :: z_merit_stop_value, z_random_sigma_cutoff, z_delta_e_chrom logical(c_bool) :: z_initialized, z_opt_with_ref, z_opt_with_base, z_label_lattice_elements, z_label_keys, z_derivative_recalc, z_derivative_uses_design logical(c_bool) :: z_init_plot_needed, z_orm_analysis, z_plot_on, z_lattice_calc_on, z_svd_retreat_on_merit_increase, z_stop_on_error, z_command_file_print_on logical(c_bool) :: z_box_plots, z_beam_timer_on, z_var_limits_on, z_only_limit_opt_vars, z_optimizer_var_limit_warn, z_rf_on, z_draw_curve_off_scale_warn logical(c_bool) :: z_wait_for_cr_in_single_mode, z_disable_smooth_line_calc, z_debug_on, z_single_step, z_optimizer_allow_user_abort, z_quiet end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_global_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call tao_global_to_c2 (C, F%y_axis_plot_dmin, F%lm_opt_deriv_reinit, F%de_lm_step_ratio, & F%de_var_to_population_factor, F%lmdif_eps, F%svd_cutoff, F%unstable_penalty, & F%merit_stop_value, F%random_sigma_cutoff, F%delta_e_chrom, F%n_opti_cycles, & F%n_opti_loops, F%phase_units, F%bunch_to_plot, F%random_seed, F%n_top10, & trim(F%random_engine) // c_null_char, trim(F%random_gauss_converter) // c_null_char, & trim(F%track_type) // c_null_char, trim(F%prompt_string) // c_null_char, & trim(F%prompt_color) // c_null_char, trim(F%optimizer) // c_null_char, & trim(F%print_command) // c_null_char, trim(F%var_out_file) // c_null_char, & c_logic(F%initialized), c_logic(F%opt_with_ref), c_logic(F%opt_with_base), & c_logic(F%label_lattice_elements), c_logic(F%label_keys), c_logic(F%derivative_recalc), & c_logic(F%derivative_uses_design), c_logic(F%init_plot_needed), c_logic(F%orm_analysis), & c_logic(F%plot_on), c_logic(F%lattice_calc_on), c_logic(F%svd_retreat_on_merit_increase), & c_logic(F%stop_on_error), c_logic(F%command_file_print_on), c_logic(F%box_plots), & c_logic(F%beam_timer_on), c_logic(F%var_limits_on), c_logic(F%only_limit_opt_vars), & c_logic(F%optimizer_var_limit_warn), c_logic(F%rf_on), & c_logic(F%draw_curve_off_scale_warn), c_logic(F%wait_for_cr_in_single_mode), & c_logic(F%disable_smooth_line_calc), c_logic(F%debug_on), c_logic(F%single_step), & c_logic(F%optimizer_allow_user_abort), c_logic(F%quiet)) end subroutine tao_global_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_global_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_global structure to a Tao tao_global_struct structure. ! This routine is called by tao_global_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_global_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_global_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_global_to_f2 (Fp, z_y_axis_plot_dmin, z_lm_opt_deriv_reinit, z_de_lm_step_ratio, & z_de_var_to_population_factor, z_lmdif_eps, z_svd_cutoff, z_unstable_penalty, & z_merit_stop_value, z_random_sigma_cutoff, z_delta_e_chrom, z_n_opti_cycles, & z_n_opti_loops, z_phase_units, z_bunch_to_plot, z_random_seed, z_n_top10, z_random_engine, & z_random_gauss_converter, z_track_type, z_prompt_string, z_prompt_color, z_optimizer, & z_print_command, z_var_out_file, z_initialized, z_opt_with_ref, z_opt_with_base, & z_label_lattice_elements, z_label_keys, z_derivative_recalc, z_derivative_uses_design, & z_init_plot_needed, z_orm_analysis, z_plot_on, z_lattice_calc_on, & z_svd_retreat_on_merit_increase, z_stop_on_error, z_command_file_print_on, z_box_plots, & z_beam_timer_on, z_var_limits_on, z_only_limit_opt_vars, z_optimizer_var_limit_warn, & z_rf_on, z_draw_curve_off_scale_warn, z_wait_for_cr_in_single_mode, & z_disable_smooth_line_calc, z_debug_on, z_single_step, z_optimizer_allow_user_abort, & z_quiet) bind(c) implicit none type(c_ptr), value :: Fp type(tao_global_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_random_engine(*), z_random_gauss_converter(*), z_track_type(*), z_prompt_string(*), z_prompt_color(*), z_optimizer(*), z_print_command(*) character(c_char) :: z_var_out_file(*) integer(c_int) :: z_n_opti_cycles, z_n_opti_loops, z_phase_units, z_bunch_to_plot, z_random_seed, z_n_top10 real(c_double) :: z_y_axis_plot_dmin, z_lm_opt_deriv_reinit, z_de_lm_step_ratio, z_de_var_to_population_factor, z_lmdif_eps, z_svd_cutoff, z_unstable_penalty real(c_double) :: z_merit_stop_value, z_random_sigma_cutoff, z_delta_e_chrom logical(c_bool) :: z_initialized, z_opt_with_ref, z_opt_with_base, z_label_lattice_elements, z_label_keys, z_derivative_recalc, z_derivative_uses_design logical(c_bool) :: z_init_plot_needed, z_orm_analysis, z_plot_on, z_lattice_calc_on, z_svd_retreat_on_merit_increase, z_stop_on_error, z_command_file_print_on logical(c_bool) :: z_box_plots, z_beam_timer_on, z_var_limits_on, z_only_limit_opt_vars, z_optimizer_var_limit_warn, z_rf_on, z_draw_curve_off_scale_warn logical(c_bool) :: z_wait_for_cr_in_single_mode, z_disable_smooth_line_calc, z_debug_on, z_single_step, z_optimizer_allow_user_abort, z_quiet call c_f_pointer (Fp, F) !! f_side.to_f2_trans[real, 0, NOT] F%y_axis_plot_dmin = z_y_axis_plot_dmin !! f_side.to_f2_trans[real, 0, NOT] F%lm_opt_deriv_reinit = z_lm_opt_deriv_reinit !! f_side.to_f2_trans[real, 0, NOT] F%de_lm_step_ratio = z_de_lm_step_ratio !! f_side.to_f2_trans[real, 0, NOT] F%de_var_to_population_factor = z_de_var_to_population_factor !! f_side.to_f2_trans[real, 0, NOT] F%lmdif_eps = z_lmdif_eps !! f_side.to_f2_trans[real, 0, NOT] F%svd_cutoff = z_svd_cutoff !! f_side.to_f2_trans[real, 0, NOT] F%unstable_penalty = z_unstable_penalty !! f_side.to_f2_trans[real, 0, NOT] F%merit_stop_value = z_merit_stop_value !! f_side.to_f2_trans[real, 0, NOT] F%random_sigma_cutoff = z_random_sigma_cutoff !! f_side.to_f2_trans[real, 0, NOT] F%delta_e_chrom = z_delta_e_chrom !! f_side.to_f2_trans[integer, 0, NOT] F%n_opti_cycles = z_n_opti_cycles !! f_side.to_f2_trans[integer, 0, NOT] F%n_opti_loops = z_n_opti_loops !! f_side.to_f2_trans[integer, 0, NOT] F%phase_units = z_phase_units !! f_side.to_f2_trans[integer, 0, NOT] F%bunch_to_plot = z_bunch_to_plot !! f_side.to_f2_trans[integer, 0, NOT] F%random_seed = z_random_seed !! f_side.to_f2_trans[integer, 0, NOT] F%n_top10 = z_n_top10 !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_random_engine, F%random_engine) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_random_gauss_converter, F%random_gauss_converter) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_track_type, F%track_type) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_prompt_string, F%prompt_string) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_prompt_color, F%prompt_color) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_optimizer, F%optimizer) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_print_command, F%print_command) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_var_out_file, F%var_out_file) !! f_side.to_f2_trans[logical, 0, NOT] F%initialized = f_logic(z_initialized) !! f_side.to_f2_trans[logical, 0, NOT] F%opt_with_ref = f_logic(z_opt_with_ref) !! f_side.to_f2_trans[logical, 0, NOT] F%opt_with_base = f_logic(z_opt_with_base) !! f_side.to_f2_trans[logical, 0, NOT] F%label_lattice_elements = f_logic(z_label_lattice_elements) !! f_side.to_f2_trans[logical, 0, NOT] F%label_keys = f_logic(z_label_keys) !! f_side.to_f2_trans[logical, 0, NOT] F%derivative_recalc = f_logic(z_derivative_recalc) !! f_side.to_f2_trans[logical, 0, NOT] F%derivative_uses_design = f_logic(z_derivative_uses_design) !! f_side.to_f2_trans[logical, 0, NOT] F%init_plot_needed = f_logic(z_init_plot_needed) !! f_side.to_f2_trans[logical, 0, NOT] F%orm_analysis = f_logic(z_orm_analysis) !! f_side.to_f2_trans[logical, 0, NOT] F%plot_on = f_logic(z_plot_on) !! f_side.to_f2_trans[logical, 0, NOT] F%lattice_calc_on = f_logic(z_lattice_calc_on) !! f_side.to_f2_trans[logical, 0, NOT] F%svd_retreat_on_merit_increase = f_logic(z_svd_retreat_on_merit_increase) !! f_side.to_f2_trans[logical, 0, NOT] F%stop_on_error = f_logic(z_stop_on_error) !! f_side.to_f2_trans[logical, 0, NOT] F%command_file_print_on = f_logic(z_command_file_print_on) !! f_side.to_f2_trans[logical, 0, NOT] F%box_plots = f_logic(z_box_plots) !! f_side.to_f2_trans[logical, 0, NOT] F%beam_timer_on = f_logic(z_beam_timer_on) !! f_side.to_f2_trans[logical, 0, NOT] F%var_limits_on = f_logic(z_var_limits_on) !! f_side.to_f2_trans[logical, 0, NOT] F%only_limit_opt_vars = f_logic(z_only_limit_opt_vars) !! f_side.to_f2_trans[logical, 0, NOT] F%optimizer_var_limit_warn = f_logic(z_optimizer_var_limit_warn) !! f_side.to_f2_trans[logical, 0, NOT] F%rf_on = f_logic(z_rf_on) !! f_side.to_f2_trans[logical, 0, NOT] F%draw_curve_off_scale_warn = f_logic(z_draw_curve_off_scale_warn) !! f_side.to_f2_trans[logical, 0, NOT] F%wait_for_cr_in_single_mode = f_logic(z_wait_for_cr_in_single_mode) !! f_side.to_f2_trans[logical, 0, NOT] F%disable_smooth_line_calc = f_logic(z_disable_smooth_line_calc) !! f_side.to_f2_trans[logical, 0, NOT] F%debug_on = f_logic(z_debug_on) !! f_side.to_f2_trans[logical, 0, NOT] F%single_step = f_logic(z_single_step) !! f_side.to_f2_trans[logical, 0, NOT] F%optimizer_allow_user_abort = f_logic(z_optimizer_allow_user_abort) !! f_side.to_f2_trans[logical, 0, NOT] F%quiet = f_logic(z_quiet) end subroutine tao_global_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_alias_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_alias_struct to a C++ CPP_tao_alias structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_alias_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_alias struct. !- subroutine tao_alias_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_alias_to_c2 (C, z_name, z_expanded_str) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_name(*), z_expanded_str(*) end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_alias_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call tao_alias_to_c2 (C, trim(F%name) // c_null_char, trim(F%expanded_str) // c_null_char) end subroutine tao_alias_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_alias_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_alias structure to a Tao tao_alias_struct structure. ! This routine is called by tao_alias_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_alias_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_alias_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_alias_to_f2 (Fp, z_name, z_expanded_str) bind(c) implicit none type(c_ptr), value :: Fp type(tao_alias_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_name(*), z_expanded_str(*) call c_f_pointer (Fp, F) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_name, F%name) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_expanded_str, F%expanded_str) end subroutine tao_alias_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_command_file_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_command_file_struct to a C++ CPP_tao_command_file structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_command_file_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_command_file struct. !- subroutine tao_command_file_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_command_file_to_c2 (C, z_name, z_ix_unit, z_cmd_arg, z_paused, z_n_line) & bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_name(*) integer(c_int) :: z_ix_unit, z_n_line type(c_ptr) :: z_cmd_arg(*) logical(c_bool) :: z_paused end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_command_file_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var type(c_ptr) :: z_cmd_arg(9) character(40+1), target :: a_cmd_arg(9) ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[character, 1, NOT] do jd1 = 1, size(F%cmd_arg,1); lb1 = lbound(F%cmd_arg,1) - 1 a_cmd_arg(jd1) = trim(F%cmd_arg(jd1+lb1)) // c_null_char z_cmd_arg(jd1) = c_loc(a_cmd_arg(jd1)) enddo !! f_side.to_c2_call call tao_command_file_to_c2 (C, trim(F%name) // c_null_char, F%ix_unit, z_cmd_arg, & c_logic(F%paused), F%n_line) end subroutine tao_command_file_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_command_file_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_command_file structure to a Tao tao_command_file_struct structure. ! This routine is called by tao_command_file_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_command_file_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_command_file_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_command_file_to_f2 (Fp, z_name, z_ix_unit, z_cmd_arg, z_paused, z_n_line) & bind(c) implicit none type(c_ptr), value :: Fp type(tao_command_file_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_name(*) integer(c_int) :: z_ix_unit, z_n_line logical(c_bool) :: z_paused type(c_ptr) :: z_cmd_arg(*) character(c_char), pointer :: f_cmd_arg call c_f_pointer (Fp, F) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_name, F%name) !! f_side.to_f2_trans[integer, 0, NOT] F%ix_unit = z_ix_unit !! f_side.to_f2_trans[character, 1, NOT] do jd1 = 1, size(F%cmd_arg,1); lb1 = lbound(F%cmd_arg,1) - 1 call c_f_pointer (z_cmd_arg(jd1), f_cmd_arg) call to_f_str(f_cmd_arg, F%cmd_arg(jd1+lb1)) enddo !! f_side.to_f2_trans[logical, 0, NOT] F%paused = f_logic(z_paused) !! f_side.to_f2_trans[integer, 0, NOT] F%n_line = z_n_line end subroutine tao_command_file_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_common_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_common_struct to a C++ CPP_tao_common structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_common_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_common struct. !- subroutine tao_common_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_common_to_c2 (C, z_alias, z_key, z_u_working, n_u_working, z_cmd_file, & n1_cmd_file, z_covar, n1_covar, n2_covar, z_alpha, n1_alpha, n2_alpha, z_dummy_target, & z_ix_ref_taylor, z_ix_ele_taylor, z_n_alias, z_cmd_file_level, z_ix_key_bank, & z_n_universes, z_default_universe, z_default_branch, z_ix_history, z_n_history, & z_cmd_file_paused, z_use_cmd_here, z_multi_commands_here, z_cmd_from_cmd_file, & z_use_saved_beam_in_tracking, z_single_mode, z_combine_consecutive_elements_of_like_name, & z_common_lattice, z_init_beam, z_init_var, z_init_read_lat_info, z_init_data, & z_parse_cmd_args, z_optimizer_running, z_have_datums_using_expressions, z_noplot_arg_set, & z_init_tao_file_arg_set, z_log_startup, z_print_to_terminal, z_cmd, z_init_name, & z_lat_file, z_init_tao_file, z_init_tao_file_path, z_beam_file, z_beam_all_file, & z_beam0_file, z_data_file, z_plot_file, z_startup_file, z_var_file, z_building_wall_file, & z_hook_init_file, z_plot_geometry, z_single_mode_buffer, z_unique_name_suffix, & z_valid_plot_who) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_cmd(*), z_init_name(*), z_lat_file(*), z_init_tao_file(*), z_init_tao_file_path(*), z_beam_file(*), z_beam_all_file(*) character(c_char) :: z_beam0_file(*), z_data_file(*), z_plot_file(*), z_startup_file(*), z_var_file(*), z_building_wall_file(*), z_hook_init_file(*) character(c_char) :: z_plot_geometry(*), z_single_mode_buffer(*), z_unique_name_suffix(*) integer(c_int) :: z_ix_ref_taylor, z_ix_ele_taylor, z_n_alias, z_cmd_file_level, z_ix_key_bank, z_n_universes, z_default_universe integer(c_int) :: z_default_branch, z_ix_history, z_n_history type(c_ptr) :: z_alias(*), z_key(*), z_cmd_file(*), z_valid_plot_who(*) integer(c_int), value :: n_u_working, n1_cmd_file, n1_covar, n2_covar, n1_alpha, n2_alpha logical(c_bool) :: z_cmd_file_paused, z_use_cmd_here, z_multi_commands_here, z_cmd_from_cmd_file, z_use_saved_beam_in_tracking, z_single_mode, z_combine_consecutive_elements_of_like_name logical(c_bool) :: z_common_lattice, z_init_beam, z_init_var, z_init_read_lat_info, z_init_data, z_parse_cmd_args, z_optimizer_running logical(c_bool) :: z_have_datums_using_expressions, z_noplot_arg_set, z_init_tao_file_arg_set, z_log_startup, z_print_to_terminal real(c_double) :: z_covar(*), z_alpha(*), z_dummy_target type(c_ptr), value :: z_u_working end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_common_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var type(c_ptr) :: z_alias(200) type(c_ptr) :: z_key(100) integer(c_int) :: n_u_working type(c_ptr), allocatable :: z_cmd_file(:) integer(c_int) :: n1_cmd_file integer(c_int) :: n1_covar integer(c_int) :: n2_covar integer(c_int) :: n1_alpha integer(c_int) :: n2_alpha type(c_ptr) :: z_valid_plot_who(10) character(16+1), target :: a_valid_plot_who(10) ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 1, NOT] do jd1 = 1, size(F%alias,1); lb1 = lbound(F%alias,1) - 1 z_alias(jd1) = c_loc(F%alias(jd1+lb1)) enddo !! f_side.to_c_trans[type, 1, NOT] do jd1 = 1, size(F%key,1); lb1 = lbound(F%key,1) - 1 z_key(jd1) = c_loc(F%key(jd1+lb1)) enddo !! f_side.to_c_trans[type, 0, PTR] n_u_working = 0 if (associated(F%u_working)) n_u_working = 1 !! f_side.to_c_trans[type, 1, ALLOC] n1_cmd_file = 0 if (allocated(F%cmd_file)) then n1_cmd_file = size(F%cmd_file); lb1 = lbound(F%cmd_file, 1) - 1 allocate (z_cmd_file(n1_cmd_file)) do jd1 = 1, n1_cmd_file z_cmd_file(jd1) = c_loc(F%cmd_file(jd1+lb1)) enddo endif !! f_side.to_c_trans[real, 2, ALLOC] if (allocated(F%covar)) then n1_covar = size(F%covar, 1) n2_covar = size(F%covar, 2) else n1_covar = 0; n2_covar = 0 endif !! f_side.to_c_trans[real, 2, ALLOC] if (allocated(F%alpha)) then n1_alpha = size(F%alpha, 1) n2_alpha = size(F%alpha, 2) else n1_alpha = 0; n2_alpha = 0 endif !! f_side.to_c_trans[character, 1, NOT] do jd1 = 1, size(F%valid_plot_who,1); lb1 = lbound(F%valid_plot_who,1) - 1 a_valid_plot_who(jd1) = trim(F%valid_plot_who(jd1+lb1)) // c_null_char z_valid_plot_who(jd1) = c_loc(a_valid_plot_who(jd1)) enddo !! f_side.to_c2_call call tao_common_to_c2 (C, z_alias, z_key, c_loc(F%u_working), n_u_working, z_cmd_file, & n1_cmd_file, mat2vec(F%covar, n1_covar*n2_covar), n1_covar, n2_covar, mat2vec(F%alpha, & n1_alpha*n2_alpha), n1_alpha, n2_alpha, F%dummy_target, F%ix_ref_taylor, F%ix_ele_taylor, & F%n_alias, F%cmd_file_level, F%ix_key_bank, F%n_universes, F%default_universe, & F%default_branch, F%ix_history, F%n_history, c_logic(F%cmd_file_paused), & c_logic(F%use_cmd_here), c_logic(F%multi_commands_here), c_logic(F%cmd_from_cmd_file), & c_logic(F%use_saved_beam_in_tracking), c_logic(F%single_mode), & c_logic(F%combine_consecutive_elements_of_like_name), c_logic(F%common_lattice), & c_logic(F%init_beam), c_logic(F%init_var), c_logic(F%init_read_lat_info), & c_logic(F%init_data), c_logic(F%parse_cmd_args), c_logic(F%optimizer_running), & c_logic(F%have_datums_using_expressions), c_logic(F%noplot_arg_set), & c_logic(F%init_tao_file_arg_set), c_logic(F%log_startup), c_logic(F%print_to_terminal), & trim(F%cmd) // c_null_char, trim(F%init_name) // c_null_char, trim(F%lat_file) // & c_null_char, trim(F%init_tao_file) // c_null_char, trim(F%init_tao_file_path) // & c_null_char, trim(F%beam_file) // c_null_char, trim(F%beam_all_file) // c_null_char, & trim(F%beam0_file) // c_null_char, trim(F%data_file) // c_null_char, trim(F%plot_file) // & c_null_char, trim(F%startup_file) // c_null_char, trim(F%var_file) // c_null_char, & trim(F%building_wall_file) // c_null_char, trim(F%hook_init_file) // c_null_char, & trim(F%plot_geometry) // c_null_char, trim(F%single_mode_buffer) // c_null_char, & trim(F%unique_name_suffix) // c_null_char, z_valid_plot_who) end subroutine tao_common_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_common_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_common structure to a Tao tao_common_struct structure. ! This routine is called by tao_common_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_common_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_common_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_common_to_f2 (Fp, z_alias, z_key, z_u_working, n_u_working, z_cmd_file, & n1_cmd_file, z_covar, n1_covar, n2_covar, z_alpha, n1_alpha, n2_alpha, z_dummy_target, & z_ix_ref_taylor, z_ix_ele_taylor, z_n_alias, z_cmd_file_level, z_ix_key_bank, & z_n_universes, z_default_universe, z_default_branch, z_ix_history, z_n_history, & z_cmd_file_paused, z_use_cmd_here, z_multi_commands_here, z_cmd_from_cmd_file, & z_use_saved_beam_in_tracking, z_single_mode, z_combine_consecutive_elements_of_like_name, & z_common_lattice, z_init_beam, z_init_var, z_init_read_lat_info, z_init_data, & z_parse_cmd_args, z_optimizer_running, z_have_datums_using_expressions, z_noplot_arg_set, & z_init_tao_file_arg_set, z_log_startup, z_print_to_terminal, z_cmd, z_init_name, & z_lat_file, z_init_tao_file, z_init_tao_file_path, z_beam_file, z_beam_all_file, & z_beam0_file, z_data_file, z_plot_file, z_startup_file, z_var_file, z_building_wall_file, & z_hook_init_file, z_plot_geometry, z_single_mode_buffer, z_unique_name_suffix, & z_valid_plot_who) bind(c) implicit none type(c_ptr), value :: Fp type(tao_common_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name type(tao_universe_struct), pointer :: f_u_working real(c_double), pointer :: f_covar(:), f_alpha(:) type(c_ptr) :: z_alias(*), z_key(*), z_cmd_file(*), z_valid_plot_who(*) integer(c_int), value :: n_u_working, n1_cmd_file, n1_covar, n2_covar, n1_alpha, n2_alpha character(c_char), pointer :: f_valid_plot_who integer(c_int) :: z_ix_ref_taylor, z_ix_ele_taylor, z_n_alias, z_cmd_file_level, z_ix_key_bank, z_n_universes, z_default_universe integer(c_int) :: z_default_branch, z_ix_history, z_n_history character(c_char) :: z_cmd(*), z_init_name(*), z_lat_file(*), z_init_tao_file(*), z_init_tao_file_path(*), z_beam_file(*), z_beam_all_file(*) character(c_char) :: z_beam0_file(*), z_data_file(*), z_plot_file(*), z_startup_file(*), z_var_file(*), z_building_wall_file(*), z_hook_init_file(*) character(c_char) :: z_plot_geometry(*), z_single_mode_buffer(*), z_unique_name_suffix(*) logical(c_bool) :: z_cmd_file_paused, z_use_cmd_here, z_multi_commands_here, z_cmd_from_cmd_file, z_use_saved_beam_in_tracking, z_single_mode, z_combine_consecutive_elements_of_like_name logical(c_bool) :: z_common_lattice, z_init_beam, z_init_var, z_init_read_lat_info, z_init_data, z_parse_cmd_args, z_optimizer_running logical(c_bool) :: z_have_datums_using_expressions, z_noplot_arg_set, z_init_tao_file_arg_set, z_log_startup, z_print_to_terminal real(c_double) :: z_dummy_target type(c_ptr), value :: z_u_working, z_covar, z_alpha call c_f_pointer (Fp, F) !! f_side.to_f2_trans[type, 1, NOT] do jd1 = 1, size(F%alias,1); lb1 = lbound(F%alias,1) - 1 call tao_alias_to_f(z_alias(jd1), c_loc(F%alias(jd1+lb1))) enddo !! f_side.to_f2_trans[type, 1, NOT] do jd1 = 1, size(F%key,1); lb1 = lbound(F%key,1) - 1 call tao_alias_to_f(z_key(jd1), c_loc(F%key(jd1+lb1))) enddo !! f_side.to_f2_trans[type, 0, PTR] if (n_u_working == 0) then if (associated(F%u_working)) deallocate(F%u_working) else if (.not. associated(F%u_working)) allocate(F%u_working) call tao_universe_to_f (z_u_working, c_loc(F%u_working)) endif !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_cmd_file == 0) then if (allocated(F%cmd_file)) deallocate(F%cmd_file) else if (allocated(F%cmd_file)) then if (n1_cmd_file == 0 .or. any(shape(F%cmd_file) /= [n1_cmd_file])) deallocate(F%cmd_file) if (any(lbound(F%cmd_file) /= 1)) deallocate(F%cmd_file) endif if (.not. allocated(F%cmd_file)) allocate(F%cmd_file(1:n1_cmd_file+1-1)) do jd1 = 1, n1_cmd_file call tao_command_file_to_f (z_cmd_file(jd1), c_loc(F%cmd_file(jd1+1-1))) enddo endif !! f_side.to_f2_trans[real, 2, ALLOC] if (allocated(F%covar)) then if (n1_covar == 0 .or. any(shape(F%covar) /= [n1_covar, n2_covar])) deallocate(F%covar) if (any(lbound(F%covar) /= 1)) deallocate(F%covar) endif if (n1_covar /= 0) then call c_f_pointer (z_covar, f_covar, [n1_covar*n2_covar]) if (.not. allocated(F%covar)) allocate(F%covar(n1_covar, n2_covar)) call vec2mat(f_covar, F%covar) else if (allocated(F%covar)) deallocate(F%covar) endif !! f_side.to_f2_trans[real, 2, ALLOC] if (allocated(F%alpha)) then if (n1_alpha == 0 .or. any(shape(F%alpha) /= [n1_alpha, n2_alpha])) deallocate(F%alpha) if (any(lbound(F%alpha) /= 1)) deallocate(F%alpha) endif if (n1_alpha /= 0) then call c_f_pointer (z_alpha, f_alpha, [n1_alpha*n2_alpha]) if (.not. allocated(F%alpha)) allocate(F%alpha(n1_alpha, n2_alpha)) call vec2mat(f_alpha, F%alpha) else if (allocated(F%alpha)) deallocate(F%alpha) endif !! f_side.to_f2_trans[real, 0, NOT] F%dummy_target = z_dummy_target !! f_side.to_f2_trans[integer, 0, NOT] F%ix_ref_taylor = z_ix_ref_taylor !! f_side.to_f2_trans[integer, 0, NOT] F%ix_ele_taylor = z_ix_ele_taylor !! f_side.to_f2_trans[integer, 0, NOT] F%n_alias = z_n_alias !! f_side.to_f2_trans[integer, 0, NOT] F%cmd_file_level = z_cmd_file_level !! f_side.to_f2_trans[integer, 0, NOT] F%ix_key_bank = z_ix_key_bank !! f_side.to_f2_trans[integer, 0, NOT] F%n_universes = z_n_universes !! f_side.to_f2_trans[integer, 0, NOT] F%default_universe = z_default_universe !! f_side.to_f2_trans[integer, 0, NOT] F%default_branch = z_default_branch !! f_side.to_f2_trans[integer, 0, NOT] F%ix_history = z_ix_history !! f_side.to_f2_trans[integer, 0, NOT] F%n_history = z_n_history !! f_side.to_f2_trans[logical, 0, NOT] F%cmd_file_paused = f_logic(z_cmd_file_paused) !! f_side.to_f2_trans[logical, 0, NOT] F%use_cmd_here = f_logic(z_use_cmd_here) !! f_side.to_f2_trans[logical, 0, NOT] F%multi_commands_here = f_logic(z_multi_commands_here) !! f_side.to_f2_trans[logical, 0, NOT] F%cmd_from_cmd_file = f_logic(z_cmd_from_cmd_file) !! f_side.to_f2_trans[logical, 0, NOT] F%use_saved_beam_in_tracking = f_logic(z_use_saved_beam_in_tracking) !! f_side.to_f2_trans[logical, 0, NOT] F%single_mode = f_logic(z_single_mode) !! f_side.to_f2_trans[logical, 0, NOT] F%combine_consecutive_elements_of_like_name = f_logic(z_combine_consecutive_elements_of_like_name) !! f_side.to_f2_trans[logical, 0, NOT] F%common_lattice = f_logic(z_common_lattice) !! f_side.to_f2_trans[logical, 0, NOT] F%init_beam = f_logic(z_init_beam) !! f_side.to_f2_trans[logical, 0, NOT] F%init_var = f_logic(z_init_var) !! f_side.to_f2_trans[logical, 0, NOT] F%init_read_lat_info = f_logic(z_init_read_lat_info) !! f_side.to_f2_trans[logical, 0, NOT] F%init_data = f_logic(z_init_data) !! f_side.to_f2_trans[logical, 0, NOT] F%parse_cmd_args = f_logic(z_parse_cmd_args) !! f_side.to_f2_trans[logical, 0, NOT] F%optimizer_running = f_logic(z_optimizer_running) !! f_side.to_f2_trans[logical, 0, NOT] F%have_datums_using_expressions = f_logic(z_have_datums_using_expressions) !! f_side.to_f2_trans[logical, 0, NOT] F%noplot_arg_set = f_logic(z_noplot_arg_set) !! f_side.to_f2_trans[logical, 0, NOT] F%init_tao_file_arg_set = f_logic(z_init_tao_file_arg_set) !! f_side.to_f2_trans[logical, 0, NOT] F%log_startup = f_logic(z_log_startup) !! f_side.to_f2_trans[logical, 0, NOT] F%print_to_terminal = f_logic(z_print_to_terminal) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_cmd, F%cmd) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_init_name, F%init_name) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_lat_file, F%lat_file) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_init_tao_file, F%init_tao_file) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_init_tao_file_path, F%init_tao_file_path) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_beam_file, F%beam_file) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_beam_all_file, F%beam_all_file) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_beam0_file, F%beam0_file) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_data_file, F%data_file) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_plot_file, F%plot_file) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_startup_file, F%startup_file) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_var_file, F%var_file) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_building_wall_file, F%building_wall_file) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_hook_init_file, F%hook_init_file) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_plot_geometry, F%plot_geometry) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_single_mode_buffer, F%single_mode_buffer) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_unique_name_suffix, F%unique_name_suffix) !! f_side.to_f2_trans[character, 1, NOT] do jd1 = 1, size(F%valid_plot_who,1); lb1 = lbound(F%valid_plot_who,1) - 1 call c_f_pointer (z_valid_plot_who(jd1), f_valid_plot_who) call to_f_str(f_valid_plot_who, F%valid_plot_who(jd1+lb1)) enddo end subroutine tao_common_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_lat_mode_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_lat_mode_struct to a C++ CPP_tao_lat_mode structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_lat_mode_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_lat_mode struct. !- subroutine tao_lat_mode_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_lat_mode_to_c2 (C, z_chrom, z_growth_rate) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C real(c_double) :: z_chrom, z_growth_rate end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_lat_mode_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call tao_lat_mode_to_c2 (C, F%chrom, F%growth_rate) end subroutine tao_lat_mode_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_lat_mode_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_lat_mode structure to a Tao tao_lat_mode_struct structure. ! This routine is called by tao_lat_mode_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_lat_mode_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_lat_mode_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_lat_mode_to_f2 (Fp, z_chrom, z_growth_rate) bind(c) implicit none type(c_ptr), value :: Fp type(tao_lat_mode_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name real(c_double) :: z_chrom, z_growth_rate call c_f_pointer (Fp, F) !! f_side.to_f2_trans[real, 0, NOT] F%chrom = z_chrom !! f_side.to_f2_trans[real, 0, NOT] F%growth_rate = z_growth_rate end subroutine tao_lat_mode_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_sigma_mat_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_sigma_mat_struct to a C++ CPP_tao_sigma_mat structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_sigma_mat_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_sigma_mat struct. !- subroutine tao_sigma_mat_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_sigma_mat_to_c2 (C, z_sigma) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C real(c_double) :: z_sigma(*) end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_sigma_mat_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call tao_sigma_mat_to_c2 (C, mat2vec(F%sigma, 6*6)) end subroutine tao_sigma_mat_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_sigma_mat_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_sigma_mat structure to a Tao tao_sigma_mat_struct structure. ! This routine is called by tao_sigma_mat_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_sigma_mat_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_sigma_mat_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_sigma_mat_to_f2 (Fp, z_sigma) bind(c) implicit none type(c_ptr), value :: Fp type(tao_sigma_mat_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name real(c_double) :: z_sigma(*) call c_f_pointer (Fp, F) !! f_side.to_f2_trans[real, 2, NOT] call vec2mat(z_sigma, F%sigma) end subroutine tao_sigma_mat_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_lattice_branch_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_lattice_branch_struct to a C++ CPP_tao_lattice_branch structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_lattice_branch_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_lattice_branch struct. !- subroutine tao_lattice_branch_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_lattice_branch_to_c2 (C, z_bunch_params, n1_bunch_params, z_linear, n1_linear, & z_orbit, n1_orbit, z_orb0, z_high_e_lat, z_low_e_lat, z_track_state, & z_has_open_match_element, z_modes, z_rad_int, z_a, z_b, z_ix_rad_int_cache, & z_modes_rf_on, z_rad_int_rf_on) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C integer(c_int) :: z_track_state, z_ix_rad_int_cache logical(c_bool) :: z_has_open_match_element type(c_ptr) :: z_bunch_params(*), z_linear(*), z_orbit(*) integer(c_int), value :: n1_bunch_params, n1_linear, n1_orbit type(c_ptr), value :: z_orb0, z_high_e_lat, z_low_e_lat, z_modes, z_rad_int, z_a, z_b type(c_ptr), value :: z_modes_rf_on, z_rad_int_rf_on end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_lattice_branch_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var type(c_ptr), allocatable :: z_bunch_params(:) integer(c_int) :: n1_bunch_params type(c_ptr), allocatable :: z_linear(:) integer(c_int) :: n1_linear type(c_ptr), allocatable :: z_orbit(:) integer(c_int) :: n1_orbit ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 1, ALLOC] n1_bunch_params = 0 if (allocated(F%bunch_params)) then n1_bunch_params = size(F%bunch_params); lb1 = lbound(F%bunch_params, 1) - 1 allocate (z_bunch_params(n1_bunch_params)) do jd1 = 1, n1_bunch_params z_bunch_params(jd1) = c_loc(F%bunch_params(jd1+lb1)) enddo endif !! f_side.to_c_trans[type, 1, ALLOC] n1_linear = 0 if (allocated(F%linear)) then n1_linear = size(F%linear); lb1 = lbound(F%linear, 1) - 1 allocate (z_linear(n1_linear)) do jd1 = 1, n1_linear z_linear(jd1) = c_loc(F%linear(jd1+lb1)) enddo endif !! f_side.to_c_trans[type, 1, ALLOC] n1_orbit = 0 if (allocated(F%orbit)) then n1_orbit = size(F%orbit); lb1 = lbound(F%orbit, 1) - 1 allocate (z_orbit(n1_orbit)) do jd1 = 1, n1_orbit z_orbit(jd1) = c_loc(F%orbit(jd1+lb1)) enddo endif !! f_side.to_c2_call call tao_lattice_branch_to_c2 (C, z_bunch_params, n1_bunch_params, z_linear, n1_linear, & z_orbit, n1_orbit, c_loc(F%orb0), c_loc(F%high_e_lat), c_loc(F%low_e_lat), F%track_state, & c_logic(F%has_open_match_element), c_loc(F%modes), c_loc(F%rad_int), c_loc(F%a), & c_loc(F%b), F%ix_rad_int_cache, c_loc(F%modes_rf_on), c_loc(F%rad_int_rf_on)) end subroutine tao_lattice_branch_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_lattice_branch_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_lattice_branch structure to a Tao tao_lattice_branch_struct structure. ! This routine is called by tao_lattice_branch_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_lattice_branch_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_lattice_branch_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_lattice_branch_to_f2 (Fp, z_bunch_params, n1_bunch_params, z_linear, n1_linear, & z_orbit, n1_orbit, z_orb0, z_high_e_lat, z_low_e_lat, z_track_state, & z_has_open_match_element, z_modes, z_rad_int, z_a, z_b, z_ix_rad_int_cache, z_modes_rf_on, & z_rad_int_rf_on) bind(c) implicit none type(c_ptr), value :: Fp type(tao_lattice_branch_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name integer(c_int) :: z_track_state, z_ix_rad_int_cache logical(c_bool) :: z_has_open_match_element type(c_ptr) :: z_bunch_params(*), z_linear(*), z_orbit(*) integer(c_int), value :: n1_bunch_params, n1_linear, n1_orbit type(c_ptr), value :: z_orb0, z_high_e_lat, z_low_e_lat, z_modes, z_rad_int, z_a, z_b type(c_ptr), value :: z_modes_rf_on, z_rad_int_rf_on call c_f_pointer (Fp, F) !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_bunch_params == 0) then if (allocated(F%bunch_params)) deallocate(F%bunch_params) else if (allocated(F%bunch_params)) then if (n1_bunch_params == 0 .or. any(shape(F%bunch_params) /= [n1_bunch_params])) deallocate(F%bunch_params) if (any(lbound(F%bunch_params) /= 1)) deallocate(F%bunch_params) endif if (.not. allocated(F%bunch_params)) allocate(F%bunch_params(1:n1_bunch_params+1-1)) do jd1 = 1, n1_bunch_params call bunch_params_to_f (z_bunch_params(jd1), c_loc(F%bunch_params(jd1+1-1))) enddo endif !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_linear == 0) then if (allocated(F%linear)) deallocate(F%linear) else if (allocated(F%linear)) then if (n1_linear == 0 .or. any(shape(F%linear) /= [n1_linear])) deallocate(F%linear) if (any(lbound(F%linear) /= 1)) deallocate(F%linear) endif if (.not. allocated(F%linear)) allocate(F%linear(1:n1_linear+1-1)) do jd1 = 1, n1_linear call tao_sigma_mat_to_f (z_linear(jd1), c_loc(F%linear(jd1+1-1))) enddo endif !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_orbit == 0) then if (allocated(F%orbit)) deallocate(F%orbit) else if (allocated(F%orbit)) then if (n1_orbit == 0 .or. any(shape(F%orbit) /= [n1_orbit])) deallocate(F%orbit) if (any(lbound(F%orbit) /= 1)) deallocate(F%orbit) endif if (.not. allocated(F%orbit)) allocate(F%orbit(1:n1_orbit+1-1)) do jd1 = 1, n1_orbit call coord_to_f (z_orbit(jd1), c_loc(F%orbit(jd1+1-1))) enddo endif !! f_side.to_f2_trans[type, 0, NOT] call coord_to_f(z_orb0, c_loc(F%orb0)) !! f_side.to_f2_trans[type, 0, NOT] call lat_to_f(z_high_e_lat, c_loc(F%high_e_lat)) !! f_side.to_f2_trans[type, 0, NOT] call lat_to_f(z_low_e_lat, c_loc(F%low_e_lat)) !! f_side.to_f2_trans[integer, 0, NOT] F%track_state = z_track_state !! f_side.to_f2_trans[logical, 0, NOT] F%has_open_match_element = f_logic(z_has_open_match_element) !! f_side.to_f2_trans[type, 0, NOT] call normal_modes_to_f(z_modes, c_loc(F%modes)) !! f_side.to_f2_trans[type, 0, NOT] call rad_int_all_ele_to_f(z_rad_int, c_loc(F%rad_int)) !! f_side.to_f2_trans[type, 0, NOT] call tao_lat_mode_to_f(z_a, c_loc(F%a)) !! f_side.to_f2_trans[type, 0, NOT] call tao_lat_mode_to_f(z_b, c_loc(F%b)) !! f_side.to_f2_trans[integer, 0, NOT] F%ix_rad_int_cache = z_ix_rad_int_cache !! f_side.to_f2_trans[type, 0, NOT] call normal_modes_to_f(z_modes_rf_on, c_loc(F%modes_rf_on)) !! f_side.to_f2_trans[type, 0, NOT] call rad_int_all_ele_to_f(z_rad_int_rf_on, c_loc(F%rad_int_rf_on)) end subroutine tao_lattice_branch_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_lattice_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_lattice_struct to a C++ CPP_tao_lattice structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_lattice_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_lattice struct. !- subroutine tao_lattice_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_lattice_to_c2 (C, z_lat, z_tao_branch, n1_tao_branch) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C type(c_ptr) :: z_tao_branch(*) integer(c_int), value :: n1_tao_branch type(c_ptr), value :: z_lat end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_lattice_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var type(c_ptr), allocatable :: z_tao_branch(:) integer(c_int) :: n1_tao_branch ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 1, ALLOC] n1_tao_branch = 0 if (allocated(F%tao_branch)) then n1_tao_branch = size(F%tao_branch); lb1 = lbound(F%tao_branch, 1) - 1 allocate (z_tao_branch(n1_tao_branch)) do jd1 = 1, n1_tao_branch z_tao_branch(jd1) = c_loc(F%tao_branch(jd1+lb1)) enddo endif !! f_side.to_c2_call call tao_lattice_to_c2 (C, c_loc(F%lat), z_tao_branch, n1_tao_branch) end subroutine tao_lattice_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_lattice_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_lattice structure to a Tao tao_lattice_struct structure. ! This routine is called by tao_lattice_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_lattice_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_lattice_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_lattice_to_f2 (Fp, z_lat, z_tao_branch, n1_tao_branch) bind(c) implicit none type(c_ptr), value :: Fp type(tao_lattice_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name type(c_ptr) :: z_tao_branch(*) integer(c_int), value :: n1_tao_branch type(c_ptr), value :: z_lat call c_f_pointer (Fp, F) !! f_side.to_f2_trans[type, 0, NOT] call lat_to_f(z_lat, c_loc(F%lat)) !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_tao_branch == 0) then if (allocated(F%tao_branch)) deallocate(F%tao_branch) else if (allocated(F%tao_branch)) then if (n1_tao_branch == 0 .or. any(shape(F%tao_branch) /= [n1_tao_branch])) deallocate(F%tao_branch) if (any(lbound(F%tao_branch) /= 1)) deallocate(F%tao_branch) endif if (.not. allocated(F%tao_branch)) allocate(F%tao_branch(1:n1_tao_branch+1-1)) do jd1 = 1, n1_tao_branch call tao_lattice_branch_to_f (z_tao_branch(jd1), c_loc(F%tao_branch(jd1+1-1))) enddo endif end subroutine tao_lattice_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_element_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_element_struct to a C++ CPP_tao_element structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_element_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_element struct. !- subroutine tao_element_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_element_to_c2 (C, z_beam, z_save_beam) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C logical(c_bool) :: z_save_beam type(c_ptr), value :: z_beam end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_element_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call tao_element_to_c2 (C, c_loc(F%beam), c_logic(F%save_beam)) end subroutine tao_element_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_element_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_element structure to a Tao tao_element_struct structure. ! This routine is called by tao_element_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_element_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_element_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_element_to_f2 (Fp, z_beam, z_save_beam) bind(c) implicit none type(c_ptr), value :: Fp type(tao_element_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name logical(c_bool) :: z_save_beam type(c_ptr), value :: z_beam call c_f_pointer (Fp, F) !! f_side.to_f2_trans[type, 0, NOT] call beam_to_f(z_beam, c_loc(F%beam)) !! f_side.to_f2_trans[logical, 0, NOT] F%save_beam = f_logic(z_save_beam) end subroutine tao_element_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_ping_scale_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_ping_scale_struct to a C++ CPP_tao_ping_scale structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_ping_scale_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_ping_scale struct. !- subroutine tao_ping_scale_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_ping_scale_to_c2 (C, z_a_mode_meas, z_a_mode_ref, z_b_mode_meas, z_b_mode_ref) & bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C real(c_double) :: z_a_mode_meas, z_a_mode_ref, z_b_mode_meas, z_b_mode_ref end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_ping_scale_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call tao_ping_scale_to_c2 (C, F%a_mode_meas, F%a_mode_ref, F%b_mode_meas, F%b_mode_ref) end subroutine tao_ping_scale_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_ping_scale_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_ping_scale structure to a Tao tao_ping_scale_struct structure. ! This routine is called by tao_ping_scale_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_ping_scale_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_ping_scale_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_ping_scale_to_f2 (Fp, z_a_mode_meas, z_a_mode_ref, z_b_mode_meas, z_b_mode_ref) & bind(c) implicit none type(c_ptr), value :: Fp type(tao_ping_scale_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name real(c_double) :: z_a_mode_meas, z_a_mode_ref, z_b_mode_meas, z_b_mode_ref call c_f_pointer (Fp, F) !! f_side.to_f2_trans[real, 0, NOT] F%a_mode_meas = z_a_mode_meas !! f_side.to_f2_trans[real, 0, NOT] F%a_mode_ref = z_a_mode_ref !! f_side.to_f2_trans[real, 0, NOT] F%b_mode_meas = z_b_mode_meas !! f_side.to_f2_trans[real, 0, NOT] F%b_mode_ref = z_b_mode_ref end subroutine tao_ping_scale_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_universe_branch_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_universe_branch_struct to a C++ CPP_tao_universe_branch structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_universe_branch_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_universe_branch struct. !- subroutine tao_universe_branch_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_universe_branch_to_c2 (C, z_ele, n1_ele, z_track_start, z_track_end, & z_ix_track_start, z_ix_track_end) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_track_start(*), z_track_end(*) integer(c_int) :: z_ix_track_start, z_ix_track_end type(c_ptr) :: z_ele(*) integer(c_int), value :: n1_ele end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_universe_branch_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var type(c_ptr), allocatable :: z_ele(:) integer(c_int) :: n1_ele ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 1, ALLOC] n1_ele = 0 if (allocated(F%ele)) then n1_ele = size(F%ele); lb1 = lbound(F%ele, 1) - 1 allocate (z_ele(n1_ele)) do jd1 = 1, n1_ele z_ele(jd1) = c_loc(F%ele(jd1+lb1)) enddo endif !! f_side.to_c2_call call tao_universe_branch_to_c2 (C, z_ele, n1_ele, trim(F%track_start) // c_null_char, & trim(F%track_end) // c_null_char, F%ix_track_start, F%ix_track_end) end subroutine tao_universe_branch_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_universe_branch_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_universe_branch structure to a Tao tao_universe_branch_struct structure. ! This routine is called by tao_universe_branch_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_universe_branch_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_universe_branch_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_universe_branch_to_f2 (Fp, z_ele, n1_ele, z_track_start, z_track_end, & z_ix_track_start, z_ix_track_end) bind(c) implicit none type(c_ptr), value :: Fp type(tao_universe_branch_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_track_start(*), z_track_end(*) integer(c_int) :: z_ix_track_start, z_ix_track_end type(c_ptr) :: z_ele(*) integer(c_int), value :: n1_ele call c_f_pointer (Fp, F) !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_ele == 0) then if (allocated(F%ele)) deallocate(F%ele) else if (allocated(F%ele)) then if (n1_ele == 0 .or. any(shape(F%ele) /= [n1_ele])) deallocate(F%ele) if (any(lbound(F%ele) /= 1)) deallocate(F%ele) endif if (.not. allocated(F%ele)) allocate(F%ele(1:n1_ele+1-1)) do jd1 = 1, n1_ele call tao_element_to_f (z_ele(jd1), c_loc(F%ele(jd1+1-1))) enddo endif !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_track_start, F%track_start) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_track_end, F%track_end) !! f_side.to_f2_trans[integer, 0, NOT] F%ix_track_start = z_ix_track_start !! f_side.to_f2_trans[integer, 0, NOT] F%ix_track_end = z_ix_track_end end subroutine tao_universe_branch_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_beam_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_beam_struct to a C++ CPP_tao_beam structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_beam_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_beam struct. !- subroutine tao_beam_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_beam_to_c2 (C, z_beam_init, z_start, z_init_beam0, z_beam_all_file, & z_beam0_file, z_saved_at) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_beam_all_file(*), z_beam0_file(*), z_saved_at(*) logical(c_bool) :: z_init_beam0 type(c_ptr), value :: z_beam_init, z_start end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_beam_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call tao_beam_to_c2 (C, c_loc(F%beam_init), c_loc(F%start), c_logic(F%init_beam0), & trim(F%beam_all_file) // c_null_char, trim(F%beam0_file) // c_null_char, trim(F%saved_at) & // c_null_char) end subroutine tao_beam_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_beam_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_beam structure to a Tao tao_beam_struct structure. ! This routine is called by tao_beam_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_beam_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_beam_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_beam_to_f2 (Fp, z_beam_init, z_start, z_init_beam0, z_beam_all_file, & z_beam0_file, z_saved_at) bind(c) implicit none type(c_ptr), value :: Fp type(tao_beam_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_beam_all_file(*), z_beam0_file(*), z_saved_at(*) logical(c_bool) :: z_init_beam0 type(c_ptr), value :: z_beam_init, z_start call c_f_pointer (Fp, F) !! f_side.to_f2_trans[type, 0, NOT] call beam_init_to_f(z_beam_init, c_loc(F%beam_init)) !! f_side.to_f2_trans[type, 0, NOT] call beam_to_f(z_start, c_loc(F%start)) !! f_side.to_f2_trans[logical, 0, NOT] F%init_beam0 = f_logic(z_init_beam0) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_beam_all_file, F%beam_all_file) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_beam0_file, F%beam0_file) !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_saved_at, F%saved_at) end subroutine tao_beam_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_universe_calc_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_universe_calc_struct to a C++ CPP_tao_universe_calc structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_universe_calc_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_universe_calc struct. !- subroutine tao_universe_calc_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_universe_calc_to_c2 (C, z_rad_int_for_data, z_rad_int_for_plotting, & z_chrom_for_data, z_chrom_for_plotting, z_beam_sigma_for_data, z_beam_sigma_for_plotting, & z_dynamic_aperture, z_one_turn_map, z_lattice, z_mat6, z_track) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C logical(c_bool) :: z_rad_int_for_data, z_rad_int_for_plotting, z_chrom_for_data, z_chrom_for_plotting, z_beam_sigma_for_data, z_beam_sigma_for_plotting, z_dynamic_aperture logical(c_bool) :: z_one_turn_map, z_lattice, z_mat6, z_track end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_universe_calc_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call tao_universe_calc_to_c2 (C, c_logic(F%rad_int_for_data), c_logic(F%rad_int_for_plotting), & c_logic(F%chrom_for_data), c_logic(F%chrom_for_plotting), c_logic(F%beam_sigma_for_data), & c_logic(F%beam_sigma_for_plotting), c_logic(F%dynamic_aperture), c_logic(F%one_turn_map), & c_logic(F%lattice), c_logic(F%mat6), c_logic(F%track)) end subroutine tao_universe_calc_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_universe_calc_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_universe_calc structure to a Tao tao_universe_calc_struct structure. ! This routine is called by tao_universe_calc_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_universe_calc_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_universe_calc_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_universe_calc_to_f2 (Fp, z_rad_int_for_data, z_rad_int_for_plotting, & z_chrom_for_data, z_chrom_for_plotting, z_beam_sigma_for_data, z_beam_sigma_for_plotting, & z_dynamic_aperture, z_one_turn_map, z_lattice, z_mat6, z_track) bind(c) implicit none type(c_ptr), value :: Fp type(tao_universe_calc_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name logical(c_bool) :: z_rad_int_for_data, z_rad_int_for_plotting, z_chrom_for_data, z_chrom_for_plotting, z_beam_sigma_for_data, z_beam_sigma_for_plotting, z_dynamic_aperture logical(c_bool) :: z_one_turn_map, z_lattice, z_mat6, z_track call c_f_pointer (Fp, F) !! f_side.to_f2_trans[logical, 0, NOT] F%rad_int_for_data = f_logic(z_rad_int_for_data) !! f_side.to_f2_trans[logical, 0, NOT] F%rad_int_for_plotting = f_logic(z_rad_int_for_plotting) !! f_side.to_f2_trans[logical, 0, NOT] F%chrom_for_data = f_logic(z_chrom_for_data) !! f_side.to_f2_trans[logical, 0, NOT] F%chrom_for_plotting = f_logic(z_chrom_for_plotting) !! f_side.to_f2_trans[logical, 0, NOT] F%beam_sigma_for_data = f_logic(z_beam_sigma_for_data) !! f_side.to_f2_trans[logical, 0, NOT] F%beam_sigma_for_plotting = f_logic(z_beam_sigma_for_plotting) !! f_side.to_f2_trans[logical, 0, NOT] F%dynamic_aperture = f_logic(z_dynamic_aperture) !! f_side.to_f2_trans[logical, 0, NOT] F%one_turn_map = f_logic(z_one_turn_map) !! f_side.to_f2_trans[logical, 0, NOT] F%lattice = f_logic(z_lattice) !! f_side.to_f2_trans[logical, 0, NOT] F%mat6 = f_logic(z_mat6) !! f_side.to_f2_trans[logical, 0, NOT] F%track = f_logic(z_track) end subroutine tao_universe_calc_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_mpi_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_mpi_struct to a C++ CPP_tao_mpi structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_mpi_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_mpi struct. !- subroutine tao_mpi_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_mpi_to_c2 (C, z_on, z_master, z_rank, z_max_rank, z_host_name) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C character(c_char) :: z_host_name(*) integer(c_int) :: z_rank, z_max_rank logical(c_bool) :: z_on, z_master end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_mpi_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var ! call c_f_pointer (Fp, F) !! f_side.to_c2_call call tao_mpi_to_c2 (C, c_logic(F%on), c_logic(F%master), F%rank, F%max_rank, trim(F%host_name) & // c_null_char) end subroutine tao_mpi_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_mpi_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_mpi structure to a Tao tao_mpi_struct structure. ! This routine is called by tao_mpi_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_mpi_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_mpi_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_mpi_to_f2 (Fp, z_on, z_master, z_rank, z_max_rank, z_host_name) bind(c) implicit none type(c_ptr), value :: Fp type(tao_mpi_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name character(c_char) :: z_host_name(*) integer(c_int) :: z_rank, z_max_rank logical(c_bool) :: z_on, z_master call c_f_pointer (Fp, F) !! f_side.to_f2_trans[logical, 0, NOT] F%on = f_logic(z_on) !! f_side.to_f2_trans[logical, 0, NOT] F%master = f_logic(z_master) !! f_side.to_f2_trans[integer, 0, NOT] F%rank = z_rank !! f_side.to_f2_trans[integer, 0, NOT] F%max_rank = z_max_rank !! f_side.to_f2_trans[character, 0, NOT] call to_f_str(z_host_name, F%host_name) end subroutine tao_mpi_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_dynamic_aperture_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_dynamic_aperture_struct to a C++ CPP_tao_dynamic_aperture structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_dynamic_aperture_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_dynamic_aperture struct. !- subroutine tao_dynamic_aperture_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_dynamic_aperture_to_c2 (C, z_scan, n1_scan, z_pz, n1_pz) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C type(c_ptr) :: z_scan(*) integer(c_int), value :: n1_scan, n1_pz real(c_double) :: z_pz(*) end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_dynamic_aperture_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var type(c_ptr), allocatable :: z_scan(:) integer(c_int) :: n1_scan integer(c_int) :: n1_pz ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 1, ALLOC] n1_scan = 0 if (allocated(F%scan)) then n1_scan = size(F%scan); lb1 = lbound(F%scan, 1) - 1 allocate (z_scan(n1_scan)) do jd1 = 1, n1_scan z_scan(jd1) = c_loc(F%scan(jd1+lb1)) enddo endif !! f_side.to_c_trans[real, 1, ALLOC] n1_pz = 0 if (allocated(F%pz)) then n1_pz = size(F%pz, 1) endif !! f_side.to_c2_call call tao_dynamic_aperture_to_c2 (C, z_scan, n1_scan, fvec2vec(F%pz, n1_pz), n1_pz) end subroutine tao_dynamic_aperture_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_dynamic_aperture_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_dynamic_aperture structure to a Tao tao_dynamic_aperture_struct structure. ! This routine is called by tao_dynamic_aperture_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_dynamic_aperture_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_dynamic_aperture_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_dynamic_aperture_to_f2 (Fp, z_scan, n1_scan, z_pz, n1_pz) bind(c) implicit none type(c_ptr), value :: Fp type(tao_dynamic_aperture_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name real(c_double), pointer :: f_pz(:) type(c_ptr) :: z_scan(*) integer(c_int), value :: n1_scan, n1_pz type(c_ptr), value :: z_pz call c_f_pointer (Fp, F) !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_scan == 0) then if (allocated(F%scan)) deallocate(F%scan) else if (allocated(F%scan)) then if (n1_scan == 0 .or. any(shape(F%scan) /= [n1_scan])) deallocate(F%scan) if (any(lbound(F%scan) /= 1)) deallocate(F%scan) endif if (.not. allocated(F%scan)) allocate(F%scan(1:n1_scan+1-1)) do jd1 = 1, n1_scan call aperture_scan_to_f (z_scan(jd1), c_loc(F%scan(jd1+1-1))) enddo endif !! f_side.to_f2_trans[real, 1, ALLOC] if (allocated(F%pz)) then if (n1_pz == 0 .or. any(shape(F%pz) /= [n1_pz])) deallocate(F%pz) if (any(lbound(F%pz) /= 1)) deallocate(F%pz) endif if (n1_pz /= 0) then call c_f_pointer (z_pz, f_pz, [n1_pz]) if (.not. allocated(F%pz)) allocate(F%pz(n1_pz)) F%pz = f_pz(1:n1_pz) else if (allocated(F%pz)) deallocate(F%pz) endif end subroutine tao_dynamic_aperture_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_universe_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_universe_struct to a C++ CPP_tao_universe structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_universe_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_universe struct. !- subroutine tao_universe_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_universe_to_c2 (C, z_common, n_common, z_model, n_model, z_design, n_design, & z_base, n_base, z_beam, z_dynamic_aperture, z_uni_branch, n1_uni_branch, z_d2_data, & n1_d2_data, z_data, n1_data, z_ping_scale, z_scratch_lat, z_calc, z_dmodel_dvar, & n1_dmodel_dvar, n2_dmodel_dvar, z_ix_uni, z_n_d2_data_used, z_n_data_used, & z_reverse_tracking, z_is_on, z_picked_uni) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C integer(c_int) :: z_ix_uni, z_n_d2_data_used, z_n_data_used type(c_ptr) :: z_uni_branch(*), z_d2_data(*), z_data(*) integer(c_int), value :: n_common, n_model, n_design, n_base, n1_uni_branch, n1_d2_data, n1_data integer(c_int), value :: n1_dmodel_dvar, n2_dmodel_dvar logical(c_bool) :: z_reverse_tracking, z_is_on, z_picked_uni real(c_double) :: z_dmodel_dvar(*) type(c_ptr), value :: z_common, z_model, z_design, z_base, z_beam, z_dynamic_aperture, z_ping_scale type(c_ptr), value :: z_scratch_lat, z_calc end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_universe_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var integer(c_int) :: n_common integer(c_int) :: n_model integer(c_int) :: n_design integer(c_int) :: n_base type(c_ptr), allocatable :: z_uni_branch(:) integer(c_int) :: n1_uni_branch type(c_ptr), allocatable :: z_d2_data(:) integer(c_int) :: n1_d2_data type(c_ptr), allocatable :: z_data(:) integer(c_int) :: n1_data integer(c_int) :: n1_dmodel_dvar integer(c_int) :: n2_dmodel_dvar ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 0, PTR] n_common = 0 if (associated(F%common)) n_common = 1 !! f_side.to_c_trans[type, 0, PTR] n_model = 0 if (associated(F%model)) n_model = 1 !! f_side.to_c_trans[type, 0, PTR] n_design = 0 if (associated(F%design)) n_design = 1 !! f_side.to_c_trans[type, 0, PTR] n_base = 0 if (associated(F%base)) n_base = 1 !! f_side.to_c_trans[type, 1, PTR] n1_uni_branch = 0 if (associated(F%uni_branch)) then n1_uni_branch = size(F%uni_branch); lb1 = lbound(F%uni_branch, 1) - 1 allocate (z_uni_branch(n1_uni_branch)) do jd1 = 1, n1_uni_branch z_uni_branch(jd1) = c_loc(F%uni_branch(jd1+lb1)) enddo endif !! f_side.to_c_trans[type, 1, ALLOC] n1_d2_data = 0 if (allocated(F%d2_data)) then n1_d2_data = size(F%d2_data); lb1 = lbound(F%d2_data, 1) - 1 allocate (z_d2_data(n1_d2_data)) do jd1 = 1, n1_d2_data z_d2_data(jd1) = c_loc(F%d2_data(jd1+lb1)) enddo endif !! f_side.to_c_trans[type, 1, ALLOC] n1_data = 0 if (allocated(F%data)) then n1_data = size(F%data); lb1 = lbound(F%data, 1) - 1 allocate (z_data(n1_data)) do jd1 = 1, n1_data z_data(jd1) = c_loc(F%data(jd1+lb1)) enddo endif !! f_side.to_c_trans[real, 2, ALLOC] if (allocated(F%dmodel_dvar)) then n1_dmodel_dvar = size(F%dmodel_dvar, 1) n2_dmodel_dvar = size(F%dmodel_dvar, 2) else n1_dmodel_dvar = 0; n2_dmodel_dvar = 0 endif !! f_side.to_c2_call call tao_universe_to_c2 (C, c_loc(F%common), n_common, c_loc(F%model), n_model, & c_loc(F%design), n_design, c_loc(F%base), n_base, c_loc(F%beam), c_loc(F%dynamic_aperture), & z_uni_branch, n1_uni_branch, z_d2_data, n1_d2_data, z_data, n1_data, c_loc(F%ping_scale), & c_loc(F%scratch_lat), c_loc(F%calc), mat2vec(F%dmodel_dvar, n1_dmodel_dvar*n2_dmodel_dvar), & n1_dmodel_dvar, n2_dmodel_dvar, F%ix_uni, F%n_d2_data_used, F%n_data_used, & c_logic(F%reverse_tracking), c_logic(F%is_on), c_logic(F%picked_uni)) end subroutine tao_universe_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_universe_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_universe structure to a Tao tao_universe_struct structure. ! This routine is called by tao_universe_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_universe_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_universe_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_universe_to_f2 (Fp, z_common, n_common, z_model, n_model, z_design, n_design, & z_base, n_base, z_beam, z_dynamic_aperture, z_uni_branch, n1_uni_branch, z_d2_data, & n1_d2_data, z_data, n1_data, z_ping_scale, z_scratch_lat, z_calc, z_dmodel_dvar, & n1_dmodel_dvar, n2_dmodel_dvar, z_ix_uni, z_n_d2_data_used, z_n_data_used, & z_reverse_tracking, z_is_on, z_picked_uni) bind(c) implicit none type(c_ptr), value :: Fp type(tao_universe_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name type(tao_universe_struct), pointer :: f_common real(c_double), pointer :: f_dmodel_dvar(:) type(c_ptr) :: z_uni_branch(*), z_d2_data(*), z_data(*) integer(c_int), value :: n_common, n_model, n_design, n_base, n1_uni_branch, n1_d2_data, n1_data integer(c_int), value :: n1_dmodel_dvar, n2_dmodel_dvar integer(c_int) :: z_ix_uni, z_n_d2_data_used, z_n_data_used type(tao_lattice_struct), pointer :: f_model, f_design, f_base logical(c_bool) :: z_reverse_tracking, z_is_on, z_picked_uni type(c_ptr), value :: z_common, z_model, z_design, z_base, z_beam, z_dynamic_aperture, z_ping_scale type(c_ptr), value :: z_scratch_lat, z_calc, z_dmodel_dvar call c_f_pointer (Fp, F) !! f_side.to_f2_trans[type, 0, PTR] if (n_common == 0) then if (associated(F%common)) deallocate(F%common) else if (.not. associated(F%common)) allocate(F%common) call tao_universe_to_f (z_common, c_loc(F%common)) endif !! f_side.to_f2_trans[type, 0, PTR] if (n_model == 0) then if (associated(F%model)) deallocate(F%model) else if (.not. associated(F%model)) allocate(F%model) call tao_lattice_to_f (z_model, c_loc(F%model)) endif !! f_side.to_f2_trans[type, 0, PTR] if (n_design == 0) then if (associated(F%design)) deallocate(F%design) else if (.not. associated(F%design)) allocate(F%design) call tao_lattice_to_f (z_design, c_loc(F%design)) endif !! f_side.to_f2_trans[type, 0, PTR] if (n_base == 0) then if (associated(F%base)) deallocate(F%base) else if (.not. associated(F%base)) allocate(F%base) call tao_lattice_to_f (z_base, c_loc(F%base)) endif !! f_side.to_f2_trans[type, 0, NOT] call tao_beam_to_f(z_beam, c_loc(F%beam)) !! f_side.to_f2_trans[type, 0, NOT] call tao_dynamic_aperture_to_f(z_dynamic_aperture, c_loc(F%dynamic_aperture)) !! f_side.to_f2_trans[type, 1, PTR] if (n1_uni_branch == 0) then if (associated(F%uni_branch)) deallocate(F%uni_branch) else if (associated(F%uni_branch)) then if (n1_uni_branch == 0 .or. any(shape(F%uni_branch) /= [n1_uni_branch])) deallocate(F%uni_branch) if (any(lbound(F%uni_branch) /= 1)) deallocate(F%uni_branch) endif if (.not. associated(F%uni_branch)) allocate(F%uni_branch(1:n1_uni_branch+1-1)) do jd1 = 1, n1_uni_branch call tao_universe_branch_to_f (z_uni_branch(jd1), c_loc(F%uni_branch(jd1+1-1))) enddo endif !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_d2_data == 0) then if (allocated(F%d2_data)) deallocate(F%d2_data) else if (allocated(F%d2_data)) then if (n1_d2_data == 0 .or. any(shape(F%d2_data) /= [n1_d2_data])) deallocate(F%d2_data) if (any(lbound(F%d2_data) /= 1)) deallocate(F%d2_data) endif if (.not. allocated(F%d2_data)) allocate(F%d2_data(1:n1_d2_data+1-1)) do jd1 = 1, n1_d2_data call tao_d2_data_to_f (z_d2_data(jd1), c_loc(F%d2_data(jd1+1-1))) enddo endif !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_data == 0) then if (allocated(F%data)) deallocate(F%data) else if (allocated(F%data)) then if (n1_data == 0 .or. any(shape(F%data) /= [n1_data])) deallocate(F%data) if (any(lbound(F%data) /= 1)) deallocate(F%data) endif if (.not. allocated(F%data)) allocate(F%data(1:n1_data+1-1)) do jd1 = 1, n1_data call tao_data_to_f (z_data(jd1), c_loc(F%data(jd1+1-1))) enddo endif !! f_side.to_f2_trans[type, 0, NOT] call tao_ping_scale_to_f(z_ping_scale, c_loc(F%ping_scale)) !! f_side.to_f2_trans[type, 0, NOT] call lat_to_f(z_scratch_lat, c_loc(F%scratch_lat)) !! f_side.to_f2_trans[type, 0, NOT] call tao_universe_calc_to_f(z_calc, c_loc(F%calc)) !! f_side.to_f2_trans[real, 2, ALLOC] if (allocated(F%dmodel_dvar)) then if (n1_dmodel_dvar == 0 .or. any(shape(F%dmodel_dvar) /= [n1_dmodel_dvar, n2_dmodel_dvar])) deallocate(F%dmodel_dvar) if (any(lbound(F%dmodel_dvar) /= 1)) deallocate(F%dmodel_dvar) endif if (n1_dmodel_dvar /= 0) then call c_f_pointer (z_dmodel_dvar, f_dmodel_dvar, [n1_dmodel_dvar*n2_dmodel_dvar]) if (.not. allocated(F%dmodel_dvar)) allocate(F%dmodel_dvar(n1_dmodel_dvar, n2_dmodel_dvar)) call vec2mat(f_dmodel_dvar, F%dmodel_dvar) else if (allocated(F%dmodel_dvar)) deallocate(F%dmodel_dvar) endif !! f_side.to_f2_trans[integer, 0, NOT] F%ix_uni = z_ix_uni !! f_side.to_f2_trans[integer, 0, NOT] F%n_d2_data_used = z_n_d2_data_used !! f_side.to_f2_trans[integer, 0, NOT] F%n_data_used = z_n_data_used !! f_side.to_f2_trans[logical, 0, NOT] F%reverse_tracking = f_logic(z_reverse_tracking) !! f_side.to_f2_trans[logical, 0, NOT] F%is_on = f_logic(z_is_on) !! f_side.to_f2_trans[logical, 0, NOT] F%picked_uni = f_logic(z_picked_uni) end subroutine tao_universe_to_f2 !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_super_universe_to_c (Fp, C) bind(c) ! ! Routine to convert a Tao tao_super_universe_struct to a C++ CPP_tao_super_universe structure ! ! Input: ! Fp -- type(c_ptr), value :: Input Tao tao_super_universe_struct structure. ! ! Output: ! C -- type(c_ptr), value :: Output C++ CPP_tao_super_universe struct. !- subroutine tao_super_universe_to_c (Fp, C) bind(c) implicit none interface !! f_side.to_c2_f2_sub_arg subroutine tao_super_universe_to_c2 (C, z_global, z_com, z_plot_page, z_v1_var, n1_v1_var, & z_var, n1_var, z_u, n1_u, z_mpi, z_key, n1_key, z_building_wall, z_wave, z_n_var_used, & z_n_v1_var_used, z_history) bind(c) import c_bool, c_double, c_ptr, c_char, c_int, c_double_complex !! f_side.to_c2_type :: f_side.to_c2_name type(c_ptr), value :: C integer(c_int) :: z_key(*), z_n_var_used, z_n_v1_var_used type(c_ptr) :: z_v1_var(*), z_var(*), z_u(*), z_history(*) integer(c_int), value :: n1_v1_var, n1_var, n1_u, n1_key type(c_ptr), value :: z_global, z_com, z_plot_page, z_mpi, z_building_wall, z_wave end subroutine end interface type(c_ptr), value :: Fp type(c_ptr), value :: C type(tao_super_universe_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_c_var type(c_ptr), allocatable :: z_v1_var(:) integer(c_int) :: n1_v1_var type(c_ptr), allocatable :: z_var(:) integer(c_int) :: n1_var type(c_ptr), allocatable :: z_u(:) integer(c_int) :: n1_u integer(c_int) :: n1_key type(c_ptr) :: z_history(1000) ! call c_f_pointer (Fp, F) !! f_side.to_c_trans[type, 1, ALLOC] n1_v1_var = 0 if (allocated(F%v1_var)) then n1_v1_var = size(F%v1_var); lb1 = lbound(F%v1_var, 1) - 1 allocate (z_v1_var(n1_v1_var)) do jd1 = 1, n1_v1_var z_v1_var(jd1) = c_loc(F%v1_var(jd1+lb1)) enddo endif !! f_side.to_c_trans[type, 1, ALLOC] n1_var = 0 if (allocated(F%var)) then n1_var = size(F%var); lb1 = lbound(F%var, 1) - 1 allocate (z_var(n1_var)) do jd1 = 1, n1_var z_var(jd1) = c_loc(F%var(jd1+lb1)) enddo endif !! f_side.to_c_trans[type, 1, ALLOC] n1_u = 0 if (allocated(F%u)) then n1_u = size(F%u); lb1 = lbound(F%u, 1) - 1 allocate (z_u(n1_u)) do jd1 = 1, n1_u z_u(jd1) = c_loc(F%u(jd1+lb1)) enddo endif !! f_side.to_c_trans[integer, 1, ALLOC] n1_key = 0 if (allocated(F%key)) then n1_key = size(F%key, 1) endif !! f_side.to_c_trans[type, 1, NOT] do jd1 = 1, size(F%history,1); lb1 = lbound(F%history,1) - 1 z_history(jd1) = c_loc(F%history(jd1+lb1)) enddo !! f_side.to_c2_call call tao_super_universe_to_c2 (C, c_loc(F%global), c_loc(F%com), c_loc(F%plot_page), z_v1_var, & n1_v1_var, z_var, n1_var, z_u, n1_u, c_loc(F%mpi), fvec2vec(F%key, n1_key), n1_key, & c_loc(F%building_wall), c_loc(F%wave), F%n_var_used, F%n_v1_var_used, z_history) end subroutine tao_super_universe_to_c !-------------------------------------------------------------------------- !-------------------------------------------------------------------------- !+ ! Subroutine tao_super_universe_to_f2 (Fp, ...etc...) bind(c) ! ! Routine used in converting a C++ CPP_tao_super_universe structure to a Tao tao_super_universe_struct structure. ! This routine is called by tao_super_universe_to_c and is not meant to be called directly. ! ! Input: ! ...etc... -- Components of the structure. See the tao_super_universe_to_f2 code for more details. ! ! Output: ! Fp -- type(c_ptr), value :: Tao tao_super_universe_struct structure. !- !! f_side.to_c2_f2_sub_arg subroutine tao_super_universe_to_f2 (Fp, z_global, z_com, z_plot_page, z_v1_var, n1_v1_var, & z_var, n1_var, z_u, n1_u, z_mpi, z_key, n1_key, z_building_wall, z_wave, z_n_var_used, & z_n_v1_var_used, z_history) bind(c) implicit none type(c_ptr), value :: Fp type(tao_super_universe_struct), pointer :: F integer jd, jd1, jd2, jd3, lb1, lb2, lb3 !! f_side.to_f2_var && f_side.to_f2_type :: f_side.to_f2_name integer(c_int) :: z_n_var_used, z_n_v1_var_used integer(c_int), pointer :: f_key(:) type(c_ptr) :: z_v1_var(*), z_var(*), z_u(*), z_history(*) integer(c_int), value :: n1_v1_var, n1_var, n1_u, n1_key type(c_ptr), value :: z_global, z_com, z_plot_page, z_mpi, z_key, z_building_wall, z_wave call c_f_pointer (Fp, F) !! f_side.to_f2_trans[type, 0, NOT] call tao_global_to_f(z_global, c_loc(F%global)) !! f_side.to_f2_trans[type, 0, NOT] call tao_common_to_f(z_com, c_loc(F%com)) !! f_side.to_f2_trans[type, 0, NOT] call tao_plot_page_to_f(z_plot_page, c_loc(F%plot_page)) !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_v1_var == 0) then if (allocated(F%v1_var)) deallocate(F%v1_var) else if (allocated(F%v1_var)) then if (n1_v1_var == 0 .or. any(shape(F%v1_var) /= [n1_v1_var])) deallocate(F%v1_var) if (any(lbound(F%v1_var) /= 1)) deallocate(F%v1_var) endif if (.not. allocated(F%v1_var)) allocate(F%v1_var(1:n1_v1_var+1-1)) do jd1 = 1, n1_v1_var call tao_v1_var_to_f (z_v1_var(jd1), c_loc(F%v1_var(jd1+1-1))) enddo endif !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_var == 0) then if (allocated(F%var)) deallocate(F%var) else if (allocated(F%var)) then if (n1_var == 0 .or. any(shape(F%var) /= [n1_var])) deallocate(F%var) if (any(lbound(F%var) /= 1)) deallocate(F%var) endif if (.not. allocated(F%var)) allocate(F%var(1:n1_var+1-1)) do jd1 = 1, n1_var call tao_var_to_f (z_var(jd1), c_loc(F%var(jd1+1-1))) enddo endif !! f_side.to_f2_trans[type, 1, ALLOC] if (n1_u == 0) then if (allocated(F%u)) deallocate(F%u) else if (allocated(F%u)) then if (n1_u == 0 .or. any(shape(F%u) /= [n1_u])) deallocate(F%u) if (any(lbound(F%u) /= 1)) deallocate(F%u) endif if (.not. allocated(F%u)) allocate(F%u(1:n1_u+1-1)) do jd1 = 1, n1_u call tao_universe_to_f (z_u(jd1), c_loc(F%u(jd1+1-1))) enddo endif !! f_side.to_f2_trans[type, 0, NOT] call tao_mpi_to_f(z_mpi, c_loc(F%mpi)) !! f_side.to_f2_trans[integer, 1, ALLOC] if (allocated(F%key)) then if (n1_key == 0 .or. any(shape(F%key) /= [n1_key])) deallocate(F%key) if (any(lbound(F%key) /= 1)) deallocate(F%key) endif if (n1_key /= 0) then call c_f_pointer (z_key, f_key, [n1_key]) if (.not. allocated(F%key)) allocate(F%key(n1_key)) F%key = f_key(1:n1_key) else if (allocated(F%key)) deallocate(F%key) endif !! f_side.to_f2_trans[type, 0, NOT] call tao_building_wall_to_f(z_building_wall, c_loc(F%building_wall)) !! f_side.to_f2_trans[type, 0, NOT] call tao_wave_to_f(z_wave, c_loc(F%wave)) !! f_side.to_f2_trans[integer, 0, NOT] F%n_var_used = z_n_var_used !! f_side.to_f2_trans[integer, 0, NOT] F%n_v1_var_used = z_n_v1_var_used !! f_side.to_f2_trans[type, 1, NOT] do jd1 = 1, size(F%history,1); lb1 = lbound(F%history,1) - 1 call tao_cmd_history_to_f(z_history(jd1), c_loc(F%history(jd1+lb1))) enddo end subroutine tao_super_universe_to_f2 end module