Skip to content
Snippets Groups Projects
Commit dc0a296a authored by Franck Pérignon's avatar Franck Pérignon
Browse files

update tests

parent cfc5f1cf
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,7 @@ on hybrid architectures (MPI-GPU)
"""
__version__ = 1.00
__all__ = ['Box', 'Field', 'AnalyticalField']
__all__ = ['Box', 'Field']
# Compilation flags
__MPI_ENABLED__ = "@USE_MPI@" is "ON"
......@@ -35,9 +35,7 @@ Box = domain.box.Box
## Fields
import fields.continuous
import fields.analytical
Field = fields.continuous.Field
AnalyticalField = fields.analytical.AnalyticalField
# ## ## Problem
......
"""
@package parmepy.domain
@file parmepy/domain/__init__.py
Everything concerning physical domains, their discretizations
and MPI topologies.
"""
......@@ -2,7 +2,6 @@
Testing parmepy.field.continuous.Field
"""
from parmepy.fields.continuous import Field
from parmepy.fields.analytical import AnalyticalField
from parmepy.domain.box import Box
......@@ -21,7 +20,22 @@ def test_analytical():
"""Test formula"""
dom = Box()
formula = lambda x, y, z: (x * y * z, 1.0, -x * y * z)
caf = AnalyticalField(dom, formula)
caf = Field(dom, formula)
assert caf.value(0., 0., 0.) == (0., 1., 0.)
assert caf.value(1., 1., 1.) == (1., 1., -1.)
assert caf.value(1., 2., 3.) == (6., 1., -6.)
def test_analytical_reset():
"""Test formula"""
dom = Box()
formula = lambda x, y, z: (x * y * z, 1.0, -x * y * z)
caf = Field(dom, formula)
assert caf.value(0., 0., 0.) == (0., 1., 0.)
assert caf.value(1., 1., 1.) == (1., 1., -1.)
assert caf.value(1., 2., 3.) == (6., 1., -6.)
form2 = lambda x, y, z, dt: (x * y * z, 1.0, -x * y * z * dt)
caf.setFormula(form2)
assert caf.value(0., 0., 0., 0.) == (0., 1., 0.)
assert caf.value(1., 1., 1., 1.) == (1., 1., -1.)
assert caf.value(1., 2., 3., 4.) == (6., 1., -24.)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment