VPTissue Reference Manual
hamiltonian/PlainGC.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 "PlainGC.h"
21 
22 #include "HHelper.h"
23 #include "bio/Cell.h"
24 #include "sim/CoreData.h"
25 
26 #include <cassert>
27 
28 using namespace std;
29 using namespace boost::property_tree;
30 using namespace SimPT_Sim;
31 
32 namespace SimPT_Default {
33 namespace Hamiltonian {
34 
35 PlainGC::PlainGC(const CoreData& cd)
36 {
37  assert( cd.Check() && "CoreData not ok in PlainGC Hamiltonian");
38  Initialize(cd);
39 }
40 
41 void PlainGC::Initialize(const CoreData& cd)
42 {
43  const auto& p = cd.m_parameters->get_child("cell_mechanics");
44 
45  m_lambda_bend = p.get<double>("lambda_bend");
46  m_lambda_cell_length = p.get<double>("lambda_celllength");
47  m_lambda_length = p.get<double>("lambda_length");
48  m_rp_stiffness = p.get<double>("relative_perimeter_stiffness");
49  m_target_node_distance = p.get<double>("target_node_distance");
50 }
51 
52 double PlainGC::operator()(Cell* cell)
53 {
54  double h = 0.0;
55 
56  if (!cell->IsBoundaryPolygon()) {
57 
58  // --------------------------------------------------------------------------------------------
59  // Cell area constraint:
60  // --------------------------------------------------------------------------------------------
61  h += pow(cell->GetArea() - cell->GetTargetArea(), 2);
62 
63  // --------------------------------------------------------------------------------------------
64  // Edge length constraint:
65  // --------------------------------------------------------------------------------------------
66  h += m_lambda_length * HHelper::EdgeTerm(cell, m_rp_stiffness, m_target_node_distance);
67 
68  // --------------------------------------------------------------------------------------------
69  // Cell length constraint:
70  // --------------------------------------------------------------------------------------------
71  if (abs(m_lambda_cell_length) > 1.0e-7) {
72  h += m_lambda_cell_length * HHelper::CellLengthTerm(cell);
73  }
74  }
75 
76  // --------------------------------------------------------------------------------------------
77  // Vertex bending constraint
78  // --------------------------------------------------------------------------------------------
79  if (abs(m_lambda_bend) > 1.0e-7) {
80  h += m_lambda_bend * HHelper::BendingTerm(cell);
81  }
82 
83  return h;
84 }
85 
86 } // namespace
87 } // namespace
Core data with mesh, parameters, random engine and time data.
Definition: CoreData.h:38
STL namespace.
A cell contains walls and nodes.
Definition: Cell.h:48
Core data used during model execution.
Interface for Hamiltonian PlainGC component.
Interface/Implementation for Hamiltonian::HHelper.
Namespace for components of the Default model group.
Namespace for the core simulator.
Interface for Cell.
double GetArea() const
Return the area of the cell.
Definition: Cell.cpp:178
bool Check() const
Verify all pointers non-null.
Definition: CoreData.h:53