Chaste Commit::9e4a273f0754a391514ab12ed9d4a38fc9933db2
ImmersedBoundaryCellPopulation.hpp
1/*
2
3Copyright (c) 2005-2026, University of Oxford.
4All rights reserved.
5
6University of Oxford means the Chancellor, Masters and Scholars of the
7University of Oxford, having an administrative office at Wellington
8Square, Oxford OX1 2JD, UK.
9
10This file is part of Chaste.
11
12Redistribution and use in source and binary forms, with or without
13modification, 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
23THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34*/
35
36#ifndef IMMERSEDBOUNDARYCELLPOPULATION_HPP_
37#define IMMERSEDBOUNDARYCELLPOPULATION_HPP_
38
39#include "AbstractOffLatticeCellPopulation.hpp"
40#include "ImmersedBoundaryMesh.hpp"
41
42#include <boost/serialization/base_object.hpp>
43#include <boost/serialization/set.hpp>
44#include <boost/serialization/vector.hpp>
46
47template <unsigned DIM>
49
56template <unsigned DIM>
58{
59private:
62
65
71
77
83 boost::shared_ptr<AbstractImmersedBoundaryDivisionRule<DIM> > mpImmersedBoundaryDivisionRule;
84
90
93
96
99
102
109 virtual void WriteVtkResultsToFile(const std::string& rDirectory);
110
111 friend class boost::serialization::access;
124 template <class Archive>
125 void serialize(Archive& archive, const unsigned int version)
126 {
127 archive& boost::serialization::base_object<AbstractOffLatticeCellPopulation<DIM> >(*this);
130 archive& mInteractionDistance;
131 archive& mReMeshFrequency;
132 }
133
142 double Delta1D(double dist, double spacing);
143
150
155 void Validate();
156
157public:
175 std::vector<CellPtr>& rCells,
176 bool deleteMesh = false,
177 bool validate = true,
178 const std::vector<unsigned> locationIndices = std::vector<unsigned>());
179
186
191
198 double GetDampingConstant(unsigned nodeIndex);
199
204
209
217 ImmersedBoundaryElement<DIM, DIM>* GetElement(unsigned elementIndex);
218
228 ImmersedBoundaryElement<DIM - 1, DIM>* GetLamina(unsigned laminaIndex);
229
233 unsigned GetNumElements();
234
238 unsigned GetNumLaminas();
239
245 unsigned GetNumNodes();
246
252 void SetInteractionDistance(double newDistance);
253
257 double GetInteractionDistance() const;
258
265 void SetReMeshFrequency(unsigned newFrequency);
266
270 unsigned GetReMeshFrequency() const;
271
275 double GetIntrinsicSpacing() const;
276
288 c_vector<double, DIM> GetLocationOfCellCentre(CellPtr pCell);
289
297 Node<DIM>* GetNode(unsigned index);
298
309 std::set<unsigned> GetNeighbouringLocationIndices(CellPtr pCell);
310
318 unsigned AddNode(Node<DIM>* pNewNode);
319
325 void UpdateNodeLocations(double dt);
326
335 void SetNode(unsigned index, ChastePoint<DIM>& rNewLocation);
336
345 CellPtr pCell);
346
358 CellPtr AddCell(CellPtr pNewCell, CellPtr pParentCell = CellPtr());
359
368 unsigned RemoveDeadCells();
369
376 bool IsCellAssociatedWithADeletedLocation(CellPtr pCell);
377
386 void Update(bool hasHadBirthsOrDeaths = true);
387
395 virtual void OpenWritersFiles(OutputFileHandler& rOutputFileHandler);
396
402 virtual void AcceptPopulationWriter(
403 boost::shared_ptr<AbstractCellPopulationWriter<DIM, DIM> > pPopulationWriter);
404
410 virtual void AcceptPopulationEventWriter(
411 boost::shared_ptr<AbstractCellPopulationEventWriter<DIM, DIM> > pPopulationEventWriter);
412
418 virtual void AcceptPopulationCountWriter(
419 boost::shared_ptr<AbstractCellPopulationCountWriter<DIM, DIM> > pPopulationCountWriter);
420
427 virtual void AcceptCellWriter(
428 boost::shared_ptr<AbstractCellWriter<DIM, DIM> > pCellWriter,
429 CellPtr pCell);
430
438 double GetVolumeOfCell(CellPtr pCell);
439
445 void OutputCellPopulationParameters(out_stream& rParamsFile);
446
457 double GetWidth(const unsigned& rDimension);
458
466 std::set<unsigned> GetNeighbouringNodeIndices(unsigned index);
467
478
489 virtual bool IsPdeNodeAssociatedWithNonApoptoticCell(unsigned pdeNodeIndex);
490
508 virtual double GetCellDataItemAtPdeNode(unsigned pdeNodeIndex,
509 std::string& rVariableName,
510 bool dirichletBoundaryConditionApplies = false,
511 double dirichletBoundaryValue = 0.0);
512
516 boost::shared_ptr<AbstractImmersedBoundaryDivisionRule<DIM> > GetImmersedBoundaryDivisionRule();
517
524 boost::shared_ptr<AbstractImmersedBoundaryDivisionRule<DIM> > pImmersedBoundaryDivisionRule);
525
531
537 bool IsCellOnBoundary(CellPtr pCell);
538
544 void SetIfPopulationHasActiveSources(bool hasActiveSources);
545
551 void SetOutputNodeRegionToVtk(bool outputNodeRegionsToVtk);
552
563 virtual double GetDefaultTimeStep();
564};
565
568
569namespace boost
570{
571namespace serialization
572{
576 template <class Archive, unsigned DIM>
577 inline void save_construct_data(
578 Archive& ar, const ImmersedBoundaryCellPopulation<DIM>* t, const unsigned int file_version)
579 {
580 // Save data required to construct instance
581 const ImmersedBoundaryMesh<DIM, DIM>* p_mesh = &(t->rGetMesh());
582 ar& p_mesh;
583 ar& t->DoesPopulationHaveActiveSources();
584 ar& t->GetInteractionDistance();
585 ar& t->GetReMeshFrequency();
586 }
587
592 template <class Archive, unsigned DIM>
593 inline void load_construct_data(
594 Archive& ar, ImmersedBoundaryCellPopulation<DIM>* t, const unsigned int file_version)
595 {
596 // Retrieve data from archive required to construct new instance
598 ar >> p_mesh;
599 bool hasActiveSources = false;
600 ar >> hasActiveSources;
601 double interactionDistance = 0.0;
602 ar >> interactionDistance;
603 unsigned int reMeshFrequency = 1;
604 ar >> reMeshFrequency;
605
606 // Invoke inplace constructor to initialise instance
607 ::new (t) ImmersedBoundaryCellPopulation<DIM>(*p_mesh);
608 t->SetIfPopulationHasActiveSources(hasActiveSources);
609 t->SetInteractionDistance(interactionDistance);
610 t->SetReMeshFrequency(reMeshFrequency);
611 }
612}
613} // namespace ...
614
615#endif /*IMMERSEDBOUNDARYCELLPOPULATION_HPP_*/
gcov doesn't like this file...
#define EXPORT_TEMPLATE_CLASS_SAME_DIMS(CLASS)
virtual void OpenWritersFiles(OutputFileHandler &rOutputFileHandler)
double Delta1D(double dist, double spacing)
boost::shared_ptr< AbstractImmersedBoundaryDivisionRule< DIM > > mpImmersedBoundaryDivisionRule
virtual void AcceptCellWriter(boost::shared_ptr< AbstractCellWriter< DIM, DIM > > pCellWriter, CellPtr pCell)
virtual double GetCellDataItemAtPdeNode(unsigned pdeNodeIndex, std::string &rVariableName, bool dirichletBoundaryConditionApplies=false, double dirichletBoundaryValue=0.0)
void OutputCellPopulationParameters(out_stream &rParamsFile)
virtual void AcceptPopulationEventWriter(boost::shared_ptr< AbstractCellPopulationEventWriter< DIM, DIM > > pPopulationEventWriter)
ImmersedBoundaryMesh< DIM, DIM > & rGetMesh()
boost::shared_ptr< AbstractImmersedBoundaryDivisionRule< DIM > > GetImmersedBoundaryDivisionRule()
ImmersedBoundaryElement< DIM - 1, DIM > * GetLamina(unsigned laminaIndex)
ImmersedBoundaryElement< DIM, DIM > * GetElementCorrespondingToCell(CellPtr pCell)
ImmersedBoundaryElement< DIM, DIM > * GetElement(unsigned elementIndex)
std::set< unsigned > GetNeighbouringNodeIndices(unsigned index)
c_vector< double, DIM > GetLocationOfCellCentre(CellPtr pCell)
void Update(bool hasHadBirthsOrDeaths=true)
virtual void AcceptPopulationWriter(boost::shared_ptr< AbstractCellPopulationWriter< DIM, DIM > > pPopulationWriter)
virtual void AcceptPopulationCountWriter(boost::shared_ptr< AbstractCellPopulationCountWriter< DIM, DIM > > pPopulationCountWriter)
virtual bool IsPdeNodeAssociatedWithNonApoptoticCell(unsigned pdeNodeIndex)
void SetImmersedBoundaryDivisionRule(boost::shared_ptr< AbstractImmersedBoundaryDivisionRule< DIM > > pImmersedBoundaryDivisionRule)
void SetOutputNodeRegionToVtk(bool outputNodeRegionsToVtk)
CellPtr AddCell(CellPtr pNewCell, CellPtr pParentCell=CellPtr())
virtual void WriteVtkResultsToFile(const std::string &rDirectory)
std::set< unsigned > GetNeighbouringLocationIndices(CellPtr pCell)
void SetNode(unsigned index, ChastePoint< DIM > &rNewLocation)
virtual TetrahedralMesh< DIM, DIM > * GetTetrahedralMeshForPdeModifier()
ImmersedBoundaryMesh< DIM, DIM > * mpImmersedBoundaryMesh
void SetIfPopulationHasActiveSources(bool hasActiveSources)
void serialize(Archive &archive, const unsigned int version)
double GetWidth(const unsigned &rDimension)
Definition Node.hpp:59