Fix warnings in cannon sims

Fixed a lot of warnings about missing prototypes and unused variables.

refs #245
This commit is contained in:
Alex Lin 2016-06-02 09:37:42 -05:00
parent 5966c61add
commit 149e01a4c9
22 changed files with 76 additions and 65 deletions

View File

@ -20,11 +20,11 @@ typedef struct {
double pos[3] ; /* m position */
double vel[3] ; /* m/s velocity */
double acc[3] ; /* m/s2 acceleration */
double omega[3] ; /* r/s Angular velocity of cannonball */
double omega[3] ; /* rad/s Angular velocity of cannonball */
double theta ; /* r Angle from x-axis to axis rotation */
double phi ; /* r Angle from z-axis to axis rotation */
double omega0 ; /* r/s Magnitude of angular velocity about
double theta ; /* rad Angle from x-axis to axis rotation */
double phi ; /* rad Angle from z-axis to axis rotation */
double omega0 ; /* rad/s Magnitude of angular velocity about
axis of rotation */
/* Impact */
REGULA_FALSI rf ; /* -- Dynamic event params for impact */
@ -42,7 +42,7 @@ typedef struct {
double mag_force_drag ; /* N Magnitude of drag force */
double mag_force_magnus ; /* N Magnitude of magnus force */
double mag_force_cross ; /* N Magnitude of cross force */
double mag_omega ; /* r/s Magnitude of angular velocity */
double mag_omega ; /* rad/s Magnitude of angular velocity */
void ** force_collect ; /* ** For collect statement */

View File

@ -3,6 +3,7 @@ PURPOSE: (Kaboom!!!)
***************************************************************************/
#include <stdio.h>
#include "../include/cannon_aero.h"
#include "../include/cannon_monte_proto.h"
#include "sim_services/Integrator/include/integrator_c_intf.h"
#include "sim_services/Executive/include/exec_proto.h"

View File

@ -2,6 +2,7 @@
PURPOSE: (Controls when jets are fired)
***************************************************************************/
#include "../include/cannon_aero.h"
#include "../include/cannon_monte_proto.h"
#include "sim_services/Executive/include/exec_proto.h"
#include "trick_utils/math/include/trick_math.h"

View File

@ -4,6 +4,7 @@ LIBRARY_DEPENDENCY: ((cannon_aero_default_data.o))
*********************************************************/
#include "../include/cannon_aero.h"
#include "../include/cannon_monte_proto.h"
int cannon_monte_default_data(CANNON_AERO* C)
{
@ -22,16 +23,16 @@ int cannon_monte_default_data(CANNON_AERO* C)
/* Regula Falsi impact critter setup */
#define BIG_TGO 10000
#define MY_BIG_TGO 10000
C->rf.lower_set = No ;
C->rf.upper_set = No ;
C->rf.iterations = 0 ;
C->rf.fires = 0 ;
C->rf.x_lower = BIG_TGO ;
C->rf.t_lower = BIG_TGO ;
C->rf.x_upper = BIG_TGO ;
C->rf.t_upper = BIG_TGO ;
C->rf.delta_time = BIG_TGO ;
C->rf.x_lower = MY_BIG_TGO ;
C->rf.t_lower = MY_BIG_TGO ;
C->rf.x_upper = MY_BIG_TGO ;
C->rf.t_upper = MY_BIG_TGO ;
C->rf.delta_time = MY_BIG_TGO ;
C->rf.error_tol = 1.0e-9 ;
C->rf.mode = Decreasing ;

View File

@ -12,15 +12,15 @@ PURPOSE: (Cannonball Structure)
typedef struct {
double pos0[2] ; /* *i M Init position of cannonball */
double vel0[2] ; /* *i M Init velocity of cannonball */
double acc0[2] ; /* *i M Init acceleration of cannonball */
double pos0[2] ; /* *i m Init position of cannonball */
double vel0[2] ; /* *i m Init velocity of cannonball */
double acc0[2] ; /* *i m Init acceleration of cannonball */
double pos[2] ; /* M xy-position */
double vel[2] ; /* M/s xy-velocity */
double acc[2] ; /* M/s2 xy-acceleration */
double init_speed ; /* *i M/s Init barrel speed */
double init_angle ; /* *i r Angle of cannon */
double pos[2] ; /* m xy-position */
double vel[2] ; /* m/s xy-velocity */
double acc[2] ; /* m/s2 xy-acceleration */
double init_speed ; /* *i m/s Init barrel speed */
double init_angle ; /* *i rad Angle of cannon */
/* Impact */
REGULA_FALSI rf ; /* -- Dynamic event params for impact */

View File

@ -3,6 +3,7 @@ PURPOSE: ( Analytical Cannon )
*****************************************************************************/
#include <stdio.h>
#include "../include/cannon.h"
#include "../include/cannon_analytic_proto.h"
int cannon_analytic(
CANNON* C )

View File

@ -5,6 +5,7 @@ LIBRARY_DEPENDENCY: ((cannon_default_data.o))
/* Model Include files */
#include "../include/cannon.h"
#include "../include/cannon_integ_proto.h"
#include "sim_services/include/Flag.h"
/* Entry Point */
@ -22,16 +23,16 @@ int cannon_default_data(CANNON* C)
/*
* Regula falsi dynamic event impact setup
*/
#define BIG_TGO 10000
#define MY_BIG_TGO 10000
C->rf.lower_set = No ;
C->rf.upper_set = No ;
C->rf.iterations = 0 ;
C->rf.fires = 0 ;
C->rf.x_lower = BIG_TGO ;
C->rf.t_lower = BIG_TGO ;
C->rf.x_upper = BIG_TGO ;
C->rf.t_upper = BIG_TGO ;
C->rf.delta_time = BIG_TGO ;
C->rf.x_lower = MY_BIG_TGO ;
C->rf.t_lower = MY_BIG_TGO ;
C->rf.x_upper = MY_BIG_TGO ;
C->rf.t_upper = MY_BIG_TGO ;
C->rf.delta_time = MY_BIG_TGO ;
C->rf.error_tol = 1.0e-9 ;
C->rf.mode = Decreasing ;

View File

@ -2,6 +2,7 @@
PURPOSE: ( Try Trick integration )
*****************************************************************************/
#include "../include/cannon.h"
#include "../include/cannon_integ_proto.h"
int cannon_deriv(
CANNON* C )

View File

@ -2,6 +2,7 @@
PURPOSE: ( Adding contact)
*****************************************************************************/
#include "../include/cannon.h"
#include "../include/cannon_contact_proto.h"
int cannon_deriv_impact( CANNON* C )
{

View File

@ -2,6 +2,7 @@
PURPOSE: ( Try dt )
*****************************************************************************/
#include "../include/cannon.h"
#include "../include/cannon_dt_proto.h"
int cannon_dt(
CANNON* C )

View File

@ -5,6 +5,7 @@ PURPOSE: ( Try Trick integration )
#include <stdio.h>
#include "sim_services/Integrator/include/integrator_c_intf.h"
#include "../include/cannon.h"
#include "../include/cannon_eulercromer_proto.h"
int cannon_ec_integ(
CANNON* C )

View File

@ -3,6 +3,7 @@ PURPOSE: ( Contact )
*****************************************************************************/
#include <stdio.h>
#include "../include/cannon.h"
#include "../include/cannon_contact_proto.h"
#include "sim_services/Integrator/include/integrator_c_intf.h"
double cannon_impact( CANNON* C )

View File

@ -4,6 +4,7 @@ PURPOSE: (Initialize the cannonball)
#include <stdio.h>
#include <math.h>
#include "../include/cannon.h"
#include "../include/cannon_integ_proto.h"
int cannon_init(
CANNON* C )

View File

@ -5,6 +5,7 @@ PURPOSE: ( Try Trick integration )
#include <stdio.h>
#include "sim_services/Integrator/include/integrator_c_intf.h"
#include "../include/cannon.h"
#include "../include/cannon_integ_proto.h"
int cannon_integ(
CANNON* C )

View File

@ -12,8 +12,8 @@
extern "C" {
#endif
int cannon_master_shutdown();
int cannon_master_shutdown(void);
#ifdef __cplusplus
}
#endif

View File

@ -1,6 +1,6 @@
/*********************************** TRICK HEADER **************************
PURPOSE: ( Amoeba )
/***************************************************************************/
***************************************************************************/
#include <stdio.h>
#include <stdlib.h>
@ -56,10 +56,8 @@ void amoeba_shrink( AMOEBA* A ) {
double* x ;
double* x_0 ;
double* x_n ;
x_0 = A->vertices[0] ;
x_n = A->vertices[A->num_dims] ;
if ( A->debug ) {
fprintf(stderr,"Shrinking simplex...\n");
@ -110,7 +108,6 @@ int amoeba_contract( AMOEBA* A ) {
double* x_n_1 ;
double* x_c ;
double* x_cont ;
double* x_e ;
/* Short hand */
x_c = A->x_cent ;
@ -118,7 +115,6 @@ int amoeba_contract( AMOEBA* A ) {
x_n = A->vertices[A->num_vertices-1] ;
x_n_1 = A->vertices[A->num_vertices-2] ;
x_cont = A->x_cont ;
x_e = A->x_expa ;
if ( A->debug ) {
fprintf(stderr,">> Try contraction.\n");
@ -196,14 +192,12 @@ int amoeba_expand( AMOEBA* A ) {
double* x_0 ;
double* x_r ;
double* x_n ;
double* x_c ;
double* x_e ;
/* Short hand */
x_0 = A->vertices[0] ;
x_r = A->x_refl ;
x_n = A->vertices[A->num_vertices-1] ;
x_c = A->x_cent ;
x_e = A->x_expa ;
if ( A->debug ) {
@ -321,17 +315,17 @@ int amoeba_satisfied( AMOEBA* A ) {
}
void amoeba_calc_reflection_point( AMOEBA* A ) {
int ii ;
double* x_r ;
double* x_n ;
double* x_c ;
/* Short hand */
x_r = A->x_refl ;
x_n = A->vertices[A->num_vertices-1] ;
x_c = A->x_cent ;
/* Calculate reflection point
* x_refl = x_cent + alpha*(x_cent - x_worst)
*/
@ -347,7 +341,6 @@ int amoeba_reflect( AMOEBA* A ) {
double* x_0 ;
double* x_r ;
double* x_n ;
double* x_c ;
if ( A->debug ) {
fprintf(stderr,">> Try reflection.\n");
@ -357,7 +350,6 @@ int amoeba_reflect( AMOEBA* A ) {
x_0 = A->vertices[0] ;
x_r = A->x_refl ;
x_n = A->vertices[A->num_vertices-1] ;
x_c = A->x_cent ;
if ( my_func(x_0) >= my_func(x_r) && my_func(x_r) > my_func(x_n) ) {
/* Accept reflection point --- replace worst point with x_r */

View File

@ -6,6 +6,7 @@ PROGRAMMERS: (Keith)
#include <stdio.h>
#include "cannon/aero/include/cannon_aero.h"
#include "../include/amoeba.h"
#include "../include/amoeba_proto.h"
int cannon_init_amoeba(
AMOEBA* A )

View File

@ -6,6 +6,7 @@ PROGRAMMER: ((keith))
#include <stdio.h>
#include "cannon/aero/include/cannon_aero.h"
#include "../include/amoeba.h"
#include "../include/amoeba_proto.h"
#include "sim_services/MonteCarlo/include/montecarlo_c_intf.h"
#include "trick_utils/comm/include/tc_proto.h"
@ -15,6 +16,9 @@ int cannon_post_master(
{
CANNON_AERO C_curr ;
// remove warning about unused parameter C
(void)C ;
/* Read slave's results */
tc_read( mc_get_connection_device(),(char*) &C_curr, sizeof(CANNON_AERO) );

View File

@ -1,6 +1,7 @@
/*********************************** TRICK HEADER **************************
PURPOSE: (Get slave sim's evaluation of x)
***************************************************************************/
#include "../include/amoeba_proto.h"
#include "cannon/aero/include/cannon_aero.h"
#include "sim_services/MonteCarlo/include/montecarlo_c_intf.h"
#include "trick_utils/comm/include/tc_proto.h"

View File

@ -6,6 +6,7 @@ PROGRAMMER: (keith)
#include <stdio.h>
#include "cannon/aero/include/cannon_aero.h"
#include "../include/amoeba.h"
#include "../include/amoeba_proto.h"
#include "sim_services/UnitTest/include/trick_tests.h"
#include "sim_services/Executive/include/exec_proto.h"
#include "sim_services/MonteCarlo/include/montecarlo_c_intf.h"

View File

@ -3,9 +3,8 @@ PURPOSE: (Slave optimization)
LIBRARY_DEPENDENCY: (amoeba.o)
PROGRAMMER: (keith)
***************************************************************************/
#include "../include/amoeba_proto.h"
#include "cannon/aero/include/cannon_aero.h"
//#include "sim_services/include/executive.h"
#include "sim_services/Executive/include/exec_proto.h"
#include <stdio.h>
int cannon_pre_slave(

View File

@ -1,24 +1,25 @@
/*********************************** TRICK HEADER **************************
PURPOSE: ( Monte Master Shutdown Job )
***************************************************************************/
#include "sim_services/UnitTest/include/trick_tests.h"
#include "sim_services/MonteCarlo/include/montecarlo_c_intf.h"
int cannon_master_shutdown()
{
int answer;
answer = mc_get_num_results();
printf("answer is %d\n", answer);
if (answer == 8) {
add_test_result("Sim_Monte Simulation", "MonteCarlo Analysis", "");
} else {
const char str[20];
sprintf(str, "Actual runs is %d should be 8\n", answer);
add_test_result("Sim_Monte Simulation", "MonteCarlo Analysis", str);
}
trick_test_add_parent("Sim_Monte Simulation", "MonteCarlo Analysis", "1452306647");
call_write_output();
return ( 0 );
}
/*********************************** TRICK HEADER **************************
PURPOSE: ( Monte Master Shutdown Job )
***************************************************************************/
#include "sim_services/UnitTest/include/trick_tests.h"
#include "sim_services/MonteCarlo/include/montecarlo_c_intf.h"
#include "../include/optim_proto.h"
int cannon_master_shutdown()
{
int answer;
answer = mc_get_num_results();
printf("answer is %d\n", answer);
if (answer == 8) {
add_test_result("Sim_Monte Simulation", "MonteCarlo Analysis", "");
} else {
char str[20];
sprintf(str, "Actual runs is %d should be 8\n", answer);
add_test_result("Sim_Monte Simulation", "MonteCarlo Analysis", str);
}
trick_test_add_parent("Sim_Monte Simulation", "MonteCarlo Analysis", "1452306647");
call_write_output();
return ( 0 );
}