libsurf
Programmer's Documentation

flapspec.h (r6227/r5385)
1 
2 /* Copyright (C) 2015 David Eller <david@larosterna.com>
3  *
4  * Commercial License Usage
5  * Licensees holding valid commercial licenses may use this file in accordance
6  * with the terms contained in their respective non-exclusive license agreement.
7  * For further information contact david@larosterna.com .
8  *
9  * GNU General Public License Usage
10  * Alternatively, this file may be used under the terms of the GNU General
11  * Public License version 3.0 as published by the Free Software Foundation and
12  * appearing in the file gpl.txt included in the packaging of this file.
13  */
14 
15 #ifndef SURF_FLAPSPEC_H
16 #define SURF_FLAPSPEC_H
17 
18 #include <genua/point.h>
19 #include <genua/xmlelement.h>
20 
21 class MxMesh;
22 
34 class FlapSpec
35 {
36 public:
37 
38  typedef std::vector<Indices> NodeIndexSet;
39 
41  FlapSpec(const std::string & s = "") : sid(s), balanceExtension(0.0) {}
42 
44  void rename(const std::string & s) {sid = s;}
45 
47  const std::string & name() const {return sid;}
48 
50  uint nsegments() const {return hp.empty() ? 0 : hp.size()-1;}
51 
53  void addSegment(const Vct3 & hingePoint, const Vct3 & endPoint) {
54  hp.push_back( hingePoint );
55  ep.push_back( endPoint );
56  }
57 
59  const Vct3 & hingePoint(uint k) const {return hp[k];}
60 
62  const Vct3 & endPoint(uint k) const {return ep[k];}
63 
65  Real balancing() const {return balanceExtension;}
66 
68  void balancing(Real balex) {balanceExtension = balex;}
69 
71  void createBoco(MxMesh & mx, NodeIndexSet & segNodes) const;
72 
74  void createDisplacement(MxMesh & mx, const NodeIndexSet & segNodes) const;
75 
77  void createDisplacement(const MxMesh & mx, uint iseg, const Indices & segNodes,
78  PointList<3> & dsp, Real fseg = 1.0) const;
79 
81  XmlElement toXml(bool share = false) const;
82 
84  void fromXml(const XmlElement & xe);
85 
86 private:
87 
89  static void collectBcElements(const MxMesh & mx, int bc, Indices & ielm);
90 
92  static void collectSurfaceElements(const MxMesh & mx, Indices & ielm);
93 
95  static void nodesFromElements(const MxMesh & mx, const Indices & ielm,
96  Indices & inodes);
97 
98 private:
99 
101  std::string sid;
102 
105 
108 
111 };
112 
116 {
117 public:
118 
119  struct Pattern {
120  public:
121 
123  Pattern() {}
124 
126  void append(const std::string & flap, Real f = 1.0, uint iseg = 0) {
127  flaps.push_back(flap);
128  segments.push_back(iseg);
129  factors.push_back(f);
130  }
131 
133  void clear() {
134  flaps.clear();
135  segments.clear();
136  factors.clear();
137  }
138 
140  XmlElement toXml(bool share=false) const;
141 
143  void fromXml(const XmlElement & xe);
144 
145  std::string name;
146  StringArray flaps;
147  Indices segments;
148  Vector factors;
149  };
150 
153 
155  uint nflaps() const {return flaps.size();}
156 
158  uint findFlap(const std::string & s) const;
159 
161  const FlapSpec & flap(uint k) const {return flaps[k];}
162 
164  uint append(const FlapSpec & f) {
165  flaps.push_back(f);
166  return flaps.size()-1;
167  }
168 
170  const Pattern & pattern(uint k) const {return patterns[k];}
171 
173  uint append(const Pattern & p) {
174  patterns.push_back(p);
175  return patterns.size()-1;
176  }
177 
179  void createDisplacements(MxMesh & mx) const;
180 
182  XmlElement toXml(bool share) const;
183 
185  void fromXml(const XmlElement & xe);
186 
187 private:
188 
190  std::vector<FlapSpec> flaps;
191 
193  std::vector<Pattern> patterns;
194 };
195 
196 #endif // FLAPSPEC_H
uint size() const
uint findFlap(const std::string &s) const
determine flap index from name
Definition: flapspec.cpp:323
uint push_back(const value_type &x)
static void collectSurfaceElements(const MxMesh &mx, Indices &ielm)
collects nodes used by any type of surface element
Definition: flapspec.cpp:220
XmlElement toXml(bool share) const
create XML representation
Definition: flapspec.cpp:361
XmlElement toXml(bool share=false) const
export to XML format
Definition: flapspec.cpp:249
std::vector< FlapSpec > flaps
control surface definitions
Definition: flapspec.h:190
void fromXml(const XmlElement &xe)
recover from XML representation
Definition: flapspec.cpp:371
PointList< 3 > hp
hinge points
Definition: flapspec.h:104
uint append(const FlapSpec &f)
append a flap geometry specification
Definition: flapspec.h:164
const Vct3 & endPoint(uint k) const
access hinge point k
Definition: flapspec.h:62
const Vct3 & hingePoint(uint k) const
access hinge point k
Definition: flapspec.h:59
void fromXml(const XmlElement &xe)
retrieve from XML format
Definition: flapspec.cpp:265
XmlElement toXml(bool share=false) const
create XML representation
Definition: flapspec.cpp:291
Holds a set of flap geometry specifications along with deflection patterns.
Definition: flapspec.h:115
uint nsegments() const
number of segments present
Definition: flapspec.h:50
void append(const std::string &flap, Real f=1.0, uint iseg=0)
append a participating flap
Definition: flapspec.h:126
Real balanceExtension
extension of the flap beyond the hinge line (balancing)
Definition: flapspec.h:110
bool empty() const
void clear()
clear out entire pattern
Definition: flapspec.h:133
void createBoco(MxMesh &mx, NodeIndexSet &segNodes) const
create an element group for each flap segment
Definition: flapspec.cpp:95
FlapSpec(const std::string &s="")
empty, invalid flap spec
Definition: flapspec.h:41
FlapSpecSet()
empty flap set
Definition: flapspec.h:152
void balancing(Real balex)
access extension parameter used to model aerodynamic balancing
Definition: flapspec.h:68
void createDisplacement(MxMesh &mx, const NodeIndexSet &segNodes) const
create a displacement field for positive deflection of each segment
Definition: flapspec.cpp:166
void rename(const std::string &s)
change name
Definition: flapspec.h:44
Definition: flapspec.h:119
Geometrical specification of control surface.
Definition: flapspec.h:34
void fromXml(const XmlElement &xe)
recover from XML representation
Definition: flapspec.cpp:307
std::vector< Pattern > patterns
each pattern
Definition: flapspec.h:193
const FlapSpec & flap(uint k) const
access flap geometry
Definition: flapspec.h:161
PointList< 3 > ep
end points, i.e. trailing edge for TE flaps
Definition: flapspec.h:107
std::string sid
flap identifier
Definition: flapspec.h:101
void addSegment(const Vct3 &hingePoint, const Vct3 &endPoint)
extend flap by adding another segment
Definition: flapspec.h:53
uint append(const Pattern &p)
append a pattern specification
Definition: flapspec.h:173
void createDisplacements(MxMesh &mx) const
create displacement fields for all patterns
Definition: flapspec.cpp:333
Real balancing() const
access extension parameter used to model aerodynamic balancing
Definition: flapspec.h:65
const std::string & name() const
access name
Definition: flapspec.h:47
static void nodesFromElements(const MxMesh &mx, const Indices &ielm, Indices &inodes)
extract nodes from element set
Definition: flapspec.cpp:236
static void collectBcElements(const MxMesh &mx, int bc, Indices &ielm)
collects nodes associated with a certain BC type (e.g. wall BC)
Definition: flapspec.cpp:205
Pattern()
create empty pattern
Definition: flapspec.h:123
uint nflaps() const
number of flap geometries defined
Definition: flapspec.h:155
const Pattern & pattern(uint k) const
access flap deflection pattern
Definition: flapspec.h:170
Generated on Wed Jan 19 2022 03:03:15 for libsurf by   doxygen 1.8.5