Commit 8c465f69 authored by Philippe Pébay's avatar Philippe Pébay
Browse files

Added command line parser so parallel contingency can be tested parametrically

parent c6be0306
......@@ -39,6 +39,8 @@ PURPOSE. See the above copyright notice for more information.
#include "vtkTimerLog.h"
#include "vtkVariantArray.h"
#include "vtksys/CommandLineArguments.hxx"
struct RandomContingencyStatisticsArgs
{
int nVals;
......@@ -419,6 +421,39 @@ int main( int argc, char** argv )
}
}
// **************************** Parse command line ***************************
// Set default argument values
int nVals = 1000000;
double stdev = 5.;
double absTol = 1.e-6;
// Initialize command line argument parser
vtksys::CommandLineArguments clArgs;
clArgs.Initialize( argc, argv );
clArgs.StoreUnusedArguments( false );
// Parse per-process cardinality of each pseudo-random sample
clArgs.AddArgument("--n-per-proc",
vtksys::CommandLineArguments::SPACE_ARGUMENT,
&nVals, "Per-process cardinality of each pseudo-random sample");
// Parse standard deviation of each pseudo-random sample
clArgs.AddArgument("--std-dev",
vtksys::CommandLineArguments::SPACE_ARGUMENT,
&stdev, "Standard deviation of each pseudo-random sample");
// Parse absolute tolerance to verify that final CDF is 1
clArgs.AddArgument("--abs-tol",
vtksys::CommandLineArguments::SPACE_ARGUMENT,
&stdev, "Absolute tolerance to verify that final CDF is 1");
// If incorrect arguments were provided, terminate in error.
if ( ! clArgs.Parse() )
{
vtkGenericWarningMacro("Incorrect input data arguments were provided.");
return 1;
}
// ************************** Initialize test *********************************
if ( com->GetLocalProcessId() == ioRank )
{
......@@ -431,10 +466,9 @@ int main( int argc, char** argv )
// Parameters for regression test.
int testValue = 0;
RandomContingencyStatisticsArgs args;
args.nVals = 1000000;
args.stdev = 5.;
args.absTol = 1.e-6;
args.nVals = nVals;
args.stdev = stdev;
args.absTol = absTol;
args.retVal = &testValue;
args.ioRank = ioRank;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment