Chaste  Release::2017.1
ExtendedBidomainTissue.cpp
1 /*
2 
3 Copyright (c) 2005-2017, University of Oxford.
4 All rights reserved.
5 
6 University of Oxford means the Chancellor, Masters and Scholars of the
7 University of Oxford, having an administrative office at Wellington
8 Square, Oxford OX1 2JD, UK.
9 
10 This file is part of Chaste.
11 
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions are met:
14  * Redistributions of source code must retain the above copyright notice,
15  this list of conditions and the following disclaimer.
16  * Redistributions in binary form must reproduce the above copyright notice,
17  this list of conditions and the following disclaimer in the documentation
18  and/or other materials provided with the distribution.
19  * Neither the name of the University of Oxford nor the names of its
20  contributors may be used to endorse or promote products derived from this
21  software without specific prior written permission.
22 
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 
34 */
35 
36 #include "ExtendedBidomainTissue.hpp"
37 
38 #include "DistributedVector.hpp"
39 #include "OrthotropicConductivityTensors.hpp"
40 #include "AxisymmetricConductivityTensors.hpp"
41 #include "AbstractStimulusFunction.hpp"
42 #include "ChastePoint.hpp"
43 #include "AbstractChasteRegion.hpp"
44 #include "HeartEventHandler.hpp"
45 
46 template <unsigned SPACE_DIM>
48  AbstractCardiacCellFactory<SPACE_DIM>* pCellFactorySecondCell,
49  AbstractStimulusFactory<SPACE_DIM>* pExtracellularStimulusFactory)
50  : AbstractCardiacTissue<SPACE_DIM>(pCellFactory),
51  mpIntracellularConductivityTensorsSecondCell(NULL),
52  mUserSuppliedExtracellularStimulus(false)
53 {
54  //First, do the same that the abstract constructor does, but applied to the second cell
55 
56  assert(pCellFactorySecondCell != NULL);
57  assert(pCellFactorySecondCell->GetMesh() != NULL);
58  assert(pCellFactorySecondCell->GetNumberOfCells() == pCellFactory->GetNumberOfCells() );
59  assert(pExtracellularStimulusFactory != NULL);
60  assert(pExtracellularStimulusFactory->GetMesh() != NULL);
61  assert(pExtracellularStimulusFactory->GetNumberOfCells() == pCellFactorySecondCell->GetNumberOfCells() );
62 
63  unsigned num_local_nodes = this->mpDistributedVectorFactory->GetLocalOwnership();
64  unsigned ownership_range_low = this->mpDistributedVectorFactory->GetLow();
65  mCellsDistributedSecondCell.resize(num_local_nodes);
66  mGgapDistributed.resize(num_local_nodes);
67  mExtracellularStimuliDistributed.resize(num_local_nodes);
68 
69  try
70  {
71  for (unsigned local_index = 0; local_index < num_local_nodes; local_index++)
72  {
73  unsigned global_index = local_index + ownership_range_low;
74  Node<SPACE_DIM>* p_node = this->mpMesh->GetNode(global_index);
75  mCellsDistributedSecondCell[local_index] = pCellFactorySecondCell->CreateCardiacCellForNode(p_node);
76  mCellsDistributedSecondCell[local_index]->SetUsedInTissueSimulation();
77  mGgapDistributed[local_index] = 0.0;//default. It will be changed by specific method later when user input will be obtained
78  mExtracellularStimuliDistributed[local_index] = pExtracellularStimulusFactory->CreateStimulusForNode(p_node);
79  }
80 
81  pCellFactorySecondCell->FinaliseCellCreation(&mCellsDistributedSecondCell,
84  }
85  // LCOV_EXCL_START //don't really know how to cover this...
86  catch (const Exception& e)
87  {
88  // Errors thrown creating cells will often be process-specific
90  // Should really do this for other processes too, but this is all we need
91  // to get memory testing to pass, and leaking when we're about to die isn't
92  // that bad! Delete second cells
93  for (std::vector<AbstractCardiacCellInterface*>::iterator cell_iterator = mCellsDistributedSecondCell.begin();
94  cell_iterator != mCellsDistributedSecondCell.end();
95  ++cell_iterator)
96  {
97  delete (*cell_iterator);
98  }
99  throw e;
100  }
101  // LCOV_EXCL_STOP
103 
104  HeartEventHandler::BeginEvent(HeartEventHandler::COMMUNICATION);
107  mGgapCacheReplicated.Resize(pCellFactorySecondCell->GetNumberOfCells());//this is a bit of a hack...
108  mExtracellularStimulusCacheReplicated.Resize(pExtracellularStimulusFactory->GetNumberOfCells());
109  HeartEventHandler::EndEvent(HeartEventHandler::COMMUNICATION);
110 
111  //Create the extracellular conductivity tensor
113 }
114 
115 //archiving constructor
116 template <unsigned SPACE_DIM>
117 ExtendedBidomainTissue<SPACE_DIM>::ExtendedBidomainTissue(std::vector<AbstractCardiacCellInterface*> & rCellsDistributed,
118  std::vector<AbstractCardiacCellInterface*> & rSecondCellsDistributed,
119  std::vector<boost::shared_ptr<AbstractStimulusFunction> > & rExtraStimuliDistributed,
120  std::vector<double> & rGgapsDistributed,
122  c_vector<double, SPACE_DIM> intracellularConductivitiesSecondCell)
123  : AbstractCardiacTissue<SPACE_DIM>(pMesh),
125  mIntracellularConductivitiesSecondCell(intracellularConductivitiesSecondCell),
126  mCellsDistributedSecondCell(rSecondCellsDistributed),
127  mExtracellularStimuliDistributed(rExtraStimuliDistributed),
128  mGgapDistributed(rGgapsDistributed),
130 {
131  //segfault guards in case we failed to load anything from the archive
132  assert(mCellsDistributedSecondCell.size() > 0);
133  assert(mExtracellularStimuliDistributed.size() > 0);
134  assert(mGgapDistributed.size() > 0);
135  //allocate memory for the caches
140 
143 }
144 
145 
146 template <unsigned SPACE_DIM>
147 void ExtendedBidomainTissue<SPACE_DIM>::SetGgapHeterogeneities(std::vector<boost::shared_ptr<AbstractChasteRegion<SPACE_DIM> > >& rGgapHeterogeneityRegions,
148  std::vector<double> rGgapValues)
149 {
150  assert( rGgapHeterogeneityRegions.size() == rGgapValues.size() );//problem class (which calls this method should have thrown otherwise)
151  mGgapHeterogeneityRegions = rGgapHeterogeneityRegions;
152  mGgapValues =rGgapValues;
153 }
154 
155 template <unsigned SPACE_DIM>
157 {
158  assert(mGgapHeterogeneityRegions.size() == mGgapValues.size());
159  assert(this->mpMesh != NULL);
160 
161  unsigned ownership_range_low = this->mpDistributedVectorFactory->GetLow();
162  unsigned num_local_nodes = this->mpDistributedVectorFactory->GetLocalOwnership();
163  assert(mGgapDistributed.size() == num_local_nodes);//the constructor should have allocated memory.
164  try
165  {
166  for (unsigned local_index = 0; local_index < num_local_nodes; local_index++)
167  {
168  unsigned global_index = ownership_range_low + local_index;
169  Node<SPACE_DIM>* p_node = this->mpMesh->GetNode(global_index);
170  mGgapDistributed[local_index] = mGGap;//assign default uniform value everywhere first
171 
172  // Then change where and if necessary
173  for (unsigned het_index = 0; het_index < mGgapHeterogeneityRegions.size(); het_index++)
174  {
175  if (mGgapHeterogeneityRegions[het_index]->DoesContain(p_node->GetPoint()))
176  {
177  mGgapDistributed[local_index] = mGgapValues[het_index];
178  }
179  }
180  }
181  }
182  // LCOV_EXCL_START
183  catch (const Exception& e)
184  {
186  throw e;
187  }
188  // LCOV_EXCL_STOP
189 
191 }
192 
193 template <unsigned SPACE_DIM>
195 {
196  HeartEventHandler::BeginEvent(HeartEventHandler::READ_MESH);
198 
199  if (this->mpConfig->IsMeshProvided() && this->mpConfig->GetLoadMesh())
200  {
201  assert(this->mFibreFilePathNoExtension != "");
202 
203  switch (this->mpConfig->GetConductivityMedia())
204  {
205  case cp::media_type::Orthotropic:
206  {
208  FileFinder ortho_file(this->mFibreFilePathNoExtension + ".ortho", RelativeTo::AbsoluteOrCwd);
209  assert(ortho_file.Exists());
211  break;
212  }
213 
214  case cp::media_type::Axisymmetric:
215  {
218  assert(axi_file.Exists());
220  break;
221  }
222 
223  case cp::media_type::NoFibreOrientation:
225  break;
226 
227  default :
229  }
230  }
231  else // Slab defined in config file or SetMesh() called; no fibre orientation assumed
232  {
234  }
235 
236  // this definition must be here (and not inside the if statement) because SetNonConstantConductivities() will keep
237  // a pointer to it and we don't want it to go out of scope before Init() is called
238  unsigned num_elements = this->mpMesh->GetNumElements();
239  std::vector<c_vector<double, SPACE_DIM> > hetero_intra_conductivities;
240 
241  c_vector<double, SPACE_DIM> intra_conductivities;
242  this->mpConfig->GetIntracellularConductivities(intra_conductivities);//this one is used just for resizing
243 
245  {
246  try
247  {
248  assert(hetero_intra_conductivities.size()==0);
249  hetero_intra_conductivities.resize(num_elements, intra_conductivities);
250  }
251  // LCOV_EXCL_START
252  catch(std::bad_alloc &badAlloc)
253  {
254 
255  std::cout << "Failed to allocate std::vector of size " << num_elements << std::endl;
257  throw badAlloc;
258  }
259  // LCOV_EXCL_STOP
260 
262 
263  std::vector<boost::shared_ptr<AbstractChasteRegion<SPACE_DIM> > > conductivities_heterogeneity_areas;
264  std::vector< c_vector<double,3> > intra_h_conductivities;
265  std::vector< c_vector<double,3> > extra_h_conductivities;
266  HeartConfig::Instance()->GetConductivityHeterogeneities(conductivities_heterogeneity_areas,
267  intra_h_conductivities,
268  extra_h_conductivities);
269  unsigned local_element_index = 0;
271  it != this->mpMesh->GetElementIteratorEnd();
272  ++it)
273  {
274  //unsigned element_index = it->GetIndex();
275  // if element centroid is contained in the region
276  ChastePoint<SPACE_DIM> element_centroid(it->CalculateCentroid());
277  for (unsigned region_index=0; region_index< conductivities_heterogeneity_areas.size(); region_index++)
278  {
279  if (conductivities_heterogeneity_areas[region_index]->DoesContain(element_centroid))
280  {
281  // We don't use ublas vector assignment here, because we might be getting a subvector of a 3-vector
282  for (unsigned i=0; i<SPACE_DIM; i++)
283  {
284  hetero_intra_conductivities[local_element_index][i] = intra_h_conductivities[region_index][i];
285  }
286  }
287  }
288  local_element_index++;
289  }
290 
292  }
293  else
294  {
296  }
297 
299  HeartEventHandler::EndEvent(HeartEventHandler::READ_MESH);
300 }
301 
302 template <unsigned SPACE_DIM>
304 {
306 }
307 
308 template <unsigned SPACE_DIM>
310 {
312 }
313 
314 template <unsigned SPACE_DIM>
315 const std::vector<AbstractCardiacCellInterface*>& ExtendedBidomainTissue<SPACE_DIM>::rGetSecondCellsDistributed() const
316 {
318 }
319 
320 template <unsigned SPACE_DIM>
322 {
323  return mGgapDistributed;
324 }
325 
326 template <unsigned SPACE_DIM>
327 const std::vector<boost::shared_ptr<AbstractStimulusFunction> >& ExtendedBidomainTissue<SPACE_DIM>::rGetExtracellularStimulusDistributed() const
328 {
330 }
331 
332 
333 template <unsigned SPACE_DIM>
335 {
336  if (this->mpConfig->IsMeshProvided() && this->mpConfig->GetLoadMesh())
337  {
338  assert(this->mFibreFilePathNoExtension != "");
339  switch (this->mpConfig->GetConductivityMedia())
340  {
341  case cp::media_type::Orthotropic:
342  {
344  FileFinder ortho_file(this->mFibreFilePathNoExtension + ".ortho", RelativeTo::AbsoluteOrCwd);
345  assert(ortho_file.Exists());
347  break;
348  }
349 
350  case cp::media_type::Axisymmetric:
351  {
354  assert(axi_file.Exists());
356  break;
357  }
358 
359  case cp::media_type::NoFibreOrientation:
361  break;
362 
363  default :
365  }
366  }
367  else // no fibre orientation assumed
368  {
370  }
371 
372  c_vector<double, SPACE_DIM> extra_conductivities;
373  this->mpConfig->GetExtracellularConductivities(extra_conductivities);
374 
375  // this definition must be here (and not inside the if statement) because SetNonConstantConductivities() will keep
376  // a pointer to it and we don't want it to go out of scope before Init() is called
377  unsigned num_elements = this->mpMesh->GetNumElements();
378  std::vector<c_vector<double, SPACE_DIM> > hetero_extra_conductivities;
379 
381  {
382  try
383  {
384  assert(hetero_extra_conductivities.size()==0);
385  //initialise with the values of teh default conductivity tensor
386  hetero_extra_conductivities.resize(num_elements, extra_conductivities);
387  }
388  // LCOV_EXCL_START
389  catch(std::bad_alloc &badAlloc)
390  {
391  std::cout << "Failed to allocate std::vector of size " << num_elements << std::endl;
393  throw badAlloc;
394  }
395  // LCOV_EXCL_STOP
396 
398 
399  std::vector<boost::shared_ptr<AbstractChasteRegion<SPACE_DIM> > > conductivities_heterogeneity_areas;
400  std::vector< c_vector<double,3> > intra_h_conductivities;
401  std::vector< c_vector<double,3> > extra_h_conductivities;
402  HeartConfig::Instance()->GetConductivityHeterogeneities(conductivities_heterogeneity_areas,
403  intra_h_conductivities,
404  extra_h_conductivities);
405  unsigned local_element_index = 0;
406  for (typename AbstractTetrahedralMesh<SPACE_DIM,SPACE_DIM>::ElementIterator iter = (this->mpMesh)->GetElementIteratorBegin();
407  iter != (this->mpMesh)->GetElementIteratorEnd();
408  ++iter)
409  {
410  //unsigned element_index = iter->GetIndex();
411  // if element centroid is contained in the region
412  ChastePoint<SPACE_DIM> element_centroid(iter->CalculateCentroid());
413  for (unsigned region_index=0; region_index< conductivities_heterogeneity_areas.size(); region_index++)
414  {
415  // If element centroid is contained in the region
416  if (conductivities_heterogeneity_areas[region_index]->DoesContain(element_centroid))
417  {
418  // We don't use ublas vector assignment here, because we might be getting a subvector of a 3-vector
419  for (unsigned i=0; i<SPACE_DIM; i++)
420  {
421  hetero_extra_conductivities[local_element_index][i] = extra_h_conductivities[region_index][i];
422  }
423  }
424  }
425  local_element_index++;
426  }
427 
429  }
430  else
431  {
433  }
435 }
436 
437 template <unsigned SPACE_DIM>
439 {
440  // Delete (second) cells
441  for (std::vector<AbstractCardiacCellInterface*>::iterator cell_iterator = mCellsDistributedSecondCell.begin();
442  cell_iterator != mCellsDistributedSecondCell.end();
443  ++cell_iterator)
444  {
445  delete (*cell_iterator);
446  }
447 
449  {
451  }
452 
454  {
456  }
457 }
458 
459 template <unsigned SPACE_DIM>
461 {
462  for (unsigned i = 0; i < SPACE_DIM; i++)
463  {
464  mIntracellularConductivitiesSecondCell[i] = conductivities[i];
465  }
466 }
467 
468 template <unsigned SPACE_DIM>
470 {
472 }
473 
474 template <unsigned SPACE_DIM>
475 const c_matrix<double, SPACE_DIM, SPACE_DIM>& ExtendedBidomainTissue<SPACE_DIM>::rGetExtracellularConductivityTensor(unsigned elementIndex)
476 {
478  if (this->mpConductivityModifier==NULL)
479  {
480  return (*mpExtracellularConductivityTensors)[elementIndex];
481  }
482  else
483  {
484  return this->mpConductivityModifier->rGetModifiedConductivityTensor(elementIndex, (*mpExtracellularConductivityTensors)[elementIndex], 1u);
485  }
486 }
487 
488 template <unsigned SPACE_DIM>
489 const c_matrix<double, SPACE_DIM, SPACE_DIM>& ExtendedBidomainTissue<SPACE_DIM>::rGetIntracellularConductivityTensorSecondCell(unsigned elementIndex)
490 {
492  if (this->mpConductivityModifier==NULL)
493  {
494  return (*mpIntracellularConductivityTensorsSecondCell)[elementIndex];
495  }
496  else
497  {
499  }
500 }
501 
502 template <unsigned SPACE_DIM>
504 {
505  return mCellsDistributedSecondCell[globalIndex - this->mpDistributedVectorFactory->GetLow()];
506 }
507 
508 template <unsigned SPACE_DIM>
509 boost::shared_ptr<AbstractStimulusFunction> ExtendedBidomainTissue<SPACE_DIM>::GetExtracellularStimulus( unsigned globalIndex )
510 {
512 }
513 
514 template <unsigned SPACE_DIM>
515 void ExtendedBidomainTissue<SPACE_DIM>::SolveCellSystems(Vec existingSolution, double time, double nextTime, bool updateVoltage)
516 {
517  HeartEventHandler::BeginEvent(HeartEventHandler::SOLVE_ODES);
518 
519  DistributedVector dist_solution = this->mpDistributedVectorFactory->CreateDistributedVector(existingSolution);
520  DistributedVector::Stripe V_first_cell(dist_solution, 0);
521  DistributedVector::Stripe V_second_cell(dist_solution, 1);
522  DistributedVector::Stripe phi_e(dist_solution, 2);
523 
524  for (DistributedVector::Iterator index = dist_solution.Begin();
525  index != dist_solution.End();
526  ++index)
527  {
528  // overwrite the voltage with the input value
529  this->mCellsDistributed[index.Local]->SetVoltage( V_first_cell[index] );
530  mCellsDistributedSecondCell[index.Local]->SetVoltage( V_second_cell[index] );
531  try
532  {
533  // solve
534  // Note: Voltage should not be updated. GetIIonic will be called later
535  // and needs the old voltage. The voltage will be updated from the pde.
536  this->mCellsDistributed[index.Local]->ComputeExceptVoltage(time, nextTime);
537  mCellsDistributedSecondCell[index.Local]->ComputeExceptVoltage(time, nextTime);
538  }
539  // LCOV_EXCL_START
540  catch (Exception &e)
541  {
543  throw e;
544  }
545  // LCOV_EXCL_STOP
546 
547  // update the Iionic and stimulus caches
548  this->UpdateCaches(index.Global, index.Local, nextTime);//in parent class
549  UpdateAdditionalCaches(index.Global, index.Local, nextTime);//extended bidomain specific caches
550  }
552  HeartEventHandler::EndEvent(HeartEventHandler::SOLVE_ODES);
553 
554  HeartEventHandler::BeginEvent(HeartEventHandler::COMMUNICATION);
555  if (this->mDoCacheReplication)
556  {
557  this->ReplicateCaches();
558  ReplicateAdditionalCaches();//extended bidomain specific caches
559  }
560  HeartEventHandler::EndEvent(HeartEventHandler::COMMUNICATION);
561 }
562 
563 template <unsigned SPACE_DIM>
564 void ExtendedBidomainTissue<SPACE_DIM>::UpdateAdditionalCaches(unsigned globalIndex, unsigned localIndex, double nextTime)
565 {
566  mIionicCacheReplicatedSecondCell[globalIndex] = mCellsDistributedSecondCell[localIndex]->GetIIonic();
567  mIntracellularStimulusCacheReplicatedSecondCell[globalIndex] = mCellsDistributedSecondCell[localIndex]->GetIntracellularStimulus(nextTime);
568  mExtracellularStimulusCacheReplicated[globalIndex] = mExtracellularStimuliDistributed[localIndex]->GetStimulus(nextTime);
569  mGgapCacheReplicated[globalIndex] = mGgapDistributed[localIndex];
570 }
571 
572 template <unsigned SPACE_DIM>
574 {
579 }
580 
581 template <unsigned SPACE_DIM>
583 {
585 }
586 
587 template <unsigned SPACE_DIM>
589 {
591 }
592 
593 template <unsigned SPACE_DIM>
595 {
597 }
598 
599 template <unsigned SPACE_DIM>
601 {
602  return mGgapCacheReplicated;
603 }
604 
605 template <unsigned SPACE_DIM>
607 {
608  return mAmFirstCell;
609 }
610 
611 template <unsigned SPACE_DIM>
613 {
614  return mAmSecondCell;
615 }
616 
617 template <unsigned SPACE_DIM>
619 {
620  return mAmGap;
621 }
622 
623 template <unsigned SPACE_DIM>
625 {
626  return mCmFirstCell;
627 }
628 
629 template <unsigned SPACE_DIM>
631 {
632  return mCmSecondCell;
633 }
634 
635 template <unsigned SPACE_DIM>
637 {
638  return mGGap;
639 }
640 
641 template <unsigned SPACE_DIM>
643 {
644  mAmFirstCell = value;
645 }
646 
647 template <unsigned SPACE_DIM>
649 {
650  mAmSecondCell = value;
651 }
652 
653 template <unsigned SPACE_DIM>
655 {
656  mAmGap = value;
657 }
658 
659 template <unsigned SPACE_DIM>
661 {
662  mGGap = value;
663 }
664 
665 template <unsigned SPACE_DIM>
667 {
668  mCmFirstCell = value;
669 }
670 
671 template <unsigned SPACE_DIM>
673 {
674  mCmSecondCell = value;
675 }
676 
677 // Explicit instantiation
678 template class ExtendedBidomainTissue<1>;
679 template class ExtendedBidomainTissue<2>;
680 template class ExtendedBidomainTissue<3>;
681 
682 // Serialization for Boost >= 1.36
void SetFibreOrientationFile(const FileFinder &rFibreOrientationFile)
virtual void FinaliseCellCreation(std::vector< AbstractCardiacCellInterface * > *pCellsDistributed, unsigned lo, unsigned hi)
AbstractConductivityTensors< SPACE_DIM, SPACE_DIM > * mpExtracellularConductivityTensors
ReplicatableVector mIionicCacheReplicatedSecondCell
std::vector< boost::shared_ptr< AbstractChasteRegion< SPACE_DIM > > > mGgapHeterogeneityRegions
ElementIterator GetElementIteratorBegin(bool skipDeletedElements=true)
virtual AbstractCardiacCellInterface * CreateCardiacCellForNode(Node< SPACE_DIM > *pNode)
ReplicatableVector & rGetExtracellularStimulusCacheReplicated()
cp::media_type GetConductivityMedia() const
DistributedVectorFactory * mpDistributedVectorFactory
void SetNonConstantConductivities(std::vector< c_vector< double, SPACE_DIM > > *pNonConstantConductivities)
ReplicatableVector & rGetIionicCacheReplicatedSecondCell()
Definition: Node.hpp:58
virtual void SolveCellSystems(Vec existingSolution, double time, double nextTime, bool updateVoltage=false)
c_vector< double, SPACE_DIM > GetIntracellularConductivitiesSecondCell() const
AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > * GetMesh()
std::vector< AbstractCardiacCellInterface * > mCellsDistributedSecondCell
ReplicatableVector & rGetGgapCacheReplicated()
void Replicate(unsigned lo, unsigned hi)
void GetIntracellularConductivities(c_vector< double, 3 > &rIntraConductivities) const
void GetExtracellularConductivities(c_vector< double, 3 > &rExtraConductivities) const
void SetGgapHeterogeneities(std::vector< boost::shared_ptr< AbstractChasteRegion< SPACE_DIM > > > &rGgapHeterogeneityRegions, std::vector< double > rGgapValues)
DistributedVector CreateDistributedVector(Vec vec, bool readOnly=false)
AbstractCardiacCellInterface * GetCardiacSecondCell(unsigned globalIndex)
c_vector< double, SPACE_DIM > mIntracellularConductivitiesSecondCell
Node< SPACE_DIM > * GetNode(unsigned index) const
virtual unsigned GetNumElements() const
const c_matrix< double, SPACE_DIM, SPACE_DIM > & rGetExtracellularConductivityTensor(unsigned elementIndex)
void SetAmSecondCell(double value)
std::vector< double > mGgapDistributed
void UpdateCaches(unsigned globalIndex, unsigned localIndex, double nextTime)
virtual void Init(AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh)=0
void UpdateAdditionalCaches(unsigned globalIndex, unsigned localIndex, double nextTime)
std::vector< boost::shared_ptr< AbstractStimulusFunction > > mExtracellularStimuliDistributed
#define NEVER_REACHED
Definition: Exception.hpp:206
AbstractConductivityTensors< SPACE_DIM, SPACE_DIM > * mpIntracellularConductivityTensorsSecondCell
void GetConductivityHeterogeneities(std::vector< boost::shared_ptr< AbstractChasteRegion< DIM > > > &conductivitiesHeterogeneityAreas, std::vector< c_vector< double, 3 > > &intraConductivities, std::vector< c_vector< double, 3 > > &extraConductivities) const
boost::shared_ptr< AbstractStimulusFunction > GetExtracellularStimulus(unsigned globalIndex)
void SetCmSecondCell(double value)
std::vector< AbstractCardiacCellInterface * > mCellsDistributed
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
ReplicatableVector & rGetIntracellularStimulusCacheReplicatedSecondCell()
c_matrix< double, SPACE_DIM, SPACE_DIM > & rGetModifiedConductivityTensor(unsigned elementIndex, const c_matrix< double, SPACE_DIM, SPACE_DIM > &rOriginalConductivity, unsigned domainIndex)
void SetConstantConductivities(c_vector< double, 1 > constantConductivities)
static void ReplicateException(bool flag)
Definition: PetscTools.cpp:198
std::vector< double > mGgapValues
AbstractTetrahedralMesh< ELEMENT_DIM, ELEMENT_DIM > * mpMesh
const std::vector< double > & rGetGapsDistributed() const
virtual boost::shared_ptr< AbstractStimulusFunction > CreateStimulusForNode(Node< SPACE_DIM > *pNode)
ReplicatableVector mIntracellularStimulusCacheReplicatedSecondCell
bool IsMeshProvided() const
AbstractConductivityModifier< ELEMENT_DIM, ELEMENT_DIM > * mpConductivityModifier
bool Exists() const
Definition: FileFinder.cpp:180
void Resize(unsigned size)
AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > * GetMesh()
ChastePoint< SPACE_DIM > GetPoint() const
Definition: Node.cpp:133
bool GetLoadMesh() const
void SetIntracellularConductivitiesSecondCell(c_vector< double, SPACE_DIM > conductivities)
void SetUserSuppliedExtracellularStimulus(bool flag)
const c_matrix< double, SPACE_DIM, SPACE_DIM > & rGetIntracellularConductivityTensorSecondCell(unsigned elementIndex)
static HeartConfig * Instance()
bool GetConductivityHeterogeneitiesProvided() const
ExtendedBidomainTissue(AbstractCardiacCellFactory< SPACE_DIM > *pCellFactory, AbstractCardiacCellFactory< SPACE_DIM > *pCellFactorySecondCell, AbstractStimulusFactory< SPACE_DIM > *pExtracellularStimulusFactory)