Example #1
0
        else:
            return None
    elif 'FIPY_LSM' in os.environ:
        return os.environ['FIPY_LSM'].lower()
    elif _checkForLSMLIB():
        return 'lsmlib'
    elif _checkForSKFMM():
        return 'skfmm'
    else:
        return None


LSM_SOLVER = _parseLSMSolver()

register_skipper(flag="LSM",
                 test=lambda: LSM_SOLVER is not None,
                 why="neither `lsmlib` nor `skfmm` can be found on the $PATH")

register_skipper(flag="LSMLIB",
                 test=lambda: LSM_SOLVER == 'lsmlib',
                 why="`lsmlib` must be used to run some tests")

register_skipper(flag="SKFMM",
                 test=lambda: LSM_SOLVER == 'skfmm',
                 why="`skfmm` must be used to run some tests")

__all__ = ["DistanceVariable"]


class DistanceVariable(CellVariable):
    r"""
Example #2
0
        except ImportError:
            from fipy.tools.comms.dummyComm import DummyComm
            serialComm, parallelComm = DummyComm(), DummyComm()
    else:
        from fipy.tools.comms.dummyComm import DummyComm
        serialComm, parallelComm = DummyComm(), DummyComm()

    return serialComm, parallelComm


serial, parallel = serialComm, parallelComm = _getComms()

from fipy.tests.doctestPlus import register_skipper

register_skipper(flag="SERIAL",
                 test=lambda: parallelComm.Nproc == 1,
                 why="more than one processor found",
                 skipWarning=False)

register_skipper(flag="PARALLEL",
                 test=lambda: parallelComm.Nproc > 1,
                 why="only one processor found",
                 skipWarning=False)

register_skipper(flag="PROCESSOR_0",
                 test=lambda: parallelComm.procID == 0,
                 why="not running on processor 0",
                 skipWarning=False)

for M in (2, 3):
    for N in range(M):
        register_skipper(flag="PROCESSOR_%d_OF_%d" % (N, M),
Example #3
0
        except ImportError:
            from fipy.tools.comms.dummyComm import DummyComm
            serialComm, parallelComm = DummyComm(), DummyComm()
    else:
        from fipy.tools.comms.dummyComm import DummyComm
        serialComm, parallelComm = DummyComm(), DummyComm()
        
    return serialComm, parallelComm
    
serial, parallel = serialComm, parallelComm = _getComms()


from fipy.tests.doctestPlus import register_skipper

register_skipper(flag="SERIAL",
                 test=lambda: parallelComm.Nproc == 1,
                 why="more than one processor found",
                 skipWarning=False)

register_skipper(flag="PARALLEL",
                 test=lambda: parallelComm.Nproc > 1,
                 why="only one processor found",
                 skipWarning=False)

register_skipper(flag="PROCESSOR_0",
                 test=lambda: parallelComm.procID == 0,
                 why="not running on processor 0",
                 skipWarning=False)

for M in (2, 3):
    for N in range(M):
        register_skipper(flag="PROCESSOR_%d_OF_%d" % (N, M),
            except (ImportError, SerialSolverError) as inst:
                exceptions.append(inst)

                try:
                    if _parallelComm.Nproc > 1:
                        raise SerialSolverError('scipy')
                    from fipy.solvers.scipy import *
                    __all__.extend(scipy.__all__)
                    solver = "scipy"
                    from fipy.matrices.scipyMatrix import _ScipyMeshMatrix
                    _MeshMatrix = _ScipyMeshMatrix
                except (ImportError, SerialSolverError) as inst:
                    exceptions.append(inst)
                    import warnings
                    warnings.warn(
                        "Could not import any solver package. If you are using Trilinos, make sure you have all of the necessary Trilinos packages installed - Epetra, EpetraExt, AztecOO, Amesos, ML, and IFPACK."
                    )
                    for inst in exceptions:
                        warnings.warn(inst.__class__.__name__ + ': ' +
                                      inst.message)

else:
    raise ImportError('Unknown solver package %s' % solver)

from fipy.tests.doctestPlus import register_skipper

register_skipper(flag='PYSPARSE_SOLVER',
                 test=lambda: solver == 'pysparse',
                 why="the PySparse solvers are not being used.",
                 skipWarning=True)
Example #5
0
            return "skfmm"
        else:
            return None
    elif 'FIPY_LSM' in os.environ:
        return os.environ['FIPY_LSM'].lower()
    elif _checkForLSMLIB():
        return 'lsmlib'
    elif _checkForSKFMM():
        return 'skfmm'
    else:
        return None
    
LSM_SOLVER = _parseLSMSolver()

register_skipper(flag="LSM",
                 test=lambda : LSM_SOLVER is not None,
                 why="neither `lsmlib` nor `skfmm` can be found on the $PATH")

register_skipper(flag="LSMLIB",
                 test=lambda : LSM_SOLVER == 'lsmlib',
                 why="`lsmlib` must be used to run some tests")

register_skipper(flag="SKFMM",
                 test=lambda : LSM_SOLVER == 'skfmm',
                 why="`skfmm` must be used to run some tests")


__all__ = ["DistanceVariable"]

class DistanceVariable(CellVariable):
    r"""
Example #6
0

