diff --git a/include/openmc/mesh.h b/include/openmc/mesh.h index eca32ad4a06..260ee2ad780 100644 --- a/include/openmc/mesh.h +++ b/include/openmc/mesh.h @@ -231,7 +231,7 @@ class RegularMesh : public StructuredMesh RegularMesh() = default; RegularMesh(pugi::xml_node node); - // Overriden methods + // Overridden methods void surface_bins_crossed(Position r0, Position r1, @@ -272,7 +272,7 @@ class RectilinearMesh : public StructuredMesh RectilinearMesh() = default; RectilinearMesh(pugi::xml_node node); - // Overriden methods + // Overridden methods void surface_bins_crossed(Position r0, Position r1, @@ -304,6 +304,17 @@ class UnstructuredMesh : public Mesh { UnstructuredMesh(pugi::xml_node node); UnstructuredMesh(const std::string& filename); + // Overridden Methods + void + surface_bins_crossed(Position r0, + Position r1, + const Direction& u, + vector& bins) const override; + + void to_hdf5(hid_t group) const override; + + std::string bin_label(int bin) const override; + // Methods //! Add a variable to the mesh instance @@ -337,14 +348,6 @@ class UnstructuredMesh : public Mesh { //! Get the library used for this unstructured mesh virtual std::string library() const = 0; - std::string bin_label(int bin) const override; - - void surface_bins_crossed(Position r0, - Position r1, - vector& bins) const; - - void to_hdf5(hid_t group) const override; - // Data members bool output_ {true}; //!< Write tallies onto the unstructured mesh at the end of a run std::string filename_; //!< Path to unstructured mesh file @@ -364,38 +367,40 @@ class MOABMesh : public UnstructuredMesh { MOABMesh(pugi::xml_node); MOABMesh(const std::string& filename); - void bins_crossed(Position r0, - Position r1, - const Direction& u, - vector& bins, - vector& lengths) const override; + // Overridden Methods - void surface_bins_crossed(Position r0, Position r1, const Direction& u, - vector& bins) const override; + void + bins_crossed(Position r0, + Position r1, + const Direction& u, + vector& bins, + vector& lengths) const override; - int get_bin(Position r) const; + int get_bin(Position r) const override; int n_bins() const override; int n_surface_bins() const override; - std::pair, vector> plot( - Position plot_ll, Position plot_ur) const override; + std::pair, vector> + plot(Position plot_ll, + Position plot_ur) const override; std::string library() const override; //! Add a score to the mesh instance void add_score(const std::string& score) override; - //! Remove a score from the mesh instance + //! Remove all scores from the mesh instance void remove_scores() override; //! Set data for a score - void set_score_data(const std::string& score, const vector& values, - const vector& std_dev) override; + void set_score_data(const std::string& score, + const vector& values, + const vector& std_dev) override; //! Write the mesh with any current tally data - void write(const std::string& base_filename) const; + void write(const std::string& base_filename) const override; Position centroid(int bin) const override; @@ -405,6 +410,8 @@ class MOABMesh : public UnstructuredMesh { void initialize() override; + // Methods + //! Find all intersections with faces of the mesh. // //! \param[in] start Staring location @@ -512,31 +519,32 @@ class LibMesh : public UnstructuredMesh { LibMesh(pugi::xml_node node); LibMesh(const std::string& filename); - // Methods + // Overridden Methods void bins_crossed(Position r0, Position r1, const Direction& u, vector& bins, vector& lengths) const override; - void surface_bins_crossed(Position r0, Position r1, const Direction& u, - vector& bins) const override; - int get_bin(Position r) const override; int n_bins() const override; int n_surface_bins() const override; - std::pair, vector> plot( - Position plot_ll, Position plot_ur) const override; + std::pair, vector> + plot(Position plot_ll, + Position plot_ur) const override; + + std::string library() const override; void add_score(const std::string& var_name) override; void remove_scores() override; - void set_score_data(const std::string& var_name, const vector& values, - const vector& std_dev) override; + void set_score_data(const std::string& var_name, + const vector& values, + const vector& std_dev) override; void write(const std::string& base_filename) const override; @@ -544,12 +552,12 @@ class LibMesh : public UnstructuredMesh { double volume(int bin) const override; - std::string library() const override; - private: void initialize() override; + // Methods + //! Translate a bin value to an element reference const libMesh::Elem& get_element_from_bin(int bin) const; @@ -567,6 +575,7 @@ class LibMesh : public UnstructuredMesh { libMesh::BoundingBox bbox_; //!< bounding box of the mesh libMesh::dof_id_type first_element_id_; //!< id of the first element in the mesh }; + #endif //============================================================================== diff --git a/src/mesh.cpp b/src/mesh.cpp index 11c7767eb6a..09ae82c707b 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -192,6 +192,7 @@ UnstructuredMesh::UnstructuredMesh(pugi::xml_node node) : Mesh(node) { void UnstructuredMesh::surface_bins_crossed(Position r0, Position r1, + const Direction& u, vector& bins) const { fatal_error("Unstructured mesh surface tallies are not implemented."); } @@ -1813,14 +1814,6 @@ double MOABMesh::tet_volume(moab::EntityHandle tet) const return 1.0 / 6.0 * (((p[1] - p[0]) * (p[2] - p[0])) % (p[3] - p[0])); } -void MOABMesh::surface_bins_crossed( - Position r0, Position r1, const Direction& u, vector& bins) const -{ - - // TODO: Implement triangle crossings here - throw std::runtime_error{"Unstructured mesh surface tallies are not implemented."}; -} - int MOABMesh::get_bin(Position r) const { moab::EntityHandle tet = get_tet(r); @@ -2081,7 +2074,8 @@ void MOABMesh::remove_scores() } void MOABMesh::set_score_data(const std::string& score, - const vector& values, const vector& std_dev) + const vector& values, + const vector& std_dev) { auto score_tags = this->get_score_tags(score); @@ -2198,13 +2192,6 @@ int LibMesh::n_bins() const return m_->n_elem(); } -void LibMesh::surface_bins_crossed( - Position r0, Position r1, const Direction& u, vector& bins) const -{ - // TODO: Implement triangle crossings here - throw std::runtime_error{"Unstructured mesh surface tallies are not implemented."}; -} - int LibMesh::n_surface_bins() const { int n_bins = 0;