Skip to content
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
64bcb0d
adding omega_h install path to the build system
magnoxemo Jun 2, 2026
b266514
add omega_h to the build system
magnoxemo Jun 7, 2026
8067920
override the pure virtual functions
magnoxemo Jun 7, 2026
da32c5b
update CI to include omega_h
magnoxemo Jun 7, 2026
b980783
update openmc testing ci to include omega_h as well
magnoxemo Jun 8, 2026
e954124
concentrating on changes that are necessary only for omega_h support
magnoxemo Jun 8, 2026
a8c9491
keeping my cicd docker file locally
magnoxemo Jun 8, 2026
7387535
Merge branch 'xdg-org:main' into omega_h
magnoxemo Jun 9, 2026
afc7b2c
still need to implement parse metadata
magnoxemo Jun 15, 2026
638dd41
implementing tests
magnoxemo Jun 15, 2026
b805e6a
compile omega_h with exodus support
magnoxemo Jun 21, 2026
b92d362
add omega_h to the docker file
magnoxemo Jun 21, 2026
2b855a8
fix testing mesh file name
magnoxemo Jun 24, 2026
6d85772
Merge branch 'main' into omega_h
magnoxemo Jun 24, 2026
e86a8a2
update mesh file name
magnoxemo Jun 24, 2026
2bfa6cc
install seacas in docker file to support exodus mesh in omega_h
magnoxemo Jun 25, 2026
929b883
setting xdg branch in docker file to this branch for now
magnoxemo Jun 25, 2026
7e8a479
update main CI to include seacas
magnoxemo Jun 27, 2026
be2d849
update xdg headers and lib pointers to allows using omega_h
magnoxemo Jun 27, 2026
5e003ca
change mesh file against which we will be testing
magnoxemo Jul 13, 2026
0507288
update test mesh
magnoxemo Jul 23, 2026
cc0db2d
trying to fix ci by providing seacas prefix path
magnoxemo Jul 27, 2026
634c3a1
Fix CMAKE_PREFIX_PATH formatting in CI workflow
magnoxemo Aug 2, 2026
7a6d1cf
regold test values
magnoxemo Aug 2, 2026
7b36ae7
cleaning up
magnoxemo Aug 4, 2026
461210d
don't build docker from my own branch
magnoxemo Aug 4, 2026
fa53c9b
Merge branch 'main' into omega_h
magnoxemo Aug 4, 2026
280fc00
rebase and adapt to API change issue
magnoxemo Aug 8, 2026
5578182
fix openmc testing CI pipeline
magnoxemo Aug 9, 2026
ae3bb15
cache seacas in CI as well
magnoxemo Aug 10, 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
60 changes: 56 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@ on:
jobs:
main:
name: |
libMesh=${{ matrix.libmesh }};MOAB=${{ matrix.moab }}
libMesh=${{ matrix.libmesh }};MOAB=${{ matrix.moab }};Omega_h=${{ matrix.omega_h }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
libmesh: [true, false]
moab: [true, false]
omega_h: [true, false]
exclude:
- moab: false
libmesh: false
omega_h: false

steps:
- name: Checkout
Expand Down Expand Up @@ -81,6 +83,15 @@ jobs:
cd libmesh
git checkout v1.7.0

- name: Omega_h Clone
if: ${{ matrix.omega_h }}
shell: bash
run: |
cd ~
git clone https://github.com/SCOREC/omega_h.git
cd omega_h
git checkout master

- name: OpenMP Environment Variables
run: |
echo "OMP_NUM_THREADS=1" >> $GITHUB_ENV
Expand All @@ -94,9 +105,13 @@ jobs:
if: ${{ matrix.libmesh }}
run: |
echo "LIBMESH_SHA"=$(cd ~/libmesh && git rev-parse HEAD) >> $GITHUB_ENV
# Enforce that we're using the debug build of libMesh
echo "METHOD=dbg" >> $GITHUB_ENV

- name: Omega_h Environment Variables
if: ${{ matrix.omega_h }}
run: |
echo "OMEGA_H_SHA"=$(cd ~/omega_h && git rev-parse HEAD) >> $GITHUB_ENV

- name: MOAB Cache
if: ${{ matrix.moab }}
id: moab-cache
Expand All @@ -117,6 +132,16 @@ jobs:
path: ~/LIBMESH
key: libmesh-${{ runner.os }}-${{ env.cache-name }}-${{ env.LIBMESH_SHA }}

- name: Omega_h Cache
if: ${{ matrix.omega_h }}
id: omega-h-cache
uses: actions/cache@v3
env:
cache-name: omega-h-cache
with:
path: ~/OMEGA_H
key: omega-h-${{ runner.os }}-${{ env.cache-name }}-${{ env.OMEGA_H_SHA }}

- if: ${{ matrix.moab && steps.moab-cache.outputs.cache-hit != 'true' }}
name: Build MOAB
run: |
Expand All @@ -141,6 +166,21 @@ jobs:
make -j4
sudo make install

- if: ${{ matrix.omega_h && steps.omega-h-cache.outputs.cache-hit != 'true' }}
name: Build Omega_h
shell: bash
run: |
cd ~/omega_h
mkdir build
cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=$HOME/OMEGA_H \
-DCMAKE_BUILD_TYPE=Release \
-DOmega_h_USE_MPI=OFF \
-DBUILD_TESTING=OFF
make -j4
make install

- name: Build
shell: bash
run: |
Expand All @@ -157,7 +197,19 @@ jobs:
fi
CMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}$HOME/MOAB"
fi
cmake .. -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" -DCMAKE_INSTALL_PREFIX=$HOME/opt -DXDG_ENABLE_MOAB=${{ matrix.moab && 'ON' || 'OFF' }} -DXDG_ENABLE_LIBMESH=${{ matrix.libmesh && 'ON' || 'OFF' }}
if [ "${{ matrix.omega_h }}" = 'true' ]; then
if [ -n "$CMAKE_PREFIX_PATH" ]; then
CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;"
fi
CMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}$HOME/OMEGA_H"
fi
cmake .. \
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \
-DCMAKE_INSTALL_PREFIX=$HOME/opt \
-DXDG_ENABLE_MOAB=${{ matrix.moab && 'ON' || 'OFF' }} \
-DXDG_ENABLE_LIBMESH=${{ matrix.libmesh && 'ON' || 'OFF' }} \
-DXDG_ENABLE_OMEGA_H=${{ matrix.omega_h && 'ON' || 'OFF' }} \
-DOMEGA_H_INSTALL_PATH=$HOME/OMEGA_H
make -j4 install

