Panel.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2023, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 #ifndef PANEL_H_
26 #define PANEL_H_
27 
28 #include <vector>
29 #include "Dipole.h"
30 #include "LocalExpansion.h"
31 #include "Math/NumericalVector.h"
32 #include "Math/Vector.h"
33 #include "Multipole.h"
34 #include "Source.h"
35 
36 class Panel;
37 
38 #include "Sphere.h"
39 
40 class Box;
41 
42 class Panel
43 {
44 public:
45  Panel(Panel* root,
46  int maximumPanelLevel,
47  Vec3D leftBound,
48  Vec3D rightBound,
49  std::vector<Source*> sources,
50  std::vector<Dipole*> dipoles,
51  NumericalVector<>* squaredFactorials,
52  Box* box);
53 
54  //Data structure functions
55  void initialise();
56 
57  void computeCoefficients();
58 
59  void createPanels(int dim, std::vector<Source*>& sources, std::vector<Dipole*>& dipoles, Vec3D& leftBoundChild,
60  Vec3D& rightBoundChild, NumericalVector<>* squaredFactorials);
61 
62  void findPanelInteractions();
63 
64  void setPanelInteractions();
65 
66  //Functions used for the upward pass
68 
70 
71  //Functions used for the downward pass
72  void setLocalExpansionZero(); //In the current implementation this function is not used
74 
76 
77 
78  //Functions that need to be removed or shift to another topic
79  void computeLocalExpansion();
80 
81 
82  //Getters
84  {
85  return centre_;
86  }
87 
89  {
90  return root_;
91  }
92 
93  std::vector<Panel*> getChilderen()
94  {
95  return childeren_;
96  }
97 
98  std::vector<Panel*> getNeighbours()
99  {
100  return neighbours_;
101  }
102 
103  std::vector<Panel*> getSecondNeighbours()
104  {
105  return secondNeighbours_;
106  }
107 
108  std::vector<Panel*> getInteractionList()
109  {
110  return interactionList_;
111  }
112 
113  std::vector<Source*> getSources()
114  {
115  return sources_;
116  }
117 
118  Source* getSource(int index)
119  {
120  return sources_[index];
121  }
122 
123  std::vector<Dipole*> getDipoles()
124  {
125  return dipoles_;
126  }
127 
128  std::vector<Multipole*> getMultipoles()
129  {
130  return multipoles_;
131  }
132 
133  std::vector<Sphere*> getSpheres()
134  {
135  return spheres_;
136  }
137 
139  {
140  return panelLevel_;
141  }
142 
144  {
145  return partialLocalExpansion_;
146  }
147 
149  {
150  return localExpansion_;
151  }
152 
153 private:
154  //Panel characteristics
155  const int panelLevel_; //The level at which the panel is living. This panel has no children when panelLevel = 1
156  Mdouble dim_; //dimension of the problem space
157  Vec3D leftBound_; // Left and bottom bounds
158  Vec3D rightBound_; // Right and top bounds
159  double size_; // the half of the width and length of the panel
160  Vec3D centre_; // Centre of the panel
161 
162  //Data structures
163  Panel* root_ = nullptr; //Root of the current panel
164  std::vector<Panel*> childeren_; //List of children which have the current panel as root.
165  std::vector<Panel*> neighbours_; //List of neighbours
166  std::vector<Panel*> secondNeighbours_; //List of second neighbours.
167  std::vector<Panel*> interactionList_; //List of interaction panels
168 
169  //Multipole structures
170  std::vector<Source*> sources_; //List of sources contained within this panel.
171  std::vector<Dipole*> dipoles_; //List of dipoles contained within this panel.
172  std::vector<Multipole*> multipoles_; //List of multipoles contained within this panel.
173 
174  //For fluid calculation
175  std::vector<Sphere*> spheres_; //For the finest level of panels this vector contains the spheres within that panel
176 
177  // Mother of all pointers
178  Box* box_; //Pointer to the data structure sorted per level
179 
180  //Computational values
181  // todo: sort out this mess
187 };
188 
189 
190 #endif /* PANEL_H_ */
Definition: Box.h:32
Definition: LocalExpansion.h:35
Definition: Multipole.h:34
Definition: NumericalVector.h:64
Definition: Panel.h:43
std::vector< Panel * > getInteractionList()
Definition: Panel.h:108
std::vector< Sphere * > getSpheres()
Definition: Panel.h:133
NumericalVector< std::complex< Mdouble > > getPartialLocalExpansion()
Definition: Panel.h:143
Source * getSource(int index)
Definition: Panel.h:118
void computePartialLocalExpansion()
Definition: Panel.cc:296
const int panelLevel_
Definition: Panel.h:155
std::vector< Source * > sources_
Definition: Panel.h:170
void computeMultipoleExpansion()
Definition: Panel.cc:250
NumericalVector< std::complex< Mdouble > > partialLocalExpansion_
Definition: Panel.h:185
Panel * root_
Definition: Panel.h:163
std::vector< Panel * > neighbours_
Definition: Panel.h:165
NumericalVector< std::complex< Mdouble > > localExpansion_
Definition: Panel.h:186
std::vector< Multipole * > getMultipoles()
Definition: Panel.h:128
std::vector< Panel * > childeren_
Definition: Panel.h:164
void initialise()
Definition: Panel.cc:163
Vec3D leftBound_
Definition: Panel.h:157
NumericalVector< std::complex< Mdouble > > getLocalExpansion()
Definition: Panel.h:148
std::vector< Panel * > interactionList_
Definition: Panel.h:167
void createPanels(int dim, std::vector< Source * > &sources, std::vector< Dipole * > &dipoles, Vec3D &leftBoundChild, Vec3D &rightBoundChild, NumericalVector<> *squaredFactorials)
Definition: Panel.cc:100
double size_
Definition: Panel.h:159
std::vector< Panel * > getNeighbours()
Definition: Panel.h:98
Vec3D centre_
Definition: Panel.h:160
void computeLocalExpansion()
Definition: Panel.cc:307
std::vector< Dipole * > getDipoles()
Definition: Panel.h:123
Panel(Panel *root, int maximumPanelLevel, Vec3D leftBound, Vec3D rightBound, std::vector< Source * > sources, std::vector< Dipole * > dipoles, NumericalVector<> *squaredFactorials, Box *box)
Definition: Panel.cc:37
std::vector< Panel * > getSecondNeighbours()
Definition: Panel.h:103
Panel * getRoot()
Definition: Panel.h:88
int getPanelLevel()
Definition: Panel.h:138
void computeCoefficients()
Definition: Panel.cc:170
void translateMultipoleExpansion()
Definition: Panel.cc:278
std::vector< Dipole * > dipoles_
Definition: Panel.h:171
void translateLocalExpansion()
Definition: Panel.cc:314
LocalExpansion * partialLocalExpansionAroundCentre_
Definition: Panel.h:183
void setPanelInteractions()
Definition: Panel.cc:198
std::vector< Sphere * > spheres_
Definition: Panel.h:175
void setLocalExpansionZero()
Definition: Panel.cc:291
std::vector< Multipole * > multipoles_
Definition: Panel.h:172
Vec3D getCentre()
Definition: Panel.h:83
Vec3D rightBound_
Definition: Panel.h:158
std::vector< Panel * > secondNeighbours_
Definition: Panel.h:166
std::vector< Panel * > getChilderen()
Definition: Panel.h:93
Mdouble dim_
Definition: Panel.h:156
LocalExpansion * localExpansionAroundCentre_
Definition: Panel.h:184
Multipole * multipoleAroundCentre_
Definition: Panel.h:182
std::vector< Source * > getSources()
Definition: Panel.h:113
void findPanelInteractions()
Definition: Panel.cc:179
Box * box_
Definition: Panel.h:178
Definition: Source.h:34
Definition: Vector.h:51