Skip to content

Commit

Permalink
corrected the nx,ny,nz confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
sridhar-mani committed Nov 20, 2024
1 parent 37db90e commit e0895c0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fipy/meshes/grid1D.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import unicode_literals
from fipy.meshes.nonUniformGrid1D import NonUniformGrid1D as Grid1D
import warnings
warnings.warn("Grid1D has been deprecated use NonUniformGrid1D instead.", stacklevel=3)
warnings.warn("Grid1D has been deprecated use NonUniformGrid1D instead.", stacklevel=3)
3 changes: 3 additions & 0 deletions fipy/meshes/nonUniformGrid1D.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ def __init__(self, dx=1., nx=None, overlap=2,
_BuilderClass=_NonuniformGrid1DBuilder,
_RepresentationClass=_Grid1DRepresentation,
_TopologyClass=_Grid1DTopology):

if not isinstance(nx, int) or nx < 0:
raise ValueError("nx must be a non-negative integer")

builder = _BuilderClass()

Expand Down
2 changes: 2 additions & 0 deletions fipy/meshes/nonUniformGrid2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class NonUniformGrid2D(Mesh2D):
"""
def __init__(self, dx=1., dy=1., nx=None, ny=None, overlap=2, communicator=parallelComm,
_RepresentationClass=_Grid2DRepresentation, _TopologyClass=_Grid2DTopology):
if (not isinstance(nx, int) or nx < 0) and (not isinstance(ny, int) or ny < 0):
raise ValueError("nx must be a non-negative integer")

builder = _NonuniformGrid2DBuilder()

Expand Down
3 changes: 3 additions & 0 deletions fipy/meshes/nonUniformGrid3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class NonUniformGrid3D(Mesh):
def __init__(self, dx = 1., dy = 1., dz = 1., nx = None, ny = None, nz = None, overlap=2, communicator=parallelComm,
_RepresentationClass=_Grid3DRepresentation, _TopologyClass=_Grid3DTopology):

if (not isinstance(nx, int) or nx < 0) and (not isinstance(ny, int) or ny < 0) and (not isinstance(nz, int) or nz < 0):
raise ValueError("nx must be a non-negative integer")

builder = _NonuniformGrid3DBuilder()

self.args = {
Expand Down

0 comments on commit e0895c0

Please sign in to comment.