VPTissue Reference Manual
TestCoupling_I.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_I.h"
21 
22 #include "bio/Cell.h"
23 #include "bio/Wall.h"
24 
25 namespace SimPT_Default {
26 namespace CellToCellTransportBoundary{
27 
28 using namespace std;
29 using namespace SimPT_Sim;
30 using namespace boost::property_tree;
31 using namespace SimPT_Sim::Util;
32 
34 {
35  Initialize(cd);
36 }
37 
39 {
40  m_cd = cd;
41 }
42 
43 void TestCoupling_I::operator()(Wall* w, double* dchem_c1, double* dchem_c2)
44 {
45  auto& transfer_map = m_cd.m_coupled_sim_transfer_data;
46  double transfer_value = 0.0;
47 
48  if (w->GetC1()->IsBoundaryPolygon()) {
49  auto it = transfer_map->find(w->GetC2()->GetIndex());
50  if (it != transfer_map->end()) {
51  transfer_value = get<0>(it->second);
52  double D_coupling = get<1>(it->second);
53  dchem_c2[0] += w->GetLength() * D_coupling *
54  ( transfer_value - ( w->GetC2()->GetChemical(0)) / w->GetC2()->GetArea() ) ;
55  }
56  } else if (w->GetC2()->IsBoundaryPolygon()) {
57  auto it = transfer_map->find(w->GetC1()->GetIndex());
58  if (it != transfer_map->end()) {
59  transfer_value = get<0>(it->second);
60  double D_coupling = get<1>(it->second);
61  dchem_c1[0] += w->GetLength() * D_coupling *
62  ( transfer_value - ( w->GetC1()->GetChemical(0)) / w->GetC1()->GetArea() ) ;
63  }
64  }
65 }
66 
67 } // namespace
68 } // namespace
Core data with mesh, parameters, random engine and time data.
Definition: CoreData.h:38
STL namespace.
Namespace for miscellaneous utilities.
Definition: PTreeFile.cpp:44
void operator()(Wall *w, double *dchem_c1, double *dchem_c2)
Execute.
Namespace for components of the Default model group.
Namespace for the core simulator.
CellToCellTransportBoundary component for the TestCoupling model.
Interface for Cell.
void Initialize(const CoreData &cd)
Initialize or re-initialize.
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_I(const CoreData &cd)
Initializing constructor.
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.