SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/NewtonianEuler/Sources - LaneEmdenGravitationalField.cpp Hit Total Coverage
Commit: 2db722c93a8e9b106e406b439b79c8e05c2057fb Lines: 1 2 50.0 %
Date: 2021-03-03 22:01:00
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : #include "Evolution/Systems/NewtonianEuler/Sources/LaneEmdenGravitationalField.hpp"
       5             : 
       6             : #include <cstddef>
       7             : 
       8             : #include "DataStructures/DataVector.hpp"
       9             : #include "DataStructures/Tensor/EagerMath/DotProduct.hpp"
      10             : #include "DataStructures/Tensor/Tensor.hpp"
      11             : #include "PointwiseFunctions/AnalyticSolutions/NewtonianEuler/LaneEmdenStar.hpp"
      12             : #include "Utilities/Gsl.hpp"
      13             : 
      14             : // IWYU pragma: no_include <array>
      15             : 
      16             : // IWYU pragma: no_forward_declare Tensor
      17             : 
      18             : namespace NewtonianEuler {
      19           1 : namespace Sources {
      20             : 
      21             : void LaneEmdenGravitationalField::apply(
      22             :     const gsl::not_null<tnsr::I<DataVector, 3>*> source_momentum_density,
      23             :     const gsl::not_null<Scalar<DataVector>*> source_energy_density,
      24             :     const Scalar<DataVector>& mass_density_cons,
      25             :     const tnsr::I<DataVector, 3>& momentum_density,
      26             :     const NewtonianEuler::Solutions::LaneEmdenStar& star,
      27             :     const tnsr::I<DataVector, 3>& x) noexcept {
      28             :   const auto gravitational_field = star.gravitational_field(x);
      29             :   for (size_t i = 0; i < 3; ++i) {
      30             :     source_momentum_density->get(i) =
      31             :         get(mass_density_cons) * gravitational_field.get(i);
      32             :   }
      33             :   *source_energy_density = dot_product(momentum_density, gravitational_field);
      34             : }
      35             : 
      36             : }  // Namespace Sources
      37             : }  // namespace NewtonianEuler

Generated by: LCOV version 1.14