//+ // C++ side of the Bmad / C++ structure interface. // // This file is generated as part of the Bmad/C++ interface code generation. // The code generation files can be found in cpp_bmad_interface. // // DO NOT EDIT THIS FILE DIRECTLY! //- #include #include "converter_templates.h" #include "cpp_bmad_classes.h" //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_spline extern "C" void spline_to_c (const Opaque_spline_class*, CPP_spline&); // c_side.to_f2_arg extern "C" void spline_to_f2 (Opaque_spline_class*, c_Real&, c_Real&, c_Real&, c_RealArr); extern "C" void spline_to_f (const CPP_spline& C, Opaque_spline_class* F) { // c_side.to_f2_call spline_to_f2 (F, C.x0, C.y0, C.x1, &C.coef[0]); } // c_side.to_c2_arg extern "C" void spline_to_c2 (CPP_spline& C, c_Real& z_x0, c_Real& z_y0, c_Real& z_x1, c_RealArr z_coef) { // c_side.to_c2_set[real, 0, NOT] C.x0 = z_x0; // c_side.to_c2_set[real, 0, NOT] C.y0 = z_y0; // c_side.to_c2_set[real, 0, NOT] C.x1 = z_x1; // c_side.to_c2_set[real, 1, NOT] C.coef << z_coef; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_spin_polar extern "C" void spin_polar_to_c (const Opaque_spin_polar_class*, CPP_spin_polar&); // c_side.to_f2_arg extern "C" void spin_polar_to_f2 (Opaque_spin_polar_class*, c_Real&, c_Real&, c_Real&, c_Real&); extern "C" void spin_polar_to_f (const CPP_spin_polar& C, Opaque_spin_polar_class* F) { // c_side.to_f2_call spin_polar_to_f2 (F, C.polarization, C.theta, C.phi, C.xi); } // c_side.to_c2_arg extern "C" void spin_polar_to_c2 (CPP_spin_polar& C, c_Real& z_polarization, c_Real& z_theta, c_Real& z_phi, c_Real& z_xi) { // c_side.to_c2_set[real, 0, NOT] C.polarization = z_polarization; // c_side.to_c2_set[real, 0, NOT] C.theta = z_theta; // c_side.to_c2_set[real, 0, NOT] C.phi = z_phi; // c_side.to_c2_set[real, 0, NOT] C.xi = z_xi; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_surface_orientation extern "C" void surface_orientation_to_c (const Opaque_surface_orientation_class*, CPP_surface_orientation&); // c_side.to_f2_arg extern "C" void surface_orientation_to_f2 (Opaque_surface_orientation_class*, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&); extern "C" void surface_orientation_to_f (const CPP_surface_orientation& C, Opaque_surface_orientation_class* F) { // c_side.to_f2_call surface_orientation_to_f2 (F, C.dz_dx, C.dz_dy, C.dz_dx_rms, C.dz_dy_rms, C.dz2_dxdy); } // c_side.to_c2_arg extern "C" void surface_orientation_to_c2 (CPP_surface_orientation& C, c_Real& z_dz_dx, c_Real& z_dz_dy, c_Real& z_dz_dx_rms, c_Real& z_dz_dy_rms, c_Real& z_dz2_dxdy) { // c_side.to_c2_set[real, 0, NOT] C.dz_dx = z_dz_dx; // c_side.to_c2_set[real, 0, NOT] C.dz_dy = z_dz_dy; // c_side.to_c2_set[real, 0, NOT] C.dz_dx_rms = z_dz_dx_rms; // c_side.to_c2_set[real, 0, NOT] C.dz_dy_rms = z_dz_dy_rms; // c_side.to_c2_set[real, 0, NOT] C.dz2_dxdy = z_dz2_dxdy; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_ac_kicker_time extern "C" void ac_kicker_time_to_c (const Opaque_ac_kicker_time_class*, CPP_ac_kicker_time&); // c_side.to_f2_arg extern "C" void ac_kicker_time_to_f2 (Opaque_ac_kicker_time_class*, c_Real&, c_Real&, const CPP_spline&); extern "C" void ac_kicker_time_to_f (const CPP_ac_kicker_time& C, Opaque_ac_kicker_time_class* F) { // c_side.to_f2_call ac_kicker_time_to_f2 (F, C.amp, C.time, C.spline); } // c_side.to_c2_arg extern "C" void ac_kicker_time_to_c2 (CPP_ac_kicker_time& C, c_Real& z_amp, c_Real& z_time, const Opaque_spline_class* z_spline) { // c_side.to_c2_set[real, 0, NOT] C.amp = z_amp; // c_side.to_c2_set[real, 0, NOT] C.time = z_time; // c_side.to_c2_set[type, 0, NOT] spline_to_c(z_spline, C.spline); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_ac_kicker_freq extern "C" void ac_kicker_freq_to_c (const Opaque_ac_kicker_freq_class*, CPP_ac_kicker_freq&); // c_side.to_f2_arg extern "C" void ac_kicker_freq_to_f2 (Opaque_ac_kicker_freq_class*, c_Real&, c_Real&, c_Real&, c_Int&); extern "C" void ac_kicker_freq_to_f (const CPP_ac_kicker_freq& C, Opaque_ac_kicker_freq_class* F) { // c_side.to_f2_call ac_kicker_freq_to_f2 (F, C.f, C.amp, C.phi, C.rf_clock_harmonic); } // c_side.to_c2_arg extern "C" void ac_kicker_freq_to_c2 (CPP_ac_kicker_freq& C, c_Real& z_f, c_Real& z_amp, c_Real& z_phi, c_Int& z_rf_clock_harmonic) { // c_side.to_c2_set[real, 0, NOT] C.f = z_f; // c_side.to_c2_set[real, 0, NOT] C.amp = z_amp; // c_side.to_c2_set[real, 0, NOT] C.phi = z_phi; // c_side.to_c2_set[integer, 0, NOT] C.rf_clock_harmonic = z_rf_clock_harmonic; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_ac_kicker extern "C" void ac_kicker_to_c (const Opaque_ac_kicker_class*, CPP_ac_kicker&); // c_side.to_f2_arg extern "C" void ac_kicker_to_f2 (Opaque_ac_kicker_class*, const CPP_ac_kicker_time**, Int, const CPP_ac_kicker_freq**, Int); extern "C" void ac_kicker_to_f (const CPP_ac_kicker& C, Opaque_ac_kicker_class* F) { // c_side.to_f_setup[type, 1, ALLOC] int n1_amp_vs_time = C.amp_vs_time.size(); const CPP_ac_kicker_time** z_amp_vs_time = NULL; if (n1_amp_vs_time != 0) { z_amp_vs_time = new const CPP_ac_kicker_time*[n1_amp_vs_time]; for (int i = 0; i < n1_amp_vs_time; i++) z_amp_vs_time[i] = &C.amp_vs_time[i]; } // c_side.to_f_setup[type, 1, ALLOC] int n1_frequency = C.frequency.size(); const CPP_ac_kicker_freq** z_frequency = NULL; if (n1_frequency != 0) { z_frequency = new const CPP_ac_kicker_freq*[n1_frequency]; for (int i = 0; i < n1_frequency; i++) z_frequency[i] = &C.frequency[i]; } // c_side.to_f2_call ac_kicker_to_f2 (F, z_amp_vs_time, n1_amp_vs_time, z_frequency, n1_frequency); // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_amp_vs_time; // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_frequency; } // c_side.to_c2_arg extern "C" void ac_kicker_to_c2 (CPP_ac_kicker& C, Opaque_ac_kicker_time_class** z_amp_vs_time, Int n1_amp_vs_time, Opaque_ac_kicker_freq_class** z_frequency, Int n1_frequency) { // c_side.to_c2_set[type, 1, ALLOC] C.amp_vs_time.resize(n1_amp_vs_time); for (int i = 0; i < n1_amp_vs_time; i++) ac_kicker_time_to_c(z_amp_vs_time[i], C.amp_vs_time[i]); // c_side.to_c2_set[type, 1, ALLOC] C.frequency.resize(n1_frequency); for (int i = 0; i < n1_frequency; i++) ac_kicker_freq_to_c(z_frequency[i], C.frequency[i]); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_interval1_coef extern "C" void interval1_coef_to_c (const Opaque_interval1_coef_class*, CPP_interval1_coef&); // c_side.to_f2_arg extern "C" void interval1_coef_to_f2 (Opaque_interval1_coef_class*, c_Real&, c_Real&, c_Real&); extern "C" void interval1_coef_to_f (const CPP_interval1_coef& C, Opaque_interval1_coef_class* F) { // c_side.to_f2_call interval1_coef_to_f2 (F, C.c0, C.c1, C.n_exp); } // c_side.to_c2_arg extern "C" void interval1_coef_to_c2 (CPP_interval1_coef& C, c_Real& z_c0, c_Real& z_c1, c_Real& z_n_exp) { // c_side.to_c2_set[real, 0, NOT] C.c0 = z_c0; // c_side.to_c2_set[real, 0, NOT] C.c1 = z_c1; // c_side.to_c2_set[real, 0, NOT] C.n_exp = z_n_exp; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_photon_reflect_table extern "C" void photon_reflect_table_to_c (const Opaque_photon_reflect_table_class*, CPP_photon_reflect_table&); // c_side.to_f2_arg extern "C" void photon_reflect_table_to_f2 (Opaque_photon_reflect_table_class*, c_RealArr, Int, c_RealArr, Int, const CPP_interval1_coef**, Int, c_RealArr, Int, Int, c_Real&, c_RealArr, Int); extern "C" void photon_reflect_table_to_f (const CPP_photon_reflect_table& C, Opaque_photon_reflect_table_class* F) { // c_side.to_f_setup[real, 1, ALLOC] int n1_angle = C.angle.size(); c_RealArr z_angle = NULL; if (n1_angle > 0) { z_angle = &C.angle[0]; } // c_side.to_f_setup[real, 1, ALLOC] int n1_energy = C.energy.size(); c_RealArr z_energy = NULL; if (n1_energy > 0) { z_energy = &C.energy[0]; } // c_side.to_f_setup[type, 1, ALLOC] int n1_int1 = C.int1.size(); const CPP_interval1_coef** z_int1 = NULL; if (n1_int1 != 0) { z_int1 = new const CPP_interval1_coef*[n1_int1]; for (int i = 0; i < n1_int1; i++) z_int1[i] = &C.int1[i]; } // c_side.to_f_setup[real, 2, ALLOC] int n1_p_reflect = C.p_reflect.size(), n2_p_reflect = 0; Real* z_p_reflect = NULL; if (n1_p_reflect > 0) { n2_p_reflect = C.p_reflect[0].size(); z_p_reflect = new Real [n1_p_reflect*n2_p_reflect]; matrix_to_vec (C.p_reflect, z_p_reflect); } // c_side.to_f_setup[real, 1, ALLOC] int n1_p_reflect_scratch = C.p_reflect_scratch.size(); c_RealArr z_p_reflect_scratch = NULL; if (n1_p_reflect_scratch > 0) { z_p_reflect_scratch = &C.p_reflect_scratch[0]; } // c_side.to_f2_call photon_reflect_table_to_f2 (F, z_angle, n1_angle, z_energy, n1_energy, z_int1, n1_int1, z_p_reflect, n1_p_reflect, n2_p_reflect, C.max_energy, z_p_reflect_scratch, n1_p_reflect_scratch); // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_int1; // c_side.to_f_cleanup[real, 2, ALLOC] delete[] z_p_reflect; } // c_side.to_c2_arg extern "C" void photon_reflect_table_to_c2 (CPP_photon_reflect_table& C, c_RealArr z_angle, Int n1_angle, c_RealArr z_energy, Int n1_energy, Opaque_interval1_coef_class** z_int1, Int n1_int1, c_RealArr z_p_reflect, Int n1_p_reflect, Int n2_p_reflect, c_Real& z_max_energy, c_RealArr z_p_reflect_scratch, Int n1_p_reflect_scratch) { // c_side.to_c2_set[real, 1, ALLOC] C.angle.resize(n1_angle); C.angle << z_angle; // c_side.to_c2_set[real, 1, ALLOC] C.energy.resize(n1_energy); C.energy << z_energy; // c_side.to_c2_set[type, 1, ALLOC] C.int1.resize(n1_int1); for (int i = 0; i < n1_int1; i++) interval1_coef_to_c(z_int1[i], C.int1[i]); // c_side.to_c2_set[real, 2, ALLOC] C.p_reflect.resize(n1_p_reflect); for (int i = 0; i < n1_p_reflect; i++) C.p_reflect[i].resize(n2_p_reflect); C.p_reflect << z_p_reflect; // c_side.to_c2_set[real, 0, NOT] C.max_energy = z_max_energy; // c_side.to_c2_set[real, 1, ALLOC] C.p_reflect_scratch.resize(n1_p_reflect_scratch); C.p_reflect_scratch << z_p_reflect_scratch; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_photon_reflect_surface extern "C" void photon_reflect_surface_to_c (const Opaque_photon_reflect_surface_class*, CPP_photon_reflect_surface&); // c_side.to_f2_arg extern "C" void photon_reflect_surface_to_f2 (Opaque_photon_reflect_surface_class*, c_Char, c_Char, c_Char, const CPP_photon_reflect_table**, Int, c_Real&, c_Real&, c_Int&); extern "C" void photon_reflect_surface_to_f (const CPP_photon_reflect_surface& C, Opaque_photon_reflect_surface_class* F) { // c_side.to_f_setup[type, 1, ALLOC] int n1_table = C.table.size(); const CPP_photon_reflect_table** z_table = NULL; if (n1_table != 0) { z_table = new const CPP_photon_reflect_table*[n1_table]; for (int i = 0; i < n1_table; i++) z_table[i] = &C.table[i]; } // c_side.to_f2_call photon_reflect_surface_to_f2 (F, C.name.c_str(), C.description.c_str(), C.reflectivity_file.c_str(), z_table, n1_table, C.surface_roughness_rms, C.roughness_correlation_len, C.ix_surface); // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_table; } // c_side.to_c2_arg extern "C" void photon_reflect_surface_to_c2 (CPP_photon_reflect_surface& C, c_Char z_name, c_Char z_description, c_Char z_reflectivity_file, Opaque_photon_reflect_table_class** z_table, Int n1_table, c_Real& z_surface_roughness_rms, c_Real& z_roughness_correlation_len, c_Int& z_ix_surface) { // c_side.to_c2_set[character, 0, NOT] C.name = z_name; // c_side.to_c2_set[character, 0, NOT] C.description = z_description; // c_side.to_c2_set[character, 0, NOT] C.reflectivity_file = z_reflectivity_file; // c_side.to_c2_set[type, 1, ALLOC] C.table.resize(n1_table); for (int i = 0; i < n1_table; i++) photon_reflect_table_to_c(z_table[i], C.table[i]); // c_side.to_c2_set[real, 0, NOT] C.surface_roughness_rms = z_surface_roughness_rms; // c_side.to_c2_set[real, 0, NOT] C.roughness_correlation_len = z_roughness_correlation_len; // c_side.to_c2_set[integer, 0, NOT] C.ix_surface = z_ix_surface; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_coord extern "C" void coord_to_c (const Opaque_coord_class*, CPP_coord&); // c_side.to_f2_arg extern "C" void coord_to_f2 (Opaque_coord_class*, c_RealArr, c_Real&, c_Real&, c_RealArr, c_RealArr, c_RealArr, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&); extern "C" void coord_to_f (const CPP_coord& C, Opaque_coord_class* F) { // c_side.to_f2_call coord_to_f2 (F, &C.vec[0], C.s, C.t, &C.spin[0], &C.field[0], &C.phase[0], C.charge, C.dt_ref, C.r, C.p0c, C.e_potential, C.beta, C.ix_ele, C.ix_branch, C.ix_user, C.state, C.direction, C.time_dir, C.species, C.location); } // c_side.to_c2_arg extern "C" void coord_to_c2 (CPP_coord& C, c_RealArr z_vec, c_Real& z_s, c_Real& z_t, c_RealArr z_spin, c_RealArr z_field, c_RealArr z_phase, c_Real& z_charge, c_Real& z_dt_ref, c_Real& z_r, c_Real& z_p0c, c_Real& z_e_potential, c_Real& z_beta, c_Int& z_ix_ele, c_Int& z_ix_branch, c_Int& z_ix_user, c_Int& z_state, c_Int& z_direction, c_Int& z_time_dir, c_Int& z_species, c_Int& z_location) { // c_side.to_c2_set[real, 1, NOT] C.vec << z_vec; // c_side.to_c2_set[real, 0, NOT] C.s = z_s; // c_side.to_c2_set[real, 0, NOT] C.t = z_t; // c_side.to_c2_set[real, 1, NOT] C.spin << z_spin; // c_side.to_c2_set[real, 1, NOT] C.field << z_field; // c_side.to_c2_set[real, 1, NOT] C.phase << z_phase; // c_side.to_c2_set[real, 0, NOT] C.charge = z_charge; // c_side.to_c2_set[real, 0, NOT] C.dt_ref = z_dt_ref; // c_side.to_c2_set[real, 0, NOT] C.r = z_r; // c_side.to_c2_set[real, 0, NOT] C.p0c = z_p0c; // c_side.to_c2_set[real, 0, NOT] C.e_potential = z_e_potential; // c_side.to_c2_set[real, 0, NOT] C.beta = z_beta; // c_side.to_c2_set[integer, 0, NOT] C.ix_ele = z_ix_ele; // c_side.to_c2_set[integer, 0, NOT] C.ix_branch = z_ix_branch; // c_side.to_c2_set[integer, 0, NOT] C.ix_user = z_ix_user; // c_side.to_c2_set[integer, 0, NOT] C.state = z_state; // c_side.to_c2_set[integer, 0, NOT] C.direction = z_direction; // c_side.to_c2_set[integer, 0, NOT] C.time_dir = z_time_dir; // c_side.to_c2_set[integer, 0, NOT] C.species = z_species; // c_side.to_c2_set[integer, 0, NOT] C.location = z_location; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_coord_array extern "C" void coord_array_to_c (const Opaque_coord_array_class*, CPP_coord_array&); // c_side.to_f2_arg extern "C" void coord_array_to_f2 (Opaque_coord_array_class*, const CPP_coord**, Int); extern "C" void coord_array_to_f (const CPP_coord_array& C, Opaque_coord_array_class* F) { // c_side.to_f_setup[type, 1, ALLOC] int n1_orbit = C.orbit.size(); const CPP_coord** z_orbit = NULL; if (n1_orbit != 0) { z_orbit = new const CPP_coord*[n1_orbit]; for (int i = 0; i < n1_orbit; i++) z_orbit[i] = &C.orbit[i]; } // c_side.to_f2_call coord_array_to_f2 (F, z_orbit, n1_orbit); // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_orbit; } // c_side.to_c2_arg extern "C" void coord_array_to_c2 (CPP_coord_array& C, Opaque_coord_class** z_orbit, Int n1_orbit) { // c_side.to_c2_set[type, 1, ALLOC] C.orbit.resize(n1_orbit); for (int i = 0; i < n1_orbit; i++) coord_to_c(z_orbit[i], C.orbit[i]); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_bpm_phase_coupling extern "C" void bpm_phase_coupling_to_c (const Opaque_bpm_phase_coupling_class*, CPP_bpm_phase_coupling&); // c_side.to_f2_arg extern "C" void bpm_phase_coupling_to_f2 (Opaque_bpm_phase_coupling_class*, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&); extern "C" void bpm_phase_coupling_to_f (const CPP_bpm_phase_coupling& C, Opaque_bpm_phase_coupling_class* F) { // c_side.to_f2_call bpm_phase_coupling_to_f2 (F, C.k_22a, C.k_12a, C.k_11b, C.k_12b, C.cbar22_a, C.cbar12_a, C.cbar11_b, C.cbar12_b, C.phi_a, C.phi_b); } // c_side.to_c2_arg extern "C" void bpm_phase_coupling_to_c2 (CPP_bpm_phase_coupling& C, c_Real& z_k_22a, c_Real& z_k_12a, c_Real& z_k_11b, c_Real& z_k_12b, c_Real& z_cbar22_a, c_Real& z_cbar12_a, c_Real& z_cbar11_b, c_Real& z_cbar12_b, c_Real& z_phi_a, c_Real& z_phi_b) { // c_side.to_c2_set[real, 0, NOT] C.k_22a = z_k_22a; // c_side.to_c2_set[real, 0, NOT] C.k_12a = z_k_12a; // c_side.to_c2_set[real, 0, NOT] C.k_11b = z_k_11b; // c_side.to_c2_set[real, 0, NOT] C.k_12b = z_k_12b; // c_side.to_c2_set[real, 0, NOT] C.cbar22_a = z_cbar22_a; // c_side.to_c2_set[real, 0, NOT] C.cbar12_a = z_cbar12_a; // c_side.to_c2_set[real, 0, NOT] C.cbar11_b = z_cbar11_b; // c_side.to_c2_set[real, 0, NOT] C.cbar12_b = z_cbar12_b; // c_side.to_c2_set[real, 0, NOT] C.phi_a = z_phi_a; // c_side.to_c2_set[real, 0, NOT] C.phi_b = z_phi_b; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_expression_atom extern "C" void expression_atom_to_c (const Opaque_expression_atom_class*, CPP_expression_atom&); // c_side.to_f2_arg extern "C" void expression_atom_to_f2 (Opaque_expression_atom_class*, c_Char, c_Int&, c_Real&); extern "C" void expression_atom_to_f (const CPP_expression_atom& C, Opaque_expression_atom_class* F) { // c_side.to_f2_call expression_atom_to_f2 (F, C.name.c_str(), C.type, C.value); } // c_side.to_c2_arg extern "C" void expression_atom_to_c2 (CPP_expression_atom& C, c_Char z_name, c_Int& z_type, c_Real& z_value) { // c_side.to_c2_set[character, 0, NOT] C.name = z_name; // c_side.to_c2_set[integer, 0, NOT] C.type = z_type; // c_side.to_c2_set[real, 0, NOT] C.value = z_value; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_wake_sr_mode extern "C" void wake_sr_mode_to_c (const Opaque_wake_sr_mode_class*, CPP_wake_sr_mode&); // c_side.to_f2_arg extern "C" void wake_sr_mode_to_f2 (Opaque_wake_sr_mode_class*, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Int&, c_Int&); extern "C" void wake_sr_mode_to_f (const CPP_wake_sr_mode& C, Opaque_wake_sr_mode_class* F) { // c_side.to_f2_call wake_sr_mode_to_f2 (F, C.amp, C.damp, C.k, C.phi, C.b_sin, C.b_cos, C.a_sin, C.a_cos, C.polarization, C.position_dependence); } // c_side.to_c2_arg extern "C" void wake_sr_mode_to_c2 (CPP_wake_sr_mode& C, c_Real& z_amp, c_Real& z_damp, c_Real& z_k, c_Real& z_phi, c_Real& z_b_sin, c_Real& z_b_cos, c_Real& z_a_sin, c_Real& z_a_cos, c_Int& z_polarization, c_Int& z_position_dependence) { // c_side.to_c2_set[real, 0, NOT] C.amp = z_amp; // c_side.to_c2_set[real, 0, NOT] C.damp = z_damp; // c_side.to_c2_set[real, 0, NOT] C.k = z_k; // c_side.to_c2_set[real, 0, NOT] C.phi = z_phi; // c_side.to_c2_set[real, 0, NOT] C.b_sin = z_b_sin; // c_side.to_c2_set[real, 0, NOT] C.b_cos = z_b_cos; // c_side.to_c2_set[real, 0, NOT] C.a_sin = z_a_sin; // c_side.to_c2_set[real, 0, NOT] C.a_cos = z_a_cos; // c_side.to_c2_set[integer, 0, NOT] C.polarization = z_polarization; // c_side.to_c2_set[integer, 0, NOT] C.position_dependence = z_position_dependence; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_wake_sr extern "C" void wake_sr_to_c (const Opaque_wake_sr_class*, CPP_wake_sr&); // c_side.to_f2_arg extern "C" void wake_sr_to_f2 (Opaque_wake_sr_class*, c_Char, const CPP_wake_sr_mode**, Int, const CPP_wake_sr_mode**, Int, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Bool&); extern "C" void wake_sr_to_f (const CPP_wake_sr& C, Opaque_wake_sr_class* F) { // c_side.to_f_setup[type, 1, ALLOC] int n1_long_wake = C.long_wake.size(); const CPP_wake_sr_mode** z_long_wake = NULL; if (n1_long_wake != 0) { z_long_wake = new const CPP_wake_sr_mode*[n1_long_wake]; for (int i = 0; i < n1_long_wake; i++) z_long_wake[i] = &C.long_wake[i]; } // c_side.to_f_setup[type, 1, ALLOC] int n1_trans_wake = C.trans_wake.size(); const CPP_wake_sr_mode** z_trans_wake = NULL; if (n1_trans_wake != 0) { z_trans_wake = new const CPP_wake_sr_mode*[n1_trans_wake]; for (int i = 0; i < n1_trans_wake; i++) z_trans_wake[i] = &C.trans_wake[i]; } // c_side.to_f2_call wake_sr_to_f2 (F, C.file.c_str(), z_long_wake, n1_long_wake, z_trans_wake, n1_trans_wake, C.z_ref_long, C.z_ref_trans, C.z_max, C.amp_scale, C.z_scale, C.scale_with_length); // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_long_wake; // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_trans_wake; } // c_side.to_c2_arg extern "C" void wake_sr_to_c2 (CPP_wake_sr& C, c_Char z_file, Opaque_wake_sr_mode_class** z_long_wake, Int n1_long_wake, Opaque_wake_sr_mode_class** z_trans_wake, Int n1_trans_wake, c_Real& z_z_ref_long, c_Real& z_z_ref_trans, c_Real& z_z_max, c_Real& z_amp_scale, c_Real& z_z_scale, c_Bool& z_scale_with_length) { // c_side.to_c2_set[character, 0, NOT] C.file = z_file; // c_side.to_c2_set[type, 1, ALLOC] C.long_wake.resize(n1_long_wake); for (int i = 0; i < n1_long_wake; i++) wake_sr_mode_to_c(z_long_wake[i], C.long_wake[i]); // c_side.to_c2_set[type, 1, ALLOC] C.trans_wake.resize(n1_trans_wake); for (int i = 0; i < n1_trans_wake; i++) wake_sr_mode_to_c(z_trans_wake[i], C.trans_wake[i]); // c_side.to_c2_set[real, 0, NOT] C.z_ref_long = z_z_ref_long; // c_side.to_c2_set[real, 0, NOT] C.z_ref_trans = z_z_ref_trans; // c_side.to_c2_set[real, 0, NOT] C.z_max = z_z_max; // c_side.to_c2_set[real, 0, NOT] C.amp_scale = z_amp_scale; // c_side.to_c2_set[real, 0, NOT] C.z_scale = z_z_scale; // c_side.to_c2_set[logical, 0, NOT] C.scale_with_length = z_scale_with_length; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_wake_lr_mode extern "C" void wake_lr_mode_to_c (const Opaque_wake_lr_mode_class*, CPP_wake_lr_mode&); // c_side.to_f2_arg extern "C" void wake_lr_mode_to_f2 (Opaque_wake_lr_mode_class*, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Int&, c_Bool&); extern "C" void wake_lr_mode_to_f (const CPP_wake_lr_mode& C, Opaque_wake_lr_mode_class* F) { // c_side.to_f2_call wake_lr_mode_to_f2 (F, C.freq, C.freq_in, C.r_over_q, C.q, C.damp, C.phi, C.angle, C.b_sin, C.b_cos, C.a_sin, C.a_cos, C.m, C.polarized); } // c_side.to_c2_arg extern "C" void wake_lr_mode_to_c2 (CPP_wake_lr_mode& C, c_Real& z_freq, c_Real& z_freq_in, c_Real& z_r_over_q, c_Real& z_q, c_Real& z_damp, c_Real& z_phi, c_Real& z_angle, c_Real& z_b_sin, c_Real& z_b_cos, c_Real& z_a_sin, c_Real& z_a_cos, c_Int& z_m, c_Bool& z_polarized) { // c_side.to_c2_set[real, 0, NOT] C.freq = z_freq; // c_side.to_c2_set[real, 0, NOT] C.freq_in = z_freq_in; // c_side.to_c2_set[real, 0, NOT] C.r_over_q = z_r_over_q; // c_side.to_c2_set[real, 0, NOT] C.q = z_q; // c_side.to_c2_set[real, 0, NOT] C.damp = z_damp; // c_side.to_c2_set[real, 0, NOT] C.phi = z_phi; // c_side.to_c2_set[real, 0, NOT] C.angle = z_angle; // c_side.to_c2_set[real, 0, NOT] C.b_sin = z_b_sin; // c_side.to_c2_set[real, 0, NOT] C.b_cos = z_b_cos; // c_side.to_c2_set[real, 0, NOT] C.a_sin = z_a_sin; // c_side.to_c2_set[real, 0, NOT] C.a_cos = z_a_cos; // c_side.to_c2_set[integer, 0, NOT] C.m = z_m; // c_side.to_c2_set[logical, 0, NOT] C.polarized = z_polarized; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_wake_lr extern "C" void wake_lr_to_c (const Opaque_wake_lr_class*, CPP_wake_lr&); // c_side.to_f2_arg extern "C" void wake_lr_to_f2 (Opaque_wake_lr_class*, c_Char, const CPP_wake_lr_mode**, Int, c_Real&, c_Real&, c_Real&, c_Real&, c_Bool&); extern "C" void wake_lr_to_f (const CPP_wake_lr& C, Opaque_wake_lr_class* F) { // c_side.to_f_setup[type, 1, ALLOC] int n1_mode = C.mode.size(); const CPP_wake_lr_mode** z_mode = NULL; if (n1_mode != 0) { z_mode = new const CPP_wake_lr_mode*[n1_mode]; for (int i = 0; i < n1_mode; i++) z_mode[i] = &C.mode[i]; } // c_side.to_f2_call wake_lr_to_f2 (F, C.file.c_str(), z_mode, n1_mode, C.t_ref, C.freq_spread, C.amp_scale, C.time_scale, C.self_wake_on); // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_mode; } // c_side.to_c2_arg extern "C" void wake_lr_to_c2 (CPP_wake_lr& C, c_Char z_file, Opaque_wake_lr_mode_class** z_mode, Int n1_mode, c_Real& z_t_ref, c_Real& z_freq_spread, c_Real& z_amp_scale, c_Real& z_time_scale, c_Bool& z_self_wake_on) { // c_side.to_c2_set[character, 0, NOT] C.file = z_file; // c_side.to_c2_set[type, 1, ALLOC] C.mode.resize(n1_mode); for (int i = 0; i < n1_mode; i++) wake_lr_mode_to_c(z_mode[i], C.mode[i]); // c_side.to_c2_set[real, 0, NOT] C.t_ref = z_t_ref; // c_side.to_c2_set[real, 0, NOT] C.freq_spread = z_freq_spread; // c_side.to_c2_set[real, 0, NOT] C.amp_scale = z_amp_scale; // c_side.to_c2_set[real, 0, NOT] C.time_scale = z_time_scale; // c_side.to_c2_set[logical, 0, NOT] C.self_wake_on = z_self_wake_on; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_lat_ele_loc extern "C" void lat_ele_loc_to_c (const Opaque_lat_ele_loc_class*, CPP_lat_ele_loc&); // c_side.to_f2_arg extern "C" void lat_ele_loc_to_f2 (Opaque_lat_ele_loc_class*, c_Int&, c_Int&); extern "C" void lat_ele_loc_to_f (const CPP_lat_ele_loc& C, Opaque_lat_ele_loc_class* F) { // c_side.to_f2_call lat_ele_loc_to_f2 (F, C.ix_ele, C.ix_branch); } // c_side.to_c2_arg extern "C" void lat_ele_loc_to_c2 (CPP_lat_ele_loc& C, c_Int& z_ix_ele, c_Int& z_ix_branch) { // c_side.to_c2_set[integer, 0, NOT] C.ix_ele = z_ix_ele; // c_side.to_c2_set[integer, 0, NOT] C.ix_branch = z_ix_branch; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_wake extern "C" void wake_to_c (const Opaque_wake_class*, CPP_wake&); // c_side.to_f2_arg extern "C" void wake_to_f2 (Opaque_wake_class*, const CPP_wake_sr&, const CPP_wake_lr&); extern "C" void wake_to_f (const CPP_wake& C, Opaque_wake_class* F) { // c_side.to_f2_call wake_to_f2 (F, C.sr, C.lr); } // c_side.to_c2_arg extern "C" void wake_to_c2 (CPP_wake& C, const Opaque_wake_sr_class* z_sr, const Opaque_wake_lr_class* z_lr) { // c_side.to_c2_set[type, 0, NOT] wake_sr_to_c(z_sr, C.sr); // c_side.to_c2_set[type, 0, NOT] wake_lr_to_c(z_lr, C.lr); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_taylor_term extern "C" void taylor_term_to_c (const Opaque_taylor_term_class*, CPP_taylor_term&); // c_side.to_f2_arg extern "C" void taylor_term_to_f2 (Opaque_taylor_term_class*, c_Real&, c_IntArr); extern "C" void taylor_term_to_f (const CPP_taylor_term& C, Opaque_taylor_term_class* F) { // c_side.to_f2_call taylor_term_to_f2 (F, C.coef, &C.expn[0]); } // c_side.to_c2_arg extern "C" void taylor_term_to_c2 (CPP_taylor_term& C, c_Real& z_coef, c_IntArr z_expn) { // c_side.to_c2_set[real, 0, NOT] C.coef = z_coef; // c_side.to_c2_set[integer, 1, NOT] C.expn << z_expn; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_taylor extern "C" void taylor_to_c (const Opaque_taylor_class*, CPP_taylor&); // c_side.to_f2_arg extern "C" void taylor_to_f2 (Opaque_taylor_class*, c_Real&, const CPP_taylor_term**, Int); extern "C" void taylor_to_f (const CPP_taylor& C, Opaque_taylor_class* F) { // c_side.to_f_setup[type, 1, PTR] int n1_term = C.term.size(); const CPP_taylor_term** z_term = NULL; if (n1_term != 0) { z_term = new const CPP_taylor_term*[n1_term]; for (int i = 0; i < n1_term; i++) z_term[i] = &C.term[i]; } // c_side.to_f2_call taylor_to_f2 (F, C.ref, z_term, n1_term); // c_side.to_f_cleanup[type, 1, PTR] delete[] z_term; } // c_side.to_c2_arg extern "C" void taylor_to_c2 (CPP_taylor& C, c_Real& z_ref, Opaque_taylor_term_class** z_term, Int n1_term) { // c_side.to_c2_set[real, 0, NOT] C.ref = z_ref; // c_side.to_c2_set[type, 1, PTR] C.term.resize(n1_term); for (int i = 0; i < n1_term; i++) taylor_term_to_c(z_term[i], C.term[i]); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_em_taylor_term extern "C" void em_taylor_term_to_c (const Opaque_em_taylor_term_class*, CPP_em_taylor_term&); // c_side.to_f2_arg extern "C" void em_taylor_term_to_f2 (Opaque_em_taylor_term_class*, c_Real&, c_IntArr); extern "C" void em_taylor_term_to_f (const CPP_em_taylor_term& C, Opaque_em_taylor_term_class* F) { // c_side.to_f2_call em_taylor_term_to_f2 (F, C.coef, &C.expn[0]); } // c_side.to_c2_arg extern "C" void em_taylor_term_to_c2 (CPP_em_taylor_term& C, c_Real& z_coef, c_IntArr z_expn) { // c_side.to_c2_set[real, 0, NOT] C.coef = z_coef; // c_side.to_c2_set[integer, 1, NOT] C.expn << z_expn; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_em_taylor extern "C" void em_taylor_to_c (const Opaque_em_taylor_class*, CPP_em_taylor&); // c_side.to_f2_arg extern "C" void em_taylor_to_f2 (Opaque_em_taylor_class*, c_Real&, const CPP_em_taylor_term**, Int); extern "C" void em_taylor_to_f (const CPP_em_taylor& C, Opaque_em_taylor_class* F) { // c_side.to_f_setup[type, 1, ALLOC] int n1_term = C.term.size(); const CPP_em_taylor_term** z_term = NULL; if (n1_term != 0) { z_term = new const CPP_em_taylor_term*[n1_term]; for (int i = 0; i < n1_term; i++) z_term[i] = &C.term[i]; } // c_side.to_f2_call em_taylor_to_f2 (F, C.ref, z_term, n1_term); // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_term; } // c_side.to_c2_arg extern "C" void em_taylor_to_c2 (CPP_em_taylor& C, c_Real& z_ref, Opaque_em_taylor_term_class** z_term, Int n1_term) { // c_side.to_c2_set[real, 0, NOT] C.ref = z_ref; // c_side.to_c2_set[type, 1, ALLOC] C.term.resize(n1_term); for (int i = 0; i < n1_term; i++) em_taylor_term_to_c(z_term[i], C.term[i]); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_cartesian_map_term1 extern "C" void cartesian_map_term1_to_c (const Opaque_cartesian_map_term1_class*, CPP_cartesian_map_term1&); // c_side.to_f2_arg extern "C" void cartesian_map_term1_to_f2 (Opaque_cartesian_map_term1_class*, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Int&, c_Int&); extern "C" void cartesian_map_term1_to_f (const CPP_cartesian_map_term1& C, Opaque_cartesian_map_term1_class* F) { // c_side.to_f2_call cartesian_map_term1_to_f2 (F, C.coef, C.kx, C.ky, C.kz, C.x0, C.y0, C.phi_z, C.family, C.form); } // c_side.to_c2_arg extern "C" void cartesian_map_term1_to_c2 (CPP_cartesian_map_term1& C, c_Real& z_coef, c_Real& z_kx, c_Real& z_ky, c_Real& z_kz, c_Real& z_x0, c_Real& z_y0, c_Real& z_phi_z, c_Int& z_family, c_Int& z_form) { // c_side.to_c2_set[real, 0, NOT] C.coef = z_coef; // c_side.to_c2_set[real, 0, NOT] C.kx = z_kx; // c_side.to_c2_set[real, 0, NOT] C.ky = z_ky; // c_side.to_c2_set[real, 0, NOT] C.kz = z_kz; // c_side.to_c2_set[real, 0, NOT] C.x0 = z_x0; // c_side.to_c2_set[real, 0, NOT] C.y0 = z_y0; // c_side.to_c2_set[real, 0, NOT] C.phi_z = z_phi_z; // c_side.to_c2_set[integer, 0, NOT] C.family = z_family; // c_side.to_c2_set[integer, 0, NOT] C.form = z_form; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_cartesian_map_term extern "C" void cartesian_map_term_to_c (const Opaque_cartesian_map_term_class*, CPP_cartesian_map_term&); // c_side.to_f2_arg extern "C" void cartesian_map_term_to_f2 (Opaque_cartesian_map_term_class*, c_Char, c_Int&, const CPP_cartesian_map_term1**, Int); extern "C" void cartesian_map_term_to_f (const CPP_cartesian_map_term& C, Opaque_cartesian_map_term_class* F) { // c_side.to_f_setup[type, 1, ALLOC] int n1_term = C.term.size(); const CPP_cartesian_map_term1** z_term = NULL; if (n1_term != 0) { z_term = new const CPP_cartesian_map_term1*[n1_term]; for (int i = 0; i < n1_term; i++) z_term[i] = &C.term[i]; } // c_side.to_f2_call cartesian_map_term_to_f2 (F, C.file.c_str(), C.n_link, z_term, n1_term); // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_term; } // c_side.to_c2_arg extern "C" void cartesian_map_term_to_c2 (CPP_cartesian_map_term& C, c_Char z_file, c_Int& z_n_link, Opaque_cartesian_map_term1_class** z_term, Int n1_term) { // c_side.to_c2_set[character, 0, NOT] C.file = z_file; // c_side.to_c2_set[integer, 0, NOT] C.n_link = z_n_link; // c_side.to_c2_set[type, 1, ALLOC] C.term.resize(n1_term); for (int i = 0; i < n1_term; i++) cartesian_map_term1_to_c(z_term[i], C.term[i]); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_cartesian_map extern "C" void cartesian_map_to_c (const Opaque_cartesian_map_class*, CPP_cartesian_map&); // c_side.to_f2_arg extern "C" void cartesian_map_to_f2 (Opaque_cartesian_map_class*, c_Real&, c_RealArr, c_Int&, c_Int&, c_Int&, const CPP_cartesian_map_term&, Int); extern "C" void cartesian_map_to_f (const CPP_cartesian_map& C, Opaque_cartesian_map_class* F) { // c_side.to_f_setup[type, 0, PTR] unsigned int n_ptr = 0; if (C.ptr != NULL) n_ptr = 1; // c_side.to_f2_call cartesian_map_to_f2 (F, C.field_scale, &C.r0[0], C.master_parameter, C.ele_anchor_pt, C.field_type, *C.ptr, n_ptr); } // c_side.to_c2_arg extern "C" void cartesian_map_to_c2 (CPP_cartesian_map& C, c_Real& z_field_scale, c_RealArr z_r0, c_Int& z_master_parameter, c_Int& z_ele_anchor_pt, c_Int& z_field_type, Opaque_cartesian_map_term_class* z_ptr, Int n_ptr) { // c_side.to_c2_set[real, 0, NOT] C.field_scale = z_field_scale; // c_side.to_c2_set[real, 1, NOT] C.r0 << z_r0; // c_side.to_c2_set[integer, 0, NOT] C.master_parameter = z_master_parameter; // c_side.to_c2_set[integer, 0, NOT] C.ele_anchor_pt = z_ele_anchor_pt; // c_side.to_c2_set[integer, 0, NOT] C.field_type = z_field_type; // c_side.to_c2_set[type, 0, PTR] if (n_ptr == 0) delete C.ptr; else { C.ptr = new CPP_cartesian_map_term; cartesian_map_term_to_c(z_ptr, *C.ptr); } } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_cylindrical_map_term1 extern "C" void cylindrical_map_term1_to_c (const Opaque_cylindrical_map_term1_class*, CPP_cylindrical_map_term1&); // c_side.to_f2_arg extern "C" void cylindrical_map_term1_to_f2 (Opaque_cylindrical_map_term1_class*, c_Complex&, c_Complex&); extern "C" void cylindrical_map_term1_to_f (const CPP_cylindrical_map_term1& C, Opaque_cylindrical_map_term1_class* F) { // c_side.to_f2_call cylindrical_map_term1_to_f2 (F, C.e_coef, C.b_coef); } // c_side.to_c2_arg extern "C" void cylindrical_map_term1_to_c2 (CPP_cylindrical_map_term1& C, c_Complex& z_e_coef, c_Complex& z_b_coef) { // c_side.to_c2_set[complex, 0, NOT] C.e_coef = z_e_coef; // c_side.to_c2_set[complex, 0, NOT] C.b_coef = z_b_coef; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_cylindrical_map_term extern "C" void cylindrical_map_term_to_c (const Opaque_cylindrical_map_term_class*, CPP_cylindrical_map_term&); // c_side.to_f2_arg extern "C" void cylindrical_map_term_to_f2 (Opaque_cylindrical_map_term_class*, c_Char, c_Int&, const CPP_cylindrical_map_term1**, Int); extern "C" void cylindrical_map_term_to_f (const CPP_cylindrical_map_term& C, Opaque_cylindrical_map_term_class* F) { // c_side.to_f_setup[type, 1, ALLOC] int n1_term = C.term.size(); const CPP_cylindrical_map_term1** z_term = NULL; if (n1_term != 0) { z_term = new const CPP_cylindrical_map_term1*[n1_term]; for (int i = 0; i < n1_term; i++) z_term[i] = &C.term[i]; } // c_side.to_f2_call cylindrical_map_term_to_f2 (F, C.file.c_str(), C.n_link, z_term, n1_term); // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_term; } // c_side.to_c2_arg extern "C" void cylindrical_map_term_to_c2 (CPP_cylindrical_map_term& C, c_Char z_file, c_Int& z_n_link, Opaque_cylindrical_map_term1_class** z_term, Int n1_term) { // c_side.to_c2_set[character, 0, NOT] C.file = z_file; // c_side.to_c2_set[integer, 0, NOT] C.n_link = z_n_link; // c_side.to_c2_set[type, 1, ALLOC] C.term.resize(n1_term); for (int i = 0; i < n1_term; i++) cylindrical_map_term1_to_c(z_term[i], C.term[i]); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_cylindrical_map extern "C" void cylindrical_map_to_c (const Opaque_cylindrical_map_class*, CPP_cylindrical_map&); // c_side.to_f2_arg extern "C" void cylindrical_map_to_f2 (Opaque_cylindrical_map_class*, c_Int&, c_Int&, c_Real&, c_Real&, c_Real&, c_Int&, c_Int&, c_Real&, c_RealArr, const CPP_cylindrical_map_term&, Int); extern "C" void cylindrical_map_to_f (const CPP_cylindrical_map& C, Opaque_cylindrical_map_class* F) { // c_side.to_f_setup[type, 0, PTR] unsigned int n_ptr = 0; if (C.ptr != NULL) n_ptr = 1; // c_side.to_f2_call cylindrical_map_to_f2 (F, C.m, C.harmonic, C.phi0_fieldmap, C.theta0_azimuth, C.field_scale, C.master_parameter, C.ele_anchor_pt, C.dz, &C.r0[0], *C.ptr, n_ptr); } // c_side.to_c2_arg extern "C" void cylindrical_map_to_c2 (CPP_cylindrical_map& C, c_Int& z_m, c_Int& z_harmonic, c_Real& z_phi0_fieldmap, c_Real& z_theta0_azimuth, c_Real& z_field_scale, c_Int& z_master_parameter, c_Int& z_ele_anchor_pt, c_Real& z_dz, c_RealArr z_r0, Opaque_cylindrical_map_term_class* z_ptr, Int n_ptr) { // c_side.to_c2_set[integer, 0, NOT] C.m = z_m; // c_side.to_c2_set[integer, 0, NOT] C.harmonic = z_harmonic; // c_side.to_c2_set[real, 0, NOT] C.phi0_fieldmap = z_phi0_fieldmap; // c_side.to_c2_set[real, 0, NOT] C.theta0_azimuth = z_theta0_azimuth; // c_side.to_c2_set[real, 0, NOT] C.field_scale = z_field_scale; // c_side.to_c2_set[integer, 0, NOT] C.master_parameter = z_master_parameter; // c_side.to_c2_set[integer, 0, NOT] C.ele_anchor_pt = z_ele_anchor_pt; // c_side.to_c2_set[real, 0, NOT] C.dz = z_dz; // c_side.to_c2_set[real, 1, NOT] C.r0 << z_r0; // c_side.to_c2_set[type, 0, PTR] if (n_ptr == 0) delete C.ptr; else { C.ptr = new CPP_cylindrical_map_term; cylindrical_map_term_to_c(z_ptr, *C.ptr); } } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_grid_field_pt1 extern "C" void grid_field_pt1_to_c (const Opaque_grid_field_pt1_class*, CPP_grid_field_pt1&); // c_side.to_f2_arg extern "C" void grid_field_pt1_to_f2 (Opaque_grid_field_pt1_class*, c_ComplexArr, c_ComplexArr); extern "C" void grid_field_pt1_to_f (const CPP_grid_field_pt1& C, Opaque_grid_field_pt1_class* F) { // c_side.to_f2_call grid_field_pt1_to_f2 (F, &C.e[0], &C.b[0]); } // c_side.to_c2_arg extern "C" void grid_field_pt1_to_c2 (CPP_grid_field_pt1& C, c_ComplexArr z_e, c_ComplexArr z_b) { // c_side.to_c2_set[complex, 1, NOT] C.e << z_e; // c_side.to_c2_set[complex, 1, NOT] C.b << z_b; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_grid_field_pt extern "C" void grid_field_pt_to_c (const Opaque_grid_field_pt_class*, CPP_grid_field_pt&); // c_side.to_f2_arg extern "C" void grid_field_pt_to_f2 (Opaque_grid_field_pt_class*, c_Char, c_Int&, const CPP_grid_field_pt1**, Int, Int, Int); extern "C" void grid_field_pt_to_f (const CPP_grid_field_pt& C, Opaque_grid_field_pt_class* F) { // c_side.to_f_setup[type, 3, ALLOC] int n1_pt = C.pt.size(), n2_pt = 0, n3_pt = 0; const CPP_grid_field_pt1** z_pt = NULL; if (n1_pt > 0) { n2_pt = C.pt[0].size(); n3_pt = C.pt[0][0].size(); z_pt = new const CPP_grid_field_pt1* [n1_pt*n2_pt*n3_pt]; for (int i = 0; i < n1_pt; i++) { for (int j = 0; j < n2_pt; j++) { for (int k = 0; k < n3_pt; k++) { z_pt[i*n2_pt*n3_pt + j*n3_pt + k] = &C.pt[i][j][k]; } } } } // c_side.to_f2_call grid_field_pt_to_f2 (F, C.file.c_str(), C.n_link, z_pt, n1_pt, n2_pt, n3_pt); // c_side.to_f_cleanup[type, 3, ALLOC] delete[] z_pt; } // c_side.to_c2_arg extern "C" void grid_field_pt_to_c2 (CPP_grid_field_pt& C, c_Char z_file, c_Int& z_n_link, Opaque_grid_field_pt1_class** z_pt, Int n1_pt, Int n2_pt, Int n3_pt) { // c_side.to_c2_set[character, 0, NOT] C.file = z_file; // c_side.to_c2_set[integer, 0, NOT] C.n_link = z_n_link; // c_side.to_c2_set[type, 3, ALLOC] C.pt.resize(n1_pt); for (int i = 0; i < n1_pt; i++) { C.pt[i].resize(n2_pt); for (int j = 0; j < n2_pt; j++) { C.pt[i][j].resize(n3_pt); for (int k = 0; k < n3_pt; k++) { grid_field_pt1_to_c(z_pt[n3_pt*n2_pt*i+n3_pt*j+k], C.pt[i][j][k]); } } } } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_grid_field extern "C" void grid_field_to_c (const Opaque_grid_field_class*, CPP_grid_field&); // c_side.to_f2_arg extern "C" void grid_field_to_f2 (Opaque_grid_field_class*, c_Int&, c_Int&, c_Real&, c_Real&, c_Int&, c_Int&, c_Int&, c_Int&, c_RealArr, c_RealArr, c_Bool&, const CPP_grid_field_pt&, Int); extern "C" void grid_field_to_f (const CPP_grid_field& C, Opaque_grid_field_class* F) { // c_side.to_f_setup[type, 0, PTR] unsigned int n_ptr = 0; if (C.ptr != NULL) n_ptr = 1; // c_side.to_f2_call grid_field_to_f2 (F, C.geometry, C.harmonic, C.phi0_fieldmap, C.field_scale, C.field_type, C.master_parameter, C.ele_anchor_pt, C.interpolation_order, &C.dr[0], &C.r0[0], C.curved_ref_frame, *C.ptr, n_ptr); } // c_side.to_c2_arg extern "C" void grid_field_to_c2 (CPP_grid_field& C, c_Int& z_geometry, c_Int& z_harmonic, c_Real& z_phi0_fieldmap, c_Real& z_field_scale, c_Int& z_field_type, c_Int& z_master_parameter, c_Int& z_ele_anchor_pt, c_Int& z_interpolation_order, c_RealArr z_dr, c_RealArr z_r0, c_Bool& z_curved_ref_frame, Opaque_grid_field_pt_class* z_ptr, Int n_ptr) { // c_side.to_c2_set[integer, 0, NOT] C.geometry = z_geometry; // c_side.to_c2_set[integer, 0, NOT] C.harmonic = z_harmonic; // c_side.to_c2_set[real, 0, NOT] C.phi0_fieldmap = z_phi0_fieldmap; // c_side.to_c2_set[real, 0, NOT] C.field_scale = z_field_scale; // c_side.to_c2_set[integer, 0, NOT] C.field_type = z_field_type; // c_side.to_c2_set[integer, 0, NOT] C.master_parameter = z_master_parameter; // c_side.to_c2_set[integer, 0, NOT] C.ele_anchor_pt = z_ele_anchor_pt; // c_side.to_c2_set[integer, 0, NOT] C.interpolation_order = z_interpolation_order; // c_side.to_c2_set[real, 1, NOT] C.dr << z_dr; // c_side.to_c2_set[real, 1, NOT] C.r0 << z_r0; // c_side.to_c2_set[logical, 0, NOT] C.curved_ref_frame = z_curved_ref_frame; // c_side.to_c2_set[type, 0, PTR] if (n_ptr == 0) delete C.ptr; else { C.ptr = new CPP_grid_field_pt; grid_field_pt_to_c(z_ptr, *C.ptr); } } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_floor_position extern "C" void floor_position_to_c (const Opaque_floor_position_class*, CPP_floor_position&); // c_side.to_f2_arg extern "C" void floor_position_to_f2 (Opaque_floor_position_class*, c_RealArr, c_RealArr, c_Real&, c_Real&, c_Real&); extern "C" void floor_position_to_f (const CPP_floor_position& C, Opaque_floor_position_class* F) { // c_side.to_f_setup[real, 2, NOT] Real z_w[3*3]; matrix_to_vec(C.w, z_w); // c_side.to_f2_call floor_position_to_f2 (F, &C.r[0], z_w, C.theta, C.phi, C.psi); } // c_side.to_c2_arg extern "C" void floor_position_to_c2 (CPP_floor_position& C, c_RealArr z_r, c_RealArr z_w, c_Real& z_theta, c_Real& z_phi, c_Real& z_psi) { // c_side.to_c2_set[real, 1, NOT] C.r << z_r; // c_side.to_c2_set[real, 2, NOT] C.w << z_w; // c_side.to_c2_set[real, 0, NOT] C.theta = z_theta; // c_side.to_c2_set[real, 0, NOT] C.phi = z_phi; // c_side.to_c2_set[real, 0, NOT] C.psi = z_psi; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_high_energy_space_charge extern "C" void high_energy_space_charge_to_c (const Opaque_high_energy_space_charge_class*, CPP_high_energy_space_charge&); // c_side.to_f2_arg extern "C" void high_energy_space_charge_to_f2 (Opaque_high_energy_space_charge_class*, const CPP_coord&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&); extern "C" void high_energy_space_charge_to_f (const CPP_high_energy_space_charge& C, Opaque_high_energy_space_charge_class* F) { // c_side.to_f2_call high_energy_space_charge_to_f2 (F, C.closed_orb, C.kick_const, C.sig_x, C.sig_y, C.phi, C.sin_phi, C.cos_phi, C.sig_z); } // c_side.to_c2_arg extern "C" void high_energy_space_charge_to_c2 (CPP_high_energy_space_charge& C, const Opaque_coord_class* z_closed_orb, c_Real& z_kick_const, c_Real& z_sig_x, c_Real& z_sig_y, c_Real& z_phi, c_Real& z_sin_phi, c_Real& z_cos_phi, c_Real& z_sig_z) { // c_side.to_c2_set[type, 0, NOT] coord_to_c(z_closed_orb, C.closed_orb); // c_side.to_c2_set[real, 0, NOT] C.kick_const = z_kick_const; // c_side.to_c2_set[real, 0, NOT] C.sig_x = z_sig_x; // c_side.to_c2_set[real, 0, NOT] C.sig_y = z_sig_y; // c_side.to_c2_set[real, 0, NOT] C.phi = z_phi; // c_side.to_c2_set[real, 0, NOT] C.sin_phi = z_sin_phi; // c_side.to_c2_set[real, 0, NOT] C.cos_phi = z_cos_phi; // c_side.to_c2_set[real, 0, NOT] C.sig_z = z_sig_z; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_xy_disp extern "C" void xy_disp_to_c (const Opaque_xy_disp_class*, CPP_xy_disp&); // c_side.to_f2_arg extern "C" void xy_disp_to_f2 (Opaque_xy_disp_class*, c_Real&, c_Real&, c_Real&); extern "C" void xy_disp_to_f (const CPP_xy_disp& C, Opaque_xy_disp_class* F) { // c_side.to_f2_call xy_disp_to_f2 (F, C.eta, C.etap, C.sigma); } // c_side.to_c2_arg extern "C" void xy_disp_to_c2 (CPP_xy_disp& C, c_Real& z_eta, c_Real& z_etap, c_Real& z_sigma) { // c_side.to_c2_set[real, 0, NOT] C.eta = z_eta; // c_side.to_c2_set[real, 0, NOT] C.etap = z_etap; // c_side.to_c2_set[real, 0, NOT] C.sigma = z_sigma; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_twiss extern "C" void twiss_to_c (const Opaque_twiss_class*, CPP_twiss&); // c_side.to_f2_arg extern "C" void twiss_to_f2 (Opaque_twiss_class*, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&); extern "C" void twiss_to_f (const CPP_twiss& C, Opaque_twiss_class* F) { // c_side.to_f2_call twiss_to_f2 (F, C.beta, C.alpha, C.gamma, C.phi, C.eta, C.etap, C.sigma, C.sigma_p, C.emit, C.norm_emit); } // c_side.to_c2_arg extern "C" void twiss_to_c2 (CPP_twiss& C, c_Real& z_beta, c_Real& z_alpha, c_Real& z_gamma, c_Real& z_phi, c_Real& z_eta, c_Real& z_etap, c_Real& z_sigma, c_Real& z_sigma_p, c_Real& z_emit, c_Real& z_norm_emit) { // c_side.to_c2_set[real, 0, NOT] C.beta = z_beta; // c_side.to_c2_set[real, 0, NOT] C.alpha = z_alpha; // c_side.to_c2_set[real, 0, NOT] C.gamma = z_gamma; // c_side.to_c2_set[real, 0, NOT] C.phi = z_phi; // c_side.to_c2_set[real, 0, NOT] C.eta = z_eta; // c_side.to_c2_set[real, 0, NOT] C.etap = z_etap; // c_side.to_c2_set[real, 0, NOT] C.sigma = z_sigma; // c_side.to_c2_set[real, 0, NOT] C.sigma_p = z_sigma_p; // c_side.to_c2_set[real, 0, NOT] C.emit = z_emit; // c_side.to_c2_set[real, 0, NOT] C.norm_emit = z_norm_emit; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_mode3 extern "C" void mode3_to_c (const Opaque_mode3_class*, CPP_mode3&); // c_side.to_f2_arg extern "C" void mode3_to_f2 (Opaque_mode3_class*, c_RealArr, const CPP_twiss&, const CPP_twiss&, const CPP_twiss&, const CPP_twiss&, const CPP_twiss&); extern "C" void mode3_to_f (const CPP_mode3& C, Opaque_mode3_class* F) { // c_side.to_f_setup[real, 2, NOT] Real z_v[6*6]; matrix_to_vec(C.v, z_v); // c_side.to_f2_call mode3_to_f2 (F, z_v, C.a, C.b, C.c, C.x, C.y); } // c_side.to_c2_arg extern "C" void mode3_to_c2 (CPP_mode3& C, c_RealArr z_v, const Opaque_twiss_class* z_a, const Opaque_twiss_class* z_b, const Opaque_twiss_class* z_c, const Opaque_twiss_class* z_x, const Opaque_twiss_class* z_y) { // c_side.to_c2_set[real, 2, NOT] C.v << z_v; // c_side.to_c2_set[type, 0, NOT] twiss_to_c(z_a, C.a); // c_side.to_c2_set[type, 0, NOT] twiss_to_c(z_b, C.b); // c_side.to_c2_set[type, 0, NOT] twiss_to_c(z_c, C.c); // c_side.to_c2_set[type, 0, NOT] twiss_to_c(z_x, C.x); // c_side.to_c2_set[type, 0, NOT] twiss_to_c(z_y, C.y); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_bookkeeping_state extern "C" void bookkeeping_state_to_c (const Opaque_bookkeeping_state_class*, CPP_bookkeeping_state&); // c_side.to_f2_arg extern "C" void bookkeeping_state_to_f2 (Opaque_bookkeeping_state_class*, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&); extern "C" void bookkeeping_state_to_f (const CPP_bookkeeping_state& C, Opaque_bookkeeping_state_class* F) { // c_side.to_f2_call bookkeeping_state_to_f2 (F, C.attributes, C.control, C.floor_position, C.s_position, C.ref_energy, C.mat6, C.rad_int, C.ptc); } // c_side.to_c2_arg extern "C" void bookkeeping_state_to_c2 (CPP_bookkeeping_state& C, c_Int& z_attributes, c_Int& z_control, c_Int& z_floor_position, c_Int& z_s_position, c_Int& z_ref_energy, c_Int& z_mat6, c_Int& z_rad_int, c_Int& z_ptc) { // c_side.to_c2_set[integer, 0, NOT] C.attributes = z_attributes; // c_side.to_c2_set[integer, 0, NOT] C.control = z_control; // c_side.to_c2_set[integer, 0, NOT] C.floor_position = z_floor_position; // c_side.to_c2_set[integer, 0, NOT] C.s_position = z_s_position; // c_side.to_c2_set[integer, 0, NOT] C.ref_energy = z_ref_energy; // c_side.to_c2_set[integer, 0, NOT] C.mat6 = z_mat6; // c_side.to_c2_set[integer, 0, NOT] C.rad_int = z_rad_int; // c_side.to_c2_set[integer, 0, NOT] C.ptc = z_ptc; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_rad_map extern "C" void rad_map_to_c (const Opaque_rad_map_class*, CPP_rad_map&); // c_side.to_f2_arg extern "C" void rad_map_to_f2 (Opaque_rad_map_class*, c_RealArr, c_RealArr, c_RealArr, c_RealArr, c_RealArr); extern "C" void rad_map_to_f (const CPP_rad_map& C, Opaque_rad_map_class* F) { // c_side.to_f_setup[real, 2, NOT] Real z_damp_dmat[6*6]; matrix_to_vec(C.damp_dmat, z_damp_dmat); // c_side.to_f_setup[real, 2, NOT] Real z_xfer_damp_mat[6*6]; matrix_to_vec(C.xfer_damp_mat, z_xfer_damp_mat); // c_side.to_f_setup[real, 2, NOT] Real z_stoc_mat[6*6]; matrix_to_vec(C.stoc_mat, z_stoc_mat); // c_side.to_f2_call rad_map_to_f2 (F, &C.ref_orb[0], z_damp_dmat, &C.xfer_damp_vec[0], z_xfer_damp_mat, z_stoc_mat); } // c_side.to_c2_arg extern "C" void rad_map_to_c2 (CPP_rad_map& C, c_RealArr z_ref_orb, c_RealArr z_damp_dmat, c_RealArr z_xfer_damp_vec, c_RealArr z_xfer_damp_mat, c_RealArr z_stoc_mat) { // c_side.to_c2_set[real, 1, NOT] C.ref_orb << z_ref_orb; // c_side.to_c2_set[real, 2, NOT] C.damp_dmat << z_damp_dmat; // c_side.to_c2_set[real, 1, NOT] C.xfer_damp_vec << z_xfer_damp_vec; // c_side.to_c2_set[real, 2, NOT] C.xfer_damp_mat << z_xfer_damp_mat; // c_side.to_c2_set[real, 2, NOT] C.stoc_mat << z_stoc_mat; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_rad_map_ele extern "C" void rad_map_ele_to_c (const Opaque_rad_map_ele_class*, CPP_rad_map_ele&); // c_side.to_f2_arg extern "C" void rad_map_ele_to_f2 (Opaque_rad_map_ele_class*, const CPP_rad_map&, const CPP_rad_map&, c_Bool&); extern "C" void rad_map_ele_to_f (const CPP_rad_map_ele& C, Opaque_rad_map_ele_class* F) { // c_side.to_f2_call rad_map_ele_to_f2 (F, C.rm0, C.rm1, C.stale); } // c_side.to_c2_arg extern "C" void rad_map_ele_to_c2 (CPP_rad_map_ele& C, const Opaque_rad_map_class* z_rm0, const Opaque_rad_map_class* z_rm1, c_Bool& z_stale) { // c_side.to_c2_set[type, 0, NOT] rad_map_to_c(z_rm0, C.rm0); // c_side.to_c2_set[type, 0, NOT] rad_map_to_c(z_rm1, C.rm1); // c_side.to_c2_set[logical, 0, NOT] C.stale = z_stale; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_gen_grad1 extern "C" void gen_grad1_to_c (const Opaque_gen_grad1_class*, CPP_gen_grad1&); // c_side.to_f2_arg extern "C" void gen_grad1_to_f2 (Opaque_gen_grad1_class*, c_Int&, c_Int&, c_Int&, c_RealArr, Int, Int); extern "C" void gen_grad1_to_f (const CPP_gen_grad1& C, Opaque_gen_grad1_class* F) { // c_side.to_f_setup[real, 2, ALLOC] int n1_deriv = C.deriv.size(), n2_deriv = 0; Real* z_deriv = NULL; if (n1_deriv > 0) { n2_deriv = C.deriv[0].size(); z_deriv = new Real [n1_deriv*n2_deriv]; matrix_to_vec (C.deriv, z_deriv); } // c_side.to_f2_call gen_grad1_to_f2 (F, C.m, C.sincos, C.n_deriv_max, z_deriv, n1_deriv, n2_deriv); // c_side.to_f_cleanup[real, 2, ALLOC] delete[] z_deriv; } // c_side.to_c2_arg extern "C" void gen_grad1_to_c2 (CPP_gen_grad1& C, c_Int& z_m, c_Int& z_sincos, c_Int& z_n_deriv_max, c_RealArr z_deriv, Int n1_deriv, Int n2_deriv) { // c_side.to_c2_set[integer, 0, NOT] C.m = z_m; // c_side.to_c2_set[integer, 0, NOT] C.sincos = z_sincos; // c_side.to_c2_set[integer, 0, NOT] C.n_deriv_max = z_n_deriv_max; // c_side.to_c2_set[real, 2, ALLOC] C.deriv.resize(n1_deriv); for (int i = 0; i < n1_deriv; i++) C.deriv[i].resize(n2_deriv); C.deriv << z_deriv; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_gen_grad_map extern "C" void gen_grad_map_to_c (const Opaque_gen_grad_map_class*, CPP_gen_grad_map&); // c_side.to_f2_arg extern "C" void gen_grad_map_to_f2 (Opaque_gen_grad_map_class*, c_Char, const CPP_gen_grad1**, Int, c_Int&, c_Int&, c_Int&, c_Int&, c_Real&, c_RealArr, c_Real&, c_Int&, c_Bool&); extern "C" void gen_grad_map_to_f (const CPP_gen_grad_map& C, Opaque_gen_grad_map_class* F) { // c_side.to_f_setup[type, 1, ALLOC] int n1_gg = C.gg.size(); const CPP_gen_grad1** z_gg = NULL; if (n1_gg != 0) { z_gg = new const CPP_gen_grad1*[n1_gg]; for (int i = 0; i < n1_gg; i++) z_gg[i] = &C.gg[i]; } // c_side.to_f2_call gen_grad_map_to_f2 (F, C.file.c_str(), z_gg, n1_gg, C.ele_anchor_pt, C.field_type, C.iz0, C.iz1, C.dz, &C.r0[0], C.field_scale, C.master_parameter, C.curved_ref_frame); // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_gg; } // c_side.to_c2_arg extern "C" void gen_grad_map_to_c2 (CPP_gen_grad_map& C, c_Char z_file, Opaque_gen_grad1_class** z_gg, Int n1_gg, c_Int& z_ele_anchor_pt, c_Int& z_field_type, c_Int& z_iz0, c_Int& z_iz1, c_Real& z_dz, c_RealArr z_r0, c_Real& z_field_scale, c_Int& z_master_parameter, c_Bool& z_curved_ref_frame) { // c_side.to_c2_set[character, 0, NOT] C.file = z_file; // c_side.to_c2_set[type, 1, ALLOC] C.gg.resize(n1_gg); for (int i = 0; i < n1_gg; i++) gen_grad1_to_c(z_gg[i], C.gg[i]); // c_side.to_c2_set[integer, 0, NOT] C.ele_anchor_pt = z_ele_anchor_pt; // c_side.to_c2_set[integer, 0, NOT] C.field_type = z_field_type; // c_side.to_c2_set[integer, 0, NOT] C.iz0 = z_iz0; // c_side.to_c2_set[integer, 0, NOT] C.iz1 = z_iz1; // c_side.to_c2_set[real, 0, NOT] C.dz = z_dz; // c_side.to_c2_set[real, 1, NOT] C.r0 << z_r0; // c_side.to_c2_set[real, 0, NOT] C.field_scale = z_field_scale; // c_side.to_c2_set[integer, 0, NOT] C.master_parameter = z_master_parameter; // c_side.to_c2_set[logical, 0, NOT] C.curved_ref_frame = z_curved_ref_frame; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_surface_grid_pt extern "C" void surface_grid_pt_to_c (const Opaque_surface_grid_pt_class*, CPP_surface_grid_pt&); // c_side.to_f2_arg extern "C" void surface_grid_pt_to_f2 (Opaque_surface_grid_pt_class*, const CPP_surface_orientation&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&); extern "C" void surface_grid_pt_to_f (const CPP_surface_grid_pt& C, Opaque_surface_grid_pt_class* F) { // c_side.to_f2_call surface_grid_pt_to_f2 (F, C.orientation, C.z0, C.x0, C.y0, C.dz_dx, C.dz_dy, C.d2z_dxdy); } // c_side.to_c2_arg extern "C" void surface_grid_pt_to_c2 (CPP_surface_grid_pt& C, const Opaque_surface_orientation_class* z_orientation, c_Real& z_z0, c_Real& z_x0, c_Real& z_y0, c_Real& z_dz_dx, c_Real& z_dz_dy, c_Real& z_d2z_dxdy) { // c_side.to_c2_set[type, 0, NOT] surface_orientation_to_c(z_orientation, C.orientation); // c_side.to_c2_set[real, 0, NOT] C.z0 = z_z0; // c_side.to_c2_set[real, 0, NOT] C.x0 = z_x0; // c_side.to_c2_set[real, 0, NOT] C.y0 = z_y0; // c_side.to_c2_set[real, 0, NOT] C.dz_dx = z_dz_dx; // c_side.to_c2_set[real, 0, NOT] C.dz_dy = z_dz_dy; // c_side.to_c2_set[real, 0, NOT] C.d2z_dxdy = z_d2z_dxdy; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_surface_grid extern "C" void surface_grid_to_c (const Opaque_surface_grid_class*, CPP_surface_grid&); // c_side.to_f2_arg extern "C" void surface_grid_to_f2 (Opaque_surface_grid_class*, c_Bool&, c_Int&, c_RealArr, c_RealArr, const CPP_surface_grid_pt**, Int, Int); extern "C" void surface_grid_to_f (const CPP_surface_grid& C, Opaque_surface_grid_class* F) { // c_side.to_f_setup[type, 2, ALLOC] int n1_pt = C.pt.size(), n2_pt = 0; const CPP_surface_grid_pt** z_pt = NULL; if (n1_pt > 0) { n2_pt = C.pt[0].size(); z_pt = new const CPP_surface_grid_pt* [n1_pt*n2_pt]; for (int i = 0; i < n1_pt; i++) { for (int j = 0; j < n2_pt; j++) z_pt[i*n2_pt + j] = &C.pt[i][j];} } // c_side.to_f2_call surface_grid_to_f2 (F, C.active, C.type, &C.dr[0], &C.r0[0], z_pt, n1_pt, n2_pt); // c_side.to_f_cleanup[type, 2, ALLOC] delete[] z_pt; } // c_side.to_c2_arg extern "C" void surface_grid_to_c2 (CPP_surface_grid& C, c_Bool& z_active, c_Int& z_type, c_RealArr z_dr, c_RealArr z_r0, Opaque_surface_grid_pt_class** z_pt, Int n1_pt, Int n2_pt) { // c_side.to_c2_set[logical, 0, NOT] C.active = z_active; // c_side.to_c2_set[integer, 0, NOT] C.type = z_type; // c_side.to_c2_set[real, 1, NOT] C.dr << z_dr; // c_side.to_c2_set[real, 1, NOT] C.r0 << z_r0; // c_side.to_c2_set[type, 2, ALLOC] C.pt.resize(n1_pt); for (int i = 0; i < n1_pt; i++) { C.pt[i].resize(n2_pt); for (int j = 0; j < n2_pt; j++) surface_grid_pt_to_c(z_pt[n2_pt*i+j], C.pt[i][j]); } } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_target_point extern "C" void target_point_to_c (const Opaque_target_point_class*, CPP_target_point&); // c_side.to_f2_arg extern "C" void target_point_to_f2 (Opaque_target_point_class*, c_RealArr); extern "C" void target_point_to_f (const CPP_target_point& C, Opaque_target_point_class* F) { // c_side.to_f2_call target_point_to_f2 (F, &C.r[0]); } // c_side.to_c2_arg extern "C" void target_point_to_c2 (CPP_target_point& C, c_RealArr z_r) { // c_side.to_c2_set[real, 1, NOT] C.r << z_r; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_surface_curvature extern "C" void surface_curvature_to_c (const Opaque_surface_curvature_class*, CPP_surface_curvature&); // c_side.to_f2_arg extern "C" void surface_curvature_to_f2 (Opaque_surface_curvature_class*, c_RealArr, c_Real&, c_RealArr, c_Bool&); extern "C" void surface_curvature_to_f (const CPP_surface_curvature& C, Opaque_surface_curvature_class* F) { // c_side.to_f_setup[real, 2, NOT] Real z_xy[7*7]; matrix_to_vec(C.xy, z_xy); // c_side.to_f2_call surface_curvature_to_f2 (F, z_xy, C.spherical, &C.elliptical[0], C.has_curvature); } // c_side.to_c2_arg extern "C" void surface_curvature_to_c2 (CPP_surface_curvature& C, c_RealArr z_xy, c_Real& z_spherical, c_RealArr z_elliptical, c_Bool& z_has_curvature) { // c_side.to_c2_set[real, 2, NOT] C.xy << z_xy; // c_side.to_c2_set[real, 0, NOT] C.spherical = z_spherical; // c_side.to_c2_set[real, 1, NOT] C.elliptical << z_elliptical; // c_side.to_c2_set[logical, 0, NOT] C.has_curvature = z_has_curvature; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_photon_target extern "C" void photon_target_to_c (const Opaque_photon_target_class*, CPP_photon_target&); // c_side.to_f2_arg extern "C" void photon_target_to_f2 (Opaque_photon_target_class*, c_Int&, c_Int&, const CPP_lat_ele_loc&, const CPP_target_point**, const CPP_target_point&); extern "C" void photon_target_to_f (const CPP_photon_target& C, Opaque_photon_target_class* F) { // c_side.to_f_setup[type, 1, NOT] const CPP_target_point* z_corner[8]; for (int i = 0; i < 8; i++) {z_corner[i] = &C.corner[i];} // c_side.to_f2_call photon_target_to_f2 (F, C.type, C.n_corner, C.ele_loc, z_corner, C.center); } // c_side.to_c2_arg extern "C" void photon_target_to_c2 (CPP_photon_target& C, c_Int& z_type, c_Int& z_n_corner, const Opaque_lat_ele_loc_class* z_ele_loc, const Opaque_target_point_class** z_corner, const Opaque_target_point_class* z_center) { // c_side.to_c2_set[integer, 0, NOT] C.type = z_type; // c_side.to_c2_set[integer, 0, NOT] C.n_corner = z_n_corner; // c_side.to_c2_set[type, 0, NOT] lat_ele_loc_to_c(z_ele_loc, C.ele_loc); // c_side.to_c2_set[type, 1, NOT] for (unsigned int i = 0; i < C.corner.size(); i++) target_point_to_c(z_corner[i], C.corner[i]); // c_side.to_c2_set[type, 0, NOT] target_point_to_c(z_center, C.center); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_photon_material extern "C" void photon_material_to_c (const Opaque_photon_material_class*, CPP_photon_material&); // c_side.to_f2_arg extern "C" void photon_material_to_f2 (Opaque_photon_material_class*, c_Complex&, c_Complex&, c_Complex&, c_Complex&, c_Complex&, c_Complex&, c_RealArr, c_RealArr); extern "C" void photon_material_to_f (const CPP_photon_material& C, Opaque_photon_material_class* F) { // c_side.to_f2_call photon_material_to_f2 (F, C.f0_m1, C.f0_m2, C.f_0, C.f_h, C.f_hbar, C.f_hkl, &C.h_norm[0], &C.l_ref[0]); } // c_side.to_c2_arg extern "C" void photon_material_to_c2 (CPP_photon_material& C, c_Complex& z_f0_m1, c_Complex& z_f0_m2, c_Complex& z_f_0, c_Complex& z_f_h, c_Complex& z_f_hbar, c_Complex& z_f_hkl, c_RealArr z_h_norm, c_RealArr z_l_ref) { // c_side.to_c2_set[complex, 0, NOT] C.f0_m1 = z_f0_m1; // c_side.to_c2_set[complex, 0, NOT] C.f0_m2 = z_f0_m2; // c_side.to_c2_set[complex, 0, NOT] C.f_0 = z_f_0; // c_side.to_c2_set[complex, 0, NOT] C.f_h = z_f_h; // c_side.to_c2_set[complex, 0, NOT] C.f_hbar = z_f_hbar; // c_side.to_c2_set[complex, 0, NOT] C.f_hkl = z_f_hkl; // c_side.to_c2_set[real, 1, NOT] C.h_norm << z_h_norm; // c_side.to_c2_set[real, 1, NOT] C.l_ref << z_l_ref; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_pixel_pt extern "C" void pixel_pt_to_c (const Opaque_pixel_pt_class*, CPP_pixel_pt&); // c_side.to_f2_arg extern "C" void pixel_pt_to_f2 (Opaque_pixel_pt_class*, c_Int8&, c_Complex&, c_Complex&, c_Real&, c_Real&, c_Real&, c_RealArr, c_RealArr, c_RealArr, c_RealArr); extern "C" void pixel_pt_to_f (const CPP_pixel_pt& C, Opaque_pixel_pt_class* F) { // c_side.to_f2_call pixel_pt_to_f2 (F, C.n_photon, C.e_x, C.e_y, C.intensity_x, C.intensity_y, C.intensity, &C.orbit[0], &C.orbit_rms[0], &C.init_orbit[0], &C.init_orbit_rms[0]); } // c_side.to_c2_arg extern "C" void pixel_pt_to_c2 (CPP_pixel_pt& C, c_Int8& z_n_photon, c_Complex& z_e_x, c_Complex& z_e_y, c_Real& z_intensity_x, c_Real& z_intensity_y, c_Real& z_intensity, c_RealArr z_orbit, c_RealArr z_orbit_rms, c_RealArr z_init_orbit, c_RealArr z_init_orbit_rms) { // c_side.to_c2_set[integer8, 0, NOT] C.n_photon = z_n_photon; // c_side.to_c2_set[complex, 0, NOT] C.e_x = z_e_x; // c_side.to_c2_set[complex, 0, NOT] C.e_y = z_e_y; // c_side.to_c2_set[real, 0, NOT] C.intensity_x = z_intensity_x; // c_side.to_c2_set[real, 0, NOT] C.intensity_y = z_intensity_y; // c_side.to_c2_set[real, 0, NOT] C.intensity = z_intensity; // c_side.to_c2_set[real, 1, NOT] C.orbit << z_orbit; // c_side.to_c2_set[real, 1, NOT] C.orbit_rms << z_orbit_rms; // c_side.to_c2_set[real, 1, NOT] C.init_orbit << z_init_orbit; // c_side.to_c2_set[real, 1, NOT] C.init_orbit_rms << z_init_orbit_rms; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_pixel_detec extern "C" void pixel_detec_to_c (const Opaque_pixel_detec_class*, CPP_pixel_detec&); // c_side.to_f2_arg extern "C" void pixel_detec_to_f2 (Opaque_pixel_detec_class*, c_RealArr, c_RealArr, c_Int8&, c_Int8&, c_Int8&, const CPP_pixel_pt**, Int, Int); extern "C" void pixel_detec_to_f (const CPP_pixel_detec& C, Opaque_pixel_detec_class* F) { // c_side.to_f_setup[type, 2, ALLOC] int n1_pt = C.pt.size(), n2_pt = 0; const CPP_pixel_pt** z_pt = NULL; if (n1_pt > 0) { n2_pt = C.pt[0].size(); z_pt = new const CPP_pixel_pt* [n1_pt*n2_pt]; for (int i = 0; i < n1_pt; i++) { for (int j = 0; j < n2_pt; j++) z_pt[i*n2_pt + j] = &C.pt[i][j];} } // c_side.to_f2_call pixel_detec_to_f2 (F, &C.dr[0], &C.r0[0], C.n_track_tot, C.n_hit_detec, C.n_hit_pixel, z_pt, n1_pt, n2_pt); // c_side.to_f_cleanup[type, 2, ALLOC] delete[] z_pt; } // c_side.to_c2_arg extern "C" void pixel_detec_to_c2 (CPP_pixel_detec& C, c_RealArr z_dr, c_RealArr z_r0, c_Int8& z_n_track_tot, c_Int8& z_n_hit_detec, c_Int8& z_n_hit_pixel, Opaque_pixel_pt_class** z_pt, Int n1_pt, Int n2_pt) { // c_side.to_c2_set[real, 1, NOT] C.dr << z_dr; // c_side.to_c2_set[real, 1, NOT] C.r0 << z_r0; // c_side.to_c2_set[integer8, 0, NOT] C.n_track_tot = z_n_track_tot; // c_side.to_c2_set[integer8, 0, NOT] C.n_hit_detec = z_n_hit_detec; // c_side.to_c2_set[integer8, 0, NOT] C.n_hit_pixel = z_n_hit_pixel; // c_side.to_c2_set[type, 2, ALLOC] C.pt.resize(n1_pt); for (int i = 0; i < n1_pt; i++) { C.pt[i].resize(n2_pt); for (int j = 0; j < n2_pt; j++) pixel_pt_to_c(z_pt[n2_pt*i+j], C.pt[i][j]); } } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_photon_element extern "C" void photon_element_to_c (const Opaque_photon_element_class*, CPP_photon_element&); // c_side.to_f2_arg extern "C" void photon_element_to_f2 (Opaque_photon_element_class*, const CPP_surface_curvature&, const CPP_photon_target&, const CPP_photon_material&, const CPP_surface_grid&, const CPP_pixel_detec&, const CPP_photon_reflect_table&, const CPP_photon_reflect_table&, const CPP_spline**, Int, c_RealArr, Int); extern "C" void photon_element_to_f (const CPP_photon_element& C, Opaque_photon_element_class* F) { // c_side.to_f_setup[type, 1, ALLOC] int n1_init_energy_prob = C.init_energy_prob.size(); const CPP_spline** z_init_energy_prob = NULL; if (n1_init_energy_prob != 0) { z_init_energy_prob = new const CPP_spline*[n1_init_energy_prob]; for (int i = 0; i < n1_init_energy_prob; i++) z_init_energy_prob[i] = &C.init_energy_prob[i]; } // c_side.to_f_setup[real, 1, ALLOC] int n1_integrated_init_energy_prob = C.integrated_init_energy_prob.size(); c_RealArr z_integrated_init_energy_prob = NULL; if (n1_integrated_init_energy_prob > 0) { z_integrated_init_energy_prob = &C.integrated_init_energy_prob[0]; } // c_side.to_f2_call photon_element_to_f2 (F, C.curvature, C.target, C.material, C.grid, C.pixel, C.reflectivity_table_sigma, C.reflectivity_table_pi, z_init_energy_prob, n1_init_energy_prob, z_integrated_init_energy_prob, n1_integrated_init_energy_prob); // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_init_energy_prob; } // c_side.to_c2_arg extern "C" void photon_element_to_c2 (CPP_photon_element& C, const Opaque_surface_curvature_class* z_curvature, const Opaque_photon_target_class* z_target, const Opaque_photon_material_class* z_material, const Opaque_surface_grid_class* z_grid, const Opaque_pixel_detec_class* z_pixel, const Opaque_photon_reflect_table_class* z_reflectivity_table_sigma, const Opaque_photon_reflect_table_class* z_reflectivity_table_pi, Opaque_spline_class** z_init_energy_prob, Int n1_init_energy_prob, c_RealArr z_integrated_init_energy_prob, Int n1_integrated_init_energy_prob) { // c_side.to_c2_set[type, 0, NOT] surface_curvature_to_c(z_curvature, C.curvature); // c_side.to_c2_set[type, 0, NOT] photon_target_to_c(z_target, C.target); // c_side.to_c2_set[type, 0, NOT] photon_material_to_c(z_material, C.material); // c_side.to_c2_set[type, 0, NOT] surface_grid_to_c(z_grid, C.grid); // c_side.to_c2_set[type, 0, NOT] pixel_detec_to_c(z_pixel, C.pixel); // c_side.to_c2_set[type, 0, NOT] photon_reflect_table_to_c(z_reflectivity_table_sigma, C.reflectivity_table_sigma); // c_side.to_c2_set[type, 0, NOT] photon_reflect_table_to_c(z_reflectivity_table_pi, C.reflectivity_table_pi); // c_side.to_c2_set[type, 1, ALLOC] C.init_energy_prob.resize(n1_init_energy_prob); for (int i = 0; i < n1_init_energy_prob; i++) spline_to_c(z_init_energy_prob[i], C.init_energy_prob[i]); // c_side.to_c2_set[real, 1, ALLOC] C.integrated_init_energy_prob.resize(n1_integrated_init_energy_prob); C.integrated_init_energy_prob << z_integrated_init_energy_prob; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_wall3d_vertex extern "C" void wall3d_vertex_to_c (const Opaque_wall3d_vertex_class*, CPP_wall3d_vertex&); // c_side.to_f2_arg extern "C" void wall3d_vertex_to_f2 (Opaque_wall3d_vertex_class*, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Int&); extern "C" void wall3d_vertex_to_f (const CPP_wall3d_vertex& C, Opaque_wall3d_vertex_class* F) { // c_side.to_f2_call wall3d_vertex_to_f2 (F, C.x, C.y, C.radius_x, C.radius_y, C.tilt, C.angle, C.x0, C.y0, C.type); } // c_side.to_c2_arg extern "C" void wall3d_vertex_to_c2 (CPP_wall3d_vertex& C, c_Real& z_x, c_Real& z_y, c_Real& z_radius_x, c_Real& z_radius_y, c_Real& z_tilt, c_Real& z_angle, c_Real& z_x0, c_Real& z_y0, c_Int& z_type) { // c_side.to_c2_set[real, 0, NOT] C.x = z_x; // c_side.to_c2_set[real, 0, NOT] C.y = z_y; // c_side.to_c2_set[real, 0, NOT] C.radius_x = z_radius_x; // c_side.to_c2_set[real, 0, NOT] C.radius_y = z_radius_y; // c_side.to_c2_set[real, 0, NOT] C.tilt = z_tilt; // c_side.to_c2_set[real, 0, NOT] C.angle = z_angle; // c_side.to_c2_set[real, 0, NOT] C.x0 = z_x0; // c_side.to_c2_set[real, 0, NOT] C.y0 = z_y0; // c_side.to_c2_set[integer, 0, NOT] C.type = z_type; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_wall3d_section extern "C" void wall3d_section_to_c (const Opaque_wall3d_section_class*, CPP_wall3d_section&); // c_side.to_f2_arg extern "C" void wall3d_section_to_f2 (Opaque_wall3d_section_class*, c_Char, c_Char, const CPP_wall3d_vertex**, Int, const CPP_photon_reflect_surface&, Int, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Bool&, c_Real&, c_Real&, c_RealArr, c_Real&, c_Real&, c_RealArr, c_RealArr, c_Real&, c_RealArr, c_RealArr); extern "C" void wall3d_section_to_f (const CPP_wall3d_section& C, Opaque_wall3d_section_class* F) { // c_side.to_f_setup[type, 1, ALLOC] int n1_v = C.v.size(); const CPP_wall3d_vertex** z_v = NULL; if (n1_v != 0) { z_v = new const CPP_wall3d_vertex*[n1_v]; for (int i = 0; i < n1_v; i++) z_v[i] = &C.v[i]; } // c_side.to_f_setup[type, 0, PTR] unsigned int n_surface = 0; if (C.surface != NULL) n_surface = 1; // c_side.to_f2_call wall3d_section_to_f2 (F, C.name.c_str(), C.material.c_str(), z_v, n1_v, *C.surface, n_surface, C.type, C.n_vertex_input, C.ix_ele, C.ix_branch, C.vertices_state, C.patch_in_region, C.thickness, C.s, &C.r0[0], C.dx0_ds, C.dy0_ds, &C.x0_coef[0], &C.y0_coef[0], C.dr_ds, &C.p1_coef[0], &C.p2_coef[0]); // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_v; } // c_side.to_c2_arg extern "C" void wall3d_section_to_c2 (CPP_wall3d_section& C, c_Char z_name, c_Char z_material, Opaque_wall3d_vertex_class** z_v, Int n1_v, Opaque_photon_reflect_surface_class* z_surface, Int n_surface, c_Int& z_type, c_Int& z_n_vertex_input, c_Int& z_ix_ele, c_Int& z_ix_branch, c_Int& z_vertices_state, c_Bool& z_patch_in_region, c_Real& z_thickness, c_Real& z_s, c_RealArr z_r0, c_Real& z_dx0_ds, c_Real& z_dy0_ds, c_RealArr z_x0_coef, c_RealArr z_y0_coef, c_Real& z_dr_ds, c_RealArr z_p1_coef, c_RealArr z_p2_coef) { // c_side.to_c2_set[character, 0, NOT] C.name = z_name; // c_side.to_c2_set[character, 0, NOT] C.material = z_material; // c_side.to_c2_set[type, 1, ALLOC] C.v.resize(n1_v); for (int i = 0; i < n1_v; i++) wall3d_vertex_to_c(z_v[i], C.v[i]); // c_side.to_c2_set[type, 0, PTR] if (n_surface == 0) delete C.surface; else { C.surface = new CPP_photon_reflect_surface; photon_reflect_surface_to_c(z_surface, *C.surface); } // c_side.to_c2_set[integer, 0, NOT] C.type = z_type; // c_side.to_c2_set[integer, 0, NOT] C.n_vertex_input = z_n_vertex_input; // c_side.to_c2_set[integer, 0, NOT] C.ix_ele = z_ix_ele; // c_side.to_c2_set[integer, 0, NOT] C.ix_branch = z_ix_branch; // c_side.to_c2_set[integer, 0, NOT] C.vertices_state = z_vertices_state; // c_side.to_c2_set[logical, 0, NOT] C.patch_in_region = z_patch_in_region; // c_side.to_c2_set[real, 0, NOT] C.thickness = z_thickness; // c_side.to_c2_set[real, 0, NOT] C.s = z_s; // c_side.to_c2_set[real, 1, NOT] C.r0 << z_r0; // c_side.to_c2_set[real, 0, NOT] C.dx0_ds = z_dx0_ds; // c_side.to_c2_set[real, 0, NOT] C.dy0_ds = z_dy0_ds; // c_side.to_c2_set[real, 1, NOT] C.x0_coef << z_x0_coef; // c_side.to_c2_set[real, 1, NOT] C.y0_coef << z_y0_coef; // c_side.to_c2_set[real, 0, NOT] C.dr_ds = z_dr_ds; // c_side.to_c2_set[real, 1, NOT] C.p1_coef << z_p1_coef; // c_side.to_c2_set[real, 1, NOT] C.p2_coef << z_p2_coef; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_wall3d extern "C" void wall3d_to_c (const Opaque_wall3d_class*, CPP_wall3d&); // c_side.to_f2_arg extern "C" void wall3d_to_f2 (Opaque_wall3d_class*, c_Char, c_Int&, c_Int&, c_Int&, c_Real&, c_Char, c_Char, c_Bool&, c_Int&, const CPP_wall3d_section**, Int); extern "C" void wall3d_to_f (const CPP_wall3d& C, Opaque_wall3d_class* F) { // c_side.to_f_setup[type, 1, ALLOC] int n1_section = C.section.size(); const CPP_wall3d_section** z_section = NULL; if (n1_section != 0) { z_section = new const CPP_wall3d_section*[n1_section]; for (int i = 0; i < n1_section; i++) z_section[i] = &C.section[i]; } // c_side.to_f2_call wall3d_to_f2 (F, C.name.c_str(), C.type, C.ix_wall3d, C.n_link, C.thickness, C.clear_material.c_str(), C.opaque_material.c_str(), C.superimpose, C.ele_anchor_pt, z_section, n1_section); // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_section; } // c_side.to_c2_arg extern "C" void wall3d_to_c2 (CPP_wall3d& C, c_Char z_name, c_Int& z_type, c_Int& z_ix_wall3d, c_Int& z_n_link, c_Real& z_thickness, c_Char z_clear_material, c_Char z_opaque_material, c_Bool& z_superimpose, c_Int& z_ele_anchor_pt, Opaque_wall3d_section_class** z_section, Int n1_section) { // c_side.to_c2_set[character, 0, NOT] C.name = z_name; // c_side.to_c2_set[integer, 0, NOT] C.type = z_type; // c_side.to_c2_set[integer, 0, NOT] C.ix_wall3d = z_ix_wall3d; // c_side.to_c2_set[integer, 0, NOT] C.n_link = z_n_link; // c_side.to_c2_set[real, 0, NOT] C.thickness = z_thickness; // c_side.to_c2_set[character, 0, NOT] C.clear_material = z_clear_material; // c_side.to_c2_set[character, 0, NOT] C.opaque_material = z_opaque_material; // c_side.to_c2_set[logical, 0, NOT] C.superimpose = z_superimpose; // c_side.to_c2_set[integer, 0, NOT] C.ele_anchor_pt = z_ele_anchor_pt; // c_side.to_c2_set[type, 1, ALLOC] C.section.resize(n1_section); for (int i = 0; i < n1_section; i++) wall3d_section_to_c(z_section[i], C.section[i]); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_control extern "C" void control_to_c (const Opaque_control_class*, CPP_control&); // c_side.to_f2_arg extern "C" void control_to_f2 (Opaque_control_class*, c_Real&, c_RealArr, Int, const CPP_expression_atom**, Int, const CPP_lat_ele_loc&, const CPP_lat_ele_loc&, c_Char, c_Char, c_Int&); extern "C" void control_to_f (const CPP_control& C, Opaque_control_class* F) { // c_side.to_f_setup[real, 1, ALLOC] int n1_y_knot = C.y_knot.size(); c_RealArr z_y_knot = NULL; if (n1_y_knot > 0) { z_y_knot = &C.y_knot[0]; } // c_side.to_f_setup[type, 1, ALLOC] int n1_stack = C.stack.size(); const CPP_expression_atom** z_stack = NULL; if (n1_stack != 0) { z_stack = new const CPP_expression_atom*[n1_stack]; for (int i = 0; i < n1_stack; i++) z_stack[i] = &C.stack[i]; } // c_side.to_f2_call control_to_f2 (F, C.value, z_y_knot, n1_y_knot, z_stack, n1_stack, C.slave, C.lord, C.attribute.c_str(), C.slave_name.c_str(), C.ix_attrib); // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_stack; } // c_side.to_c2_arg extern "C" void control_to_c2 (CPP_control& C, c_Real& z_value, c_RealArr z_y_knot, Int n1_y_knot, Opaque_expression_atom_class** z_stack, Int n1_stack, const Opaque_lat_ele_loc_class* z_slave, const Opaque_lat_ele_loc_class* z_lord, c_Char z_attribute, c_Char z_slave_name, c_Int& z_ix_attrib) { // c_side.to_c2_set[real, 0, NOT] C.value = z_value; // c_side.to_c2_set[real, 1, ALLOC] C.y_knot.resize(n1_y_knot); C.y_knot << z_y_knot; // c_side.to_c2_set[type, 1, ALLOC] C.stack.resize(n1_stack); for (int i = 0; i < n1_stack; i++) expression_atom_to_c(z_stack[i], C.stack[i]); // c_side.to_c2_set[type, 0, NOT] lat_ele_loc_to_c(z_slave, C.slave); // c_side.to_c2_set[type, 0, NOT] lat_ele_loc_to_c(z_lord, C.lord); // c_side.to_c2_set[character, 0, NOT] C.attribute = z_attribute; // c_side.to_c2_set[character, 0, NOT] C.slave_name = z_slave_name; // c_side.to_c2_set[integer, 0, NOT] C.ix_attrib = z_ix_attrib; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_controller_var1 extern "C" void controller_var1_to_c (const Opaque_controller_var1_class*, CPP_controller_var1&); // c_side.to_f2_arg extern "C" void controller_var1_to_f2 (Opaque_controller_var1_class*, c_Char, c_Real&, c_Real&); extern "C" void controller_var1_to_f (const CPP_controller_var1& C, Opaque_controller_var1_class* F) { // c_side.to_f2_call controller_var1_to_f2 (F, C.name.c_str(), C.value, C.old_value); } // c_side.to_c2_arg extern "C" void controller_var1_to_c2 (CPP_controller_var1& C, c_Char z_name, c_Real& z_value, c_Real& z_old_value) { // c_side.to_c2_set[character, 0, NOT] C.name = z_name; // c_side.to_c2_set[real, 0, NOT] C.value = z_value; // c_side.to_c2_set[real, 0, NOT] C.old_value = z_old_value; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_controller extern "C" void controller_to_c (const Opaque_controller_class*, CPP_controller&); // c_side.to_f2_arg extern "C" void controller_to_f2 (Opaque_controller_class*, const CPP_controller_var1**, Int, const CPP_control**, Int, c_RealArr, Int); extern "C" void controller_to_f (const CPP_controller& C, Opaque_controller_class* F) { // c_side.to_f_setup[type, 1, ALLOC] int n1_var = C.var.size(); const CPP_controller_var1** z_var = NULL; if (n1_var != 0) { z_var = new const CPP_controller_var1*[n1_var]; for (int i = 0; i < n1_var; i++) z_var[i] = &C.var[i]; } // c_side.to_f_setup[type, 1, ALLOC] int n1_ramp = C.ramp.size(); const CPP_control** z_ramp = NULL; if (n1_ramp != 0) { z_ramp = new const CPP_control*[n1_ramp]; for (int i = 0; i < n1_ramp; i++) z_ramp[i] = &C.ramp[i]; } // c_side.to_f_setup[real, 1, ALLOC] int n1_x_knot = C.x_knot.size(); c_RealArr z_x_knot = NULL; if (n1_x_knot > 0) { z_x_knot = &C.x_knot[0]; } // c_side.to_f2_call controller_to_f2 (F, z_var, n1_var, z_ramp, n1_ramp, z_x_knot, n1_x_knot); // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_var; // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_ramp; } // c_side.to_c2_arg extern "C" void controller_to_c2 (CPP_controller& C, Opaque_controller_var1_class** z_var, Int n1_var, Opaque_control_class** z_ramp, Int n1_ramp, c_RealArr z_x_knot, Int n1_x_knot) { // c_side.to_c2_set[type, 1, ALLOC] C.var.resize(n1_var); for (int i = 0; i < n1_var; i++) controller_var1_to_c(z_var[i], C.var[i]); // c_side.to_c2_set[type, 1, ALLOC] C.ramp.resize(n1_ramp); for (int i = 0; i < n1_ramp; i++) control_to_c(z_ramp[i], C.ramp[i]); // c_side.to_c2_set[real, 1, ALLOC] C.x_knot.resize(n1_x_knot); C.x_knot << z_x_knot; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_ellipse_beam_init extern "C" void ellipse_beam_init_to_c (const Opaque_ellipse_beam_init_class*, CPP_ellipse_beam_init&); // c_side.to_f2_arg extern "C" void ellipse_beam_init_to_f2 (Opaque_ellipse_beam_init_class*, c_Int&, c_Int&, c_Real&); extern "C" void ellipse_beam_init_to_f (const CPP_ellipse_beam_init& C, Opaque_ellipse_beam_init_class* F) { // c_side.to_f2_call ellipse_beam_init_to_f2 (F, C.part_per_ellipse, C.n_ellipse, C.sigma_cutoff); } // c_side.to_c2_arg extern "C" void ellipse_beam_init_to_c2 (CPP_ellipse_beam_init& C, c_Int& z_part_per_ellipse, c_Int& z_n_ellipse, c_Real& z_sigma_cutoff) { // c_side.to_c2_set[integer, 0, NOT] C.part_per_ellipse = z_part_per_ellipse; // c_side.to_c2_set[integer, 0, NOT] C.n_ellipse = z_n_ellipse; // c_side.to_c2_set[real, 0, NOT] C.sigma_cutoff = z_sigma_cutoff; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_kv_beam_init extern "C" void kv_beam_init_to_c (const Opaque_kv_beam_init_class*, CPP_kv_beam_init&); // c_side.to_f2_arg extern "C" void kv_beam_init_to_f2 (Opaque_kv_beam_init_class*, c_IntArr, c_Int&, c_Real&); extern "C" void kv_beam_init_to_f (const CPP_kv_beam_init& C, Opaque_kv_beam_init_class* F) { // c_side.to_f2_call kv_beam_init_to_f2 (F, &C.part_per_phi[0], C.n_i2, C.a); } // c_side.to_c2_arg extern "C" void kv_beam_init_to_c2 (CPP_kv_beam_init& C, c_IntArr z_part_per_phi, c_Int& z_n_i2, c_Real& z_a) { // c_side.to_c2_set[integer, 1, NOT] C.part_per_phi << z_part_per_phi; // c_side.to_c2_set[integer, 0, NOT] C.n_i2 = z_n_i2; // c_side.to_c2_set[real, 0, NOT] C.a = z_a; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_grid_beam_init extern "C" void grid_beam_init_to_c (const Opaque_grid_beam_init_class*, CPP_grid_beam_init&); // c_side.to_f2_arg extern "C" void grid_beam_init_to_f2 (Opaque_grid_beam_init_class*, c_Int&, c_Int&, c_Real&, c_Real&, c_Real&, c_Real&); extern "C" void grid_beam_init_to_f (const CPP_grid_beam_init& C, Opaque_grid_beam_init_class* F) { // c_side.to_f2_call grid_beam_init_to_f2 (F, C.n_x, C.n_px, C.x_min, C.x_max, C.px_min, C.px_max); } // c_side.to_c2_arg extern "C" void grid_beam_init_to_c2 (CPP_grid_beam_init& C, c_Int& z_n_x, c_Int& z_n_px, c_Real& z_x_min, c_Real& z_x_max, c_Real& z_px_min, c_Real& z_px_max) { // c_side.to_c2_set[integer, 0, NOT] C.n_x = z_n_x; // c_side.to_c2_set[integer, 0, NOT] C.n_px = z_n_px; // c_side.to_c2_set[real, 0, NOT] C.x_min = z_x_min; // c_side.to_c2_set[real, 0, NOT] C.x_max = z_x_max; // c_side.to_c2_set[real, 0, NOT] C.px_min = z_px_min; // c_side.to_c2_set[real, 0, NOT] C.px_max = z_px_max; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_beam_init extern "C" void beam_init_to_c (const Opaque_beam_init_class*, CPP_beam_init&); // c_side.to_f2_arg extern "C" void beam_init_to_f2 (Opaque_beam_init_class*, c_Char, c_Char, c_Char*, c_RealArr, const CPP_ellipse_beam_init**, const CPP_kv_beam_init&, const CPP_grid_beam_init**, c_RealArr, c_RealArr, c_Real&, c_Real&, c_Int&, c_Bool&, c_Bool&, c_Char, c_Char, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_RealArr, c_Real&, c_Real&, c_Real&, c_Real&, c_Int&, c_Char, c_Bool&, c_Bool&, c_Bool&, c_Bool&, c_Bool&, c_Real&, c_Real&, c_Bool&); extern "C" void beam_init_to_f (const CPP_beam_init& C, Opaque_beam_init_class* F) { // c_side.to_f_setup[character, 1, NOT] c_Char z_distribution_type[3]; for (int i = 0; i < 3; i++) {z_distribution_type[i] = C.distribution_type[i].c_str();} // c_side.to_f_setup[type, 1, NOT] const CPP_ellipse_beam_init* z_ellipse[3]; for (int i = 0; i < 3; i++) {z_ellipse[i] = &C.ellipse[i];} // c_side.to_f_setup[type, 1, NOT] const CPP_grid_beam_init* z_grid[3]; for (int i = 0; i < 3; i++) {z_grid[i] = &C.grid[i];} // c_side.to_f2_call beam_init_to_f2 (F, C.position_file.c_str(), C.file_name.c_str(), z_distribution_type, &C.spin[0], z_ellipse, C.kv, z_grid, &C.center_jitter[0], &C.emit_jitter[0], C.sig_z_jitter, C.sig_pz_jitter, C.n_particle, C.renorm_center, C.renorm_sigma, C.random_engine.c_str(), C.random_gauss_converter.c_str(), C.random_sigma_cutoff, C.a_norm_emit, C.b_norm_emit, C.a_emit, C.b_emit, C.dpz_dz, &C.center[0], C.dt_bunch, C.sig_z, C.sig_pz, C.bunch_charge, C.n_bunch, C.species.c_str(), C.init_spin, C.full_6d_coupling_calc, C.use_particle_start, C.use_t_coords, C.use_z_as_t, C.sig_e_jitter, C.sig_e, C.use_particle_start_for_center); } // c_side.to_c2_arg extern "C" void beam_init_to_c2 (CPP_beam_init& C, c_Char z_position_file, c_Char z_file_name, c_Char* z_distribution_type, c_RealArr z_spin, const Opaque_ellipse_beam_init_class** z_ellipse, const Opaque_kv_beam_init_class* z_kv, const Opaque_grid_beam_init_class** z_grid, c_RealArr z_center_jitter, c_RealArr z_emit_jitter, c_Real& z_sig_z_jitter, c_Real& z_sig_pz_jitter, c_Int& z_n_particle, c_Bool& z_renorm_center, c_Bool& z_renorm_sigma, c_Char z_random_engine, c_Char z_random_gauss_converter, c_Real& z_random_sigma_cutoff, c_Real& z_a_norm_emit, c_Real& z_b_norm_emit, c_Real& z_a_emit, c_Real& z_b_emit, c_Real& z_dpz_dz, c_RealArr z_center, c_Real& z_dt_bunch, c_Real& z_sig_z, c_Real& z_sig_pz, c_Real& z_bunch_charge, c_Int& z_n_bunch, c_Char z_species, c_Bool& z_init_spin, c_Bool& z_full_6d_coupling_calc, c_Bool& z_use_particle_start, c_Bool& z_use_t_coords, c_Bool& z_use_z_as_t, c_Real& z_sig_e_jitter, c_Real& z_sig_e, c_Bool& z_use_particle_start_for_center) { // c_side.to_c2_set[character, 0, NOT] C.position_file = z_position_file; // c_side.to_c2_set[character, 0, NOT] C.file_name = z_file_name; // c_side.to_c2_set[character, 1, NOT] for (unsigned int i = 0; i < C.distribution_type.size(); i++) C.distribution_type[i] = z_distribution_type[i]; // c_side.to_c2_set[real, 1, NOT] C.spin << z_spin; // c_side.to_c2_set[type, 1, NOT] for (unsigned int i = 0; i < C.ellipse.size(); i++) ellipse_beam_init_to_c(z_ellipse[i], C.ellipse[i]); // c_side.to_c2_set[type, 0, NOT] kv_beam_init_to_c(z_kv, C.kv); // c_side.to_c2_set[type, 1, NOT] for (unsigned int i = 0; i < C.grid.size(); i++) grid_beam_init_to_c(z_grid[i], C.grid[i]); // c_side.to_c2_set[real, 1, NOT] C.center_jitter << z_center_jitter; // c_side.to_c2_set[real, 1, NOT] C.emit_jitter << z_emit_jitter; // c_side.to_c2_set[real, 0, NOT] C.sig_z_jitter = z_sig_z_jitter; // c_side.to_c2_set[real, 0, NOT] C.sig_pz_jitter = z_sig_pz_jitter; // c_side.to_c2_set[integer, 0, NOT] C.n_particle = z_n_particle; // c_side.to_c2_set[logical, 0, NOT] C.renorm_center = z_renorm_center; // c_side.to_c2_set[logical, 0, NOT] C.renorm_sigma = z_renorm_sigma; // c_side.to_c2_set[character, 0, NOT] C.random_engine = z_random_engine; // c_side.to_c2_set[character, 0, NOT] C.random_gauss_converter = z_random_gauss_converter; // c_side.to_c2_set[real, 0, NOT] C.random_sigma_cutoff = z_random_sigma_cutoff; // c_side.to_c2_set[real, 0, NOT] C.a_norm_emit = z_a_norm_emit; // c_side.to_c2_set[real, 0, NOT] C.b_norm_emit = z_b_norm_emit; // c_side.to_c2_set[real, 0, NOT] C.a_emit = z_a_emit; // c_side.to_c2_set[real, 0, NOT] C.b_emit = z_b_emit; // c_side.to_c2_set[real, 0, NOT] C.dpz_dz = z_dpz_dz; // c_side.to_c2_set[real, 1, NOT] C.center << z_center; // c_side.to_c2_set[real, 0, NOT] C.dt_bunch = z_dt_bunch; // c_side.to_c2_set[real, 0, NOT] C.sig_z = z_sig_z; // c_side.to_c2_set[real, 0, NOT] C.sig_pz = z_sig_pz; // c_side.to_c2_set[real, 0, NOT] C.bunch_charge = z_bunch_charge; // c_side.to_c2_set[integer, 0, NOT] C.n_bunch = z_n_bunch; // c_side.to_c2_set[character, 0, NOT] C.species = z_species; // c_side.to_c2_set[logical, 0, NOT] C.init_spin = z_init_spin; // c_side.to_c2_set[logical, 0, NOT] C.full_6d_coupling_calc = z_full_6d_coupling_calc; // c_side.to_c2_set[logical, 0, NOT] C.use_particle_start = z_use_particle_start; // c_side.to_c2_set[logical, 0, NOT] C.use_t_coords = z_use_t_coords; // c_side.to_c2_set[logical, 0, NOT] C.use_z_as_t = z_use_z_as_t; // c_side.to_c2_set[real, 0, NOT] C.sig_e_jitter = z_sig_e_jitter; // c_side.to_c2_set[real, 0, NOT] C.sig_e = z_sig_e; // c_side.to_c2_set[logical, 0, NOT] C.use_particle_start_for_center = z_use_particle_start_for_center; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_lat_param extern "C" void lat_param_to_c (const Opaque_lat_param_class*, CPP_lat_param&); // c_side.to_f2_arg extern "C" void lat_param_to_f2 (Opaque_lat_param_class*, c_Real&, c_Real&, c_Real&, c_RealArr, c_RealArr, c_Real&, c_Int&, c_Int&, c_Int&, c_Int&, c_Bool&, c_Bool&, c_Real&, c_Real&, c_Real&, const CPP_bookkeeping_state&, const CPP_beam_init&); extern "C" void lat_param_to_f (const CPP_lat_param& C, Opaque_lat_param_class* F) { // c_side.to_f_setup[real, 2, NOT] Real z_t1_with_rf[6*6]; matrix_to_vec(C.t1_with_rf, z_t1_with_rf); // c_side.to_f_setup[real, 2, NOT] Real z_t1_no_rf[6*6]; matrix_to_vec(C.t1_no_rf, z_t1_no_rf); // c_side.to_f2_call lat_param_to_f2 (F, C.n_part, C.total_length, C.unstable_factor, z_t1_with_rf, z_t1_no_rf, C.spin_tune, C.particle, C.default_tracking_species, C.geometry, C.ixx, C.stable, C.live_branch, C.g1_integral, C.g2_integral, C.g3_integral, C.bookkeeping_state, C.beam_init); } // c_side.to_c2_arg extern "C" void lat_param_to_c2 (CPP_lat_param& C, c_Real& z_n_part, c_Real& z_total_length, c_Real& z_unstable_factor, c_RealArr z_t1_with_rf, c_RealArr z_t1_no_rf, c_Real& z_spin_tune, c_Int& z_particle, c_Int& z_default_tracking_species, c_Int& z_geometry, c_Int& z_ixx, c_Bool& z_stable, c_Bool& z_live_branch, c_Real& z_g1_integral, c_Real& z_g2_integral, c_Real& z_g3_integral, const Opaque_bookkeeping_state_class* z_bookkeeping_state, const Opaque_beam_init_class* z_beam_init) { // c_side.to_c2_set[real, 0, NOT] C.n_part = z_n_part; // c_side.to_c2_set[real, 0, NOT] C.total_length = z_total_length; // c_side.to_c2_set[real, 0, NOT] C.unstable_factor = z_unstable_factor; // c_side.to_c2_set[real, 2, NOT] C.t1_with_rf << z_t1_with_rf; // c_side.to_c2_set[real, 2, NOT] C.t1_no_rf << z_t1_no_rf; // c_side.to_c2_set[real, 0, NOT] C.spin_tune = z_spin_tune; // c_side.to_c2_set[integer, 0, NOT] C.particle = z_particle; // c_side.to_c2_set[integer, 0, NOT] C.default_tracking_species = z_default_tracking_species; // c_side.to_c2_set[integer, 0, NOT] C.geometry = z_geometry; // c_side.to_c2_set[integer, 0, NOT] C.ixx = z_ixx; // c_side.to_c2_set[logical, 0, NOT] C.stable = z_stable; // c_side.to_c2_set[logical, 0, NOT] C.live_branch = z_live_branch; // c_side.to_c2_set[real, 0, NOT] C.g1_integral = z_g1_integral; // c_side.to_c2_set[real, 0, NOT] C.g2_integral = z_g2_integral; // c_side.to_c2_set[real, 0, NOT] C.g3_integral = z_g3_integral; // c_side.to_c2_set[type, 0, NOT] bookkeeping_state_to_c(z_bookkeeping_state, C.bookkeeping_state); // c_side.to_c2_set[type, 0, NOT] beam_init_to_c(z_beam_init, C.beam_init); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_mode_info extern "C" void mode_info_to_c (const Opaque_mode_info_class*, CPP_mode_info&); // c_side.to_f2_arg extern "C" void mode_info_to_f2 (Opaque_mode_info_class*, c_Bool&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&); extern "C" void mode_info_to_f (const CPP_mode_info& C, Opaque_mode_info_class* F) { // c_side.to_f2_call mode_info_to_f2 (F, C.stable, C.tune, C.emit, C.chrom, C.sigma, C.sigmap); } // c_side.to_c2_arg extern "C" void mode_info_to_c2 (CPP_mode_info& C, c_Bool& z_stable, c_Real& z_tune, c_Real& z_emit, c_Real& z_chrom, c_Real& z_sigma, c_Real& z_sigmap) { // c_side.to_c2_set[logical, 0, NOT] C.stable = z_stable; // c_side.to_c2_set[real, 0, NOT] C.tune = z_tune; // c_side.to_c2_set[real, 0, NOT] C.emit = z_emit; // c_side.to_c2_set[real, 0, NOT] C.chrom = z_chrom; // c_side.to_c2_set[real, 0, NOT] C.sigma = z_sigma; // c_side.to_c2_set[real, 0, NOT] C.sigmap = z_sigmap; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_pre_tracker extern "C" void pre_tracker_to_c (const Opaque_pre_tracker_class*, CPP_pre_tracker&); // c_side.to_f2_arg extern "C" void pre_tracker_to_f2 (Opaque_pre_tracker_class*, c_Int&, c_Int&, c_Int&, c_Char); extern "C" void pre_tracker_to_f (const CPP_pre_tracker& C, Opaque_pre_tracker_class* F) { // c_side.to_f2_call pre_tracker_to_f2 (F, C.who, C.ix_ele_start, C.ix_ele_end, C.input_file.c_str()); } // c_side.to_c2_arg extern "C" void pre_tracker_to_c2 (CPP_pre_tracker& C, c_Int& z_who, c_Int& z_ix_ele_start, c_Int& z_ix_ele_end, c_Char z_input_file) { // c_side.to_c2_set[integer, 0, NOT] C.who = z_who; // c_side.to_c2_set[integer, 0, NOT] C.ix_ele_start = z_ix_ele_start; // c_side.to_c2_set[integer, 0, NOT] C.ix_ele_end = z_ix_ele_end; // c_side.to_c2_set[character, 0, NOT] C.input_file = z_input_file; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_anormal_mode extern "C" void anormal_mode_to_c (const Opaque_anormal_mode_class*, CPP_anormal_mode&); // c_side.to_f2_arg extern "C" void anormal_mode_to_f2 (Opaque_anormal_mode_class*, c_Real&, c_Real&, c_RealArr, c_Real&, c_Real&, c_Real&, c_Real&); extern "C" void anormal_mode_to_f (const CPP_anormal_mode& C, Opaque_anormal_mode_class* F) { // c_side.to_f2_call anormal_mode_to_f2 (F, C.emittance, C.emittance_no_vert, &C.synch_int[0], C.j_damp, C.alpha_damp, C.chrom, C.tune); } // c_side.to_c2_arg extern "C" void anormal_mode_to_c2 (CPP_anormal_mode& C, c_Real& z_emittance, c_Real& z_emittance_no_vert, c_RealArr z_synch_int, c_Real& z_j_damp, c_Real& z_alpha_damp, c_Real& z_chrom, c_Real& z_tune) { // c_side.to_c2_set[real, 0, NOT] C.emittance = z_emittance; // c_side.to_c2_set[real, 0, NOT] C.emittance_no_vert = z_emittance_no_vert; // c_side.to_c2_set[real, 1, NOT] C.synch_int << z_synch_int; // c_side.to_c2_set[real, 0, NOT] C.j_damp = z_j_damp; // c_side.to_c2_set[real, 0, NOT] C.alpha_damp = z_alpha_damp; // c_side.to_c2_set[real, 0, NOT] C.chrom = z_chrom; // c_side.to_c2_set[real, 0, NOT] C.tune = z_tune; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_linac_normal_mode extern "C" void linac_normal_mode_to_c (const Opaque_linac_normal_mode_class*, CPP_linac_normal_mode&); // c_side.to_f2_arg extern "C" void linac_normal_mode_to_f2 (Opaque_linac_normal_mode_class*, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&); extern "C" void linac_normal_mode_to_f (const CPP_linac_normal_mode& C, Opaque_linac_normal_mode_class* F) { // c_side.to_f2_call linac_normal_mode_to_f2 (F, C.i2_e4, C.i3_e7, C.i5a_e6, C.i5b_e6, C.sig_e1, C.a_emittance_end, C.b_emittance_end); } // c_side.to_c2_arg extern "C" void linac_normal_mode_to_c2 (CPP_linac_normal_mode& C, c_Real& z_i2_e4, c_Real& z_i3_e7, c_Real& z_i5a_e6, c_Real& z_i5b_e6, c_Real& z_sig_e1, c_Real& z_a_emittance_end, c_Real& z_b_emittance_end) { // c_side.to_c2_set[real, 0, NOT] C.i2_e4 = z_i2_e4; // c_side.to_c2_set[real, 0, NOT] C.i3_e7 = z_i3_e7; // c_side.to_c2_set[real, 0, NOT] C.i5a_e6 = z_i5a_e6; // c_side.to_c2_set[real, 0, NOT] C.i5b_e6 = z_i5b_e6; // c_side.to_c2_set[real, 0, NOT] C.sig_e1 = z_sig_e1; // c_side.to_c2_set[real, 0, NOT] C.a_emittance_end = z_a_emittance_end; // c_side.to_c2_set[real, 0, NOT] C.b_emittance_end = z_b_emittance_end; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_normal_modes extern "C" void normal_modes_to_c (const Opaque_normal_modes_class*, CPP_normal_modes&); // c_side.to_f2_arg extern "C" void normal_modes_to_f2 (Opaque_normal_modes_class*, c_RealArr, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, const CPP_anormal_mode&, const CPP_anormal_mode&, const CPP_anormal_mode&, const CPP_linac_normal_mode&); extern "C" void normal_modes_to_f (const CPP_normal_modes& C, Opaque_normal_modes_class* F) { // c_side.to_f2_call normal_modes_to_f2 (F, &C.synch_int[0], C.sige_e, C.sig_z, C.e_loss, C.rf_voltage, C.pz_aperture, C.pz_average, C.momentum_compaction, C.dpz_damp, C.a, C.b, C.z, C.lin); } // c_side.to_c2_arg extern "C" void normal_modes_to_c2 (CPP_normal_modes& C, c_RealArr z_synch_int, c_Real& z_sige_e, c_Real& z_sig_z, c_Real& z_e_loss, c_Real& z_rf_voltage, c_Real& z_pz_aperture, c_Real& z_pz_average, c_Real& z_momentum_compaction, c_Real& z_dpz_damp, const Opaque_anormal_mode_class* z_a, const Opaque_anormal_mode_class* z_b, const Opaque_anormal_mode_class* z_z, const Opaque_linac_normal_mode_class* z_lin) { // c_side.to_c2_set[real, 1, NOT] C.synch_int << z_synch_int; // c_side.to_c2_set[real, 0, NOT] C.sige_e = z_sige_e; // c_side.to_c2_set[real, 0, NOT] C.sig_z = z_sig_z; // c_side.to_c2_set[real, 0, NOT] C.e_loss = z_e_loss; // c_side.to_c2_set[real, 0, NOT] C.rf_voltage = z_rf_voltage; // c_side.to_c2_set[real, 0, NOT] C.pz_aperture = z_pz_aperture; // c_side.to_c2_set[real, 0, NOT] C.pz_average = z_pz_average; // c_side.to_c2_set[real, 0, NOT] C.momentum_compaction = z_momentum_compaction; // c_side.to_c2_set[real, 0, NOT] C.dpz_damp = z_dpz_damp; // c_side.to_c2_set[type, 0, NOT] anormal_mode_to_c(z_a, C.a); // c_side.to_c2_set[type, 0, NOT] anormal_mode_to_c(z_b, C.b); // c_side.to_c2_set[type, 0, NOT] anormal_mode_to_c(z_z, C.z); // c_side.to_c2_set[type, 0, NOT] linac_normal_mode_to_c(z_lin, C.lin); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_em_field extern "C" void em_field_to_c (const Opaque_em_field_class*, CPP_em_field&); // c_side.to_f2_arg extern "C" void em_field_to_f2 (Opaque_em_field_class*, c_RealArr, c_RealArr, c_RealArr, c_RealArr, c_Real&, c_Real&, c_RealArr); extern "C" void em_field_to_f (const CPP_em_field& C, Opaque_em_field_class* F) { // c_side.to_f_setup[real, 2, NOT] Real z_de[3*3]; matrix_to_vec(C.de, z_de); // c_side.to_f_setup[real, 2, NOT] Real z_db[3*3]; matrix_to_vec(C.db, z_db); // c_side.to_f2_call em_field_to_f2 (F, &C.e[0], &C.b[0], z_de, z_db, C.phi, C.phi_b, &C.a[0]); } // c_side.to_c2_arg extern "C" void em_field_to_c2 (CPP_em_field& C, c_RealArr z_e, c_RealArr z_b, c_RealArr z_de, c_RealArr z_db, c_Real& z_phi, c_Real& z_phi_b, c_RealArr z_a) { // c_side.to_c2_set[real, 1, NOT] C.e << z_e; // c_side.to_c2_set[real, 1, NOT] C.b << z_b; // c_side.to_c2_set[real, 2, NOT] C.de << z_de; // c_side.to_c2_set[real, 2, NOT] C.db << z_db; // c_side.to_c2_set[real, 0, NOT] C.phi = z_phi; // c_side.to_c2_set[real, 0, NOT] C.phi_b = z_phi_b; // c_side.to_c2_set[real, 1, NOT] C.a << z_a; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_strong_beam extern "C" void strong_beam_to_c (const Opaque_strong_beam_class*, CPP_strong_beam&); // c_side.to_f2_arg extern "C" void strong_beam_to_f2 (Opaque_strong_beam_class*, c_Int&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&); extern "C" void strong_beam_to_f (const CPP_strong_beam& C, Opaque_strong_beam_class* F) { // c_side.to_f2_call strong_beam_to_f2 (F, C.ix_slice, C.x_center, C.y_center, C.x_sigma, C.y_sigma, C.dx, C.dy); } // c_side.to_c2_arg extern "C" void strong_beam_to_c2 (CPP_strong_beam& C, c_Int& z_ix_slice, c_Real& z_x_center, c_Real& z_y_center, c_Real& z_x_sigma, c_Real& z_y_sigma, c_Real& z_dx, c_Real& z_dy) { // c_side.to_c2_set[integer, 0, NOT] C.ix_slice = z_ix_slice; // c_side.to_c2_set[real, 0, NOT] C.x_center = z_x_center; // c_side.to_c2_set[real, 0, NOT] C.y_center = z_y_center; // c_side.to_c2_set[real, 0, NOT] C.x_sigma = z_x_sigma; // c_side.to_c2_set[real, 0, NOT] C.y_sigma = z_y_sigma; // c_side.to_c2_set[real, 0, NOT] C.dx = z_dx; // c_side.to_c2_set[real, 0, NOT] C.dy = z_dy; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_track_point extern "C" void track_point_to_c (const Opaque_track_point_class*, CPP_track_point&); // c_side.to_f2_arg extern "C" void track_point_to_f2 (Opaque_track_point_class*, c_Real&, const CPP_coord&, const CPP_em_field&, const CPP_strong_beam&, c_RealArr, c_RealArr); extern "C" void track_point_to_f (const CPP_track_point& C, Opaque_track_point_class* F) { // c_side.to_f_setup[real, 2, NOT] Real z_mat6[6*6]; matrix_to_vec(C.mat6, z_mat6); // c_side.to_f2_call track_point_to_f2 (F, C.s_body, C.orb, C.field, C.strong_beam, &C.vec0[0], z_mat6); } // c_side.to_c2_arg extern "C" void track_point_to_c2 (CPP_track_point& C, c_Real& z_s_body, const Opaque_coord_class* z_orb, const Opaque_em_field_class* z_field, const Opaque_strong_beam_class* z_strong_beam, c_RealArr z_vec0, c_RealArr z_mat6) { // c_side.to_c2_set[real, 0, NOT] C.s_body = z_s_body; // c_side.to_c2_set[type, 0, NOT] coord_to_c(z_orb, C.orb); // c_side.to_c2_set[type, 0, NOT] em_field_to_c(z_field, C.field); // c_side.to_c2_set[type, 0, NOT] strong_beam_to_c(z_strong_beam, C.strong_beam); // c_side.to_c2_set[real, 1, NOT] C.vec0 << z_vec0; // c_side.to_c2_set[real, 2, NOT] C.mat6 << z_mat6; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_track extern "C" void track_to_c (const Opaque_track_class*, CPP_track&); // c_side.to_f2_arg extern "C" void track_to_f2 (Opaque_track_class*, const CPP_track_point**, Int, c_Real&, c_Int&, c_Int&, c_Int&); extern "C" void track_to_f (const CPP_track& C, Opaque_track_class* F) { // c_side.to_f_setup[type, 1, ALLOC] int n1_pt = C.pt.size(); const CPP_track_point** z_pt = NULL; if (n1_pt != 0) { z_pt = new const CPP_track_point*[n1_pt]; for (int i = 0; i < n1_pt; i++) z_pt[i] = &C.pt[i]; } // c_side.to_f2_call track_to_f2 (F, z_pt, n1_pt, C.ds_save, C.n_pt, C.n_bad, C.n_ok); // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_pt; } // c_side.to_c2_arg extern "C" void track_to_c2 (CPP_track& C, Opaque_track_point_class** z_pt, Int n1_pt, c_Real& z_ds_save, c_Int& z_n_pt, c_Int& z_n_bad, c_Int& z_n_ok) { // c_side.to_c2_set[type, 1, ALLOC] C.pt.resize(n1_pt); for (int i = 0; i < n1_pt; i++) track_point_to_c(z_pt[i], C.pt[i]); // c_side.to_c2_set[real, 0, NOT] C.ds_save = z_ds_save; // c_side.to_c2_set[integer, 0, NOT] C.n_pt = z_n_pt; // c_side.to_c2_set[integer, 0, NOT] C.n_bad = z_n_bad; // c_side.to_c2_set[integer, 0, NOT] C.n_ok = z_n_ok; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_space_charge_common extern "C" void space_charge_common_to_c (const Opaque_space_charge_common_class*, CPP_space_charge_common&); // c_side.to_f2_arg extern "C" void space_charge_common_to_f2 (Opaque_space_charge_common_class*, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_IntArr, c_IntArr, c_Int&, c_Int&, c_Int&, c_Int&, c_Bool&, c_Bool&, c_Char); extern "C" void space_charge_common_to_f (const CPP_space_charge_common& C, Opaque_space_charge_common_class* F) { // c_side.to_f2_call space_charge_common_to_f2 (F, C.ds_track_step, C.dt_track_step, C.cathode_strength_cutoff, C.rel_tol_tracking, C.abs_tol_tracking, C.beam_chamber_height, C.lsc_sigma_cutoff, C.particle_sigma_cutoff, &C.space_charge_mesh_size[0], &C.csr3d_mesh_size[0], C.n_bin, C.particle_bin_span, C.n_shield_images, C.sc_min_in_bin, C.lsc_kick_transverse_dependence, C.debug, C.diagnostic_output_file.c_str()); } // c_side.to_c2_arg extern "C" void space_charge_common_to_c2 (CPP_space_charge_common& C, c_Real& z_ds_track_step, c_Real& z_dt_track_step, c_Real& z_cathode_strength_cutoff, c_Real& z_rel_tol_tracking, c_Real& z_abs_tol_tracking, c_Real& z_beam_chamber_height, c_Real& z_lsc_sigma_cutoff, c_Real& z_particle_sigma_cutoff, c_IntArr z_space_charge_mesh_size, c_IntArr z_csr3d_mesh_size, c_Int& z_n_bin, c_Int& z_particle_bin_span, c_Int& z_n_shield_images, c_Int& z_sc_min_in_bin, c_Bool& z_lsc_kick_transverse_dependence, c_Bool& z_debug, c_Char z_diagnostic_output_file) { // c_side.to_c2_set[real, 0, NOT] C.ds_track_step = z_ds_track_step; // c_side.to_c2_set[real, 0, NOT] C.dt_track_step = z_dt_track_step; // c_side.to_c2_set[real, 0, NOT] C.cathode_strength_cutoff = z_cathode_strength_cutoff; // c_side.to_c2_set[real, 0, NOT] C.rel_tol_tracking = z_rel_tol_tracking; // c_side.to_c2_set[real, 0, NOT] C.abs_tol_tracking = z_abs_tol_tracking; // c_side.to_c2_set[real, 0, NOT] C.beam_chamber_height = z_beam_chamber_height; // c_side.to_c2_set[real, 0, NOT] C.lsc_sigma_cutoff = z_lsc_sigma_cutoff; // c_side.to_c2_set[real, 0, NOT] C.particle_sigma_cutoff = z_particle_sigma_cutoff; // c_side.to_c2_set[integer, 1, NOT] C.space_charge_mesh_size << z_space_charge_mesh_size; // c_side.to_c2_set[integer, 1, NOT] C.csr3d_mesh_size << z_csr3d_mesh_size; // c_side.to_c2_set[integer, 0, NOT] C.n_bin = z_n_bin; // c_side.to_c2_set[integer, 0, NOT] C.particle_bin_span = z_particle_bin_span; // c_side.to_c2_set[integer, 0, NOT] C.n_shield_images = z_n_shield_images; // c_side.to_c2_set[integer, 0, NOT] C.sc_min_in_bin = z_sc_min_in_bin; // c_side.to_c2_set[logical, 0, NOT] C.lsc_kick_transverse_dependence = z_lsc_kick_transverse_dependence; // c_side.to_c2_set[logical, 0, NOT] C.debug = z_debug; // c_side.to_c2_set[character, 0, NOT] C.diagnostic_output_file = z_diagnostic_output_file; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_bmad_common extern "C" void bmad_common_to_c (const Opaque_bmad_common_class*, CPP_bmad_common&); // c_side.to_f2_arg extern "C" void bmad_common_to_f2 (Opaque_bmad_common_class*, c_Real&, c_RealArr, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Bool&, c_Bool&, c_Bool&, c_Bool&, c_Bool&, c_Bool&, c_Bool&, c_Bool&, c_Bool&, c_Bool&, c_Bool&, c_Bool&, c_Bool&, c_Bool&, c_Bool&, c_Bool&, c_Bool&); extern "C" void bmad_common_to_f (const CPP_bmad_common& C, Opaque_bmad_common_class* F) { // c_side.to_f2_call bmad_common_to_f2 (F, C.max_aperture_limit, &C.d_orb[0], C.default_ds_step, C.significant_length, C.rel_tol_tracking, C.abs_tol_tracking, C.rel_tol_adaptive_tracking, C.abs_tol_adaptive_tracking, C.init_ds_adaptive_tracking, C.min_ds_adaptive_tracking, C.fatal_ds_adaptive_tracking, C.autoscale_amp_abs_tol, C.autoscale_amp_rel_tol, C.autoscale_phase_tol, C.electric_dipole_moment, C.synch_rad_scale, C.sad_eps_scale, C.sad_amp_max, C.sad_n_div_max, C.taylor_order, C.runge_kutta_order, C.default_integ_order, C.max_num_runge_kutta_step, C.rf_phase_below_transition_ref, C.sr_wakes_on, C.lr_wakes_on, C.auto_bookkeeper, C.high_energy_space_charge_on, C.csr_and_space_charge_on, C.spin_tracking_on, C.spin_sokolov_ternov_flipping_on, C.radiation_damping_on, C.radiation_zero_average, C.radiation_fluctuations_on, C.conserve_taylor_maps, C.absolute_time_tracking, C.absolute_time_ref_shift, C.convert_to_kinetic_momentum, C.aperture_limit_on, C.debug); } // c_side.to_c2_arg extern "C" void bmad_common_to_c2 (CPP_bmad_common& C, c_Real& z_max_aperture_limit, c_RealArr z_d_orb, c_Real& z_default_ds_step, c_Real& z_significant_length, c_Real& z_rel_tol_tracking, c_Real& z_abs_tol_tracking, c_Real& z_rel_tol_adaptive_tracking, c_Real& z_abs_tol_adaptive_tracking, c_Real& z_init_ds_adaptive_tracking, c_Real& z_min_ds_adaptive_tracking, c_Real& z_fatal_ds_adaptive_tracking, c_Real& z_autoscale_amp_abs_tol, c_Real& z_autoscale_amp_rel_tol, c_Real& z_autoscale_phase_tol, c_Real& z_electric_dipole_moment, c_Real& z_synch_rad_scale, c_Real& z_sad_eps_scale, c_Real& z_sad_amp_max, c_Int& z_sad_n_div_max, c_Int& z_taylor_order, c_Int& z_runge_kutta_order, c_Int& z_default_integ_order, c_Int& z_max_num_runge_kutta_step, c_Bool& z_rf_phase_below_transition_ref, c_Bool& z_sr_wakes_on, c_Bool& z_lr_wakes_on, c_Bool& z_auto_bookkeeper, c_Bool& z_high_energy_space_charge_on, c_Bool& z_csr_and_space_charge_on, c_Bool& z_spin_tracking_on, c_Bool& z_spin_sokolov_ternov_flipping_on, c_Bool& z_radiation_damping_on, c_Bool& z_radiation_zero_average, c_Bool& z_radiation_fluctuations_on, c_Bool& z_conserve_taylor_maps, c_Bool& z_absolute_time_tracking, c_Bool& z_absolute_time_ref_shift, c_Bool& z_convert_to_kinetic_momentum, c_Bool& z_aperture_limit_on, c_Bool& z_debug) { // c_side.to_c2_set[real, 0, NOT] C.max_aperture_limit = z_max_aperture_limit; // c_side.to_c2_set[real, 1, NOT] C.d_orb << z_d_orb; // c_side.to_c2_set[real, 0, NOT] C.default_ds_step = z_default_ds_step; // c_side.to_c2_set[real, 0, NOT] C.significant_length = z_significant_length; // c_side.to_c2_set[real, 0, NOT] C.rel_tol_tracking = z_rel_tol_tracking; // c_side.to_c2_set[real, 0, NOT] C.abs_tol_tracking = z_abs_tol_tracking; // c_side.to_c2_set[real, 0, NOT] C.rel_tol_adaptive_tracking = z_rel_tol_adaptive_tracking; // c_side.to_c2_set[real, 0, NOT] C.abs_tol_adaptive_tracking = z_abs_tol_adaptive_tracking; // c_side.to_c2_set[real, 0, NOT] C.init_ds_adaptive_tracking = z_init_ds_adaptive_tracking; // c_side.to_c2_set[real, 0, NOT] C.min_ds_adaptive_tracking = z_min_ds_adaptive_tracking; // c_side.to_c2_set[real, 0, NOT] C.fatal_ds_adaptive_tracking = z_fatal_ds_adaptive_tracking; // c_side.to_c2_set[real, 0, NOT] C.autoscale_amp_abs_tol = z_autoscale_amp_abs_tol; // c_side.to_c2_set[real, 0, NOT] C.autoscale_amp_rel_tol = z_autoscale_amp_rel_tol; // c_side.to_c2_set[real, 0, NOT] C.autoscale_phase_tol = z_autoscale_phase_tol; // c_side.to_c2_set[real, 0, NOT] C.electric_dipole_moment = z_electric_dipole_moment; // c_side.to_c2_set[real, 0, NOT] C.synch_rad_scale = z_synch_rad_scale; // c_side.to_c2_set[real, 0, NOT] C.sad_eps_scale = z_sad_eps_scale; // c_side.to_c2_set[real, 0, NOT] C.sad_amp_max = z_sad_amp_max; // c_side.to_c2_set[integer, 0, NOT] C.sad_n_div_max = z_sad_n_div_max; // c_side.to_c2_set[integer, 0, NOT] C.taylor_order = z_taylor_order; // c_side.to_c2_set[integer, 0, NOT] C.runge_kutta_order = z_runge_kutta_order; // c_side.to_c2_set[integer, 0, NOT] C.default_integ_order = z_default_integ_order; // c_side.to_c2_set[integer, 0, NOT] C.max_num_runge_kutta_step = z_max_num_runge_kutta_step; // c_side.to_c2_set[logical, 0, NOT] C.rf_phase_below_transition_ref = z_rf_phase_below_transition_ref; // c_side.to_c2_set[logical, 0, NOT] C.sr_wakes_on = z_sr_wakes_on; // c_side.to_c2_set[logical, 0, NOT] C.lr_wakes_on = z_lr_wakes_on; // c_side.to_c2_set[logical, 0, NOT] C.auto_bookkeeper = z_auto_bookkeeper; // c_side.to_c2_set[logical, 0, NOT] C.high_energy_space_charge_on = z_high_energy_space_charge_on; // c_side.to_c2_set[logical, 0, NOT] C.csr_and_space_charge_on = z_csr_and_space_charge_on; // c_side.to_c2_set[logical, 0, NOT] C.spin_tracking_on = z_spin_tracking_on; // c_side.to_c2_set[logical, 0, NOT] C.spin_sokolov_ternov_flipping_on = z_spin_sokolov_ternov_flipping_on; // c_side.to_c2_set[logical, 0, NOT] C.radiation_damping_on = z_radiation_damping_on; // c_side.to_c2_set[logical, 0, NOT] C.radiation_zero_average = z_radiation_zero_average; // c_side.to_c2_set[logical, 0, NOT] C.radiation_fluctuations_on = z_radiation_fluctuations_on; // c_side.to_c2_set[logical, 0, NOT] C.conserve_taylor_maps = z_conserve_taylor_maps; // c_side.to_c2_set[logical, 0, NOT] C.absolute_time_tracking = z_absolute_time_tracking; // c_side.to_c2_set[logical, 0, NOT] C.absolute_time_ref_shift = z_absolute_time_ref_shift; // c_side.to_c2_set[logical, 0, NOT] C.convert_to_kinetic_momentum = z_convert_to_kinetic_momentum; // c_side.to_c2_set[logical, 0, NOT] C.aperture_limit_on = z_aperture_limit_on; // c_side.to_c2_set[logical, 0, NOT] C.debug = z_debug; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_rad_int1 extern "C" void rad_int1_to_c (const Opaque_rad_int1_class*, CPP_rad_int1&); // c_side.to_f2_arg extern "C" void rad_int1_to_f2 (Opaque_rad_int1_class*, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&); extern "C" void rad_int1_to_f (const CPP_rad_int1& C, Opaque_rad_int1_class* F) { // c_side.to_f2_call rad_int1_to_f2 (F, C.i0, C.i1, C.i2, C.i3, C.i4a, C.i4b, C.i4z, C.i5a, C.i5b, C.i6b, C.lin_i2_e4, C.lin_i3_e7, C.lin_i5a_e6, C.lin_i5b_e6, C.lin_norm_emit_a, C.lin_norm_emit_b, C.lin_sig_e, C.n_steps); } // c_side.to_c2_arg extern "C" void rad_int1_to_c2 (CPP_rad_int1& C, c_Real& z_i0, c_Real& z_i1, c_Real& z_i2, c_Real& z_i3, c_Real& z_i4a, c_Real& z_i4b, c_Real& z_i4z, c_Real& z_i5a, c_Real& z_i5b, c_Real& z_i6b, c_Real& z_lin_i2_e4, c_Real& z_lin_i3_e7, c_Real& z_lin_i5a_e6, c_Real& z_lin_i5b_e6, c_Real& z_lin_norm_emit_a, c_Real& z_lin_norm_emit_b, c_Real& z_lin_sig_e, c_Real& z_n_steps) { // c_side.to_c2_set[real, 0, NOT] C.i0 = z_i0; // c_side.to_c2_set[real, 0, NOT] C.i1 = z_i1; // c_side.to_c2_set[real, 0, NOT] C.i2 = z_i2; // c_side.to_c2_set[real, 0, NOT] C.i3 = z_i3; // c_side.to_c2_set[real, 0, NOT] C.i4a = z_i4a; // c_side.to_c2_set[real, 0, NOT] C.i4b = z_i4b; // c_side.to_c2_set[real, 0, NOT] C.i4z = z_i4z; // c_side.to_c2_set[real, 0, NOT] C.i5a = z_i5a; // c_side.to_c2_set[real, 0, NOT] C.i5b = z_i5b; // c_side.to_c2_set[real, 0, NOT] C.i6b = z_i6b; // c_side.to_c2_set[real, 0, NOT] C.lin_i2_e4 = z_lin_i2_e4; // c_side.to_c2_set[real, 0, NOT] C.lin_i3_e7 = z_lin_i3_e7; // c_side.to_c2_set[real, 0, NOT] C.lin_i5a_e6 = z_lin_i5a_e6; // c_side.to_c2_set[real, 0, NOT] C.lin_i5b_e6 = z_lin_i5b_e6; // c_side.to_c2_set[real, 0, NOT] C.lin_norm_emit_a = z_lin_norm_emit_a; // c_side.to_c2_set[real, 0, NOT] C.lin_norm_emit_b = z_lin_norm_emit_b; // c_side.to_c2_set[real, 0, NOT] C.lin_sig_e = z_lin_sig_e; // c_side.to_c2_set[real, 0, NOT] C.n_steps = z_n_steps; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_rad_int_branch extern "C" void rad_int_branch_to_c (const Opaque_rad_int_branch_class*, CPP_rad_int_branch&); // c_side.to_f2_arg extern "C" void rad_int_branch_to_f2 (Opaque_rad_int_branch_class*, const CPP_rad_int1**, Int); extern "C" void rad_int_branch_to_f (const CPP_rad_int_branch& C, Opaque_rad_int_branch_class* F) { // c_side.to_f_setup[type, 1, ALLOC] int n1_ele = C.ele.size(); const CPP_rad_int1** z_ele = NULL; if (n1_ele != 0) { z_ele = new const CPP_rad_int1*[n1_ele]; for (int i = 0; i < n1_ele; i++) z_ele[i] = &C.ele[i]; } // c_side.to_f2_call rad_int_branch_to_f2 (F, z_ele, n1_ele); // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_ele; } // c_side.to_c2_arg extern "C" void rad_int_branch_to_c2 (CPP_rad_int_branch& C, Opaque_rad_int1_class** z_ele, Int n1_ele) { // c_side.to_c2_set[type, 1, ALLOC] C.ele.resize(n1_ele); for (int i = 0; i < n1_ele; i++) rad_int1_to_c(z_ele[i], C.ele[i]); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_rad_int_all_ele extern "C" void rad_int_all_ele_to_c (const Opaque_rad_int_all_ele_class*, CPP_rad_int_all_ele&); // c_side.to_f2_arg extern "C" void rad_int_all_ele_to_f2 (Opaque_rad_int_all_ele_class*, const CPP_rad_int_branch**, Int); extern "C" void rad_int_all_ele_to_f (const CPP_rad_int_all_ele& C, Opaque_rad_int_all_ele_class* F) { // c_side.to_f_setup[type, 1, ALLOC] int n1_branch = C.branch.size(); const CPP_rad_int_branch** z_branch = NULL; if (n1_branch != 0) { z_branch = new const CPP_rad_int_branch*[n1_branch]; for (int i = 0; i < n1_branch; i++) z_branch[i] = &C.branch[i]; } // c_side.to_f2_call rad_int_all_ele_to_f2 (F, z_branch, n1_branch); // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_branch; } // c_side.to_c2_arg extern "C" void rad_int_all_ele_to_c2 (CPP_rad_int_all_ele& C, Opaque_rad_int_branch_class** z_branch, Int n1_branch) { // c_side.to_c2_set[type, 1, ALLOC] C.branch.resize(n1_branch); for (int i = 0; i < n1_branch; i++) rad_int_branch_to_c(z_branch[i], C.branch[i]); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_ele extern "C" void ele_to_c (const Opaque_ele_class*, CPP_ele&); // c_side.to_f2_arg extern "C" void ele_to_f2 (Opaque_ele_class*, c_Char, c_Char, c_Char, c_Char, c_Char, Int, const CPP_twiss&, const CPP_twiss&, const CPP_twiss&, const CPP_xy_disp&, const CPP_xy_disp&, const CPP_ac_kicker&, Int, const CPP_bookkeeping_state&, const CPP_controller&, Int, const CPP_floor_position&, const CPP_high_energy_space_charge&, Int, const CPP_mode3&, Int, const CPP_photon_element&, Int, const CPP_rad_map_ele&, Int, const CPP_taylor**, c_RealArr, const CPP_taylor**, const CPP_wake&, Int, const CPP_wall3d**, Int, const CPP_cartesian_map**, Int, const CPP_cylindrical_map**, Int, const CPP_gen_grad_map**, Int, const CPP_grid_field**, Int, const CPP_coord&, const CPP_coord&, const CPP_coord&, const CPP_coord&, c_RealArr, c_RealArr, c_RealArr, c_RealArr, c_RealArr, c_RealArr, c_Real&, c_Real&, c_Real&, c_Real&, c_RealArr, Int, c_RealArr, Int, c_RealArr, Int, c_RealArr, Int, c_RealArr, Int, c_RealArr, Int, Int, Int, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Bool&, c_Bool&, c_Bool&, c_Bool&, c_Bool&, c_Bool&, c_Bool&, c_Bool&, c_Bool&, c_Bool&, c_Bool&); extern "C" void ele_to_f (const CPP_ele& C, Opaque_ele_class* F) { // c_side.to_f_setup[character, 0, PTR] unsigned int n_descrip = 0; const char* z_descrip = NULL; if (C.descrip != NULL) { z_descrip = C.descrip->c_str(); n_descrip = 1; } // c_side.to_f_setup[type, 0, PTR] unsigned int n_ac_kick = 0; if (C.ac_kick != NULL) n_ac_kick = 1; // c_side.to_f_setup[type, 0, PTR] unsigned int n_control = 0; if (C.control != NULL) n_control = 1; // c_side.to_f_setup[type, 0, PTR] unsigned int n_high_energy_space_charge = 0; if (C.high_energy_space_charge != NULL) n_high_energy_space_charge = 1; // c_side.to_f_setup[type, 0, PTR] unsigned int n_mode3 = 0; if (C.mode3 != NULL) n_mode3 = 1; // c_side.to_f_setup[type, 0, PTR] unsigned int n_photon = 0; if (C.photon != NULL) n_photon = 1; // c_side.to_f_setup[type, 0, PTR] unsigned int n_rad_map = 0; if (C.rad_map != NULL) n_rad_map = 1; // c_side.to_f_setup[type, 1, NOT] const CPP_taylor* z_taylor[6]; for (int i = 0; i < 6; i++) {z_taylor[i] = &C.taylor[i];} // c_side.to_f_setup[type, 1, NOT] const CPP_taylor* z_spin_taylor[4]; for (int i = 0; i < 4; i++) {z_spin_taylor[i] = &C.spin_taylor[i];} // c_side.to_f_setup[type, 0, PTR] unsigned int n_wake = 0; if (C.wake != NULL) n_wake = 1; // c_side.to_f_setup[type, 1, PTR] int n1_wall3d = C.wall3d.size(); const CPP_wall3d** z_wall3d = NULL; if (n1_wall3d != 0) { z_wall3d = new const CPP_wall3d*[n1_wall3d]; for (int i = 0; i < n1_wall3d; i++) z_wall3d[i] = &C.wall3d[i]; } // c_side.to_f_setup[type, 1, PTR] int n1_cartesian_map = C.cartesian_map.size(); const CPP_cartesian_map** z_cartesian_map = NULL; if (n1_cartesian_map != 0) { z_cartesian_map = new const CPP_cartesian_map*[n1_cartesian_map]; for (int i = 0; i < n1_cartesian_map; i++) z_cartesian_map[i] = &C.cartesian_map[i]; } // c_side.to_f_setup[type, 1, PTR] int n1_cylindrical_map = C.cylindrical_map.size(); const CPP_cylindrical_map** z_cylindrical_map = NULL; if (n1_cylindrical_map != 0) { z_cylindrical_map = new const CPP_cylindrical_map*[n1_cylindrical_map]; for (int i = 0; i < n1_cylindrical_map; i++) z_cylindrical_map[i] = &C.cylindrical_map[i]; } // c_side.to_f_setup[type, 1, PTR] int n1_gen_grad_map = C.gen_grad_map.size(); const CPP_gen_grad_map** z_gen_grad_map = NULL; if (n1_gen_grad_map != 0) { z_gen_grad_map = new const CPP_gen_grad_map*[n1_gen_grad_map]; for (int i = 0; i < n1_gen_grad_map; i++) z_gen_grad_map[i] = &C.gen_grad_map[i]; } // c_side.to_f_setup[type, 1, PTR] int n1_grid_field = C.grid_field.size(); const CPP_grid_field** z_grid_field = NULL; if (n1_grid_field != 0) { z_grid_field = new const CPP_grid_field*[n1_grid_field]; for (int i = 0; i < n1_grid_field; i++) z_grid_field[i] = &C.grid_field[i]; } // c_side.to_f_setup[real, 2, NOT] Real z_spin_q[4*7]; matrix_to_vec(C.spin_q, z_spin_q); // c_side.to_f_setup[real, 2, NOT] Real z_mat6[6*6]; matrix_to_vec(C.mat6, z_mat6); // c_side.to_f_setup[real, 2, NOT] Real z_c_mat[2*2]; matrix_to_vec(C.c_mat, z_c_mat); // c_side.to_f_setup[real, 1, PTR] int n1_a_pole = C.a_pole.size(); c_RealArr z_a_pole = NULL; if (n1_a_pole > 0) { z_a_pole = &C.a_pole[0]; } // c_side.to_f_setup[real, 1, PTR] int n1_b_pole = C.b_pole.size(); c_RealArr z_b_pole = NULL; if (n1_b_pole > 0) { z_b_pole = &C.b_pole[0]; } // c_side.to_f_setup[real, 1, PTR] int n1_a_pole_elec = C.a_pole_elec.size(); c_RealArr z_a_pole_elec = NULL; if (n1_a_pole_elec > 0) { z_a_pole_elec = &C.a_pole_elec[0]; } // c_side.to_f_setup[real, 1, PTR] int n1_b_pole_elec = C.b_pole_elec.size(); c_RealArr z_b_pole_elec = NULL; if (n1_b_pole_elec > 0) { z_b_pole_elec = &C.b_pole_elec[0]; } // c_side.to_f_setup[real, 1, PTR] int n1_custom = C.custom.size(); c_RealArr z_custom = NULL; if (n1_custom > 0) { z_custom = &C.custom[0]; } // c_side.to_f_setup[real, 3, PTR] int n1_r = C.r.size(), n2_r = 0, n3_r = 0; Real* z_r = NULL; if (n1_r > 0) { n2_r = C.r[0].size(); n3_r = C.r[0][0].size(); z_r = new Real [C.r.size()*C.r[0].size()*C.r[0][0].size()]; tensor_to_vec (C.r, z_r); } // c_side.to_f2_call ele_to_f2 (F, C.name.c_str(), C.type.c_str(), C.alias.c_str(), C.component_name.c_str(), z_descrip, n_descrip, C.a, C.b, C.z, C.x, C.y, *C.ac_kick, n_ac_kick, C.bookkeeping_state, *C.control, n_control, C.floor, *C.high_energy_space_charge, n_high_energy_space_charge, *C.mode3, n_mode3, *C.photon, n_photon, *C.rad_map, n_rad_map, z_taylor, &C.spin_taylor_ref_orb_in[0], z_spin_taylor, *C.wake, n_wake, z_wall3d, n1_wall3d, z_cartesian_map, n1_cartesian_map, z_cylindrical_map, n1_cylindrical_map, z_gen_grad_map, n1_gen_grad_map, z_grid_field, n1_grid_field, C.map_ref_orb_in, C.map_ref_orb_out, C.time_ref_orb_in, C.time_ref_orb_out, &C.value[0], &C.old_value[0], z_spin_q, &C.vec0[0], z_mat6, z_c_mat, C.gamma_c, C.s_start, C.s, C.ref_time, z_a_pole, n1_a_pole, z_b_pole, n1_b_pole, z_a_pole_elec, n1_a_pole_elec, z_b_pole_elec, n1_b_pole_elec, z_custom, n1_custom, z_r, n1_r, n2_r, n3_r, C.key, C.sub_key, C.ix_ele, C.ix_branch, C.lord_status, C.n_slave, C.n_slave_field, C.ix1_slave, C.slave_status, C.n_lord, C.n_lord_field, C.ic1_lord, C.ix_pointer, C.ixx, C.iyy, C.izz, C.mat6_calc_method, C.tracking_method, C.spin_tracking_method, C.csr_method, C.space_charge_method, C.ptc_integration_type, C.field_calc, C.aperture_at, C.aperture_type, C.ref_species, C.orientation, C.symplectify, C.mode_flip, C.multipoles_on, C.scale_multipoles, C.taylor_map_includes_offsets, C.field_master, C.is_on, C.logic, C.bmad_logic, C.select, C.offset_moves_aperture); // c_side.to_f_cleanup[type, 1, PTR] delete[] z_wall3d; // c_side.to_f_cleanup[type, 1, PTR] delete[] z_cartesian_map; // c_side.to_f_cleanup[type, 1, PTR] delete[] z_cylindrical_map; // c_side.to_f_cleanup[type, 1, PTR] delete[] z_gen_grad_map; // c_side.to_f_cleanup[type, 1, PTR] delete[] z_grid_field; // c_side.to_f_cleanup[real, 3, PTR] delete[] z_r; } // c_side.to_c2_arg extern "C" void ele_to_c2 (CPP_ele& C, c_Char z_name, c_Char z_type, c_Char z_alias, c_Char z_component_name, c_Char z_descrip, Int n_descrip, const Opaque_twiss_class* z_a, const Opaque_twiss_class* z_b, const Opaque_twiss_class* z_z, const Opaque_xy_disp_class* z_x, const Opaque_xy_disp_class* z_y, Opaque_ac_kicker_class* z_ac_kick, Int n_ac_kick, const Opaque_bookkeeping_state_class* z_bookkeeping_state, Opaque_controller_class* z_control, Int n_control, const Opaque_floor_position_class* z_floor, Opaque_high_energy_space_charge_class* z_high_energy_space_charge, Int n_high_energy_space_charge, Opaque_mode3_class* z_mode3, Int n_mode3, Opaque_photon_element_class* z_photon, Int n_photon, Opaque_rad_map_ele_class* z_rad_map, Int n_rad_map, const Opaque_taylor_class** z_taylor, c_RealArr z_spin_taylor_ref_orb_in, const Opaque_taylor_class** z_spin_taylor, Opaque_wake_class* z_wake, Int n_wake, Opaque_wall3d_class** z_wall3d, Int n1_wall3d, Opaque_cartesian_map_class** z_cartesian_map, Int n1_cartesian_map, Opaque_cylindrical_map_class** z_cylindrical_map, Int n1_cylindrical_map, Opaque_gen_grad_map_class** z_gen_grad_map, Int n1_gen_grad_map, Opaque_grid_field_class** z_grid_field, Int n1_grid_field, const Opaque_coord_class* z_map_ref_orb_in, const Opaque_coord_class* z_map_ref_orb_out, const Opaque_coord_class* z_time_ref_orb_in, const Opaque_coord_class* z_time_ref_orb_out, c_RealArr z_value, c_RealArr z_old_value, c_RealArr z_spin_q, c_RealArr z_vec0, c_RealArr z_mat6, c_RealArr z_c_mat, c_Real& z_gamma_c, c_Real& z_s_start, c_Real& z_s, c_Real& z_ref_time, c_RealArr z_a_pole, Int n1_a_pole, c_RealArr z_b_pole, Int n1_b_pole, c_RealArr z_a_pole_elec, Int n1_a_pole_elec, c_RealArr z_b_pole_elec, Int n1_b_pole_elec, c_RealArr z_custom, Int n1_custom, c_RealArr z_r, Int n1_r, Int n2_r, Int n3_r, c_Int& z_key, c_Int& z_sub_key, c_Int& z_ix_ele, c_Int& z_ix_branch, c_Int& z_lord_status, c_Int& z_n_slave, c_Int& z_n_slave_field, c_Int& z_ix1_slave, c_Int& z_slave_status, c_Int& z_n_lord, c_Int& z_n_lord_field, c_Int& z_ic1_lord, c_Int& z_ix_pointer, c_Int& z_ixx, c_Int& z_iyy, c_Int& z_izz, c_Int& z_mat6_calc_method, c_Int& z_tracking_method, c_Int& z_spin_tracking_method, c_Int& z_csr_method, c_Int& z_space_charge_method, c_Int& z_ptc_integration_type, c_Int& z_field_calc, c_Int& z_aperture_at, c_Int& z_aperture_type, c_Int& z_ref_species, c_Int& z_orientation, c_Bool& z_symplectify, c_Bool& z_mode_flip, c_Bool& z_multipoles_on, c_Bool& z_scale_multipoles, c_Bool& z_taylor_map_includes_offsets, c_Bool& z_field_master, c_Bool& z_is_on, c_Bool& z_logic, c_Bool& z_bmad_logic, c_Bool& z_select, c_Bool& z_offset_moves_aperture) { // c_side.to_c2_set[character, 0, NOT] C.name = z_name; // c_side.to_c2_set[character, 0, NOT] C.type = z_type; // c_side.to_c2_set[character, 0, NOT] C.alias = z_alias; // c_side.to_c2_set[character, 0, NOT] C.component_name = z_component_name; // c_side.to_c2_set[character, 0, PTR] if (n_descrip == 0) delete C.descrip; else { C.descrip = new string; *(C.descrip) = z_descrip; } // c_side.to_c2_set[type, 0, NOT] twiss_to_c(z_a, C.a); // c_side.to_c2_set[type, 0, NOT] twiss_to_c(z_b, C.b); // c_side.to_c2_set[type, 0, NOT] twiss_to_c(z_z, C.z); // c_side.to_c2_set[type, 0, NOT] xy_disp_to_c(z_x, C.x); // c_side.to_c2_set[type, 0, NOT] xy_disp_to_c(z_y, C.y); // c_side.to_c2_set[type, 0, PTR] if (n_ac_kick == 0) delete C.ac_kick; else { C.ac_kick = new CPP_ac_kicker; ac_kicker_to_c(z_ac_kick, *C.ac_kick); } // c_side.to_c2_set[type, 0, NOT] bookkeeping_state_to_c(z_bookkeeping_state, C.bookkeeping_state); // c_side.to_c2_set[type, 0, PTR] if (n_control == 0) delete C.control; else { C.control = new CPP_controller; controller_to_c(z_control, *C.control); } // c_side.to_c2_set[type, 0, NOT] floor_position_to_c(z_floor, C.floor); // c_side.to_c2_set[type, 0, PTR] if (n_high_energy_space_charge == 0) delete C.high_energy_space_charge; else { C.high_energy_space_charge = new CPP_high_energy_space_charge; high_energy_space_charge_to_c(z_high_energy_space_charge, *C.high_energy_space_charge); } // c_side.to_c2_set[type, 0, PTR] if (n_mode3 == 0) delete C.mode3; else { C.mode3 = new CPP_mode3; mode3_to_c(z_mode3, *C.mode3); } // c_side.to_c2_set[type, 0, PTR] if (n_photon == 0) delete C.photon; else { C.photon = new CPP_photon_element; photon_element_to_c(z_photon, *C.photon); } // c_side.to_c2_set[type, 0, PTR] if (n_rad_map == 0) delete C.rad_map; else { C.rad_map = new CPP_rad_map_ele; rad_map_ele_to_c(z_rad_map, *C.rad_map); } // c_side.to_c2_set[type, 1, NOT] for (unsigned int i = 0; i < C.taylor.size(); i++) taylor_to_c(z_taylor[i], C.taylor[i]); // c_side.to_c2_set[real, 1, NOT] C.spin_taylor_ref_orb_in << z_spin_taylor_ref_orb_in; // c_side.to_c2_set[type, 1, NOT] for (unsigned int i = 0; i < C.spin_taylor.size(); i++) taylor_to_c(z_spin_taylor[i], C.spin_taylor[i]); // c_side.to_c2_set[type, 0, PTR] if (n_wake == 0) delete C.wake; else { C.wake = new CPP_wake; wake_to_c(z_wake, *C.wake); } // c_side.to_c2_set[type, 1, PTR] C.wall3d.resize(n1_wall3d); for (int i = 0; i < n1_wall3d; i++) wall3d_to_c(z_wall3d[i], C.wall3d[i]); // c_side.to_c2_set[type, 1, PTR] C.cartesian_map.resize(n1_cartesian_map); for (int i = 0; i < n1_cartesian_map; i++) cartesian_map_to_c(z_cartesian_map[i], C.cartesian_map[i]); // c_side.to_c2_set[type, 1, PTR] C.cylindrical_map.resize(n1_cylindrical_map); for (int i = 0; i < n1_cylindrical_map; i++) cylindrical_map_to_c(z_cylindrical_map[i], C.cylindrical_map[i]); // c_side.to_c2_set[type, 1, PTR] C.gen_grad_map.resize(n1_gen_grad_map); for (int i = 0; i < n1_gen_grad_map; i++) gen_grad_map_to_c(z_gen_grad_map[i], C.gen_grad_map[i]); // c_side.to_c2_set[type, 1, PTR] C.grid_field.resize(n1_grid_field); for (int i = 0; i < n1_grid_field; i++) grid_field_to_c(z_grid_field[i], C.grid_field[i]); // c_side.to_c2_set[type, 0, NOT] coord_to_c(z_map_ref_orb_in, C.map_ref_orb_in); // c_side.to_c2_set[type, 0, NOT] coord_to_c(z_map_ref_orb_out, C.map_ref_orb_out); // c_side.to_c2_set[type, 0, NOT] coord_to_c(z_time_ref_orb_in, C.time_ref_orb_in); // c_side.to_c2_set[type, 0, NOT] coord_to_c(z_time_ref_orb_out, C.time_ref_orb_out); // c_side.to_c2_set[real, 1, NOT] C.value[0] = 0; for (unsigned int i = 1; i < Bmad::NUM_ELE_ATTRIB+1; i++) C.value[i] = z_value[i-1]; // c_side.to_c2_set[real, 1, NOT] C.old_value[0] = 0; for (unsigned int i = 1; i < Bmad::NUM_ELE_ATTRIB+1; i++) C.old_value[i] = z_old_value[i-1]; // c_side.to_c2_set[real, 2, NOT] C.spin_q << z_spin_q; // c_side.to_c2_set[real, 1, NOT] C.vec0 << z_vec0; // c_side.to_c2_set[real, 2, NOT] C.mat6 << z_mat6; // c_side.to_c2_set[real, 2, NOT] C.c_mat << z_c_mat; // c_side.to_c2_set[real, 0, NOT] C.gamma_c = z_gamma_c; // c_side.to_c2_set[real, 0, NOT] C.s_start = z_s_start; // c_side.to_c2_set[real, 0, NOT] C.s = z_s; // c_side.to_c2_set[real, 0, NOT] C.ref_time = z_ref_time; // c_side.to_c2_set[real, 1, PTR] C.a_pole.resize(n1_a_pole); C.a_pole << z_a_pole; // c_side.to_c2_set[real, 1, PTR] C.b_pole.resize(n1_b_pole); C.b_pole << z_b_pole; // c_side.to_c2_set[real, 1, PTR] C.a_pole_elec.resize(n1_a_pole_elec); C.a_pole_elec << z_a_pole_elec; // c_side.to_c2_set[real, 1, PTR] C.b_pole_elec.resize(n1_b_pole_elec); C.b_pole_elec << z_b_pole_elec; // c_side.to_c2_set[real, 1, PTR] C.custom.resize(n1_custom); C.custom << z_custom; // c_side.to_c2_set[real, 3, PTR] C.r.resize(n1_r); for (unsigned int i = 0; i < C.r.size(); i++) { C.r[i].resize(n2_r); for (unsigned int j = 0; j < C.r[0].size(); j++) C.r[i][j].resize(n3_r); } C.r << z_r; // c_side.to_c2_set[integer, 0, NOT] C.key = z_key; // c_side.to_c2_set[integer, 0, NOT] C.sub_key = z_sub_key; // c_side.to_c2_set[integer, 0, NOT] C.ix_ele = z_ix_ele; // c_side.to_c2_set[integer, 0, NOT] C.ix_branch = z_ix_branch; // c_side.to_c2_set[integer, 0, NOT] C.lord_status = z_lord_status; // c_side.to_c2_set[integer, 0, NOT] C.n_slave = z_n_slave; // c_side.to_c2_set[integer, 0, NOT] C.n_slave_field = z_n_slave_field; // c_side.to_c2_set[integer, 0, NOT] C.ix1_slave = z_ix1_slave; // c_side.to_c2_set[integer, 0, NOT] C.slave_status = z_slave_status; // c_side.to_c2_set[integer, 0, NOT] C.n_lord = z_n_lord; // c_side.to_c2_set[integer, 0, NOT] C.n_lord_field = z_n_lord_field; // c_side.to_c2_set[integer, 0, NOT] C.ic1_lord = z_ic1_lord; // c_side.to_c2_set[integer, 0, NOT] C.ix_pointer = z_ix_pointer; // c_side.to_c2_set[integer, 0, NOT] C.ixx = z_ixx; // c_side.to_c2_set[integer, 0, NOT] C.iyy = z_iyy; // c_side.to_c2_set[integer, 0, NOT] C.izz = z_izz; // c_side.to_c2_set[integer, 0, NOT] C.mat6_calc_method = z_mat6_calc_method; // c_side.to_c2_set[integer, 0, NOT] C.tracking_method = z_tracking_method; // c_side.to_c2_set[integer, 0, NOT] C.spin_tracking_method = z_spin_tracking_method; // c_side.to_c2_set[integer, 0, NOT] C.csr_method = z_csr_method; // c_side.to_c2_set[integer, 0, NOT] C.space_charge_method = z_space_charge_method; // c_side.to_c2_set[integer, 0, NOT] C.ptc_integration_type = z_ptc_integration_type; // c_side.to_c2_set[integer, 0, NOT] C.field_calc = z_field_calc; // c_side.to_c2_set[integer, 0, NOT] C.aperture_at = z_aperture_at; // c_side.to_c2_set[integer, 0, NOT] C.aperture_type = z_aperture_type; // c_side.to_c2_set[integer, 0, NOT] C.ref_species = z_ref_species; // c_side.to_c2_set[integer, 0, NOT] C.orientation = z_orientation; // c_side.to_c2_set[logical, 0, NOT] C.symplectify = z_symplectify; // c_side.to_c2_set[logical, 0, NOT] C.mode_flip = z_mode_flip; // c_side.to_c2_set[logical, 0, NOT] C.multipoles_on = z_multipoles_on; // c_side.to_c2_set[logical, 0, NOT] C.scale_multipoles = z_scale_multipoles; // c_side.to_c2_set[logical, 0, NOT] C.taylor_map_includes_offsets = z_taylor_map_includes_offsets; // c_side.to_c2_set[logical, 0, NOT] C.field_master = z_field_master; // c_side.to_c2_set[logical, 0, NOT] C.is_on = z_is_on; // c_side.to_c2_set[logical, 0, NOT] C.logic = z_logic; // c_side.to_c2_set[logical, 0, NOT] C.bmad_logic = z_bmad_logic; // c_side.to_c2_set[logical, 0, NOT] C.select = z_select; // c_side.to_c2_set[logical, 0, NOT] C.offset_moves_aperture = z_offset_moves_aperture; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_complex_taylor_term extern "C" void complex_taylor_term_to_c (const Opaque_complex_taylor_term_class*, CPP_complex_taylor_term&); // c_side.to_f2_arg extern "C" void complex_taylor_term_to_f2 (Opaque_complex_taylor_term_class*, c_Complex&, c_IntArr); extern "C" void complex_taylor_term_to_f (const CPP_complex_taylor_term& C, Opaque_complex_taylor_term_class* F) { // c_side.to_f2_call complex_taylor_term_to_f2 (F, C.coef, &C.expn[0]); } // c_side.to_c2_arg extern "C" void complex_taylor_term_to_c2 (CPP_complex_taylor_term& C, c_Complex& z_coef, c_IntArr z_expn) { // c_side.to_c2_set[complex, 0, NOT] C.coef = z_coef; // c_side.to_c2_set[integer, 1, NOT] C.expn << z_expn; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_complex_taylor extern "C" void complex_taylor_to_c (const Opaque_complex_taylor_class*, CPP_complex_taylor&); // c_side.to_f2_arg extern "C" void complex_taylor_to_f2 (Opaque_complex_taylor_class*, c_Complex&, const CPP_complex_taylor_term**, Int); extern "C" void complex_taylor_to_f (const CPP_complex_taylor& C, Opaque_complex_taylor_class* F) { // c_side.to_f_setup[type, 1, PTR] int n1_term = C.term.size(); const CPP_complex_taylor_term** z_term = NULL; if (n1_term != 0) { z_term = new const CPP_complex_taylor_term*[n1_term]; for (int i = 0; i < n1_term; i++) z_term[i] = &C.term[i]; } // c_side.to_f2_call complex_taylor_to_f2 (F, C.ref, z_term, n1_term); // c_side.to_f_cleanup[type, 1, PTR] delete[] z_term; } // c_side.to_c2_arg extern "C" void complex_taylor_to_c2 (CPP_complex_taylor& C, c_Complex& z_ref, Opaque_complex_taylor_term_class** z_term, Int n1_term) { // c_side.to_c2_set[complex, 0, NOT] C.ref = z_ref; // c_side.to_c2_set[type, 1, PTR] C.term.resize(n1_term); for (int i = 0; i < n1_term; i++) complex_taylor_term_to_c(z_term[i], C.term[i]); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_branch extern "C" void branch_to_c (const Opaque_branch_class*, CPP_branch&); // c_side.to_f2_arg extern "C" void branch_to_f2 (Opaque_branch_class*, c_Char, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, const CPP_mode_info&, const CPP_mode_info&, const CPP_mode_info&, const CPP_ele**, Int, const CPP_lat_param&, const CPP_wall3d**, Int); extern "C" void branch_to_f (const CPP_branch& C, Opaque_branch_class* F) { // c_side.to_f_setup[type, 1, PTR] int n1_ele = C.ele.size(); const CPP_ele** z_ele = NULL; if (n1_ele != 0) { z_ele = new const CPP_ele*[n1_ele]; for (int i = 0; i < n1_ele; i++) z_ele[i] = &C.ele[i]; } // c_side.to_f_setup[type, 1, PTR] int n1_wall3d = C.wall3d.size(); const CPP_wall3d** z_wall3d = NULL; if (n1_wall3d != 0) { z_wall3d = new const CPP_wall3d*[n1_wall3d]; for (int i = 0; i < n1_wall3d; i++) z_wall3d[i] = &C.wall3d[i]; } // c_side.to_f2_call branch_to_f2 (F, C.name.c_str(), C.ix_branch, C.ix_from_branch, C.ix_from_ele, C.ix_to_ele, C.n_ele_track, C.n_ele_max, C.a, C.b, C.z, z_ele, n1_ele, C.param, z_wall3d, n1_wall3d); // c_side.to_f_cleanup[type, 1, PTR] delete[] z_ele; // c_side.to_f_cleanup[type, 1, PTR] delete[] z_wall3d; } // c_side.to_c2_arg extern "C" void branch_to_c2 (CPP_branch& C, c_Char z_name, c_Int& z_ix_branch, c_Int& z_ix_from_branch, c_Int& z_ix_from_ele, c_Int& z_ix_to_ele, c_Int& z_n_ele_track, c_Int& z_n_ele_max, const Opaque_mode_info_class* z_a, const Opaque_mode_info_class* z_b, const Opaque_mode_info_class* z_z, Opaque_ele_class** z_ele, Int n1_ele, const Opaque_lat_param_class* z_param, Opaque_wall3d_class** z_wall3d, Int n1_wall3d) { // c_side.to_c2_set[character, 0, NOT] C.name = z_name; // c_side.to_c2_set[integer, 0, NOT] C.ix_branch = z_ix_branch; // c_side.to_c2_set[integer, 0, NOT] C.ix_from_branch = z_ix_from_branch; // c_side.to_c2_set[integer, 0, NOT] C.ix_from_ele = z_ix_from_ele; // c_side.to_c2_set[integer, 0, NOT] C.ix_to_ele = z_ix_to_ele; // c_side.to_c2_set[integer, 0, NOT] C.n_ele_track = z_n_ele_track; // c_side.to_c2_set[integer, 0, NOT] C.n_ele_max = z_n_ele_max; // c_side.to_c2_set[type, 0, NOT] mode_info_to_c(z_a, C.a); // c_side.to_c2_set[type, 0, NOT] mode_info_to_c(z_b, C.b); // c_side.to_c2_set[type, 0, NOT] mode_info_to_c(z_z, C.z); // c_side.to_c2_set[type, 1, PTR] C.ele.resize(n1_ele); for (int i = 0; i < n1_ele; i++) ele_to_c(z_ele[i], C.ele[i]); // c_side.to_c2_set[type, 0, NOT] lat_param_to_c(z_param, C.param); // c_side.to_c2_set[type, 1, PTR] C.wall3d.resize(n1_wall3d); for (int i = 0; i < n1_wall3d; i++) wall3d_to_c(z_wall3d[i], C.wall3d[i]); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_lat extern "C" void lat_to_c (const Opaque_lat_class*, CPP_lat&); // c_side.to_f2_arg extern "C" void lat_to_f2 (Opaque_lat_class*, c_Char, c_Char, c_Char, c_Char, c_Char, c_Char*, Int, const CPP_expression_atom**, Int, const CPP_mode_info&, Int, const CPP_mode_info&, Int, const CPP_mode_info&, Int, const CPP_lat_param&, Int, const CPP_bookkeeping_state&, const CPP_ele&, const CPP_ele**, Int, const CPP_branch**, Int, const CPP_control**, Int, const CPP_coord&, const CPP_beam_init&, const CPP_pre_tracker&, c_RealArr, Int, c_Int&, c_IntArr, Int, c_IntArr, Int, c_Int&, c_Int&, c_Int&, c_IntArr, Int, c_Int&, c_Int&); extern "C" void lat_to_f (const CPP_lat& C, Opaque_lat_class* F) { // c_side.to_f_setup[character, 1, ALLOC] int n1_print_str = C.print_str.size(); c_Char* z_print_str = NULL; if (n1_print_str != 0) { z_print_str = new c_Char[n1_print_str]; for (int i = 0; i < n1_print_str; i++) z_print_str[i] = C.print_str[i].c_str(); } // c_side.to_f_setup[type, 1, ALLOC] int n1_constant = C.constant.size(); const CPP_expression_atom** z_constant = NULL; if (n1_constant != 0) { z_constant = new const CPP_expression_atom*[n1_constant]; for (int i = 0; i < n1_constant; i++) z_constant[i] = &C.constant[i]; } // c_side.to_f_setup[type, 0, PTR] unsigned int n_a = 0; if (C.a != NULL) n_a = 1; // c_side.to_f_setup[type, 0, PTR] unsigned int n_b = 0; if (C.b != NULL) n_b = 1; // c_side.to_f_setup[type, 0, PTR] unsigned int n_z = 0; if (C.z != NULL) n_z = 1; // c_side.to_f_setup[type, 0, PTR] unsigned int n_param = 0; if (C.param != NULL) n_param = 1; // c_side.to_f_setup[type, 1, PTR] int n1_ele = C.ele.size(); const CPP_ele** z_ele = NULL; if (n1_ele != 0) { z_ele = new const CPP_ele*[n1_ele]; for (int i = 0; i < n1_ele; i++) z_ele[i] = &C.ele[i]; } // c_side.to_f_setup[type, 1, ALLOC] int n1_branch = C.branch.size(); const CPP_branch** z_branch = NULL; if (n1_branch != 0) { z_branch = new const CPP_branch*[n1_branch]; for (int i = 0; i < n1_branch; i++) z_branch[i] = &C.branch[i]; } // c_side.to_f_setup[type, 1, ALLOC] int n1_control = C.control.size(); const CPP_control** z_control = NULL; if (n1_control != 0) { z_control = new const CPP_control*[n1_control]; for (int i = 0; i < n1_control; i++) z_control[i] = &C.control[i]; } // c_side.to_f_setup[real, 1, ALLOC] int n1_custom = C.custom.size(); c_RealArr z_custom = NULL; if (n1_custom > 0) { z_custom = &C.custom[0]; } // c_side.to_f_setup[integer, 0, PTR] unsigned int n_n_ele_track = 0; if (C.n_ele_track != NULL) n_n_ele_track = 1; // c_side.to_f_setup[integer, 0, PTR] unsigned int n_n_ele_max = 0; if (C.n_ele_max != NULL) n_n_ele_max = 1; // c_side.to_f_setup[integer, 1, ALLOC] int n1_ic = C.ic.size(); c_IntArr z_ic = NULL; if (n1_ic > 0) { z_ic = &C.ic[0]; } // c_side.to_f2_call lat_to_f2 (F, C.use_name.c_str(), C.lattice.c_str(), C.machine.c_str(), C.input_file_name.c_str(), C.title.c_str(), z_print_str, n1_print_str, z_constant, n1_constant, *C.a, n_a, *C.b, n_b, *C.z, n_z, *C.param, n_param, C.lord_state, C.ele_init, z_ele, n1_ele, z_branch, n1_branch, z_control, n1_control, C.particle_start, C.beam_init, C.pre_tracker, z_custom, n1_custom, C.version, C.n_ele_track, n_n_ele_track, C.n_ele_max, n_n_ele_max, C.n_control_max, C.n_ic_max, C.input_taylor_order, z_ic, n1_ic, C.photon_type, C.creation_hash); // c_side.to_f_cleanup[character, 1, ALLOC] delete[] z_print_str; // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_constant; // c_side.to_f_cleanup[type, 1, PTR] delete[] z_ele; // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_branch; // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_control; } // c_side.to_c2_arg extern "C" void lat_to_c2 (CPP_lat& C, c_Char z_use_name, c_Char z_lattice, c_Char z_machine, c_Char z_input_file_name, c_Char z_title, c_Char* z_print_str, Int n1_print_str, Opaque_expression_atom_class** z_constant, Int n1_constant, Opaque_mode_info_class* z_a, Int n_a, Opaque_mode_info_class* z_b, Int n_b, Opaque_mode_info_class* z_z, Int n_z, Opaque_lat_param_class* z_param, Int n_param, const Opaque_bookkeeping_state_class* z_lord_state, const Opaque_ele_class* z_ele_init, Opaque_ele_class** z_ele, Int n1_ele, Opaque_branch_class** z_branch, Int n1_branch, Opaque_control_class** z_control, Int n1_control, const Opaque_coord_class* z_particle_start, const Opaque_beam_init_class* z_beam_init, const Opaque_pre_tracker_class* z_pre_tracker, c_RealArr z_custom, Int n1_custom, c_Int& z_version, c_IntArr z_n_ele_track, Int n_n_ele_track, c_IntArr z_n_ele_max, Int n_n_ele_max, c_Int& z_n_control_max, c_Int& z_n_ic_max, c_Int& z_input_taylor_order, c_IntArr z_ic, Int n1_ic, c_Int& z_photon_type, c_Int& z_creation_hash) { // c_side.to_c2_set[character, 0, NOT] C.use_name = z_use_name; // c_side.to_c2_set[character, 0, NOT] C.lattice = z_lattice; // c_side.to_c2_set[character, 0, NOT] C.machine = z_machine; // c_side.to_c2_set[character, 0, NOT] C.input_file_name = z_input_file_name; // c_side.to_c2_set[character, 0, NOT] C.title = z_title; // c_side.to_c2_set[character, 1, ALLOC] C.print_str.resize(n1_print_str); for (int i = 0; i < n1_print_str; i++) C.print_str[i] = z_print_str[i]; // c_side.to_c2_set[type, 1, ALLOC] C.constant.resize(n1_constant); for (int i = 0; i < n1_constant; i++) expression_atom_to_c(z_constant[i], C.constant[i]); // c_side.to_c2_set[type, 0, PTR] if (n_a == 0) delete C.a; else { C.a = new CPP_mode_info; mode_info_to_c(z_a, *C.a); } // c_side.to_c2_set[type, 0, PTR] if (n_b == 0) delete C.b; else { C.b = new CPP_mode_info; mode_info_to_c(z_b, *C.b); } // c_side.to_c2_set[type, 0, PTR] if (n_z == 0) delete C.z; else { C.z = new CPP_mode_info; mode_info_to_c(z_z, *C.z); } // c_side.to_c2_set[type, 0, PTR] if (n_param == 0) delete C.param; else { C.param = new CPP_lat_param; lat_param_to_c(z_param, *C.param); } // c_side.to_c2_set[type, 0, NOT] bookkeeping_state_to_c(z_lord_state, C.lord_state); // c_side.to_c2_set[type, 0, NOT] ele_to_c(z_ele_init, C.ele_init); // c_side.to_c2_set[type, 1, PTR] C.ele.resize(n1_ele); for (int i = 0; i < n1_ele; i++) ele_to_c(z_ele[i], C.ele[i]); // c_side.to_c2_set[type, 1, ALLOC] C.branch.resize(n1_branch); for (int i = 0; i < n1_branch; i++) branch_to_c(z_branch[i], C.branch[i]); // c_side.to_c2_set[type, 1, ALLOC] C.control.resize(n1_control); for (int i = 0; i < n1_control; i++) control_to_c(z_control[i], C.control[i]); // c_side.to_c2_set[type, 0, NOT] coord_to_c(z_particle_start, C.particle_start); // c_side.to_c2_set[type, 0, NOT] beam_init_to_c(z_beam_init, C.beam_init); // c_side.to_c2_set[type, 0, NOT] pre_tracker_to_c(z_pre_tracker, C.pre_tracker); // c_side.to_c2_set[real, 1, ALLOC] C.custom.resize(n1_custom); C.custom << z_custom; // c_side.to_c2_set[integer, 0, NOT] C.version = z_version; // c_side.to_c2_set[integer, 0, PTR] if (n_n_ele_track == 0) delete C.n_ele_track; else { C.n_ele_track = new Int; *C.n_ele_track = *z_n_ele_track; } // c_side.to_c2_set[integer, 0, PTR] if (n_n_ele_max == 0) delete C.n_ele_max; else { C.n_ele_max = new Int; *C.n_ele_max = *z_n_ele_max; } // c_side.to_c2_set[integer, 0, NOT] C.n_control_max = z_n_control_max; // c_side.to_c2_set[integer, 0, NOT] C.n_ic_max = z_n_ic_max; // c_side.to_c2_set[integer, 0, NOT] C.input_taylor_order = z_input_taylor_order; // c_side.to_c2_set[integer, 1, ALLOC] C.ic.resize(n1_ic); C.ic << z_ic; // c_side.to_c2_set[integer, 0, NOT] C.photon_type = z_photon_type; // c_side.to_c2_set[integer, 0, NOT] C.creation_hash = z_creation_hash; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_bunch extern "C" void bunch_to_c (const Opaque_bunch_class*, CPP_bunch&); // c_side.to_f2_arg extern "C" void bunch_to_f2 (Opaque_bunch_class*, const CPP_coord**, Int, c_IntArr, Int, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&); extern "C" void bunch_to_f (const CPP_bunch& C, Opaque_bunch_class* F) { // c_side.to_f_setup[type, 1, ALLOC] int n1_particle = C.particle.size(); const CPP_coord** z_particle = NULL; if (n1_particle != 0) { z_particle = new const CPP_coord*[n1_particle]; for (int i = 0; i < n1_particle; i++) z_particle[i] = &C.particle[i]; } // c_side.to_f_setup[integer, 1, ALLOC] int n1_ix_z = C.ix_z.size(); c_IntArr z_ix_z = NULL; if (n1_ix_z > 0) { z_ix_z = &C.ix_z[0]; } // c_side.to_f2_call bunch_to_f2 (F, z_particle, n1_particle, z_ix_z, n1_ix_z, C.charge_tot, C.charge_live, C.z_center, C.t_center, C.t0, C.ix_ele, C.ix_bunch, C.ix_turn, C.n_live, C.n_good, C.n_bad); // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_particle; } // c_side.to_c2_arg extern "C" void bunch_to_c2 (CPP_bunch& C, Opaque_coord_class** z_particle, Int n1_particle, c_IntArr z_ix_z, Int n1_ix_z, c_Real& z_charge_tot, c_Real& z_charge_live, c_Real& z_z_center, c_Real& z_t_center, c_Real& z_t0, c_Int& z_ix_ele, c_Int& z_ix_bunch, c_Int& z_ix_turn, c_Int& z_n_live, c_Int& z_n_good, c_Int& z_n_bad) { // c_side.to_c2_set[type, 1, ALLOC] C.particle.resize(n1_particle); for (int i = 0; i < n1_particle; i++) coord_to_c(z_particle[i], C.particle[i]); // c_side.to_c2_set[integer, 1, ALLOC] C.ix_z.resize(n1_ix_z); C.ix_z << z_ix_z; // c_side.to_c2_set[real, 0, NOT] C.charge_tot = z_charge_tot; // c_side.to_c2_set[real, 0, NOT] C.charge_live = z_charge_live; // c_side.to_c2_set[real, 0, NOT] C.z_center = z_z_center; // c_side.to_c2_set[real, 0, NOT] C.t_center = z_t_center; // c_side.to_c2_set[real, 0, NOT] C.t0 = z_t0; // c_side.to_c2_set[integer, 0, NOT] C.ix_ele = z_ix_ele; // c_side.to_c2_set[integer, 0, NOT] C.ix_bunch = z_ix_bunch; // c_side.to_c2_set[integer, 0, NOT] C.ix_turn = z_ix_turn; // c_side.to_c2_set[integer, 0, NOT] C.n_live = z_n_live; // c_side.to_c2_set[integer, 0, NOT] C.n_good = z_n_good; // c_side.to_c2_set[integer, 0, NOT] C.n_bad = z_n_bad; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_bunch_params extern "C" void bunch_params_to_c (const Opaque_bunch_params_class*, CPP_bunch_params&); // c_side.to_f2_arg extern "C" void bunch_params_to_f2 (Opaque_bunch_params_class*, const CPP_coord&, const CPP_twiss&, const CPP_twiss&, const CPP_twiss&, const CPP_twiss&, const CPP_twiss&, const CPP_twiss&, c_RealArr, c_RealArr, c_RealArr, c_Real&, c_Real&, c_Real&, c_Real&, c_Real&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Int&, c_Bool&); extern "C" void bunch_params_to_f (const CPP_bunch_params& C, Opaque_bunch_params_class* F) { // c_side.to_f_setup[real, 2, NOT] Real z_sigma[6*6]; matrix_to_vec(C.sigma, z_sigma); // c_side.to_f2_call bunch_params_to_f2 (F, C.centroid, C.x, C.y, C.z, C.a, C.b, C.c, z_sigma, &C.rel_max[0], &C.rel_min[0], C.s, C.t, C.sigma_t, C.charge_live, C.charge_tot, C.n_particle_tot, C.n_particle_live, C.n_particle_lost_in_ele, C.n_good_steps, C.n_bad_steps, C.ix_ele, C.location, C.twiss_valid); } // c_side.to_c2_arg extern "C" void bunch_params_to_c2 (CPP_bunch_params& C, const Opaque_coord_class* z_centroid, const Opaque_twiss_class* z_x, const Opaque_twiss_class* z_y, const Opaque_twiss_class* z_z, const Opaque_twiss_class* z_a, const Opaque_twiss_class* z_b, const Opaque_twiss_class* z_c, c_RealArr z_sigma, c_RealArr z_rel_max, c_RealArr z_rel_min, c_Real& z_s, c_Real& z_t, c_Real& z_sigma_t, c_Real& z_charge_live, c_Real& z_charge_tot, c_Int& z_n_particle_tot, c_Int& z_n_particle_live, c_Int& z_n_particle_lost_in_ele, c_Int& z_n_good_steps, c_Int& z_n_bad_steps, c_Int& z_ix_ele, c_Int& z_location, c_Bool& z_twiss_valid) { // c_side.to_c2_set[type, 0, NOT] coord_to_c(z_centroid, C.centroid); // c_side.to_c2_set[type, 0, NOT] twiss_to_c(z_x, C.x); // c_side.to_c2_set[type, 0, NOT] twiss_to_c(z_y, C.y); // c_side.to_c2_set[type, 0, NOT] twiss_to_c(z_z, C.z); // c_side.to_c2_set[type, 0, NOT] twiss_to_c(z_a, C.a); // c_side.to_c2_set[type, 0, NOT] twiss_to_c(z_b, C.b); // c_side.to_c2_set[type, 0, NOT] twiss_to_c(z_c, C.c); // c_side.to_c2_set[real, 2, NOT] C.sigma << z_sigma; // c_side.to_c2_set[real, 1, NOT] C.rel_max << z_rel_max; // c_side.to_c2_set[real, 1, NOT] C.rel_min << z_rel_min; // c_side.to_c2_set[real, 0, NOT] C.s = z_s; // c_side.to_c2_set[real, 0, NOT] C.t = z_t; // c_side.to_c2_set[real, 0, NOT] C.sigma_t = z_sigma_t; // c_side.to_c2_set[real, 0, NOT] C.charge_live = z_charge_live; // c_side.to_c2_set[real, 0, NOT] C.charge_tot = z_charge_tot; // c_side.to_c2_set[integer, 0, NOT] C.n_particle_tot = z_n_particle_tot; // c_side.to_c2_set[integer, 0, NOT] C.n_particle_live = z_n_particle_live; // c_side.to_c2_set[integer, 0, NOT] C.n_particle_lost_in_ele = z_n_particle_lost_in_ele; // c_side.to_c2_set[integer, 0, NOT] C.n_good_steps = z_n_good_steps; // c_side.to_c2_set[integer, 0, NOT] C.n_bad_steps = z_n_bad_steps; // c_side.to_c2_set[integer, 0, NOT] C.ix_ele = z_ix_ele; // c_side.to_c2_set[integer, 0, NOT] C.location = z_location; // c_side.to_c2_set[logical, 0, NOT] C.twiss_valid = z_twiss_valid; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_beam extern "C" void beam_to_c (const Opaque_beam_class*, CPP_beam&); // c_side.to_f2_arg extern "C" void beam_to_f2 (Opaque_beam_class*, const CPP_bunch**, Int); extern "C" void beam_to_f (const CPP_beam& C, Opaque_beam_class* F) { // c_side.to_f_setup[type, 1, ALLOC] int n1_bunch = C.bunch.size(); const CPP_bunch** z_bunch = NULL; if (n1_bunch != 0) { z_bunch = new const CPP_bunch*[n1_bunch]; for (int i = 0; i < n1_bunch; i++) z_bunch[i] = &C.bunch[i]; } // c_side.to_f2_call beam_to_f2 (F, z_bunch, n1_bunch); // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_bunch; } // c_side.to_c2_arg extern "C" void beam_to_c2 (CPP_beam& C, Opaque_bunch_class** z_bunch, Int n1_bunch) { // c_side.to_c2_set[type, 1, ALLOC] C.bunch.resize(n1_bunch); for (int i = 0; i < n1_bunch; i++) bunch_to_c(z_bunch[i], C.bunch[i]); } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_aperture_point extern "C" void aperture_point_to_c (const Opaque_aperture_point_class*, CPP_aperture_point&); // c_side.to_f2_arg extern "C" void aperture_point_to_f2 (Opaque_aperture_point_class*, c_Real&, c_Real&, c_Int&, c_Int&, c_Int&); extern "C" void aperture_point_to_f (const CPP_aperture_point& C, Opaque_aperture_point_class* F) { // c_side.to_f2_call aperture_point_to_f2 (F, C.x, C.y, C.plane, C.ix_ele, C.i_turn); } // c_side.to_c2_arg extern "C" void aperture_point_to_c2 (CPP_aperture_point& C, c_Real& z_x, c_Real& z_y, c_Int& z_plane, c_Int& z_ix_ele, c_Int& z_i_turn) { // c_side.to_c2_set[real, 0, NOT] C.x = z_x; // c_side.to_c2_set[real, 0, NOT] C.y = z_y; // c_side.to_c2_set[integer, 0, NOT] C.plane = z_plane; // c_side.to_c2_set[integer, 0, NOT] C.ix_ele = z_ix_ele; // c_side.to_c2_set[integer, 0, NOT] C.i_turn = z_i_turn; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_aperture_param extern "C" void aperture_param_to_c (const Opaque_aperture_param_class*, CPP_aperture_param&); // c_side.to_f2_arg extern "C" void aperture_param_to_f2 (Opaque_aperture_param_class*, c_Real&, c_Real&, c_Int&, c_Int&, c_Real&, c_Real&, c_Real&, c_Real&, c_Char); extern "C" void aperture_param_to_f (const CPP_aperture_param& C, Opaque_aperture_param_class* F) { // c_side.to_f2_call aperture_param_to_f2 (F, C.min_angle, C.max_angle, C.n_angle, C.n_turn, C.x_init, C.y_init, C.rel_accuracy, C.abs_accuracy, C.start_ele.c_str()); } // c_side.to_c2_arg extern "C" void aperture_param_to_c2 (CPP_aperture_param& C, c_Real& z_min_angle, c_Real& z_max_angle, c_Int& z_n_angle, c_Int& z_n_turn, c_Real& z_x_init, c_Real& z_y_init, c_Real& z_rel_accuracy, c_Real& z_abs_accuracy, c_Char z_start_ele) { // c_side.to_c2_set[real, 0, NOT] C.min_angle = z_min_angle; // c_side.to_c2_set[real, 0, NOT] C.max_angle = z_max_angle; // c_side.to_c2_set[integer, 0, NOT] C.n_angle = z_n_angle; // c_side.to_c2_set[integer, 0, NOT] C.n_turn = z_n_turn; // c_side.to_c2_set[real, 0, NOT] C.x_init = z_x_init; // c_side.to_c2_set[real, 0, NOT] C.y_init = z_y_init; // c_side.to_c2_set[real, 0, NOT] C.rel_accuracy = z_rel_accuracy; // c_side.to_c2_set[real, 0, NOT] C.abs_accuracy = z_abs_accuracy; // c_side.to_c2_set[character, 0, NOT] C.start_ele = z_start_ele; } //-------------------------------------------------------------------- //-------------------------------------------------------------------- // CPP_aperture_scan extern "C" void aperture_scan_to_c (const Opaque_aperture_scan_class*, CPP_aperture_scan&); // c_side.to_f2_arg extern "C" void aperture_scan_to_f2 (Opaque_aperture_scan_class*, const CPP_aperture_point**, Int, const CPP_coord&, c_Real&); extern "C" void aperture_scan_to_f (const CPP_aperture_scan& C, Opaque_aperture_scan_class* F) { // c_side.to_f_setup[type, 1, ALLOC] int n1_point = C.point.size(); const CPP_aperture_point** z_point = NULL; if (n1_point != 0) { z_point = new const CPP_aperture_point*[n1_point]; for (int i = 0; i < n1_point; i++) z_point[i] = &C.point[i]; } // c_side.to_f2_call aperture_scan_to_f2 (F, z_point, n1_point, C.ref_orb, C.pz_start); // c_side.to_f_cleanup[type, 1, ALLOC] delete[] z_point; } // c_side.to_c2_arg extern "C" void aperture_scan_to_c2 (CPP_aperture_scan& C, Opaque_aperture_point_class** z_point, Int n1_point, const Opaque_coord_class* z_ref_orb, c_Real& z_pz_start) { // c_side.to_c2_set[type, 1, ALLOC] C.point.resize(n1_point); for (int i = 0; i < n1_point; i++) aperture_point_to_c(z_point[i], C.point[i]); // c_side.to_c2_set[type, 0, NOT] coord_to_c(z_ref_orb, C.ref_orb); // c_side.to_c2_set[real, 0, NOT] C.pz_start = z_pz_start; }