CenterGravity.cpp
1 #include "CenterGravity.hpp"
2 
4 (double M, double Rmin, const Vector2D& center):
5  M_(M),Rmin_(Rmin),center_(center){}
6 
7 Vector2D CenterGravity::operator()
8 (const Tessellation& tess,
9  const vector<ComputationalCell>& /*cells*/,
10  const vector<Extensive>& /*fluxes*/,
11  const double /*time*/,
12  const int point,
13  TracerStickerNames const& /*tracerstickernames*/) const
14 {
15  const Vector2D pos(tess.GetCellCM(point)-center_);
16  const double r = abs(pos);
17  return (-1)*pos*M_/(r*r*r+Rmin_*Rmin_*Rmin_);
18 }
Abstract class for tessellation.
virtual Vector2D const & GetCellCM(int index) const =0
Returns Position of Cell&#39;s CM.
Point source gravity force.
Class for keeping the names of the tracers and stickers.
CenterGravity(double M, double Rmin, const Vector2D &center)
Class constructor.
double abs(Vector3D const &v)
Norm of a vector.
Definition: Vector3D.cpp:44
2D Mathematical vector
Definition: geometry.hpp:15