Skip to content

Commit

Permalink
Use isort on all python files
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgensd committed Dec 5, 2023
1 parent 1d3e4c8 commit 93d32e6
Show file tree
Hide file tree
Showing 44 changed files with 165 additions and 112 deletions.
9 changes: 5 additions & 4 deletions python/benchmarks/bench_contact_3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
from pathlib import Path

from mpi4py import MPI
from petsc4py import PETSc

import basix.ufl
import numpy as np
from basix.ufl import element
Expand All @@ -24,15 +27,13 @@
from dolfinx.mesh import (CellType, compute_midpoints, create_mesh,
create_unit_cube, locate_entities_boundary, meshtags,
refine)
from dolfinx_mpc.utils import (create_normal_approximation, log_info,
rigid_motions_nullspace, rotation_matrix)
from mpi4py import MPI
from petsc4py import PETSc
from ufl import (Identity, Mesh, TestFunction, TrialFunction, dx, grad, inner,
sym, tr)

from dolfinx_mpc import (MultiPointConstraint, apply_lifting, assemble_matrix,
assemble_vector)
from dolfinx_mpc.utils import (create_normal_approximation, log_info,
rigid_motions_nullspace, rotation_matrix)

comm = MPI.COMM_WORLD

Expand Down
7 changes: 4 additions & 3 deletions python/benchmarks/bench_elasticity.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@
from pathlib import Path
from typing import Optional

from mpi4py import MPI
from petsc4py import PETSc

