Nektar++
Loading...
Searching...
No Matches
GeometricDataWarehouse.hpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: GeometricDataWarehouse.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// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description:
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#pragma once
36
39
41
43{
44
45class GeometricDataCreator;
46
47template <typename TData> class WeightsKey : public LibUtilities::BaseKey
48{
50
51public:
53 typedef TData value_type;
54
55 ~WeightsKey() override = default;
56
57 WeightsKey(const unsigned int block_idx,
58 const unsigned int interleave_width)
59 : m_block_idx(block_idx), m_interleave_width(interleave_width)
60 {
62 typeid(value_type).name(), "WeightsKey");
63 }
64
65private:
66 unsigned int m_block_idx;
67 unsigned int m_interleave_width;
68};
69
70template <typename TData> class JacobianKey : public LibUtilities::BaseKey
71{
73
74public:
76 typedef TData value_type;
77
78 ~JacobianKey() override = default;
79
80 JacobianKey(const unsigned int block_idx,
81 const unsigned int interleave_width)
82 : m_block_idx(block_idx), m_interleave_width(interleave_width)
83 {
85 typeid(value_type).name(), "JacobianKey");
86 }
87
88private:
89 unsigned int m_block_idx;
90 unsigned int m_interleave_width;
91};
92
93/// Quadrature metric of every quadrature point of a block: the quadrature
94/// weight times the Jacobian, as Expansion::MultiplyByQuadratureMetric
95/// applies it, laid out as a phys block at the given interleave width, with
96/// zero on the padded elements.
97template <typename TData>
99{
101
102public:
104 typedef TData value_type;
105
106 ~QuadratureMetricKey() override = default;
107
108 QuadratureMetricKey(const unsigned int block_idx,
109 const unsigned int interleave_width)
110 : m_block_idx(block_idx), m_interleave_width(interleave_width)
111 {
113 typeid(value_type).name(), "QuadratureMetricKey");
114 }
115
116private:
117 unsigned int m_block_idx;
118 unsigned int m_interleave_width;
119};
120
121template <typename TData> class DerivFactorKey : public LibUtilities::BaseKey
122{
124
125public:
127 typedef TData value_type;
128
129 ~DerivFactorKey() override = default;
130
131 DerivFactorKey(const unsigned int block_idx,
132 const unsigned int interleave_width, const bool transpose)
133 : m_block_idx(block_idx), m_interleave_width(interleave_width),
134 m_transpose(transpose)
135 {
137 typeid(value_type).name(), "DerivFactorKey");
138 }
139
140private:
141 unsigned int m_block_idx;
142 unsigned int m_interleave_width;
144};
145
146template <typename TData> class CoordKey : public LibUtilities::BaseKey
147{
149
150public:
152 typedef TData value_type;
153
154 ~CoordKey() override = default;
155
156 CoordKey(const unsigned block_idx, const unsigned int interleave_width,
157 const bool transpose)
158 : m_block_idx(block_idx), m_interleave_width(interleave_width),
159 m_transpose(transpose)
160 {
162 typeid(value_type).name(), "CoordKey");
163 }
164
165private:
166 unsigned int m_block_idx;
167 unsigned int m_interleave_width;
169};
170
171template <typename TData> class OrientKey : public LibUtilities::BaseKey
172{
174
175public:
177 typedef unsigned int value_type;
178
179 ~OrientKey() override = default;
180
181 OrientKey(const unsigned int block_idx, const unsigned int interleave_width)
182 : m_block_idx(block_idx), m_interleave_width(interleave_width)
183 {
185 typeid(value_type).name(), "OrientKey");
186 }
187
188private:
189 unsigned int m_block_idx;
190 unsigned int m_interleave_width;
191};
192
193template <typename TData> class TraceToElmtMapKey : public LibUtilities::BaseKey
194{
196
197public:
199 typedef unsigned int value_type;
200
201 ~TraceToElmtMapKey() override = default;
202
203 TraceToElmtMapKey(const unsigned int block_idx,
204 const unsigned int interleave_width)
205 : m_block_idx(block_idx), m_interleave_width(interleave_width)
206 {
208 typeid(value_type).name(), "TraceToElmtMapKey");
209 }
210
211private:
212 unsigned int m_block_idx;
213 unsigned int m_interleave_width;
214};
215
216template <typename TData>
218{
220
221public:
223 typedef int value_type;
224
225 ~TraceToElmtSignKey() override = default;
226
227 TraceToElmtSignKey(const unsigned int block_idx,
228 const unsigned int interleave_width)
229 : m_block_idx(block_idx), m_interleave_width(interleave_width)
230 {
232 typeid(value_type).name(), "TraceToElmtSignKey");
233 }
234
235private:
236 unsigned int m_block_idx;
237 unsigned int m_interleave_width;
238};
239
240template <typename TData> class InteriorMapKey : public LibUtilities::BaseKey
241{
243
244public:
246 typedef unsigned int value_type;
247
248 ~InteriorMapKey() override = default;
249
250 InteriorMapKey(const unsigned int block_idx,
251 const unsigned int interleave_width)
252 : m_block_idx(block_idx), m_interleave_width(interleave_width)
253 {
255 typeid(value_type).name(), "InteriorMapKey");
256 }
257
258private:
259 unsigned int m_block_idx;
260 unsigned int m_interleave_width;
261};
262
263template <typename TData> class JacobianTraceKey : public LibUtilities::BaseKey
264{
266
267public:
269 typedef TData value_type;
270
271 ~JacobianTraceKey() override = default;
272
273 JacobianTraceKey(const unsigned int block_idx,
274 const unsigned int interleave_width)
275 : m_block_idx(block_idx), m_interleave_width(interleave_width)
276 {
278 typeid(value_type).name(), "JacobianTraceKey");
279 }
280
281private:
282 unsigned int m_block_idx;
283 unsigned int m_interleave_width;
284};
285
286template <typename TData>
288{
290
291public:
293 typedef TData value_type;
294
295 ~JacobianLocTraceKey() override = default;
296
297 JacobianLocTraceKey(const unsigned int block_idx,
298 const unsigned int interleave_width)
299 : m_block_idx(block_idx), m_interleave_width(interleave_width)
300 {
302 typeid(value_type).name(), "JacobianLocTraceKey");
303 }
304
305private:
306 unsigned int m_block_idx;
307 unsigned int m_interleave_width;
308};
309
310/**
311 * Whether the trace normal derivative factors have to be stored once per
312 * trace quadrature point rather than once per trace.
313 *
314 * For a Seg, Quad or Hex this is just the element's deformed flag: a regular
315 * element has a constant normal and constant deriv factors, so one value per
316 * trace is enough.
317 *
318 * A collapsed shape is different. Its factors carry the regular part of the
319 * collapsed chain rule, for a triangle
320 *
321 * f_0 + (1 + eta_0)/2 f_1,
322 *
323 * and eta_0 varies along edge 0 even when f_0 and f_1 are constant. So a
324 * straight sided triangle, which Nektar calls regular, still needs a factor
325 * at every trace point. Storing per point also means the trace is free to
326 * carry any quadrature it likes.
327 *
328 * The singular 2/(1 - eta) part of the chain rule is deliberately not in
329 * this data - the operator applies it on the volume - so evaluating these
330 * factors at every trace point is safe even at the collapsed apex.
331 */
333 bool isDeformed)
334{
335 switch (shape)
336 {
340 return isDeformed;
341 default:
342 return true;
343 }
344}
345
346template <typename TData>
348{
350
351public:
353 typedef TData value_type;
354
355 ~JacNormGeomFactorLocTraceKey() override = default;
356
357 /// @param dir -1 (the default) contracts the derivative factors with
358 /// the trace normal, the classic scalar form; 0..dim-1 keeps
359 /// the factors of that Cartesian direction uncontracted, for
360 /// the vector-input lift.
361 JacNormGeomFactorLocTraceKey(const unsigned int block_idx,
362 const unsigned int interleave_width,
363 const int dir = -1)
364 : m_block_idx(block_idx), m_interleave_width(interleave_width),
365 m_dir(dir)
366 {
368 typeid(value_type).name(), "JacNormGeomFactorLocTraceKey");
369 }
370
371private:
372 unsigned int m_block_idx;
373 unsigned int m_interleave_width;
374 int m_dir;
375};
376
377/// Inverse mass matrix of every element of a deformed block, as
378/// Expansion::GetLocMatrix returns it for StdRegions::eInvMass: element after
379/// element, each nmTot x nmTot and column-major, with zero matrices on the
380/// padded elements.
381template <typename TData> class ElmtInvMassKey : public LibUtilities::BaseKey
382{
384
385public:
387 typedef TData value_type;
388
389 ~ElmtInvMassKey() override = default;
390
391 ElmtInvMassKey(const unsigned int block_idx) : m_block_idx(block_idx)
392 {
393 hash_combine(m_hash, m_block_idx, typeid(value_type).name(),
394 "ElmtInvMassKey");
395 }
396
397private:
398 unsigned int m_block_idx;
399};
400
402{
403public:
404 ~GeometricDataCreator() override = default;
406 : m_collections(collections)
407 {
408 }
409
410 template <typename MemSpace, typename TData>
412 const WeightsKey<TData> &weightsKey);
413
414 template <typename MemSpace, typename TData>
416 const JacobianKey<TData> &jacobianKey);
417
418 template <typename MemSpace, typename TData>
420 const QuadratureMetricKey<TData> &quadratureMetricKey);
421
422 template <typename MemSpace, typename TData>
424 const DerivFactorKey<TData> &derivFactorKey);
425
426 template <typename MemSpace, typename TData>
428
429 template <typename MemSpace, typename TData>
431 const OrientKey<TData> &orientKey);
432
433 template <typename MemSpace, typename TData>
435 const TraceToElmtMapKey<TData> &traceToElmtMapKey);
436
437 template <typename MemSpace, typename TData>
439 const TraceToElmtSignKey<TData> &traceToElmtSignKey);
440
441 template <typename MemSpace, typename TData>
443 const InteriorMapKey<TData> &interiorMapKey);
444
445 template <typename MemSpace, typename TData>
447 const JacobianTraceKey<TData> &jacobianTraceKey);
448
449 template <typename MemSpace, typename TData>
451 const JacobianLocTraceKey<TData> &jacobianLocTraceKey);
452
453 template <typename MemSpace, typename TData>
455 const JacNormGeomFactorLocTraceKey<TData> &jacnormgeomfacLocTraceKey);
456
457 template <typename MemSpace, typename TData>
459 const ElmtInvMassKey<TData> &elmtInvMassKey);
460
461 inline static const std::string m_name = "GeometricDataCreator";
462
463private:
465};
466
467} // namespace Nektar::LocalRegions
A MemoryRegion represents a memory region.
CoordKey(const unsigned block_idx, const unsigned int interleave_width, const bool transpose)
~CoordKey() override=default
DerivFactorKey(const unsigned int block_idx, const unsigned int interleave_width, const bool transpose)
Inverse mass matrix of every element of a deformed block, as Expansion::GetLocMatrix returns it for S...
ElmtInvMassKey(const unsigned int block_idx)
LibUtilities::MemoryRegion< unsigned int > Create(const InteriorMapKey< TData > &interiorMapKey)
GeometricDataCreator(const Collections::CollectionVector collections)
LibUtilities::MemoryRegion< unsigned int > Create(const TraceToElmtMapKey< TData > &traceToElmtMapKey)
LibUtilities::MemoryRegion< TData > Create(const WeightsKey< TData > &weightsKey)
LibUtilities::MemoryRegion< unsigned int > Create(const OrientKey< TData > &orientKey)
InteriorMapKey(const unsigned int block_idx, const unsigned int interleave_width)
JacNormGeomFactorLocTraceKey(const unsigned int block_idx, const unsigned int interleave_width, const int dir=-1)
JacobianKey(const unsigned int block_idx, const unsigned int interleave_width)
JacobianLocTraceKey(const unsigned int block_idx, const unsigned int interleave_width)
JacobianTraceKey(const unsigned int block_idx, const unsigned int interleave_width)
~OrientKey() override=default
OrientKey(const unsigned int block_idx, const unsigned int interleave_width)
Quadrature metric of every quadrature point of a block: the quadrature weight times the Jacobian,...
QuadratureMetricKey(const unsigned int block_idx, const unsigned int interleave_width)
TraceToElmtMapKey(const unsigned int block_idx, const unsigned int interleave_width)
TraceToElmtSignKey(const unsigned int block_idx, const unsigned int interleave_width)
WeightsKey(const unsigned int block_idx, const unsigned int interleave_width)
~WeightsKey() override=default
std::vector< Collection > CollectionVector
Definition Collection.h:142
bool TraceDerivFactorsArePointwise(LibUtilities::ShapeType shape, bool isDeformed)
void hash_combine(std::size_t &seed)
Definition HashUtils.hpp:45