Skip to content

Instantly share code, notes, and snippets.

View shimwell's full-sized avatar

Jonathan Shimwell shimwell

View GitHub Profile
@pshriwise
pshriwise / groups_to_block_mats.py
Last active March 28, 2024 03:54
A code snippet for converting DAGMC Cubit groups to blocks and material assignments
import cubit
for (name, gid) in cubit.group_names_ids():
# skip the 'picked' group and other groups
# that aren't materials
if name == 'picked' or 'mat' not in name:
continue
mat = name.split('/')[0].split(':')[1]
if not mat:
@gonuke
gonuke / get_material_volume_mapping.py
Last active December 18, 2021 16:12
*untested* short script to get map of volumes and their materials from a DAGMC H5M file
import numpy as np
import pymoab as mb
def load_model(filename):
mbcore = mb.core.Core()
mbcore.load_file(filename)
return mbcore
@pshriwise
pshriwise / Makefile
Last active April 29, 2021 23:14
A quick and dirty program for writing DAGMC volumes to screen and a TSV file
DAGMC_DIR=/home/shriwise/opt/dagmc
MOAB_DIR=/home/shriwise/opt/moab
DAGMC_LIB_DIR=$(DAGMC_DIR)/lib
MOAB_LIB_DIR=$(MOAB_DIR)/lib
CXX=g++
all:
$(CXX) dagmc_vols.cpp -I$(DAGMC_DIR)/include -I$(MOAB_DIR)/include -L$(DAGMC_LIB_DIR) -L$(MOAB_LIB_DIR) -ldagmc -lMOAB -Wl,-rpath=$(DAGMC_LIB_DIR) -Wl,-rpath=$(MOAB_LIB_DIR) -o dagmc_vols
@pshriwise
pshriwise / stls_to_dagmc.py
Last active August 13, 2021 20:24
PyMOAB Script for compiling a non-overlapping set of STLs into a DAGMC model
#!/usr/bin/env python
# coding: utf-8
import glob
import json
import numpy as np
from pymoab import core, types
# skip graveyard volume for better viz
@whoisryosuke
whoisryosuke / Update-branch.md
Created September 17, 2019 17:38 — forked from santisbon/Update-branch.md
Bring your feature branch up to date with master. Deploying from Git branches adds flexibility. Bring your branch up to date with master and deploy it to make sure everything works. If everything looks good the branch can be merged. Otherwise, you can deploy your master branch to return production to its stable state.

Updating a feature branch

First we'll update your local master branch. Go to your local project and check out the branch you want to merge into (your local master branch)

$ git checkout master

Fetch the remote, bringing the branches and their commits from the remote repository. You can use the -p, --prune option to delete any remote-tracking references that no longer exist in the remote. Commits to master will be stored in a local branch, remotes/origin/master

@pshriwise
pshriwise / openmc-statepoint-3d.py
Last active January 3, 2020 22:05
Convert OpenMC Meshtally to MOAB/VTK mesh
#!/usr/env/python3
"""
Script for converting OpenMC mesh in an OpenMC
statepoint file to other mesh formats for visualization
"""
import argparse
import sys
import math