Some cleanup of the bin_label functions.

This commit is contained in:
Patrick Shriwise 2020-04-08 12:54:18 -05:00
parent 9711d70b33
commit 651ef1255c
2 changed files with 8 additions and 31 deletions

View file

@ -108,6 +108,9 @@ public:
plot(Position plot_ll, Position plot_ur) const = 0;
//! Get a label for the mesh bin
//! Return a string representation of the mesh bin
//
//! \param[in] bin Mesh bin to generate a label for
virtual std::string bin_label(int bin) const = 0;
// Data members
@ -219,8 +222,6 @@ public:
double negative_grid_boundary(int* ijk, int i) const override;
std::string bin_label(int bin) const override;
int n_surface_bins() const override;
std::pair<std::vector<double>, std::vector<double>>
@ -274,6 +275,7 @@ public:
};
class UnstructuredMeshBase : public Mesh {
public:
// constructors
UnstructuredMeshBase() {};
@ -282,10 +284,10 @@ public:
std::string bin_label(int bin) const override;
//! Add a variable to the libmesh mesh instance
//! Add a variable to the mesh instance
virtual void add_score(const std::string& var_name) = 0;
//! Set the value of a bin for a variable on the libmesh mesh instance
//! Set the value of a bin for a variable on the mesh instance
virtual void set_score_data(const std::string& var_name,
std::vector<double> values,
std::vector<double> std_dev) = 0;
@ -294,7 +296,7 @@ public:
virtual Position centroid(int bin) const = 0;
// Data members
std::string filename_;
};
@ -343,11 +345,6 @@ public:
// \return The centroid of the element
Position centroid(int bin) const override;
//! Return a string represntation of the mesh bin
//
//! \param[in] bin Mesh bin to generate a label for
std::string bin_label(int bin) const override;
//! Add a score to the mesh instance
void add_score(const std::string& score);

View file

@ -133,9 +133,7 @@ UnstructuredMeshBase::UnstructuredMeshBase(pugi::xml_node node) : Mesh(node) {
std::string
UnstructuredMeshBase::bin_label(int bin) const {
std::stringstream out;
out << "Mesh Index (" << bin << ")";
return out.str();
return fmt::format("Mesh Index ({})", bin);
};
//==============================================================================
@ -1055,19 +1053,6 @@ RegularMesh::count_sites(const Particle::Bank* bank,
return counts;
}
std::string RegularMesh::bin_label(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();
}
//==============================================================================
// RectilinearMesh implementation
//==============================================================================
@ -2033,11 +2018,6 @@ UnstructuredMesh::centroid(int bin) const {
return {centroid[0], centroid[1], centroid[2]};
}
std::string
UnstructuredMesh::bin_label(int bin) const {
return fmt::format("Mesh Index ({})", bin);
};
std::pair<moab::Tag, moab::Tag>
UnstructuredMesh::get_score_tags(std::string score) const {
moab::ErrorCode rval;