Comments (3)
Hi @thoth291
I've tried to approach your problem from a simpler perspective: by making a simpler double-sphere inside a rectangular volume.
It has three "materials":
- 0 for "the outside"
- 1 for the inner ROI
- 2 for the outer ROI
Here's the script:
import numpy as np
import pygalmesh
Nx = 72
Ny = 41
Nz = 28
h = [0.2] * 3
vol = np.zeros((Nx, Ny, Nz))
X, Y, Z = np.meshgrid(np.linspace(0, Nx * h[0], num=Nx),
np.linspace(0, Ny * h[1], num=Ny),
np.linspace(0, Nz * h[2], num=Nz), indexing='ij')
x0, y0, z0 = X.mean(), Y.mean(), Z.mean()
# let's define spherical ROIs
roi_outer = (X-x0)**2 + (Y - y0)**2 + (Z - z0)**2 < 2**2
roi_inner = (X-x0)**2 + (Y - y0)**2 + (Z - z0)**2 < 1
# ... and assign some values to them (in reverse order else it will overwrite the previous values)
vol[roi_outer] = 2
vol[roi_inner] = 1
# and let's make a mesh with it
mesh = pygalmesh.generate_from_array(vol.astype(np.uint8), h, facet_distance=0.2, cell_size=0.5)
mesh.write("spheres_in_square.vtk")
Here's the result, visualized with Paraview:
So the implicit convention is that the outer mesh geometry will correspond to class 0. We can test this understanding by initializing the volume with a different value (e.g. 3): vol = np.zeros((Nx, Ny, Nz)) + 3
.
I hope this helps you get started.
Cheers
Florian
from pygalmesh.
I'd just play around with the code in the readme.
from pygalmesh.
@nschloe , what I did is simply something like this (not real code):
vol = (vol==1).astype(np.uint8)
And it seems to be doing something, but since I don't know how my mesh should look like in the first place I'm still exploring and testing.
from pygalmesh.
Related Issues (20)
- Maximum boundary size? HOT 1
- Parallel build HOT 2
- Release archives do not contain git-lfs files HOT 1
- extra_feature_edges does not seem to have any effect HOT 4
- Unstructured grid HOT 1
- pygalmesh installation in anaconda (windows) HOT 1
- SyntaxError: future feature annotations is not defined HOT 3
- How to use a closed stl file to generate the volume mesh? HOT 1
- install on windows HOT 1
- Calculate Union on meshes from meshio
- Labels on generated mesh HOT 2
- Question about converting volume to surface HOT 1
- [README] The images in the README.md are not rendering HOT 2
- Release v0.10.7 missing on GitHub
- M1 Apple Silicon support HOT 5
- generation from array HOT 4
- Compiler assumption on MacOS
- install broken for non-default install locations
- Fix `generate_from_array` signature
- Non manifold interface between two meshes
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 pygalmesh.