SeveralSources.cpp
1 #include "SeveralSources.hpp"
2 
3 SeveralSources::SeveralSources(vector<SourceTerm*> sources) :
4  sources_(sources) {}
5 
7 
8 vector<Extensive> SeveralSources::operator()
9 (const Tessellation& tess,
10  const PhysicalGeometry& pg,
11  const CacheData& cd,
12  const vector<ComputationalCell>& cells,
13  const vector<Extensive>& fluxes,
14  const vector<Vector2D>& point_velocities,
15  const double t,
16  TracerStickerNames const& tracerstickernames) const
17 {
18  vector<Extensive> res(static_cast<size_t>(tess.GetPointNo()));
19  size_t ntracer = cells[0].tracers.size();
20  for (size_t i = 0; i < res.size(); ++i)
21  {
22  res[i].mass = 0;
23  res[i].momentum = Vector2D(0, 0);
24  res[i].energy = 0;
25  res[i].tracers = cells[0].tracers;
26  for (size_t j = 0; j < ntracer; ++j)
27  res[i].tracers[j] = 0;
28  }
29  for (size_t i = 0; i < sources_.size(); ++i)
30  {
31  const vector<Extensive> diff = (*sources_[i])
32  (tess, pg, cd, cells, fluxes, point_velocities, t,tracerstickernames);
33  for (size_t j = 0; j < res.size(); ++j)
34  {
35  res[j].mass += diff[j].mass;
36  res[j].momentum += diff[j].momentum;
37  res[j].energy += diff[j].energy;
38  for (size_t k = 0; k < ntracer; ++k)
39  res[j].tracers[k] += diff[j].tracers[k];
40  }
41  }
42  return res;
43 }
Abstract class for tessellation.
virtual int GetPointNo(void) const =0
Get Total number of mesh generating points.
Class for a combination of external sources.
SeveralSources(vector< SourceTerm *> forces)
Class constructor.
~SeveralSources(void)
Class destructor.
Container for cache data.
Definition: cache_data.hpp:14
Class for keeping the names of the tracers and stickers.
2D Mathematical vector
Definition: geometry.hpp:15
Base class for physical geometry.