SpECTRE
v2021.04.06
Documentation
Introduction
Releases
Installation
User Tutorials
Dev Guide
Code of Conduct
Contributing Guide
Code Reference
Topics
Namespaces
Files
Bibliography
View on GitHub
tests
Unit
Helpers
Evolution
DiscontinuousGalerkin
Limiters
TestHelpers.hpp
1
// Distributed under the MIT License.
2
// See LICENSE.txt for details.
3
4
#pragma once
5
6
#include <
cstddef
>
7
#include <
unordered_set
>
8
9
#include "
Domain/Structure/Element.hpp
"
10
#include "
Domain/Structure/ElementId.hpp
"
11
#include "
Domain/Structure/Neighbors.hpp
"
12
#include "Domain/Structure/OrientationMap.hpp"
13
14
namespace
TestHelpers {
15
namespace
Limiters
{
16
17
// Construct a Neighbors object with one neighboring element.
18
template
<
size_t
VolumeDim>
19
Neighbors<VolumeDim>
make_neighbor_with_id(
const
size_t
id
) noexcept {
20
return
{
std::unordered_set<ElementId<VolumeDim>
>{
ElementId<VolumeDim>
(
id
)},
21
OrientationMap<VolumeDim>
{}};
22
}
23
24
// Construct an Element with one neighboring element in each direction.
25
//
26
// The optional argument specifies directions to external boundaries, i.e.,
27
// directions where there is no neighboring element.
28
template
<
size_t
VolumeDim>
29
Element<VolumeDim>
make_element(
30
const
std::unordered_set
<
Direction<VolumeDim>
>&
31
directions_of_external_boundaries = {}) noexcept {
32
typename
Element<VolumeDim>::Neighbors_t
neighbors;
33
for
(
const
auto
& dir :
Direction<VolumeDim>::all_directions
()) {
34
// Element has neighbors in directions with internal boundaries
35
if
(directions_of_external_boundaries.count(dir) == 0) {
36
const
size_t
index =
37
1 + 2 * dir.dimension() + (dir.side() == Side::Upper ? 1 : 0);
38
neighbors[dir] = make_neighbor_with_id<VolumeDim>(index);
39
}
40
}
41
return
Element<VolumeDim>
{
ElementId<VolumeDim>
{0}, neighbors};
42
}
43
44
}
// namespace Limiters
45
}
// namespace TestHelpers
Limiters
Things relating to limiting.
Definition:
HwenoImpl.hpp:42
unordered_set
OrientationMap
A mapping of the logical coordinate axes of a host to the logical coordinate axes of a neighbor of th...
Definition:
OrientationMap.hpp:34
Direction
Definition:
Direction.hpp:23
Element
Definition:
Element.hpp:29
ElementId
An ElementId uniquely labels an Element.
Definition:
ElementId.hpp:50
ElementId.hpp
cstddef
Neighbors.hpp
Neighbors
Definition:
Neighbors.hpp:28
Element.hpp
DirectionMap< VolumeDim, Neighbors< VolumeDim > >
© Copyright 2017 - 2021
SXS Collaboration
,
Distributed under the
MIT License