AbstractCardiacCellFactory.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 "AbstractCardiacCellFactory.hpp"
00037 #include "FakeBathCell.hpp"
00038 #include "AbstractCvodeCell.hpp"
00039 #include "HeartConfig.hpp"
00040
00041 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00042 AbstractCardiacCellInterface* AbstractCardiacCellFactory<ELEMENT_DIM,SPACE_DIM>::CreateCardiacCellForNode(
00043 Node<SPACE_DIM>* pNode)
00044 {
00045 if (HeartRegionCode::IsRegionBath( pNode->GetRegion() ))
00046 {
00047 return new FakeBathCell(this->mpSolver, this->mpZeroStimulus);
00048 }
00049 else
00050 {
00051 AbstractCardiacCellInterface* p_cell = CreateCardiacCellForTissueNode(pNode);
00052 #ifdef CHASTE_CVODE
00053 if (dynamic_cast<AbstractCvodeCell*>(p_cell))
00054 {
00055 #if CHASTE_SUNDIALS_VERSION >= 20400
00056
00057
00058
00059 static_cast<AbstractCvodeCell*>(p_cell)->SetMinimalReset(true);
00060 #endif // SUNDIALS_VERSION
00061
00062 static_cast<AbstractCvodeCell*>(p_cell)->SetTimestep(HeartConfig::Instance()->GetPdeTimeStep());
00063 }
00064 #endif // CHASTE_CVODE
00065 return p_cell;
00066 }
00067 }
00068
00069 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00070 void AbstractCardiacCellFactory<ELEMENT_DIM,SPACE_DIM>::FinaliseCellCreation(
00071 std::vector< AbstractCardiacCellInterface* >* pCellsDistributed,
00072 unsigned lo,
00073 unsigned hi)
00074 {
00075 }
00076
00077 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00078 void AbstractCardiacCellFactory<ELEMENT_DIM,SPACE_DIM>::FillInCellularTransmuralAreas()
00079 {
00080
00081 }
00082
00083 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00084 unsigned AbstractCardiacCellFactory<ELEMENT_DIM,SPACE_DIM>::GetNumberOfCells()
00085 {
00086 assert(mpMesh != NULL);
00087 return mpMesh->GetNumNodes();
00088 }
00089
00090 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00091 AbstractCardiacCellFactory<ELEMENT_DIM,SPACE_DIM>::AbstractCardiacCellFactory(
00092 boost::shared_ptr<AbstractIvpOdeSolver> pSolver)
00093 : mpMesh(NULL),
00094 mpHeartGeometryInformation(NULL),
00095 mpZeroStimulus(new ZeroStimulus),
00096 mpSolver(pSolver)
00097 {
00098 }
00099
00100 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00101 AbstractCardiacCellFactory<ELEMENT_DIM,SPACE_DIM>::~AbstractCardiacCellFactory()
00102 {
00103 }
00104
00105 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00106 void AbstractCardiacCellFactory<ELEMENT_DIM,SPACE_DIM>::SetMesh(AbstractTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>* pMesh)
00107 {
00108 mpMesh = pMesh;
00109 }
00110
00111 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00112 AbstractTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>* AbstractCardiacCellFactory<ELEMENT_DIM,SPACE_DIM>::GetMesh()
00113 {
00114 if (mpMesh == NULL)
00115 {
00116 EXCEPTION("The mesh object has not been set in the cell factory");
00117 }
00118 return mpMesh;
00119 }
00120
00121 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00122 void AbstractCardiacCellFactory<ELEMENT_DIM,SPACE_DIM>::SetHeartGeometryInformation(HeartGeometryInformation<SPACE_DIM>* pHeartGeometryInformation)
00123 {
00124 mpHeartGeometryInformation = pHeartGeometryInformation;
00125 }
00126
00127 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00128 HeartGeometryInformation<SPACE_DIM>* AbstractCardiacCellFactory<ELEMENT_DIM,SPACE_DIM>::GetHeartGeometryInformation()
00129 {
00130 if (mpHeartGeometryInformation == NULL)
00131 {
00132 EXCEPTION("HeartGeometryInformation object has not been set in the cell factory");
00133 }
00134 return mpHeartGeometryInformation;
00135 }
00137
00139
00140 template class AbstractCardiacCellFactory<1,1>;
00141 template class AbstractCardiacCellFactory<1,2>;
00142 template class AbstractCardiacCellFactory<1,3>;
00143 template class AbstractCardiacCellFactory<2,2>;
00144 template class AbstractCardiacCellFactory<3,3>;