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
18 changes: 9 additions & 9 deletions .github/workflows/setup_repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ git checkout indiamai/integrate_fuse
git status
python3 -m pip install --break-system-packages -e .

/usr/bin/git config --global --add safe.directory ~
cd ~
git clone https://github.com/firedrakeproject/ufl.git
/usr/bin/git config --global --add safe.directory ~/ufl
cd ufl
git fetch
git checkout indiamai/integrate-fuse
git status
python3 -m pip install --break-system-packages -e .
#/usr/bin/git config --global --add safe.directory ~
#cd ~
#git clone https://github.com/firedrakeproject/ufl.git
#/usr/bin/git config --global --add safe.directory ~/ufl
#cd ufl
#git fetch
#git checkout indiamai/integrate-fuse
#git status
#python3 -m pip install --break-system-packages -e .
16 changes: 3 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ jobs:
# Run on the Github hosted runner
runs-on: ubuntu-latest
container:
image: firedrakeproject/firedrake-vanilla-default:latest
#image: firedrakeproject/firedrake-vanilla-default:latest
image: firedrakeproject/firedrake-vanilla-default:dev-main
# Steps represent a sequence of tasks that will be executed as
# part of the jobs
steps:
Expand Down Expand Up @@ -44,17 +45,6 @@ jobs:
git checkout indiamai/integrate_fuse
git status
python3 -m pip install --break-system-packages -e .
- name: Checkout correct UFL branch
run: |
/usr/bin/git config --global --add safe.directory ~
cd ~
git clone https://github.com/firedrakeproject/ufl.git
/usr/bin/git config --global --add safe.directory ~/ufl
cd ufl
git fetch
git checkout indiamai/integrate-fuse
git status
python3 -m pip install --break-system-packages -e .
- name: Run tests
run: |
pip list
Expand Down Expand Up @@ -104,4 +94,4 @@ jobs:
message: ${{ env.total }}%
minColorRange: 50
maxColorRange: 90
valColorRange: ${{ env.total }}
valColorRange: ${{ env.total }}
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ lint:

test_examples:
@echo " Running examples"
@python3 -m pytest test/test_2d_examples_docs.py
@python3 -m pytest test/test_3d_examples_docs.py
@FIREDRAKE_USE_FUSE=1 python3 -m pytest test/test_2d_examples_docs.py
@FIREDRAKE_USE_FUSE=1 python3 -m pytest test/test_3d_examples_docs.py

tests:
@echo " Running all tests"
@python3 -m coverage run -p -m pytest -rx test
@FIREDRAKE_USE_FUSE=1 python3 -m coverage run -p -m pytest -rx test

coverage:
@python3 -m coverage combine
Expand All @@ -34,13 +34,13 @@ coverage:
test_cells:
@echo " Running all cell comparison tests"
@firedrake-clean
@python3 -m pytest -rPx --run-cleared test/test_cells.py::test_ref_els[expect0]
@FIREDRAKE_USE_FUSE=1 python3 -m pytest -rPx --run-cleared test/test_cells.py::test_ref_els[expect0]
@firedrake-clean
@python3 -m pytest -rPx --run-cleared test/test_cells.py::test_ref_els[expect1]
@FIREDRAKE_USE_FUSE=1 python3 -m pytest -rPx --run-cleared test/test_cells.py::test_ref_els[expect1]

clean:
@(cd docs/ && make clean)

prepush: lint tests
@rm .coverage.*
make clean docs
make clean docs
4 changes: 1 addition & 3 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import pytest

def pytest_addoption(parser):
parser.addoption(
"--run-cleared",
action="store_true",
default=False,
help="Run tests that require a cleared cache",
)
)
9 changes: 6 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# html_css_files = ["additional.css"]


def setup(app):
app.add_css_file('additional.css')
app.add_css_file('additional.css')


