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 
40 
41 namespace Nektar
42 {
43 
44 namespace SpatialDomains
45 {
46 
47 // Fwd def to allow for inclusion in meshgraph
48 struct Composite;
49 typedef std::shared_ptr<Composite> CompositeSharedPtr;
50 typedef std::map<int, CompositeSharedPtr> CompositeMap;
51 
52 /// A interface which is a single edge on a zone for handling non-conformality
53 struct Interface
54 {
55  /// Constructor
56  Interface(int indx, const CompositeMap &edge) : m_id(indx)
57  {
58  // Fill element Ids
59  for (auto &comp : edge)
60  {
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 protected:
102  /// Matching opposite interface of the interface pair
103  std::shared_ptr<Interface> m_oppInterface;
104  /// Interface ID
105  int m_id;
106  /// Map of global ID to geometry of the interface edge
107  std::map<int, GeometrySharedPtr> m_edge;
108 };
109 
110 typedef std::shared_ptr<Interface> InterfaceShPtr;
111 
112 /**
113  * Interface pair consisting of a 'left' and 'right' interface. The allocation
114  * of 'left' and 'right' is arbitrary for any interface as long as it stays
115  * consistent. Every full interface will consist of exactly one 'left' and one
116  * 'right' interface, the nomenclature helps keep code understandable.
117  */
119 {
120  /// Constructor
121  InterfacePair(const InterfaceShPtr &leftInterface,
122  const InterfaceShPtr &rightInterface)
123  : m_leftInterface(leftInterface), m_rightInterface(rightInterface)
124  {
125  // Sets the opposite interfaces
126  leftInterface->GetOppInterface() = rightInterface;
127  rightInterface->GetOppInterface() = leftInterface;
128  }
129 
130  /// 'Left' interface of the interface pair
132  /// 'Right' interface of the interface pair
134 
135 public:
136  /// Return the 'left' interface from the interface pair
137  inline const InterfaceShPtr &GetLeftInterface() const
138  {
139  return m_leftInterface;
140  }
141 
142  /// Return the 'right' interface from the interface pair
143  inline const InterfaceShPtr &GetRightInterface() const
144  {
145  return m_rightInterface;
146  }
147 };
148 
149 typedef std::shared_ptr<InterfacePair> InterfacePairShPtr;
150 
151 } // namespace SpatialDomains
152 } // namespace Nektar
153 
154 #endif // NEKTAR_SPATIALDOMAINS_INTERFACEINTERPOLATION_H
std::shared_ptr< InterfacePair > InterfacePairShPtr
std::shared_ptr< Interface > InterfaceShPtr
std::shared_ptr< Composite > CompositeSharedPtr
Definition: MeshGraph.h:137
std::shared_ptr< Geometry > GeometrySharedPtr
Definition: Geometry.h:53
std::map< int, CompositeSharedPtr > CompositeMap
Definition: MeshGraph.h:138
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
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.
std::shared_ptr< Interface > & GetOppInterface()
Returns the matching opposite interface from the interface pair.
virtual ~Interface()=default
Default destructor.
bool IsEmpty() const
Checks if the interface edge is empty (used for parallelisation)
std::map< int, GeometrySharedPtr > m_edge
Map of global ID to geometry of the interface edge.
std::map< int, GeometrySharedPtr > const & GetEdge() const
Returns map of global ID to geometry of the interface edge.
Interface(int indx, const CompositeMap &edge)
Constructor.
GeometrySharedPtr const & GetEdge(int id)
Returns geometry of the interface edge with global ID.
int & GetId()
Returns the interface ID.
InterfaceShPtr m_leftInterface
'Left' interface of the interface pair
InterfacePair(const InterfaceShPtr &leftInterface, const InterfaceShPtr &rightInterface)
Constructor.
const InterfaceShPtr & GetLeftInterface() const
Return the 'left' interface from the interface pair.
const InterfaceShPtr & GetRightInterface() const
Return the 'right' interface from the interface pair.
InterfaceShPtr m_rightInterface
'Right' interface of the interface pair