27 directory = PM->get_string(
"directory",
LOC(),
"default");
39 std::string rule, mode, save;
41 rule = j.get<std::string>();
46 }
else if (j.is_object()) {
47 if (j.count(
"rule") == 1) {
48 rule = j[
"rule"].get<std::string>();
52 if (j.count(
"mode") == 1) mode = j[
"mode"].get<std::string>();
53 if (j.count(
"save") == 1) save = j[
"save"].get<std::string>();
54 }
else if (j.is_array()) {
55 std::string v0 = j[0].get<std::string>();
56 auto ipos = v0.find_first_of(
"#");
57 if (ipos != std::string::npos) rule = v0.substr(ipos + 1, v0.size());
58 if (ipos != std::string::npos) v0 = v0.substr(0, ipos);
59 std::string v1 = j[1].get<std::string>();
60 ipos = v1.find_first_of(
"#");
61 if (ipos != std::string::npos) rule += v1.substr(ipos + 1, v1.size());
62 if (ipos != std::string::npos) v1 = v1.substr(0, ipos);
67 throw std::runtime_error(
"recorder parse error");
71 std::shared_ptr<RuleEvaluator> record_time_rule(
73 _ruleset->registerRules(record_time_rule);
77 std::shared_ptr<RuleEvaluator> record_rule(
79 _ruleset->registerRules(record_rule);
83 bool not_parsed =
_ruleset->getRules().size() == 0;
84 auto& json = *(
_param->pjson());
85 if (not_parsed && json.count(
"result") == 1 && json[
"result"].is_array()) {
86 for (
auto& j : (json[
"result"]))
token(j);
93 for (
auto& irule :
_ruleset->getRules()) { irule->calculateResult(
isamp_ptr[0]); }
99 for (
auto& irule :
_ruleset->getRules()) irule->collectResult();
this file provides einsum operation
this file provides Kernel_Recorder class for trace data in dataset during the dynamics.
provide RuleEvaluator class
virtual void token(Param::JSON &j)
virtual const std::string getName()
Get the name of the kernel.
virtual ~Kernel_Recorder()
virtual Status & finalizeKernel_impl(Status &stat)
Virtual function to finalize the kernel implementation.
virtual Status & initializeKernel_impl(Status &stat)
Virtual function to initialize the kernel implementation.
std::vector< std::string > opened_files
virtual void setInputParam_impl(std::shared_ptr< Param > &PM)
Virtual function to set input parameters for the kernel implementation.
virtual void setInputDataSet_impl(std::shared_ptr< DataSet > &DS)
Virtual function to set input data set for the kernel implementation.
virtual Status & executeKernel_impl(Status &stat)
Virtual function to execute the kernel implementation.
kids_bint * at_samplingstep_initially_ptr
virtual int getType() const
Get the type of the kernel.
std::shared_ptr< Param > _param
Shared pointer to the Param object associated with this kernel.
std::shared_ptr< DataSet > _dataset
Shared pointer to the DataSet object associated with this kernel.
std::shared_ptr< RuleSet > _ruleset
Recorded Rules associated with the Kernel.
Represents a handler for input/output operations related to expressions.
#define LOC()
show the location information for debug
VARIABLE< kids_int > sstep
VARIABLE< kids_bint > at_samplingstep_initially
VARIABLE< kids_int > istep
VARIABLE< kids_int > isamp
VARIABLE< kids_int > nsamp
< http://warp.povusers.org/FunctionParser/fparser.html
constexpr dimension7 time_d
[T]
std::basic_string< CharT > concat(const separator_t< CharT > &sep, Args &&... seq)
constexpr uint32_t hash(const char *str)
Represents a rule for evaluating an expression.
declaration of variables used in the program.