48 #define M_PI 3.14159265358979323846
62 int main(
int argc,
char **argv)
67 std::cerr <<
" ******************************************* " << std::endl
68 <<
" ********** Flutter shutter density estimator ****** " << std::endl
69 <<
" EX: ./flutter_estimator snapshot.txt output_rho.txt 0 " << std::endl
70 <<
" ***************************************************** " << std::endl
71 <<
" ************* Yohann Tendero, 2014 **************** " << std::endl
72 <<
" ***************************************************** " << std::endl;
91 char* flutter_code_file=argv[1];
92 char* output_rho_file=argv[2];
94 double num_plot_points=1001;
95 vector<double> output_rho;
96 vector<double> output_wprime;
97 double epsilon=2/num_plot_points;
111 double probability_of_velocity;
114 for(
double velocity=-1; velocity<=1;
115 velocity=velocity+2/num_plot_points)
119 if(probability_of_velocity>=0)
120 output_rho.push_back(probability_of_velocity);
121 else output_rho.push_back(0);
126 for(
unsigned k=0; k<output_rho.size(); k++)
127 sum=sum+output_rho[k];
128 sum=sum*2/num_plot_points;
130 for(
unsigned k=0; k<output_rho.size(); k++)
131 output_rho[k]=output_rho[k]/sum;
134 for(
unsigned k=0; k<output_rho.size(); k++)
135 output_rho[k]=log(output_rho[k]+1);
142 double w_prime_velocity;
144 for(
double velocity=0; velocity<=1; velocity=velocity+2/num_plot_points)
147 output_wprime.push_back(w_prime_velocity);
152 ofstream file_output_rho(output_rho_file, ios::out | ios::trunc);
157 for(
double velocity=-1; velocity<=1;
158 velocity=velocity+2/num_plot_points)
160 file_output_rho << velocity <<
" " << output_rho[k] << endl;
164 file_output_rho.close();
167 cerr <<
"Unable to open file !" << endl;
171 ofstream file_output_wprime(
"wprime.txt", ios::out | ios::trunc);
176 for(
double velocity=0; velocity<=1; velocity=velocity+2/num_plot_points)
178 file_output_wprime << velocity <<
" " << output_wprime[k] << endl;
182 file_output_wprime.close();
185 cerr <<
"Unable to open file !" << endl;
int main(int argc, char **argv)
main function call
std::vector< double > fileToVector(const char *name)
Given the file name oof a text file containing a flutter code store the values in a vector of doubles...
double w_prime_estimator(double xi, std::vector< double > code, double epsilon)