Description

This class provides functionality for validation of simulation results.

It provides functions for processing either two data files (simulation and reference) and calculating the norms of the column differences, or for processing a single simulation data file and calculating the norms of its columns. In either case, it is assumed that the first column in a data file contains time values; this column is never processed.

#include <ChValidation.h>

Public Types

enum  NormType { L2, RMS, INF }
 Norm types for validation.
 
typedef std::vector< std::string > Headers
 Vector of data file headers.
 
typedef ChVectorDynamic DataVector
 Vector of data points.
 
typedef std::vector< DataVectorData
 Data table.
 

Public Member Functions

bool Process (const std::string &sim_filename, const std::string &ref_filename)
 Read the data from the specified files and process it. More...
 
bool Process (const Data &sim_data, const Data &ref_data)
 Process the data in the two specified structures. More...
 
bool Process (const std::string &sim_filename)
 Read the data in the specified file and process it. More...
 
bool Process (const Data &sim_data)
 Process the data in the specified structure. More...
 
size_t GetNumColumns () const
 Return the number of data columns.
 
size_t GetNumRows () const
 Return the number of rows.
 
const HeadersGetHeadersSimData () const
 Return the headers in the simulation data file.
 
const DataGetSimData () const
 Return the simulation data.
 
const HeadersGetHeadersRefData () const
 Return the headers in the reference data file.
 
const DataGetRefData () const
 Return the reference data.
 
double GetL2norm (size_t col) const
 Return the L2 norm for the specified column.
 
double GetRMSnorm (size_t col) const
 Return the RMS norm for the specified column.
 
double GetINFnorm (size_t col) const
 Return the infinity norm for the specified column.
 
const DataVectorGetL2norms () const
 Return the L2 norms for all columns.
 
const DataVectorGetRMSnorms () const
 Return the RMS norm for all columns.
 
const DataVectorGetINFnorms () const
 Return the infinity norms for all columns.
 

Static Public Member Functions

static Data CreateData (const std::vector< std::vector< double >> &columns)
 Create and return a validation Data object from the specified vector of data series.
 
static Data ReadDataFile (const std::string &filename, Headers &headers)
 Read the specified data file and return a validation Data object. More...
 
static bool Test (const std::string &sim_filename, const std::string &ref_filename, NormType norm_type, double tolerance, DataVector &norms)
 Compare the data in the two specified files. More...
 
static bool Test (const Data &sim_data, const Data &ref_data, NormType norm_type, double tolerance, DataVector &norms)
 Compare the data in the two specified structures. More...
 
static bool Test (const std::string &sim_filename, NormType norm_type, double tolerance, DataVector &norms)
 Validation of a constraint violation data file. More...
 
static bool Test (const Data &sim_data, NormType norm_type, double tolerance, DataVector &norms)
 Validation of a constraint violation data structure. More...
 
static std::string GetNormTypeAsString (NormType type)
 Return the norm type as a string.
 

Member Function Documentation

◆ Process() [1/4]

bool chrono::utils::ChValidation::Process ( const Data sim_data)

Process the data in the specified structure.

Calculate the vector norms of all columns except the first one.

Parameters
sim_datasimulation data structure

◆ Process() [2/4]

bool chrono::utils::ChValidation::Process ( const Data sim_data,
const Data ref_data 
)

Process the data in the two specified structures.

Ignoring the first column (which must contain identical values in the two input structures), subtract the data in corresponding columns in the two structures are and calculate the norms of the difference vectors.

Parameters
sim_datasimulation data strcture
ref_datareference data structure

◆ Process() [3/4]

bool chrono::utils::ChValidation::Process ( const std::string &  sim_filename)

Read the data in the specified file and process it.

Calculate the vector norms of all columns except the first one.

◆ Process() [4/4]

bool chrono::utils::ChValidation::Process ( const std::string &  sim_filename,
const std::string &  ref_filename 
)

Read the data from the specified files and process it.

Ignoring the first column (which must contain identical values in the two input files), subtract the data in corresponding columns in the two files are and calculate the norms of the difference vectors.

Parameters
sim_filenamename of the file with simulation results
ref_filenamename of the file with reference data

◆ ReadDataFile()

ChValidation::Data chrono::utils::ChValidation::ReadDataFile ( const std::string &  filename,
Headers headers 
)
static

Read the specified data file and return a validation Data object.

The file is assumed to be space-delimited.

Parameters
[in]filenamename of the data file
[out]headersvector of column header strings

◆ Test() [1/4]

bool chrono::utils::ChValidation::Test ( const Data sim_data,
const Data ref_data,
NormType  norm_type,
double  tolerance,
DataVector norms 
)
static

Compare the data in the two specified structures.

The comparison is done using the specified norm type and tolerance. The function returns true if the norms of all column differences are below the given tolerance and false otherwise.

◆ Test() [2/4]

bool chrono::utils::ChValidation::Test ( const Data sim_data,
NormType  norm_type,
double  tolerance,
DataVector norms 
)
static

Validation of a constraint violation data structure.

The validation is done using the specified norm type and tolerance. The function returns true if the norms of all columns, excluding the first one, are below the given tolerance and false otherwise.

◆ Test() [3/4]

bool chrono::utils::ChValidation::Test ( const std::string &  sim_filename,
const std::string &  ref_filename,
NormType  norm_type,
double  tolerance,
DataVector norms 
)
static

Compare the data in the two specified files.

The comparison is done using the specified norm type and tolerance. The function returns true if the norms of all column differences are below the given tolerance and false otherwise. It is assumed that the input files are space-delimited.

◆ Test() [4/4]

bool chrono::utils::ChValidation::Test ( const std::string &  sim_filename,
NormType  norm_type,
double  tolerance,
DataVector norms 
)
static

Validation of a constraint violation data file.

The validation is done using the specified norm type and tolerance. The function returns true if the norms of all columns, excluding the first one, are below the given tolerance and false otherwise. It is assumed that the input file is space-delimited.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono/utils/ChValidation.h
  • /builds/uwsbel/chrono/src/chrono/utils/ChValidation.cpp