Some cleanup and removal of commented sections after rebase.

This commit is contained in:
Patrick Shriwise 2019-11-28 06:28:45 -06:00
parent 43d05fb178
commit b454617c64
5 changed files with 7 additions and 168 deletions

View file

@ -118,60 +118,6 @@ public:
xt::xtensor<double, 1> upper_right_; //!< Upper-right coordinates of mesh
};
// class Mesh {
// public:
// // Constructors
// Mesh() = default;
// Mesh(pugi::xml_node node);
// // Destructor
// virtual ~Mesh() = default;
// //! Determine which bins were crossed by a particle
// //
// //! \param[in] p Particle to check
// //! \param[out] bins Bins that were crossed
// //! \param[out] lengths Fraction of tracklength in each bin
// virtual void bins_crossed(const Particle* p, std::vector<int>& bins,
// std::vector<double>& lengths) const = 0;
// //! Write mesh data to an HDF5 group
// //
// //! \param[in] group HDF5 group
// virtual void to_hdf5(hid_t group) const = 0;
// //! Determine which surface bins were crossed by a particle
// //
// //! \param[in] p Particle to check
// //! \param[out] bins Surface bins that were crossed
// virtual void
// surface_bins_crossed(const Particle* p, std::vector<int>& bins) const = 0;
// //! Get bin at a given position in space
// //
// //! \param[in] r Position to get bin for
// //! \return Mesh bin
// virtual int get_bin(Position r) const = 0;
// virtual std::string get_label_for_bin(int bin) const = 0;
// //! Count number of bank sites in each mesh bin / energy bin
// //
// //! \param[in] bank Array of bank sites
// //! \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;
// virtual double get_volume_frac(int bin = -1) const = 0;
// virtual int num_bins() const = 0;
// int id_ {-1}; //!< User-specified ID
// int n_dimension_; //!< Number of dimensions
// };
//==============================================================================
//! Tessellation of n-dimensional Euclidean space by congruent squares or cubes
//==============================================================================
@ -227,22 +173,10 @@ public:
xt::xtensor<double, 1> count_sites(const Particle::Bank* bank, int64_t length,
bool* outside) const;
// 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;
int num_bins() const;
// Data members
double volume_frac_; //!< Volume fraction of each mesh element
xt::xtensor<int, 1> shape_; //!< Number of mesh elements in each dimension
xt::xtensor<double, 1> width_; //!< Width of each mesh element
@ -326,18 +260,6 @@ public:
private:
// void
// intersect_track(const moab::CartVect& start,
// const moab::CartVect& dir,
// double track_len,
// std::vector<moab::EntityHandle>& tris,
// std::vector<double>& intersection_dists) const;
// void
// intersect_track(const moab::CartVect& start,
// const moab::CartVect& dir,
// double track_len,
// TriHits& hits) const;
//! Finds all intersections with faces of the mesh.
//
//! \param[in] start Staring location
@ -430,8 +352,6 @@ public:
std::string get_label_for_bin(int bin) const;
// double get_volume_frac(int bin = -1) const;
int n_bins() const override;
int n_surface_bins() const override;

View file

