Using a common count_sites implementation.

This commit is contained in:
Patrick Shriwise 2019-05-10 17:56:36 -05:00
parent 8d4f937e73
commit 6cc00a8420
2 changed files with 16 additions and 18 deletions

View file

@ -77,7 +77,7 @@ public:
//! \param[out] Whether any bank sites are outside the mesh
//! \return Array indicating number of sites in each mesh/energy bin
virtual xt::xarray<double>
count_sites(const std::vector<Particle::Bank>& bank, bool* outside) const = 0;
count_sites(const std::vector<Particle::Bank>& bank, bool* outside) const;
virtual double get_volume_frac(int bin = -1) const = 0;
@ -216,6 +216,7 @@ public:
//! \return Whether the line segment connecting r0 and r1 intersects mesh
bool intersects(Position& r0, Position r1, int* ijk) const;
//! Count number of bank sites in each mesh bin / energy bin
//
//! \param[in] bank Array of bank sites
@ -226,6 +227,14 @@ public:
// Data members
//! Write mesh data to an HDF5 group
//
//! \param[in] group HDF5 group
// void to_hdf5(hid_t group) const;
// std::string get_label_for_bin(int bin) const;
//std::string get_label_for_bin(int bin) const;
//double get_volume_frac(int bin = -1) const;
@ -339,9 +348,6 @@ public:
std::string get_label_for_bin(int bin) const;
xt::xarray<double>
count_sites(const std::vector<Particle::Bank>& bank, bool* outside) const;
double get_volume_frac(int bin = -1) const;
int num_bins() const;

View file

@ -795,11 +795,12 @@ void RegularMesh::to_hdf5(hid_t group) const
}
xt::xtensor<double, 1>
RegularMesh::count_sites(const Particle::Bank* bank, int64_t length,
bool* outside) const
bool* outside) const
{
// Determine shape of array for counts
std::size_t m = xt::prod(shape_)();
std::size_t m = num_bins();
std::vector<std::size_t> shape = {m};
// Create array of zeros
@ -1413,7 +1414,6 @@ RegularMesh* get_regular_mesh(int32_t index) {
return dynamic_cast<RegularMesh*>(model::meshes[index].get());
}
//! Extend the meshes array by n elements
extern "C" int
openmc_extend_meshes(int32_t n, int32_t* index_start, int32_t* index_end)
@ -1686,8 +1686,9 @@ void UnstructuredMesh::surface_bins_crossed(const Particle* p, std::vector<int>&
}
std::string UnstructuredMesh::get_label_for_bin(int bin) const {
std::string s;
return s;
std::stringstream out;
out << "MOAB EntityHandle: " << get_ent_handle_from_bin(bin);
return out.str();
}
int
@ -1700,7 +1701,6 @@ UnstructuredMesh::get_bin(Position r) const {
}
}
void
UnstructuredMesh::compute_barycentric_data(const moab::Range& all_tets) {
moab::ErrorCode rval;
@ -1760,7 +1760,6 @@ UnstructuredMesh::point_in_tet(const Position& r, moab::EntityHandle tet) const
bary_coords[0] + bary_coords[1] + bary_coords[2] <= 1.);
return in_tet;
}
int
@ -1774,13 +1773,6 @@ UnstructuredMesh::get_ent_handle_from_bin(int bin) const {
return ehs_[bin];
}
xt::xarray<double>
UnstructuredMesh::count_sites(const std::vector<Particle::Bank>& bank,
bool* outside) const {
xt::xarray<double> out;
return out;
}
double UnstructuredMesh::get_volume_frac(int bin) const {
return 0.0;
}