Program Listing for File gravity.hpp
↰ Return to documentation for file (gravity/gravity.hpp
)
// ***********************************************************************************
// Idefix MHD astrophysical code
// Copyright(C) 2020-2022 Geoffroy R. J. Lesur <geoffroy.lesur@univ-grenoble-alpes.fr>
// and other code contributors
// Licensed under CeCILL 2.1 License, see COPYING for more information
// ***********************************************************************************
#ifndef GRAVITY_GRAVITY_HPP_
#define GRAVITY_GRAVITY_HPP_
#include "idefix.hpp"
#include "input.hpp"
// Forward class hydro declaration
class Hydro;
class DataBlock;
// Enrolled functions signature
using GravPotentialFunc = void (*) (DataBlock &, const real t, IdefixArray1D<real>&,
IdefixArray1D<real>&, IdefixArray1D<real>&,
IdefixArray3D<real> &);
using BodyForceFunc = void (*) (DataBlock &, const real t, IdefixArray4D<real>&);
class Gravity {
public:
void Init(Input &, DataBlock*);
void ComputeGravity();
void EnrollPotential(GravPotentialFunc);
void EnrollBodyForce(BodyForceFunc);
void ResetPotential();
void AddCentralMassPotential();
void ShowConfig();
bool havePotential{false};
bool haveUserDefPotential{false};
bool haveCentralMassPotential{false};
bool havePlanetsPotential{false};
bool haveSelfGravityPotential{false};
bool haveBodyForce{false};
// Gravitational potential
IdefixArray3D<real> phiP;
// Bodyforce
IdefixArray4D<real> bodyForceVector;
private:
bool haveInitialisedPotential{false};
bool haveInitialisedBodyForce{false};
real centralMass;
DataBlock *data;
// User defined gravitational potential
GravPotentialFunc gravPotentialFunc{NULL};
// Body force
BodyForceFunc bodyForceFunc{NULL};
};
#endif // GRAVITY_GRAVITY_HPP_