- name: Test
Expand All @@ -173,4 +225,4 @@ jobs:

- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
uses: mxschmitt/action-tmate@v3
45 changes: 38 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(openmc C CXX)
project(xdg C CXX)
Comment thread
magnoxemo marked this conversation as resolved.

option(XDG_ENABLE_MOAB "Enable support for the MOAB mesh library" ON)
option(XDG_ENABLE_MFEM "Enable support for the MFEM mesh library" OFF)
option(XDG_ENABLE_LIBMESH "Enable support for the libMesh mesh library" OFF)
option(XDG_ENABLE_OMEGA_H "Enable support for the Omega_h mesh library" ON)
Comment thread
magnoxemo marked this conversation as resolved.
Outdated
option(XDG_LINK_MPI "Link with MPI (for dependency compatibility)" OFF)
option(XDG_ENABLE_EMBREE "Enable support for the Embree ray tracing library" ON)
option(XDG_ENABLE_GPRT "Enable support for the GPRT ray tracing library" OFF)
Expand All @@ -14,7 +15,7 @@ option(XDG_BUILD_TOOLS "Enable tools and miniapps" ON
set(XDG_VERSION_MAJOR 0)
set(XDG_VERSION_MINOR 14)
set(XDG_VERSION_RELEASE 1)
set(XDG_VERSION ${OPENMC_VERSION_MAJOR}.${OPENMC_VERSION_MINOR}.${OPENMC_VERSION_RELEASE})
set(XDG_VERSION ${XDG_VERSION_MAJOR}.${XDG_VERSION_MINOR}.${XDG_VERSION_RELEASE})

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose build type" FORCE)
Expand Down Expand Up @@ -43,6 +44,20 @@ if (NOT MOAB_USE_HDF5)
endif()
endif()

#===============================================================================
# Omega_h backend
#===============================================================================
if (XDG_ENABLE_OMEGA_H)
if (NOT OMEGA_H_INSTALL_PATH)
set(OMEGA_H_INSTALL_PATH "$ENV{OMEGA_H_INSTALL_PATH}")
endif()
message(STATUS "OMEGA_H_INSTALL_PATH=${OMEGA_H_INSTALL_PATH}")
find_package(Omega_h REQUIRED HINTS "${OMEGA_H_INSTALL_PATH}/lib/cmake/Omega_h")
endif()

#===============================================================================
# Embree
#===============================================================================
if (XDG_ENABLE_EMBREE)
# find Embree for CPU ray tracing

Expand Down Expand Up @@ -122,7 +137,7 @@ if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL 0)
message(FATAL_ERROR
"git submodule update --init failed with erro code ${GIT_SUBMOD_RESULT}, "
"git submodule update --init failed with error code ${GIT_SUBMOD_RESULT}, "
"please checkout submodule at ${VENDOR_PATH} manually and try again.")
endif()
endforeach()
Expand All @@ -148,7 +163,6 @@ if (XDG_BUILD_TESTS)
message(STATUS "Using Catch2 ${Catch2_VERSION} at ${Catch2_DIR}")
endif()


# fmt
if (NOT fmt_FOUND)
set(FMT_INSTALL ON CACHE BOOL "Generate the fmt install target")
Expand All @@ -165,13 +179,13 @@ if(XDG_BUILD_TOOLS)
add_subdirectory(${CMAKE_SOURCE_DIR}/vendor/indicators)
endif()