@ -537,14 +537,9 @@ void ufs_count_sites()
// On the first generation, just assume that the source is already evenly
// distributed so that effectively the production of fission sites is not
// biased
std::size_t n = simulation::ufs_mesh->n_bins();
double vol_frac = simulation::ufs_mesh->volume_frac_;
simulation::source_frac = xt::xtensor<double, 1>({n}, vol_frac);
// auto s = xt::view(simulation::source_frac, xt::all());
// s = m->get_volume_frac();
} else {
// count number of source sites in each ufs mesh cell
bool sites_outside;
@ -586,7 +581,6 @@ double ufs_get_weight(const Particle* p)
if (simulation::source_frac(mesh_bin) != 0.0) {
return simulation::ufs_mesh->volume_frac_
/ simulation::source_frac(mesh_bin);
// return m->get_volume_frac() / simulation::source_frac(mesh_bin);
} else {
return 1.0;
}

View file

@ -5,7 +5,6 @@
#include <cmath> // for ceil
#include <memory> // for allocator
#include <string>
#include <sstream>
#ifdef OPENMC_MPI
#include "mpi.h"
@ -15,7 +14,6 @@
#include "xtensor/xmath.hpp"
#include "xtensor/xsort.hpp"
#include "xtensor/xtensor.hpp"
#include "xtensor/xarray.hpp"
#include "openmc/capi.h"
#include "openmc/constants.h"
@ -848,23 +846,6 @@ RegularMesh::count_sites(const Particle::Bank* bank, int64_t length,
return counts;
}
// std::string RegularMesh::get_label_for_bin(int bin) const {
// int ijk[n_dimension_];
// get_indices_from_bin(bin, ijk);
// std::stringstream out;
// out << "Mesh Index (" << ijk[0];
// if (n_dimension_ > 1) out << ", " << ijk[1];
// if (n_dimension_ > 2) out << ", " << ijk[2];
// out << ")";
// return out.str();
// }
// double RegularMesh::get_volume_frac(int bin) const {
// return volume_frac_;
// }
//==============================================================================
// RectilinearMesh implementation
//==============================================================================
@ -1459,7 +1440,6 @@ openmc_mesh_get_dimension(int32_t index, int** dims, int* n)
set_errmsg("Index in meshes array is out of bounds.");
return OPENMC_E_OUT_OF_BOUNDS;
}
RegularMesh* mesh;
if (int err = check_regular_mesh(index, &mesh)) return err;
*dims = mesh->shape_.data();
@ -1471,6 +1451,11 @@ openmc_mesh_get_dimension(int32_t index, int** dims, int* n)
extern "C" int
openmc_mesh_set_dimension(int32_t index, int n, const int* dims)
{
if (index < 0 || index >= model::meshes.size()) {
set_errmsg("Index in meshes array is out of bounds.");
return OPENMC_E_OUT_OF_BOUNDS;
}
RegularMesh* mesh;
if (int err = check_regular_mesh(index, &mesh)) return err;
@ -1608,9 +1593,6 @@ UnstructuredMesh::build_kdtree(const moab::Range& all_tets) {
// create and build KD-tree
kdtree_ = std::unique_ptr<moab::AdaptiveKDTree>(new moab::AdaptiveKDTree(mbi_.get()));
//const char settings[] = "MESHSET_FLAGS=0x1;TAG_NAME=0";
// moab::FileOptions fileopts(settings);
// build the tree
rval = kdtree_->build_tree(all_tets_and_tris, &kdtree_root_);
if (rval != moab::MB_SUCCESS) {
@ -1974,17 +1956,6 @@ UnstructuredMesh::get_ent_handle_from_bin(int bin) const {
return ehs_[bin];
}
// double UnstructuredMesh::get_volume_frac(int bin) const {
// if (bin == -1) { return 0.0; }
// if (bin > ehs_.size() || bin < -1) {
// std::stringstream msg;
// msg << "Invalid bin " << bin << " for umesh with id " << id_;
// fatal_error(msg);
// }
// moab::EntityHandle tet = get_ent_handle_from_bin(bin);
// return tet_volume(tet);
// }
int UnstructuredMesh::n_bins() const {
return ehs_.size();
}
@ -2011,7 +1982,6 @@ int UnstructuredMesh::n_surface_bins() const {
void read_meshes(pugi::xml_node root)
{
for (auto node : root.children("mesh")) {
std::string mesh_type;
if (check_for_node(node, "type")) {
mesh_type = get_node_value(node, "type", true, true);

View file

@ -696,7 +696,6 @@ void draw_mesh_lines(Plot pl, ImageData& data)
Position width = ur_plot - ll_plot;
// Find the (axis-aligned) lines of the mesh that intersect this plot.
auto axis_lines = model::meshes[pl.index_meshlines_mesh_]
->plot(ll_plot, ur_plot);
@ -714,49 +713,6 @@ void draw_mesh_lines(Plot pl, ImageData& data)
ax2_min = 0;
ax2_max = pl.pixels_[1];
}
// auto m = get_regular_mesh(pl.index_meshlines_mesh_);
// int ijk_ll[3], ijk_ur[3];
// bool in_mesh;
// m->get_indices(ll_plot, &(ijk_ll[0]), &in_mesh);
// m->get_indices(ur_plot, &(ijk_ur[0]), &in_mesh);
// // Fortran/C++ index correction
// ijk_ur[0]++; ijk_ur[1]++; ijk_ur[2]++;
// Position r_ll, r_ur;
// // sweep through all meshbins on this plane and draw borders
// for (int i = ijk_ll[outer]; i <= ijk_ur[outer]; i++) {
// for (int j = ijk_ll[inner]; j <= ijk_ur[inner]; j++) {
// // check if we're in the mesh for this ijk
// if (i > 0 && i <= m->shape_[outer] && j >0 && j <= m->shape_[inner] ) {
// int outrange[3], inrange[3];
// // get xyz's of lower left and upper right of this mesh cell
// r_ll[outer] = m->lower_left_[outer] + m->width_[outer] * (i - 1);
// r_ll[inner] = m->lower_left_[inner] + m->width_[inner] * (j - 1);
// r_ur[outer] = m->lower_left_[outer] + m->width_[outer] * i;
// r_ur[inner] = m->lower_left_[inner] + m->width_[inner] * j;
// // map the xyz ranges to pixel ranges
// double frac = (r_ll[outer] - ll_plot[outer]) / width[outer];
// outrange[0] = int(frac * double(pl.pixels_[0]));
// frac = (r_ur[outer] - ll_plot[outer]) / width[outer];
// outrange[1] = int(frac * double(pl.pixels_[0]));
// frac = (r_ur[inner] - ll_plot[inner]) / width[inner];
// inrange[0] = int((1. - frac) * (double)pl.pixels_[1]);
// frac = (r_ll[inner] - ll_plot[inner]) / width[inner];
// inrange[1] = int((1. - frac) * (double)pl.pixels_[1]);
// // draw lines
// for (int out_ = outrange[0]; out_ <= outrange[1]; out_++) {
// for (int plus = 0; plus <= pl.meshlines_width_; plus++) {
// data(out_, inrange[0] + plus) = rgb;
// data(out_, inrange[1] + plus) = rgb;
// data(out_, inrange[0] - plus) = rgb;
// data(out_, inrange[1] - plus) = rgb;
// }
// }
// Iterate across the first axis and draw lines.
for (auto ax1_val : axis_lines.first) {

View file

@ -55,7 +55,6 @@ std::string
MeshFilter::text_label(int bin) const
{
auto& mesh = *model::meshes[mesh_];
int n_dim = mesh.n_dimension_;
std::vector<int> ijk(n_dim);