hummingbird
Solving the self-adjoint angular flux transport equation using spectral elements on Cartesian geometry
Loading...
Searching...
No Matches
element.cc
Go to the documentation of this file.
1#include "mesh/element.h"
2
3#include <format>
4#include <stdexcept>
5
6#include "mesh/mesh.h"
7
8namespace hummingbird {
11
12void Element::SetNewNodeID(const size_t prev_id, const size_t new_id) {
13 for (auto i = 0; i < node_ids_.size(); i++) {
14 if (node_ids_.at(i) == prev_id) {
15 node_ids_.at(i) = new_id;
16 return;
17 }
18 }
19 throw std::runtime_error(
20 std::format("ID {} not found in current element.", prev_id));
21}
22
24 Mesh& mesh, const MaterialBank& material_bank,
25 const SourceBank& source_bank,
26 const QuadratureBase<Ordinate>& angular_quadrature) {
27 for (const auto node_id : node_ids_) {
28 const Node& node = mesh.GetNode(node_id);
29 auto source_fluxes =
31 source_bank, angular_quadrature);
32 mesh.SetNodeSourceFluxes(node_id, source_fluxes);
33 }
34}
35} // namespace hummingbird
void SetNodeSourceFluxes(Mesh &mesh, const MaterialBank &material_bank, const SourceBank &source_bank, const QuadratureBase< Ordinate > &angular_quadrature)
Compute and set the source flux values on this element's nodes using this element's material and sour...
Definition element.cc:23
int material_id() const
Get Material ID.
Definition element.h:68
std::vector< size_t > node_ids_
IDs of nodes defining the element.
Definition element.h:183
int material_id_
Material ID to access Material Bank. Auto initialized to -1. Value must be set to a positive value (i...
Definition element.h:176
Element(const int material_id, const int source_id)
Construct a new Element object.
Definition element.cc:9
int source_id() const
Get Source ID.
Definition element.h:75
int source_id_
Source ID to access Source Bank. ID of 0 is always NONE, meaning the element has no external source.
Definition element.h:180
void SetNewNodeID(const size_t prev_id, const size_t new_id)
Set the new Node ID.
Definition element.cc:12
Bank holding the materials defined in the input file.
Class defing a mesh.
Definition mesh.h:27
const Node & GetNode(const size_t id) const
Get Node by ID.
Definition mesh.h:93
void SetNodeSourceFluxes(const size_t node_id, const std::vector< double > &source_fluxes)
Set the Node's source flux values.
Definition mesh.h:217
Base class for defining a quadrature set.
Bank holding the volumetric sources defined in the input file.
Definition source_bank.h:25
std::vector< double > ComputeNodeSourceFluxes(const Node &node, const int material_id, const int source_id, const MaterialBank &material_bank, const SourceBank &source_bank, const QuadratureBase< Ordinate > &angular_quadrature)
Compute the node source flux values.
Definition node.cc:24
A point in the mesh holding its coordinates, boundary info, and flux solution values.
Definition node.h:26