def _checkForTVTK():
    hasTVTK = True
    try:
        try:
            from tvtk.api import tvtk
        except ImportError as e:
            from enthought.tvtk.api import tvtk
    except Exception:
        hasTVTK = False
    return hasTVTK


register_skipper(flag="TVTK",
                 test=_checkForTVTK,
                 why="the `tvtk` package cannot be imported")


class VTKViewer(AbstractViewer):
    """Renders `_MeshVariable` data in VTK format
    """
    def __init__(self, vars, title=None, limits={}, **kwlimits):
        """Creates a VTKViewer

        :Parameters:
          vars
            a `_MeshVariable` or a tuple of them
          title
            displayed at the top of the `Viewer` window
          limits : dict
Example #7
0
from fipy.viewers.viewer import AbstractViewer
from fipy.tests.doctestPlus import register_skipper

def _checkForTVTK():
    hasTVTK = True
    try:
        try:
            from tvtk.api import tvtk
        except ImportError as e:
            from enthought.tvtk.api import tvtk
    except Exception:
        hasTVTK = False
    return hasTVTK

register_skipper(flag="TVTK",
                 test=_checkForTVTK,
                 why="the `tvtk` package cannot be imported")

class VTKViewer(AbstractViewer):
    """Renders `_MeshVariable` data in VTK format
    """
    def __init__(self, vars, title=None, limits={}, **kwlimits):
        """Creates a VTKViewer

        :Parameters:
          vars
            a `_MeshVariable` or a tuple of them
          title
            displayed at the top of the `Viewer` window
          limits : dict
            a (deprecated) alternative to limit keyword arguments
Example #8
0
                    if _parallelComm.Nproc > 1:
                        raise SerialSolverError('scipy')
                    from fipy.solvers.scipy import *
                    __all__.extend(scipy.__all__)
                    solver = "scipy"
                    from fipy.matrices.scipyMatrix import _ScipyMeshMatrix
                    _MeshMatrix = _ScipyMeshMatrix
                except (ImportError, SerialSolverError) as inst:
                    exceptions.append(inst)
                    import warnings
                    warnings.warn("Could not import any solver package. If you are using Trilinos, make sure you have all of the necessary Trilinos packages installed - Epetra, EpetraExt, AztecOO, Amesos, ML, and IFPACK.")
                    for inst in exceptions:
                        warnings.warn(inst.__class__.__name__ + ': ' + inst.message)


else:
    raise ImportError('Unknown solver package %s' % solver)


from fipy.tests.doctestPlus import register_skipper

register_skipper(flag='PYSPARSE_SOLVER',
                 test=lambda: solver == 'pysparse',
                 why="the Pysparse solvers are not being used.",
                 skipWarning=True)

register_skipper(flag='NOT_PYAMGX_SOLVER',
                 test=lambda: solver != 'pyamgx',
                 why="the PyAMGX solver is being used.",
                 skipWarning=True)
Example #9
0
__docformat__ = 'restructuredtext'

import platform

from fipy.terms.implicitSourceTerm import ImplicitSourceTerm
from fipy.variables.variable import Variable
from fipy.terms.explicitUpwindConvectionTerm import ExplicitUpwindConvectionTerm
from fipy.variables.surfactantConvectionVariable import SurfactantConvectionVariable
from fipy.terms.transientTerm import TransientTerm
from fipy.tests.doctestPlus import register_skipper
from fipy.solvers import solver

register_skipper(
    flag="NOTLINUXSCIPY",
    test=lambda: platform.system() != "Linux" or solver != 'scipy',
    why="`scipy` solvers on Linux fail intermittently: #575")


class AdsorbingSurfactantEquation():
    r"""

    The `AdsorbingSurfactantEquation` object solves the
    `SurfactantEquation` but with an adsorbing species from some bulk
    value. The equation that describes the surfactant adsorbing is
    given by,

    .. math::

       \dot{\theta} = J v \theta + k c (1 - \theta - \theta_{\text{other}}) - \theta c_{\text{other}} k_{\text{other}} - k^- \theta

    where :math:`\theta`, :math:`J`, :math:`v`, :math:`k`, :math:`c`,
Example #10
0
            except (ImportError, SerialSolverError) as inst:
                exceptions.append(inst)

                try:
                    if _parallelComm.Nproc > 1:
                        raise SerialSolverError('scipy')
                    from fipy.solvers.scipy import *
                    __all__.extend(scipy.__all__)
                    solver = "scipy"
                    from fipy.matrices.scipyMatrix import _ScipyMeshMatrix
                    _MeshMatrix = _ScipyMeshMatrix
                except (ImportError, SerialSolverError) as inst:
                    exceptions.append(inst)
                    import warnings
                    warnings.warn("Could not import any solver package. If you are using Trilinos, make sure you have all of the necessary Trilinos packages installed - Epetra, EpetraExt, AztecOO, Amesos, ML, and IFPACK.") 
                    for inst in exceptions:
                        warnings.warn(inst.__class__.__name__ + ': ' + inst.message)
                        

else:
    raise ImportError, 'Unknown solver package %s' % solver


from fipy.tests.doctestPlus import register_skipper

register_skipper(flag='PYSPARSE_SOLVER',
                 test=lambda: solver == 'pysparse',
                 why="the PySparse solvers are not being used.",
                 skipWarning=True)