Nektar++
InterfaceInterpolation.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////////////
2//
3// File: InterfaceInterpolation.hpp
4//
5// For more information, please see: http://www.nektar.info/
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// License for the specific language governing rights and limitations under
14// Permission is hereby granted, free of charge, to any person obtaining a
15// copy of this software and associated documentation files (the "Software"),
16// to deal in the Software without restriction, including without limitation
17// the rights to use, copy, modify, merge, publish, distribute, sublicense,
18// and/or sell copies of the Software, and to permit persons to whom the
19// Software is furnished to do so, subject to the following s:
20//
21// The above copyright notice and this permission notice shall be included
22// in all copies or substantial portions of the Software.
23//
24// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30// DEALINGS IN THE SOFTWARE.
31//
32// Description: Interface handling for zones using the interpolation method
33//
34//
35////////////////////////////////////////////////////////////////////////////////
36#ifndef NEKTAR_SPATIALDOMAINS_INTERFACEINTERPOLATION_H
37#define NEKTAR_SPATIALDOMAINS_INTERFACEINTERPOLATION_H
38
41
43{
44
45// Fwd def to allow for inclusion in meshgraph
46struct Composite;
47typedef std::shared_ptr<Composite> CompositeSharedPtr;
48typedef std::map<int, CompositeSharedPtr> CompositeMap;
49
50/// A interface which is a single edge on a zone for handling non-conformality
52{
53 /// Constructor
54 Interface(int indx, const CompositeMap &edge) : m_id(indx)
55 {
56 // Fill element Ids
57 for (auto &comp : edge)
58 {
59 m_compositeIDs.push_back(comp.first);
60 for (auto &geom : comp.second->m_geomVec)
61 {
62 m_edge[geom->GetGlobalID()] = geom;
63 }
64 }
65 }
66
67 /// Default destructor
68 virtual ~Interface() = default;
69
70 /// Returns map of global ID to geometry of the interface edge
71 inline std::map<int, GeometrySharedPtr> const &GetEdge() const
72 {
73 return m_edge;
74 }
75
76 /// Returns geometry of the interface edge with global ID @param id
77 inline GeometrySharedPtr const &GetEdge(int id)
78 {
79 return m_edge[id];
80 }
81
82 /// Checks if the interface edge is empty (used for parallelisation)
83 inline bool IsEmpty() const
84 {
85 return m_edge.empty();
86 }
87
88 /// Returns the matching opposite interface from the interface pair
89 inline std::shared_ptr<Interface> &GetOppInterface()
90 {
91 return m_oppInterface;
92 }
93
94 /// Returns the interface ID
95 inline int &GetId()
96 {
97 return m_id;
98 }
99
100 /// Returns IDs of composites making up the interface
101 inline const std::vector<unsigned int> &GetCompositeIDs() const
102 {
103 return m_compositeIDs;
104 }
105
106protected:
107 /// Matching opposite interface of the interface pair
108 std::shared_ptr<Interface> m_oppInterface;
109 /// Interface ID
110 int m_id;
111 /// String from XML representation, describing which composites make up this
112 /// interface
113 std::vector<unsigned int> m_compositeIDs;
114 /// Map of global ID to geometry of the interface edge
115 std::map<int, GeometrySharedPtr> m_edge;
116};
117
118typedef std::shared_ptr<Interface> InterfaceShPtr;
119
120/**
121 * Interface pair consisting of a 'left' and 'right' interface. The allocation
122 * of 'left' and 'right' is arbitrary for any interface as long as it stays
123 * consistent. Every full interface will consist of exactly one 'left' and one
124 * 'right' interface, the nomenclature helps keep code understandable.
125 */
127{
128 /// Constructor
129 InterfacePair(const InterfaceShPtr &leftInterface,
130 const InterfaceShPtr &rightInterface)
131 : m_leftInterface(leftInterface), m_rightInterface(rightInterface)
132 {
133 // Sets the opposite interfaces
134 leftInterface->GetOppInterface() = rightInterface;
135 rightInterface->GetOppInterface() = leftInterface;
136 }
137
138 /// 'Left' interface of the interface pair
140 /// 'Right' interface of the interface pair
142
143public:
144 /// Return the 'left' interface from the interface pair
145 inline const InterfaceShPtr &GetLeftInterface() const
146 {
147 return m_leftInterface;
148 }
149
150 /// Return the 'right' interface from the interface pair
151 inline const InterfaceShPtr &GetRightInterface() const
152 {
153 return m_rightInterface;
154 }
155};
156
157typedef std::shared_ptr<InterfacePair> InterfacePairShPtr;
158
159} // namespace Nektar::SpatialDomains
160
161#endif // NEKTAR_SPATIALDOMAINS_INTERFACEINTERPOLATION_H
std::shared_ptr< InterfacePair > InterfacePairShPtr
std::shared_ptr< Interface > InterfaceShPtr
std::shared_ptr< Composite > CompositeSharedPtr
Definition: MeshGraph.h:135
std::shared_ptr< Geometry > GeometrySharedPtr
Definition: Geometry.h:51
std::map< int, CompositeSharedPtr > CompositeMap
Definition: MeshGraph.h:136
A interface which is a single edge on a zone for handling non-conformality.
std::shared_ptr< Interface > m_oppInterface
Matching opposite interface of the interface pair.
virtual ~Interface()=default
Default destructor.
bool IsEmpty() const
Checks if the interface edge is empty (used for parallelisation)
std::shared_ptr< Interface > & GetOppInterface()
Returns the matching opposite interface from the interface pair.
std::map< int, GeometrySharedPtr > m_edge
Map of global ID to geometry of the interface edge.
std::vector< unsigned int > m_compositeIDs
String from XML representation, describing which composites make up this interface.
const std::vector< unsigned int > & GetCompositeIDs() const
Returns IDs of composites making up the interface.
int & GetId()
Returns the interface ID.
Interface(int indx, const CompositeMap &edge)
Constructor.
std::map< int, GeometrySharedPtr > const & GetEdge() const
Returns map of global ID to geometry of the interface edge.
GeometrySharedPtr const & GetEdge(int id)
Returns geometry of the interface edge with global ID.
const InterfaceShPtr & GetRightInterface() const
Return the 'right' interface from the interface pair.
InterfaceShPtr m_leftInterface
'Left' interface of the interface pair
InterfacePair(const InterfaceShPtr &leftInterface, const InterfaceShPtr &rightInterface)
Constructor.
InterfaceShPtr m_rightInterface
'Right' interface of the interface pair
const InterfaceShPtr & GetLeftInterface() const
Return the 'left' interface from the interface pair.