FlightGear next
FGExternalForce.h
Go to the documentation of this file.
1/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3 Header: FGExternalForce.h
4 Author: Jon Berndt, Dave Culp
5 Date started: 9/21/07
6
7 ------------- Copyright (C) 2007 Jon S. Berndt (jon@jsbsim.org) -------------
8
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser General Public License as published by the Free
11 Software Foundation; either version 2 of the License, or (at your option) any
12 later version.
13
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
17 details.
18
19 You should have received a copy of the GNU Lesser General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc., 59
21 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23 Further information about the GNU Lesser General Public License can also be
24 found on the world wide web at http://www.gnu.org.
25
26
27 HISTORY
28--------------------------------------------------------------------------------
299/21/07 JB Created
30
31%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32SENTRY
33%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
34
35#ifndef FGEXTERNALFORCE_H
36#define FGEXTERNALFORCE_H
37
38/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39INCLUDES
40%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
41
43#include "simgear/props/propertyObject.hxx"
44
45/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46FORWARD DECLARATIONS
47%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
48
49namespace JSBSim {
50
51class FGParameter;
52class Element;
54
55/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56CLASS DECLARATION
57%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
58
60{
61public:
63 FGPropertyVector3(FGPropertyManager* pm, const std::string& baseName,
64 const std::string& xcmp, const std::string& ycmp,
65 const std::string& zcmp);
66
68 data[0] = v(1);
69 data[1] = v(2);
70 data[2] = v(3);
71
72 return *this;
73 }
74
75 operator FGColumnVector3() const {
76 return FGColumnVector3(data[0], data[1], data[2]);
77 }
78
79 FGColumnVector3 operator*(double a) const {
80 return FGColumnVector3(a * data[0], a * data[1], a * data[2]);
81 }
82
83private:
84 SGPropObjDouble data[3];
85};
86
87inline FGColumnVector3 operator*(double a, const FGPropertyVector3& v) {
88 return v*a;
89}
90
91/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92CLASS DOCUMENTATION
93%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
94
207
209{
210public:
216 : FGForce(FDMExec), forceMagnitude(NULL), momentMagnitude(NULL)
217 { Debug(0); }
218
223
225 ~FGExternalForce() override;
226
227 void setForce(Element* el);
228 void setMoment(Element* el);
229 const FGColumnVector3& GetBodyForces(void) override;
230
231private:
232 FGParameter* bind(Element* el, const std::string& baseName,
234
235 std::string Name;
236 FGParameter *forceMagnitude, *momentMagnitude;
237 FGPropertyVector3 forceDirection, momentDirection;
238 void Debug(int from);
239};
240}
241#endif
JSBSim::FGFDMExec * FDMExec
Definition JSBSim.cpp:88
This class implements a 3 element column vector.
const FGColumnVector3 & GetBodyForces(void) override
void setMoment(Element *el)
FGExternalForce(const FGExternalForce &extForce)
Copy Constructor.
~FGExternalForce() override
Destructor.
FGExternalForce(FGFDMExec *FDMExec)
Constructor.
FGForce(FGFDMExec *FDMExec)
Constructor.
Definition FGForce.cpp:53
Represents various types of parameters.
Definition FGParameter.h:59
FGColumnVector3 operator*(double a) const
FGPropertyVector3 & operator=(const FGColumnVector3 &v)
FGColumnVector3 operator*(double scalar, const FGColumnVector3 &A)
Scalar multiplication.