Code Monkey home page Code Monkey logo

Comments (4)

shimwell avatar shimwell commented on June 16, 2024

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.

shimwell avatar shimwell commented on June 16, 2024

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.

shimwell avatar shimwell commented on June 16, 2024

h5view can be used to see the contents of the h5 file
Screenshot from 2022-10-20 16-08-40

from vertices_to_h5m.

shimwell avatar shimwell commented on June 16, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.