Box Class Reference

#include <Box.h>

Public Member Functions

 Box (int maxLevel, int nTerms)
 
void addPanel (int level, Panel *panel)
 
void upwardPass ()
 
void downwardPass ()
 
void computeFlow (int k)
 
int getMaxLevel ()
 
int getNrPanelsOnLevel (int level)
 
int getNumberOfTerms ()
 

Private Attributes

int maxLevel_
 
int p_
 
std::vector< std::vector< Panel * > > levels_
 
std::vector< Sphere * > spheres_
 

Constructor & Destructor Documentation

◆ Box()

Box::Box ( int  maxLevel,
int  nTerms 
)
10  : maxLevel_(maxLevel), p_(nTerms)
11 {
12  for (int iL = 0; iL <= maxLevel; iL++)
13  {
14  std::vector<Panel*>* boxLevel = new std::vector<Panel*>;
15  levels_.push_back(*boxLevel);
16  }
17 }
int maxLevel_
Definition: Box.h:41
int p_
Definition: Box.h:42
std::vector< std::vector< Panel * > > levels_
Definition: Box.h:43

References levels_.

Member Function Documentation

◆ addPanel()

void Box::addPanel ( int  level,
Panel panel 
)
20 {
21  levels_[level].push_back(panel);
22 }

References levels_.

Referenced by Panel::Panel().

◆ computeFlow()

void Box::computeFlow ( int  k)
89 {
90  //***************************************
91  //* Initialise spheres *
92  //***************************************
93 
94  // The first step is to add dipoles with correct location and strengths in the domain
95  // All dipoles in the domain are now expanded into multipoles
96  logger(INFO, "Initialising spheres");
97  upwardPass();
98  downwardPass();
99 
100  //For all panels on the finest level
101  //for (Panel* panel : levels_[maxLevel_])
102  //{
103  //For all dipoles on the finest level
104  //for (Dipole* iD : panel->getDipoles())
105  //{
106  // Add a multipole in the domain
107  //Multipole* multipole = new Multipole(iD->getP, iD->getSquaredFactorials, iD->getLocation());
108  //panel->multipoles_.push_back(multipole);
109 
110  // Construct a sphere
111  //Sphere* sphere = new Sphere(panel, iD->getLocation(), iD, multipole);
112 
113  // Add the sphere to the list of spheres and to the panel list
114  //spheres_.push_back(sphere);
115  //spheres_.push_back(sphere);
116  //}
117  //}
118 
119  //***********************************
120  //* Compue Mirror Multipoles *
121  //***********************************
122 
123 
124  // Compute k order mirrors
125  for (int i = 1; k <= i; i++)
126  {
127  //For all panels on the finest level
128  for (Panel* panel : levels_[maxLevel_])
129  {
130  // For all spheres: add a new multipole to the centre of a sphere to compensate
131  for (Sphere* sphere : panel->getSpheres())
132  {
133  std::vector<std::complex<Mdouble>> localExpansionAroundSphere;
134  //Vec3D sphereCentre = sphere->getLocation();
135 
136  // Compute panel local expansion around sphere
137  //localExpansionAroundSphere = panel->localExpansionAroundCentre_->translateLocalExpansion(sphereCentre);
138 
139  // Compute other sphere local expansion around sphere
140  for (Sphere* sphereOther: spheres_)
141  {
142  if (sphereOther != sphere)
143  {
144  // todo: implement this shizzle
145  //localExpansionAroundSphere += sphereOther->multipole_->convertMultipoleToLocal(sphereCentre);
146  }
147  }
148  // Compute multipole
149  size_t nTerms = (p_ + 1) * (p_ + 1);
150  NumericalVector<std::complex<Mdouble>> multipoleExpansionCoefficients(nTerms);
151  //for (int n = 0; n <= p_; n++)
152  //{
153  //for (int m = -n; m <= n; m++)
154  //{
155  //int location = n * n + (m + n);
156  //multipoleExpansionCoefficients[location] = localExpansionAroundSphere[0]*n/(n+1)*std::pow(sphere->getRadius,2n+1);
157  //}
158  //}
159  //sphere->multipole_->setExpansionCoefficients(multipoleExpansionCoefficients);
160  }
161  }
162 
163  //Perform and upward and downward pass to compute the new coefficients
164  upwardPass();
165  downwardPass();
166  }
167 
168 
169 }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ INFO
void downwardPass()
Definition: Box.cc:48
void upwardPass()
Definition: Box.cc:24
std::vector< Sphere * > spheres_
Definition: Box.h:44
Definition: NumericalVector.h:44
Definition: Panel.h:23
Definition: Sphere.h:15
char char char int int * k
Definition: level2_impl.h:374

