Chaste Commit::1fd4e48e3990e67db148bc1bc4cf6991a0049d0c
Cylindrical2dMesh.hpp
1/*
2
3Copyright (c) 2005-2024, 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#ifndef CYLINDRICAL2DMESH_HPP_
36#define CYLINDRICAL2DMESH_HPP_
37
39#include <boost/serialization/base_object.hpp>
40
41#include <cmath>
42#include <map>
43
44#include "MutableMesh.hpp"
45#include "TrianglesMeshWriter.hpp"
46
55class Cylindrical2dMesh : public MutableMesh<2,2>
56{
57 friend class TestCylindrical2dMesh;
58private:
59
61 double mWidth;
62
64 double mTop;
65
67 double mBottom;
68
71
74
76 std::vector<unsigned> mLeftOriginals;
77
79 std::vector<unsigned> mLeftImages;
80
82 std::map<unsigned, unsigned> mImageToLeftOriginalNodeMap;
83
85 std::vector<unsigned> mRightOriginals;
86
88 std::vector<unsigned> mRightImages;
89
91 std::map<unsigned, unsigned> mImageToRightOriginalNodeMap;
92
95
98
100 std::vector<unsigned > mTopHaloNodes;
101
103 std::vector<unsigned > mBottomHaloNodes;
104
107
114 void UpdateTopAndBottom();
115
124 void CreateHaloNodes();
125
132 void CreateMirrorNodes();
133
147
154 void DeleteHaloNodes();
155
167
179
187 unsigned GetCorrespondingNodeIndex(unsigned nodeIndex);
188
199 void UseTheseElementsToDecideMeshing(std::set<unsigned>& rMainSideElements);
200
214 template<class Archive>
215 void serialize(Archive & archive, const unsigned int version)
216 {
217 archive & boost::serialization::base_object<MutableMesh<2,2> >(*this);
218 archive & mWidth;
219 archive & mTop;
220 archive & mBottom;
221 archive & mHaloScalingFactor;
222 archive & mHaloOffset;
223 }
224
225public:
226
232 Cylindrical2dMesh(double width);
233
241 Cylindrical2dMesh(double width, std::vector<Node<2>*> nodes);
242
247
258 void ReMesh(NodeMap& rMap);
259
270 c_vector<double, 2> GetVectorFromAtoB(const c_vector<double, 2>& rLocation1, const c_vector<double, 2>& rLocation2);
271
282 void SetNode(unsigned index, ChastePoint<2> point, bool concreteMove);
283
293 double GetWidth(const unsigned& rDimension) const;
294
300 void SetHaloScalingFactor(double haloScalingFactor);
301
305 double GetHaloScalingFactor() const;
306
312 void SetHaloOffset(double haloOffset);
313
317 double GetHaloOffset() const;
318
319
326 unsigned AddNode(Node<2>* pNewNode);
327
332};
333
334namespace boost
335{
336namespace serialization
337{
341template<class Archive>
342inline void save_construct_data(
343 Archive & ar, const Cylindrical2dMesh * t, const unsigned int file_version)
344{
345 // Save data required to construct instance
346 const double width = t->GetWidth(0);
347 ar & width;
348}
349
353template<class Archive>
354inline void load_construct_data(
355 Archive & ar, Cylindrical2dMesh * t, const unsigned int file_version)
356{
357 // Retrieve data from archive required to construct new instance
358 double width;
359 ar & width;
360
361 // Invoke inplace constructor to initialise instance
362 ::new(t)Cylindrical2dMesh(width);
363}
364}
365} // namespace ...
366
369
370#endif /*CYLINDRICAL2DMESH_HPP_*/
gcov doesn't like this file...
#define CHASTE_CLASS_EXPORT(T)
std::vector< unsigned > mLeftImages
unsigned AddNode(Node< 2 > *pNewNode)
unsigned GetCorrespondingNodeIndex(unsigned nodeIndex)
std::vector< unsigned > mRightImages
std::map< unsigned, unsigned > mImageToLeftOriginalNodeMap
double GetWidth(const unsigned &rDimension) const
bool GetInstanceOfMismatchedBoundaryNodes()
void GenerateVectorsOfElementsStraddlingPeriodicBoundaries()
double GetHaloOffset() const
c_vector< double, 2 > GetVectorFromAtoB(const c_vector< double, 2 > &rLocation1, const c_vector< double, 2 > &rLocation2)
std::map< unsigned, unsigned > mImageToRightOriginalNodeMap
void SetHaloOffset(double haloOffset)
void SetHaloScalingFactor(double haloScalingFactor)
std::vector< unsigned > mTopHaloNodes
double GetHaloScalingFactor() const
void SetNode(unsigned index, ChastePoint< 2 > point, bool concreteMove)
void serialize(Archive &archive, const unsigned int version)
std::vector< unsigned > mRightOriginals
std::vector< unsigned > mLeftOriginals
friend class boost::serialization::access
std::vector< unsigned > mBottomHaloNodes
std::set< unsigned > mRightPeriodicBoundaryElementIndices
std::set< unsigned > mLeftPeriodicBoundaryElementIndices
void UseTheseElementsToDecideMeshing(std::set< unsigned > &rMainSideElements)
Definition Node.hpp:59