mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
added bbox by @pshriwise
This commit is contained in:
parent
b72c4593a3
commit
6c78d129c3
1 changed files with 13 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ from pathlib import Path
|
|||
from tempfile import TemporaryDirectory
|
||||
from xml.etree import ElementTree as ET
|
||||
|
||||
import h5py
|
||||
import numpy as np
|
||||
|
||||
import openmc
|
||||
|
|
@ -630,6 +631,9 @@ class DAGMCUniverse(UniverseBase):
|
|||
auto_mat_ids : bool
|
||||
Set IDs automatically on initialization (True) or report overlaps
|
||||
in ID space between OpenMC and UWUW materials (False)
|
||||
bounding_box : 2-tuple of numpy.array
|
||||
Lower-left and upper-right coordinates of an axis-aligned bounding box
|
||||
of the universe.
|
||||
"""
|
||||
|
||||
def __init__(self,
|
||||
|
|
@ -650,6 +654,15 @@ class DAGMCUniverse(UniverseBase):
|
|||
string += '{: <16}=\t{}\n'.format('\tFile', self.filename)
|
||||
return string
|
||||
|
||||
@property
|
||||
def bounding_box(self):
|
||||
dagmc_file = h5py.File(self.filename)
|
||||
coords = dagmc_file['tstt']['nodes']['coordinates'][()]
|
||||
lower_left_corner = coords.min(axis=0)
|
||||
upper_right_corner = coords.max(axis=0)
|
||||
bounding_box = (lower_left_corner, upper_right_corner)
|
||||
return bounding_box
|
||||
|
||||
@property
|
||||
def filename(self):
|
||||
return self._filename
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue