The BioCro C++ Library
parameter_calculator.h
Go to the documentation of this file.
1#ifndef PARAMETER_CALCULATOR_H
2#define PARAMETER_CALCULATOR_H
3
4#include "../framework/module.h"
5#include "../framework/state_map.h"
6
7namespace standardBML
8{
9class parameter_calculator : public direct_module
10{
11 public:
12 parameter_calculator(state_map const& input_quantities, state_map* output_quantities)
13 : direct_module{},
14
15 // Get pointers to input quantities
16 Sp{get_input(input_quantities, "Sp")},
17 Leaf{get_input(input_quantities, "Leaf")},
18 LeafN_0{get_input(input_quantities, "LeafN_0")},
19 LeafN{get_input(input_quantities, "LeafN")},
20 alphab1{get_input(input_quantities, "alphab1")},
21 alpha1{get_input(input_quantities, "alpha1")},
22
23 // Get pointers to output quantities
24 lai_op{get_op(output_quantities, "lai")},
25 alpha_op{get_op(output_quantities, "alpha")}
26 {
27 }
28 static string_vector get_inputs();
29 static string_vector get_outputs();
30 static std::string get_name() { return "parameter_calculator"; }
31
32 private:
33 // References to input quantities
34 double const& Sp;
35 double const& Leaf;
36 double const& LeafN_0;
37 double const& LeafN;
38 double const& alphab1;
39 double const& alpha1;
40
41 // Pointers to output quantities
42 double* lai_op;
43 double* alpha_op;
44
45 // Main operation
46 void do_operation() const;
47};
48
50{
51 return {
52 "Sp", // Ha / Mg
53 "Leaf", // Mg / Ha
54 "LeafN_0", //
55 "LeafN", //
56 "alphab1", //
57 "alpha1" //
58 };
59}
60
62{
63 return {
64 "lai", // dimensionless
65 "alpha" //
66 };
67}
68
69void parameter_calculator::do_operation() const
70{
71 update(lai_op, Leaf * Sp);
72 update(alpha_op, (LeafN_0 - LeafN) * alphab1 + alpha1);
73}
74
75} // namespace standardBML
76#endif
parameter_calculator(state_map const &input_quantities, state_map *output_quantities)
This is the standard BioCro module library; it includes the essential modules used in typical BioCro ...
Definition: aba_decay.h:8