Skip to content

Commit 34af2ec

Browse files
authored
Add missing docstrings, remove pydocstyle skips (#667)
* docs in codegeneration * docstrings * docstyle * flake * docs in demos * doc
1 parent c080573 commit 34af2ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+632
-373
lines changed

demo/BiharmonicHHJ.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Copyright (C) 2016 Lizao Li
2-
#
3-
# The bilinear form a(u, v) and linear form L(v) for
4-
# Biharmonic equation in Hellan-Herrmann-Johnson (HHJ)
5-
# formulation.
2+
"""Biharmonis HHJ demo.
3+
4+
The bilinear form a(u, v) and linear form L(v) for Biharmonic equation
5+
in Hellan-Herrmann-Johnson (HHJ) formulation.
6+
"""
7+
68
import basix.ufl
79
from ufl import (Coefficient, FacetNormal, FunctionSpace, Mesh, TestFunctions,
810
TrialFunctions, dot, dS, ds, dx, grad, inner, jump)
@@ -20,6 +22,7 @@
2022

2123

2224
def b(sigma, v):
25+
"""The form b."""
2326
n = FacetNormal(domain)
2427
return inner(sigma, grad(grad(v))) * dx \
2528
- dot(dot(sigma('+'), n('+')), n('+')) * jump(grad(v), n) * dS \

demo/BiharmonicRegge.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Copyright (C) 2016 Lizao Li
2-
#
3-
# The bilinear form a(u, v) and linear form L(v) for
4-
# Biharmonic equation in Regge formulation.
2+
"""Biharmonic Regge demo.
3+
4+
The bilinear form a(u, v) and linear form L(v) for Biharmonic equation in Regge formulation.
5+
"""
56
import basix.ufl
67
from ufl import (Coefficient, FacetNormal, FunctionSpace, Identity, Mesh,
78
TestFunctions, TrialFunctions, dot, dS, ds, dx, grad, inner,
@@ -20,10 +21,12 @@
2021

2122

2223
def S(mu):
24+
"""The form S."""
2325
return mu - Identity(3) * tr(mu)
2426

2527

2628
def b(mu, v):
29+
"""The form b."""
2730
n = FacetNormal(domain)
2831
return inner(S(mu), grad(grad(v))) * dx \
2932
- dot(dot(S(mu('+')), n('+')), n('+')) * jump(grad(v), n) * dS \

demo/CellGeometry.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Copyright (C) 2013 Martin S. Alnaes
2-
#
3-
# A functional M involving a bunch of cell geometry quantities.
2+
"""Cell geometry demo.
3+
4+
A functional M involving a bunch of cell geometry quantities.
5+
"""
6+
47
import basix.ufl
58
from ufl import (CellVolume, Circumradius, Coefficient, FacetArea, FacetNormal,
69
FunctionSpace, Mesh, SpatialCoordinate, TrialFunction, ds, dx)

demo/ComplexPoisson.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
17-
#
18-
# The bilinear form a(u, v) and linear form L(v) for
19-
# Poisson's equation using bilinear elements on bilinear mesh geometry.
17+
"""Complex Poisson demo.
18+
19+
The bilinear form a(u, v) and linear form L(v) for
20+
Poisson's equation using bilinear elements on bilinear mesh geometry.
21+
"""
22+
2023
import basix.ufl
2124
from ufl import (Coefficient, FunctionSpace, Mesh, TestFunction, TrialFunction,
2225
dx, grad, inner)

demo/Components.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
17-
#
18-
# This example demonstrates how to create vectors component-wise
17+
"""Components demo.
18+
19+
This example demonstrates how to create vectors component-wise.
20+
"""
21+
1922
import basix.ufl
2023
from ufl import (Coefficient, FunctionSpace, Mesh, TestFunction, as_vector, dx,
2124
inner)

demo/Conditional.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
17-
#
18-
# Illustration on how to use Conditional to define a source term
17+
"""Conditional demo.
18+
19+
Illustration on how to use Conditional to define a source term.
20+
"""
21+
1922
import basix.ufl
2023
from ufl import (And, Constant, FunctionSpace, Mesh, Not, Or,
2124
SpatialCoordinate, TestFunction, conditional, dx, ge, gt,

demo/ExpressionInterpolation.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with FFC. If not, see <http://www.gnu.org/licenses/>.
17-
#
18-
# Defines an Expression which evaluates the several different functions at
19-
# a set of interpolation points
17+
"""Expression interpolation demo.
18+
19+
Defines an Expression which evaluates the several different functions at
20+
a set of interpolation points.
21+
"""
2022

2123
import basix
2224
import basix.ufl

demo/FacetIntegrals.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
17-
#
18-
# First added: 2009-03-20
19-
# Last changed: 2011-03-08
20-
#
21-
# Simple example of a form defined over exterior and interior facets.
17+
"""Facet integrals demo.
18+
19+
Simple example of a form defined over exterior and interior facets.
20+
"""
21+
2222
import basix.ufl
2323
from ufl import (FacetNormal, FunctionSpace, Mesh, TestFunction, TrialFunction,
2424
avg, ds, dS, grad, inner, jump)

demo/FacetRestrictionAD.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
17+
"""Facet restriction demo."""
18+
1719
import basix.ufl
1820
from ufl import (Coefficient, FunctionSpace, Mesh, TestFunction, TrialFunction,
19-
avg, derivative, dot, dS, dx, grad, inner)
21+
avg, derivative, dS, dx, grad, inner)
2022

2123
element = basix.ufl.element("Discontinuous Lagrange", "triangle", 1)
2224
domain = Mesh(basix.ufl.element("Lagrange", "triangle", 1, shape=(2, )))

demo/HyperElasticity.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
#
21
# Author: Martin Sandve Alnes
32
# Date: 2008-12-22
4-
#
3+
# Modified by Garth N. Wells, 2009
4+
"""Hyper-elasticity demo."""
55

66
import basix.ufl
7-
# Modified by Garth N. Wells, 2009
87
from ufl import (Coefficient, Constant, FacetNormal, FunctionSpace, Identity,
98
Mesh, SpatialCoordinate, TestFunction, TrialFunction,
10-
derivative, det, diff, dot, ds, dx, exp, grad, inner, inv,
9+
derivative, det, diff, ds, dx, exp, grad, inner, inv,
1110
tetrahedron, tr, variable)
1211

1312
# Cell and its properties

demo/MassAction.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
# This file is part of FFCx. (https://www.fenicsproject.org)
44
#
55
# SPDX-License-Identifier: LGPL-3.0-or-later
6-
7-
import numpy as np
6+
"""Mass action demo."""
87

98
import basix
109
import ufl

demo/MassDG0.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
17-
#
18-
# The bilinear form for a mass matrix.
17+
"""DG mass matrix demo.
18+
19+
The bilinear form for a mass matrix.
20+
"""
21+
1922
import basix.ufl
2023
from ufl import FunctionSpace, Mesh, TestFunction, TrialFunction, dx, inner
2124

demo/MassHcurl_2D_1.py

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
17+
"""H(curl) mass matrix demo."""
1718
import basix.ufl
1819
from ufl import FunctionSpace, Mesh, TestFunction, TrialFunction, dx, inner
1920

demo/MassHdiv_2D_1.py

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
17+
"""H(div) mass matrix demo."""
18+
1719
import basix.ufl
1820
from ufl import FunctionSpace, Mesh, TestFunction, TrialFunction, dx, inner
1921

demo/MathFunctions.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
17-
#
18-
# Test all algebra operators on Coefficients.
17+
"""Math function demo.
18+
19+
Test all algebra operators on Coefficients.
20+
"""
21+
1922
import basix.ufl
2023
from ufl import (Coefficient, FunctionSpace, Mesh, acos, asin, atan, bessel_J,
2124
bessel_Y, cos, dx, erf, exp, ln, sin, sqrt, tan)

demo/MetaData.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
17-
#
18-
# Test form for metadata.
17+
"""Metadata demo.
18+
19+
Test form for metadata.
20+
"""
21+
1922
import basix.ufl
2023
from ufl import (Coefficient, Constant, FunctionSpace, Mesh, TestFunction,
2124
TrialFunction, dx, grad, inner)

demo/Mini.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
17-
#
18-
# Illustration of vector sum of elements (EnrichedElement): The
19-
# bilinear form a(u, v) for the Stokes equations using a mixed
20-
# formulation involving the Mini element. The velocity element is
21-
# composed of a P1 element augmented by the cubic bubble function.
17+
"""Mini element demo.
18+
19+
Illustration of vector sum of elements (EnrichedElement): The
20+
bilinear form a(u, v) for the Stokes equations using a mixed
21+
formulation involving the Mini element. The velocity element is
22+
composed of a P1 element augmented by the cubic bubble function.
23+
"""
24+
2225
import basix.ufl
2326
from ufl import (FunctionSpace, Mesh, TestFunctions, TrialFunctions, div, dx,
2427
grad, inner)

demo/MixedCoefficient.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#
1717
# You should have received a copy of the GNU Lesser General Public License
1818
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
19-
#
20-
# Mixed coefficient.
19+
"""Mixed coefficient demo."""
20+
2121
import basix.ufl
2222
from ufl import Coefficients, FunctionSpace, Mesh, dot, dS, dx
2323

demo/MixedGradient.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Mixed gradient demo."""
2+
13
import basix.ufl
24
from ufl import (FunctionSpace, Mesh, TestFunctions, TrialFunctions, ds, grad,
35
inner)

demo/MixedPoissonDual.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with DOLFINx. If not, see <http://www.gnu.org/licenses/>.
17-
#
18-
# First added: 2014-01-29
19-
# Last changed: 2014-01-29
20-
#
21-
# The bilinear form a(u, v) and linear form L(v) for a two-field
22-
# (mixed) formulation of Poisson's equation
17+
"""Mixed Poisson dual demo.
18+
19+
The bilinear form a(u, v) and linear form L(v) for a two-field
20+
(mixed) formulation of Poisson's equation.
21+
"""
22+
2323
import basix.ufl
2424
from ufl import (Coefficient, FunctionSpace, Mesh, TestFunctions,
2525
TrialFunctions, ds, dx, grad, inner)

demo/Normals.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
17-
#
18-
# This example demonstrates how to use the facet normals
19-
# Merely project the normal onto a vector section.
17+
"""Normals demo.
18+
19+
This example demonstrates how to use the facet normals
20+
Merely project the normal onto a vector section.
21+
"""
22+
2023
import basix.ufl
2124
from ufl import (FacetNormal, FunctionSpace, Mesh, TestFunction, TrialFunction,
2225
ds, inner, triangle)

demo/Poisson1D.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
17-
#
18-
# The bilinear form a(u, v) and linear form L(v) for
19-
# Poisson's equation.
17+
"""1D Poisson demo.
18+
19+
The bilinear form a(u, v) and linear form L(v) for Poisson's equation.
20+
"""
21+
2022
import basix.ufl
2123
from ufl import (Coefficient, FunctionSpace, Mesh, TestFunction, TrialFunction,
2224
dx, grad, inner)

demo/PoissonQuad.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
17-
#
18-
# The bilinear form a(u, v) and linear form L(v) for
19-
# Poisson's equation using bilinear elements on bilinear mesh geometry.
17+
"""Quadrilateral Poisson demo.
18+
19+
The bilinear form a(u, v) and linear form L(v) for
20+
Poisson's equation using bilinear elements on bilinear mesh geometry.
21+
"""
22+
2023
import basix.ufl
2124
from ufl import (Coefficient, FunctionSpace, Mesh, TestFunction, TrialFunction,
2225
dx, grad, inner)

demo/ProjectionManifold.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
17-
#
18-
# This demo illustrates use of finite element spaces defined over
19-
# simplicies embedded in higher dimensions
17+
"""Projection manifold demo.
18+
19+
This demo illustrates use of finite element spaces defined over
20+
simplicies embedded in higher dimensions.
21+
"""
22+
2023
import basix.ufl
2124
from ufl import (FunctionSpace, Mesh, TestFunctions, TrialFunctions, div, dx,
2225
inner)

demo/ReactionDiffusion.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
17-
#
18-
# The bilinear form a(u, v) and linear form L(v) for a simple
19-
# reaction-diffusion equation using simplified tuple notation.
17+
"""Reaction-diffusion demo.
18+
19+
The bilinear form a(u, v) and linear form L(v) for a simple
20+
reaction-diffusion equation using simplified tuple notation.
21+
"""
22+
2023
import basix.ufl
2124
from ufl import (Coefficient, FunctionSpace, Mesh, TestFunction, TrialFunction,
2225
dx, grad, inner)

demo/SpatialCoordinates.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public License
1616
# along with FFCx. If not, see <http://www.gnu.org/licenses/>.
17-
#
18-
# The bilinear form a(u, v) and linear form L(v) for
19-
# Poisson's equation where spatial coordinates are used to define the source
20-
# and boundary flux terms.
17+
"""Spatial coordinates demo.
18+
19+
The bilinear form a(u, v) and linear form L(v) for Poisson's equation where
20+
spatial coordinates are used to define the source and boundary flux terms.
21+
"""
22+
2123
import basix.ufl
2224
from ufl import (FunctionSpace, Mesh, SpatialCoordinate, TestFunction,
2325
TrialFunction, ds, dx, exp, grad, inner, sin)

0 commit comments

Comments
 (0)