Comments (3)
Looking into this and I think the method of finding the bounding box can be improved. Currently it runs openmc.lib and finds the bounding box from the initilized object.
However this requires openmc to be installed.
Another way would be to load up the h5m file with meshio and obtain the bounding box. The vertices of the bounding box can then be searched to find the lower left and upper right corners, by searching for points that are greater than the centroid and less than the centroid in all dimensions. and offset (now called expand) can also be allied to the resulting bounding box
import trimesh
class dagmc_bounding_box():
def __init__(self, h5m_filename):
self.h5m_filename=h5m_filename
def corners(self, expand=None):
trimesh_mesh_object = trimesh.load_mesh(self.h5m_filename, process=False)
verts =trimesh_mesh_object.bounding_box.vertices
for vert in verts:
print(vert)
if vert[0]<trimesh_mesh_object.centroid[0] and vert[1]<trimesh_mesh_object.centroid[1] and vert[2]<trimesh_mesh_object.centroid[2]:
print('upper left corner', vert)
llc = (vert[0],vert[1],vert[2])
if vert[0]>trimesh_mesh_object.centroid[0] and vert[1]>trimesh_mesh_object.centroid[1] and vert[2]>trimesh_mesh_object.centroid[2]:
print('upper right corner', vert)
urc = (vert[0],vert[1],vert[2])
if expand:
llc = (llc[0]-expand[0], llc[1]-expand[1], llc[2]-expand[2])
urc = (urc[0]+expand[0], urc[1]+expand[1], urc[2]+expand[2])
return llc, urc
bounding_box_for_openmc_mesh = dagmc_bounding_box('dagmc_not_merged.h5m').corners(expand=[1000, 1000, 1000])
print(bounding_box_for_openmc_mesh)
from openmc-dagmc-wrapper.
I'm adding this feature on this branch https://github.com/fusion-energy/openmc-dagmc-wrapper/tree/adding_offset_to_bounding_box
from openmc-dagmc-wrapper.
bounding box is now made in a separate package and offset can be set there
from openmc-dagmc-wrapper.
Related Issues (20)
- Change of repo name
- Density of liquids HOT 3
- Support for CylindricalMesh HOT 1
- Simplify create_material
- Refactor discussion HOT 8
- CellTally cannot have multiple targets HOT 2
- General tidy up HOT 2
- `__version__` attribute needed
- Can't set water
- Tallies names should not be overwritten by ODW HOT 1
- changing default setting.source
- Check the processing of results with batches = 1 HOT 1
- units for results
- Create a conda build for the package
- bounding box not subscriptable error HOT 1
- more standard tally names
- using model.Model instead of .Model HOT 2
- Plotly missing in dependencies container
- Add angle units to doc string
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openmc-dagmc-wrapper.