Chi-Tech
PieceWiseLinearBase.cc
Go to the documentation of this file.
2
4
8
9#define UnsupportedCellType(fname) \
10 std::invalid_argument((fname) + \
11 ": Unsupported cell type encountered. type_id=" + \
12 std::to_string(static_cast<int>(cell.Type())));
13
15{
16// ###################################################################
17/**Constructor*/
19 QuadratureOrder q_order,
20 SDMType sdm_type,
22 : FiniteElementBase(grid, cs_type, sdm_type, q_order),
23 line_quad_order_arbitrary_(q_order),
24 tri_quad_order_arbitrary_(q_order),
25 quad_quad_order_arbitrary_(q_order),
26 tet_quad_order_arbitrary_(q_order)
27{
28}
29
31{
32 constexpr std::string_view fname = __PRETTY_FUNCTION__;
33
37
38 auto MakeCellMapping = [this, fname](const chi_mesh::Cell& cell)
39 {
40 using namespace std;
41 using namespace chi_math;
42 std::unique_ptr<chi_math::CellMapping> mapping;
43
44 switch (cell.Type())
45 {
47 {
48 const auto& vol_quad = line_quad_order_arbitrary_;
49
50 mapping = make_unique<SlabSlab>(cell, ref_grid_, vol_quad);
51 break;
52 }
54 {
55 const auto& vol_quad = tri_quad_order_arbitrary_;
56 const auto& area_quad = line_quad_order_arbitrary_;
57
58 mapping = make_unique<Polygon>(cell, ref_grid_, vol_quad, area_quad);
59 break;
60 }
62 {
63 const auto& vol_quad = tet_quad_order_arbitrary_;
64 const auto& area_quad = tri_quad_order_arbitrary_;
65
66 mapping = make_unique<Polyhedron>(cell, ref_grid_, vol_quad, area_quad);
67 break;
68 }
69 default:
70 throw UnsupportedCellType(std::string(fname))
71 }
72 return mapping;
73 };
74
75 for (const auto& cell : ref_grid_.local_cells)
76 cell_mappings_.push_back(MakeCellMapping(cell));
77
78 const auto ghost_ids = ref_grid_.cells.GetGhostGlobalIDs();
79 for (uint64_t ghost_id : ghost_ids)
80 {
81 auto ghost_mapping = MakeCellMapping(ref_grid_.cells[ghost_id]);
82 nb_cell_mappings_.insert(
83 std::make_pair(ghost_id, std::move(ghost_mapping)));
84 }
85}
86} // namespace chi_math::spatial_discretization
#define UnsupportedCellType(fname)
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_
PieceWiseLinearBase(const chi_mesh::MeshContinuum &grid, QuadratureOrder q_order, SDMType sdm_type, CoordinateSystemType cs_type)
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