11 const std::string fname =
"InitializePointSources";
17 throw std::logic_error(
18 fname +
": Point source multigroup strength vector "
19 "is not compatible with the number of "
20 "groups in the simulation. Expected " +
22 std::to_string(point_source.Strength().size()));
24 const auto& p = point_source.Location();
27 std::vector<PointSource::ContainingCellInfo> temp_list;
28 for (
const auto& cell :
grid_ptr_->local_cells)
30 if (
grid_ptr_->CheckPointInsideCell(cell, p))
34 const auto& M = cell_matrices.M_matrix;
35 const auto& I = cell_matrices.Vi_vectors;
37 std::vector<double> shape_values;
38 cell_view.ShapeValues(point_source.Location(),
46 for (
double val : I) v_cell += val;
57 auto ghost_global_ids =
grid_ptr_->cells.GetGhostGlobalIDs();
58 for (uint64_t ghost_global_id : ghost_global_ids)
60 const auto& neighbor_cell =
grid_ptr_->cells[ghost_global_id];
61 if (
grid_ptr_->CheckPointInsideCell(neighbor_cell, p))
63 const auto& cell_matrices =
65 for (
double val : cell_matrices.Vi_vectors)
70 point_source.ClearInitializedInfo();
71 for (
const auto& info : temp_list)
73 point_source.AddContainingCellInfo(info.volume_weight/v_total,
77 const auto& cell =
grid_ptr_->local_cells[info.cell_local_id];
80 std::stringstream output;
81 output <<
"Point source at " << p.PrintStr() <<
" assigned to cell "
82 << cell.global_id_ <<
" with shape values ";
83 for (
double val : info.shape_values) output << val <<
" ";
84 output <<
"volume_weight=" << info.volume_weight/v_total;
std::vector< PointSource > point_sources_
chi_mesh::MeshContinuumPtr grid_ptr_
std::shared_ptr< chi_math::SpatialDiscretization > discretization_
std::vector< UnitCellMatrices > unit_cell_matrices_
void InitializePointSources()
std::map< uint64_t, UnitCellMatrices > unit_ghost_cell_matrices_
MatDbl Inverse(const MatDbl &A)
MatDbl MatMul(const MatDbl &A, const double c)