Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing docstrings, remove pydocstyle skips #667

Merged
merged 6 commits into from
Feb 7, 2024
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
11 changes: 7 additions & 4 deletions demo/BiharmonicHHJ.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Copyright (C) 2016 Lizao Li
#
# The bilinear form a(u, v) and linear form L(v) for
# Biharmonic equation in Hellan-Herrmann-Johnson (HHJ)
# formulation.
"""Biharmonis HHJ demo.

The bilinear form a(u, v) and linear form L(v) for Biharmonic equation
in Hellan-Herrmann-Johnson (HHJ) formulation.
"""

import basix.ufl
from ufl import (Coefficient, FacetNormal, FunctionSpace, Mesh, TestFunctions,
TrialFunctions, dot, dS, ds, dx, grad, inner, jump)
Expand All @@ -20,6 +22,7 @@


def b(sigma, v):
"""The form b."""
n = FacetNormal(domain)
return inner(sigma, grad(grad(v))) * dx \
- dot(dot(sigma('+'), n('+')), n('+')) * jump(grad(v), n) * dS \
Expand Down
9 changes: 6 additions & 3 deletions demo/BiharmonicRegge.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Copyright (C) 2016 Lizao Li
#
# The bilinear form a(u, v) and linear form L(v) for
# Biharmonic equation in Regge formulation.
"""Biharmonic Regge demo.

The bilinear form a(u, v) and linear form L(v) for Biharmonic equation in Regge formulation.
"""
import basix.ufl
from ufl import (Coefficient, FacetNormal, FunctionSpace, Identity, Mesh,
TestFunctions, TrialFunctions, dot, dS, ds, dx, grad, inner,
Expand All @@ -20,10 +21,12 @@


def S(mu):
"""The form S."""
return mu - Identity(3) * tr(mu)


def b(mu, v):
"""The form b."""
n = FacetNormal(domain)
return inner(S(mu), grad(grad(v))) * dx \
- dot(dot(S(mu('+')), n('+')), n('+')) * jump(grad(v), n) * dS \
Expand Down
7 changes: 5 additions & 2 deletions demo/CellGeometry.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Copyright (C) 2013 Martin S. Alnaes
#
# A functional M involving a bunch of cell geometry quantities.
"""Cell geometry demo.

A functional M involving a bunch of cell geometry quantities.
"""

import basix.ufl
from ufl import (CellVolume, Circumradius, Coefficient, FacetArea, FacetNormal,
FunctionSpace, Mesh, SpatialCoordinate, TrialFunction, ds, dx)
Expand Down
9 changes: 6 additions & 3 deletions demo/ComplexPoisson.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
#
# The bilinear form a(u, v) and linear form L(v) for
# Poisson's equation using bilinear elements on bilinear mesh geometry.
"""Complex Poisson demo.

The bilinear form a(u, v) and linear form L(v) for
Poisson's equation using bilinear elements on bilinear mesh geometry.
"""

import basix.ufl
from ufl import (Coefficient, FunctionSpace, Mesh, TestFunction, TrialFunction,
dx, grad, inner)
Expand Down
7 changes: 5 additions & 2 deletions demo/Components.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
#
# This example demonstrates how to create vectors component-wise
"""Components demo.

This example demonstrates how to create vectors component-wise.
"""

import basix.ufl
from ufl import (Coefficient, FunctionSpace, Mesh, TestFunction, as_vector, dx,
inner)
Expand Down
7 changes: 5 additions & 2 deletions demo/Conditional.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
#
# Illustration on how to use Conditional to define a source term
"""Conditional demo.

Illustration on how to use Conditional to define a source term.
"""

import basix.ufl
from ufl import (And, Constant, FunctionSpace, Mesh, Not, Or,
SpatialCoordinate, TestFunction, conditional, dx, ge, gt,
Expand Down
8 changes: 5 additions & 3 deletions demo/ExpressionInterpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFC. If not, see <http://www.gnu.org/licenses/>.
#
# Defines an Expression which evaluates the several different functions at
# a set of interpolation points
"""Expression interpolation demo.

Defines an Expression which evaluates the several different functions at
a set of interpolation points.
"""

import basix
import basix.ufl
Expand Down
10 changes: 5 additions & 5 deletions demo/FacetIntegrals.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
#
# First added: 2009-03-20
# Last changed: 2011-03-08
#
# Simple example of a form defined over exterior and interior facets.
"""Facet integrals demo.

Simple example of a form defined over exterior and interior facets.
"""

import basix.ufl
from ufl import (FacetNormal, FunctionSpace, Mesh, TestFunction, TrialFunction,
avg, ds, dS, grad, inner, jump)
Expand Down
4 changes: 3 additions & 1 deletion demo/FacetRestrictionAD.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
"""Facet restriction demo."""

import basix.ufl
from ufl import (Coefficient, FunctionSpace, Mesh, TestFunction, TrialFunction,
avg, derivative, dot, dS, dx, grad, inner)
avg, derivative, dS, dx, grad, inner)

element = basix.ufl.element("Discontinuous Lagrange", "triangle", 1)
domain = Mesh(basix.ufl.element("Lagrange", "triangle", 1, shape=(2, )))
Expand Down
7 changes: 3 additions & 4 deletions demo/HyperElasticity.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#
# Author: Martin Sandve Alnes
# Date: 2008-12-22
#
# Modified by Garth N. Wells, 2009
"""Hyper-elasticity demo."""

import basix.ufl
# Modified by Garth N. Wells, 2009
from ufl import (Coefficient, Constant, FacetNormal, FunctionSpace, Identity,
Mesh, SpatialCoordinate, TestFunction, TrialFunction,
derivative, det, diff, dot, ds, dx, exp, grad, inner, inv,
derivative, det, diff, ds, dx, exp, grad, inner, inv,
tetrahedron, tr, variable)

# Cell and its properties
Expand Down
3 changes: 1 addition & 2 deletions demo/MassAction.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
# This file is part of FFCx. (https://www.fenicsproject.org)
#
# SPDX-License-Identifier: LGPL-3.0-or-later

import numpy as np
"""Mass action demo."""

import basix
import ufl
Expand Down
7 changes: 5 additions & 2 deletions demo/MassDG0.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
#
# The bilinear form for a mass matrix.
"""DG mass matrix demo.

The bilinear form for a mass matrix.
"""

import basix.ufl
from ufl import FunctionSpace, Mesh, TestFunction, TrialFunction, dx, inner

Expand Down
1 change: 1 addition & 0 deletions demo/MassHcurl_2D_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
"""H(curl) mass matrix demo."""
import basix.ufl
from ufl import FunctionSpace, Mesh, TestFunction, TrialFunction, dx, inner

Expand Down
2 changes: 2 additions & 0 deletions demo/MassHdiv_2D_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
"""H(div) mass matrix demo."""

import basix.ufl
from ufl import FunctionSpace, Mesh, TestFunction, TrialFunction, dx, inner

Expand Down
7 changes: 5 additions & 2 deletions demo/MathFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
#
# Test all algebra operators on Coefficients.
"""Math function demo.

Test all algebra operators on Coefficients.
"""

import basix.ufl
from ufl import (Coefficient, FunctionSpace, Mesh, acos, asin, atan, bessel_J,
bessel_Y, cos, dx, erf, exp, ln, sin, sqrt, tan)
Expand Down
7 changes: 5 additions & 2 deletions demo/MetaData.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
#
# Test form for metadata.
"""Metadata demo.

Test form for metadata.
"""

import basix.ufl
from ufl import (Coefficient, Constant, FunctionSpace, Mesh, TestFunction,
TrialFunction, dx, grad, inner)
Expand Down
13 changes: 8 additions & 5 deletions demo/Mini.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
#
# Illustration of vector sum of elements (EnrichedElement): The
# bilinear form a(u, v) for the Stokes equations using a mixed
# formulation involving the Mini element. The velocity element is
# composed of a P1 element augmented by the cubic bubble function.
"""Mini element demo.

Illustration of vector sum of elements (EnrichedElement): The
bilinear form a(u, v) for the Stokes equations using a mixed
formulation involving the Mini element. The velocity element is
composed of a P1 element augmented by the cubic bubble function.
"""

import basix.ufl
from ufl import (FunctionSpace, Mesh, TestFunctions, TrialFunctions, div, dx,
grad, inner)
Expand Down
4 changes: 2 additions & 2 deletions demo/MixedCoefficient.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
#
# Mixed coefficient.
"""Mixed coefficient demo."""

import basix.ufl
from ufl import Coefficients, FunctionSpace, Mesh, dot, dS, dx

Expand Down
2 changes: 2 additions & 0 deletions demo/MixedGradient.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Mixed gradient demo."""

import basix.ufl
from ufl import (FunctionSpace, Mesh, TestFunctions, TrialFunctions, ds, grad,
inner)
Expand Down
12 changes: 6 additions & 6 deletions demo/MixedPoissonDual.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with DOLFINx. If not, see <http://www.gnu.org/licenses/>.
#
# First added: 2014-01-29
# Last changed: 2014-01-29
#
# The bilinear form a(u, v) and linear form L(v) for a two-field
# (mixed) formulation of Poisson's equation
"""Mixed Poisson dual demo.

The bilinear form a(u, v) and linear form L(v) for a two-field
(mixed) formulation of Poisson's equation.
"""

import basix.ufl
from ufl import (Coefficient, FunctionSpace, Mesh, TestFunctions,
TrialFunctions, ds, dx, grad, inner)
Expand Down
9 changes: 6 additions & 3 deletions demo/Normals.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
#
# This example demonstrates how to use the facet normals
# Merely project the normal onto a vector section.
"""Normals demo.

This example demonstrates how to use the facet normals
Merely project the normal onto a vector section.
"""

import basix.ufl
from ufl import (FacetNormal, FunctionSpace, Mesh, TestFunction, TrialFunction,
ds, inner, triangle)
Expand Down
8 changes: 5 additions & 3 deletions demo/Poisson1D.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
#
# The bilinear form a(u, v) and linear form L(v) for
# Poisson's equation.
"""1D Poisson demo.

The bilinear form a(u, v) and linear form L(v) for Poisson's equation.
"""

import basix.ufl
from ufl import (Coefficient, FunctionSpace, Mesh, TestFunction, TrialFunction,
dx, grad, inner)
Expand Down
9 changes: 6 additions & 3 deletions demo/PoissonQuad.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
#
# The bilinear form a(u, v) and linear form L(v) for
# Poisson's equation using bilinear elements on bilinear mesh geometry.
"""Quadrilateral Poisson demo.

The bilinear form a(u, v) and linear form L(v) for
Poisson's equation using bilinear elements on bilinear mesh geometry.
"""

import basix.ufl
from ufl import (Coefficient, FunctionSpace, Mesh, TestFunction, TrialFunction,
dx, grad, inner)
Expand Down
9 changes: 6 additions & 3 deletions demo/ProjectionManifold.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
#
# This demo illustrates use of finite element spaces defined over
# simplicies embedded in higher dimensions
"""Projection manifold demo.

This demo illustrates use of finite element spaces defined over
simplicies embedded in higher dimensions.
"""

import basix.ufl
from ufl import (FunctionSpace, Mesh, TestFunctions, TrialFunctions, div, dx,
inner)
Expand Down
9 changes: 6 additions & 3 deletions demo/ReactionDiffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
#
# The bilinear form a(u, v) and linear form L(v) for a simple
# reaction-diffusion equation using simplified tuple notation.
"""Reaction-diffusion demo.

The bilinear form a(u, v) and linear form L(v) for a simple
reaction-diffusion equation using simplified tuple notation.
"""

import basix.ufl
from ufl import (Coefficient, FunctionSpace, Mesh, TestFunction, TrialFunction,
dx, grad, inner)
Expand Down
10 changes: 6 additions & 4 deletions demo/SpatialCoordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
#
# The bilinear form a(u, v) and linear form L(v) for
# Poisson's equation where spatial coordinates are used to define the source
# and boundary flux terms.
"""Spatial coordinates demo.

The bilinear form a(u, v) and linear form L(v) for Poisson's equation where
spatial coordinates are used to define the source and boundary flux terms.
"""

import basix.ufl
from ufl import (FunctionSpace, Mesh, SpatialCoordinate, TestFunction,
TrialFunction, ds, dx, exp, grad, inner, sin)
Expand Down
Loading