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, bool skipCoordCheck)
55 : m_id(indx), m_skipCoordCheck(skipCoordCheck)
56 {
57 // Fill element Ids
58 for (auto &comp : edge)
59 {
60 m_compositeIDs.push_back(comp.first);
61 for (auto &geom : comp.second->m_geomVec)
62 {
63 m_edge[geom->GetGlobalID()] = geom;
64 }
65 }
66 }
67
68 /// Default destructor
69 virtual ~Interface() = default;
70
71 /// Returns map of global ID to geometry of the interface edge
72 inline std::map<int, GeometrySharedPtr> const &GetEdge() const
73 {
74 return m_edge;
75 }
76
77 /// Returns geometry of the interface edge with global ID @param id
78 inline GeometrySharedPtr const &GetEdge(int id)
79 {
80 return m_edge[id];
81 }
82
83 /// Checks if the interface edge is empty (used for parallelisation)
84 inline bool IsEmpty() const
85 {
86 return m_edge.empty();
87 }
88
89 /// Returns the matching opposite interface from the interface pair
90 inline std::shared_ptr<Interface> &GetOppInterface()
91 {
92 return m_oppInterface;
93 }
94
95 /// Returns the interface ID
96 inline int &GetId()
97 {
98 return m_id;
99 }
100
101 /// Returns IDs of composites making up the interface
102 inline const std::vector<unsigned int> &GetCompositeIDs() const
103 {
104 return m_compositeIDs;
105 }
106
107 /// Return the skip check flag for coordinate exchange in InterfaceMapDG
108 inline bool GetSkipCoordCheck() const
109 {
110 return m_skipCoordCheck;
111 }
112
113protected:
114 /// Matching opposite interface of the interface pair
115 std::shared_ptr<Interface> m_oppInterface;
116 /// Interface ID
117 int m_id;
118 /// String from XML representation, describing which composites make up this
119 /// interface
120 std::vector<unsigned int> m_compositeIDs;
121 /// Map of global ID to geometry of the interface edge
122 std::map<int, GeometrySharedPtr> m_edge;
123 /// Skip the coord found check in InterfaceMapDG
125};
126
127typedef std::shared_ptr<Interface> InterfaceShPtr;
128
129/**
130 * Interface pair consisting of a 'left' and 'right' interface. The allocation
131 * of 'left' and 'right' is arbitrary for any interface as long as it stays
132 * consistent. Every full interface will consist of exactly one 'left' and one
133 * 'right' interface, the nomenclature helps keep code understandable.
134 */
136{
137 /// Constructor
138 InterfacePair(const InterfaceShPtr &leftInterface,
139 const InterfaceShPtr &rightInterface)
140 : m_leftInterface(leftInterface), m_rightInterface(rightInterface)
141 {
142 // Sets the opposite interfaces
143 leftInterface->GetOppInterface() = rightInterface;
144 rightInterface->GetOppInterface() = leftInterface;
145 }
146
147 /// 'Left' interface of the interface pair
149 /// 'Right' interface of the interface pair
151
152public:
153 /// Return the 'left' interface from the interface pair
154 inline const InterfaceShPtr &GetLeftInterface() const
155 {
156 return m_leftInterface;
157 }
158
159 /// Return the 'right' interface from the interface pair
160 inline const InterfaceShPtr &GetRightInterface() const
161 {
162 return m_rightInterface;
163 }
164};
165
166typedef std::shared_ptr<InterfacePair> InterfacePairShPtr;
167
168} // namespace Nektar::SpatialDomains
169
170#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.
bool GetSkipCoordCheck() const
Return the skip check flag for coordinate exchange in InterfaceMapDG.
std::map< int, GeometrySharedPtr > m_edge
Map of global ID to geometry of the interface edge.
Interface(int indx, const CompositeMap &edge, bool skipCoordCheck)
Constructor.
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.
std::map< int, GeometrySharedPtr > const & GetEdge() const
Returns map of global ID to geometry of the interface edge.
bool m_skipCoordCheck
Skip the coord found check in InterfaceMapDG.
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.