Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LocTraceToTraceMap.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File LocTraceToTraceMap.h
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 conditions:
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: Local Trace to general trace map information
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef MULTIREGIONS_LOCTRACETOTRACEMAP_H
37 #define MULTIREGIONS_LOCTRACETOTRACEMAP_H
38 
39 #include <boost/tuple/tuple.hpp>
40 
45 
46 namespace Nektar
47 {
48 namespace LocalRegions
49 {
50 class Expansion;
51 typedef boost::shared_ptr<Expansion> ExpansionSharedPtr;
52 }
53 
54 namespace MultiRegions
55 {
56 class ExpList;
57 typedef boost::shared_ptr<ExpList> ExpListSharedPtr;
58 
60 {
68 };
69 
70 /**
71  * @brief Map holding points distributions required for interpolation of local
72  * traces onto global trace in two and three dimensions.
73  *
74  * The tuple contains four PointsKey entries. All four are used in 3D, but for
75  * 2D only two are used. The first two denote the local elemental points
76  * distributions, the latter the target trace distributions. In the 2D case,
77  * unused trace directions are set to LibUtilities::eNoPointsType.
78  */
79 typedef boost::tuple<LibUtilities::PointsKey,
80  LibUtilities::PointsKey,
81  LibUtilities::PointsKey,
82  LibUtilities::PointsKey> TraceInterpPoints;
83 
84 struct cmpop
85 {
86  bool operator()(TraceInterpPoints const &a,
87  TraceInterpPoints const &b) const
88  {
89  if (a.get<0>() < b.get<0>())
90  {
91  return true;
92  }
93 
94  if (b.get<0>() < a.get<0>())
95  {
96  return false;
97  }
98 
99  if (a.get<1>() < b.get<1>())
100  {
101  return true;
102  }
103  if (b.get<1>() < a.get<1>())
104  {
105  return false;
106  }
107 
108  if (a.get<2>() < b.get<2>())
109  {
110  return true;
111  }
112 
113  if (b.get<2>() < a.get<2>())
114  {
115  return false;
116  }
117 
118  if (a.get<3>() < b.get<3>())
119  {
120  return true;
121  }
122 
123  return false;
124  }
125 };
126 
127 /**
128  * @brief A helper class to deal with trace operations in the discontinuous
129  * Galerkin code.
130  *
131  * This class sets up a number of mappings to deal with operations that take the
132  * "local trace" of an expansion list -- i.e. the concatenation of all elemental
133  * facets -- to the "global trace" -- where the duplicate facets between
134  * connected elements have been removed.
135  *
136  * <pre>
137  * Elements: Local trace: Global trace:
138  * +----+----+ + +---+ + + +---+ + + +---+ + +---+ +
139  * | | | | | | | | | |
140  * | | | | | | | | | |
141  * +----+----+ + +---+ + + +---+ + + +---+ + +---+ +
142  * </pre>
143  *
144  * There are a number of mappings that are required that this class provides
145  * maps for:
146  *
147  * - Extracting the local trace from the elements in physical space
148  * - Dealing with cases that need interpolation (i.e. where the polynomial
149  * order varies between two elements)
150  * - Adding global trace contributions back into the elements.
151  *
152  * These are documented in the member variables and class functions.
153  */
155 {
156 public:
157  // Constructor
159  const ExpList &locExp,
160  const ExpListSharedPtr &trace,
162  &elmtToTrace,
163  const vector<bool> &LeftAdjacents);
164 
165  // Destructor
167 
169  const ExpList &locExp,
170  const ExpListSharedPtr &trace,
172  &elmtToTrace,
173  const vector<bool> &LeftAdjacents);
174 
176  const ExpList &locExp,
177  const ExpListSharedPtr &trace,
179  &elmtToTrace,
180  const vector<bool> &LeftAdjacents);
181 
183  const Array<OneD, const NekDouble> &field,
184  Array<OneD, NekDouble> faces);
185 
187  const Array<OneD, const NekDouble> &field,
188  Array<OneD, NekDouble> faces);
189 
191  const int dir,
192  const Array<OneD, const NekDouble> &locfaces,
193  Array<OneD, NekDouble> edges);
194 
196  const int dir,
197  const Array<OneD, const NekDouble> &locfaces,
198  Array<OneD, NekDouble> faces);
199 
201  const Array<OneD, const NekDouble> &trace,
202  Array<OneD, NekDouble> &field);
203 
205  const int dir,
206  const Array<OneD, const NekDouble> &race,
207  Array<OneD, NekDouble> &field);
208 
209  /**
210  * @brief Return the number of `forward' local trace points.
211  */
213  {
214  return m_nFwdLocTracePts;
215  }
216 
217  /**
218  * @brief Return the number of local trace points.
219  */
221  {
222  return m_nLocTracePts;
223  }
224 
225 private:
226  /// The number of forward trace points. A local trace element is `forward'
227  /// if it is the side selected for the global trace.
229  /// The number of local trace points.
231  /// The number of global trace points.
233  /// A mapping from the local trace points, arranged as all forwards traces
234  /// followed by backwards traces, to elemental storage.
236  /// A mapping from local trace points to the global trace. Dimension 0 holds
237  /// forward traces, dimension 1 backward.
239  /// A mapping holding the type of interpolation needed for each local trace.
240  /// Dimension 0 holds forward traces, dimension 1 backward.
242  /// Interpolation matrices for either 2D edges or first coordinate of 3D
243  /// face.
245  /// Interpolation matrices for the second coordinate of 3D face, not used in
246  /// 2D.
248  /// Interpolation points key distributions for each of the local to global
249  /// mappings.
251  /// Mapping to hold first coordinate direction endpoint interpolation, which
252  /// can be more optimal if using Gauss-Radau distribution for triangles
254  /// Mapping to hold second coordinate direction endpoint interpolation,
255  /// which can be more optimal if using Gauss-Radau distribution for
256  /// triangles
258  /// Number of edges/faces on a 2D/3D element that require interpolation.
260  /// Number of forwards/backwards trace coefficients.
262  /// Mapping from forwards/backwards trace coefficients to elemental
263  /// coefficient storage.
265  /// Mapping from forwards/backwards trace coefficients to the position of
266  /// the trace element in global storage.
268  /// Sign array for mapping from forwards/backwards trace coefficients to
269  /// local trace storage.
271 };
272 
273 typedef boost::shared_ptr<LocTraceToTraceMap> LocTraceToTraceMapSharedPtr;
274 
275 }
276 }
277 
278 #endif
int GetNFwdLocTracePts()
Return the number of `forward' local trace points.
int m_nTracePts
The number of global trace points.
boost::tuple< LibUtilities::PointsKey, LibUtilities::PointsKey, LibUtilities::PointsKey, LibUtilities::PointsKey > TraceInterpPoints
Map holding points distributions required for interpolation of local traces onto global trace in two ...
Array< OneD, Array< OneD, DNekMatSharedPtr > > m_interpTraceI0
Interpolation matrices for either 2D edges or first coordinate of 3D face.
void FwdLocTracesFromField(const Array< OneD, const NekDouble > &field, Array< OneD, NekDouble > faces)
Gather the forwards-oriented local traces in physical space from field using m_fieldToLocTraceMap.
#define MULTI_REGIONS_EXPORT
Array< OneD, Array< OneD, int > > m_traceCoeffsToElmtTrace
Mapping from forwards/backwards trace coefficients to the position of the trace element in global sto...
void InterpLocEdgesToTrace(const int dir, const Array< OneD, const NekDouble > &locfaces, Array< OneD, NekDouble > edges)
Interpolate local trace edges to global trace edge point distributions where required.
LocTraceToTraceMap(const ExpList &locExp, const ExpListSharedPtr &trace, const Array< OneD, Array< OneD, LocalRegions::ExpansionSharedPtr > > &elmtToTrace, const vector< bool > &LeftAdjacents)
Set up trace to trace mapping components.
boost::shared_ptr< LocTraceToTraceMap > LocTraceToTraceMapSharedPtr
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_interpEndPtI0
Mapping to hold first coordinate direction endpoint interpolation, which can be more optimal if using...
Base class for all multi-elemental spectral/hp expansions.
Definition: ExpList.h:101
Array< OneD, Array< OneD, int > > m_traceCoeffsToElmtSign
Sign array for mapping from forwards/backwards trace coefficients to local trace storage.
int m_nLocTracePts
The number of local trace points.
bool operator()(TraceInterpPoints const &a, TraceInterpPoints const &b) const
int m_nTraceCoeffs[2]
Number of forwards/backwards trace coefficients.
int m_nFwdLocTracePts
The number of forward trace points. A local trace element is `forward' if it is the side selected for...
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
void Setup2D(const ExpList &locExp, const ExpListSharedPtr &trace, const Array< OneD, Array< OneD, LocalRegions::ExpansionSharedPtr > > &elmtToTrace, const vector< bool > &LeftAdjacents)
Set up member variables for a two-dimensional problem.
Array< OneD, Array< OneD, int > > m_traceCoeffsToElmtMap
Mapping from forwards/backwards trace coefficients to elemental coefficient storage.
Defines a specification for a set of points.
Definition: Points.h:58
void LocTracesFromField(const Array< OneD, const NekDouble > &field, Array< OneD, NekDouble > faces)
Gather the local traces in physical space from field using m_fieldToLocTraceMap.
boost::shared_ptr< Expansion > ExpansionSharedPtr
Definition: Expansion.h:68
Array< OneD, Array< OneD, DNekMatSharedPtr > > m_interpTraceI1
Interpolation matrices for the second coordinate of 3D face, not used in 2D.
int GetNLocTracePts()
Return the number of local trace points.
A helper class to deal with trace operations in the discontinuous Galerkin code.
Array< OneD, Array< OneD, int > > m_interpNfaces
Number of edges/faces on a 2D/3D element that require interpolation.
Array< OneD, Array< OneD, int > > m_LocTraceToTraceMap
A mapping from local trace points to the global trace. Dimension 0 holds forward traces, dimension 1 backward.
void Setup3D(const ExpList &locExp, const ExpListSharedPtr &trace, const Array< OneD, Array< OneD, LocalRegions::ExpansionSharedPtr > > &elmtToTrace, const vector< bool > &LeftAdjacents)
Set up member variables for a three-dimensional problem.
Array< OneD, Array< OneD, InterpLocTraceToTrace > > m_interpTrace
A mapping holding the type of interpolation needed for each local trace. Dimension 0 holds forward tr...
void AddTraceCoeffsToFieldCoeffs(const Array< OneD, const NekDouble > &trace, Array< OneD, NekDouble > &field)
Add contributions from trace coefficients to the elemental field storage.
Array< OneD, Array< OneD, TraceInterpPoints > > m_interpPoints
Interpolation points key distributions for each of the local to global mappings.
void InterpLocFacesToTrace(const int dir, const Array< OneD, const NekDouble > &locfaces, Array< OneD, NekDouble > faces)
Interpolate local faces to trace face point distributions where required.
Array< OneD, int > m_fieldToLocTraceMap
A mapping from the local trace points, arranged as all forwards traces followed by backwards traces...
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_interpEndPtI1
Mapping to hold second coordinate direction endpoint interpolation, which can be more optimal if usin...