netxsimdg
Loading...
Searching...
No Matches
ModelArrayDetails.cpp
Go to the documentation of this file.
1
8#include "include/ModelArray.hpp"
9
10// A source file to detail the ModelArray dimensions and types for
11// Discontinuous Galerkin models, as well as the relationships between them.
12
13// Should be grouped with a consistent ModelArrayDetails.cpp and
14// ModelArrayTypedefs.hpp
15
16namespace Nextsim {
17// clang-format off
18std::map<ModelArray::Dimension, ModelArray::DimensionSpec> ModelArray::definedDimensions = {
19 { ModelArray::Dimension::X, { "x", 0 } },
20 { ModelArray::Dimension::Y, { "y", 0 } },
21 { ModelArray::Dimension::Z, { "z", 1 } },
22 { ModelArray::Dimension::XVERTEX, { "xvertex", 1 } }, // defined as x + 1
23 { ModelArray::Dimension::YVERTEX, { "yvertex", 1 } }, // defined as y + 1
24 { ModelArray::Dimension::XCG, { "x_cg", 1 } },
25 { ModelArray::Dimension::YCG, { "y_cg", 1 } },
26 // The DG components are also included here to store the names
27 { ModelArray::Dimension::DG, { "dg_comp", 1 } },
28 { ModelArray::Dimension::DGSTRESS, { "dgstress_comp", 1 } },
29 { ModelArray::Dimension::NCOORDS, { "ncoords", 2 } }, // It's a two dimensional model
30// clang-format on
31};
32
33ModelArray::TypeDimensions ModelArray::typeDimensions = {
34 { ModelArray::Type::H,
35 {
36 ModelArray::Dimension::X,
37 ModelArray::Dimension::Y,
38 } },
39 { ModelArray::Type::VERTEX,
40 {
41 ModelArray::Dimension::XVERTEX,
42 ModelArray::Dimension::YVERTEX,
43 } },
44 { ModelArray::Type::U,
45 {
46 ModelArray::Dimension::X,
47 ModelArray::Dimension::Y,
48 } },
49 { ModelArray::Type::V,
50 {
51 ModelArray::Dimension::X,
52 ModelArray::Dimension::Y,
53 } },
54 { ModelArray::Type::Z,
55 {
56 ModelArray::Dimension::X,
57 ModelArray::Dimension::Y,
58 ModelArray::Dimension::Z,
59 } },
60 { ModelArray::Type::DG,
61 {
62 ModelArray::Dimension::X,
63 ModelArray::Dimension::Y,
64 } },
65 { ModelArray::Type::DGSTRESS,
66 {
67 ModelArray::Dimension::X,
68 ModelArray::Dimension::Y,
69 } },
70 { ModelArray::Type::CG,
71 {
72 ModelArray::Dimension::XCG,
73 ModelArray::Dimension::YCG,
74 } },
75};
76
77const std::map<ModelArray::Type, std::string> ModelArray::typeNames = {
78 { ModelArray::Type::H, "HField" },
79 { ModelArray::Type::VERTEX, "VertexField" },
80 { ModelArray::Type::U, "UField" },
81 { ModelArray::Type::V, "VField" },
82 { ModelArray::Type::Z, "ZField" },
83 { ModelArray::Type::DG, "DGField" },
84 { ModelArray::Type::DGSTRESS, "DGStressField" },
85 { ModelArray::Type::CG, "CGField" },
86};
87
89 : ModelArray(Type::H)
90{
91}
92
93bool ModelArray::hasDoF(const Type type)
94{
95 return type == Type::DG || type == Type::DGSTRESS || type == Type::VERTEX;
96}
97
98ModelArray::SizeMap::SizeMap()
99 : m_sizes({ { Type::H, 0 }, { Type::VERTEX, 1 }, { Type::U, 0 }, { Type::V, 0 }, { Type::Z, 0 },
100 { Type::DG, 0 }, { Type::DGSTRESS, 0 }, { Type::CG, 1 } })
101{
102}
103
104ModelArray::DimensionMap::DimensionMap()
105 : m_dimensions({
106 { Type::H, { 0, 0 } },
107 { Type::VERTEX, { 1, 1 } },
108 { Type::U, { 0, 0 } },
109 { Type::V, { 0, 0 } },
110 { Type::Z, { 0, 0, 1 } },
111 { Type::DG, { 0, 0 } },
112 { Type::DGSTRESS, { 0, 0 } },
113 { Type::CG, { 1, 1 } },
114 })
115{
116}
117const size_t ModelArray::nCoords = 2;
118
119const std::map<ModelArray::Type, ModelArray::Dimension> ModelArray::componentMap = {
120 { Type::DG, Dimension::DG },
121 { Type::DGSTRESS, Dimension::DGSTRESS },
122 { Type::VERTEX, Dimension::NCOORDS },
123};
124
125}
A class that holds the array data for the model.
static TypeDimensions typeDimensions
The dimensions that make up each defined type. Defined in ModelArrayDetails.cpp.
bool hasDoF() const
Returns whether this type of ModelArray has additional discontinuous Galerkin components.
static std::map< Dimension, DimensionSpec > definedDimensions
The name and length of each dimension that is defined.
static const std::map< Type, std::string > typeNames
The name of each type of ModelArray.