LCOV - code coverage report
Current view: top level - models/abm - location.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 13 13 100.0 %
Date: 2025-02-17 13:46:44 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /* 
       2             : * Copyright (C) 2020-2025 MEmilio
       3             : *
       4             : * Authors: Daniel Abele, Elisabeth Kluth, Carlotta Gerstein, Martin J. Kuehn, Khoa Nguyen, David Kerkmann
       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/location_type.h"
      21             : #include "abm/intervention_type.h"
      22             : #include "abm/location.h"
      23             : #include "abm/random_events.h"
      24             : 
      25             : namespace mio
      26             : {
      27             : namespace abm
      28             : {
      29             : 
      30        1426 : Location::Location(LocationType loc_type, LocationId loc_id, size_t num_agegroups, int model_id, uint32_t num_cells)
      31        1426 :     : m_type(loc_type)
      32        1426 :     , m_id(loc_id)
      33        1426 :     , m_parameters(num_agegroups)
      34        1426 :     , m_cells(num_cells)
      35        1426 :     , m_required_mask(MaskType::None)
      36        1426 :     , m_model_id(model_id)
      37             : {
      38        1426 :     assert(num_cells > 0 && "Number of cells has to be larger than 0.");
      39        1426 : }
      40             : 
      41             : /*
      42             : For every cell in a location we have a transmission factor that is nomalized to m_capacity.volume / m_capacity.persons of 
      43             : the location "Home", which is 66. We multiply this rate with the individual size of each cell to obtain a "space per person" factor.
      44             : */
      45          27 : ScalarType Cell::compute_space_per_person_relative() const
      46             : {
      47          27 :     if (m_capacity.volume != 0) {
      48          18 :         return 66.0 / m_capacity.volume;
      49             :     }
      50             :     else {
      51           9 :         return 1.0;
      52             :     }
      53             : }
      54             : 
      55             : } // namespace abm
      56             : } // namespace mio

Generated by: LCOV version 1.14