ExtendedBidomainTissue.cpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2011
00004 
00005 University of Oxford means the Chancellor, Masters and Scholars of the
00006 University of Oxford, having an administrative office at Wellington
00007 Square, Oxford OX1 2JD, UK.
00008 
00009 This file is part of Chaste.
00010 
00011 Chaste is free software: you can redistribute it and/or modify it
00012 under the terms of the GNU Lesser General Public License as published
00013 by the Free Software Foundation, either version 2.1 of the License, or
00014 (at your option) any later version.
00015 
00016 Chaste is distributed in the hope that it will be useful, but WITHOUT
00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00019 License for more details. The offer of Chaste under the terms of the
00020 License is subject to the License being interpreted in accordance with
00021 English Law and subject to any action against the University of Oxford
00022 being under the jurisdiction of the English Courts.
00023 
00024 You should have received a copy of the GNU Lesser General Public License
00025 along with Chaste. If not, see <http://www.gnu.org/licenses/>.
00026 
00027 */
00028 
00029 #include "ExtendedBidomainTissue.hpp"
00030 
00031 #include "DistributedVector.hpp"
00032 #include "OrthotropicConductivityTensors.hpp"
00033 #include "AbstractStimulusFunction.hpp"
00034 #include "ChastePoint.hpp"
00035 #include "AbstractChasteRegion.hpp"
00036 #include "HeartEventHandler.hpp"
00037 
00038 template <unsigned SPACE_DIM>
00039 ExtendedBidomainTissue<SPACE_DIM>::ExtendedBidomainTissue(
00040             AbstractCardiacCellFactory<SPACE_DIM>* pCellFactory, AbstractCardiacCellFactory<SPACE_DIM>* pCellFactorySecondCell, AbstractStimulusFactory<SPACE_DIM>* pExtracellularStimulusFactory)
00041     : AbstractCardiacTissue<SPACE_DIM>(pCellFactory),
00042       mpIntracellularConductivityTensorsSecondCell(NULL),
00043       mUserSuppliedExtracellularStimulus(false)
00044 {
00045     //First, do the same that the abstract constructor does, but applied to the second cell
00046 
00047     assert(pCellFactorySecondCell != NULL);
00048     assert(pCellFactorySecondCell->GetMesh() != NULL);
00049     assert(pCellFactorySecondCell->GetNumberOfCells() == pCellFactory->GetNumberOfCells() );
00050     assert(pExtracellularStimulusFactory != NULL);
00051     assert(pExtracellularStimulusFactory->GetMesh() != NULL);
00052     assert(pExtracellularStimulusFactory->GetNumberOfCells() == pCellFactorySecondCell->GetNumberOfCells() );
00053 
00054     unsigned num_local_nodes = this->mpDistributedVectorFactory->GetLocalOwnership();
00055     unsigned ownership_range_low = this->mpDistributedVectorFactory->GetLow();
00056     mCellsDistributedSecondCell.resize(num_local_nodes);
00057     mGgapDistributed.resize(num_local_nodes);
00058     mExtracellularStimuliDistributed.resize(num_local_nodes);
00059 
00060     try
00061     {
00062         for (unsigned local_index = 0; local_index < num_local_nodes; local_index++)
00063         {
00064             unsigned global_index = ownership_range_low + local_index;
00065             mCellsDistributedSecondCell[local_index] = pCellFactorySecondCell->CreateCardiacCellForNode(global_index);
00066             mCellsDistributedSecondCell[local_index]->SetUsedInTissueSimulation();
00067             mGgapDistributed[local_index] = 0.0;//default. It will be changed by specific method later when user input will be obtained
00068             mExtracellularStimuliDistributed[local_index] = pExtracellularStimulusFactory->CreateStimulusForNode(global_index);
00069         }
00070 
00071         pCellFactorySecondCell->FinaliseCellCreation(&mCellsDistributedSecondCell,
00072                                            this->mpDistributedVectorFactory->GetLow(),
00073                                            this->mpDistributedVectorFactory->GetHigh());
00074     }
00075     catch (const Exception& e)
00076     {
00077 #define COVERAGE_IGNORE //don't really know how to cover this...
00078         // Errors thrown creating cells will often be process-specific
00079         PetscTools::ReplicateException(true);
00080         // Should really do this for other processes too, but this is all we need
00081         // to get memory testing to pass, and leaking when we're about to die isn't
00082         // that bad! Delete second cells
00083         for (std::vector<AbstractCardiacCell*>::iterator cell_iterator = mCellsDistributedSecondCell.begin();
00084              cell_iterator != mCellsDistributedSecondCell.end();
00085              ++cell_iterator)
00086         {
00087             delete (*cell_iterator);
00088         }
00089         throw e;
00090 #undef COVERAGE_IGNORE
00091     }
00092     PetscTools::ReplicateException(false);
00093 
00094     HeartEventHandler::BeginEvent(HeartEventHandler::COMMUNICATION);
00095     mIionicCacheReplicatedSecondCell.Resize( pCellFactory->GetNumberOfCells() );
00096     mIntracellularStimulusCacheReplicatedSecondCell.Resize( pCellFactorySecondCell->GetNumberOfCells() );
00097     mGgapCacheReplicated.Resize(pCellFactorySecondCell->GetNumberOfCells());//this is a bit of a hack...
00098     mExtracellularStimulusCacheReplicated.Resize(pExtracellularStimulusFactory->GetNumberOfCells());
00099     HeartEventHandler::EndEvent(HeartEventHandler::COMMUNICATION);
00100 
00101     //Creat the extracellular conductivity tensor
00102     CreateExtracellularConductivityTensors();
00103 }
00104 
00105 //archiving constructor
00106 template <unsigned SPACE_DIM>
00107 ExtendedBidomainTissue<SPACE_DIM>::ExtendedBidomainTissue(std::vector<AbstractCardiacCell*> & rCellsDistributed, std::vector<AbstractCardiacCell*> & rSecondCellsDistributed, std::vector<boost::shared_ptr<AbstractStimulusFunction> > & rExtraStimuliDistributed, std::vector<double> & rGgapsDistributed, AbstractTetrahedralMesh<SPACE_DIM,SPACE_DIM>* pMesh,c_vector<double, SPACE_DIM>  intracellularConductivitiesSecondCell)
00108         :   AbstractCardiacTissue<SPACE_DIM>(pMesh),
00109             mpIntracellularConductivityTensorsSecondCell(NULL),
00110             mIntracellularConductivitiesSecondCell(intracellularConductivitiesSecondCell),
00111             mCellsDistributedSecondCell(rSecondCellsDistributed),
00112             mExtracellularStimuliDistributed(rExtraStimuliDistributed),
00113             mGgapDistributed(rGgapsDistributed),
00114             mUserSuppliedExtracellularStimulus(false)
00115 {
00116     //segfault guards in case we failed to load anything from the archive
00117     assert(mCellsDistributedSecondCell.size() > 0);
00118     assert(mExtracellularStimuliDistributed.size() > 0);
00119     assert(mGgapDistributed.size() > 0);
00120     //allocate memory for the caches
00121     mIionicCacheReplicatedSecondCell.Resize( this->mpDistributedVectorFactory->GetProblemSize());
00122     mIntracellularStimulusCacheReplicatedSecondCell.Resize( this->mpDistributedVectorFactory->GetProblemSize() );
00123     mGgapCacheReplicated.Resize(this->mpDistributedVectorFactory->GetProblemSize());
00124     mExtracellularStimulusCacheReplicated.Resize(this->mpDistributedVectorFactory->GetProblemSize());
00125 
00126     CreateIntracellularConductivityTensorSecondCell();
00127     CreateExtracellularConductivityTensors();
00128 }
00129 
00130 
00131 template <unsigned SPACE_DIM>
00132 void ExtendedBidomainTissue<SPACE_DIM>::SetGgapHeterogeneities ( std::vector<boost::shared_ptr<AbstractChasteRegion<SPACE_DIM> > >& rGgapHeterogeneityRegions, std::vector<double> rGgapValues)
00133 {
00134     assert( rGgapHeterogeneityRegions.size() == rGgapValues.size() );//problem class (which calls this method should have thrown otherwise)
00135     mGgapHeterogeneityRegions = rGgapHeterogeneityRegions;
00136     mGgapValues =rGgapValues;
00137 }
00138 
00139 template <unsigned SPACE_DIM>
00140 void ExtendedBidomainTissue<SPACE_DIM>::CreateGGapConductivities()
00141 {
00142     assert(mGgapHeterogeneityRegions.size() == mGgapValues.size());
00143     assert(this->mpMesh != NULL);
00144 
00145     unsigned num_local_nodes = this->mpDistributedVectorFactory->GetLocalOwnership();
00146     unsigned ownership_range_low = this->mpDistributedVectorFactory->GetLow();
00147     assert(mGgapDistributed.size() == num_local_nodes);//the constructor should have allocated memory.
00148     try
00149     {
00150         for (unsigned local_index = 0; local_index < num_local_nodes; local_index++)
00151         {
00152             mGgapDistributed[local_index] = mGGap;//assign default uniform value everywhere first
00153 
00154             //then change where and if necessary
00155             unsigned global_index = ownership_range_low + local_index;
00156             for (unsigned het_index = 0; het_index < mGgapHeterogeneityRegions.size(); het_index++)
00157             {
00158                 if ( mGgapHeterogeneityRegions[het_index]->DoesContain ( this->mpMesh->GetNode(global_index)->GetPoint() ) )
00159                 {
00160                     mGgapDistributed[local_index] = mGgapValues[het_index];
00161                 }
00162             }
00163         }
00164     }
00165     catch (const Exception& e)
00166     {
00167 #define COVERAGE_IGNORE
00168         PetscTools::ReplicateException(true);
00169         throw e;
00170 #undef COVERAGE_IGNORE
00171     }
00172     PetscTools::ReplicateException(false);
00173 }
00174 
00175 template <unsigned SPACE_DIM>
00176 void ExtendedBidomainTissue<SPACE_DIM>::CreateIntracellularConductivityTensorSecondCell()
00177 {
00178     HeartEventHandler::BeginEvent(HeartEventHandler::READ_MESH);
00179     this->mpConfig = HeartConfig::Instance();
00180     mpIntracellularConductivityTensorsSecondCell = new OrthotropicConductivityTensors<SPACE_DIM,SPACE_DIM>;
00181 
00182     // this definition must be here (and not inside the if statement) because SetNonConstantConductivities() will keep
00183     // a pointer to it and we don't want it to go out of scope before Init() is called
00184     unsigned num_elements = this->mpMesh->GetNumElements();
00185     std::vector<c_vector<double, SPACE_DIM> > hetero_intra_conductivities;
00186 
00187     c_vector<double, SPACE_DIM> intra_conductivities;
00188     this->mpConfig->GetIntracellularConductivities(intra_conductivities);//this one is used just for resizing
00189 
00190     if (this->mpConfig->GetConductivityHeterogeneitiesProvided())
00191     {
00192         try
00193         {
00194             assert(hetero_intra_conductivities.size()==0);
00195             hetero_intra_conductivities.resize(num_elements, intra_conductivities);
00196         }
00197         catch(std::bad_alloc &badAlloc)
00198         {
00199 #define COVERAGE_IGNORE
00200             std::cout << "Failed to allocate std::vector of size " << num_elements << std::endl;
00201             PetscTools::ReplicateException(true);
00202             throw badAlloc;
00203 #undef COVERAGE_IGNORE
00204         }
00205         PetscTools::ReplicateException(false);
00206 
00207         std::vector<boost::shared_ptr<AbstractChasteRegion<SPACE_DIM> > > conductivities_heterogeneity_areas;
00208         std::vector< c_vector<double,3> > intra_h_conductivities;
00209         std::vector< c_vector<double,3> > extra_h_conductivities;
00210         HeartConfig::Instance()->GetConductivityHeterogeneities(conductivities_heterogeneity_areas,
00211                                                                 intra_h_conductivities,
00212                                                                 extra_h_conductivities);
00213         unsigned local_element_index = 0;
00214         for (typename AbstractTetrahedralMesh<SPACE_DIM,SPACE_DIM>::ElementIterator it = this->mpMesh->GetElementIteratorBegin();
00215              it != this->mpMesh->GetElementIteratorEnd();
00216              ++it)
00217         {
00218             //unsigned element_index = it->GetIndex();
00219             // if element centroid is contained in the region
00220             ChastePoint<SPACE_DIM> element_centroid(it->CalculateCentroid());
00221             for (unsigned region_index=0; region_index< conductivities_heterogeneity_areas.size(); region_index++)
00222             {
00223                 if ( conductivities_heterogeneity_areas[region_index]->DoesContain(element_centroid) )
00224                 {
00225                     //We don't use ublas vector assignment here, because we might be getting a subvector of a 3-vector
00226                     for (unsigned i=0; i<SPACE_DIM; i++)
00227                     {
00228                         hetero_intra_conductivities[local_element_index][i] = intra_h_conductivities[region_index][i];
00229                     }
00230                 }
00231             }
00232             local_element_index++;
00233         }
00234 
00235         mpIntracellularConductivityTensorsSecondCell->SetNonConstantConductivities(&hetero_intra_conductivities);
00236     }
00237     else
00238     {
00239         mpIntracellularConductivityTensorsSecondCell->SetConstantConductivities(mIntracellularConductivitiesSecondCell);
00240     }
00241 
00242     mpIntracellularConductivityTensorsSecondCell->Init(this->mpMesh);
00243     HeartEventHandler::EndEvent(HeartEventHandler::READ_MESH);
00244 }
00245 
00246 template <unsigned SPACE_DIM>
00247 bool ExtendedBidomainTissue<SPACE_DIM>::HasTheUserSuppliedExtracellularStimulus()
00248 {
00249     return mUserSuppliedExtracellularStimulus;
00250 }
00251 
00252 template <unsigned SPACE_DIM>
00253 void ExtendedBidomainTissue<SPACE_DIM>::SetUserSuppliedExtracellularStimulus(bool flag)
00254 {
00255     mUserSuppliedExtracellularStimulus = flag;
00256 }
00257 
00258 template <unsigned SPACE_DIM>
00259 const std::vector<AbstractCardiacCell*>& ExtendedBidomainTissue<SPACE_DIM>::rGetSecondCellsDistributed() const
00260 {
00261     return mCellsDistributedSecondCell;
00262 }
00263 
00264 template <unsigned SPACE_DIM>
00265 const std::vector<double>& ExtendedBidomainTissue<SPACE_DIM>::rGetGapsDistributed() const
00266 {
00267     return mGgapDistributed;
00268 }
00269 
00270 template <unsigned SPACE_DIM>
00271 const std::vector<boost::shared_ptr<AbstractStimulusFunction> >& ExtendedBidomainTissue<SPACE_DIM>::rGetExtracellularStimulusDistributed() const
00272 {
00273     return mExtracellularStimuliDistributed;
00274 }
00275 
00276 
00277 template <unsigned SPACE_DIM>
00278 void ExtendedBidomainTissue<SPACE_DIM>::CreateExtracellularConductivityTensors()
00279 {
00280 
00281     mpExtracellularConductivityTensors =  new OrthotropicConductivityTensors<SPACE_DIM,SPACE_DIM>;
00282     c_vector<double, SPACE_DIM> extra_conductivities;
00283     this->mpConfig->GetExtracellularConductivities(extra_conductivities);
00284 
00285     // this definition must be here (and not inside the if statement) because SetNonConstantConductivities() will keep
00286     // a pointer to it and we don't want it to go out of scope before Init() is called
00287     unsigned num_elements = this->mpMesh->GetNumElements();
00288     std::vector<c_vector<double, SPACE_DIM> > hetero_extra_conductivities;
00289 
00290     if (this->mpConfig->GetConductivityHeterogeneitiesProvided())
00291     {
00292         try
00293         {
00294             assert(hetero_extra_conductivities.size()==0);
00295             //initialise with the values of teh default conductivity tensor
00296             hetero_extra_conductivities.resize(num_elements, extra_conductivities);
00297         }
00298         catch(std::bad_alloc &badAlloc)
00299         {
00300 #define COVERAGE_IGNORE
00301             std::cout << "Failed to allocate std::vector of size " << num_elements << std::endl;
00302             PetscTools::ReplicateException(true);
00303             throw badAlloc;
00304 #undef COVERAGE_IGNORE
00305         }
00306         PetscTools::ReplicateException(false);
00307 
00308         std::vector<boost::shared_ptr<AbstractChasteRegion<SPACE_DIM> > > conductivities_heterogeneity_areas;
00309         std::vector< c_vector<double,3> > intra_h_conductivities;
00310         std::vector< c_vector<double,3> > extra_h_conductivities;
00311         HeartConfig::Instance()->GetConductivityHeterogeneities(conductivities_heterogeneity_areas,
00312                                                                 intra_h_conductivities,
00313                                                                 extra_h_conductivities);
00314         unsigned local_element_index = 0;
00315         for (typename AbstractTetrahedralMesh<SPACE_DIM,SPACE_DIM>::ElementIterator iter = (this->mpMesh)->GetElementIteratorBegin();
00316              iter != (this->mpMesh)->GetElementIteratorEnd();
00317              ++iter)
00318         {
00319             //unsigned element_index = iter->GetIndex();
00320             // if element centroid is contained in the region
00321             ChastePoint<SPACE_DIM> element_centroid(iter->CalculateCentroid());
00322             for (unsigned region_index=0; region_index< conductivities_heterogeneity_areas.size(); region_index++)
00323             {
00324                 // if element centroid is contained in the region
00325                 if ( conductivities_heterogeneity_areas[region_index]->DoesContain( element_centroid ) )
00326                 {
00327                     //We don't use ublas vector assignment here, because we might be getting a subvector of a 3-vector
00328                     for (unsigned i=0; i<SPACE_DIM; i++)
00329                     {
00330                         hetero_extra_conductivities[local_element_index][i] = extra_h_conductivities[region_index][i];
00331                     }
00332                 }
00333             }
00334             local_element_index++;
00335         }
00336 
00337         mpExtracellularConductivityTensors->SetNonConstantConductivities(&hetero_extra_conductivities);
00338     }
00339     else
00340     {
00341         mpExtracellularConductivityTensors->SetConstantConductivities(extra_conductivities);
00342     }
00343     mpExtracellularConductivityTensors->Init(this->mpMesh);
00344 }
00345 
00346 template <unsigned SPACE_DIM>
00347 ExtendedBidomainTissue<SPACE_DIM>::~ExtendedBidomainTissue()
00348 {
00349     // Delete (second) cells
00350     for (std::vector<AbstractCardiacCell*>::iterator cell_iterator = mCellsDistributedSecondCell.begin();
00351          cell_iterator != mCellsDistributedSecondCell.end();
00352          ++cell_iterator)
00353     {
00354         delete (*cell_iterator);
00355     }
00356 
00357     if (mpExtracellularConductivityTensors)
00358     {
00359         delete mpExtracellularConductivityTensors;
00360     }
00361 
00362     if (mpIntracellularConductivityTensorsSecondCell)
00363     {
00364         delete mpIntracellularConductivityTensorsSecondCell;
00365     }
00366 }
00367 
00368 template <unsigned SPACE_DIM>
00369 void ExtendedBidomainTissue<SPACE_DIM>::SetIntracellularConductivitiesSecondCell(c_vector<double, SPACE_DIM> conductivities)
00370 {
00371     for (unsigned i = 0; i < SPACE_DIM; i++)
00372     {
00373         mIntracellularConductivitiesSecondCell[i] = conductivities[i];
00374     }
00375 }
00376 
00377 template <unsigned SPACE_DIM>
00378 c_vector<double, SPACE_DIM>  ExtendedBidomainTissue<SPACE_DIM>::GetIntracellularConductivitiesSecondCell() const
00379 {
00380     return mIntracellularConductivitiesSecondCell;
00381 }
00382 
00383 template <unsigned SPACE_DIM>
00384 const c_matrix<double, SPACE_DIM, SPACE_DIM>& ExtendedBidomainTissue<SPACE_DIM>::rGetExtracellularConductivityTensor(unsigned elementIndex)
00385 {
00386     assert(mpExtracellularConductivityTensors);
00387     return (*mpExtracellularConductivityTensors)[elementIndex];
00388 }
00389 
00390 template <unsigned SPACE_DIM>
00391 const c_matrix<double, SPACE_DIM, SPACE_DIM>& ExtendedBidomainTissue<SPACE_DIM>::rGetIntracellularConductivityTensorSecondCell(unsigned elementIndex)
00392 {
00393     assert(mpIntracellularConductivityTensorsSecondCell);
00394     return (*mpIntracellularConductivityTensorsSecondCell)[elementIndex];
00395 }
00396 
00397 template <unsigned SPACE_DIM>
00398 AbstractCardiacCell* ExtendedBidomainTissue<SPACE_DIM>::GetCardiacSecondCell( unsigned globalIndex )
00399 {
00400     return mCellsDistributedSecondCell[globalIndex - this->mpDistributedVectorFactory->GetLow()];
00401 }
00402 
00403 template <unsigned SPACE_DIM>
00404 boost::shared_ptr<AbstractStimulusFunction> ExtendedBidomainTissue<SPACE_DIM>::GetExtracellularStimulus( unsigned globalIndex )
00405 {
00406     return mExtracellularStimuliDistributed[globalIndex - this->mpDistributedVectorFactory->GetLow()];
00407 }
00408 
00409 template <unsigned SPACE_DIM>
00410 void ExtendedBidomainTissue<SPACE_DIM>::SolveCellSystems(Vec existingSolution, double time, double nextTime, bool updateVoltage)
00411 {
00412     HeartEventHandler::BeginEvent(HeartEventHandler::SOLVE_ODES);
00413 
00414     DistributedVector dist_solution = this->mpDistributedVectorFactory->CreateDistributedVector(existingSolution);
00415     DistributedVector::Stripe phi_i_first_cell(dist_solution, 0);
00416     DistributedVector::Stripe phi_i_second_cell(dist_solution, 1);
00417     DistributedVector::Stripe phi_e(dist_solution, 2);
00418 
00419     for (DistributedVector::Iterator index = dist_solution.Begin();
00420          index != dist_solution.End();
00421          ++index)
00422     {
00423         double voltage_first_cell = phi_i_first_cell[index] - phi_e[index];
00424         double voltage_second_cell = phi_i_second_cell[index] - phi_e[index];
00425 
00426         // overwrite the voltage with the input value
00427         this->mCellsDistributed[index.Local]->SetVoltage( voltage_first_cell );
00428         mCellsDistributedSecondCell[index.Local]->SetVoltage( voltage_second_cell );
00429         try
00430         {
00431             // solve
00432             // Note: Voltage should not be updated. GetIIonic will be called later
00433             // and needs the old voltage. The voltage will be updated from the pde.
00434             this->mCellsDistributed[index.Local]->ComputeExceptVoltage(time, nextTime);
00435             mCellsDistributedSecondCell[index.Local]->ComputeExceptVoltage(time, nextTime);
00436         }
00437         catch (Exception &e)
00438         {
00439 #define COVERAGE_IGNORE
00440             PetscTools::ReplicateException(true);
00441             throw e;
00442 #undef COVERAGE_IGNORE
00443         }
00444 
00445         // update the Iionic and stimulus caches
00446         this->UpdateCaches(index.Global, index.Local, nextTime);//in parent class
00447         UpdateAdditionalCaches(index.Global, index.Local, nextTime);//extended bidomain specific caches
00448     }
00449     PetscTools::ReplicateException(false);
00450     HeartEventHandler::EndEvent(HeartEventHandler::SOLVE_ODES);
00451 
00452     HeartEventHandler::BeginEvent(HeartEventHandler::COMMUNICATION);
00453     if ( this->mDoCacheReplication )
00454     {
00455         this->ReplicateCaches();
00456         ReplicateAdditionalCaches();//extended bidomain specific caches
00457     }
00458     HeartEventHandler::EndEvent(HeartEventHandler::COMMUNICATION);
00459 }
00460 
00461 template <unsigned SPACE_DIM>
00462 void ExtendedBidomainTissue<SPACE_DIM>::UpdateAdditionalCaches(unsigned globalIndex, unsigned localIndex, double nextTime)
00463 {
00464     mIionicCacheReplicatedSecondCell[globalIndex] = mCellsDistributedSecondCell[localIndex]->GetIIonic();
00465     mIntracellularStimulusCacheReplicatedSecondCell[globalIndex] = mCellsDistributedSecondCell[localIndex]->GetIntracellularStimulus(nextTime);
00466     mExtracellularStimulusCacheReplicated[globalIndex] = mExtracellularStimuliDistributed[localIndex]->GetStimulus(nextTime);
00467     mGgapCacheReplicated[globalIndex] = mGgapDistributed[localIndex];
00468 }
00469 
00470 template <unsigned SPACE_DIM>
00471 void ExtendedBidomainTissue<SPACE_DIM>::ReplicateAdditionalCaches()
00472 {
00473     mIionicCacheReplicatedSecondCell.Replicate(this->mpDistributedVectorFactory->GetLow(), this->mpDistributedVectorFactory->GetHigh());
00474     mIntracellularStimulusCacheReplicatedSecondCell.Replicate(this->mpDistributedVectorFactory->GetLow(), this->mpDistributedVectorFactory->GetHigh());
00475     mExtracellularStimulusCacheReplicated.Replicate(this->mpDistributedVectorFactory->GetLow(), this->mpDistributedVectorFactory->GetHigh());
00476     mGgapCacheReplicated.Replicate(this->mpDistributedVectorFactory->GetLow(), this->mpDistributedVectorFactory->GetHigh());
00477 }
00478 
00479 template <unsigned SPACE_DIM>
00480 ReplicatableVector& ExtendedBidomainTissue<SPACE_DIM>::rGetIionicCacheReplicatedSecondCell()
00481 {
00482     return mIionicCacheReplicatedSecondCell;
00483 }
00484 
00485 template <unsigned SPACE_DIM>
00486 ReplicatableVector& ExtendedBidomainTissue<SPACE_DIM>::rGetIntracellularStimulusCacheReplicatedSecondCell()
00487 {
00488     return mIntracellularStimulusCacheReplicatedSecondCell;
00489 }
00490 
00491 template <unsigned SPACE_DIM>
00492 ReplicatableVector& ExtendedBidomainTissue<SPACE_DIM>::rGetExtracellularStimulusCacheReplicated()
00493 {
00494     return mExtracellularStimulusCacheReplicated;
00495 }
00496 
00497 template <unsigned SPACE_DIM>
00498 ReplicatableVector& ExtendedBidomainTissue<SPACE_DIM>::rGetGgapCacheReplicated()
00499 {
00500     return mGgapCacheReplicated;
00501 }
00502 
00503 template <unsigned SPACE_DIM>
00504 double ExtendedBidomainTissue<SPACE_DIM>::GetAmFirstCell()
00505 {
00506     return mAmFirstCell;
00507 }
00508 
00509 template <unsigned SPACE_DIM>
00510 double ExtendedBidomainTissue<SPACE_DIM>::GetAmSecondCell()
00511 {
00512     return mAmSecondCell;
00513 }
00514 
00515 template <unsigned SPACE_DIM>
00516 double ExtendedBidomainTissue<SPACE_DIM>::GetAmGap()
00517 {
00518     return mAmGap;
00519 }
00520 
00521 template <unsigned SPACE_DIM>
00522 double ExtendedBidomainTissue<SPACE_DIM>::GetCmFirstCell()
00523 {
00524     return mCmFirstCell;
00525 }
00526 
00527 template <unsigned SPACE_DIM>
00528 double ExtendedBidomainTissue<SPACE_DIM>::GetCmSecondCell()
00529 {
00530     return mCmSecondCell;
00531 }
00532 
00533 template <unsigned SPACE_DIM>
00534 double ExtendedBidomainTissue<SPACE_DIM>::GetGGap()
00535 {
00536     return mGGap;
00537 }
00538 
00539 template <unsigned SPACE_DIM>
00540 void ExtendedBidomainTissue<SPACE_DIM>::SetAmFirstCell(double value)
00541 {
00542     mAmFirstCell = value;
00543 }
00544 
00545 template <unsigned SPACE_DIM>
00546 void ExtendedBidomainTissue<SPACE_DIM>::SetAmSecondCell(double value)
00547 {
00548     mAmSecondCell = value;
00549 }
00550 
00551 template <unsigned SPACE_DIM>
00552 void ExtendedBidomainTissue<SPACE_DIM>::SetAmGap(double value)
00553 {
00554     mAmGap = value;
00555 }
00556 
00557 template <unsigned SPACE_DIM>
00558 void ExtendedBidomainTissue<SPACE_DIM>::SetGGap(double value)
00559 {
00560     mGGap = value;
00561 }
00562 
00563 template <unsigned SPACE_DIM>
00564 void ExtendedBidomainTissue<SPACE_DIM>::SetCmFirstCell(double value)
00565 {
00566     mCmFirstCell = value;
00567 }
00568 
00569 template <unsigned SPACE_DIM>
00570 void ExtendedBidomainTissue<SPACE_DIM>::SetCmSecondCell(double value)
00571 {
00572     mCmSecondCell = value;
00573 }
00574 
00576 // Explicit instantiation
00578 
00579 template class ExtendedBidomainTissue<1>;
00580 template class ExtendedBidomainTissue<2>;
00581 template class ExtendedBidomainTissue<3>;
00582 
00583 // Serialization for Boost >= 1.36
00584 #include "SerializationExportWrapperForCpp.hpp"
00585 EXPORT_TEMPLATE_CLASS_SAME_DIMS(ExtendedBidomainTissue)
Generated on Thu Dec 22 13:00:07 2011 for Chaste by  doxygen 1.6.3