Skip to content

Commit

Permalink
Remove incorrect axis argument to concatenate
Browse files Browse the repository at this point in the history
This never should have worked, but numpy 1.10 actually checks.
Also provide some documentation for what `_faceToCellDistanceRatio` is and
why it's scalar.

Addresses #475
  • Loading branch information
guyer committed Nov 25, 2015
1 parent b542e0c commit e76a1a3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions fipy/meshes/uniformGrid1D.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ def _cellVolumes(self):

@property
def _faceToCellDistanceRatio(self):
"""how far face is from first to second cell
distance from center of face to center of first cell divided by distance
between cell centers
"""
distances = numerix.ones(self.numberOfFaces, 'd')
distances *= 0.5
if len(distances) > 0:
Expand Down
5 changes: 5 additions & 0 deletions fipy/meshes/uniformGrid2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,11 @@ def _cellDistances(self):

@property
def _faceToCellDistanceRatio(self):
"""how far face is from first to second cell
distance from center of face to center of first cell divided by distance
between cell centers
"""
faceToCellDistanceRatios = numerix.zeros(self.numberOfFaces, 'd')
faceToCellDistanceRatios[:] = 0.5
faceToCellDistanceRatios[:self.nx] = 1.
Expand Down
7 changes: 6 additions & 1 deletion fipy/meshes/uniformGrid3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,11 @@ def _cellDistances(self):

@property
def _faceToCellDistanceRatio(self):
"""how far face is from first to second cell
distance from center of face to center of first cell divided by distance
between cell centers
"""
XYdis = numerix.zeros((self.nx, self.ny, self.nz + 1),'d')
XYdis[:] = 0.5
XYdis[..., 0] = 1
Expand All @@ -275,7 +280,7 @@ def _faceToCellDistanceRatio(self):

return numerix.concatenate((numerix.ravel(XYdis.swapaxes(0,2)),
numerix.ravel(XZdis.swapaxes(0,2)),
numerix.ravel(YZdis.swapaxes(0,2))), axis=1)
numerix.ravel(YZdis.swapaxes(0,2))))

@property
def _orientedFaceNormals(self):
Expand Down

0 comments on commit e76a1a3

Please sign in to comment.