15 std::string text_name,
18 std::map<uint64_t, BoundaryCondition> bcs,
20 const std::vector<UnitCellMatrices>& unit_cell_matrices,
22 const bool requires_ghosts)
23 : text_name_(std::move(text_name)),
28 mat_id_2_xs_map_(std::move(map_mat_id_2_xs)),
29 unit_cell_matrices_(unit_cell_matrices),
30 num_local_dofs_(static_cast<int64_t>(sdm_.GetNumLocalDOFs(uk_man_))),
31 num_global_dofs_(static_cast<int64_t>(sdm_.GetNumGlobalDOFs(uk_man_))),
35 requires_ghosts_(requires_ghosts)
72std::pair<size_t, size_t>
75 return {sdm_.GetNumLocalDOFs(uk_man_), sdm_.GetNumGlobalDOFs(uk_man_)};
81 const std::vector<double>& values)
83 typedef unsigned int uint;
84 typedef const int64_t cint64_t;
85 const size_t num_local_dofs = sdm_.GetNumLocalDOFs(uk_man_);
88 "Vector size mismatched with spatial discretization");
90 const size_t num_unknowns = uk_man_.NumberOfUnknowns();
92 for (
const auto& cell : grid_.local_cells)
94 const auto& cell_mapping = sdm_.GetCellMapping(cell);
96 for (
size_t i = 0; i < cell_mapping.NumNodes(); ++i)
98 for (
size_t u = 0; u < num_unknowns; ++u)
100 for (
uint c = 0; c < uk_man_.GetUnknown(u).NumComponents(); ++c)
102 cint64_t dof_map_local = sdm_.MapDOFLocal(cell, i, uk_man_, u, c);
103 cint64_t dof_map = sdm_.MapDOF(cell, i, uk_man_, u, c);
105 VecSetValue(rhs_, dof_map, values[dof_map_local], ADD_VALUES);
111 VecAssemblyBegin(rhs_);
112 VecAssemblyEnd(rhs_);
#define ChiInvalidArgumentIf(condition, message)
struct lbs::acceleration::DiffusionSolver::Options options
std::string TextName() const
const chi_math::SpatialDiscretization & sdm_
const chi_math::UnknownManager & UnknownStructure() const
DiffusionSolver(std::string text_name, const chi_math::SpatialDiscretization &sdm, const chi_math::UnknownManager &uk_man, std::map< uint64_t, BoundaryCondition > bcs, MatID2XSMap map_mat_id_2_xs, const std::vector< UnitCellMatrices > &unit_cell_matrices, bool verbose, bool requires_ghosts)
void AddToRHS(const std::vector< double > &values)
const chi_math::UnknownManager uk_man_
virtual ~DiffusionSolver()
const chi_math::SpatialDiscretization & SpatialDiscretization() const
std::map< int, Multigroup_D_and_sigR > MatID2XSMap
std::pair< size_t, size_t > GetNumPhiIterativeUnknowns()
const std::string text_name_
bool verbose
Verbosity flag.