Chi-Tech
PieceWiseLinearBaseMapping.cc
Go to the documentation of this file.
2
4
5#include "chi_runtime.h"
6#include "chi_log.h"
7
9{
10
12 const chi_mesh::MeshContinuum& grid,
13 const chi_mesh::Cell& cell,
14 size_t num_nodes,
15 std::vector<std::vector<int>> face_node_mappings)
16 : CellMapping(grid,
17 cell,
18 num_nodes,
19 GetVertexLocations(grid, cell),
20 std::move(face_node_mappings),
21 &CellMapping::ComputeCellVolumeAndAreas)
22{
23}
24
25/** This section just determines a mapping of face dofs
26to cell dofs. This is pretty simple since we can
27just loop over each face dof then subsequently
28loop over cell dofs, if the face dof node index equals
29the cell dof node index then the mapping is assigned.
30
31This mapping is not used by any of the methods in
32 this class but is used by methods requiring the
33 surface integrals of the shape functions.*/
34std::vector<std::vector<int>>
36{
37 const size_t num_faces = cell.faces_.size();
38 std::vector<std::vector<int>> mappings;
39 mappings.reserve(num_faces);
40 for (auto& face : cell.faces_)
41 {
42 std::vector<int> face_dof_mapping;
43 face_dof_mapping.reserve(face.vertex_ids_.size());
44 for (uint64_t fvid : face.vertex_ids_)
45 {
46 int mapping = -1;
47 for (size_t ci = 0; ci < cell.vertex_ids_.size(); ci++)
48 {
49 if (fvid == cell.vertex_ids_[ci])
50 {
51 mapping = static_cast<int>(ci);
52 break;
53 }
54 } // for cell i
55 if (mapping < 0)
56 {
57 Chi::log.LogAllError() << "Unknown face mapping encountered. "
58 "pwl_polyhedron.h";
59 Chi::Exit(EXIT_FAILURE);
60 }
61 face_dof_mapping.push_back(mapping);
62 } // for face i
63
64 mappings.push_back(face_dof_mapping);
65 }
66 return mappings;
67}
68
70 const chi_mesh::MeshContinuum& grid, const chi_mesh::Cell& cell)
71{
72 std::vector<chi_mesh::Vector3> verts;
73 verts.reserve(cell.vertex_ids_.size());
74
75 for (const auto vid : cell.vertex_ids_)
76 verts.push_back(grid.vertices[vid]);
77
78 return verts;
79}
80
81} // namespace chi_math::cell_mapping
static void Exit(int error_code)
Definition: chi_runtime.cc:342
static chi::ChiLog & log
Definition: chi_runtime.h:81
LogStream LogAllError()
Definition: chi_log.h:239
static std::vector< chi_mesh::Vector3 > GetVertexLocations(const chi_mesh::MeshContinuum &grid, const chi_mesh::Cell &cell)
PieceWiseLinearBaseMapping(const chi_mesh::MeshContinuum &grid, const chi_mesh::Cell &cell, size_t num_nodes, std::vector< std::vector< int > > face_node_mappings)
static std::vector< std::vector< int > > MakeFaceNodeMapping(const chi_mesh::Cell &cell)
std::vector< CellFace > faces_
Definition: cell.h:82
std::vector< uint64_t > vertex_ids_
Definition: cell.h:81