VPTissue Reference Manual
TestCoupling_II.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Universiteit Antwerpen
3  *
4  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
5  * the European Commission - subsequent versions of the EUPL (the "Licence");
6  * You may not use this work except in compliance with the Licence.
7  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the Licence is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the Licence for the specific language governing
13  * permissions and limitations under the Licence.
14  */
20 #include "TestCoupling_II.h"
21 
22 #include "bio/Cell.h"
23 #include "bio/Wall.h"
24 #include "util/misc/Exception.h"
25 #include "util/misc/log_debug.h"
26 
27 namespace SimPT_Default {
28 namespace CellToCellTransportBoundary {
29 
30 using namespace std;
31 using namespace SimPT_Sim;
32 using namespace boost::property_tree;
33 using namespace SimPT_Sim::Util;
34 
35 
36 
38 {
39  Initialize(cd);
40 }
41 
43 {
44  m_cd = cd;
45 }
46 
47 void TestCoupling_II::operator()(Wall* w, double* dchem_c1, double* dchem_c2)
48 {
49  auto& transfer_map = m_cd.m_coupled_sim_transfer_data;
50  double transfer_value = 0.0;
51 
52  if (w->GetC1()->IsBoundaryPolygon()) {
53  auto it = transfer_map->find(w->GetC2()->GetIndex());
54  if (it != transfer_map->end()) {
55  transfer_value = get<0>(it->second);
56  double D_coupling = get<1>(it->second);
57  dchem_c2[1] += w->GetLength() * D_coupling *
58  ( transfer_value - ( w->GetC2()->GetChemical(1)) / w->GetC2()->GetArea() ) ;
59  }
60  } else if (w->GetC2()->IsBoundaryPolygon()) {
61  auto it = transfer_map->find(w->GetC1()->GetIndex());
62  if (it != transfer_map->end()) {
63  transfer_value = get<0>(it->second);
64  double D_coupling = get<1>(it->second);
65  dchem_c1[1] += w->GetLength() * D_coupling *
66  ( transfer_value - ( w->GetC1()->GetChemical(1)) / w->GetC1()->GetArea() ) ;
67  }
68  }
69 }
70 
71 } // namespace
72 } // namespace
Core data with mesh, parameters, random engine and time data.
Definition: CoreData.h:38
STL namespace.
void operator()(Wall *w, double *dchem_c1, double *dchem_c2)
Execute.
Namespace for miscellaneous utilities.
Definition: PTreeFile.cpp:44
CellToCellTransportBoundary component for the TestCoupling model.
void Initialize(const CoreData &cd)
Initialize or re-initialize.
Namespace for components of the Default model group.
Namespace for the core simulator.
Interface for Cell.
Macro defs for debug and logging.
int GetIndex() const
Return the index.
Definition: Cell.h:76
double GetLength() const
Returns (and calculates, if length marked as dirty) the length along all nodes.
Definition: Wall.cpp:97
TestCoupling_II(const CoreData &cd)
Initializing constructor.
Header file for Exception class.
double GetArea() const
Return the area of the cell.
Definition: Cell.cpp:178
A cell wall, runs between cell corner points and consists of wall elements.
Definition: Wall.h:48
Interface for Wall.