libsurf
Programmer's Documentation

endcap.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 ENDCAP_H
16 #define ENDCAP_H
17 
18 #include <genua/defines.h>
19 #include "meshcomponent.h"
20 
26 class EndCap
27 {
28  public:
29 
30  typedef enum {LongCap, RingCap} Shape;
31 
33  EndCap() : fheight(0.0), shape(EndCap::LongCap),
34  mainside(none), itag(NotFound), present(false) {}
35 
37  explicit EndCap(Real h) : fheight(h), shape(EndCap::LongCap),
38  mainside(none), itag(NotFound), present(true) {}
39 
41  EndCap(Shape s, Real h) : fheight(h), shape(s), mainside(none),
42  itag(NotFound), present(true) {}
43 
45  explicit EndCap(const XmlElement & xe) {fromXml(xe);}
46 
48  void reset() {
49  fheight = 0.0;
50  shape = LongCap;
51  mainside = none;
52  itag = NotFound;
53  present = false;
54  cap.reset();
55  }
56 
58  EndCap::Shape capShape() const {return shape;}
59 
61  void capShape(EndCap::Shape s) {shape = s;}
62 
64  Real height() const {return fheight;}
65 
67  void height(Real h) {fheight = h;}
68 
70  void toggle(bool flag) {present = flag;}
71 
73  side_t attachedSide() const {return mainside;}
74 
76  void attachedSide(side_t s) {mainside = s;}
77 
79  bool isPresent() const {return present;}
80 
82  void tag(uint t) {itag = t;}
83 
85  uint tag() const {return itag;}
86 
88  MeshComponentPtr create(MeshComponentPtr main, side_t side);
89 
91  void adapt(MeshComponentPtr main, side_t side);
92 
94  const MeshComponentPtr & component() const {
95  return cap;
96  }
97 
99  const SurfacePtr & surface() const {
100  assert(cap);
101  return cap->surface();
102  }
103 
105  XmlElement toXml() const;
106 
108  void fromXml(const XmlElement & xe);
109 
110  private:
111 
113  MeshComponentPtr cap;
114 
116  Real fheight;
117 
119  EndCap::Shape shape;
120 
122  side_t mainside;
123 
125  uint itag;
126 
128  bool present;
129 };
130 
131 #endif // ENDCAP_H
const MeshComponentPtr & component() const
access component of the current cap surface
Definition: endcap.h:94
Real height() const
access height value
Definition: endcap.h:64
void reset()
destroy surface
Definition: endcap.h:48
EndCap(Real h)
instanciate default long cap (simple wingtip cap)
Definition: endcap.h:37
void height(Real h)
access height value
Definition: endcap.h:67
uint tag() const
query tag
Definition: endcap.h:85
EndCap()
default cap is not present
Definition: endcap.h:33
void tag(uint t)
set tag
Definition: endcap.h:82
void capShape(EndCap::Shape s)
access shape type
Definition: endcap.h:61
MeshComponentPtr cap
cap surface geometry
Definition: endcap.h:113
side_t mainside
which side of main is closed by this cap?
Definition: endcap.h:122
Properties of caps on AsyComponents.
Definition: endcap.h:26
side_t attachedSide() const
retrieve attachment side tag
Definition: endcap.h:73
void attachedSide(side_t s)
set attachment side
Definition: endcap.h:76
bool present
present at all?
Definition: endcap.h:128
MeshComponentPtr create(MeshComponentPtr main, side_t side)
create cap on component &#39;body&#39;
Definition: endcap.cpp:24
EndCap::Shape shape
shape identifier
Definition: endcap.h:119
const SurfacePtr & surface() const
access current cap surface itself
Definition: endcap.h:99
void adapt(MeshComponentPtr main, side_t side)
adapt cap to current main body geometry
Definition: endcap.cpp:90
XmlElement toXml() const
generate xml representation
Definition: endcap.cpp:134
bool isPresent() const
check if present
Definition: endcap.h:79
Real fheight
height parameter
Definition: endcap.h:116
void toggle(bool flag)
switch on/off
Definition: endcap.h:70
EndCap(Shape s, Real h)
detailed constructor
Definition: endcap.h:41
EndCap(const XmlElement &xe)
construct from xml element
Definition: endcap.h:45
EndCap::Shape capShape() const
access shape type
Definition: endcap.h:58
uint itag
tag set after mesh generation
Definition: endcap.h:125
void fromXml(const XmlElement &xe)
recover from xml representation
Definition: endcap.cpp:150
Generated on Mon Jan 24 2022 03:03:16 for libsurf by   doxygen 1.8.5