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"
76template <
unsigned SPACE_DIM>
80 friend class TestExtendedBidomainTissue;
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
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,
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);
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();
509 archive & is_dynamic;
513 #ifdef 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,
592 for (
unsigned i=0; i<rStimuli.size(); i++)
594 assert(rStimuli[i] == NULL);
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();
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(
639 c_vector<double, SPACE_DIM> intracellular_conductivities_second_cell = t->GetIntracellularConductivitiesSecondCell();
641 for (
unsigned i = 0; i < SPACE_DIM; i++)
643 ar & intracellular_conductivities_second_cell(i);
651 t->SaveExtendedBidomainCells(ar, file_version);
652 t->SaveExtracellularStimulus(ar, file_version);
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;
688 t->LoadExtendedBidomainCells(
691 t->LoadExtracellularStimulus(
gcov doesn't like this file...
#define EXPORT_TEMPLATE_CLASS_SAME_DIMS(CLASS)
const std::vector< AbstractCardiacCellInterface * > & rGetCellsDistributed() const
DistributedVectorFactory * mpDistributedVectorFactory
Forward declaration which is going to be used for friendship.
DistributedVectorFactory * GetOriginalFactory()
bool IsGlobalIndexLocal(unsigned globalIndex)
unsigned GetLocalOwnership() const
ReplicatableVector mExtracellularStimulusCacheReplicated
void UpdateAdditionalCaches(unsigned globalIndex, unsigned localIndex, double nextTime)
void ReplicateAdditionalCaches()
void serialize(Archive &archive, const unsigned int version)
void SetGGap(double value)
ReplicatableVector & rGetExtracellularStimulusCacheReplicated()
const std::vector< boost::shared_ptr< AbstractStimulusFunction > > & rGetExtracellularStimulusDistributed() const
virtual void SolveCellSystems(Vec existingSolution, double time, double nextTime, bool updateVoltage=false)
void SetGgapHeterogeneities(std::vector< boost::shared_ptr< AbstractChasteRegion< SPACE_DIM > > > &rGgapHeterogeneityRegions, std::vector< double > rGgapValues)
void CreateExtracellularConductivityTensors()
ReplicatableVector mIionicCacheReplicatedSecondCell
std::vector< boost::shared_ptr< AbstractChasteRegion< SPACE_DIM > > > mGgapHeterogeneityRegions
std::vector< double > mGgapValues
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)
ReplicatableVector & rGetIionicCacheReplicatedSecondCell()
void SetCmFirstCell(double value)
ReplicatableVector & rGetGgapCacheReplicated()
AbstractConductivityTensors< SPACE_DIM, SPACE_DIM > * mpExtracellularConductivityTensors
const std::vector< AbstractCardiacCellInterface * > & rGetSecondCellsDistributed() const
std::vector< AbstractCardiacCellInterface * > mCellsDistributedSecondCell
ReplicatableVector mIntracellularStimulusCacheReplicatedSecondCell
void SetAmFirstCell(double value)
c_vector< double, SPACE_DIM > mIntracellularConductivitiesSecondCell
boost::shared_ptr< AbstractStimulusFunction > GetExtracellularStimulus(unsigned globalIndex)
bool HasTheUserSuppliedExtracellularStimulus()
std::vector< boost::shared_ptr< AbstractStimulusFunction > > mExtracellularStimuliDistributed
void SetAmSecondCell(double value)
ReplicatableVector & rGetIntracellularStimulusCacheReplicatedSecondCell()
AbstractConductivityTensors< SPACE_DIM, SPACE_DIM > * mpIntracellularConductivityTensorsSecondCell
void LoadExtracellularStimulus(Archive &archive, const unsigned int version, std::vector< boost::shared_ptr< AbstractStimulusFunction > > &rStimuli, AbstractTetrahedralMesh< SPACE_DIM, SPACE_DIM > *pMesh)
void SaveExtracellularStimulus(Archive &archive, const unsigned int version) const
c_vector< double, SPACE_DIM > GetIntracellularConductivitiesSecondCell() const
void CreateIntracellularConductivityTensorSecondCell()
const c_matrix< double, SPACE_DIM, SPACE_DIM > & rGetExtracellularConductivityTensor(unsigned elementIndex)
std::vector< double > mGgapDistributed
friend class boost::serialization::access
virtual ~ExtendedBidomainTissue()
AbstractCardiacCellInterface * GetCardiacSecondCell(unsigned globalIndex)
bool mUserSuppliedExtracellularStimulus
const std::vector< double > & rGetGapsDistributed() const
void SetUserSuppliedExtracellularStimulus(bool flag)
void SetAmGap(double value)
void SaveExtendedBidomainCells(Archive &archive, const unsigned int version) const
void SetIntracellularConductivitiesSecondCell(c_vector< double, SPACE_DIM > conductivities)
const c_matrix< double, SPACE_DIM, SPACE_DIM > & rGetIntracellularConductivityTensorSecondCell(unsigned elementIndex)
void CreateGGapConductivities()
ReplicatableVector mGgapCacheReplicated
void SetCmSecondCell(double value)
static HeartConfig * Instance()
static Archive * Get(void)