Chi-Tech
lbsadj_solver_01a_make_adjointXS.cc
Go to the documentation of this file.
1#include "lbsadj_solver.h"
2
5
6namespace lbs
7{
8
10{
11 //============================================= Create adjoint cross sections
12 using AdjXS = chi_physics::AdjointMGXS;
13
14 // define the actual cross-sections
15 std::map<int, XSPtr> matid_to_adj_xs_map;
16 for (const auto& matid_xs_pair : matid_to_xs_map_)
17 {
18 const auto matid = matid_xs_pair.first;
19 const auto fwd_xs = std::dynamic_pointer_cast<chi_physics::MultiGroupXS>(
20 matid_xs_pair.second);
21 matid_to_adj_xs_map[matid] = std::make_shared<AdjXS>(*fwd_xs);
22 } // for each mat
23 matid_to_xs_map_ = std::move(matid_to_adj_xs_map);
24
25 // reassign transport view to adjoint cross-sections
26 if (grid_ptr_->local_cells.size() == cell_transport_views_.size())
27 for (const auto& cell : grid_ptr_->local_cells)
28 {
29 const auto& xs_ptr = matid_to_xs_map_[cell.material_id_];
30 auto& transport_view = cell_transport_views_[cell.local_id_];
31
32 transport_view.ReassingXS(*xs_ptr);
33 }
34}
35
36} // namespace lbs
chi_mesh::MeshContinuumPtr grid_ptr_
Definition: lbs_solver.h:75
std::vector< lbs::CellLBSView > cell_transport_views_
Definition: lbs_solver.h:83
std::map< int, XSPtr > matid_to_xs_map_
Definition: lbs_solver.h:71