libsurf
Programmer's Documentation

stitchedsurf.h (r6227/r5402)
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_STITCHEDSURF_H
16 #define SURF_STITCHEDSURF_H
17 
18 #include "surface.h"
19 
20 class StitchedWingSpec;
21 
30 class StitchedSurf : public Surface
31 {
32  public:
33 
35  StitchedSurf(const std::string & s = "NoNameStitchedSurf") : Surface(s) {}
36 
38  StitchedSurf(const StitchedSurf & a) : Surface(a) {init(a.sfl, a.vbreak);}
39 
41  void init(const SurfaceArray & s, const Vector & vb);
42 
47  // void init(CurvePtrArray & cpa, uint nwl = 0, bool cubic = false);
48 
50  void init(const StitchedWingSpec & spec);
51 
53  const Vector & breakPoints() const {return vbreak;}
54 
56  const SurfaceArray & segments() const {return sfl;}
57 
59  Vct3 eval(Real u, Real v) const;
60 
62  Vct3 derive(Real u, Real v, uint du, uint dv) const;
63 
65  void plane(Real u, Real v, Vct3 & S, Vct3 & Su, Vct3 & Sv) const;
66 
68  Vct3 normal(Real u, Real v) const;
69 
71  void apply();
72 
74  void initMesh(const DnRefineCriterion & c, DnMesh & gnr) const;
75 
77  XmlElement toXml(bool share=false) const;
78 
80  void fromXml(const XmlElement & xe);
81 
83  int toIges(IgesFile & file, int tfi=0) const;
84 
86  StitchedSurf *clone() const {return new StitchedSurf(*this);}
87 
89  virtual void dimStats(DimStat & stat) const;
90 
92  void initGridPattern(Vector & up, Vector & vp) const;
93 
95  void isSymmetric(bool & usym, bool & vsym) const;
96 
97  private:
98 
100  // void construct();
101 
103  uint segment(Real v) const {
104  assert(v >= vbreak.front());
105  assert(v <= vbreak.back());
106  Vector::const_iterator pos;
107  pos = std::lower_bound(vbreak.begin(), vbreak.end(), v);
108  if (pos == vbreak.begin())
109  return 1;
110  else if (pos == vbreak.end())
111  return vbreak.size()-1;
112  else
113  return std::distance(vbreak.begin(), pos);
114  }
115 
116  private:
117 
119  Vector vbreak;
120 
122  SurfaceArray sfl;
123 };
124 
125 typedef boost::shared_ptr<StitchedSurf> StitchedSurfPtr;
126 
135 {
136  public:
137 
138  enum SegType {SegLinear, SegCubic, SegWlBlend};
139 
141  StitchedWingSpec(const CurvePtrArray & crv) : cpa(crv) {}
142 
144  uint addSegment(uint first, uint last, SegType s = SegLinear);
145 
147  uint nsegments() const {return sType.size();}
148 
150  void construct(SurfaceArray & slist, Vector & vbreak) const;
151 
152  private:
153 
155  const CurvePtrArray & cpa;
156 
158  Indices sBegin, sEnd;
159 
161  std::vector<SegType> sType;
162 };
163 
164 #endif
Indices sBegin
specify which curves make up segments
Definition: stitchedsurf.h:158
SurfaceArray sfl
child surfaces
Definition: stitchedsurf.h:122
const CurvePtrArray & cpa
curves to use for interpolation
Definition: stitchedsurf.h:155
void init(const SurfaceArray &s, const Vector &vb)
create from surface array (copies surfaces)
Definition: stitchedsurf.cpp:52
Vector vbreak
break points in v direction
Definition: stitchedsurf.h:119
const SurfaceArray & segments() const
access surface segments
Definition: stitchedsurf.h:56
Mesh generation engine.
Definition: dnmesh.h:47
Specification of wing with multiple segments.
Definition: stitchedsurf.h:134
void construct(SurfaceArray &slist, Vector &vbreak) const
construct surfaces from segments
Definition: stitchedsurf.cpp:399
int toIges(IgesFile &file, int tfi=0) const
write constituent surfaces to IGES file
Definition: stitchedsurf.cpp:356
Combined surface.
Definition: stitchedsurf.h:30
uint addSegment(uint first, uint last, SegType s=SegLinear)
define a new segment from curves [first, last]
Definition: stitchedsurf.cpp:380
Main interface to IGES files.
Definition: igesfile.h:32
Vct3 derive(Real u, Real v, uint du, uint dv) const
derive at (u,v)
Definition: stitchedsurf.cpp:75
std::vector< SegType > sType
segment types
Definition: stitchedsurf.h:161
Vct3 eval(Real u, Real v) const
evaluation interface
Definition: stitchedsurf.cpp:68
uint nsegments() const
number of segments
Definition: stitchedsurf.h:147
void plane(Real u, Real v, Vct3 &S, Vct3 &Su, Vct3 &Sv) const
compute point and tangent derivatives at (u,v), for efficiency
Definition: stitchedsurf.cpp:88
void fromXml(const XmlElement &xe)
XML input.
Definition: stitchedsurf.cpp:289
virtual void dimStats(DimStat &stat) const
compute dimensional statistics
Definition: stitchedsurf.cpp:365
XmlElement toXml(bool share=false) const
XML output.
Definition: stitchedsurf.cpp:267
uint segment(Real v) const
build once surface list is present
Definition: stitchedsurf.h:103
void initMesh(const DnRefineCriterion &c, DnMesh &gnr) const
initialize mesh generator (marks kink edges)
Definition: stitchedsurf.cpp:232
void initGridPattern(Vector &up, Vector &vp) const
return an initial discretization pattern to start with
Definition: stitchedsurf.cpp:238
StitchedSurf(const StitchedSurf &a)
make a deep copy
Definition: stitchedsurf.h:38
Vct3 normal(Real u, Real v) const
compute normal vector
Definition: stitchedsurf.cpp:98
Surface interface.
Definition: surface.h:37
StitchedSurf(const std::string &s="NoNameStitchedSurf")
empty construction
Definition: stitchedsurf.h:35
StitchedWingSpec(const CurvePtrArray &crv)
initialize with reference to curves
Definition: stitchedsurf.h:141
StitchedSurf * clone() const
generate a clone
Definition: stitchedsurf.h:86
void apply()
coordinate transformation
Definition: stitchedsurf.cpp:107
const Vector & breakPoints() const
make breakpoints available
Definition: stitchedsurf.h:53
Simplest mesh refinement criterion.
Definition: dnrefine.h:43
void isSymmetric(bool &usym, bool &vsym) const
return if surface is symmetric in u- or v-direction
Definition: stitchedsurf.cpp:261
Generated on Mon Jan 24 2022 03:03:16 for libsurf by   doxygen 1.8.5