-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcurrent.py
More file actions
40 lines (35 loc) · 984 Bytes
/
current.py
File metadata and controls
40 lines (35 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# py.test -v current.py
import sys
from firedrake import *
from os.path import abspath, dirname
import pytest
import os
from os import path
cwd = abspath(dirname(__file__))
sys.path.insert(0, 'lib/')
from init import *
from connect import *
from makejson import *
def test_ex2():
#define a field
exp="x[1]*x[0]"
mesh = UnitSquareMesh(2,2)
V= FunctionSpace(mesh,"Lagrange",degree=2)
f = Function(V)
f = interpolate(Expression(exp),V)
name = 'out'
res = 100
stepSize = 0.01
# path to connection
######################### choose one ###################
# old way (depends on fem branch)
#cut_old(name, f, V,res, stepSize)
# uses femprime branch and creates json file
#cut_json(name, f, V,res, stepSize)
#does not create json file
a = cut_new(name, f, res)
# two fields
#V2= FunctionSpace(mesh,"P",degree=2)
#g = Function(V2).interpolate(Expression(exp))
#cut_newTwo(name, f, g, res)
test_ex2()