Skip to content

Commit

Permalink
Lint. (#3157)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhale committed Apr 22, 2024
1 parent 91d3bee commit 5591004
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 28 deletions.
24 changes: 17 additions & 7 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,15 @@ set_package_properties(
)

if(DOLFINX_ENABLE_PETSC)
set(_REQUIRE_PETSC TRUE CACHE BOOL "Is PETSc REQUIRED?")
set(_REQUIRE_PETSC
TRUE
CACHE BOOL "Is PETSc REQUIRED?"
)
else()
set(_REQUIRE_PETSC FALSE CACHE BOOL "Is PETSc REQUIRED?")
set(_REQUIRE_PETSC
FALSE
CACHE BOOL "Is PETSc REQUIRED?"
)
endif()

option(DOLFINX_ENABLE_PETSC "Compile with support for PETSc." ON)
Expand All @@ -122,7 +128,6 @@ set_package_properties(
PURPOSE "Linear and nonlinear solvers"
)


if(DOLFINX_ENABLE_PARMETIS)
set(_REQUIRE_PARMETIS
TRUE
Expand Down Expand Up @@ -318,7 +323,7 @@ find_package(HDF5 REQUIRED COMPONENTS C)
if(NOT HDF5_IS_PARALLEL)
message(
FATAL_ERROR
"Found serial HDF5 build, MPI HDF5 build required, try setting HDF5_DIR or HDF5_ROOT"
"Found serial HDF5 build, MPI HDF5 build required, try setting HDF5_DIR or HDF5_ROOT"
)
endif()

Expand Down Expand Up @@ -368,7 +373,7 @@ endif()
if(DOLFINX_ENABLE_PETSC)
find_package(PkgConfig REQUIRED)
set(ENV{PKG_CONFIG_PATH}
"$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{PETSC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}"
"$ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib/pkgconfig:$ENV{PETSC_DIR}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}"
)
if(_REQUIRE_PETSC)
pkg_search_module(PETSC REQUIRED IMPORTED_TARGET PETSc>=3.15 petsc>=3.15)
Expand All @@ -378,7 +383,9 @@ if(DOLFINX_ENABLE_PETSC)

# Setting for FeatureSummary
if(PETSC_FOUND)
message(STATUS "Found PETSc version ${PETSC_VERSION}, prefix: ${PETSC_PREFIX}")
message(
STATUS "Found PETSc version ${PETSC_VERSION}, prefix: ${PETSC_PREFIX}"
)
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND PETSc)
else()
set_property(GLOBAL APPEND PROPERTY PACKAGES_NOT_FOUND PETSc)
Expand Down Expand Up @@ -412,7 +419,10 @@ if(DOLFINX_ENABLE_SLEPC AND PETSC_FOUND)
set_property(GLOBAL APPEND PROPERTY PACKAGES_NOT_FOUND SLEPc)
endif()
elseif(_REQUIRE_SLEPC AND NOT PETSC_FOUND)
message(FATAL_ERROR "SLEPc requested, but no configured because PETSc was not found.")
message(
FATAL_ERROR
"SLEPc requested, but no configured because PETSc was not found."
)
endif()

if(DOLFINX_ENABLE_SCOTCH AND _REQUIRE_SCOTCH)
Expand Down
19 changes: 12 additions & 7 deletions cpp/cmake/modules/FindSCOTCH.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ message(STATUS "Checking for package 'SCOTCH-PT'")
# Check for header file
find_path(
SCOTCH_INCLUDE_DIRS ptscotch.h
HINTS ${SCOTCH_DIR}/include $ENV{SCOTCH_DIR}/include
${SCOTCH_ROOT}/include $ENV{SCOTCH_ROOT}/include ${PETSC_INCLUDE_DIRS}
HINTS ${SCOTCH_DIR}/include $ENV{SCOTCH_DIR}/include ${SCOTCH_ROOT}/include
$ENV{SCOTCH_ROOT}/include ${PETSC_INCLUDE_DIRS}
PATH_SUFFIXES scotch
DOC "Directory where the SCOTCH-PT header is located"
)
Expand All @@ -60,7 +60,8 @@ find_path(
find_library(
SCOTCH_LIBRARY
NAMES scotch
HINTS ${SCOTCH_DIR}/lib $ENV{SCOTCH_DIR}/lib ${SCOTCH_ROOT}/lib $ENV{SCOTCH_ROOT}/lib ${PETSC_LIBRARY_DIRS}
HINTS ${SCOTCH_DIR}/lib $ENV{SCOTCH_DIR}/lib ${SCOTCH_ROOT}/lib
$ENV{SCOTCH_ROOT}/lib ${PETSC_LIBRARY_DIRS}
NO_DEFAULT_PATH
DOC "The SCOTCH library"
)
Expand All @@ -74,7 +75,8 @@ find_library(
find_library(
SCOTCHERR_LIBRARY
NAMES scotcherr
HINTS ${SCOTCH_DIR}/lib $ENV{SCOTCH_DIR}/lib ${SCOTCH_ROOT}/lib $ENV{SCOTCH_ROOT}/lib
HINTS ${SCOTCH_DIR}/lib $ENV{SCOTCH_DIR}/lib ${SCOTCH_ROOT}/lib
$ENV{SCOTCH_ROOT}/lib
NO_DEFAULT_PATH
DOC "The SCOTCH-ERROR library"
)
Expand All @@ -88,7 +90,8 @@ find_library(
find_library(
PTSCOTCH_LIBRARY
NAMES ptscotch
HINTS ${SCOTCH_DIR}/lib $ENV{SCOTCH_DIR}/lib ${SCOTCH_ROOT}/lib $ENV{SCOTCH_ROOT}/lib ${PETSC_LIBRARY_DIRS}
HINTS ${SCOTCH_DIR}/lib $ENV{SCOTCH_DIR}/lib ${SCOTCH_ROOT}/lib
$ENV{SCOTCH_ROOT}/lib ${PETSC_LIBRARY_DIRS}
NO_DEFAULT_PATH
DOC "The PTSCOTCH library"
)
Expand All @@ -102,7 +105,8 @@ find_library(
find_library(
PTESMUMPS_LIBRARY
NAMES ptesmumps esmumps
HINTS ${SCOTCH_DIR}/lib $ENV{SCOTCH_DIR}/lib ${SCOTCH_ROOT}/lib $ENV{SCOTCH_ROOT}/lib ${PETSC_LIBRARY_DIRS}
HINTS ${SCOTCH_DIR}/lib $ENV{SCOTCH_DIR}/lib ${SCOTCH_ROOT}/lib
$ENV{SCOTCH_ROOT}/lib ${PETSC_LIBRARY_DIRS}
NO_DEFAULT_PATH
DOC "The PTSCOTCH-ESMUMPS library"
)
Expand All @@ -116,7 +120,8 @@ find_library(
find_library(
PTSCOTCHERR_LIBRARY
NAMES ptscotcherr
HINTS ${SCOTCH_DIR}/lib $ENV{SCOTCH_DIR}/lib ${SCOTCH_ROOT}/lib $ENV{SCOTCH_ROOT}/lib ${PETSC_LIBRARY_DIRS}
HINTS ${SCOTCH_DIR}/lib $ENV{SCOTCH_DIR}/lib ${SCOTCH_ROOT}/lib
$ENV{SCOTCH_ROOT}/lib ${PETSC_LIBRARY_DIRS}
NO_DEFAULT_PATH
DOC "The PTSCOTCH-ERROR library"
)
Expand Down
24 changes: 10 additions & 14 deletions python/dolfinx/wrappers/fem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,8 @@ void declare_function_space(nb::module_& m, std::string type)
cell_permutations.data(), cell_permutations.size());
for (std::size_t i = 0; i < cell_permutations.size(); i++)
{
self.T_apply(
x_span.subspan(i * data_per_cell, data_per_cell),
perm_span[i], dim);
self.T_apply(x_span.subspan(i * data_per_cell, data_per_cell),
perm_span[i], dim);
}
},
nb::arg("x"), nb::arg("cell_permutations"), nb::arg("dim"))
Expand All @@ -169,9 +168,8 @@ void declare_function_space(nb::module_& m, std::string type)
cell_permutations.data(), cell_permutations.size());
for (std::size_t i = 0; i < cell_permutations.size(); i++)
{
self.Tt_apply(
x_span.subspan(i * data_per_cell, data_per_cell),
perm_span[i], dim);
self.Tt_apply(x_span.subspan(i * data_per_cell, data_per_cell),
perm_span[i], dim);
}
},
nb::arg("x"), nb::arg("cell_permutations"), nb::arg("dim"))
Expand Down Expand Up @@ -213,9 +211,8 @@ void declare_function_space(nb::module_& m, std::string type)

