Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
d07f5cc
Initial bulk transfer of XDG geometry classes
pshriwise Sep 29, 2026
37ce5af
Porting particle state and other small changes. Compiles
pshriwise Sep 30, 2026
66a263c
Bringing in the rest of the C++ code for the XDG mesh as geometry
pshriwise Sep 30, 2026
16997fc
Bringing in necessary changes to the Python interface.
pshriwise Oct 1, 2026
33ee3d3
Fixups to surface mesh transport
pshriwise Oct 2, 2026
2f31dc1
I/O corrections and updates
pshriwise Oct 2, 2026
0e8d32f
Adding mesh filter optimization
pshriwise Oct 16, 2026
782dedc
Update value of invalid material constant
pshriwise Oct 17, 2026
21c5a36
Precomplier guards for non-xdg builds
pshriwise Nov 3, 2026
572fc19
Read new meshes using geometry root element, not filepath
pshriwise Nov 4, 2026
62b2de6
Replicate DAGMC surface mesh test for XDG
pshriwise Nov 4, 2026
2fec178
Reuse DAGMC universe test for XDG check
pshriwise Nov 4, 2026
1d80c51
Correct XDG target linkage to public.
pshriwise Nov 4, 2026
0721ba8
Remove conditional linkage of XDG from C++ unit tests
pshriwise Nov 4, 2026
ff23fef
Correction to cell attribute during XDG universe replacemnet
pshriwise Nov 4, 2026
f112c68
Adding XDG to list of features in comment
pshriwise Nov 4, 2026
9606083
Updating C++ formatting
pshriwise Nov 4, 2026
de1a638
Reworking CAD-based geometry tests
pshriwise Nov 5, 2026
70d1f33
Corecting IPC check and order of returned args from xdg::ray_fire
pshriwise Nov 5, 2026
7e478f1
Reworking test models and extending DAGMC error checks to XDG
pshriwise Nov 6, 2026
1ee233b
Remove UWUW restriction for the reflective CAD geometry test
pshriwise Nov 6, 2026
5fd9359
Moving reflective boundary DAGMC into common directory
pshriwise Nov 6, 2026
f3d3383
Corrections to reflected particle handling for XDG surface meshes
pshriwise Nov 6, 2026
4c7d7e3
Streamlining test skips
pshriwise Nov 6, 2026
e04fbe9
C++ format.
pshriwise Nov 6, 2026
f530315
Fixing broken DAGMC file symlink
pshriwise Nov 7, 2026
79794e5
Creating a fixture for the DAGMC pincell used outside regression tests
pshriwise Nov 10, 2026
dd9e603
Correcting fixture usage. Accidentally placed in fixture call
pshriwise Nov 10, 2026
3acfe92
Updating dagmc file fixture
pshriwise Nov 13, 2026
c8f02ff
Adding updates to testing and CAPI function for unstructured mesh cre…
pshriwise Dec 1, 2026
a828333
C++ formatting
pshriwise Dec 1, 2026
ade180a
Add option to check for xdg mesh backends. Support better skip practi…
pshriwise Dec 2, 2026
c5574d1
Updating skip conditions to support XDG builds with single mesh libra…
pshriwise Dec 3, 2026
ed1cc4d
C++ formatting
pshriwise Dec 3, 2026
012fdf2
C++ formatting
pshriwise Dec 3, 2026
a0249c7
Various small fixes and refactors
pshriwise Dec 4, 2026
7acf8aa
Correction to DAGMC state reset
pshriwise Dec 4, 2026
a64d251
C++ formatting
pshriwise Dec 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ elseif(OPENMC_USE_UWUW)
endif()

if(OPENMC_USE_XDG)
target_compile_definitions(libopenmc_objects PRIVATE OPENMC_XDG_ENABLED)
target_compile_definitions(libopenmc_objects PUBLIC OPENMC_XDG_ENABLED)
target_link_libraries(libopenmc_objects PUBLIC xdg::xdg)
endif()

