1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
| // Include the library specific header file as generated by the
// MATLAB Compiler
#include "raytracing.h"
int run_main(int argc, char **argv)
{
// Call application and library initialization.
// Perform init before calling any API functions or
// Compiler-generated libraries.
if (!mclInitializeApplication(NULL,0))
{
std::cerr << "could not initialize the application properly" << std::endl;
return -1;
}
if( !raytracingInitialize() )
{
std::cerr << "could not initialize the library properly" << std::endl;
return -1;
}
else
{
try
{
// Create input datas
mwArray par_input;
par_input = struct_func("delta_r", 0.1000,"opt_ang", 0,
"any_pl", 516,
"delta_z", 0.1000,
"delta_nz", 0.0100,
"z_raw_str", "0:300"
"z_raw", 0,//[1x301 double]
"c_raw_str", 0,//'1500+(0:300)*0.1'
"c_raw", 0,//[1x301 double]
"SSP_z",0, //[1x3001 double]
"SSP_c", 0,//[1x3001 double]
"theta_min", -10,
"theta_max", 10,
"angle_max", 10,
"angle_min", -10,
"N_angles", 20,
"theta_initial",0, //[1x18 double]
"c_botm", 1700,
"rho_bottom", 2000,
"alpha_bottom", 1,
"wind_speed", 2,
"sigma_bottom", 0.1000,
"z_source", 200,
"z_receiver", 200,
"R_b_str", "0:10000"
"R_b", 0,//[1x10001 double]
"Z_b_str", "300"
"Z_b", 0,//[1x10001 double]
"SED_r",0, //[1x100001 double]
"SED_z", 0,//[1x100001 double]
"r_source", 10,
"r_receiver", 10000,
"signal_length", 512,
"ctr_freq", 100,
"message_f", 50,
"delta_phone", 500,
"botm_stop", 0,
"intp_SSP", "linear",
"intp_Bottom", "linear",
"intp_angle", "exponential",
"dir_receiver", 0,
"if_opt_ang", 0,
"describe", "Software default parameters",
"z_max", 300,
"r_max", 10000,
"fs", 500,
"s_fs", 250,
"signal", 0,//[1x512 double]
"sigma_surface", 0.0204,
"c_red", 1530,
"c_source", 1520,
"phone", 0//[1x20 double]
);
mwArray new_thetas;//theta);
mwArray new_delta_z;//z_step);
//SetData(data, 9);
// Create output array
mwArray rays;
rays = struct_func(
"delta_z", 0.1000,
"X", 0,//[1x12724 double]
"Z", 0,//[-200 2000 -4999 7999 -10998 12724]
"DIR_X", 0,//[1x9991 double]
"DIR_Z", 0//[1x9991 double]
);
mwArray count;
count = struct_func(
"TURNING_ANGLE", 0,
"BOTTOM",0,//[0 1 1 2]
"SURFACE", 0,//[1 1 2 2]
"TURNING_ABOVE",0, //[0 0 0 0]
"TURNING_BELOW",0 //[0 0 0 0]
);
mwArray eig;
eig = struct_func(
"TIME", 0,//[1.6221 3.1514 4.7735 6.3028],
"RANGE", 0,//[2.4271e+003 4.7492e+003 7.1663e+003 9.4884e+003],
"THETA", -0.1239,
"ANGLE",0, //[0.1239 -0.1240 0.1239 -0.1240],
"AL",0, //[0.9997 0.9993 0.9990 0.9987],
"REFCOEF_BOTM", 0,//[1 -0.9004 - 0.4171i -0.9004 - 0.4171i 0.6368 + 0.7511i],
"REFCOEF_SURF",0, //[1.0000 1.0000 1.0000 1.0000],
"Doppler", 0,//[0.0032 0.0032 0.0065 0.0065],
"DIREIG",0 //tryjrty
);
mwArray OK(0);
// Call the library function
ray_tracing(4, rays,count,eig,OK, par_input, new_thetas,new_delta_z);
}
catch (const mwException& e)
{
std::cerr << e.what() << std::endl;
return -2;
}
catch (...)
{
std::cerr << "Unexpected error thrown" << std::endl;
return -3;
}
// Call the application and library termination routine
raytracingTerminate();
}
/* You should call mclTerminate application at the end of
* your application.
*/
mclTerminateApplication();
return 0;
}
int main()
{
mclmcrInitialize();
return mclRunMain((mclMainFcnType)run_main,0,NULL);
} |