gmggroup / omf-python

Python library for working with OMF files
MIT License
79 stars 19 forks source link

Point based/structured grids? #80

Open banesullivan opened 5 years ago

banesullivan commented 5 years ago

I'm just now realizing there isn't exactly support for structured grids (points based grids) in OMF.

For example, take discretize's CurvilinearMesh class and preview a 3D rendering of it here

import discretize
import numpy as np
import pyvista as pv

sz = [16, 16, 16]
curv = discretize.CurvilinearMesh(discretize.utils.exampleLrmGrid(sz, 'rotate'))
vec = np.arange(curv.nC)
data = {'a': vec, 'b': vec + 1}

curv.to_vtk(data).slice_orthogonal().plot(show_edges=True)

ezgif com-video-to-gif-4

@fwkoch: How would one go about serializing this type of structured grid to the OMF format? Are there plans for node-based grids in v2.0?

Relevant to https://github.com/simpeg/discretize/pull/174

banesullivan commented 5 years ago

Also, the equivalent VTK data structure I have in mind id vtkStructuredGrid (pyvista.StructuredGrid)