libsurf
Programmer's Documentation

surfinterpolator.h (r6227/r5716)
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_SURFINTERPOLATOR_H
16 #define SURF_SURFINTERPOLATOR_H
17 
18 #include "dispinterpolator.h"
19 #include <genua/forward.h>
20 #include <genua/mxelementtree.h>
21 
32 {
33 public:
34 
37  m_maxNrmDev(rad(20.)), m_maxDistance(1e18),
38  m_concavityLimit(2.0),
39  m_smoothedRadius(0.0), m_smOmega(0.5f),
41  m_smoothedRing(1) {}
42 
44  virtual ~SurfInterpolator();
45 
47  void jumpCriteria(Real nrmDev, Real absDst=-1);
48 
51 
53  void selectiveSmoothing(int niterations, int neighborhoodRing=1,
54  float neighborhoodRadius=0.0f, float omega=0.5f) {
55  m_smoothSelective = niterations;
56  m_smoothedRadius = neighborhoodRadius;
57  m_smoothedRing = neighborhoodRing;
58  m_smOmega = omega;
59  }
60 
62  void useGalerkin(bool flag) {m_useGalerkin = flag;}
63 
65  void globalSmoothing(int niterations) {
66  m_smoothGlobal = niterations;
67  }
68 
70  void buildTreeFromSections(const Indices &sections = Indices());
71 
81  void buildTreeByPid(const Indices &pidwet, const Indices &pidintern);
82 
84  uint map();
85 
87  void hmap(MapMatrix &H);
88 
90  uint map(const MapMatrix &H, DMatrix<float> &m);
91 
93  FFANodePtr mapToFFA(const MapMatrix &H) const;
94 
96  virtual bool mapFromFFA(const FFANodePtr &root, MapMatrix &H);
97 
99  void writeProjection(const std::string &fname) const;
100 
102  void addDebugFields();
103 
104 private:
105 
107  Vct3f footPoint(const uint v[], const float wuv[]) const {
108  Vct3f fp;
109  for (int k=0; k<3; ++k)
110  fp += Vct3f( m_pstr->node(v[k]) ) * wuv[k];
111  return fp;
112  }
113 
115  float sqDistance(uint iwn, const uint v[], const float wuv[]) const {
116  return sq( Vct3f(m_paer->node(iwn)) - footPoint(v, wuv) );
117  }
118 
120  Vct3f evalDisplacement(uint anode, uint ifield,
121  const uint v[], const float wuv[]) const;
122 
124  Vct3f evalDisplacement(uint ifield, const uint v[], const Mtx33f h[]) const;
125 
127  void evalDisplacements(uint anode, const uint v[], const float wuv[],
128  float *column) const;
129 
131  Vct3f evalMap(uint anode, const uint v[],
132  const float wuv[], Mtx33f h[]) const;
133 
135  void footPoints(const Indices &nodeSet, PointList<3> &feet) const;
136 
138  void collectConcaveNodes(const ConnectMap &v2v, const PointList<3> &feet,
139  Indices &cnodes) const;
140 
142  void jumpNodes(Indices &rnodes) const;
143 
145  void riskyNodes(const ConnectMap &v2v, Indices &rn,
146  Real maxphi=rad(20.0)) const;
147 
149  void topoNeighbors(const ConnectMap &v2v, Indices &rn) const;
150 
152  void smoothDisplacements(const Indices &rn, const ConnectMap &v2v,
153  DMatrix<float> &m, int niter=1,
154  float omega=0.5f) const;
155 
157  void diffuseDisplacements(const ConnectMap &v2v,
158  const Indices &rnodes, DMatrix<float> &m);
159 
161  void diffusionStencil(const ConnectMap &v2v, const Indices &rnodes,
162  ConnectMap &spty) const;
163 
165  void smoothingOperator(const Indices &rnodes, const Indices &rim,
166  CsrMatrixD &Dff,
167  CsrMatrixD &Dfc) const;
168 
170  static void diffusionMatrix(const Vct3 tri[], Mtx33 &De);
171 
173  static void massMatrix(const Vct3 tri[], Mtx33 &De);
174 
176  void averagingOperator(const Indices &rnodes, const Indices &rim,
177  CsrMatrixD &Dff, CsrMatrixD &Dfc) const;
178 
180  void linearSmoothingRow(size_t row,
181  const Indices &fnodes, const Indices &cnodes,
182  CsrMatrixD &Dff, CsrMatrixD &Dfc) const;
183 
184 // /// determine least-squares error vector
185 // void evalLeastSquares(const Indices &itri, const Indices &inodes,
186 // const MapMatrix &H,
187 // CsrMatrixD &A,
188 // Vector &b) const;
189 
191  void drawFootLines();
192 
193 private:
194 
197 
200 
203 
206 
209 
212 
214  float m_smOmega;
215 
218 
221 
224 
226  bool m_useGalerkin = false;
227 
229  bool m_buildSymmetric = false;
230 };
231 
232 #endif // SURFINTERPOLATOR_H
uint map()
perform mapping and store displacement fields in aerodynamic mesh
Definition: surfinterpolator.cpp:280
int m_smoothedRing
extend of region to smooth
Definition: surfinterpolator.h:223
Map displacements from structural to aerodynamic surfaces.
Definition: surfinterpolator.h:31
void smoothingOperator(const Indices &rnodes, const Indices &rim, CsrMatrixD &Dff, CsrMatrixD &Dfc) const
generate diffusion matrix for internal smoothed region
Definition: surfinterpolator.cpp:1060
bool m_useGalerkin
surface diffusion or Galerkin averaging?
Definition: surfinterpolator.h:226
void buildTreeByPid(const Indices &pidwet, const Indices &pidintern)
Build tree from shell elements with PID.
Definition: surfinterpolator.cpp:78
void globalSmoothing(int niterations)
set parameters for postprocessing by global Laplacian smoothing
Definition: surfinterpolator.h:65
virtual ~SurfInterpolator()
virtual destructor
Definition: surfinterpolator.cpp:31
void diffuseDisplacements(const ConnectMap &v2v, const Indices &rnodes, DMatrix< float > &m)
solve diffusion problem for nodes in the internal discontinuity regions
Definition: surfinterpolator.cpp:977
float m_catchRadius
accepted distance between surfaces
Definition: surfinterpolator.h:199
bool m_buildSymmetric
assemble symmetric operator matrix?
Definition: surfinterpolator.h:229
void selectiveSmoothing(int niterations, int neighborhoodRing=1, float neighborhoodRadius=0.0f, float omega=0.5f)
set parameters for postprocessing by selective Laplacian smoothing
Definition: surfinterpolator.h:53
float sqDistance(uint iwn, const uint v[], const float wuv[]) const
compute distance from projection foot
Definition: surfinterpolator.h:115
Real m_maxDistance
parameter for identification of discontinuities
Definition: surfinterpolator.h:205
int m_smoothSelective
optional selective smoothing iterations
Definition: surfinterpolator.h:217
Real m_maxNrmDev
parameter for identification of discontinuities
Definition: surfinterpolator.h:202
Vct3f footPoint(const uint v[], const float wuv[]) const
evaluate position of foot point
Definition: surfinterpolator.h:107
void linearSmoothingRow(size_t row, const Indices &fnodes, const Indices &cnodes, CsrMatrixD &Dff, CsrMatrixD &Dfc) const
construct a single row for linear-approximation smoothing operator
Definition: surfinterpolator.cpp:1423
void useGalerkin(bool flag)
use Galerkin method for smoothing
Definition: surfinterpolator.h:62
void hmap(MapMatrix &H)
determine mapping matrix
Definition: surfinterpolator.cpp:396
void evalDisplacements(uint anode, const uint v[], const float wuv[], float *column) const
evaluate displacements for all modes in one pass
Definition: surfinterpolator.cpp:189
int m_smoothGlobal
optional global smoothing iterations
Definition: surfinterpolator.h:220
Vct3f evalMap(uint anode, const uint v[], const float wuv[], Mtx33f h[]) const
compute local mapping matrices for one node, return foot point
Definition: surfinterpolator.cpp:239
Real m_concavityLimit
threshold value for the classification as concave
Definition: surfinterpolator.h:208
SurfInterpolator()
empty construction
Definition: surfinterpolator.h:36
void drawFootLines()
debugging: generate lines connecting a-nodes to footpoints
Definition: surfinterpolator.cpp:673
MxMeshPtr m_pstr
structural mesh
Definition: dispinterpolator.h:167
MxTriTree m_tree
element search tree
Definition: surfinterpolator.h:196
static void diffusionMatrix(const Vct3 tri[], Mtx33 &De)
generate surface diffusion operator for single triangle
Definition: surfinterpolator.cpp:1232
void diffusionStencil(const ConnectMap &v2v, const Indices &rnodes, ConnectMap &spty) const
stencils for jump node set
Definition: surfinterpolator.cpp:1035
void writeProjection(const std::string &fname) const
useful for debugging : dump projection surface to mesh file for viewing
Definition: surfinterpolator.cpp:625
void addDebugFields()
debugging: write field of projection distances
Definition: surfinterpolator.cpp:693
void riskyNodes(const ConnectMap &v2v, Indices &rn, Real maxphi=rad(20.0)) const
identify aerodynamic nodes where displacement jumps are expected
Definition: surfinterpolator.cpp:871
MxMeshPtr m_paer
aerodynamic mesh
Definition: dispinterpolator.h:170
void averagingOperator(const Indices &rnodes, const Indices &rim, CsrMatrixD &Dff, CsrMatrixD &Dfc) const
another smoothing operator
Definition: surfinterpolator.cpp:1298
float m_smOmega
relaxation parameter for smoothing iterations
Definition: surfinterpolator.h:214
Base class for displacement interpolation.
Definition: dispinterpolator.h:34
void smoothDisplacements(const Indices &rn, const ConnectMap &v2v, DMatrix< float > &m, int niter=1, float omega=0.5f) const
plain Laplacian smoothing displacements for a node subset
Definition: surfinterpolator.cpp:950
Real m_smoothedRadius
radius around discontinuities which is included in smoothing
Definition: surfinterpolator.h:211
void footPoints(const Indices &nodeSet, PointList< 3 > &feet) const
determine projection foot points
Definition: surfinterpolator.cpp:630
void jumpCriteria(Real nrmDev, Real absDst=-1)
set parameters for identification of discontinuous projections
Definition: surfinterpolator.cpp:34
static void massMatrix(const Vct3 tri[], Mtx33 &De)
generate mass matrix for single triangle
Definition: surfinterpolator.cpp:1273
void jumpNodes(Indices &rnodes) const
identify aerodynamic elements which likely straddle a discontinuity
Definition: surfinterpolator.cpp:707
FFANodePtr mapToFFA(const MapMatrix &H) const
pack mapping matrix H into FFA format
Definition: surfinterpolator.cpp:544
virtual bool mapFromFFA(const FFANodePtr &root, MapMatrix &H)
retreive mapping matrix H from FFA format file
Definition: surfinterpolator.cpp:598
void concavityThreshold(Real t)
set threshold value for concavity criterion (set negative to disable)
Definition: surfinterpolator.h:50
void topoNeighbors(const ConnectMap &v2v, Indices &rn) const
collect direct neighbors of a node set
Definition: surfinterpolator.cpp:924
void buildTreeFromSections(const Indices &sections=Indices())
build mapping tree from given list of sections, or all shell elements
Definition: surfinterpolator.cpp:49
void collectConcaveNodes(const ConnectMap &v2v, const PointList< 3 > &feet, Indices &cnodes) const
gather mapped nodes with concavity ratio exceeding threshold
Definition: surfinterpolator.cpp:647
Vct3f evalDisplacement(uint anode, uint ifield, const uint v[], const float wuv[]) const
evaluate displacement of aerodynamic node mapped to specified triangle
Definition: surfinterpolator.cpp:141
Generated on Mon Jan 24 2022 03:03:16 for libsurf by   doxygen 1.8.5