libsurf
Programmer's Documentation

loadipol.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 
16 #ifndef SURF_LOADIPOL_H
17 #define SURF_LOADIPOL_H
18 
19 #include <genua/mxmesh.h>
20 
30 class LoadIpol : public MxMesh
31 {
32 public:
33 
35  LoadIpol() : iReference(NotFound) {}
36 
38  uint nstate() const {return xlo.size();}
39 
41  const std::string & stateInfo(uint i, Real & lo, Real & hi) const {
42  lo = xlo[i];
43  hi = xhi[i];
44  return stateNames[i];
45  }
46 
48  uint newState(const std::string & name, Real lo=0.0, Real hi=1.0) {
49  xlo.push_back(lo);
50  xhi.push_back(hi);
51  iDeriv.push_back(NotFound);
52  stateNames.push_back(name);
53  return xlo.size()-1;
54  }
55 
57  void markReference(uint k, const Vector & x);
58 
60  void markDerivative(uint kf, uint kx);
61 
63  uint cpimport(const MxMesh & mx, uint ifield);
64 
66  void eval(const Vector & x, Vector & cp) const;
67 
69  void createNote();
70 
72  bool extractNote();
73 
74 private:
75 
77  void normState(const Vector & x, Vector & xn) const {
78  const int n = nstate();
79  assert(x.size() == size_t(n));
80  xn.allocate(n);
81  for (int i=0; i<n; ++i)
82  xn[i] = (x[i] - xlo[i]) / (xhi[i] - xlo[i]);
83  }
84 
85 protected:
86 
88  StringArray stateNames;
89 
91  Vector xlo;
92 
94  Vector xhi;
95 
97  Vector xnref;
98 
101 
103  Indices iDeriv;
104 };
105 
106 #endif // LOADIPOL_H
void createNote()
create xml annotation
Definition: loadipol.cpp:102
uint newState(const std::string &name, Real lo=0.0, Real hi=1.0)
define a new state
Definition: loadipol.h:48
void eval(const Vector &x, Vector &cp) const
evaluate pressure coefficient field for given state
Definition: loadipol.cpp:61
bool extractNote()
extract annotations after MxMesh::fromXml()
Definition: loadipol.cpp:136
uint iReference
index of the field containing Cp for reference state
Definition: loadipol.h:100
LoadIpol()
empty interpolator
Definition: loadipol.h:35
Vector xlo
lower limits for state variables (used for normalization)
Definition: loadipol.h:91
void normState(const Vector &x, Vector &xn) const
compute normalized state
Definition: loadipol.h:77
StringArray stateNames
names of the model states
Definition: loadipol.h:88
Indices iDeriv
index of the field which contains derivative, if applicable
Definition: loadipol.h:103
uint nstate() const
number of states
Definition: loadipol.h:38
const std::string & stateInfo(uint i, Real &lo, Real &hi) const
access state
Definition: loadipol.h:41
uint cpimport(const MxMesh &mx, uint ifield)
import Cp data from another mesh file (exception on mismatch)
Definition: loadipol.cpp:18
void markReference(uint k, const Vector &x)
mark field k as reference solution, provide state
Definition: loadipol.cpp:36
Aerodynamic load interpolator.
Definition: loadipol.h:30
void markDerivative(uint kf, uint kx)
mark field kf as derivative for state kx, will normalize field kf!
Definition: loadipol.cpp:45
Vector xhi
upper limits for state variables (used for normalization)
Definition: loadipol.h:94
Vector xnref
normalized reference state for linearization
Definition: loadipol.h:97
Generated on Wed Jan 19 2022 03:03:15 for libsurf by   doxygen 1.8.5