MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
MLS.h
Go to the documentation of this file.
1 /* metodi di interpolazione meshless */
2 
3 #ifndef MLS_H
4 #define MLS_H
5 
6 #ifdef USE_ANN
7 
8 #if defined(HAVE_ANN_H)
9 #include <ANN.h>
10 #elif defined(HAVE_ANN_ANN_H)
11 #include <ANN/ANN.h>
12 #else
13 // should never happen
14 #error "need ANN.h"
15 #endif
16 
17 #include "fullmh.h"
18 #include "spmapmh.h"
19 #include "geomdata.h"
20 
21 class Weight
22 {
23 public:
24  virtual ~Weight(void) {};
25  virtual void SetWeight(MyVectorHandler& r_in, SparseMatrixHandler& w_out) = 0;
26 };
27 
28 class RBF0: public Weight
29 {
30 public:
31  inline void SetWeight(MyVectorHandler& r, SparseMatrixHandler& w_out);
32 };
33 
34 class RBF2: public Weight
35 {
36 public:
37  inline void SetWeight(MyVectorHandler& r, SparseMatrixHandler& w_out);
38 };
39 
40 class RBF4: public Weight
41 {
42 public:
43  inline void SetWeight(MyVectorHandler& r, SparseMatrixHandler& w_out);
44 };
45 
46 class POrder
47 {
48 public:
49  virtual ~POrder(void) {};
50  virtual void
51  SetP(double* PosFem, double** PosMb, int* id,
52  unsigned int k, MyVectorHandler& p, FullMatrixHandler& P) = 0;
53 };
54 
55 class Linear: public POrder
56 {
57 public:
58  /* 1 x y z */
59  void
60  SetP(double* PosFem, double** PosMb, int* id,
61  unsigned int k, MyVectorHandler& p, FullMatrixHandler& P);
62 };
63 
64 class Quadratic: public POrder
65 {
66 public:
67  /* 1 x y z x^2 xy xz y^2 yz z^2 */
68  void
69  SetP(double* PosFem, double** PosMb, int* id,
70  unsigned int k, MyVectorHandler& p, FullMatrixHandler& P);
71 };
72 
73 class InterpMethod
74 {
75 public:
76  virtual ~InterpMethod(void) {};
77 
78  // virtual unsigned int MaxNds(void) = 0;
79  virtual void
80  Interpolate(const GeometryData&, const GeometryData&, SpMapMatrixHandler*) = 0;
81 
82  virtual void
83  Interpolate_Adj(const GeometryData&, const GeometryData&,
84  SpMapMatrixHandler*, const std::vector<Vec3>&) = 0;
85 };
86 
87 /* Mean Least Square Polinomial */
88 class MLSP: public InterpMethod
89 {
90  unsigned int N;
93  MyVectorHandler pp;
94 
95  Weight* pWg;
96  POrder* pOr;
97 
98  ANNkd_tree* pTree;
99 
100 public:
101  MLSP(unsigned int NodesN, int WgType, bool LinQuad);
102  void Interpolate(const GeometryData&, const GeometryData&, SpMapMatrixHandler*);
103  void Interpolate_Adj(const GeometryData&, const GeometryData&, SpMapMatrixHandler*,const std::vector<Vec3>&);
104 };
105 
106 #endif // USE_ANN
107 
108 #endif // MLS_H