References downwardPass(), i, INFO, k, levels_, logger, maxLevel_, p_, spheres_, and upwardPass().

◆ downwardPass()

void Box::downwardPass ( )
49 {
50  logger(INFO, "============================\n"
51  "Starting the downward pass.\n", Flusher::NO_FLUSH);
52  //Set the first part of the local expansion to zero: everything is in the interaction list or closer
53  NumericalVector<std::complex<Mdouble>> localExpansionCoefficients;
54  for (Panel* panel: levels_[1])
55  {
56  panel->setLocalExpansionZero();
57  }
58 
59  // Compute all local expansions for intermediate levels
60  for (int iL = 1; iL < maxLevel_; iL++)
61  {
62  logger(INFO, "Computing nearby Local Expansions on level %.\n", iL, Flusher::NO_FLUSH);
63  for (Panel* panel: levels_[iL])
64  {
65  panel->computePartialLocalExpansion();
66  panel->computeLocalExpansion();
67 
68  }
69 
70  logger(INFO, "Translating local expansions to children\n", Flusher::NO_FLUSH);
71  for (Panel* panel: levels_[iL])
72  {
73  panel->translateLocalExpansion();
74  }
75  }
76 
77  // Compute local expansions for the remaining interaction list on the finest level
78  logger(INFO, "Computing nearby local expansions on finest level\n", Flusher::NO_FLUSH);
79  for (Panel* panel : levels_[maxLevel_])
80  {
81  panel->computePartialLocalExpansion();
82  panel->computeLocalExpansion();
83  }
84 
85  logger(INFO, "Finished downward pass.");
86 }

References INFO, levels_, logger, maxLevel_, and NO_FLUSH.

Referenced by Panel::computeCoefficients(), and computeFlow().

◆ getMaxLevel()

int Box::getMaxLevel ( )
inline
25  {
26  return maxLevel_;
27  }

References maxLevel_.

◆ getNrPanelsOnLevel()

int Box::getNrPanelsOnLevel ( int  level)
inline
Todo:
some ints here should be unsigned long
31  {
32  return levels_[level].size();
33  }

References levels_.

◆ getNumberOfTerms()

int Box::getNumberOfTerms ( )
inline
36  {
37  return p_;
38  }

References p_.

Referenced by Panel::Panel().

◆ upwardPass()

void Box::upwardPass ( )
25 {
26  // Perform a multipole expansion about the centre of all panels located on the finest mesh
27  logger(INFO, "============================\n"
28  "Starting the upward pass\n"
29  "Computing multipole expansion on finest level\n", Flusher::NO_FLUSH);
30  for (Panel* panel: levels_[maxLevel_])
31  {
32  panel->computeMultipoleExpansion();
33  }
34 
35  // Perform an upward pass, each level combine the previous level multipole expansions by shifting them to the centre of the current panel
36  for (int iL = maxLevel_ - 1; iL >= 0; iL--)
37  {
38  logger(INFO, "Shifting multipole expansions on level %.\n", iL, Flusher::NO_FLUSH);
39  for (Panel* panel: levels_[iL])
40  {
41  panel->translateMultipoleExpansion();
42  }
43  }
44  logger(INFO, "Finished upward pass.");
45 
46 }

References INFO, levels_, logger, maxLevel_, and NO_FLUSH.

Referenced by Panel::computeCoefficients(), and computeFlow().

Member Data Documentation

◆ levels_

std::vector<std::vector<Panel*> > Box::levels_
private

◆ maxLevel_

int Box::maxLevel_
private

◆ p_

int Box::p_
private

Referenced by computeFlow(), and getNumberOfTerms().

◆ spheres_

std::vector<Sphere*> Box::spheres_
private

Referenced by computeFlow().


The documentation for this class was generated from the following files: