int main(int argc, char *argv[]) { /* Create the sidl structures */ sidl_BaseClass model_base = LOADCLASS("libRosenbrock-server-C++.so","Rosenbrock.RosenbrockModel"); Optimize_OptimizationModel model = Optimize_OptimizationModel__cast(model_base); sidl_BaseClass tao_base = LOADCLASS("libTaoapi-server-C++.so","TAO.Solver"); Solver_OptimizationSolver tao = Solver_OptimizationSolver__cast(tao_base); sidl_BaseClass taoenvironment_base = LOADCLASS("libTaoapi-server-C++.so","TAO.Environment"); Solver_ProjectState taoenvironment = Solver_ProjectState__cast(taoenvironment_base); int info,i; /* Get argument list in sidl_string__array form */ struct sidl_string__array *args = sidl_string__array_create1d(argc); for (i=0;i<argc;i++) sidl_string__array_set1(args, i, argv[i]); /* Initializes PETSc and TAO */ info = Solver_ProjectState_Initialize(taoenvironment,args); CHKERR(info, "initialize"); /* Create the solver */ info = Solver_OptimizationSolver_Create(tao,"tao_lmvm"); CHKERR(info,"solver_create"); /* Read in any tao command line arguments */ info = Solver_OptimizationSolver_SetFromOptions(tao); CHKERR(info,"setfromoptions"); /* Solve the application */ info = Solver_OptimizationSolver_SolveApplication(tao,model); CHKERR(info,"solveapplication"); /* View the solver information */ info = Solver_OptimizationSolver_View(tao); CHKERR(info,"view"); /* Clean up */ info = Solver_OptimizationSolver_Destroy(tao); CHKERR(info,"solver_destroy"); info = Solver_ProjectState_Finalize(taoenvironment); CHKERR(info,"env_destroy"); /* Delete sidl structure */ Optimize_OptimizationModel_deleteRef(model); Solver_OptimizationSolver_deleteRef(tao); sidl_string__array_deleteRef(args); return 0; }
struct sidl_string__array* impl_csdms_model_Sedflux2d_get_output_item_list( /* in */ csdms_model_Sedflux2d self, /* out */ sidl_BaseInterface *_ex) { *_ex = 0; { /* DO-NOT-DELETE splicer.begin(csdms.model.Sedflux2d.get_output_item_list) */ struct sidl_string__array* item_names_array = NULL; char **item_names = NULL; const int MAX_NAME_LENGTH = 2048; int number_of_names = 0; int i; GET_PRIVATE_DATA(this); CALL_BMI(Get_output_var_name_count, this->state, &number_of_names); item_names = (char**)malloc(sizeof(char*) * number_of_names); item_names[0] = (char*)calloc(number_of_names * MAX_NAME_LENGTH, sizeof(char)); for (i = 1; i < number_of_names; i ++) { item_names[i] = item_names[i - 1] + MAX_NAME_LENGTH; } CALL_BMI(Get_output_var_names, this->state, item_names); item_names_array = sidl_string__array_create1d(number_of_names); for (i = 0; i < number_of_names; i ++) { sidl_string__array_set1(item_names_array, i, item_names[i]); } free(item_names); return item_names_array; EXIT: return NULL; /* DO-NOT-DELETE splicer.end(csdms.model.Sedflux2d.get_output_item_list) */ } }