html_theme_options = {
'navbar_links': [
Expand All @@ -109,11 +112,11 @@ def setup(app):
'globaltoc_depth': 2,
}

html_sidebars = {'api/*': ['localtoc.html'],
html_sidebars = {'api/*': ['localtoc.html'],
'api': ['localtoc.html'],
'about': [],
'install': [],
'index': ['localtoc.html'],
'manual': ['localtoc.html'],
'manual/*': ['localtoc.html'],
'_generated/*': ['custom-sidebar.html'], }
'_generated/*': ['custom-sidebar.html'], }
1 change: 0 additions & 1 deletion fuse/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from fuse.cells import Point, Edge, polygon, make_tetrahedron, constructCellComplex
from fuse.groups import S1, S2, S3, D4, Z3, Z4, C3, C4, S4, A4, tri_C3, tet_edges, tet_faces, sq_edges, GroupRepresentation, PermutationSetRepresentation, get_cyc_group, get_sym_group
from fuse.dof import DeltaPairing, DOF, L2Pairing, FuseFunction, PointKernel, PolynomialKernel, ComponentKernel, ParameterisationKernel
Expand Down
24 changes: 12 additions & 12 deletions fuse/cells.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from sympy.combinatorics.named_groups import SymmetricGroup
from fuse.utils import sympy_to_numpy, fold_reduce, numpy_to_str_tuple, orientation_value
from FIAT.reference_element import Simplex, TensorProductCell as FiatTensorProductCell, Hypercube
from FIAT.quadrature_schemes import create_quadrature
from ufl.cell import Cell, TensorProductCell
from functools import cache

Expand Down Expand Up @@ -656,9 +657,9 @@ def to_tikz(self, show=True, scale=3):
return "\n".join(tikz_commands)
return tikz_commands


def generate_facet_parameterisation(self, facet_num):
#facet = self.d_entities(self.dimension - 1)[facet_num]
raise NotImplementedError("Facet Parameterisation can be expressed using polynomials")
# facet = self.d_entities(self.dimension - 1)[facet_num]
facet = self.get_node(facet_num)
facet_dim = facet.dimension
if facet_dim != self.dimension - 1:
Expand All @@ -667,19 +668,16 @@ def generate_facet_parameterisation(self, facet_num):
raise NotImplementedError("Facet parameterisation is not implemented for dimensions greater than 1")
verts = facet.vertices()
v_coords = np.array([self.get_node(v.id, return_coords=True) for v in verts])
midpoint = np.average(v_coords, axis=0)
stacked = np.c_[np.ones((self.dimension,)), v_coords[:, 0].reshape(self.dimension,1)]
stacked = np.c_[np.ones((self.dimension,)), v_coords[:, 0].reshape(self.dimension, 1)]
b = np.array([0, 1])
coeffs = np.linalg.solve(stacked, b)

symbol_names = ["x", "y", "z"]
symbols = [1] + [sp.Symbol(symbol_names[d]) for d in range(facet_dim)]
res = 0
for d in range(facet_dim + 1):
res += coeffs[d] * symbols[d]
return res, symbols[1:]


def plot(self, show=True, plain=False, ax=None, filename=None):
""" for now into 2 dimensional space """
if self.dimension == 3:
Expand Down Expand Up @@ -790,10 +788,12 @@ def attachment(self, source, dst):
assert all(np.isclose(val, vals[0]).all() for val in vals)

return lambda *x: fold_reduce(attachments[0], *x)





def quadrature(self, degree):
fiat_el = self.to_fiat()
Q = create_quadrature(fiat_el, degree)
pts, wts = Q.get_points(), Q.get_weights()
return pts, wts

def cell_attachment(self, dst):
if not isinstance(dst, int):
Expand All @@ -803,7 +803,7 @@ def cell_attachment(self, dst):

def orient(self, o):
""" Orientation node is always labelled with -1 """
#if self.oriented:
# if self.oriented:
# o = self.oriented * o
oriented_point = copy.deepcopy(self)
top_level_node = oriented_point.d_entities_ids(
Expand Down Expand Up @@ -1103,7 +1103,7 @@ def __init__(self, cell, name=None):
super(CellComplexToUFL, self).__init__(name)

def to_fiat(self):
return self.cell_complex.to_fiat(name=self.cellname())
return self.cell_complex.to_fiat(name=self.cellname)

def __repr__(self):
return super(CellComplexToUFL, self).__repr__()
Expand Down
Loading