Skip to content

Commit

Permalink
merged source:branches/ticket454@5280 to source:trunk@5280. Fixes tic…
Browse files Browse the repository at this point in the history
…ket:454

git-svn-id: svn+ssh://code.matforge.org/fipy/trunk@5281 d80e17d7-ff13-0410-a124-85740d801063
  • Loading branch information
guyer committed Aug 9, 2012
2 parents 53d6503 + f59b221 commit e6f0d21
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 40 deletions.
81 changes: 45 additions & 36 deletions fipy/meshes/gmshImport.py
Original file line number Diff line number Diff line change
Expand Up @@ -1868,8 +1868,6 @@ def _test(self):
<BLANKLINE>
>>> f.close()
>>> if sys.platform == 'win32':
... os.close(ftmp)
>>> os.remove(posFile)
"""
Expand Down Expand Up @@ -2123,48 +2121,59 @@ def _test(self):
>>> if sys.platform == 'win32':
... os.close(ftmp)
>>> f = open(posFile, mode='r')
>>> print "".join(f.readlines())
>>> f = open(posFile, mode='r') # doctest: +GMSH
>>> l = f.readlines() # doctest: +GMSH
>>> f.close() # doctest: +GMSH
>>> print "".join(l[:5]) # doctest: +GMSH
$PostFormat
1.4 0 8
$EndPostFormat
$View
volume 1
0 0 0
0 0 0
0 0 0
0 0 0
1 0 0
0 0 0
1 0 0
1 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0 0
0
0.0 1.0 1.0 1.0
0.0 1.0 0.0 0.0
0.0 0.0 1.0 0.0
0.166666666667 0.166666666667 0.166666666667 0.166666666667
1.0 1.0 1.0 3.0 3.0 3.0
0.0 1.0 0.0 0.0 1.0 0.0
0.0 0.0 1.0 0.0 0.0 1.0
1.0 1.0 1.0 1.0 1.0 1.0
1.0 1.0 3.0 3.0 2.0
0.0 1.0 1.0 0.0 0.5
0.0 0.0 0.0 0.0 -1.0
0.666666666667 0.666666666667 0.666666666667 0.666666666667 0.666666666667
<BLANKLINE>
>>> print l[-1] # doctest: +GMSH
$EndView
<BLANKLINE>
>>> f.close()
>>> if sys.platform == 'win32':
... os.close(ftmp)
Py3k writes the numbers at a different precision
>>> from fipy import numerix
>>> a1 = numerix.fromstring("".join(l[5:-1]), sep=" ") # doctest: +GMSH
>>> a2 = numerix.fromstring('''
... 0 0 0
... 0 0 0
... 0 0 0
... 0 0 0
... 1 0 0
... 0 0 0
... 1 0 0
... 1 0 0
... 0 0 0
... 0 0 0
... 0 0 0
... 0 0 0
... 0 0 0
... 0 0 0
... 0 0 0
... 0 0 0 0
... 0
... 0.0 1.0 1.0 1.0
... 0.0 1.0 0.0 0.0
... 0.0 0.0 1.0 0.0
... 0.16666666666666663 0.16666666666666663 0.16666666666666663 0.16666666666666663
... 1.0 1.0 1.0 3.0 3.0 3.0
... 0.0 1.0 0.0 0.0 1.0 0.0
... 0.0 0.0 1.0 0.0 0.0 1.0
... 1.0 1.0 1.0 1.0 1.0 1.0
... 1.0 1.0 3.0 3.0 2.0
... 0.0 1.0 1.0 0.0 0.5
... 0.0 0.0 0.0 0.0 -1.0
... 0.6666666666666666 0.6666666666666666 0.6666666666666666 0.6666666666666666 0.6666666666666666
... ''', sep=" ")
>>> print numerix.allclose(a1, a2) # doctest: +GMSH
True
>>> os.remove(posFile)
"""
Expand Down
2 changes: 1 addition & 1 deletion fipy/terms/abstractConvectionTerm.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __init__(self, coeff=1.0, var=None):
__ConvectionTerm(coeff=FaceVariable(value=array([[ 0., 0., 0.]]), mesh=UniformGrid1D(dx=1.0, nx=2)))
>>> __ConvectionTerm(coeff = (1,))
__ConvectionTerm(coeff=(1,))
>>> ExplicitUpwindConvectionTerm(coeff = (0,)).solve(var=cv, solver=DummySolver())
>>> ExplicitUpwindConvectionTerm(coeff = (0,)).solve(var=cv, solver=DummySolver()) # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
TransientTermError: The equation requires a TransientTerm with explicit convection.
Expand Down
4 changes: 2 additions & 2 deletions fipy/terms/term.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import os

from fipy.tools import numerix
from fipy.solvers import DefaultSolver
from fipy.solvers import DefaultSolver, DummySolver
from fipy.terms import AbstractBaseClassError
from fipy.terms import SolutionVariableRequiredError
from fipy.tools.decorators import getsetDeprecated
Expand Down Expand Up @@ -325,7 +325,7 @@ def justErrorVector(self, var=None, solver=None, boundaryConditions=(), dt=1., u
>>> from fipy import *
>>> m = Grid1D(nx=10)
>>> v = CellVariable(mesh=m)
>>> len(DiffusionTerm().justErrorVector(v)) == m.numberOfCells
>>> len(DiffusionTerm().justErrorVector(v, solver=DummySolver())) == m.numberOfCells
True
"""
Expand Down
2 changes: 1 addition & 1 deletion fipy/terms/vanLeerConvectionTerm.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def _test(self):
>>> m = Grid1D()
>>> c = CellVariable(mesh=m)
>>> e = VanLeerConvectionTerm(((1,),))
>>> e.solve(c)
>>> e.solve(c) # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
TransientTermError: The equation requires a TransientTerm with explicit convection.
Expand Down

0 comments on commit e6f0d21

Please sign in to comment.