0-offset for geom
This commit is contained in:
parent
ffabeacbcb
commit
86d91baf90
2
PRIVATE
2
PRIVATE
|
@ -1 +1 @@
|
||||||
Subproject commit e30d554c1b78d5767bac9f2e2e5037947477b474
|
Subproject commit 4b75ce7adaf901c8c371fb54424df1352c53dfb0
|
|
@ -256,7 +256,7 @@ class Geom:
|
||||||
else:
|
else:
|
||||||
material_ = material_.reshape(grid)
|
material_ = material_.reshape(grid)
|
||||||
|
|
||||||
return Geom(material = material_+1 if material is None else material[material_],
|
return Geom(material = material_ if material is None else material[material_],
|
||||||
size = size,
|
size = size,
|
||||||
comments = util.execution_stamp('Geom','from_Laguerre_tessellation'),
|
comments = util.execution_stamp('Geom','from_Laguerre_tessellation'),
|
||||||
)
|
)
|
||||||
|
@ -286,7 +286,7 @@ class Geom:
|
||||||
KDTree = spatial.cKDTree(seeds,boxsize=size) if periodic else spatial.cKDTree(seeds)
|
KDTree = spatial.cKDTree(seeds,boxsize=size) if periodic else spatial.cKDTree(seeds)
|
||||||
devNull,material_ = KDTree.query(coords)
|
devNull,material_ = KDTree.query(coords)
|
||||||
|
|
||||||
return Geom(material = (material_+1 if material is None else material[material_]).reshape(grid),
|
return Geom(material = (material_ if material is None else material[material_]).reshape(grid),
|
||||||
size = size,
|
size = size,
|
||||||
comments = util.execution_stamp('Geom','from_Voronoi_tessellation'),
|
comments = util.execution_stamp('Geom','from_Voronoi_tessellation'),
|
||||||
)
|
)
|
||||||
|
@ -335,7 +335,7 @@ class Geom:
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_minimal_surface(grid,size,surface,threshold=0.0,periods=1,materials=(1,2)):
|
def from_minimal_surface(grid,size,surface,threshold=0.0,periods=1,materials=(0,1)):
|
||||||
"""
|
"""
|
||||||
Generate geometry from definition of triply periodic minimal surface.
|
Generate geometry from definition of triply periodic minimal surface.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import os
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
@ -305,8 +303,8 @@ class TestGeom:
|
||||||
N_seeds= np.random.randint(10,30)
|
N_seeds= np.random.randint(10,30)
|
||||||
seeds = np.random.rand(N_seeds,3) * np.broadcast_to(size,(N_seeds,3))
|
seeds = np.random.rand(N_seeds,3) * np.broadcast_to(size,(N_seeds,3))
|
||||||
weights= np.full((N_seeds),-np.inf)
|
weights= np.full((N_seeds),-np.inf)
|
||||||
ms = np.random.randint(1, N_seeds+1)
|
ms = np.random.randint(N_seeds)
|
||||||
weights[ms-1] = np.random.random()
|
weights[ms] = np.random.random()
|
||||||
Laguerre = Geom.from_Laguerre_tessellation(grid,size,seeds,weights,periodic=np.random.random()>0.5)
|
Laguerre = Geom.from_Laguerre_tessellation(grid,size,seeds,weights,periodic=np.random.random()>0.5)
|
||||||
assert np.all(Laguerre.material == ms)
|
assert np.all(Laguerre.material == ms)
|
||||||
|
|
||||||
|
@ -316,8 +314,8 @@ class TestGeom:
|
||||||
grid = np.random.randint(5,10,3)*2
|
grid = np.random.randint(5,10,3)*2
|
||||||
size = grid.astype(np.float)
|
size = grid.astype(np.float)
|
||||||
seeds = np.vstack((size*np.array([0.5,0.25,0.5]),size*np.array([0.5,0.75,0.5])))
|
seeds = np.vstack((size*np.array([0.5,0.25,0.5]),size*np.array([0.5,0.75,0.5])))
|
||||||
material = np.ones(grid)
|
material = np.zeros(grid)
|
||||||
material[:,grid[1]//2:,:] = 2
|
material[:,grid[1]//2:,:] = 1
|
||||||
if approach == 'Laguerre':
|
if approach == 'Laguerre':
|
||||||
geom = Geom.from_Laguerre_tessellation(grid,size,seeds,np.ones(2),periodic=np.random.random()>0.5)
|
geom = Geom.from_Laguerre_tessellation(grid,size,seeds,np.ones(2),periodic=np.random.random()>0.5)
|
||||||
elif approach == 'Voronoi':
|
elif approach == 'Voronoi':
|
||||||
|
|
Loading…
Reference in New Issue