import basix.ufl
import h5py
import numpy as np
from dolfinx.common import Timer, TimingType, list_timings
from dolfinx.fem import (Constant, Function, functionspace, dirichletbc, form,
from dolfinx.fem import (Constant, Function, dirichletbc, form, functionspace,
locate_dofs_topological, set_bc)
from dolfinx.io import XDMFFile
from dolfinx.mesh import (create_unit_cube, locate_entities_boundary, meshtags,
refine)
from mpi4py import MPI
from petsc4py import PETSc
from ufl import (Identity, TestFunction, TrialFunction, ds, dx, grad, inner,
sym, tr)

Expand Down
7 changes: 4 additions & 3 deletions python/benchmarks/bench_elasticity_edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
from pathlib import Path

from mpi4py import MPI
from petsc4py import PETSc

import basix.ufl
import h5py
import numpy as np
from dolfinx import default_scalar_type
from dolfinx.common import Timer, TimingType, list_timings
from dolfinx.fem import (Constant, Function, functionspace, dirichletbc, form,
from dolfinx.fem import (Constant, Function, dirichletbc, form, functionspace,
locate_dofs_topological)
from dolfinx.fem.petsc import set_bc
from dolfinx.io import XDMFFile
from dolfinx.mesh import (CellType, create_unit_cube, locate_entities_boundary,
meshtags)
from mpi4py import MPI
from petsc4py import PETSc
from ufl import (Identity, SpatialCoordinate, TestFunction, TrialFunction,
as_vector, ds, dx, grad, inner, sym, tr)

Expand Down
5 changes: 3 additions & 2 deletions python/benchmarks/bench_periodic.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
from pathlib import Path

from mpi4py import MPI
from petsc4py import PETSc

import h5py
import numpy as np
from dolfinx import default_scalar_type
Expand All @@ -25,8 +28,6 @@
from dolfinx.io import XDMFFile
from dolfinx.mesh import (CellType, create_unit_cube, locate_entities_boundary,
meshtags)
from mpi4py import MPI
from petsc4py import PETSc
from ufl import (SpatialCoordinate, TestFunction, TrialFunction, dx, exp, grad,
inner, pi, sin)

Expand Down
2 changes: 1 addition & 1 deletion python/benchmarks/post_proc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import numpy as np
import matplotlib.pyplot as plt
import numpy as np

# Res 0.1 31776, 0.05 234546, 0.025 1801086, 0.02 3488856, 0.0175 5147961,0.015 7960200
dofs = [31776, 234546, 1801086, 3488856, 5147961, 7960200]
Expand Down
5 changes: 3 additions & 2 deletions python/benchmarks/ref_elasticity.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
from time import perf_counter
from typing import Optional

from mpi4py import MPI
from petsc4py import PETSc

import basix.ufl
import h5py
import numpy as np
Expand All @@ -24,8 +27,6 @@
from dolfinx.log import LogLevel, log, set_log_level
from dolfinx.mesh import (CellType, create_unit_cube, locate_entities_boundary,
meshtags, refine)
from mpi4py import MPI
from petsc4py import PETSc
from ufl import (Identity, SpatialCoordinate, TestFunction, TrialFunction,
as_vector, ds, dx, grad, inner, sym, tr)

Expand Down
7 changes: 4 additions & 3 deletions python/benchmarks/ref_periodic.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,20 @@
from time import perf_counter
from typing import Optional

from mpi4py import MPI
from petsc4py import PETSc

import h5py
import numpy as np
from dolfinx import default_scalar_type
from dolfinx.common import Timer, TimingType, list_timings
from dolfinx.fem import (Function, functionspace, dirichletbc, form,
from dolfinx.fem import (Function, dirichletbc, form, functionspace,
locate_dofs_geometrical)
from dolfinx.fem.petsc import (apply_lifting, assemble_matrix, assemble_vector,
set_bc)
from dolfinx.io import XDMFFile
from dolfinx.log import LogLevel, log, set_log_level
from dolfinx.mesh import CellType, create_unit_cube, refine
from mpi4py import MPI
from petsc4py import PETSc
from ufl import (SpatialCoordinate, TestFunction, TrialFunction, dx, exp, grad,
inner, pi, sin)

Expand Down
12 changes: 7 additions & 5 deletions python/benchmarks/visualize_iterations.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
from __future__ import annotations

import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator, LogLocator, NullFormatter
import matplotlib.transforms as mtransforms
import h5py
import mpi4py
import argparse
import sys

import mpi4py

import h5py
import matplotlib.pyplot as plt
import matplotlib.transforms as mtransforms
import numpy as np
from matplotlib.ticker import LogLocator, MaxNLocator, NullFormatter


def visualize_elasticity():
Expand Down
6 changes: 4 additions & 2 deletions python/demos/create_and_export_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@
from pathlib import Path
from typing import Dict, List, Sequence, Tuple, Union

from mpi4py import MPI

import dolfinx.common as _common
import dolfinx.cpp as _cpp
import dolfinx.io as _io
import dolfinx.mesh as _mesh
import dolfinx_mpc.utils as _utils
import gmsh
import numpy as np
import ufl
from basix.ufl import element
from dolfinx.io import gmshio
from mpi4py import MPI

import dolfinx_mpc.utils as _utils


def gmsh_3D_stacked(celltype: str, theta: float, res: float = 0.1,
Expand Down
9 changes: 5 additions & 4 deletions python/demos/demo_contact_2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
from pathlib import Path

from mpi4py import MPI
from petsc4py import PETSc

import numpy as np
import scipy.sparse.linalg
from create_and_export_mesh import gmsh_2D_stacked, mesh_2D_dolfin
from dolfinx import default_scalar_type, default_real_type
from dolfinx import default_real_type, default_scalar_type
from dolfinx.common import Timer, TimingType, list_timings
from dolfinx.fem import (Constant, dirichletbc, form, functionspace,
locate_dofs_geometrical)
Expand All @@ -29,11 +31,10 @@
from dolfinx.io import XDMFFile
from dolfinx.log import LogLevel, set_log_level
from dolfinx.mesh import locate_entities_boundary, meshtags
from mpi4py import MPI
from petsc4py import PETSc
from ufl import (Identity, Measure, TestFunction, TrialFunction, dx, grad,
inner, sym, tr)

from create_and_export_mesh import gmsh_2D_stacked, mesh_2D_dolfin
from dolfinx_mpc import LinearProblem, MultiPointConstraint
from dolfinx_mpc.utils import (compare_mpc_lhs, compare_mpc_rhs,
create_normal_approximation,
Expand Down
7 changes: 4 additions & 3 deletions python/demos/demo_contact_3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
from pathlib import Path

from mpi4py import MPI
from petsc4py import PETSc

import dolfinx.fem as fem
import numpy as np
import scipy.sparse.linalg
from create_and_export_mesh import gmsh_3D_stacked, mesh_3D_dolfin
from dolfinx import default_real_type, default_scalar_type
from dolfinx.common import Timer, TimingType, list_timings
from dolfinx.io import XDMFFile
from dolfinx.mesh import CellType
from mpi4py import MPI
from petsc4py import PETSc
from ufl import Identity, TestFunction, TrialFunction, dx, grad, inner, sym, tr

from create_and_export_mesh import gmsh_3D_stacked, mesh_3D_dolfin
from dolfinx_mpc import (MultiPointConstraint, apply_lifting, assemble_matrix,
assemble_vector)
from dolfinx_mpc.utils import (compare_mpc_lhs, compare_mpc_rhs,
Expand Down
5 changes: 3 additions & 2 deletions python/demos/demo_elasticity.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@

from pathlib import Path

from mpi4py import MPI
from petsc4py import PETSc

import dolfinx.fem as fem
import numpy as np
import scipy.sparse.linalg
from dolfinx import default_scalar_type
from dolfinx.common import Timer
from dolfinx.io import XDMFFile
from dolfinx.mesh import create_unit_square, locate_entities_boundary
from mpi4py import MPI
from petsc4py import PETSc
from ufl import (Identity, SpatialCoordinate, TestFunction, TrialFunction,
as_vector, dx, grad, inner, sym, tr)

Expand Down
3 changes: 2 additions & 1 deletion python/demos/demo_elasticity_disconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@

from pathlib import Path

from mpi4py import MPI

import basix.ufl
import gmsh
import numpy as np
from dolfinx import default_scalar_type
from dolfinx.fem import (Constant, Function, dirichletbc, functionspace,
locate_dofs_topological)
from dolfinx.io import XDMFFile, gmshio
from mpi4py import MPI
from ufl import (Identity, Measure, SpatialCoordinate, TestFunction,
TrialFunction, as_vector, grad, inner, sym, tr)

Expand Down
3 changes: 2 additions & 1 deletion python/demos/demo_elasticity_disconnect_2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

from pathlib import Path

from mpi4py import MPI

import gmsh
import numpy as np
from dolfinx import default_scalar_type
Expand All @@ -17,7 +19,6 @@
locate_dofs_topological)
from dolfinx.io import XDMFFile, gmshio
from dolfinx.mesh import locate_entities_boundary
from mpi4py import MPI
from ufl import (Identity, Measure, SpatialCoordinate, TestFunction,
TrialFunction, grad, inner, sym, tr)

Expand Down
3 changes: 2 additions & 1 deletion python/demos/demo_periodic3d_topological.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from pathlib import Path
from typing import Dict, Union

from mpi4py import MPI

import dolfinx.fem as fem
import numpy as np
import scipy.sparse.linalg
Expand All @@ -27,7 +29,6 @@
from dolfinx.io import VTXWriter
from dolfinx.mesh import (CellType, create_unit_cube, locate_entities_boundary,
meshtags)
from mpi4py import MPI
from numpy.typing import NDArray
from ufl import (SpatialCoordinate, TestFunction, TrialFunction, as_vector, dx,
exp, grad, inner, pi, sin)
Expand Down
5 changes: 3 additions & 2 deletions python/demos/demo_periodic_geometrical.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@
from pathlib import Path
from typing import Union

from mpi4py import MPI
from petsc4py import PETSc

import dolfinx.fem as fem
import numpy as np
import scipy.sparse.linalg
from dolfinx import default_scalar_type
from dolfinx.common import Timer, TimingType, list_timings
from dolfinx.io import XDMFFile
from dolfinx.mesh import create_unit_square, locate_entities_boundary
from mpi4py import MPI
from petsc4py import PETSc
from ufl import (SpatialCoordinate, TestFunction, TrialFunction, as_vector, dx,
exp, grad, inner, pi, sin)

Expand Down
5 changes: 3 additions & 2 deletions python/demos/demo_periodic_gep.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@
from pathlib import Path
from typing import List, Tuple

from mpi4py import MPI
from petsc4py import PETSc

import dolfinx.fem as fem
import numpy as np
from dolfinx import default_scalar_type
from dolfinx.io import XDMFFile
from dolfinx.mesh import create_unit_square, locate_entities_boundary, meshtags
from mpi4py import MPI
from petsc4py import PETSc
from slepc4py import SLEPc
from ufl import TestFunction, TrialFunction, dx, grad, inner

Expand Down
8 changes: 5 additions & 3 deletions python/demos/demo_stokes.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,23 @@
from pathlib import Path
from typing import Union

from mpi4py import MPI
from petsc4py import PETSc

import basix.ufl
import dolfinx_mpc.utils
import gmsh
import numpy as np
import scipy.sparse.linalg
from dolfinx import common, default_scalar_type, fem, io
from dolfinx.io import gmshio
from mpi4py import MPI
from numpy.typing import NDArray
from petsc4py import PETSc
from ufl import (FacetNormal, Identity, Measure, TestFunctions, TrialFunctions,
div, dot, dx, grad, inner, outer, sym)
from ufl.core.expr import Expr

import dolfinx_mpc.utils
from dolfinx_mpc import LinearProblem, MultiPointConstraint

# -
# ## Mesh generation
#
Expand Down
5 changes: 3 additions & 2 deletions python/demos/demo_stokes_nest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

from pathlib import Path

from mpi4py import MPI
from petsc4py import PETSc

import basix
import dolfinx.io
import gmsh
Expand All @@ -21,8 +24,6 @@
import ufl
from dolfinx import default_scalar_type
from dolfinx.io import gmshio
from mpi4py import MPI
from petsc4py import PETSc
from ufl.core.expr import Expr

import dolfinx_mpc
Expand Down
Loading

0 comments on commit 93d32e6

Please sign in to comment.