LCOV - code coverage report
Current view: top level - models/abm - simulation.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 10 10 100.0 %
Date: 2024-11-18 12:45:26 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /* 
       2             : * Copyright (C) 2020-2024 MEmilio
       3             : *
       4             : * Authors: Daniel Abele, Khoa Nguyen
       5             : *
       6             : * Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
       7             : *
       8             : * Licensed under the Apache License, Version 2.0 (the "License");
       9             : * you may not use this file except in compliance with the License.
      10             : * You may obtain a copy of the License at
      11             : *
      12             : *     http://www.apache.org/licenses/LICENSE-2.0
      13             : *
      14             : * Unless required by applicable law or agreed to in writing, software
      15             : * distributed under the License is distributed on an "AS IS" BASIS,
      16             : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      17             : * See the License for the specific language governing permissions and
      18             : * limitations under the License.
      19             : */
      20             : #include "abm/simulation.h"
      21             : 
      22             : namespace mio
      23             : {
      24             : namespace abm
      25             : {
      26             : 
      27          27 : Simulation::Simulation(TimePoint t, Model&& model)
      28          27 :     : m_model(std::move(model))
      29          27 :     , m_t(t)
      30          27 :     , m_dt(hours(1))
      31             : {
      32          27 : }
      33             : 
      34         666 : void Simulation::evolve_model(TimePoint tmax)
      35             : {
      36         666 :     auto dt = std::min(m_dt, tmax - m_t);
      37         666 :     m_model.evolve(m_t, dt);
      38         666 :     m_t += m_dt;
      39         666 : }
      40             : 
      41             : } // namespace abm
      42             : } // namespace mio

Generated by: LCOV version 1.14