30 int n_spacetime_dimensions_)
31 :
n_fields(potential_.get_number_of_fields())
32 , n_spacetime_dimensions(n_spacetime_dimensions_)
33 , potential(&potential_)
34 , profiles(&profiles_)
39 const Eigen::VectorXd& x, Eigen::VectorXd& dxdt,
double rho)
const 42 throw Domain_error(
"Perturbations_ODE_system::operator(): " 43 "spatial coordinate must be positive");
47 std::ostringstream msg;
48 msg <<
"Perturbations_ODE_system::operator(): " 49 <<
"perturbations contained a nan at rho = " << rho;
54 dxdt.resize(2 *
n_fields, Eigen::NoChange);
63 std::ostringstream msg;
64 msg <<
"Perturbations_ODE_system::operator(): " 65 <<
"derivatives contained a nan at rho = " << rho;
72 #if EIGEN_VERSION_AT_LEAST(3,2,0) 75 const int n = x.size();
76 for (
int i = 0; i < n; ++i) {
77 if (!std::isfinite(x(i))) {
88 using Index = Eigen::VectorXd::Index;
90 Eigen::VectorXd inh(Eigen::VectorXd::Zero(
n_fields));
93 for (Index i = 0; i <
n_fields; ++i) {
106 using Index = Eigen::MatrixXd::Index;
111 for (Index j = 0; j <
n_fields; ++j) {
112 for (Index i = j; i <
n_fields; ++i) {
118 for (Index j = 0; j <
n_fields; ++j) {
119 for (Index i = 0; i < j; ++i) {
120 mass_matrix(i, j) = mass_matrix(j, i);
contains the definition of the Field_profiles clas
double derivative_at(int field, int order, double rho) const
Take the radial derivative of a field at a given radius.
Exception indicating function evaluation out of allowed domain.
Perturbations_ODE_system(Potential &potential_, Field_profiles &profiles_, int n_spacetime_dimensions_)
Constructs the system of ODEs for the given potential.
virtual double partial(const Eigen::VectorXd &coords, int i) const =0
Partial derivative WRT coordinate i at a point.
Field_profiles * profiles
int n_spacetime_dimensions
bool is_finite(const Eigen::VectorXd &) const
Eigen::VectorXd calculate_inhomogeneities(double) const
Eigen::VectorXd evaluate_at(double rho) const
Get all field values at a given radius.
void operator()(const Eigen::VectorXd &eps, Eigen::VectorXd &depsdr, double r) const
Calculate the derivatives of the perturbations.
Eigen::MatrixXd calculate_mass_matrix(double) const
Abstract base class for a generic potential.
Exception indicating generic numerical error.
Discretized set of field profiles.