libsurf
Programmer's Documentation

asycomponent.h (r6227/r5397)
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_ASYCOMPONENT_H
16 #define SURF_ASYCOMPONENT_H
17 
18 #include "forward.h"
19 #include "endcap.h"
20 #include <genua/xmlelement.h>
21 #include <boost/shared_ptr.hpp>
22 
34 {
35 public:
36 
37  typedef enum {CapULo=0, CapUHi=1, CapVLo=2, CapVHi=3} CapSide;
38 
40  AsyComponent();
41 
43  virtual ~AsyComponent() {}
44 
46  bool defined() const {return (main.get() != 0);}
47 
49  //bool capIntersected() const {return bCapIntersected;}
50 
52  const std::string & name() const {
53  assert(defined());
54  return main->surface()->name();}
55 
57  void component(const MeshComponentPtr & mcp) {main = mcp;}
58 
60  void surface(const SurfacePtr & s);
61 
63  const SurfacePtr & surface() const {
64  assert(defined());
65  return main->surface();}
66 
68  void surface(const SurfacePtr & s) const {
69  assert(defined());
70  main->surface(s);}
71 
73  const DnRefineCriterionPtr & criterion() const {
74  assert(defined());
75  return main->criterion();}
76 
78  void criterion(const DnRefineCriterionPtr & c) {
79  assert(defined());
80  main->criterion(c);}
81 
83  uint mainTag() const {return maintag;}
84 
86  void mainTag(uint t) {maintag = t;}
87 
89  uint capTag(uint k) const {
90  assert(k < 4);
91  return ecaps[k].tag();
92  }
93 
95  void capTag(uint k, uint t) {
96  assert(k < 4);
97  ecaps[k].tag(t);
98  }
99 
101  void surfaceChanged() {
102  assert(defined());
103  main->surfaceChanged();
104  }
105 
107  void stretchedMesh(bool flag) {
108  assert(defined());
109  main->stretchedMesh(flag);}
110 
112  bool stretchedMesh() const {
113  assert(defined());
114  return main->stretchedMesh();}
115 
117  void smoothing(uint nsm, Real wsm) {
118  assert(defined());
119  main->smoothingFactor(wsm);
120  main->smoothingIterations(nsm);}
121 
123  void kinkLimit(Real k) {main->kinkLimit(k);}
124 
126  Real kinkLimit() const {return main->kinkLimit();}
127 
129  const MeshComponentPtr & cap(CapSide s) const {
130  return ecaps[(int) s].component();
131  }
132 
134  void endCap(const EndCap & c);
135 
137  const EndCap & endCap(uint k) const {
138  assert(k < 4);
139  return ecaps[k];
140  }
141 
143  EndCap & endCap(uint k) {
144  assert(k < 4);
145  return ecaps[k];
146  }
147 
149  void endCap(CapSide s, EndCap::Shape shape, Real h);
150 
152  void translation(const Vct3 & t) {sTrn = t;}
153 
155  const Vct3 & translation() const {return sTrn;}
156 
158  void rotation(const Vct3 & r) {sRot = r;}
159 
161  const Vct3 & rotation() const {return sRot;}
162 
164  void append(MeshGenerator & mg);
165 
167  void adaptCaps();
168 
170  virtual void defaultCriterion();
171 
173  virtual void buildInitGrid(PointGrid<2> & pgi);
174 
176  virtual XmlElement toXml() const;
177 
179  virtual void fromXml(const XmlElement & xe);
180 
181 protected:
182 
184  void transform();
185 
187  void generateCaps();
188 
189 protected:
190 
192  MeshComponentPtr main;
193 
196 
198  Vct3 sTrn, sRot, sScl;
199 
201  uint maintag;
202 };
203 
204 
205 
206 #endif
bool defined() const
check if surface is defined
Definition: asycomponent.h:46
void translation(const Vct3 &t)
change translation transformation
Definition: asycomponent.h:152
Real kinkLimit() const
access kink limiter
Definition: asycomponent.h:126
void tag(uint t)
set tag
Definition: endcap.h:82
void smoothing(uint nsm, Real wsm)
set number of smoothing iterations and factor
Definition: asycomponent.h:117
void capTag(uint k, uint t)
access end cap surface mesh tag
Definition: asycomponent.h:95
virtual void defaultCriterion()
overload: create a sensible default mesh criterion
Definition: asycomponent.cpp:34
const std::string & name() const
check if any cap was intersected
Definition: asycomponent.h:52
uint maintag
tags received after mesh generation
Definition: asycomponent.h:201
Vct3 sTrn
transformation
Definition: asycomponent.h:198
void generateCaps()
generate cap surfaces (involves premeshing)
Definition: asycomponent.cpp:99
void kinkLimit(Real k)
access kink limiter
Definition: asycomponent.h:123
Properties of caps on AsyComponents.
Definition: endcap.h:26
uint mainTag() const
access main surface mesh tag
Definition: asycomponent.h:83
void stretchedMesh(bool flag)
use algorithm to generate streched mesh
Definition: asycomponent.h:107
void component(const MeshComponentPtr &mcp)
set main mesh component
Definition: asycomponent.h:57
void surface(const SurfacePtr &s) const
access main surface
Definition: asycomponent.h:68
void transform()
apply transformation to surfaces
Definition: asycomponent.cpp:117
const DnRefineCriterionPtr & criterion() const
access mesh criterion
Definition: asycomponent.h:73
void rotation(const Vct3 &r)
change rotation transformation
Definition: asycomponent.h:158
bool stretchedMesh() const
access anisotropic mesh setting
Definition: asycomponent.h:112
const SurfacePtr & surface() const
access main surface
Definition: asycomponent.h:63
virtual void fromXml(const XmlElement &xe)
retrieve from XML
Definition: asycomponent.cpp:164
MeshComponentPtr main
main surface
Definition: asycomponent.h:192
EndCap ecaps[4]
end caps (possibly 4)
Definition: asycomponent.h:195
void adaptCaps()
adapt caps to main surfaces after refinement
Definition: asycomponent.cpp:108
void mainTag(uint t)
access main surface mesh tag
Definition: asycomponent.h:86
uint capTag(uint k) const
access end cap surface mesh tag
Definition: asycomponent.h:89
virtual XmlElement toXml() const
write as XML
Definition: asycomponent.cpp:143
const Vct3 & translation() const
access translation transformation
Definition: asycomponent.h:155
AsyComponent()
undefined surface
Definition: asycomponent.cpp:26
EndCap & endCap(uint k)
access end cap
Definition: asycomponent.h:143
void criterion(const DnRefineCriterionPtr &c)
access mesh criterion
Definition: asycomponent.h:78
void surfaceChanged()
mark surface as changed
Definition: asycomponent.h:101
virtual void buildInitGrid(PointGrid< 2 > &pgi)
generate initialization grid, provided by surface by default
Definition: asycomponent.cpp:41
const EndCap & endCap(uint k) const
access end cap
Definition: asycomponent.h:137
void endCap(const EndCap &c)
register cap
Definition: asycomponent.cpp:78
const Vct3 & rotation() const
access rotation transformation
Definition: asycomponent.h:161
Top-level mesh generator.
Definition: meshgenerator.h:79
Base class for top-level components.
Definition: asycomponent.h:33
virtual ~AsyComponent()
virtual destructor
Definition: asycomponent.h:43
const MeshComponentPtr & cap(CapSide s) const
retrieve cap mesh component
Definition: asycomponent.h:129
void append(MeshGenerator &mg)
add to mesh generator
Definition: asycomponent.cpp:126
Generated on Wed Jan 19 2022 03:03:14 for libsurf by   doxygen 1.8.5