LandscapeDNDC 1.37.0
mbe_physiology.h
1
12#ifndef LDNDC_SUBSTATE_PHYSIOLOGY_H_
13#define LDNDC_SUBSTATE_PHYSIOLOGY_H_
14
15#include <constants/lconstants-plant.h>
16
17#include "state/mbe_substate.h"
18#include "substate/mbe_physiology.h.inc"
19#include "mbe_plant.h"
20
21namespace ldndc {
22
23class LDNDC_API substate_physiology_t : public MoBiLE_Substate
24{
25 MOBILE_SUBSTATE_OBJECT(physiology,LSUB_FLAG_NONE);
26 public:
27 /* holds physiology state items */
28 LDNDC_physiology_SUBSTATE_ITEMS
29
30 public:
31#ifdef _HAVE_SERIALIZE
32 /* interface declaration for dump/restore mechanism */
33 int create_checkpoint( substate_checkpoint_write_context_t *);
34 int restore_checkpoint( substate_checkpoint_read_context_t *);
35#endif /* _HAVE_SERIALIZE */
36#ifdef _LDNDC_HAVE_ONLINECONTROL
37 public:
38 int process_request(
39 lreply_t * /*reply*/,
40 lrequest_t const * /*request*/);
41#endif /* _LDNDC_HAVE_ONLINECONTROL */
42
43 public:
44
45 /* returns total vegetation root biomass per soil layer */
46 double mfrt_sl( MoBiLE_PlantVegetation * _veg, size_t _sl)
47 const
48 {
49 double mfrt( 0.0);
50 for ( PlantIterator vt = _veg->begin(); vt != _veg->end(); ++vt)
51 {
52 mfrt += (*vt)->mFrt * (*vt)->fFrt_sl[_sl];
53 }
54 return mfrt;
55 }
56
57 /* returns total vegetation root length per soil layer */
58 double rootlength_sl( MoBiLE_PlantVegetation * _veg, size_t _sl)
59 const
60 {
61 double rootlength( 0.0);
62 for ( PlantIterator vt = _veg->begin(); vt != _veg->end(); ++vt)
63 {
64 rootlength += (*vt)->rootlength_sl[_sl];
65 }
66 return rootlength;
67 }
68
69 /* vegetation carbon uptake */
70 double carbonuptake( MoBiLE_PlantVegetation * _veg, size_t _fl_cnt)
71 const
72 {
73 double carbonuptake_sum( 0.0);
74 for ( PlantIterator vt = _veg->begin(); vt != _veg->end(); ++vt)
75 {
76 carbonuptake_sum += cbm::sum( (*vt)->carbonuptake_fl, _fl_cnt);
77 }
78 return carbonuptake_sum;
79 }
80
81 lerr_t update_canopy_layers_height( MoBiLE_PlantVegetation *);
82};
83}
84
85
86#endif /* !LDNDC_SUBSTATE_PHYSIOLOGY_H_ */
87
Spatially explicit groundwater model.
Definition: airchemistryput.h:15
@ LSUB_FLAG_NONE
Definition: mbe_substate.h:77