Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/fenicsx-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ jobs:

- name: Install Basix
run: |
python3 -m pip install git+https://github.com/FEniCS/basix.git
python3 -m pip install git+https://github.com/FEniCS/basix.git@mscroggs/remove-gdim

- name: Clone FFCx
uses: actions/checkout@v4
with:
path: ./ffcx
repository: FEniCS/ffcx
ref: main
ref: mscroggs/gdim

- name: Install FFCx
run: |
Expand Down Expand Up @@ -69,15 +69,15 @@ jobs:

- name: Install Basix and FFCx
run: |
python3 -m pip install git+https://github.com/FEniCS/basix.git
python3 -m pip install git+https://github.com/FEniCS/ffcx.git
python3 -m pip install git+https://github.com/FEniCS/basix.git@mscroggs/remove-gdim
python3 -m pip install git+https://github.com/FEniCS/ffcx.git@mscroggs/gdim

- name: Clone DOLFINx
uses: actions/checkout@v4
with:
path: ./dolfinx
repository: FEniCS/dolfinx
ref: main
ref: mscroggs/gdim
- name: Install DOLFINx
run: |
cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build -S dolfinx/cpp/
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tsfc-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ jobs:
with:
path: ./tsfc
repository: firedrakeproject/tsfc
ref: master
ref: mscroggs/gdim
- name: Install tsfc
run: |
cd tsfc
pip install -r requirements-ext.txt
pip install git+https://github.com/coneoproject/COFFEE.git#egg=coffee
pip install git+https://github.com/firedrakeproject/fiat.git#egg=fenics-fiat
pip install git+https://github.com/FInAT/FInAT.git#egg=finat
pip install git+https://github.com/FInAT/FInAT.git@mscroggs/gdim#egg=finat
pip install git+https://github.com/firedrakeproject/loopy.git#egg=loopy
pip install .[ci]
pip install pytest
Expand Down
2 changes: 1 addition & 1 deletion demo/HyperElasticity.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# Cell and its properties
cell = tetrahedron
domain = Mesh(FiniteElement("Lagrange", cell, 1, (3, ), identity_pullback, H1))
d = cell.geometric_dimension()
d = 3
N = FacetNormal(domain)
x = SpatialCoordinate(domain)

Expand Down
3 changes: 1 addition & 2 deletions test/test_apply_function_pullbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def check_single_function_pullback(g, mappings):


def test_apply_single_function_pullbacks_triangle3d():
triangle3d = Cell("triangle", geometric_dimension=3)
cell = triangle3d
cell = Cell("triangle")
domain = Mesh(FiniteElement("Lagrange", cell, 1, (3, ), identity_pullback, H1))

UL2 = FiniteElement("Discontinuous Lagrange", cell, 1, (), l2_piola, L2)
Expand Down
2 changes: 1 addition & 1 deletion test/test_automatic_differentiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ExpressionCollection(object):

def __init__(self, cell):
self.cell = cell
d = cell.geometric_dimension()
d = cell.topological_dimension()
domain = Mesh(FiniteElement("Lagrange", cell, 1, (d, ), identity_pullback, H1))

x = SpatialCoordinate(domain)
Expand Down
1 change: 0 additions & 1 deletion test/test_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,3 @@ def test_tensorproductcell():
cell = orig.reconstruct()
assert cell.sub_cells() == orig.sub_cells()
assert cell.topological_dimension() == orig.topological_dimension()
assert cell.geometric_dimension() == orig.geometric_dimension()
2 changes: 1 addition & 1 deletion test/test_classcoverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def testAll(self):

# --- Elements:
cell = triangle
dim = cell.geometric_dimension()
dim = 2

e0 = FiniteElement("Lagrange", cell, 1, (), identity_pullback, H1)
e1 = FiniteElement("Lagrange", cell, 1, (2, ), identity_pullback, H1)
Expand Down
26 changes: 14 additions & 12 deletions test/test_derivative.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,16 @@ def make_value(c):

