VPTissue Reference Manual
cell2cell_transport/TestCoupling.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.h"
21 
22 #include "../ComponentFactory.h"
23 #include "bio/Cell.h"
24 #include "bio/Wall.h"
25 #include "model/ComponentTraits.h"
26 
27 #include <boost/property_tree/ptree.hpp>
28 
29 namespace SimPT_Default {
30 namespace CellToCellTransport {
31 
32 using namespace std;
33 using namespace SimPT_Sim;
34 using namespace boost::property_tree;
35 using namespace SimPT_Sim::Util;
36 
38 {
39  Initialize(cd);
40 }
41 
43 {
44  m_cd = cd;
45 
46  auto& p = m_cd.m_parameters;
47  m_chemical_count = p->get<unsigned int>("model.cell_chemical_count");
48 
49  //m_d = p->get<double>("test_coupling.D[0]");
50  ptree const& arr_D = p->get_child("auxin_transport.D.value_array");
51  unsigned int c = 0;
52  for (auto it = arr_D.begin(); it != arr_D.end(); it++) {
53  if (c == m_chemical_count) {
54  break;
55  }
56  m_D.push_back(it->second.get_value<double>());
57  c++;
58  }
59  // Defensive: if fewer than chemical_count parameters were specified, fill up.
60  for (unsigned int i = c; i < m_chemical_count; i++) {
61  m_D.push_back(0.0);
62  }
63 
64  m_has_boundary_condition = false;
65 
66  if (p->get<std::string>( ComponentTraits<CellToCellTransportBoundaryTag>::Label(),"") != "") {
67  m_has_boundary_condition = true;
68  m_boundary_condition = ComponentFactory::CreateCellToCellTransportBoundary(cd);
69  if (m_boundary_condition == nullptr) {
70  throw runtime_error("TestCoupling::Initialize> nullptr for cell2cell_transport boundary codition.");
71  }
72  }
73 
74 }
75 
76 void TestCoupling::operator()(Wall* w, double* dchem_c1, double* dchem_c2)
77 {
78  if ( !(w->GetC1()->IsBoundaryPolygon()) && !(w->GetC2()->IsBoundaryPolygon()) ) {
79  const double apoplast_thickness = 1.;
80 
81  const double phi = (w->GetLength() / apoplast_thickness) * m_D[0]
82  * ( ( w->GetC2()->GetChemical(0) / (w->GetC2()->GetArea()) )
83  - ( w->GetC1()->GetChemical(0) / (w->GetC1()->GetArea()) ) ); //LEVELS!
84 
85  dchem_c1[0] += phi; //LEVELS!
86  dchem_c2[0] -= phi; //LEVELS!
87 
88  //DDV2012: diffusive hormone - chemical '1'
89  const double phi2 = (w->GetLength() / apoplast_thickness) * m_D[1]
90  * ( ( w->GetC2()->GetChemical(1) / (w->GetC2()->GetArea()) )
91  - ( w->GetC1()->GetChemical(1) / (w->GetC1()->GetArea()) ) ); //LEVELS!
92 
93  dchem_c1[1] += phi2 ; //LEVELS!
94  dchem_c2[1] -= phi2 ; //LEVELS!
95  } else {
96  if (m_has_boundary_condition) {
97  m_boundary_condition(w, dchem_c1, dchem_c2);
98  }
99  }
100 }
101 
102 } // namespace
103 } // 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
CellToCellTransport component for the TestCoupling model.
Namespace for components of the Default model group.
Namespace for the core simulator.
Interface for Cell.
TestCoupling(const CoreData &cd)
Initializing constructor.
void operator()(Wall *w, double *dchem_c1, double *dchem_c2)
Execute.
Primary template never gets instantiated.
static CellToCellTransportBoundaryComponent CreateCellToCellTransportBoundary(const CoreData &cd)
Create CellToCellTransportBoundaryFunction (internal use).
double GetLength() const
Returns (and calculates, if length marked as dirty) the length along all nodes.
Definition: Wall.cpp:97
void Initialize(const CoreData &cd)
Initialize or re-initialize.
Model component .
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.