for (std::size_t i = 0; i < cell_permutations.size(); i++)
{
self.T_apply(
x_span.subspan(i * data_per_cell, data_per_cell),
perm_span[i], dim);
self.T_apply(x_span.subspan(i * data_per_cell, data_per_cell),
perm_span[i], dim);
}
},
nb::arg("x"), nb::arg("cell_permutations"), nb::arg("dim"))
Expand All @@ -235,9 +232,8 @@ void declare_function_space(nb::module_& m, std::string type)

for (std::size_t i = 0; i < cell_permutations.size(); i++)
{
self.Tt_apply(
x_span.subspan(i * data_per_cell, data_per_cell),
perm_span[i], dim);
self.Tt_apply(x_span.subspan(i * data_per_cell, data_per_cell),
perm_span[i], dim);
}
},
nb::arg("x"), nb::arg("cell_permutations"), nb::arg("dim"))
Expand Down Expand Up @@ -903,8 +899,8 @@ void declare_real_functions(nb::module_& m)
dolfinx::fem::ElementDofLayout layout
= dolfinx::fem::create_element_dof_layout(*p, topology.cell_type());

std::function<void(std::span<std::int32_t>, std::uint32_t)>
permute_inv = nullptr;
std::function<void(std::span<std::int32_t>, std::uint32_t)> permute_inv
= nullptr;
if (element.needs_dof_permutations())
permute_inv = element.dof_permutation_fn(true, true);
return dolfinx::fem::create_dofmap(comm.get(), layout, topology,
Expand Down

0 comments on commit 5591004

Please sign in to comment.