Commit 895a4446 authored by George Zagaris's avatar George Zagaris
Browse files

Merge remote-tracking branch 'origin/master' into AMR-Refactoring

parents 3c0fa84a 309bc281
......@@ -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;
......@@ -266,7 +268,7 @@ void RandomContingencyStatistics( vtkMultiProcessController* controller, void* a
{
cout << "\n## Verifying that local and global CDFs sum to 1 (within "
<< args->absTol
<< " relative tolerance).\n";
<< " absolute tolerance).\n";
}
vtkIdTypeArray* keys = vtkIdTypeArray::SafeDownCast( outputContingency->GetColumnByName( "Key" ) );
......@@ -419,6 +421,39 @@ int main( int argc, char** argv )
}
}
// **************************** Parse command line ***************************
// Set default argument values
int nVals = 100000;
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,
&absTol, "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,12 +466,11 @@ 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.retVal = &testValue;
args.ioRank = ioRank;
args.absTol = absTol;
// Check how many processes have been made available
int numProcs = controller->GetNumberOfProcesses();
......
......@@ -46,6 +46,7 @@ struct RandomOrderStatisticsArgs
double stdev;
bool quantize;
int maxHistoSize;
double absTol;
int* retVal;
int ioRank;
};
......@@ -223,7 +224,10 @@ void RandomOrderStatistics( vtkMultiProcessController* controller, void* arg )
// Print out and verify global extrema
if ( com->GetLocalProcessId() == args->ioRank )
{
cout << "\n## Verifying that calculated global extrema are correct.\n";
cout << "\n## Verifying that calculated global extrema are correct (within "
<< args->absTol
<< " absolute tolerance).\n";
double min_c = outputQuantiles->GetValueByName( 0,
columnNames[0] ).ToDouble();
......@@ -236,13 +240,13 @@ void RandomOrderStatistics( vtkMultiProcessController* controller, void* arg )
<< max_c
<< "\n";
if ( fabs( min_c - min_g ) > 1.e-6 )
if ( fabs( min_c - min_g ) > args->absTol )
{
vtkGenericWarningMacro("Incorrect minimum.");
*(args->retVal) = 1;
}
if ( fabs( max_c - max_g ) > 1.e-6 )
if ( fabs( max_c - max_g ) > args->absTol )
{
vtkGenericWarningMacro("Incorrect maximum.");
*(args->retVal) = 1;
......@@ -321,6 +325,7 @@ int main( int argc, char** argv )
double stdev = 50.;
bool quantize = false;
int maxHistoSize = 500;
double absTol = 1.e-6;
// Initialize command line argument parser
vtksys::CommandLineArguments clArgs;
......@@ -347,6 +352,11 @@ int main( int argc, char** argv )
vtksys::CommandLineArguments::NO_ARGUMENT,
&quantize, "Allow re-quantizing");
// Parse absolute tolerance to verify extrema
clArgs.AddArgument("--abs-tol",
vtksys::CommandLineArguments::SPACE_ARGUMENT,
&absTol, "Absolute tolerance to verify extrema");
// If incorrect arguments were provided, terminate in error.
if ( ! clArgs.Parse() )
{
......@@ -372,6 +382,7 @@ int main( int argc, char** argv )
args.maxHistoSize = maxHistoSize;
args.retVal = &testValue;
args.ioRank = ioRank;
args.absTol = absTol;
// Check how many processes have been made available
int numProcs = controller->GetNumberOfProcesses();
......
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