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 ./Design_Fire 1 3 Design_Fire.input fmkl for FMKL parameterization of the GLD. Run as ./Design_Fire 1 3 Design_Fire.input rs for the RS parametrization. This sets dimension = 1 number of quadrature points = 3, Design_Fire.input as the input file to be read and fmkl or rs as the parameterization of the GLD.

 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. Only five moments are needed for the GLD. Whereas the number of quadrature points is chosen by the user. Moms are the moments of the input variable (heat release rate) modelled as GBD. gld_moms are the moments of the output (smoke height) for which the CDF is to be estimated.

 moments moms(itot), gld_moms(5);
    quadpts quadwts(itot); 

Compute the moments of the generalized beta distribution

 moms = moms.generalized_beta( dimension, num_points, b1, b2, b3 ); 

Compute quadrature points from the moments product difference algorithm.

 quadwts = moms.product_difference( 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_GLD_1D ( dimension, num_points ); 

Call the GLD reconstruction routine that takes the moments and returns the CDF. The argv[4] argument is either fmkl or rs as specified during run time. The num_intervals is the number of points in the CDF reconstruction.

 matrix cdf_gld;
 cdf_gld = gld_moms.get_cdf_gld(100, argv[4]); 

Print the CDF to file. Open a file called output.txt

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

cdf_gld.fprintf(fp,"%.5e");

Exit the program

 return 0; 
  } 

 All Classes Files Functions Variables Typedefs Friends Defines