int main ( int  argc,
char **  argv 
)

Main program for the Design Fire example problem.

Parameters:
argc: reads the different command line options
**argvreads the different options.

For example, the program is run as ./Lognormal_Integration 1 N lognormal_int.inp . This sets dimension = 1 number of quadrature points = N where N =1,2,3,... lognormal_int.inp is the input file to be read in.

 int main (int argc, char **argv)
    { 

Declare variable solver_params as an object of the inputs class. solver_params can then access the member function input_reader that reads the input file

 inputs solver_params 

Declare as extern variables defined elsewhere in Design_fire_inputs.c. These varibles are parameters of the generalized Beta distribution that models the fire heat release rate.

 extern double b1, b2, b3; 
 extern int verbose_mode; 

Invoke the the input_reader function which is a member of the inputs class of which solver_params is declared to be a member. The argv[3] is the third variable in the command line options when running the example.

 solver_params.input_reader(argv[3]); 

Declare the dimension of the problem. atoi(argv[1]) assigns the first variable in the command line options to dimension.

 size_t dimension = atoi(argv[1]); 

Declare the number of quadrature points to be used in the problem. atoi(argv[2]) assigns the second variable in the command line options to num_points.

 size_t num_points = atoi(argv[2]); 

The total number of moments required for the chosen dimension and num_points.

 size_t itot = num_points + dimension*num_points; 

Declare the moment vectors and the equivalent quadrature-weights+points vectors. moms is an object of the moments class and quadwts is an object of the quadrature-weights+points class. computed_moms contains the computed moments over the specified in the user-defined-functions.

 moments moms(itot), computed_moms(7);
    quadpts quadwts(itot); 

Compute the moments of the univariate lognormal distribution

 moms = moms = moms.univariate_lognormal(dimension, num_points, mu_g, std_g); 

Compute quadrature points from the moments using the Chebyshev algorithm.

 quadwts = moms.three_term_recurrence(dimension, num_points); 

Compute the moments of the output variable. The function below calls the user defined function that implements the input output map.

 gld_moms = quadwts.get_user_defined_moments_1D (dimension, num_points,7); 

Write results to file FILE *fp; fp = fopen("output.txt", "w"); if(fp == NULL) { perror("failed to open output.txt"); return 0;}

If verbose mode equals 1 print out computed moments. if (verbose_mode == 1){ computed_moms.fprintf(stdout,"%.15e"); }

Exit the program

 return 0; 
  } 

 All Classes Files Functions Variables Typedefs Friends Defines