Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisrichardson committed Apr 25, 2022
2 parents 1d7ff21 + 2ad4ef1 commit 6d68bdd
Show file tree
Hide file tree
Showing 73 changed files with 796 additions and 436 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build wheels

# By default this action does not push to test or production PyPI. The wheels
# are available as an artifact that can be downloaded and tested locally.

on:
workflow_dispatch:
inputs:
ufl_ref:
description: "UFL git ref to checkout"
default: "main"
type: string
test_pypi_publish:
description: "Publish to Test PyPi (true | false)"
default: false
type: boolean
pypi_publish:
description: "Publish to PyPi (true | false)"
default: false
type: boolean

workflow_call:
inputs:
ufl_ref:
description: "UFL git ref to checkout"
default: "main"
type: string
test_pypi_publish:
description: "Publish to Test PyPi (true | false)"
default: false
type: boolean
pypi_publish:
description: "Publish to PyPi (true | false))"
default: false
type: boolean

jobs:
build:
name: Build wheels and source distributions
runs-on: ubuntu-latest
steps:
- name: Checkout UFL
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.ufl_ref }}

- name: Upgrade pip and setuptools
run: python -m pip install setuptools pip build --upgrade

- name: Build sdist and wheel
run: python -m build .

- uses: actions/upload-artifact@v2
with:
path: dist/*

upload_pypi:
name: Upload to PyPI (optional)
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist

- uses: pypa/[email protected]
if: ${{ github.event.inputs.test_pypi_publish }}
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
repository_url: https://pypi.org/legacy/

- uses: pypa/[email protected]
if: ${{ github.event.inputs.pypi_publish }}
with:
user: __token__
password: ${{ secrets.PYPI_TEST_TOKEN }}
repository_url: https://test.pypi.org/legacy/
93 changes: 93 additions & 0 deletions .github/workflows/fenicsx-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# This workflow will install Basix, FFCx, DOLFINx and run the DOLFINx and FFCx unit tests.

name: FEniCSx integration

on:
pull_request:
branches:
- main

jobs:
ffcx-tests:
name: Run FFCx tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install test dependencies
run: |
sudo apt-get install -y graphviz libgraphviz-dev ninja-build pkg-config
- name: Install UFL
run: |
pip3 install .
- name: Install Basix
run: |
python3 -m pip install git+https://github.com/FEniCS/basix.git
- name: Clone FFCx
uses: actions/checkout@v2
with:
path: ./ffcx
repository: FEniCS/ffcx
ref: main
- name: Install FFCx
run: |
cd ffcx
pip install .[ci]
- name: Run FFCx unit tests
run: python3 -m pytest -n auto ffcx/test

dolfinx-tests:
name: Run DOLFINx tests
runs-on: ubuntu-latest
container: fenicsproject/test-env:latest-openmpi

env:
CC: clang
CXX: clang++

PETSC_ARCH: linux-gnu-complex-32
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
OMPI_MCA_rmaps_base_oversubscribe: 1
OMPI_MCA_plm: isolated
OMPI_MCA_btl_vader_single_copy_mechanism: none
OMPI_MCA_mpi_yield_when_idle: 1
OMPI_MCA_hwloc_base_binding_policy: none

steps:
- uses: actions/checkout@v2
- name: Install dependencies (Python)
run: |
python3 -m pip install --upgrade pip
- name: Install UFL
run: |
pip3 install .
- 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
- name: Clone DOLFINx
uses: actions/checkout@v2
with:
path: ./dolfinx
repository: FEniCS/dolfinx
ref: main
- name: Install DOLFINx
run: |
cmake -G Ninja -DCMAKE_BUILD_TYPE=Developer -B build -S dolfinx/cpp/
cmake --build build
cmake --install build
pip3 -v install --global-option build --global-option --debug dolfinx/python/
- name: Run DOLFINx unit tests
run: python3 -m pytest -n auto dolfinx/python/test/unit
11 changes: 5 additions & 6 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.7, 3.8, 3.9]
python-version: ['3.7', '3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v2
Expand All @@ -22,18 +22,17 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Lint with flake8
run: |
pip install flake8
python -m pip install flake8
flake8 --statistics .
- name: Check documentation style
run: |
pip install pydocstyle
python -m pip install pydocstyle
python -m pydocstyle .
- name: Install UFL
run: pip install .
run: python -m pip install .[ci]
- name: Run unit tests
run: |
pip install coveralls coverage pytest pytest-cov pytest-xdist
pytest -n auto --cov=ufl/ --junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml test/
python -m pytest -n auto --cov=ufl/ --junitxml=junit/test-results-${{ matrix.os }}-${{ matrix.python-version }}.xml test/
- name: Upload to Coveralls
if: ${{ github.repository == 'FEniCS/ufl' && github.head_ref == '' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8' }}
env:
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include AUTHORS
include COPYING
include COPYING.LESSER
include ChangeLog
include ChangeLog.rst
recursive-include demo *
recursive-include doc *
recursive-include test *
Expand Down
7 changes: 4 additions & 3 deletions demo/Constant.ufl → demo/Constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
# Modified by Martin Sandve Alnes, 2009
#
# Test form for scalar and vector constants.
from ufl import (Coefficient, Constant, FiniteElement, TestFunction,
TrialFunction, VectorConstant, dot, dx, grad, inner, triangle)

cell = triangle
element = FiniteElement("Lagrange", cell, 1)
Expand All @@ -29,6 +31,5 @@
c = Constant(cell)
d = VectorConstant(cell)

a = c*dot(grad(v), grad(u))*dx
L = inner(d, grad(v))*dx

a = c * dot(grad(v), grad(u)) * dx
L = inner(d, grad(v)) * dx
3 changes: 2 additions & 1 deletion demo/ConvectionJacobi.ufl → demo/ConvectionJacobi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Author: Martin Sandve Alnes
# Date: 2008-10-03
#
from ufl import (Coefficient, TestFunction, TrialFunction, VectorElement, dot,
dx, grad, triangle)

element = VectorElement("Lagrange", triangle, 1)

Expand All @@ -10,4 +12,3 @@
w = Coefficient(element)

a = dot(dot(u, grad(w)) + dot(w, grad(u)), v) * dx

14 changes: 14 additions & 0 deletions demo/ConvectionJacobi2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# Author: Martin Sandve Alnes
# Date: 2008-10-03
#
from ufl import (Coefficient, TestFunction, TrialFunction, VectorElement, dx,
i, j, triangle)

element = VectorElement("Lagrange", triangle, 1)

u = TrialFunction(element)
v = TestFunction(element)
w = Coefficient(element)

a = (u[j] * w[i].dx(j) + w[j] * u[i].dx(j)) * v[i] * dx
6 changes: 3 additions & 3 deletions demo/ConvectionJacobi2.ufl → demo/ConvectionVector.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# Author: Martin Sandve Alnes
# Date: 2008-10-03
#
from ufl import (Coefficient, TestFunction, VectorElement, dot, dx, grad,
triangle)

element = VectorElement("Lagrange", triangle, 1)

u = TrialFunction(element)
v = TestFunction(element)
w = Coefficient(element)

a = (u[j]*w[i].dx(j) + w[j]*u[i].dx(j)) * v[i] * dx

a = dot(dot(w, grad(w)), v) * dx
12 changes: 0 additions & 12 deletions demo/ConvectionVector.ufl

This file was deleted.

12 changes: 8 additions & 4 deletions demo/Elasticity.ufl → demo/Elasticity.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
# Modified by: Martin Sandve Alnes
# Date: 2009-01-12
#
from ufl import (TestFunction, TrialFunction, VectorElement, dx, grad, inner,
tetrahedron)

element = VectorElement("Lagrange", tetrahedron, 1)

v = TestFunction(element)
u = TrialFunction(element)



def epsilon(v):
Dv = grad(v)
return 0.5*(Dv + Dv.T)
return 0.5 * (Dv + Dv.T)


a = inner(epsilon(v), epsilon(u))*dx
a = inner(epsilon(v), epsilon(u)) * dx
4 changes: 2 additions & 2 deletions demo/EnergyNorm.ufl → demo/EnergyNorm.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#
# This example demonstrates how to define a functional, here
# the energy norm (squared) for a reaction-diffusion problem.
from ufl import Coefficient, FiniteElement, dot, dx, grad, tetrahedron

element = FiniteElement("Lagrange", tetrahedron, 1)

v = Coefficient(element)
a = (v*v + dot(grad(v), grad(v)))*dx

a = (v * v + dot(grad(v), grad(v))) * dx
5 changes: 3 additions & 2 deletions demo/Equation.ufl → demo/Equation.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
# the unknown u to the right-hand side, all terms may
# be listed on one line and left- and right-hand sides
# extracted by lhs() and rhs().
from ufl import (Coefficient, FiniteElement, TestFunction, TrialFunction, dot,
dx, grad, lhs, rhs, triangle)

element = FiniteElement("Lagrange", triangle, 1)

Expand All @@ -43,8 +45,7 @@
u = TrialFunction(element)
u0 = Coefficient(element)

F = v*(u - u0)*dx + k*dot(grad(v), grad(0.5*(u0 + u)))*dx
F = v * (u - u0) * dx + k * dot(grad(v), grad(0.5 * (u0 + u))) * dx

a = lhs(F)
L = rhs(F)

5 changes: 3 additions & 2 deletions demo/ExplicitConvection.ufl → demo/ExplicitConvection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
# Author: Martin Sandve Alnes
# Date: 2008-10-03
#
from ufl import (Coefficient, TestFunction, TrialFunction, VectorElement, dot,
dx, grad, triangle)

element = VectorElement("Lagrange", triangle, 1)

u = TrialFunction(element)
v = TestFunction(element)
w = Coefficient(element)

a = dot( dot(w, grad(u)), v ) * dx

a = dot(dot(w, grad(u)), v) * dx
Loading

0 comments on commit 6d68bdd

Please sign in to comment.