66 lines
3.3 KiB
C++
Executable File
66 lines
3.3 KiB
C++
Executable File
#ifndef VECTOR_FIELD_GENERATOR_H
|
|
#define VECTOR_FIELD_GENERATOR_H
|
|
|
|
#include <memory>
|
|
|
|
#include "jansson.h"
|
|
#include "simulation/parameter.h"
|
|
#include "simulation/vector_field.h"
|
|
|
|
namespace generator {
|
|
// create an VectorField object from a json_t pointer to an json object
|
|
// defining the vector field:
|
|
// has to contain a json-object with key either: "VectorFieldConstant", "VectorFieldFunctionInZ" or "VectorFieldFromArray"
|
|
// if neither of those is specified an error is thrown
|
|
// if "VectorFieldConstant" is specified:
|
|
// - has to contain a json-object called "constant" containing a json-array of size 3 (r,phi and z component in this ordering)
|
|
// with an arbitrary key
|
|
// if "VectorFieldFunctionInZ" is specifid:
|
|
// - has to contain a json-object with key "zFunction", that defines a function3D (see "generators/function_generator.h")
|
|
// if "VectorFieldFromArray" is specified:
|
|
// - has to contain a json-object called "ReadArrayFromFile" (see readComponentFromFile)
|
|
// - a json-double "Radius" specifying the radial extent for which the read in vector field is defined
|
|
// - a json-double "Length" specifying the longitudinal extent for which the read in vector field is defined
|
|
// examples for the look in a json file can be found in "simulation_config/vector_field_examples.json"
|
|
std::shared_ptr<VectorField> buildVectorField(json_t* object);
|
|
|
|
// read a path to a file from a json-object consisting of three json-string objects:
|
|
// - "Type": acceptable value either "AbsolutePath" or "RelativeToHomebase", if neither is specified throw an error
|
|
// - if "Type" is "AbsolutePath", the json-string with key "AbsoluteFolderPath" has to be defined, containing
|
|
// the absolute path to the directory the file that should be read is located in
|
|
// - if "Type" is "RelativeToHomebase", the json-string with key "RelativePath" has to be defined, containing
|
|
// the path relative (wrt the shell variable "HOMEBASE") to the directory the file that should be read is located in
|
|
// - the json-string with key "Filename", containing the name of the file to be read
|
|
//
|
|
// "key_of_object": {
|
|
// "Type": "RelativeToHomebase" or "AbsolutePath",
|
|
// "RelativePath" or "AbsoluteFolderPath": path to directory
|
|
// "Filename": name of file in the path to the directory
|
|
// }
|
|
std::string readAbsoluteFilename(json_t* object);
|
|
|
|
// read a single component (radial, azimuthal or longitudinal) into a blitz::Array
|
|
// has to consist of:
|
|
// - a json_object called "PathToH5" in the format described for the function "readAbsoluteFilename"
|
|
// - a json_array "Keys" consisting of the keys of the absolute path to groups that should be read from the given hdf5 file
|
|
//
|
|
// "key_to_object": {
|
|
// "PathToH5" : { ... },
|
|
// "Keys": [path to component of vector field in r-dir, path to component of vector field in phi-dir, path to component of vector field in z-dir]
|
|
// }
|
|
blitz::Array<double, 3> readComponentFromFile(json_t* object, int component);
|
|
|
|
// read a single 3d array into a blitz::Array
|
|
// has to consist of:
|
|
// - a json_object called "PathToH5" in the format described for the function "readAbsoluteFilename"
|
|
// - a json_string "Key" specifying the path to the array within the hdf5 file
|
|
//
|
|
// "key_to_object": {
|
|
// "PathToH5" : { ... },
|
|
// "Key": path within hdf5 file
|
|
// }
|
|
blitz::Array<double, 3> readFromFile(json_t* object);
|
|
} // namespace generator
|
|
|
|
#endif /* VECTOR_FIELD_GENERATOR_H */
|