35 #ifndef ABSTRACTCARDIACTISSUE_HPP_ 36 #define ABSTRACTCARDIACTISSUE_HPP_ 40 #include <boost/shared_ptr.hpp> 47 #include <boost/serialization/base_object.hpp> 48 #include <boost/serialization/shared_ptr.hpp> 49 #include <boost/serialization/vector.hpp> 50 #include <boost/serialization/string.hpp> 51 #include <boost/serialization/split_member.hpp> 53 #include "AbstractCardiacCellInterface.hpp" 54 #include "FakeBathCell.hpp" 55 #include "AbstractCardiacCellFactory.hpp" 56 #include "AbstractConductivityTensors.hpp" 57 #include "AbstractPurkinjeCellFactory.hpp" 58 #include "ReplicatableVector.hpp" 59 #include "HeartConfig.hpp" 60 #include "ArchiveLocationInfo.hpp" 61 #include "AbstractDynamicallyLoadableEntity.hpp" 62 #include "DynamicModelLoaderRegistry.hpp" 63 #include "AbstractConductivityModifier.hpp" 77 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM = ELEMENT_DIM>
83 friend class boost::serialization::access;
84 friend class TestMonodomainTissue;
92 template<
class Archive>
93 void save(Archive & archive,
const unsigned int version)
const 113 case cp::media_type::Orthotropic:
116 assert(source_file.
Exists());
123 case cp::media_type::Axisymmetric:
126 assert(source_file.
Exists());
134 case cp::media_type::NoFibreOrientation:
161 template<
class Archive>
162 void load(Archive & archive,
const unsigned int version)
184 for (
unsigned local_index = 0; local_index < num_halo_nodes; local_index++)
186 unsigned global_index =
mHaloNodes[local_index];
203 bool do_one_cache_replication =
true;
204 archive & do_one_cache_replication;
219 BOOST_SERIALIZATION_SPLIT_MEMBER()
447 virtual void SolveCellSystems(
Vec existingSolution,
double time,
double nextTime,
bool updateVoltage=
false);
469 void UpdateCaches(
unsigned globalIndex,
unsigned localIndex,
double nextTime);
520 template<
class Archive>
523 const std::vector<AbstractCardiacCellInterface*> & r_cells_distributed =
rGetCellsDistributed();
526 const unsigned num_cells = r_cells_distributed.size();
528 for (
unsigned i=0; i<num_cells; i++)
531 bool is_dynamic = (p_entity != NULL);
532 archive & is_dynamic;
535 #ifdef CHASTE_CAN_CHECKPOINT_DLLS 536 archive & p_entity->
GetLoader()->GetLoadableModulePath();
540 #endif // CHASTE_CAN_CHECKPOINT_DLLS 542 archive & r_cells_distributed[i];
562 template<
class Archive>
575 if (mCellsDistributed.empty())
580 for (
unsigned i=0; i<mCellsDistributed.size(); i++)
582 assert(mCellsDistributed[i] == NULL);
592 if (mPurkinjeCellsDistributed.empty())
604 unsigned index_low = p_factory->GetOriginalFactory() ? p_factory->GetOriginalFactory()->GetLow() : p_mesh_factory->
GetLow();
607 std::set<FakeBathCell*> fake_cells_non_local, fake_cells_local;
622 for (
unsigned local_index=0; local_index<num_cells; local_index++)
625 unsigned global_index = index_low + local_index;
629 std::map<unsigned, unsigned>::const_iterator halo_position;
630 bool halo = ((halo_position=mHaloGlobalToLocalIndexMap.find(global_index)) != mHaloGlobalToLocalIndexMap.end());
634 archive & is_dynamic;
637 #ifdef CHASTE_CAN_CHECKPOINT_DLLS 641 std::string shared_object_path;
642 archive & shared_object_path;
647 #endif // CHASTE_CAN_CHECKPOINT_DLLS 654 archive & p_purkinje_cell;
662 fake_cells_local.insert(p_fake);
666 fake_cells_non_local.insert(p_fake);
674 fake_cells_local.insert(p_fake_purkinje);
678 fake_cells_non_local.insert(p_fake_purkinje);
686 unsigned new_local_index = global_index - p_mesh_factory->
GetLow();
687 assert(mCellsDistributed[new_local_index] == NULL);
688 mCellsDistributed[new_local_index] = p_cell;
691 assert(mPurkinjeCellsDistributed[new_local_index] == NULL);
692 mPurkinjeCellsDistributed[new_local_index] = p_purkinje_cell;
697 assert(mHaloCellsDistributed[halo_position->second] == NULL);
698 mHaloCellsDistributed[halo_position->second] = p_cell;
707 if (!p_fake_purkinje)
710 delete p_purkinje_cell;
716 for (std::set<FakeBathCell*>::iterator it = fake_cells_non_local.begin();
717 it != fake_cells_non_local.end();
720 if (fake_cells_local.find(*it) == fake_cells_local.end())
731 namespace serialization {
738 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
ReplicatableVector mIntracellularStimulusCacheReplicated
virtual DistributedVectorFactory * GetDistributedVectorFactory()
#define TEMPLATED_CLASS_IS_ABSTRACT_2_UNSIGNED(T)
static DynamicModelLoaderRegistry * Instance()
AbstractConductivityTensors< ELEMENT_DIM, SPACE_DIM > * mpIntracellularConductivityTensors
void SetConductivityModifier(AbstractConductivityModifier< ELEMENT_DIM, SPACE_DIM > *pModifier)
void CreateIntracellularConductivityTensor()
DistributedVectorFactory * mpDistributedVectorFactory
const DynamicCellModelLoaderPtr GetLoader() const
ReplicatableVector & rGetPurkinjeIionicCacheReplicated()
AbstractCardiacTissue(AbstractCardiacCellFactory< ELEMENT_DIM, SPACE_DIM > *pCellFactory, bool exchangeHalos=false)
std::vector< std::vector< unsigned > > mNodesToSendPerProcess
virtual void SolveCellSystems(Vec existingSolution, double time, double nextTime, bool updateVoltage=false)
static std::string GetMeshFilename()
FileFinder CopyTo(const FileFinder &rDest) const
virtual ~AbstractCardiacTissue()
void UpdateCaches(unsigned globalIndex, unsigned localIndex, double nextTime)
void LoadCardiacCells(Archive &archive, const unsigned int version)
ReplicatableVector mPurkinjeIionicCacheReplicated
std::vector< AbstractCardiacCellInterface * > mPurkinjeCellsDistributed
ReplicatableVector mPurkinjeIntracellularStimulusCacheReplicated
void load(Archive &archive, const unsigned int version)
std::vector< AbstractCardiacCellInterface * > mHaloCellsDistributed
std::vector< AbstractCardiacCellInterface * > mCellsDistributed
bool IsGlobalIndexLocal(unsigned globalIndex)
static Archive * Get(void)
bool GetDoCacheReplication()
AbstractCardiacCellInterface * GetCardiacCellOrHaloCell(unsigned globalIndex)
std::string mFibreFilePathNoExtension
ReplicatableVector & rGetIntracellularStimulusCacheReplicated()
std::vector< std::vector< unsigned > > mNodesToReceivePerProcess
AbstractCardiacCellInterface * GetPurkinjeCell(unsigned globalIndex)
void SetUpHaloCells(AbstractCardiacCellFactory< ELEMENT_DIM, SPACE_DIM > *pCellFactory)
void SaveCardiacCells(Archive &archive, const unsigned int version) const
unsigned GetProblemSize() const
#define CHASTE_VERSION_CONTENT(N)
DynamicCellModelLoaderPtr GetLoader(const std::string &rPath)
ReplicatableVector mIionicCacheReplicated
AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > * mpMesh
const std::vector< AbstractCardiacCellInterface * > & rGetCellsDistributed() const
virtual const c_matrix< double, SPACE_DIM, SPACE_DIM > & rGetExtracellularConductivityTensor(unsigned elementIndex)
AbstractConductivityModifier< ELEMENT_DIM, SPACE_DIM > * mpConductivityModifier
unsigned GetLocalOwnership() const
std::map< unsigned, unsigned > mHaloGlobalToLocalIndexMap
void Resize(unsigned size)
const std::vector< AbstractCardiacCellInterface * > & rGetPurkinjeCellsDistributed() const
void CalculateHaloNodesFromNodeExchange()
void SetCacheReplication(bool doCacheReplication)
Forward declaration which is going to be used for friendship.
gcov doesn't like this file...
ReplicatableVector & rGetPurkinjeIntracellularStimulusCacheReplicated()
const c_matrix< double, SPACE_DIM, SPACE_DIM > & rGetIntracellularConductivityTensor(unsigned elementIndex)
static std::string GetArchiveRelativePath()
std::vector< unsigned > mHaloNodes
AbstractCardiacCellInterface * GetCardiacCell(unsigned globalIndex)
void UpdatePurkinjeCaches(unsigned globalIndex, unsigned localIndex, double nextTime)
static HeartConfig * Instance()
const AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > * pGetMesh() const
void save(Archive &archive, const unsigned int version) const
ReplicatableVector & rGetIionicCacheReplicated()