37#ifndef ABSTRACTCARDIACPROBLEM_HPP_
38#define ABSTRACTCARDIACPROBLEM_HPP_
44#include <boost/shared_ptr.hpp>
47#include <boost/serialization/vector.hpp>
48#include <boost/serialization/string.hpp>
49#include <boost/serialization/split_member.hpp>
50#include <boost/serialization/shared_ptr.hpp>
54#include "AbstractTetrahedralMesh.hpp"
55#include "AbstractCardiacCell.hpp"
56#include "AbstractCardiacCellFactory.hpp"
57#include "AbstractCardiacTissue.hpp"
58#include "AbstractDynamicLinearPdeSolver.hpp"
59#include "BoundaryConditionsContainer.hpp"
60#include "DistributedVectorFactory.hpp"
61#include "Hdf5DataReader.hpp"
62#include "Hdf5DataWriter.hpp"
63#include "Warnings.hpp"
64#include "AbstractOutputModifier.hpp"
82#include "DistributedTetrahedralMesh.hpp"
83#include "TetrahedralMesh.hpp"
84#include "MonodomainTissue.hpp"
85#include "BidomainTissue.hpp"
112template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM,
unsigned PROBLEM_DIM>
115 friend class TestBidomainWithBath;
116 friend class TestMonodomainProblem;
117 friend class TestCardiacSimulationArchiver;
120 typedef typename boost::shared_ptr<BoundaryConditionsContainer<ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM> >
133 template<
class Archive>
134 void save(Archive & archive,
const unsigned int version)
const
138 const unsigned element_dim=ELEMENT_DIM;
139 archive & element_dim;
140 const unsigned space_dim=SPACE_DIM;
142 const unsigned problem_dim=PROBLEM_DIM;
143 archive & problem_dim;
150 assert(version >= 2);
167 archive & has_solution;
188 std::vector<int> variable_ids;
189 variable_ids.push_back(vm_col);
190 variable_ids.push_back(phie_col);
223 template<
class Archive>
224 void load(Archive & archive,
const unsigned int version)
228 unsigned element_dim;
230 unsigned problem_dim;
231 archive & element_dim;
233 archive & problem_dim;
234 if ((element_dim != ELEMENT_DIM) ||(space_dim != SPACE_DIM) ||(problem_dim != PROBLEM_DIM))
242 EXCEPTION(
"Failed to load from checkpoint because the dimensions of the archive do not match the object it's being read into.");
252 bool use_matrix_based_assembly;
253 archive & use_matrix_based_assembly;
267 archive & has_solution;
268 if ((has_solution) && PROBLEM_DIM < 3)
272 mSolution =
mpMesh->GetDistributedVectorFactory()->CreateVec(PROBLEM_DIM);
275 Vec vm =
mpMesh->GetDistributedVectorFactory()->CreateVec();
276 Vec phie =
mpMesh->GetDistributedVectorFactory()->CreateVec();
291 index != mSolution_distri.
End();
294 mSolution_vm[index] = vm_distri[index];
310 index != mSolution_distri.
End();
313 mSolution_vm[index] = vm_distri[index];
314 mSolution_phie[index] = phie_distri[index];
342 BOOST_SERIALIZATION_SPLIT_MEMBER()
351 template<class Archive>
366 template<
class Archive>
466 template<
unsigned DIM,
unsigned ELEC_PROB_DIM>
780 template<
class Archive>
808template<
unsigned DIM>
811template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM,
unsigned PROBLEM_DIM>
812template<
class Archive>
817 archive >> p_mesh_factory;
821 unsigned orig_num_procs = 1;
822 if (p_original_factory)
824 orig_num_procs = p_original_factory->
GetNumProcs();
832 archive >> p_pde_factory;
833 assert(p_pde_factory == p_mesh_factory);
836 delete p_mesh_factory;
857 WARNING(
"Loading from a parallel archive which used a non-distributed mesh. This scenario should work but is not fully tested.");
864 archive >> p_default_bcc;
868 assert(p_bcc == p_default_bcc);
873 if (p_bidomain_problem)
875 assert(ELEMENT_DIM == SPACE_DIM);
881namespace serialization {
888template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM,
unsigned PROBLEM_DIM>
gcov doesn't like this file...
#define TEMPLATED_CLASS_IS_ABSTRACT_3_UNSIGNED(T)
#define EXCEPTION(message)
AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM > * mpCardiacTissue
virtual Vec CreateInitialCondition()
virtual ~AbstractCardiacProblem()
bool mUseHdf5DataWriterCache
hsize_t mHdf5DataWriterChunkSizeAndAlignment
BccType mpDefaultBoundaryConditionsContainer
void SetWriteInfo(bool writeInfo=true)
virtual AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM > * CreateSolver()=0
virtual void OnEndOfTimestep(double time)
void load(Archive &archive, const unsigned int version)
virtual void SetElectrodes()
std::vector< boost::shared_ptr< AbstractOutputModifier > > mOutputModifiers
virtual AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM > * CreateCardiacTissue()=0
void AddOutputModifier(boost::shared_ptr< AbstractOutputModifier > pOutputModifier)
AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > * mpMesh
virtual void CreateMeshFromHeartConfig()
BccType LoadBoundaryConditions(Archive &archive, AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh)
void SetOutputNodes(std::vector< unsigned > &rNodesToOutput)
void DefineExtraVariablesWriterColumns(bool extending)
DistributedVector GetSolutionDistributedVector()
void save(Archive &archive, const unsigned int version) const
void SetHdf5DataWriterTargetChunkSizeAndAlignment(hsize_t size)
Hdf5DataReader GetDataReader()
virtual void SetUpAdditionalStoppingTimes(std::vector< double > &rAdditionalStoppingTimes)
AbstractTimeAdaptivityController * mpTimeAdaptivityController
void SetUseTimeAdaptivityController(bool useAdaptivity, AbstractTimeAdaptivityController *pController=NULL)
void SetMesh(AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh)
AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > & rGetMesh()
AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM > * mpSolver
boost::shared_ptr< BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM > > BccType
void SaveBoundaryConditions(Archive &archive, AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh, BccType pBcc) const
void CloseFilesAndPostProcess()
virtual void WriteOneStep(double time, Vec voltageVec)=0
Hdf5DataWriter * mpWriter
BccType mpBoundaryConditionsContainer
virtual void WriteInfo(double time)=0
virtual void PreSolveChecks()
void PrintOutput(bool rPrintOutput)
std::vector< unsigned > mExtraVariablesId
virtual bool GetHasBath()
void SetBoundaryConditionsContainer(BccType pBcc)
friend class boost::serialization::access
AbstractCardiacCellFactory< ELEMENT_DIM, SPACE_DIM > * mpCellFactory
std::vector< unsigned > mNodesToOutput
std::string mMeshFilename
AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM > * GetTissue()
void SetUseHdf5DataWriterCache(bool useCache=true)
void LoadExtraArchive(Archive &archive, unsigned version)
bool mAllocatedMemoryForMesh
void SetNodesPerProcessorFilename(const std::string &rFilename)
void WriteExtraVariablesOneStep()
virtual void DefineWriterColumns(bool extending)
virtual void AtBeginningOfTimestep(double time)
unsigned mVoltageColumnId
virtual ~AbstractUntemplatedCardiacProblem()
static std::string GetArchiveRelativePath()
void LoadExtraArchiveForBidomain(Archive &archive, unsigned version)
DistributedVectorFactory * GetOriginalFactory()
unsigned GetNumProcs() const
static bool IsAbsolutePath(const std::string &rPath)
void GetVariableOverNodes(Vec data, const std::string &rVariableName, unsigned timestep=0)
void DefineUnlimitedDimension(const std::string &rVariableName, const std::string &rVariableUnits, unsigned estimatedLength=1)
void PutUnlimitedVariable(double value)
void DefineFixedDimension(long dimensionSize)
int DefineVariable(const std::string &rVariableName, const std::string &rVariableUnits)
virtual void EndDefineMode()
void PutVector(int variableID, Vec petscVector)
void PutStripedVector(std::vector< int > variableIDs, Vec petscVector)
static Archive * Get(void)
CHASTE_VERSION_CONTENT(4)
Macro to set the version number of templated archive in known versions of Boost.