Chi-Tech
fv_05_utils.cc
Go to the documentation of this file.
1#include "FiniteVolume.h"
2
5
6#include "chi_mpi.h"
7
9{
10
11// ###################################################################
12/**Get the number of ghost degrees-of-freedom.*/
13size_t
15 const chi_math::UnknownManager& unknown_manager) const
16{
17 unsigned int N = unknown_manager.GetTotalUnknownStructureSize();
18
19 return ref_grid_.cells.GetNumGhosts() * N;
20}
21
22// ###################################################################
23/**Returns the ghost DOF indices.*/
24std::vector<int64_t>
26 const chi_math::UnknownManager& unknown_manager) const
27{
28 std::vector<int64_t> dof_ids;
29 dof_ids.reserve(GetNumGhostDOFs(unknown_manager));
30
31 std::vector<uint64_t> ghost_cell_ids = ref_grid_.cells.GetGhostGlobalIDs();
32
33 const size_t num_uks = unknown_manager.unknowns_.size();
34
35 for (const auto cell_id : ghost_cell_ids)
36 {
37 const auto& cell = ref_grid_.cells[cell_id];
38 for (size_t u = 0; u < num_uks; ++u)
39 {
40 const auto& unkn = unknown_manager.unknowns_[u];
41 const size_t num_comps = unkn.num_components_;
42 for (size_t c = 0; c < num_comps; ++c)
43 {
44 const int64_t dofmap = MapDOF(cell, 0, unknown_manager, u, c);
45 dof_ids.push_back(dofmap);
46 } // for c
47 } // for u
48 }
49
50 return dof_ids;
51}
52
53} // namespace chi_math::spatial_discretization
std::vector< Unknown > unknowns_
unsigned int GetTotalUnknownStructureSize() const
size_t GetNumGhostDOFs(const UnknownManager &unknown_manager) const override
Definition: fv_05_utils.cc:14
std::vector< int64_t > GetGhostDOFIndices(const UnknownManager &unknown_manager) const override
Definition: fv_05_utils.cc:25