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 
)
30  : maxLevel_(maxLevel), p_(nTerms)
31 {
32  for (int iL = 0; iL <= maxLevel; iL++)
33  {
34  std::vector<Panel*>* boxLevel = new std::vector<Panel*>;
35  levels_.push_back(*boxLevel);
36  }
37 }
int maxLevel_
Definition: Box.h:61
int p_
Definition: Box.h:62
std::vector< std::vector< Panel * > > levels_
Definition: Box.h:63

References levels_.

Member Function Documentation

◆ addPanel()

void Box::addPanel ( int  level,
Panel panel 
)
40 {
41  levels_[level].push_back(panel);
42 }

References levels_.

Referenced by Panel::Panel().

◆ computeFlow()

void Box::computeFlow ( int  k)
109 {
110  //***************************************
111  //* Initialise spheres *
112  //***************************************
113 
114  // The first step is to add dipoles with correct location and strengths in the domain
115  // All dipoles in the domain are now expanded into multipoles
116  logger(INFO, "Initialising spheres");
117  upwardPass();
118  downwardPass();
119 
120  //For all panels on the finest level
121  //for (Panel* panel : levels_[maxLevel_])
122  //{
123  //For all dipoles on the finest level
124  //for (Dipole* iD : panel->getDipoles())
125  //{
126  // Add a multipole in the domain
127  //Multipole* multipole = new Multipole(iD->getP, iD->getSquaredFactorials, iD->getLocation());
128  //panel->multipoles_.push_back(multipole);
129 
130  // Construct a sphere
131  //Sphere* sphere = new Sphere(panel, iD->getLocation(), iD, multipole);
132 
133  // Add the sphere to the list of spheres and to the panel list
134  //spheres_.push_back(sphere);
135  //spheres_.push_back(sphere);
136  //}
137  //}
138 
139  //***********************************
140  //* Compue Mirror Multipoles *
141  //***********************************
142 
143 
144  // Compute k order mirrors
145  for (int i = 1; k <= i; i++)
146  {
147  //For all panels on the finest level
148  for (Panel* panel : levels_[maxLevel_])
149  {
150  // For all spheres: add a new multipole to the centre of a sphere to compensate
151  for (Sphere* sphere : panel->getSpheres())
152  {
153  std::vector<std::complex<Mdouble>> localExpansionAroundSphere;
154  //Vec3D sphereCentre = sphere->getLocation();
155 
156  // Compute panel local expansion around sphere
157  //localExpansionAroundSphere = panel->localExpansionAroundCentre_->translateLocalExpansion(sphereCentre);
158 
159  // Compute other sphere local expansion around sphere
160  for (Sphere* sphereOther: spheres_)
161  {
162  if (sphereOther != sphere)
163  {
164  // todo: implement this shizzle
165  //localExpansionAroundSphere += sphereOther->multipole_->convertMultipoleToLocal(sphereCentre);
166  }
167  }
168  // Compute multipole
169  size_t nTerms = (p_ + 1) * (p_ + 1);
170  NumericalVector<std::complex<Mdouble>> multipoleExpansionCoefficients(nTerms);
171  //for (int n = 0; n <= p_; n++)
172  //{
173  //for (int m = -n; m <= n; m++)
174  //{
175  //int location = n * n + (m + n);
176  //multipoleExpansionCoefficients[location] = localExpansionAroundSphere[0]*n/(n+1)*std::pow(sphere->getRadius,2n+1);
177  //}
178  //}
179  //sphere->multipole_->setExpansionCoefficients(multipoleExpansionCoefficients);
180  }
181  }
182 
183  //Perform and upward and downward pass to compute the new coefficients
184  upwardPass();
185  downwardPass();
186  }
187 
188 
189 }
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:68
void upwardPass()
Definition: Box.cc:44
std::vector< Sphere * > spheres_
Definition: Box.h:64
Definition: NumericalVector.h:64
Definition: Panel.h:43
Definition: Sphere.h:35
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51

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

◆ downwardPass()

void Box::downwardPass ( )
69 {
70  logger(INFO, "============================\n"
71  "Starting the downward pass.\n", Flusher::NO_FLUSH);
72  //Set the first part of the local expansion to zero: everything is in the interaction list or closer
73  NumericalVector<std::complex<Mdouble>> localExpansionCoefficients;
74  for (Panel* panel: levels_[1])
75  {
76  panel->setLocalExpansionZero();
77  }
78 
79  // Compute all local expansions for intermediate levels
80  for (int iL = 1; iL < maxLevel_; iL++)
81  {
82  logger(INFO, "Computing nearby Local Expansions on level %.\n", iL, Flusher::NO_FLUSH);
83  for (Panel* panel: levels_[iL])
84  {
85  panel->computePartialLocalExpansion();
86  panel->computeLocalExpansion();
87 
88  }
89 
90  logger(INFO, "Translating local expansions to children\n", Flusher::NO_FLUSH);
91  for (Panel* panel: levels_[iL])
92  {
93  panel->translateLocalExpansion();
94  }
95  }
96 
97  // Compute local expansions for the remaining interaction list on the finest level
98  logger(INFO, "Computing nearby local expansions on finest level\n", Flusher::NO_FLUSH);
99  for (Panel* panel : levels_[maxLevel_])
100  {
101  panel->computePartialLocalExpansion();
102  panel->computeLocalExpansion();
103  }
104 
105  logger(INFO, "Finished downward pass.");
106 }

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

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

◆ getMaxLevel()

int Box::getMaxLevel ( )
inline
45  {
46  return maxLevel_;
47  }

References maxLevel_.

◆ getNrPanelsOnLevel()

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

References levels_.

◆ getNumberOfTerms()

int Box::getNumberOfTerms ( )
inline
56  {
57  return p_;
58  }

References p_.

Referenced by Panel::Panel().

◆ upwardPass()

void Box::upwardPass ( )
45 {
46  // Perform a multipole expansion about the centre of all panels located on the finest mesh
47  logger(INFO, "============================\n"
48  "Starting the upward pass\n"
49  "Computing multipole expansion on finest level\n", Flusher::NO_FLUSH);
50  for (Panel* panel: levels_[maxLevel_])
51  {
52  panel->computeMultipoleExpansion();
53  }
54 
55  // Perform an upward pass, each level combine the previous level multipole expansions by shifting them to the centre of the current panel
56  for (int iL = maxLevel_ - 1; iL >= 0; iL--)
57  {
58  logger(INFO, "Shifting multipole expansions on level %.\n", iL, Flusher::NO_FLUSH);
59  for (Panel* panel: levels_[iL])
60  {
61  panel->translateMultipoleExpansion();
62  }
63  }
64  logger(INFO, "Finished upward pass.");
65 
66 }

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: