diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 024238f..9ed71dd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ ci: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: check-added-large-files - id: check-merge-conflict @@ -12,16 +12,16 @@ repos: - id: mixed-line-ending - id: trailing-whitespace - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v20.1.7 + rev: v22.1.2 hooks: - id: clang-format types_or: [c, c++] - repo: https://github.com/PyCQA/isort - rev: 6.0.1 + rev: 8.0.1 hooks: - id: isort - repo: https://github.com/psf/black-pre-commit-mirror - rev: 25.1.0 + rev: 26.3.1 hooks: - id: black - repo: https://github.com/PyCQA/flake8 diff --git a/include/flyft/composite_mixin.h b/include/flyft/composite_mixin.h index c469a67..0e66277 100644 --- a/include/flyft/composite_mixin.h +++ b/include/flyft/composite_mixin.h @@ -9,7 +9,7 @@ template class CompositeMixin { public: - CompositeMixin() {} + CompositeMixin() { } bool addObject(std::shared_ptr object) { diff --git a/include/flyft/data_view.h b/include/flyft/data_view.h index 6da3f61..d88ac4e 100644 --- a/include/flyft/data_view.h +++ b/include/flyft/data_view.h @@ -23,11 +23,11 @@ class DataView using pointer = DataView::pointer; using reference = DataView::reference; - Iterator() : Iterator(DataView()) {} + Iterator() : Iterator(DataView()) { } - explicit Iterator(const DataView& view) : Iterator(view, 0) {} + explicit Iterator(const DataView& view) : Iterator(view, 0) { } - Iterator(const DataView& view, int current) : view_(view), current_(current) {} + Iterator(const DataView& view, int current) : view_(view), current_(current) { } reference operator*() const { @@ -85,9 +85,9 @@ class DataView int current_; }; - DataView() : DataView(nullptr, DataLayout()) {} + DataView() : DataView(nullptr, DataLayout()) { } - DataView(pointer data, const DataLayout& layout) : DataView(data, layout, 0, layout.shape()) {} + DataView(pointer data, const DataLayout& layout) : DataView(data, layout, 0, layout.shape()) { } DataView(pointer data, const DataLayout& layout, int start, int end) : data_(data), layout_(layout), start_(start), end_(end) diff --git a/include/flyft/field.h b/include/flyft/field.h index a32e974..3c4636b 100644 --- a/include/flyft/field.h +++ b/include/flyft/field.h @@ -21,7 +21,7 @@ class GenericField : public TrackedObject using ConstantIterator = typename ConstantView::Iterator; GenericField() = delete; - explicit GenericField(int shape) : GenericField(shape, 0) {} + explicit GenericField(int shape) : GenericField(shape, 0) { } GenericField(int shape, int buffer_shape) : data_(nullptr), shape_(0), buffer_shape_(0), layout_(0) { diff --git a/include/flyft/integrator.h b/include/flyft/integrator.h index 451dce8..68361fe 100644 --- a/include/flyft/integrator.h +++ b/include/flyft/integrator.h @@ -58,8 +58,7 @@ class Integrator virtual void step(std::shared_ptr flux, std::shared_ptr grand, std::shared_ptr state, - double timestep) - = 0; + double timestep) = 0; virtual int getLocalErrorExponent() const = 0; }; diff --git a/include/flyft/linear_potential.h b/include/flyft/linear_potential.h index 07ac4a5..fdb62b9 100644 --- a/include/flyft/linear_potential.h +++ b/include/flyft/linear_potential.h @@ -15,7 +15,8 @@ namespace flyft class LinearPotentialFunction { public: - LinearPotentialFunction(double x0, double y0, double slope) : x0_(x0), y0_(y0), slope_(slope) {} + LinearPotentialFunction(double x0, double y0, double slope) + : x0_(x0), y0_(y0), slope_(slope) { } double operator()(double x) const { diff --git a/include/flyft/parameter.h b/include/flyft/parameter.h index f150de4..af0525e 100644 --- a/include/flyft/parameter.h +++ b/include/flyft/parameter.h @@ -14,9 +14,9 @@ template class Parameter : public TrackedObject { public: - Parameter() {} + Parameter() { } - virtual ~Parameter() {} + virtual ~Parameter() { } virtual T operator()(std::shared_ptr state) = 0; @@ -31,7 +31,7 @@ template class ConstantParameter : public Parameter { public: - ConstantParameter(T value) : value_(value) {} + ConstantParameter(T value) : value_(value) { } T operator()(std::shared_ptr /*state*/) override { diff --git a/include/flyft/wall_potential.h b/include/flyft/wall_potential.h index 5895ec9..12fba29 100644 --- a/include/flyft/wall_potential.h +++ b/include/flyft/wall_potential.h @@ -13,7 +13,7 @@ namespace flyft class WallPotentialFunction { public: - WallPotentialFunction(double origin, double normal) : origin_(origin), normal_(normal) {} + WallPotentialFunction(double origin, double normal) : origin_(origin), normal_(normal) { } protected: double origin_; diff --git a/python/tests/conftest.py b/python/tests/conftest.py index 04d65ed..4adb701 100644 --- a/python/tests/conftest.py +++ b/python/tests/conftest.py @@ -1,8 +1,7 @@ +import flyft import pytest from pytest_lazy_fixtures import lf as lazy_fixture -import flyft - @pytest.fixture def ig(): diff --git a/python/tests/test_boublik_hard_sphere.py b/python/tests/test_boublik_hard_sphere.py index 0b7c3cb..98c4463 100644 --- a/python/tests/test_boublik_hard_sphere.py +++ b/python/tests/test_boublik_hard_sphere.py @@ -1,8 +1,7 @@ +import flyft import numpy as np import pytest -import flyft - def fex_cs(eta, d): """Carnahan-Starling free-energy density of hard spheres""" diff --git a/python/tests/test_brownian_diffusive_flux.py b/python/tests/test_brownian_diffusive_flux.py index f7099c1..e55ad57 100644 --- a/python/tests/test_brownian_diffusive_flux.py +++ b/python/tests/test_brownian_diffusive_flux.py @@ -1,9 +1,8 @@ +import flyft import numpy as np import pytest from pytest_lazy_fixtures import lf as lazy_fixture -import flyft - @pytest.fixture def cartesian_mesh_grand(): diff --git a/python/tests/test_composite_external_potential.py b/python/tests/test_composite_external_potential.py index 9515921..e075944 100644 --- a/python/tests/test_composite_external_potential.py +++ b/python/tests/test_composite_external_potential.py @@ -1,8 +1,7 @@ +import flyft import numpy as np import pytest -import flyft - @pytest.fixture def comp(): diff --git a/python/tests/test_composite_flux.py b/python/tests/test_composite_flux.py index f1785eb..b92b7d0 100644 --- a/python/tests/test_composite_flux.py +++ b/python/tests/test_composite_flux.py @@ -1,8 +1,7 @@ +import flyft import numpy as np import pytest -import flyft - @pytest.fixture def comp(): diff --git a/python/tests/test_composite_functional.py b/python/tests/test_composite_functional.py index ebd37f6..ec070a1 100644 --- a/python/tests/test_composite_functional.py +++ b/python/tests/test_composite_functional.py @@ -1,8 +1,7 @@ +import flyft import numpy as np import pytest -import flyft - @pytest.fixture def comp(): diff --git a/python/tests/test_crank_nicolson_integrator.py b/python/tests/test_crank_nicolson_integrator.py index dfcba14..2a9153f 100644 --- a/python/tests/test_crank_nicolson_integrator.py +++ b/python/tests/test_crank_nicolson_integrator.py @@ -1,8 +1,7 @@ +import flyft import numpy as np import pytest -import flyft - @pytest.fixture def cn(): diff --git a/python/tests/test_explicit_euler_integrator.py b/python/tests/test_explicit_euler_integrator.py index 2889542..1e0e3e6 100644 --- a/python/tests/test_explicit_euler_integrator.py +++ b/python/tests/test_explicit_euler_integrator.py @@ -1,8 +1,7 @@ +import flyft import numpy as np import pytest -import flyft - @pytest.fixture def euler(): diff --git a/python/tests/test_exponential_wall_potential.py b/python/tests/test_exponential_wall_potential.py index 5da332b..18573b1 100644 --- a/python/tests/test_exponential_wall_potential.py +++ b/python/tests/test_exponential_wall_potential.py @@ -1,8 +1,7 @@ +import flyft import numpy as np import pytest -import flyft - @pytest.fixture def ew(): diff --git a/python/tests/test_external_field.py b/python/tests/test_external_field.py index b07c5d0..f896a48 100644 --- a/python/tests/test_external_field.py +++ b/python/tests/test_external_field.py @@ -1,8 +1,7 @@ +import flyft import numpy as np import pytest -import flyft - @pytest.fixture def spherical_mesh_grand(): diff --git a/python/tests/test_field.py b/python/tests/test_field.py index 2409aff..c7f3d78 100644 --- a/python/tests/test_field.py +++ b/python/tests/test_field.py @@ -1,8 +1,7 @@ +import flyft import numpy as np import pytest -import flyft - @pytest.fixture def field(): diff --git a/python/tests/test_grand_potential.py b/python/tests/test_grand_potential.py index 768cd2c..bbf9897 100644 --- a/python/tests/test_grand_potential.py +++ b/python/tests/test_grand_potential.py @@ -1,8 +1,7 @@ +import flyft import numpy as np import pytest -import flyft - from .test_ideal_gas import f_ig, mu_ig from .test_rosenfeld_fmt import fex_py, muex_py diff --git a/python/tests/test_hard_wall_potential.py b/python/tests/test_hard_wall_potential.py index 697d82e..5730945 100644 --- a/python/tests/test_hard_wall_potential.py +++ b/python/tests/test_hard_wall_potential.py @@ -1,8 +1,7 @@ +import flyft import numpy as np import pytest -import flyft - @pytest.fixture def hw(): diff --git a/python/tests/test_harmonic_wall_potential.py b/python/tests/test_harmonic_wall_potential.py index 7d6dbd2..a700c2a 100644 --- a/python/tests/test_harmonic_wall_potential.py +++ b/python/tests/test_harmonic_wall_potential.py @@ -1,8 +1,7 @@ +import flyft import numpy as np import pytest -import flyft - @pytest.fixture def hw(): diff --git a/python/tests/test_implicit_euler_integrator.py b/python/tests/test_implicit_euler_integrator.py index aa39865..dc7bc7e 100644 --- a/python/tests/test_implicit_euler_integrator.py +++ b/python/tests/test_implicit_euler_integrator.py @@ -1,8 +1,7 @@ +import flyft import numpy as np import pytest -import flyft - @pytest.fixture def euler(): diff --git a/python/tests/test_lennard_jones_93_wall_potential.py b/python/tests/test_lennard_jones_93_wall_potential.py index efa5692..ca70f83 100644 --- a/python/tests/test_lennard_jones_93_wall_potential.py +++ b/python/tests/test_lennard_jones_93_wall_potential.py @@ -1,8 +1,7 @@ +import flyft import numpy as np import pytest -import flyft - @pytest.fixture def lj(): diff --git a/python/tests/test_mirror.py b/python/tests/test_mirror.py index f721114..1828282 100644 --- a/python/tests/test_mirror.py +++ b/python/tests/test_mirror.py @@ -1,6 +1,5 @@ -import pytest - import flyft.mirror +import pytest class _A: diff --git a/python/tests/test_parameter.py b/python/tests/test_parameter.py index 82631cc..3e91ea5 100644 --- a/python/tests/test_parameter.py +++ b/python/tests/test_parameter.py @@ -1,8 +1,7 @@ +import flyft import numpy as np import pytest -import flyft - class TimeParameter(flyft.CustomParameter): def __call__(self, state): diff --git a/python/tests/test_picard_iteration.py b/python/tests/test_picard_iteration.py index 5bc1cf5..b5ad3de 100644 --- a/python/tests/test_picard_iteration.py +++ b/python/tests/test_picard_iteration.py @@ -1,8 +1,7 @@ +import flyft import numpy as np import pytest -import flyft - from .test_ideal_gas import mu_ig from .test_rosenfeld_fmt import muex_py diff --git a/python/tests/test_rpy_diffusive_flux.py b/python/tests/test_rpy_diffusive_flux.py index 71d4524..89e433c 100644 --- a/python/tests/test_rpy_diffusive_flux.py +++ b/python/tests/test_rpy_diffusive_flux.py @@ -1,8 +1,7 @@ +import flyft import numpy as np import pytest -import flyft - @pytest.fixture def spherical_mesh_grand(): diff --git a/python/tests/test_state.py b/python/tests/test_state.py index 24924a6..a1aed37 100644 --- a/python/tests/test_state.py +++ b/python/tests/test_state.py @@ -1,6 +1,5 @@ -import pytest - import flyft +import pytest def test_init(state): diff --git a/python/tests/test_virial_expansion.py b/python/tests/test_virial_expansion.py index 4b5d0e1..3464b95 100644 --- a/python/tests/test_virial_expansion.py +++ b/python/tests/test_virial_expansion.py @@ -1,8 +1,7 @@ +import flyft import numpy as np import pytest -import flyft - def f_ex(B, rho): """Excess free-energy density of virial expansion""" diff --git a/python/tests/test_white_bear.py b/python/tests/test_white_bear.py index 2924ae2..6ef571b 100644 --- a/python/tests/test_white_bear.py +++ b/python/tests/test_white_bear.py @@ -1,8 +1,7 @@ +import flyft import numpy as np import pytest -import flyft - def fex_cs(eta, v): """Carnahan--Starling free-energy density of hard spheres""" diff --git a/python/tests/test_white_bear_mark_ii.py b/python/tests/test_white_bear_mark_ii.py index 73feed1..48ee0ec 100644 --- a/python/tests/test_white_bear_mark_ii.py +++ b/python/tests/test_white_bear_mark_ii.py @@ -1,8 +1,7 @@ +import flyft import numpy as np import pytest -import flyft - def fex_cs(eta, v): """Carnahan--Starling free-energy density of hard spheres""" diff --git a/python/validate/binary_mixture.py b/python/validate/binary_mixture.py index 4cdae6b..28e6620 100644 --- a/python/validate/binary_mixture.py +++ b/python/validate/binary_mixture.py @@ -1,6 +1,5 @@ -import numpy as np - import flyft +import numpy as np L = 50.0 dx = 0.2 diff --git a/python/validate/brownian_diffusion.py b/python/validate/brownian_diffusion.py index 8183677..0fc5d5a 100644 --- a/python/validate/brownian_diffusion.py +++ b/python/validate/brownian_diffusion.py @@ -1,6 +1,5 @@ -import numpy as np - import flyft +import numpy as np L = 10.0 dx = 0.05 diff --git a/python/validate/hard_sphere_evaporation.py b/python/validate/hard_sphere_evaporation.py index af01e9e..be85854 100644 --- a/python/validate/hard_sphere_evaporation.py +++ b/python/validate/hard_sphere_evaporation.py @@ -1,6 +1,5 @@ -import numpy as np - import flyft +import numpy as np L = 10.0 dx = 0.05 diff --git a/python/validate/hard_sphere_slit.py b/python/validate/hard_sphere_slit.py index 73d6fdd..bb2a014 100644 --- a/python/validate/hard_sphere_slit.py +++ b/python/validate/hard_sphere_slit.py @@ -1,6 +1,5 @@ -import numpy as np - import flyft +import numpy as np L = 16.0 diameters = {"A": 1.0} diff --git a/python/validate/stratification.py b/python/validate/stratification.py index a8cdb6f..ee04a00 100644 --- a/python/validate/stratification.py +++ b/python/validate/stratification.py @@ -1,6 +1,5 @@ -import numpy as np - import flyft +import numpy as np L = 38.5 dx = 0.05 diff --git a/src/communicator.cc b/src/communicator.cc index 4c96f2f..05fb16c 100644 --- a/src/communicator.cc +++ b/src/communicator.cc @@ -20,7 +20,7 @@ Communicator::Communicator(MPI_Comm comm, int root) : comm_(comm), root_(root) } #endif // FLYFT_MPI -Communicator::~Communicator() {} +Communicator::~Communicator() { } #ifdef FLYFT_MPI MPI_Comm Communicator::get() const diff --git a/src/composite_external_potential.cc b/src/composite_external_potential.cc index a19825d..074c2dc 100644 --- a/src/composite_external_potential.cc +++ b/src/composite_external_potential.cc @@ -5,7 +5,7 @@ namespace flyft { -CompositeExternalPotential::CompositeExternalPotential() {} +CompositeExternalPotential::CompositeExternalPotential() { } bool CompositeExternalPotential::setup(std::shared_ptr state, bool compute_value) { diff --git a/src/composite_functional.cc b/src/composite_functional.cc index e4f56e5..f5f621a 100644 --- a/src/composite_functional.cc +++ b/src/composite_functional.cc @@ -5,7 +5,7 @@ namespace flyft { -CompositeFunctional::CompositeFunctional() {} +CompositeFunctional::CompositeFunctional() { } bool CompositeFunctional::setup(std::shared_ptr state, bool compute_value) { diff --git a/src/data_layout.cc b/src/data_layout.cc index dc58eab..2416f8d 100644 --- a/src/data_layout.cc +++ b/src/data_layout.cc @@ -5,9 +5,9 @@ namespace flyft { -DataLayout::DataLayout() : shape_(0) {} +DataLayout::DataLayout() : shape_(0) { } -DataLayout::DataLayout(int shape) : shape_(shape) {} +DataLayout::DataLayout(int shape) : shape_(shape) { } int DataLayout::operator()(int idx) const { diff --git a/src/explicit_euler_integrator.cc b/src/explicit_euler_integrator.cc index c2287d3..b498db2 100644 --- a/src/explicit_euler_integrator.cc +++ b/src/explicit_euler_integrator.cc @@ -5,7 +5,7 @@ namespace flyft { -ExplicitEulerIntegrator::ExplicitEulerIntegrator(double timestep) : Integrator(timestep) {} +ExplicitEulerIntegrator::ExplicitEulerIntegrator(double timestep) : Integrator(timestep) { } void ExplicitEulerIntegrator::step(std::shared_ptr flux, std::shared_ptr grand, diff --git a/src/external_potential.cc b/src/external_potential.cc index 72c3194..2ce68d7 100644 --- a/src/external_potential.cc +++ b/src/external_potential.cc @@ -3,7 +3,7 @@ namespace flyft { -ExternalPotential::ExternalPotential() {} +ExternalPotential::ExternalPotential() { } bool ExternalPotential::setup(std::shared_ptr state, bool compute_value) { diff --git a/src/flux.cc b/src/flux.cc index 1ada3db..17dda8c 100644 --- a/src/flux.cc +++ b/src/flux.cc @@ -5,9 +5,9 @@ namespace flyft { -Flux::Flux() {} +Flux::Flux() { } -Flux::~Flux() {} +Flux::~Flux() { } const TypeMap>& Flux::getFluxes() { diff --git a/src/functional.cc b/src/functional.cc index 1e9eeb3..6c4df35 100644 --- a/src/functional.cc +++ b/src/functional.cc @@ -5,9 +5,9 @@ namespace flyft { -Functional::Functional() : value_(std::nan("")) {} +Functional::Functional() : value_(std::nan("")) { } -Functional::~Functional() {} +Functional::~Functional() { } Functional::Token Functional::compute(std::shared_ptr state, bool compute_value) { diff --git a/src/integrator.cc b/src/integrator.cc index dffe04d..0d89d08 100644 --- a/src/integrator.cc +++ b/src/integrator.cc @@ -12,7 +12,7 @@ Integrator::Integrator(double timestep) setTimestep(timestep); } -Integrator::~Integrator() {} +Integrator::~Integrator() { } bool Integrator::advance(std::shared_ptr flux, std::shared_ptr grand, diff --git a/src/parallel_mesh.cc b/src/parallel_mesh.cc index d8f98e1..c2a96d0 100644 --- a/src/parallel_mesh.cc +++ b/src/parallel_mesh.cc @@ -46,7 +46,7 @@ ParallelMesh::ParallelMesh(std::shared_ptr mesh, std::shared_ptrslice(start, end); } -ParallelMesh::~ParallelMesh() {} +ParallelMesh::~ParallelMesh() { } std::shared_ptr ParallelMesh::getCommunicator() { diff --git a/src/rpy_diffusive_flux.cc b/src/rpy_diffusive_flux.cc index ae3b010..f156e35 100644 --- a/src/rpy_diffusive_flux.cc +++ b/src/rpy_diffusive_flux.cc @@ -7,7 +7,7 @@ namespace flyft { -RPYDiffusiveFlux::RPYDiffusiveFlux() : viscosity_(1.0) {} +RPYDiffusiveFlux::RPYDiffusiveFlux() : viscosity_(1.0) { } void RPYDiffusiveFlux::compute(std::shared_ptr grand, std::shared_ptr state) { diff --git a/src/solver.cc b/src/solver.cc index 94c527a..f778616 100644 --- a/src/solver.cc +++ b/src/solver.cc @@ -3,7 +3,7 @@ namespace flyft { -Solver::Solver() {} +Solver::Solver() { } -Solver::~Solver() {} +Solver::~Solver() { } } // namespace flyft diff --git a/src/three_dimensional_index.cc b/src/three_dimensional_index.cc index ab91f16..75c7267 100644 --- a/src/three_dimensional_index.cc +++ b/src/three_dimensional_index.cc @@ -2,9 +2,9 @@ namespace flyft { -ThreeDimensionalIndex::ThreeDimensionalIndex() : nx_(0), ny_(0), nz_(0) {} +ThreeDimensionalIndex::ThreeDimensionalIndex() : nx_(0), ny_(0), nz_(0) { } -ThreeDimensionalIndex::ThreeDimensionalIndex(int nx, int ny, int nz) : nx_(nx), ny_(ny), nz_(nz) {} +ThreeDimensionalIndex::ThreeDimensionalIndex(int nx, int ny, int nz) : nx_(nx), ny_(ny), nz_(nz) { } int ThreeDimensionalIndex::operator()(int i, int j, int k) const { diff --git a/src/tracked_object.cc b/src/tracked_object.cc index 907b52d..8befc13 100644 --- a/src/tracked_object.cc +++ b/src/tracked_object.cc @@ -7,9 +7,9 @@ namespace flyft { TrackedObject::Identifier TrackedObject::count = 0; -TrackedObject::TrackedObject() : id_(count++), token_(id_) {} +TrackedObject::TrackedObject() : id_(count++), token_(id_) { } -TrackedObject::TrackedObject(const TrackedObject& /*other*/) : id_(count++), token_(id_) {} +TrackedObject::TrackedObject(const TrackedObject& /*other*/) : id_(count++), token_(id_) { } TrackedObject::TrackedObject(TrackedObject&& other) : id_(std::move(other.id_)), token_(std::move(other.token_)) @@ -31,7 +31,7 @@ TrackedObject& TrackedObject::operator=(TrackedObject&& /*other*/) return *this; } -TrackedObject::~TrackedObject() {} +TrackedObject::~TrackedObject() { } TrackedObject::Identifier TrackedObject::id() const { @@ -43,16 +43,16 @@ TrackedObject::Token TrackedObject::token() return token_; } -TrackedObject::Token::Token() : Token(invalid_id) {} +TrackedObject::Token::Token() : Token(invalid_id) { } -TrackedObject::Token::Token(TrackedObject::Identifier id) : Token(id, 0) {} +TrackedObject::Token::Token(TrackedObject::Identifier id) : Token(id, 0) { } TrackedObject::Token::Token(TrackedObject::Identifier id, uint64_t code) : id_(id), code_(code), dirty_(false) { } -TrackedObject::Token::~Token() {} +TrackedObject::Token::~Token() { } void TrackedObject::Token::commit() { @@ -98,7 +98,7 @@ bool TrackedObject::Token::operator!=(const TrackedObject::Token& other) const return !(*this == other); } -TrackedObject::Dependencies::Dependencies() : object_map_changed_(false) {} +TrackedObject::Dependencies::Dependencies() : object_map_changed_(false) { } void TrackedObject::Dependencies::add(TrackedObject* object) {