mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 13:15:39 -04:00
Move n_bins and n_surface_bins implementations to StructuredMesh base class. Refs #1695
This commit is contained in:
parent
9a36ea405a
commit
008a73fa36
2 changed files with 14 additions and 30 deletions
|
|
@ -107,6 +107,10 @@ public:
|
|||
|
||||
int get_bin(Position r) const override;
|
||||
|
||||
int n_bins() const override;
|
||||
|
||||
int n_surface_bins() const override;
|
||||
|
||||
//! Get bin given mesh indices
|
||||
//
|
||||
//! \param[in] Array of mesh indices
|
||||
|
|
@ -175,10 +179,6 @@ public:
|
|||
|
||||
int get_index_in_direction(double r, int i) const override;
|
||||
|
||||
int n_bins() const override;
|
||||
|
||||
int n_surface_bins() const override;
|
||||
|
||||
std::pair<std::vector<double>, std::vector<double>>
|
||||
plot(Position plot_ll, Position plot_ur) const override;
|
||||
|
||||
|
|
@ -217,10 +217,6 @@ public:
|
|||
|
||||
int get_index_in_direction(double r, int i) const override;
|
||||
|
||||
int n_bins() const override;
|
||||
|
||||
int n_surface_bins() const override;
|
||||
|
||||
std::pair<std::vector<double>, std::vector<double>>
|
||||
plot(Position plot_ll, Position plot_ur) const override;
|
||||
|
||||
|
|
|
|||
32
src/mesh.cpp
32
src/mesh.cpp
|
|
@ -152,6 +152,16 @@ int StructuredMesh::get_bin(Position r) const
|
|||
return get_bin_from_indices(ijk.data());
|
||||
}
|
||||
|
||||
int StructuredMesh::n_bins() const
|
||||
{
|
||||
return xt::prod(shape_)();
|
||||
}
|
||||
|
||||
int StructuredMesh::n_surface_bins() const
|
||||
{
|
||||
return 4 * n_dimension_ * n_bins();
|
||||
}
|
||||
|
||||
bool StructuredMesh::intersects(Position& r0, Position r1, int* ijk) const
|
||||
{
|
||||
switch(n_dimension_) {
|
||||
|
|
@ -486,18 +496,6 @@ int RegularMesh::get_index_in_direction(double r, int i) const
|
|||
return std::ceil((r - lower_left_[i]) / width_[i]);
|
||||
}
|
||||
|
||||
int RegularMesh::n_bins() const
|
||||
{
|
||||
int n_bins = 1;
|
||||
for (auto dim : shape_) n_bins *= dim;
|
||||
return n_bins;
|
||||
}
|
||||
|
||||
int RegularMesh::n_surface_bins() const
|
||||
{
|
||||
return 4 * n_dimension_ * n_bins();
|
||||
}
|
||||
|
||||
void RegularMesh::bins_crossed(const Particle& p, std::vector<int>& bins,
|
||||
std::vector<double>& lengths) const
|
||||
{
|
||||
|
|
@ -1167,16 +1165,6 @@ int RectilinearMesh::get_index_in_direction(double r, int i) const
|
|||
return lower_bound_index(grid_[i].begin(), grid_[i].end(), r) + 1;
|
||||
}
|
||||
|
||||
int RectilinearMesh::n_bins() const
|
||||
{
|
||||
return xt::prod(shape_)();
|
||||
}
|
||||
|
||||
int RectilinearMesh::n_surface_bins() const
|
||||
{
|
||||
return 4 * n_dimension_ * n_bins();
|
||||
}
|
||||
|
||||
std::pair<std::vector<double>, std::vector<double>>
|
||||
RectilinearMesh::plot(Position plot_ll, Position plot_ur) const
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue