improved_center_gravity.cpp
2 
4 (double M,double Rmin,const Vector2D& center,double Rsoft):
5  M_(M),Rmin_(Rmin),center_(center),Rsoft_(Rsoft){}
6 
7 Vector2D ImprovedCenterGravity::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  if(r>Rsoft_)
18  return (-1)*pos*M_ / (r*r*r);
19  else
20  return (-1)*pos*M_/(r*r*r+Rmin_*Rmin_*Rmin_);
21 }
22 
24 {
25  return center_;
26 }
Abstract class for tessellation.
virtual Vector2D const & GetCellCM(int index) const =0
Returns Position of Cell&#39;s CM.
Class for keeping the names of the tracers and stickers.
Point source gravity force.
double abs(Vector3D const &v)
Norm of a vector.
Definition: Vector3D.cpp:44
2D Mathematical vector
Definition: geometry.hpp:15
Vector2D const & get_center(void) const
Returns the position of the center.
ImprovedCenterGravity(double M, double Rmin, const Vector2D &center, double Rsoft=0)
Class constructor.