LCOV - code coverage report
Current view: top level - models/abm - location.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 12 12 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, 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        1360 : Location::Location(LocationType loc_type, LocationId loc_id, size_t num_agegroups, uint32_t num_cells)
      31        1360 :     : m_type(loc_type)
      32        1360 :     , m_id(loc_id)
      33        1360 :     , m_parameters(num_agegroups)
      34        1360 :     , m_cells(num_cells)
      35        1360 :     , m_required_mask(MaskType::None)
      36             : {
      37        1360 :     assert(num_cells > 0 && "Number of cells has to be larger than 0.");
      38        1360 : }
      39             : 
      40             : /*
      41             : For every cell in a location we have a transmission factor that is nomalized to m_capacity.volume / m_capacity.persons of 
      42             : the location "Home", which is 66. We multiply this rate with the individual size of each cell to obtain a "space per person" factor.
      43             : */
      44          27 : ScalarType Cell::compute_space_per_person_relative() const
      45             : {
      46          27 :     if (m_capacity.volume != 0) {
      47          18 :         return 66.0 / m_capacity.volume;
      48             :     }
      49             :     else {
      50           9 :         return 1.0;
      51             :     }
      52             : }
      53             : 
      54             : } // namespace abm
      55             : } // namespace mio

Generated by: LCOV version 1.14