amapping = dict((c, make_value(c)) for c in chain(ad.original_form.coefficients(), ad.original_form.arguments()))
bmapping = dict((c, make_value(c)) for c in chain(bd.original_form.coefficients(), bd.original_form.arguments()))
acell = extract_unique_domain(actual).ufl_cell()
bcell = extract_unique_domain(expected).ufl_cell()
adomain = extract_unique_domain(actual)
bdomain = extract_unique_domain(expected)
acell = adomain.ufl_cell()
bcell = bdomain.ufl_cell()
assert acell == bcell
if acell.geometric_dimension() == 1:
if adomain.geometric_dimension() == 1:
x = (0.3,)
elif acell.geometric_dimension() == 2:
elif adomain.geometric_dimension() == 2:
x = (0.3, 0.4)
elif acell.geometric_dimension() == 3:
elif adomain.geometric_dimension() == 3:
x = (0.3, 0.4, 0.5)
av = a(x, amapping)
bv = b(x, bmapping)
Expand Down Expand Up @@ -464,7 +466,7 @@ def test_multiple_coefficient_derivative(self):

def test_indexed_coefficient_derivative(self):
cell = triangle
ident = Identity(cell.geometric_dimension())
ident = Identity(2)
V = FiniteElement("Lagrange", cell, 1, (), identity_pullback, H1)
W = FiniteElement("Lagrange", cell, 1, (2, ), identity_pullback, H1)
domain = Mesh(FiniteElement("Lagrange", cell, 1, (2, ), identity_pullback, H1))
Expand Down Expand Up @@ -522,21 +524,21 @@ def test_segregated_derivative_of_convection(self):

Lv = {}
Lvu = {}
for a in range(cell.geometric_dimension()):
for a in range(3):
Lv[a] = derivative(L, v[a], dv)
for b in range(cell.geometric_dimension()):
for b in range(3):
Lvu[a, b] = derivative(Lv[a], u[b], du)

for a in range(cell.geometric_dimension()):
for b in range(cell.geometric_dimension()):
for a in range(3):
for b in range(3):
form = Lvu[a, b]*dx
fd = compute_form_data(form)
pf = fd.preprocessed_form
expand_indices(pf)

k = Index()
for a in range(cell.geometric_dimension()):
for b in range(cell.geometric_dimension()):
for a in range(3):
for b in range(3):
actual = Lvu[a, b]
expected = du*u[a].dx(b)*dv + u[k]*du.dx(k)*dv
assertEqualBySampling(actual, expected)
Expand Down
19 changes: 9 additions & 10 deletions test/test_domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@

def test_construct_domains_from_cells():
for cell in all_cells:
d = cell.geometric_dimension()
d = cell.topological_dimension()
Mesh(FiniteElement("Lagrange", cell, 1, (d, ), identity_pullback, H1))