# Ensure at least one mesh backend is enabled
if (NOT XDG_ENABLE_MOAB AND NOT XDG_ENABLE_LIBMESH)
if (NOT XDG_ENABLE_MOAB AND NOT XDG_ENABLE_LIBMESH AND NOT XDG_ENABLE_OMEGA_H)
message(FATAL_ERROR
"No mesh backend enabled. Enable at least one of:\n"
" -DXDG_ENABLE_MOAB=ON\n"
" -DXDG_ENABLE_LIBMESH=ON")
" -DXDG_ENABLE_LIBMESH=ON"
" -DXDG_ENABLE_OMEGA_H=ON")
endif()

# Ensure at least one ray tracing backend is enabled
Expand Down Expand Up @@ -236,6 +250,12 @@ src/moab/metadata.cpp
)
endif()

if (XDG_ENABLE_OMEGA_H)
list(APPEND xdg_sources
src/omega_h/mesh_manager.cpp
)
endif ()

#===============================================================================
# RPATH information (from OpenMC)
#===============================================================================
Expand Down Expand Up @@ -314,6 +334,12 @@ if (XDG_ENABLE_EMBREE)
target_compile_definitions(xdg PUBLIC XDG_ENABLE_EMBREE)
endif()


if (XDG_ENABLE_OMEGA_H)
target_compile_definitions(xdg PUBLIC XDG_ENABLE_OMEGA_H)
endif()


if (XDG_ENABLE_GPRT)
target_compile_definitions(xdg PUBLIC XDG_ENABLE_GPRT)
target_link_options(xdg PRIVATE -Wl,--unresolved-symbols=ignore-in-shared-libs)
Expand Down Expand Up @@ -354,6 +380,11 @@ if(XDG_ENABLE_LIBMESH)
target_link_libraries(xdg PRIVATE PkgConfig::LIBMESH)
endif()

if(XDG_ENABLE_OMEGA_H)
target_link_libraries(xdg PRIVATE Omega_h::omega_h)
endif()


# this provides the ability to link MPI when needed for compatibility with other
# libraries (e.g., libMesh)
if (XDG_LINK_MPI)
Expand Down
Empty file added Dockerfile
Empty file.
74 changes: 74 additions & 0 deletions include/xdg/omega_h/mesh_manager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#ifndef XDG_OMEGA_H_MESH_MANAGER_H
#define XDG_OMEGA_H_MESH_MANAGER_H

#include <map>
#include <memory>
#include <utility>

#include "xdg/mesh_manager_interface.h"

#include "Omega_h_library.hpp"
#include "Omega_h_map.hpp"
#include "Omega_h_mesh.hpp"
#include "Omega_h_profile.hpp"
#include "Omega_h_quality.hpp"
#include "Omega_h_timer.hpp"

namespace xdg {

class OmegaHMeshManager : public MeshManager {
public:
OmegaHMeshManager();
~OmegaHMeshManager() = default;

void load_file(const std::string &file_path) override;

void init() override;

int num_volumes() const override;
int num_surfaces() const override;
int num_ents_of_dimension(int dim) const;

MeshID create_volume() override;
void add_surface_to_volume(MeshID volume, MeshID surface, Sense sense,
bool overwrite = false) override;

int num_volume_elements(MeshID volume) const override;
int num_volume_elements() const override;
int num_volume_faces(MeshID volume) const override;
int num_surface_faces(MeshID surface) const override;
int num_vertices() const override;

std::vector<MeshID> get_volume_elements(MeshID volume) const override;
std::vector<MeshID> get_surface_faces(MeshID surface) const override;
std::vector<MeshID> element_connectivity(MeshID element) const override;
std::vector<MeshID> face_connectivity(MeshID face) const override;
Vertex vertex_coordinates(MeshID vertex) const override;
std::vector<Vertex> element_vertices(MeshID element) const override;
std::array<Vertex, 3> face_vertices(MeshID face) const override;
SurfaceElementType get_surface_element_type(MeshID surface) const override;
MeshID adjacent_element(MeshID element, int face) const override;
double element_volume(MeshID element) const override;

std::pair<MeshID, MeshID> surface_senses(MeshID surface) const override;
std::vector<MeshID> get_volume_surfaces(MeshID volume) const override;
Sense surface_sense(MeshID surface, MeshID volume) const override;

void parse_metadata() {};

Omega_h::Mesh *mesh() { return mesh_.get(); }
const Omega_h::Mesh *mesh() const { return mesh_.get(); }

private:
std::unique_ptr<Omega_h::Library> library_;
std::unique_ptr<Omega_h::Mesh> mesh_;

std::map<MeshID, std::pair<MeshID, MeshID>> surface_senses_;

MeshID next_volume_id_{1};
MeshID next_surface_id_{1};
};

} // namespace xdg

#endif // XDG_OMEGA_H_MESH_MANAGER_H
2 changes: 2 additions & 0 deletions src/omega_h/mesh_manager.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include "xdg/omega_h/mesh_manager.h"

Loading