Skip to content

Commit

Permalink
.gitignore + test_grids.py
Browse files Browse the repository at this point in the history
  • Loading branch information
albop committed May 23, 2017
1 parent 6b06053 commit c3b555c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1 +1,3 @@
*.pyc
*.mypy_cache*
*.ipynb_checkpoints*
27 changes: 27 additions & 0 deletions dolo/tests/test_grids.py
@@ -0,0 +1,27 @@
def test_grids():

from dolo.numeric.grids import CartesianGrid, UnstructuredGrid, NonUniformCartesianGrid, SmolyakGrid
from dolo.numeric.grids import n_nodes, nodes, node
print("Cartsian Grid")
grid = CartesianGrid([0.1, 0.3], [9, 0.4], [50, 10])
print(grid.nodes())
print(nodes(grid))

print("UnstructuredGrid")
ugrid = UnstructuredGrid([[0.1, 0.3], [9, 0.4], [50, 10]])
print(nodes(ugrid))
print(node(ugrid,0))
print(n_nodes(ugrid))


print("Non Uniform CartesianGrid")
ugrid = NonUniformCartesianGrid([[0.1, 0.3], [9, 0.4], [50, 10]])
print(nodes(ugrid))
print(node(ugrid,0))
print(n_nodes(ugrid))

print("Smolyak Grid")
sg = SmolyakGrid([0.1, 0.2], [1.0, 2.0], 2)
print(nodes(sg))
print(node(sg, 1))
print(n_nodes(sg))

0 comments on commit c3b555c

Please sign in to comment.