def test_construct_domains_with_names():
for cell in all_cells:
d = cell.geometric_dimension()
d = cell.topological_dimension()
e = FiniteElement("Lagrange", cell, 1, (d, ), identity_pullback, H1)
D2 = Mesh(e, ufl_id=2)
D3 = Mesh(e, ufl_id=3)
Expand All @@ -36,16 +36,15 @@ def test_construct_domains_with_names():
def test_domains_sort_by_name():
# This ordering is rather arbitrary, but at least this shows sorting is
# working
domains1 = [Mesh(FiniteElement("Lagrange", cell, 1, (cell.geometric_dimension(), ),
domains1 = [Mesh(FiniteElement("Lagrange", cell, 1, (cell.topological_dimension(), ),
identity_pullback, H1),
ufl_id=hash(cell.cellname()))
for cell in all_cells]
domains2 = [Mesh(FiniteElement("Lagrange", cell, 1, (cell.geometric_dimension(), ),
domains2 = [Mesh(FiniteElement("Lagrange", cell, 1, (cell.topological_dimension(), ),
identity_pullback, H1),
ufl_id=hash(cell.cellname()))
for cell in sorted(all_cells)]
sdomains = sorted(domains1, key=lambda D: (D.geometric_dimension(),
D.topological_dimension(),
sdomains = sorted(domains1, key=lambda D: (D.topological_dimension(),
D.ufl_cell(),
D.ufl_id()))
assert sdomains != domains1
Expand Down Expand Up @@ -115,7 +114,7 @@ def test_join_domains():
from ufl.domain import join_domains
mesh7 = MockMesh(7)
mesh8 = MockMesh(8)
triangle3 = Cell("triangle", geometric_dimension=3)
triangle = Cell("triangle")
xa = FiniteElement("Lagrange", triangle, 1, (2, ), identity_pullback, H1)
xb = FiniteElement("Lagrange", triangle, 1, (2, ), identity_pullback, H1)

Expand Down Expand Up @@ -163,11 +162,11 @@ def test_join_domains():
with pytest.raises(BaseException):
join_domains([
Mesh(FiniteElement("Lagrange", triangle, 1, (2, ), identity_pullback, H1)),
Mesh(FiniteElement("Lagrange", triangle3, 1, (3, ), identity_pullback, H1))])
Mesh(FiniteElement("Lagrange", triangle, 1, (3, ), identity_pullback, H1))])
with pytest.raises(BaseException):
join_domains([
Mesh(FiniteElement("Lagrange", triangle, 1, (2, ), identity_pullback, H1), ufl_id=7, cargo=mesh7),
Mesh(FiniteElement("Lagrange", triangle3, 1, (3, ), identity_pullback, H1), ufl_id=8, cargo=mesh8)])
Mesh(FiniteElement("Lagrange", triangle, 1, (3, ), identity_pullback, H1), ufl_id=8, cargo=mesh8)])
# Cargo and mesh ids must match
with pytest.raises(BaseException):
Mesh(FiniteElement("Lagrange", triangle, 1, (2, ), identity_pullback, H1), ufl_id=7, cargo=mesh8)
Expand All @@ -181,7 +180,7 @@ def test_join_domains():
Mesh(FiniteElement("Lagrange", triangle, 1, (2, ), identity_pullback, H1), ufl_id=7), None,
Mesh(FiniteElement("Lagrange", quadrilateral, 1, (2, ), identity_pullback, H1), ufl_id=8)]))
assert None not in join_domains([
Mesh(FiniteElement("Lagrange", triangle3, 1, (3, ), identity_pullback, H1), ufl_id=7), None,
Mesh(FiniteElement("Lagrange", triangle, 1, (3, ), identity_pullback, H1), ufl_id=7), None,
Mesh(FiniteElement("Lagrange", tetrahedron, 1, (3, ), identity_pullback, H1), ufl_id=8)])


Expand Down
4 changes: 2 additions & 2 deletions test/test_evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def testZero():

def testIdentity():
cell = triangle
ident = Identity(cell.geometric_dimension())
ident = Identity(cell.topological_dimension())

s = 123 * ident[0, 0]
e = s((5, 7))
Expand Down Expand Up @@ -118,7 +118,7 @@ def testIndexSum2():
cell = triangle
domain = Mesh(FiniteElement("Lagrange", cell, 1, (2, ), identity_pullback, H1))
x = SpatialCoordinate(domain)
ident = Identity(cell.geometric_dimension())
ident = Identity(cell.topological_dimension())
i, j = indices(2)
s = (x[i] * x[j]) * ident[i, j]
e = s((5, 7))
Expand Down
133 changes: 0 additions & 133 deletions test/test_grad.py

This file was deleted.

2 changes: 1 addition & 1 deletion test/test_indices.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def test_spatial_derivative(self):
v = TestFunction(space)
u = TrialFunction(space)
i, j, k, l = indices(4) # noqa: E741
d = cell.geometric_dimension()
d = 2

a = v[i].dx(i)
self.assertSameIndices(a, ())
Expand Down
3 changes: 1 addition & 2 deletions test/test_measures.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,12 @@ def test_foo():
# Define a manifold domain, allows checking gdim/tdim mixup errors
gdim = 3
tdim = 2
cell = Cell("triangle", gdim)
cell = Cell("triangle")
mymesh = MockMesh(9)
mydomain = Mesh(FiniteElement("Lagrange", cell, 1, (gdim, ), identity_pullback, H1),
ufl_id=9, cargo=mymesh)

assert cell.topological_dimension() == tdim
assert cell.geometric_dimension() == gdim
assert cell.cellname() == "triangle"
assert mydomain.topological_dimension() == tdim
assert mydomain.geometric_dimension() == gdim
Expand Down
Loading