Files
karl/include/generators/function_generator.h
2024-12-04 17:15:04 +01:00

45 lines
2.0 KiB
C++
Executable File

#ifndef FUNCTION_GENERATOR_H
#define FUNCTION_GENERATOR_H
#include <functional>
#include "functions/functions.h"
#include "jansson.h"
namespace generator {
// return a function1D specified by the json object "object"
// consists of a json-object called either "Constant", "PiecewiseLinear", "PiecewiseLinearFromFile" or an json-array called "Product"
// if "Constant" is specified:
// - has to contain a json-double called "constant" specifying the value of the constant the function should return
//
// if "PiecewiseLinear" is specified:
// - has to contain two json_arrays "xValues" and "yValues" specifying the point between which should be linearly interpolated
// - has to contain a json-double "prefactor", with which "yValues" will be scaled
//
// if "PiecewiseLinearFromFile" is specified:
// - has to contain a json-object "PathToH5" as described in "generators/vector_field_generator.h"
// - two json-strings "xValuesKey" and "yValuesKey" specifying the path of the x- and y-values in the hdf5 file
// - a json-double "prefactor" which scales the read y-values
//
// if "Product" is specified:
// - has to consist of an arbitrary number of json-objects following the format described for this function
//
// (examples can be found in "simulation_config/function_examples.json")
std::function<double(double)> function1D(json_t* object);
// return a function3D specified by the json object "object"
// has to consist of a json-object called either "Constant3D" or "Product"
//
// if "Constant3D" is specified:
// - has to contain a json-double "constant", defining the constant value that should be returned
//
// if "Product" is specified:
// - has to contain three json-objects called "fi", "fk" and "fj" defining the
// functional form in x,y and z direction; objects have to follow the description
// of "function1D"
//
// (examples can be found in "simulation_config/function_examples.json")
std::function<double(double, double, double)> function3D(json_t* object);
}; // namespace generator
#endif /* FUNCTION_GENERATOR_H */