Free Electron
Forest.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __vegetation_Forest_h__
8 #define __vegetation_Forest_h__
9 
10 FE_ATTRIBUTE("sim:collider", "Spherical obstacle (x,y,z,r)");
11 FE_ATTRIBUTE("sim:effectForce", "Force on effector");
12 
13 namespace fe
14 {
15 namespace ext
16 {
17 
18 /**************************************************************************//**
19  @brief Forest RecordView
20 
21  @ingroup vegetation
22 *//***************************************************************************/
23 class FE_DL_EXPORT Forest: public RecordView
24 {
25  public:
26  Functor< sp<Component> > collider;
27  Functor<SpatialTransform> colliderTransform;
28  Functor<SpatialVector> effectorVelocity;
29  Functor<SpatialVector> effectForce;
30  Functor<SpatialVector> gravity;
31  Functor<SpatialVector> uniformVelocity;
32  Functor< sp<RecordGroup> > plants;
33  Functor< sp<Component> > pointI;
34  Functor< sp<Component> > drawI;
35  Functor< sp<Component> > cameraControllerI;
36  Functor<String> stickForm;
37  Functor<String> leafForm;
38  Functor<I32> serial;
39  Functor<I32> upAxis;
40  Functor<Real> time;
41  Functor<Real> deltaT;
42 
43  Forest(void) { setName("Forest"); }
44 virtual void addFunctors(void)
45  {
46  add(collider, FE_USE("sim:collider"));
47  add(colliderTransform, FE_USE("sim:colliderTransform"));
48  add(effectorVelocity, FE_USE("sim:effectorVel"));
49  add(effectForce, FE_USE("sim:effectForce"));
50  add(gravity, FE_USE("sim:gravity"));
51  add(uniformVelocity, FE_USE("sim:uniformVel"));
52 
53  add(plants, FE_SPEC("veg:plants",
54  "RecordGroup of vegetation"));
55 
56  add(pointI, FE_USE("ren:PointI"));
57  add(drawI, FE_USE("ren:DrawI"));
58  add(cameraControllerI, FE_USE("ren:CameraControllerI"));
59  add(stickForm, FE_USE("ren:stickForm"));
60  add(leafForm, FE_USE("ren:leafForm"));
61 
62  add(serial, FE_USE(":SN"));
63  add(upAxis, FE_USE("sim:upAxis"));
64  add(time, FE_USE("sim:time"));
65  add(deltaT, FE_USE("sim:timestep"));
66  }
67 virtual void initializeRecord(void)
68  {
69  plants.createAndSetRecordGroup();
70 
71  setIdentity(colliderTransform());
72  set(effectorVelocity());
73  set(effectForce());
74  set(gravity());
75  set(uniformVelocity());
76 
77  stickForm()="line";
78  leafForm()="point";
79  upAxis()=2;
80  time()=0.0f;
81  deltaT()=(1.0f/60.0f);
82  }
83 };
84 
85 } /* namespace ext */
86 } /* namespace fe */
87 
88 #endif /* __vegetation_Forest_h__ */
virtual void initializeRecord(void)
Called at instantiation to initialize attributes.
Definition: Forest.h:67
kernel
Definition: namespace.dox:3
virtual void addFunctors(void)
Called at instantiation to add functors.
Definition: Forest.h:44
Bindable collection of accessor Functors.
Definition: RecordView.h:106
Forest RecordView.
Definition: Forest.h:23