NagaiHondaDifferentialAdhesionForce.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #include "NagaiHondaDifferentialAdhesionForce.hpp"
00037 #include "CellLabel.hpp"
00038
00039 template<unsigned DIM>
00040 NagaiHondaDifferentialAdhesionForce<DIM>::NagaiHondaDifferentialAdhesionForce()
00041 : NagaiHondaForce<DIM>(),
00042 mNagaiHondaLabelledCellLabelledCellAdhesionEnergyParameter(1.0),
00043 mNagaiHondaLabelledCellCellAdhesionEnergyParameter(1.0),
00044 mNagaiHondaLabelledCellBoundaryAdhesionEnergyParameter(1.0)
00045 {
00046 }
00047
00048 template<unsigned DIM>
00049 NagaiHondaDifferentialAdhesionForce<DIM>::~NagaiHondaDifferentialAdhesionForce()
00050 {
00051 }
00052
00053 template<unsigned DIM>
00054 double NagaiHondaDifferentialAdhesionForce<DIM>::GetAdhesionParameter(Node<DIM>* pNodeA,
00055 Node<DIM>* pNodeB,
00056 VertexBasedCellPopulation<DIM>& rVertexCellPopulation)
00057 {
00058
00059 std::set<unsigned> elements_containing_nodeA = pNodeA->rGetContainingElementIndices();
00060 std::set<unsigned> elements_containing_nodeB = pNodeB->rGetContainingElementIndices();
00061
00062
00063 std::set<unsigned> shared_elements;
00064 std::set_intersection(elements_containing_nodeA.begin(),
00065 elements_containing_nodeA.end(),
00066 elements_containing_nodeB.begin(),
00067 elements_containing_nodeB.end(),
00068 std::inserter(shared_elements, shared_elements.begin()));
00069
00070
00071 assert(!shared_elements.empty());
00072
00073
00074 if (shared_elements.size() == 1)
00075 {
00076 unsigned element_index = *(shared_elements.begin());
00077
00078
00079 CellPtr p_cell = rVertexCellPopulation.GetCellUsingLocationIndex(element_index);
00080
00081 if (p_cell->template HasCellProperty<CellLabel>())
00082 {
00083
00084 return this->GetNagaiHondaLabelledCellBoundaryAdhesionEnergyParameter();
00085 }
00086 else
00087 {
00088
00089 return this->GetNagaiHondaCellBoundaryAdhesionEnergyParameter();
00090 }
00091 }
00092 else
00093 {
00094
00095 unsigned num_labelled_cells = 0;
00096 for (std::set<unsigned>::iterator iter = shared_elements.begin();
00097 iter != shared_elements.end();
00098 ++iter)
00099 {
00100 unsigned element_index = *(iter);
00101
00102
00103 CellPtr p_cell = rVertexCellPopulation.GetCellUsingLocationIndex(element_index);
00104
00105 if (p_cell->template HasCellProperty<CellLabel>())
00106 {
00107 num_labelled_cells++;
00108 }
00109 }
00110
00111 if (num_labelled_cells == 2)
00112 {
00113
00114 return this->GetNagaiHondaLabelledCellLabelledCellAdhesionEnergyParameter();
00115 }
00116 else if (num_labelled_cells == 1)
00117 {
00118
00119 return this->GetNagaiHondaLabelledCellCellAdhesionEnergyParameter();
00120 }
00121 else
00122 {
00123
00124 assert(num_labelled_cells == 0);
00125 return this->GetNagaiHondaCellCellAdhesionEnergyParameter();
00126 }
00127 }
00128 }
00129
00130 template<unsigned DIM>
00131 double NagaiHondaDifferentialAdhesionForce<DIM>::GetNagaiHondaLabelledCellCellAdhesionEnergyParameter()
00132 {
00133 return mNagaiHondaLabelledCellCellAdhesionEnergyParameter;
00134 }
00135
00136 template<unsigned DIM>
00137 double NagaiHondaDifferentialAdhesionForce<DIM>::GetNagaiHondaLabelledCellLabelledCellAdhesionEnergyParameter()
00138 {
00139 return mNagaiHondaLabelledCellLabelledCellAdhesionEnergyParameter;
00140 }
00141
00142 template<unsigned DIM>
00143 double NagaiHondaDifferentialAdhesionForce<DIM>::GetNagaiHondaLabelledCellBoundaryAdhesionEnergyParameter()
00144 {
00145 return mNagaiHondaLabelledCellBoundaryAdhesionEnergyParameter;
00146 }
00147
00148 template<unsigned DIM>
00149 void NagaiHondaDifferentialAdhesionForce<DIM>::SetNagaiHondaLabelledCellCellAdhesionEnergyParameter(double labelledCellCellAdhesionEnergyParameter)
00150 {
00151 mNagaiHondaLabelledCellCellAdhesionEnergyParameter = labelledCellCellAdhesionEnergyParameter;
00152 }
00153
00154 template<unsigned DIM>
00155 void NagaiHondaDifferentialAdhesionForce<DIM>::SetNagaiHondaLabelledCellLabelledCellAdhesionEnergyParameter(double labelledCellLabelledCellAdhesionEnergyParameter)
00156 {
00157 mNagaiHondaLabelledCellLabelledCellAdhesionEnergyParameter = labelledCellLabelledCellAdhesionEnergyParameter;
00158 }
00159
00160 template<unsigned DIM>
00161 void NagaiHondaDifferentialAdhesionForce<DIM>::SetNagaiHondaLabelledCellBoundaryAdhesionEnergyParameter(double labelledCellBoundaryAdhesionEnergyParameter)
00162 {
00163 mNagaiHondaLabelledCellBoundaryAdhesionEnergyParameter = labelledCellBoundaryAdhesionEnergyParameter;
00164 }
00165
00166 template<unsigned DIM>
00167 void NagaiHondaDifferentialAdhesionForce<DIM>::OutputForceParameters(out_stream& rParamsFile)
00168 {
00169
00170 *rParamsFile << "\t\t\t<NagaiHondaLabelledCellLabelledCellAdhesionEnergyParameter>" << mNagaiHondaLabelledCellLabelledCellAdhesionEnergyParameter << "</NagaiHondaLabelledCellLabelledCellAdhesionEnergyParameter> \n";
00171 *rParamsFile << "\t\t\t<NagaiHondaLabelledCellCellAdhesionEnergyParameter>" << mNagaiHondaLabelledCellCellAdhesionEnergyParameter << "</NagaiHondaLabelledCellCellAdhesionEnergyParameter> \n";
00172 *rParamsFile << "\t\t\t<NagaiHondaLabelledCellBoundaryAdhesionEnergyParameter>" << mNagaiHondaLabelledCellBoundaryAdhesionEnergyParameter << "</NagaiHondaLabelledCellBoundaryAdhesionEnergyParameter> \n";
00173
00174
00175 NagaiHondaForce<DIM>::OutputForceParameters(rParamsFile);
00176 }
00177
00179
00181
00182 template class NagaiHondaDifferentialAdhesionForce<1>;
00183 template class NagaiHondaDifferentialAdhesionForce<2>;
00184 template class NagaiHondaDifferentialAdhesionForce<3>;
00185
00186
00187 #include "SerializationExportWrapperForCpp.hpp"
00188 EXPORT_TEMPLATE_CLASS_SAME_DIMS(NagaiHondaDifferentialAdhesionForce)