Chaste  Build::
AbstractDiscreteContinuumSolver.hpp
1 /*
2 
3 Copyright (c) 2005-2016, 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 #ifndef ABSTRACTDISCRETECONTINUUMSOLVER_HPP_
37 #define ABSTRACTDISCRETECONTINUUMSOLVER_HPP_
38 
39 #include <vector>
40 #include <string>
41 #include "OutputFileHandler.hpp"
42 #include "VesselNetwork.hpp"
43 #include "AbstractCellPopulation.hpp"
44 #include "AbstractDiscreteContinuumLinearEllipticPde.hpp"
45 #include "AbstractDiscreteContinuumNonLinearEllipticPde.hpp"
46 #include "DiscreteContinuumBoundaryCondition.hpp"
47 #include "RegularGrid.hpp"
48 #include "DiscreteContinuumMesh.hpp"
49 #include "UnitCollection.hpp"
50 
58 template<unsigned DIM>
60 {
61 
62 protected:
63 
67  boost::shared_ptr<VesselNetwork<DIM> > mpNetwork;
68 
72  AbstractCellPopulation<DIM>* mpCellPopulation;
73 
77  units::quantity<unit::length> mCellPopulationReferenceLength;
78 
82  units::quantity<unit::concentration> mCellPopulationReferenceConcentration;
83 
87  boost::shared_ptr<OutputFileHandler> mpOutputFileHandler;
88 
92  std::string mFilename;
93 
97  std::string mLabel;
98 
103 
108 
112  boost::shared_ptr<AbstractDiscreteContinuumLinearEllipticPde<DIM, DIM> > mpPde;
113 
117  boost::shared_ptr<AbstractDiscreteContinuumNonLinearEllipticPde<DIM, DIM> > mpNonLinearPde;
118 
122  std::vector<boost::shared_ptr<DiscreteContinuumBoundaryCondition<DIM> > > mBoundaryConditions;
123 
129  units::quantity<unit::concentration> mReferenceConcentration;
130 
134  std::vector<double> mSolution;
135 
139  std::vector<units::quantity<unit::concentration> > mConcentrations;
140 
145 
150 
151 public:
152 
157 
162 
167  void AddBoundaryCondition(boost::shared_ptr<DiscreteContinuumBoundaryCondition<DIM> > pBoundaryCondition);
168 
173  bool CellPopulationIsSet();
174 
179  virtual std::vector<units::quantity<unit::concentration> > GetConcentrations();
180 
186  virtual std::vector<units::quantity<unit::concentration> > GetConcentrations(boost::shared_ptr<RegularGrid<DIM> > pGrid) = 0;
187 
193  virtual std::vector<units::quantity<unit::concentration> > GetConcentrations(const std::vector<DimensionalChastePoint<DIM> >& rSamplePoints) = 0;
194 
200  virtual std::vector<units::quantity<unit::concentration> > GetConcentrations(boost::shared_ptr<DiscreteContinuumMesh<DIM> > pMesh) = 0;
201 
206  const std::string& GetLabel();
207 
212  boost::shared_ptr<AbstractDiscreteContinuumNonLinearEllipticPde<DIM, DIM> > GetNonLinearPde();
213 
218  boost::shared_ptr<AbstractDiscreteContinuumLinearEllipticPde<DIM, DIM> > GetPde();
219 
224  units::quantity<unit::concentration> GetReferenceConcentration();
225 
230  virtual std::vector<double> GetSolution();
231 
237  virtual std::vector<double> GetSolution(const std::vector<DimensionalChastePoint<DIM> >& rSamplePoints) = 0;
238 
244  virtual std::vector<double> GetSolution(boost::shared_ptr<RegularGrid<DIM> > pGrid) = 0;
245 
251  virtual std::vector<double> GetSolution(boost::shared_ptr<DiscreteContinuumMesh<DIM> > pMesh) = 0;
252 
257  bool HasRegularGrid();
258 
263  bool HasUnstructuredGrid();
264 
271  void SetCellPopulation(AbstractCellPopulation<DIM>& rCellPopulation,
272  units::quantity<unit::length> cellPopulationReferenceLength,
273  units::quantity<unit::concentration> cellPopulationReferenceConcentration);
274 
279  void SetFileHandler(boost::shared_ptr<OutputFileHandler> pOutputFileHandler);
280 
285  void SetFileName(const std::string& rFilename);
286 
291  void SetLabel(const std::string& rLabel);
292 
297  void SetPde(boost::shared_ptr<AbstractDiscreteContinuumLinearEllipticPde<DIM, DIM> > pPde);
298 
304 
308  virtual void Setup() = 0;
309 
314  void SetReferenceConcentration(units::quantity<unit::concentration> referenceConcentration);
315 
320  void SetVesselNetwork(boost::shared_ptr<VesselNetwork<DIM> > pNetwork);
321 
326  void SetWriteSolution(bool write=true);
327 
331  virtual void Solve() = 0;
332 
336  virtual void Update() = 0;
337 
341  virtual void UpdateCellData() = 0;
342 
347  virtual void UpdateSolution(const std::vector<double>& rData);
348 
353  virtual void UpdateSolution(const std::vector<units::quantity<unit::concentration> >& rData);
354 
358  virtual void Write() = 0;
359 };
360 
361 #endif /* ABSTRACTDISCRETECONTINUUMSOLVER_HPP_ */
virtual std::vector< units::quantity< unit::concentration > > GetConcentrations()
void SetCellPopulation(AbstractCellPopulation< DIM > &rCellPopulation, units::quantity< unit::length > cellPopulationReferenceLength, units::quantity< unit::concentration > cellPopulationReferenceConcentration)
virtual void UpdateSolution(const std::vector< double > &rData)
void SetNonLinearPde(boost::shared_ptr< AbstractDiscreteContinuumNonLinearEllipticPde< DIM, DIM > > pPde)
void SetPde(boost::shared_ptr< AbstractDiscreteContinuumLinearEllipticPde< DIM, DIM > > pPde)
boost::shared_ptr< AbstractDiscreteContinuumLinearEllipticPde< DIM, DIM > > mpPde
void SetReferenceConcentration(units::quantity< unit::concentration > referenceConcentration)
boost::shared_ptr< OutputFileHandler > mpOutputFileHandler
void SetFileHandler(boost::shared_ptr< OutputFileHandler > pOutputFileHandler)
AbstractCellPopulation< DIM > * mpCellPopulation
std::vector< units::quantity< unit::concentration > > mConcentrations
boost::shared_ptr< AbstractDiscreteContinuumLinearEllipticPde< DIM, DIM > > GetPde()
void AddBoundaryCondition(boost::shared_ptr< DiscreteContinuumBoundaryCondition< DIM > > pBoundaryCondition)
void SetVesselNetwork(boost::shared_ptr< VesselNetwork< DIM > > pNetwork)
std::vector< boost::shared_ptr< DiscreteContinuumBoundaryCondition< DIM > > > mBoundaryConditions
boost::shared_ptr< AbstractDiscreteContinuumNonLinearEllipticPde< DIM, DIM > > GetNonLinearPde()
boost::shared_ptr< AbstractDiscreteContinuumNonLinearEllipticPde< DIM, DIM > > mpNonLinearPde
boost::shared_ptr< VesselNetwork< DIM > > mpNetwork
units::quantity< unit::concentration > mReferenceConcentration
units::quantity< unit::concentration > mCellPopulationReferenceConcentration
units::quantity< unit::concentration > GetReferenceConcentration()
units::quantity< unit::length > mCellPopulationReferenceLength
void SetFileName(const std::string &rFilename)