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 525 #endif // CHASTE_CAN_CHECKPOINT_DLLS 532 archive & p_second_cell;
536 rCells[new_local_index] = p_cell;
537 rSecondCells[new_local_index] = p_second_cell;
538 rGgaps[new_local_index] = g_gap;
557 template<
class Archive>
563 const unsigned num_cells = r_stimulus_distributed.size();
564 r_archive & num_cells;
565 for (
unsigned i=0; i<num_cells; i++)
567 r_archive & r_stimulus_distributed[i];
579 template<
class Archive>
581 std::vector<boost::shared_ptr<AbstractStimulusFunction> >& rStimuli,
589 rStimuli.resize(p_factory->GetLocalOwnership());
592 for (
unsigned i=0; i<rStimuli.size(); i++)
594 assert(rStimuli[i] == NULL);
602 unsigned index_low = p_factory->GetOriginalFactory() ? p_factory->GetOriginalFactory()->GetLow() : p_factory->GetLow();
606 for (
unsigned local_index=0; local_index<num_cells; local_index++)
608 unsigned global_index = index_low + local_index;
610 unsigned new_local_index = global_index - p_factory->GetLow();
611 bool local = p_factory->IsGlobalIndexLocal(global_index);
613 boost::shared_ptr<AbstractStimulusFunction> p_stim;
618 rStimuli[new_local_index] = p_stim;
631 namespace serialization
634 template<
class Archive,
unsigned SPACE_DIM>
635 inline void save_construct_data(
641 for (
unsigned i = 0; i < SPACE_DIM; i++)
643 ar & intracellular_conductivities_second_cell(i);
665 template<
class Archive,
unsigned SPACE_DIM>
666 inline void load_construct_data(
670 c_vector<double, SPACE_DIM> intra_cond_second_cell;
672 for (
unsigned i = 0; i < SPACE_DIM; i++)
676 intra_cond_second_cell(i) = cond;
680 std::vector<AbstractCardiacCellInterface*> cells_distributed;
681 std::vector<AbstractCardiacCellInterface*> cells_distributed_second_cell;
682 std::vector<boost::shared_ptr<AbstractStimulusFunction> > extra_stim;
683 std::vector<double> g_gaps;
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)
gcov doesn't like this file...
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)