OSFEG-C++  1.4.5
OpenSF Error Generation Library
OSFEG-C++ Documentation

Introduction

OSFEG is a library to create and exploit flexible definitions of perturbations and errors, that is, functions of up to one independent variable that may be either random or deterministic. Such definitions may be created on the fly, or be loaded from an XML file.

Usage

For a basic usage, considering a pre-existing XML file with some named perturbation/error sources, include OSFEG.h to access the ErrorSources class. To load the data in the file, simply create an instance of that class; any error will cause the call to throw. Once the data is loaded, values for each perturbation/error source can be generated by using the ErrorSources::getError method, as seen in the example below.

#include "OSFEG.h"
#include <stdexcept>
#include <iostream>
void print_nested_exc(const std::exception&);
int main()
try {
// Load data
ErrorSources infile{"perts.xml"};
// Evaluate some perturbation
const double t=0.25;
const std::string name="APE";
std::cout << "Value of perturbation " << name << " at t=" << t << ": "
<< infile.getError(name, t) << "\n";
return 0;
} catch (const std::exception& e) {
print_nested_exc(e);
return 1;
}
ErrorSources::getError
double getError(const std::string &paramName, const double time) override
ErrorSources
Definition: ErrorSources.h:35
OSFEG.h