Merge branch 'dev' into docs

This commit is contained in:
Lindsey Heagy
2016-03-06 21:50:27 -08:00
66 changed files with 6439 additions and 126 deletions
+38
View File
@@ -118,6 +118,44 @@ def defineElipse(ccMesh, center=[0,0,0], anisotropy=[1,1,1], slope=10., theta=0.
D = np.sqrt(np.sum(G**2,axis=1))
return -np.arctan((D-1)*slope)*(2./np.pi)/2.+0.5
def getIndicesSphere(center,radius,ccMesh):
"""
Creates a vector containing the sphere indices in the cell centers mesh.
Returns a tuple
The sphere is defined by the points
p0, describe the position of the center of the cell
r, describe the radius of the sphere.
ccMesh represents the cell-centered mesh
The points p0 must live in the the same dimensional space as the mesh.
"""
# Validation: mesh and point (p0) live in the same dimensional space
dimMesh = np.size(ccMesh[0,:])
assert len(center) == dimMesh, "Dimension mismatch. len(p0) != dimMesh"
if dimMesh == 1:
# Define the reference points
ind = np.abs(center[0] - ccMesh[:,0]) < radius
elif dimMesh == 2:
# Define the reference points
ind = np.sqrt( ( center[0] - ccMesh[:,0] )**2 + ( center[1] - ccMesh[:,1] )**2 ) < radius
elif dimMesh == 3:
# Define the points
ind = np.sqrt( ( center[0] - ccMesh[:,0] )**2 + ( center[1] - ccMesh[:,1] )**2 + ( center[2] - ccMesh[:,2] )**2 ) < radius
# Return a tuple
return ind
def defineTwoLayers(ccMesh,depth,vals=[0,1]):
"""
Define a two layered model. Depth of the first layer must be specified.