-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Combines component as basic application
Issues with segfaults in meshpy.triangle related to order of of meshpy vs. numpy imports have emerged again. See this issue on the meshpy repo (inducer/meshpy#8). Look into using TetGen to do the 2d triangulation as the issue seems to be restricted to triangle.
- Loading branch information
Showing
6 changed files
with
195 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from __future__ import print_function | ||
|
||
from meshpy import triangle, tet | ||
import numpy as np | ||
from numpy import random as npr | ||
from numpy import linalg as npl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
import faulthandler | ||
faulthandler.enable() | ||
|
||
import sys | ||
|
||
from mesh_sphere_packing import * | ||
from mesh_sphere_packing.splitsphere import splitsphere | ||
from mesh_sphere_packing.boundarypslg import boundarypslg | ||
from mesh_sphere_packing.tetmesh import build_tetmesh | ||
|
||
|
||
def build(args): | ||
x, y, z, r, Lx, Ly, Lz = args | ||
segments = splitsphere(args) | ||
boundaries = boundarypslg(segments, Lx, Ly, Lz) | ||
return build_tetmesh(segments, boundaries, Lx, Ly, Lz) | ||
|
||
|
||
def get_args(argv): | ||
# TODO : Replace with argparse. | ||
"""Get command line arguments | ||
:return: sphere center coordinates, x, y, z, sphere radius, r, | ||
domain box side lengths, Lx, Ly, Lz. | ||
""" | ||
try: | ||
return float(argv[1]), float(argv[2]), float(argv[3]), float(argv[4]),\ | ||
float(argv[5]), float(argv[6]), float(argv[7]) | ||
except IndexError: | ||
raise UserWarning('Must specify x0 y0 z0 r Lx Ly Lz') | ||
except ValueError: | ||
raise UserWarning('Invalid arguments') | ||
|
||
|
||
if __name__ == '__main__': | ||
args = get_args(sys.argv) | ||
mesh = build(args) | ||
mesh.write_vtk('mesh.vtk') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.