37 #ifndef EXTENDEDBIDOMAINTISSUE_HPP_
38 #define EXTENDEDBIDOMAINTISSUE_HPP_
41 #include <boost/serialization/base_object.hpp>
46 #include "AbstractStimulusFunction.hpp"
47 #include "AbstractStimulusFactory.hpp"
48 #include "AbstractConductivityTensors.hpp"
50 #include "AbstractCardiacTissue.hpp"
76 template <
unsigned SPACE_DIM>
80 friend class TestExtendedBidomainTissue;
83 friend class boost::serialization::access;
90 template<
class Archive>
91 void serialize(Archive & archive,
const unsigned int version)
93 archive & boost::serialization::base_object<AbstractCardiacTissue<SPACE_DIM> >(*this);
228 std::vector<AbstractCardiacCellInterface*> & rSecondCellsDistributed,
229 std::vector<boost::shared_ptr<AbstractStimulusFunction> > & rExtraStimuliDistributed,
230 std::vector<double>& rGgapsDistributed,
232 c_vector<double, SPACE_DIM> intracellularConductivitiesSecondCell);
292 virtual void SolveCellSystems(
Vec existingSolution,
double time,
double nextTime,
bool updateVoltage =
false);
424 template<
class Archive>
428 const std::vector<AbstractCardiacCellInterface*> & r_cells_distributed = this->
rGetCellsDistributed();
433 const unsigned num_cells = r_cells_distributed.size();
434 r_archive & num_cells;
435 for (
unsigned i=0; i<num_cells; i++)
438 bool is_dynamic = (p_entity != NULL);
439 r_archive & is_dynamic;
442 #ifdef CHASTE_CAN_CHECKPOINT_DLLS
449 #endif // CHASTE_CAN_CHECKPOINT_DLLS
451 r_archive & r_cells_distributed[i];
452 r_archive & r_cells_distributed_second_cell[i];
453 r_archive & r_ggaps_distributed[i];
471 template<
class Archive>
473 std::vector<AbstractCardiacCellInterface*>& rCells,
474 std::vector<AbstractCardiacCellInterface*>& rSecondCells,
475 std::vector<double>& rGgaps,
483 rCells.resize(p_factory->GetLocalOwnership());
484 rSecondCells.resize(p_factory->GetLocalOwnership());
485 rGgaps.resize(p_factory->GetLocalOwnership());
488 assert(rCells.size() == rSecondCells.size());
489 for (
unsigned i=0; i<rCells.size(); i++)
491 assert(rCells[i] == NULL);
492 assert(rSecondCells[i] == NULL);
500 unsigned index_low = p_factory->GetOriginalFactory() ? p_factory->GetOriginalFactory()->GetLow() : p_factory->GetLow();
502 for (
unsigned local_index=0; local_index<num_cells; local_index++)
504 unsigned global_index = index_low + local_index;
505 unsigned new_local_index = global_index - p_factory->GetLow();
506 bool local = p_factory->IsGlobalIndexLocal(global_index);
509 archive & is_dynamic;
513 #ifdef CHASTE_CAN_CHECKPOINT_DLLS
527 #endif // CHASTE_CAN_CHECKPOINT_DLLS
534 archive & p_second_cell;
538 rCells[new_local_index] = p_cell;
539 rSecondCells[new_local_index] = p_second_cell;
540 rGgaps[new_local_index] = g_gap;
559 template<
class Archive>
565 const unsigned num_cells = r_stimulus_distributed.size();
566 r_archive & num_cells;
567 for (
unsigned i=0; i<num_cells; i++)
569 r_archive & r_stimulus_distributed[i];
581 template<
class Archive>
583 std::vector<boost::shared_ptr<AbstractStimulusFunction> >& rStimuli,
591 rStimuli.resize(p_factory->GetLocalOwnership());
594 for (
unsigned i=0; i<rStimuli.size(); i++)
596 assert(rStimuli[i] == NULL);
604 unsigned index_low = p_factory->GetOriginalFactory() ? p_factory->GetOriginalFactory()->GetLow() : p_factory->GetLow();
608 for (
unsigned local_index=0; local_index<num_cells; local_index++)
610 unsigned global_index = index_low + local_index;
612 unsigned new_local_index = global_index - p_factory->GetLow();
613 bool local = p_factory->IsGlobalIndexLocal(global_index);
615 boost::shared_ptr<AbstractStimulusFunction> p_stim;
620 rStimuli[new_local_index] = p_stim;
633 namespace serialization
636 template<
class Archive,
unsigned SPACE_DIM>
637 inline void save_construct_data(
643 for (
unsigned i = 0; i < SPACE_DIM; i++)
645 ar & intracellular_conductivities_second_cell(i);
667 template<
class Archive,
unsigned SPACE_DIM>
668 inline void load_construct_data(
672 c_vector<double, SPACE_DIM> intra_cond_second_cell;
674 for (
unsigned i = 0; i < SPACE_DIM; i++)
678 intra_cond_second_cell(i) = cond;
682 std::vector<AbstractCardiacCellInterface*> cells_distributed;
683 std::vector<AbstractCardiacCellInterface*> cells_distributed_second_cell;
684 std::vector<boost::shared_ptr<AbstractStimulusFunction> > extra_stim;
685 std::vector<double> g_gaps;
703 ::new(t)
ExtendedBidomainTissue<SPACE_DIM>(cells_distributed, cells_distributed_second_cell, extra_stim, g_gaps, p_mesh, intra_cond_second_cell);
AbstractConductivityTensors< SPACE_DIM, SPACE_DIM > * mpExtracellularConductivityTensors
ReplicatableVector mIionicCacheReplicatedSecondCell
std::vector< boost::shared_ptr< AbstractChasteRegion< SPACE_DIM > > > mGgapHeterogeneityRegions
ReplicatableVector & rGetExtracellularStimulusCacheReplicated()
void CreateIntracellularConductivityTensorSecondCell()
void SetAmGap(double value)
DistributedVectorFactory * mpDistributedVectorFactory
ReplicatableVector & rGetIionicCacheReplicatedSecondCell()
virtual void SolveCellSystems(Vec existingSolution, double time, double nextTime, bool updateVoltage=false)
c_vector< double, SPACE_DIM > GetIntracellularConductivitiesSecondCell() const
std::vector< AbstractCardiacCellInterface * > mCellsDistributedSecondCell
ReplicatableVector & rGetGgapCacheReplicated()
void ReplicateAdditionalCaches()
void SetGgapHeterogeneities(std::vector< boost::shared_ptr< AbstractChasteRegion< SPACE_DIM > > > &rGgapHeterogeneityRegions, std::vector< double > rGgapValues)
AbstractCardiacCellInterface * GetCardiacSecondCell(unsigned globalIndex)
c_vector< double, SPACE_DIM > mIntracellularConductivitiesSecondCell
void CreateGGapConductivities()
const c_matrix< double, SPACE_DIM, SPACE_DIM > & rGetExtracellularConductivityTensor(unsigned elementIndex)
void CreateExtracellularConductivityTensors()
void SetAmSecondCell(double value)
virtual ~ExtendedBidomainTissue()
std::vector< double > mGgapDistributed
void SaveExtendedBidomainCells(Archive &archive, const unsigned int version) const
void UpdateAdditionalCaches(unsigned globalIndex, unsigned localIndex, double nextTime)
std::vector< boost::shared_ptr< AbstractStimulusFunction > > mExtracellularStimuliDistributed
AbstractConductivityTensors< SPACE_DIM, SPACE_DIM > * mpIntracellularConductivityTensorsSecondCell
boost::shared_ptr< AbstractStimulusFunction > GetExtracellularStimulus(unsigned globalIndex)
static void LoadExtendedBidomainCells(Archive &archive, const unsigned int version, std::vector< AbstractCardiacCellInterface * > &rCells, std::vector< AbstractCardiacCellInterface * > &rSecondCells, std::vector< double > &rGgaps, AbstractTetrahedralMesh< SPACE_DIM, SPACE_DIM > *pMesh)
void SetCmSecondCell(double value)
static Archive * Get(void)
bool HasTheUserSuppliedExtracellularStimulus()
const std::vector< AbstractCardiacCellInterface * > & rGetSecondCellsDistributed() const
ReplicatableVector mExtracellularStimulusCacheReplicated
#define EXPORT_TEMPLATE_CLASS_SAME_DIMS(CLASS)
ReplicatableVector mGgapCacheReplicated
const std::vector< boost::shared_ptr< AbstractStimulusFunction > > & rGetExtracellularStimulusDistributed() const
void SetCmFirstCell(double value)
ReplicatableVector & rGetIntracellularStimulusCacheReplicatedSecondCell()
std::vector< double > mGgapValues
const std::vector< double > & rGetGapsDistributed() const
ReplicatableVector mIntracellularStimulusCacheReplicatedSecondCell
const std::vector< AbstractCardiacCellInterface * > & rGetCellsDistributed() const
void LoadExtracellularStimulus(Archive &archive, const unsigned int version, std::vector< boost::shared_ptr< AbstractStimulusFunction > > &rStimuli, AbstractTetrahedralMesh< SPACE_DIM, SPACE_DIM > *pMesh)
void SetIntracellularConductivitiesSecondCell(c_vector< double, SPACE_DIM > conductivities)
void SetUserSuppliedExtracellularStimulus(bool flag)
void serialize(Archive &archive, const unsigned int version)
const c_matrix< double, SPACE_DIM, SPACE_DIM > & rGetIntracellularConductivityTensorSecondCell(unsigned elementIndex)
bool mUserSuppliedExtracellularStimulus
static HeartConfig * Instance()
void SaveExtracellularStimulus(Archive &archive, const unsigned int version) const
const AbstractTetrahedralMesh< ELEMENT_DIM, ELEMENT_DIM > * pGetMesh() const
void SetAmFirstCell(double value)
void SetGGap(double value)
ExtendedBidomainTissue(AbstractCardiacCellFactory< SPACE_DIM > *pCellFactory, AbstractCardiacCellFactory< SPACE_DIM > *pCellFactorySecondCell, AbstractStimulusFactory< SPACE_DIM > *pExtracellularStimulusFactory)