Chaste Commit::a9c8bf7350f67d7cf086e6fe3cf5461521554546
PlaneBoundaryCondition.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 PLANEBOUNDARYCONDITION_HPP_
37#define PLANEBOUNDARYCONDITION_HPP_
38
39#include "AbstractCellPopulationBoundaryCondition.hpp"
40
42#include <boost/serialization/base_object.hpp>
43#include <boost/serialization/vector.hpp>
44
52template<unsigned ELEMENT_DIM, unsigned SPACE_DIM=ELEMENT_DIM>
54{
55private:
56
60 c_vector<double, SPACE_DIM> mPointOnPlane;
61
65 c_vector<double, SPACE_DIM> mNormalToPlane;
66
72
81 template<class Archive>
82 void serialize(Archive & archive, const unsigned int version)
83 {
84 archive & boost::serialization::base_object<AbstractCellPopulationBoundaryCondition<ELEMENT_DIM, SPACE_DIM> >(*this);
85 //archive & mUseJiggledNodesOnPlane;
86 }
87
88public:
89
98 c_vector<double, SPACE_DIM> point,
99 c_vector<double, SPACE_DIM> normal);
100
104 const c_vector<double, SPACE_DIM>& rGetPointOnPlane() const;
105
109 const c_vector<double, SPACE_DIM>& rGetNormalToPlane() const;
110
116 void SetUseJiggledNodesOnPlane(bool useJiggledNodesOnPlane);
117
120
128 void ImposeBoundaryCondition(const std::map<Node<SPACE_DIM>*, c_vector<double, SPACE_DIM> >& rOldLocations);
129
138
145 void OutputCellPopulationBoundaryConditionParameters(out_stream& rParamsFile);
146};
147
150
151namespace boost
152{
153namespace serialization
154{
158template<class Archive, unsigned ELEMENT_DIM, unsigned SPACE_DIM>
159inline void save_construct_data(
160 Archive & ar, const PlaneBoundaryCondition<ELEMENT_DIM, SPACE_DIM>* t, const unsigned int file_version)
161{
162 // Save data required to construct instance
163 const AbstractCellPopulation<ELEMENT_DIM, SPACE_DIM>* const p_cell_population = t->GetCellPopulation();
164 ar << p_cell_population;
165
166 // Archive c_vectors one component at a time
167 c_vector<double, SPACE_DIM> point = t->rGetPointOnPlane();
168 for (unsigned i=0; i<SPACE_DIM; i++)
169 {
170 ar << point[i];
171 }
172 c_vector<double, SPACE_DIM> normal = t->rGetNormalToPlane();
173 for (unsigned i=0; i<SPACE_DIM; i++)
174 {
175 ar << normal[i];
176 }
177}
178
182template<class Archive, unsigned ELEMENT_DIM, unsigned SPACE_DIM>
183inline void load_construct_data(
184 Archive & ar, PlaneBoundaryCondition<ELEMENT_DIM, SPACE_DIM>* t, const unsigned int file_version)
185{
186 // Retrieve data from archive required to construct new instance
188 ar >> p_cell_population;
189
190 // Archive c_vectors one component at a time
191 c_vector<double, SPACE_DIM> point;
192 for (unsigned i=0; i<SPACE_DIM; i++)
193 {
194 ar >> point[i];
195 }
196 c_vector<double, SPACE_DIM> normal;
197 for (unsigned i=0; i<SPACE_DIM; i++)
198 {
199 ar >> normal[i];
200 }
201
202 // Invoke inplace constructor to initialise instance
203 ::new(t)PlaneBoundaryCondition<ELEMENT_DIM, SPACE_DIM>(p_cell_population, point, normal);
204}
205}
206} // namespace ...
207
208#endif /*PLANEBOUNDARYCONDITION_HPP_*/
gcov doesn't like this file...
#define EXPORT_TEMPLATE_CLASS_ALL_DIMS(CLASS)
Definition Node.hpp:59
const c_vector< double, SPACE_DIM > & rGetNormalToPlane() const
void ImposeBoundaryCondition(const std::map< Node< SPACE_DIM > *, c_vector< double, SPACE_DIM > > &rOldLocations)
void OutputCellPopulationBoundaryConditionParameters(out_stream &rParamsFile)
void serialize(Archive &archive, const unsigned int version)
c_vector< double, SPACE_DIM > mPointOnPlane
c_vector< double, SPACE_DIM > mNormalToPlane
friend class boost::serialization::access
const c_vector< double, SPACE_DIM > & rGetPointOnPlane() const
void SetUseJiggledNodesOnPlane(bool useJiggledNodesOnPlane)