Expand Down
7 changes: 4 additions & 3 deletions include/openmc/capi.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ int openmc_get_mesh_index(int32_t id, int32_t* index);
int openmc_get_n_batches(int* n_batches, bool get_max_batches);
int openmc_get_nuclide_index(const char name[], int* index);
int openmc_add_unstructured_mesh(const char filename[], const char library[],
double length_multiplier, const char options[], int32_t id, int32_t* index);
const char interface[], double length_multiplier, const char options[],
int32_t id, int32_t* index);
int64_t openmc_get_seed();
uint64_t openmc_get_stride();
int openmc_get_tally_index(int32_t id, int32_t* index);
Expand Down Expand Up @@ -398,8 +399,8 @@ int openmc_properties_import(const char* filename);

//! Get whether an optional build feature is enabled.
//!
//! Supported feature names are ``dagmc``, ``libmesh``, ``strict_fp``, and
//! ``uwuw``.
//! Supported feature names are ``dagmc``, ``xdg``, ``libmesh``, ``strict_fp``,
//! and ``uwuw``.
//! \param feature Name of the feature to query
//! \param enabled Whether the feature is enabled
//! \return Error code
Expand Down
2 changes: 1 addition & 1 deletion include/openmc/cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ class Cell {
//! taking into account presence of distribcell material
//! \param[in] instance of the cell
//! \return material index
int32_t material(int32_t instance) const
virtual int32_t material(int32_t instance) const
{
// If distributed materials are used, then each instance has its own
// material definition. If distributed materials are not used, then
Expand Down
3 changes: 2 additions & 1 deletion include/openmc/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ constexpr array<const char*, 39> SUBSHELLS = {"K", "L1", "L2", "L3", "M1", "M2",
// Void material and nuclide
// TODO: refactor and remove
constexpr int MATERIAL_VOID {-1};
constexpr int MATERIAL_INVALID {-2};
constexpr int NUCLIDE_NONE {-1};

// ============================================================================
Expand Down Expand Up @@ -404,7 +405,7 @@ enum class RandomRaySolve { FORWARD, FORWARD_FOR_ADJOINT, ADJOINT };
//==============================================================================
// Geometry Constants

enum class GeometryType { CSG, DAG };
enum class GeometryType { CSG, DAG, XDG_SURFACE_MESH, XDG_VOLUME_MESH };

// a surface token cannot be zero due to the unsigned nature of zero for integer
// representations. This value represents no surface.
Expand Down
6 changes: 6 additions & 0 deletions include/openmc/material.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ double density_effect(const vector<double>& f, const vector<double>& e_b_sq,
double e_p_sq, double n_conduction, double rho, double E, double tol,
int max_iter);

//! Get a material index from its name
//! \param[in] mat_name Name of the material
//! \return Index of the material in model::materials, or MATERIAL_INVALID if
//! not found
int32_t get_material_by_name(const std::string& mat_name);

//! Read material data from materials.xml
void read_materials_xml();

Expand Down
6 changes: 6 additions & 0 deletions include/openmc/mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ namespace openmc {

enum class ElementType { UNSUPPORTED = -1, LINEAR_TET, LINEAR_HEX };

struct NextMeshCell {
double distance {INFTY};
int face_idx {-1};
std::array<int, 3> next_ijk;
};

//==============================================================================
// Global variables
//==============================================================================
Expand Down
67 changes: 57 additions & 10 deletions include/openmc/particle_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
#include "DagMC.hpp"
#endif

#ifdef OPENMC_XDG_ENABLED
#include "xdg/constants.h"
#endif

namespace openmc {

//==============================================================================
Expand Down Expand Up @@ -122,11 +126,17 @@ class LocalCoord {
int& universe() { return universe_; }
const int& universe() const { return universe_; }

int& lattice() { return lattice_; }
int lattice() const { return lattice_; }
int& mesh_cell_index() { return mesh_bin_; }
int mesh_cell_index() const { return mesh_bin_; }

int& lattice() { return lattice_idx_; }
int lattice() const { return lattice_idx_; }

array<int, 3>& lattice_index() { return lattice_index_; }
const array<int, 3>& lattice_index() const { return lattice_index_; }
array<int, 3>& mesh_index() { return lattice_or_mesh_idx_; }
array<int, 3> mesh_index() const { return lattice_or_mesh_idx_; }

array<int, 3>& lattice_index() { return lattice_or_mesh_idx_; }
array<int, 3> lattice_index() const { return lattice_or_mesh_idx_; }

bool& rotated() { return rotated_; }
const bool& rotated() const { return rotated_; }
Expand All @@ -137,8 +147,9 @@ class LocalCoord {
Direction u_; //!< particle direction
int cell_ {-1};
int universe_ {-1};
int lattice_ {-1};
array<int, 3> lattice_index_ {{-1, -1, -1}};
int lattice_idx_ {-1};
array<int, 3> lattice_or_mesh_idx_ {{-1, -1, -1}};
int mesh_bin_ {-1};
bool rotated_ {false}; //!< Is the level rotated?
};

Expand Down Expand Up @@ -239,7 +250,7 @@ class BoundaryInfo {
distance_ = INFINITY;
surface_ = SURFACE_NONE;
coord_level_ = 0;
lattice_translation_ = {0, 0, 0};
mesh_or_lattice_translation_ = {0, 0, 0};
}
double& distance() { return distance_; }
const double& distance() const { return distance_; }
Expand All @@ -250,12 +261,21 @@ class BoundaryInfo {
int coord_level() const { return coord_level_; }
int& coord_level() { return coord_level_; }

array<int, 3>& lattice_translation() { return lattice_translation_; }
array<int, 3>& lattice_translation() { return mesh_or_lattice_translation_; }
const array<int, 3>& lattice_translation() const
{
return lattice_translation_;
return mesh_or_lattice_translation_;
}

const array<int, 3>& mesh_translation() const
{
return mesh_or_lattice_translation_;
}

array<int, 3>& mesh_translation() { return mesh_or_lattice_translation_; }

int mesh_translation(int i) const { return mesh_or_lattice_translation_[i]; }

// TODO: off-by-one
int surface_index() const { return std::abs(surface()) - 1; }

Expand All @@ -265,7 +285,7 @@ class BoundaryInfo {
int surface_ {
SURFACE_NONE}; //!< surface token, non-zero if boundary is surface
int coord_level_ {0}; //!< coordinate level after crossing boundary
array<int, 3> lattice_translation_ {
array<int, 3> mesh_or_lattice_translation_ {
0, 0, 0}; //!< which way lattice indices will change
};

Expand Down Expand Up @@ -398,7 +418,16 @@ class GeometryState {
#ifdef OPENMC_DAGMC_ENABLED
// DagMC state variables
moab::DagMC::RayHistory& history() { return history_; }
#endif

#ifdef OPENMC_XDG_ENABLED
// Previously intersected XDG faces
std::vector<xdg::MeshID>& xdg_prev_elements() { return xdg_prev_elements_; }
#endif

#if defined(OPENMC_DAGMC_ENABLED) || defined(OPENMC_XDG_ENABLED)
Direction& last_dir() { return last_dir_; }
const Direction& last_dir() const { return last_dir_; }
#endif

// material of current and last cell
Expand All @@ -421,6 +450,17 @@ class GeometryState {
int& temperature_field_bin() { return temperature_field_bin_; }
const int& temperature_field_bin() const { return temperature_field_bin_; }

void reset_cad_state()
{
#ifdef OPENMC_DAGMC_ENABLED
history_.reset();
#endif

#ifdef OPENMC_XDG_ENABLED
xdg_prev_elements_.clear();
#endif
}

private:
int64_t id_ {-1}; //!< Unique ID

Expand Down Expand Up @@ -456,6 +496,13 @@ class GeometryState {

#ifdef OPENMC_DAGMC_ENABLED
moab::DagMC::RayHistory history_;
#endif

#ifdef OPENMC_XDG_ENABLED
std::vector<xdg::MeshID> xdg_prev_elements_;
#endif

#if defined(OPENMC_DAGMC_ENABLED) || defined(OPENMC_XDG_ENABLED)
Direction last_dir_;
#endif
};
Expand Down
2 changes: 1 addition & 1 deletion include/openmc/string_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ char* strtrim(char* c_str);

std::string to_element(const std::string& name);

void to_lower(std::string& str);
std::string& to_lower(std::string& str);

int word_count(const std::string& str);

Expand Down
Loading
Loading