Comments (4)
Alternatively, h5py routines could be written into this package to take the vertices and triangles and write them directly to h5m files.
Perhaps something like this is a starting point
import numpy as np
import h5py
vertices = np.array(
[
[0.0, 0.0, 0.0],
[1.0, 0.0, 0.0],
[0.0, 1.0, 0.0],
[0.0, 0.0, 1.0],
]
)
triangles = [
np.array([[0, 1, 2], [3, 1, 2], [0, 2, 3], [0, 1, 3]]),
]
f = h5py.File("one_volume.h5m", "w")
tstt = f.create_group("tstt")
elements = tstt.create_group("elements")
nodes = tstt.create_group("nodes")
coords = nodes.create_dataset("coordinates", data=vertices)
sets = tstt.create_group("sets")
tags = tstt.create_group("tags")
from vertices_to_h5m.
To test the resulting h5m file works in openmc I have a few test cases as part of the CI that will check that the material tags are visible to DAGMC and that neutrons can be transported through the geometry. So any solution to this issue can be tested against these test cases
from vertices_to_h5m.
h5view can be used to see the contents of the h5 file
from vertices_to_h5m.
just to note the triangle sets need tagging with a string that is encoded. here is an example of decoding https://github.com/openmc-dev/openmc/blob/dff3ad48f1e9f7f3bc9cb74675613d1ae3d8bb60/openmc/universe.py#L717-L728
from vertices_to_h5m.
Related Issues (4)
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 vertices_to_h5m.