Chi-Tech
LagrangeBase.cc
Go to the documentation of this file.
1#include "LagrangeBase.h"
2
4
11
14
15#include "chi_log_exceptions.h"
16
18{
19
21 QuadratureOrder q_order,
22 SDMType sdm_type,
24 : FiniteElementBase(grid, cs_type, sdm_type, q_order),
25 line_quad_order_arbitrary_(q_order),
26 tri_quad_order_arbitrary_(q_order),
27 quad_quad_order_arbitrary_(q_order),
28 tet_quad_order_arbitrary_(q_order),
29 hex_quad_order_arbitrary_(q_order),
30 wedge_quad_order_arbitrary_(q_order)
31{
33
35}
36
38{
44 typedef cell_mapping::LagrangeTetMapping Tetrahedron;
45
48
49 auto MakeCellMapping = [this](const chi_mesh::Cell& cell)
50 {
51 using namespace std;
52 using namespace chi_math;
53 std::unique_ptr<chi_math::CellMapping> mapping;
54
55 switch (cell.Type())
56 {
58 {
59 const auto& vol_quad = line_quad_order_arbitrary_;
60 const auto& area_quad = point_quadrature_;
61
62 mapping = make_unique<Slab>(ref_grid_, cell, vol_quad, area_quad);
63 break;
64 }
66 {
67 if (cell.SubType() == chi_mesh::CellType::QUADRILATERAL)
68 {
69 const auto& vol_quad = quad_quad_order_arbitrary_;
70 const auto& area_quad = line_quad_order_arbitrary_;
71
72 mapping = make_unique<Quad>(ref_grid_, cell, vol_quad, area_quad);
73 break;
74 }
75 else if (cell.SubType() == chi_mesh::CellType::TRIANGLE)
76 {
77 const auto& vol_quad = tri_quad_order_arbitrary_;
78 const auto& area_quad = line_quad_order_arbitrary_;
79
80 mapping = make_unique<Triangle>(ref_grid_, cell, vol_quad, area_quad);
81 break;
82 }
83 else
84 {
85 const auto& vol_quad = tri_quad_order_arbitrary_;
86 const auto& area_quad = line_quad_order_arbitrary_;
87
88 mapping = make_unique<Polygon>(cell, ref_grid_, vol_quad, area_quad);
89 break;
90 }
91 }
93 {
94 if (cell.SubType() == chi_mesh::CellType::HEXAHEDRON)
95 {
96 const auto& vol_quad = hex_quad_order_arbitrary_;
97 const auto& area_quad = quad_quad_order_arbitrary_;
98
99 mapping = make_unique<Hex>(ref_grid_, cell, vol_quad, area_quad);
100 break;
101 }
102 else if (cell.SubType() == chi_mesh::CellType::WEDGE)
103 {
104 const auto& vol_quad = wedge_quad_order_arbitrary_;
105 const auto& area_quad1 = quad_quad_order_arbitrary_;
106 const auto& area_quad2 = tri_quad_order_arbitrary_;
107
108 mapping = make_unique<Wedge>(
109 ref_grid_, cell, vol_quad, area_quad1, area_quad2);
110 break;
111 }
112 else if (cell.SubType() == chi_mesh::CellType::TETRAHEDRON)
113 {
114 const auto& vol_quad = tet_quad_order_arbitrary_;
115 const auto& area_quad = tri_quad_order_arbitrary_;
116
117 mapping = make_unique<Tetrahedron>(
118 ref_grid_, cell, vol_quad, area_quad);
119 break;
120 }
121 else
122 {
123 const auto& vol_quad = tet_quad_order_arbitrary_;
124 const auto& area_quad = tri_quad_order_arbitrary_;
125
126 mapping =
127 make_unique<Polyhedron>(cell, ref_grid_, vol_quad, area_quad);
128 break;
129 }
130 }
131 default:
132 ChiInvalidArgument("Unsupported cell type encountered");
133 }
134 return mapping;
135 };
136
137 for (const auto& cell : ref_grid_.local_cells)
138 cell_mappings_.push_back(MakeCellMapping(cell));
139
140 const auto ghost_ids = ref_grid_.cells.GetGhostGlobalIDs();
141 for (uint64_t ghost_id : ghost_ids)
142 {
143 auto ghost_mapping = MakeCellMapping(ref_grid_.cells[ghost_id]);
144 nb_cell_mappings_.insert(
145 std::make_pair(ghost_id, std::move(ghost_mapping)));
146 }
147}
148
149} // namespace chi_math::spatial_discretization
#define ChiInvalidArgument(message)
void SetRange(const std::pair< double, double > &in_range)
Definition: quadrature.cc:91
std::vector< std::unique_ptr< CellMapping > > cell_mappings_
std::map< uint64_t, std::shared_ptr< CellMapping > > nb_cell_mappings_
const chi_mesh::MeshContinuum & ref_grid_
QuadratureQuadrilateral quad_quad_order_arbitrary_
Definition: LagrangeBase.h:30
LagrangeBase(const chi_mesh::MeshContinuum &grid, QuadratureOrder q_order, SDMType sdm_type, CoordinateSystemType cs_type)
Definition: LagrangeBase.cc:20
std::vector< uint64_t > GetGhostGlobalIDs() const
LocalCellHandler local_cells
GlobalCellHandler cells
QuadratureOrder
Definition: quadrature.h:12
SpatialDiscretizationType
Definition: chi_math.h:37
CoordinateSystemType
Definition: chi_math.h:29