From 13c7eb817331bd61961162b2bb4fb9991c3d5015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Di=20Remigio=20Eik=C3=A5s?= Date: Fri, 25 Aug 2023 17:32:06 +0200 Subject: [PATCH] Run clang-format --- src/vampyr/core/bases.h | 5 +-- src/vampyr/functions/functions.h | 5 +-- src/vampyr/functions/gaussians.h | 49 ++++++++++++++++------------- src/vampyr/operators/convolutions.h | 26 ++++++--------- src/vampyr/treebuilders/project.h | 10 +++--- src/vampyr/trees/trees.h | 3 +- 6 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/vampyr/core/bases.h b/src/vampyr/core/bases.h index 7fbe5572..9d9b5693 100644 --- a/src/vampyr/core/bases.h +++ b/src/vampyr/core/bases.h @@ -29,8 +29,9 @@ void bases(pybind11::module &m) { py::class_>(m, "WaveletFunction"); - py::class_(m, "ScalingBasis", - R"mydelimiter( + py::class_(m, + "ScalingBasis", + R"mydelimiter( Filler text )mydelimiter") .def(py::init(), "order"_a, "type"_a) diff --git a/src/vampyr/functions/functions.h b/src/vampyr/functions/functions.h index 1bd50355..0a11101f 100644 --- a/src/vampyr/functions/functions.h +++ b/src/vampyr/functions/functions.h @@ -12,8 +12,9 @@ template void functions(pybind11::module &m) { using namespace pybind11::literals; // RepresentableFunction class - py::class_, PyRepresentableFunction>(m, "RepresentableFunction", - R"mydelimiter( + py::class_, PyRepresentableFunction>(m, + "RepresentableFunction", + R"mydelimiter( Filler text )mydelimiter") .def(py::init &, const std::vector &>()) diff --git a/src/vampyr/functions/gaussians.h b/src/vampyr/functions/gaussians.h index 7dc86ffb..c7fefbb3 100644 --- a/src/vampyr/functions/gaussians.h +++ b/src/vampyr/functions/gaussians.h @@ -15,8 +15,9 @@ template void gaussians(pybind11::module &m) { using namespace pybind11::literals; // Gaussian class - py::class_, PyGaussian, RepresentableFunction>(m, "Gaussian", - R"mydelimiter( + py::class_, PyGaussian, RepresentableFunction>(m, + "Gaussian", + R"mydelimiter( Parent class to the GaussFunc class. Note: This is only a template. Do not use it directly. @@ -36,8 +37,9 @@ template void gaussians(pybind11::module &m) { }); // GaussFunc class - py::class_, PyGaussian>, Gaussian>(m, "GaussFunc", - R"mydelimiter( + py::class_, PyGaussian>, Gaussian>(m, + "GaussFunc", + R"mydelimiter( An analytic Gaussian function in d dimensions: .. math:: @@ -70,36 +72,39 @@ template void gaussians(pybind11::module &m) { .def( "differentiate", [](const GaussFunc &gauss, int dir) { return gauss.differentiate(dir).asGaussExp(); }, - "dir"_a, "Differentiates the Gaussian along the specified axis.") + "dir"_a, + "Differentiates the Gaussian along the specified axis.") .def("squaredNorm", &GaussFunc::calcSquareNorm) - .def("calcCoulombEnergy", &GaussFunc::calcCoulombEnergy, + .def("calcCoulombEnergy", + &GaussFunc::calcCoulombEnergy, R"mydelimiter( Calculate energy interaction between this Gaussian and an input Gaussian. Warning: power has to be a zero vector)mydelimiter"); // GaussExp class - py::class_, RepresentableFunction>(m, "GaussExp", - R"mydelimiter( + py::class_, RepresentableFunction>(m, + "GaussExp", + R"mydelimiter( test )mydelimiter") .def(py::init()) - .def("size", - py::overload_cast<>(&GaussExp::size, py::const_), - "Number of Gaussians in the GaussExp") + .def("size", py::overload_cast<>(&GaussExp::size, py::const_), "Number of Gaussians in the GaussExp") .def("func", - py::overload_cast(&GaussExp::getFunc), - "term"_a, - py::return_value_policy::reference_internal) + py::overload_cast(&GaussExp::getFunc), + "term"_a, + py::return_value_policy::reference_internal) .def("append", - py::overload_cast &>(&GaussExp::append), - "Append Gaussians to the end of the GaussExp") - .def("periodify", &GaussExp::periodify, - "period"_a, - "std_dev"_a = 4.0, - "Make copies of the Gaussian to simulate periodicity, then append it to the GaussExp") + py::overload_cast &>(&GaussExp::append), + "Append Gaussians to the end of the GaussExp") + .def("periodify", + &GaussExp::periodify, + "period"_a, + "std_dev"_a = 4.0, + "Make copies of the Gaussian to simulate periodicity, then append it to the GaussExp") .def("differentiate", - &GaussExp::differentiate, - "dir"_a, "Differentiate all Gaussians in GaussExp along the specified axis") + &GaussExp::differentiate, + "dir"_a, + "Differentiate all Gaussians in GaussExp along the specified axis") .def("squaredNorm", &GaussExp::calcSquareNorm) .def("calcCoulombEnergy", &GaussExp::calcCoulombEnergy) .def("__str__", [](const GaussExp &func) { diff --git a/src/vampyr/operators/convolutions.h b/src/vampyr/operators/convolutions.h index cb8e0ba6..eb089c4e 100644 --- a/src/vampyr/operators/convolutions.h +++ b/src/vampyr/operators/convolutions.h @@ -2,10 +2,10 @@ #include +#include #include #include #include -#include #include namespace vampyr { @@ -20,17 +20,14 @@ template void convolutions(pybind11::module &m) { using namespace pybind11::literals; py::class_>(m, "ConvolutionOperator") - .def(py::init &, GaussExp<1> &, double>(), - "mra"_a, - "kernel"_a, - "prec"_a) - .def(py::init &, GaussExp<1> &, double, int, int>()) - .def( - "__call__", - [](ConvolutionOperator &C, FunctionTree *inp) { - auto out = std::make_unique>(inp->getMRA()); - apply(C.getBuildPrec(), *out, C, *inp); - return out; + .def(py::init &, GaussExp<1> &, double>(), "mra"_a, "kernel"_a, "prec"_a) + .def(py::init &, GaussExp<1> &, double, int, int>()) + .def( + "__call__", + [](ConvolutionOperator &C, FunctionTree *inp) { + auto out = std::make_unique>(inp->getMRA()); + apply(C.getBuildPrec(), *out, C, *inp); + return out; }, "inp"_a); @@ -61,10 +58,7 @@ void cartesian_convolution(pybind11::module &m) { using namespace pybind11::literals; py::class_>(m, "CartesianConvolution") - .def(py::init &, GaussExp<1> &, double>(), - "mra"_a, - "kernel"_a, - "prec"_a) + .def(py::init &, GaussExp<1> &, double>(), "mra"_a, "kernel"_a, "prec"_a) .def( "__call__", [](CartesianConvolution &O, FunctionTree<3> *inp) { diff --git a/src/vampyr/treebuilders/project.h b/src/vampyr/treebuilders/project.h index 4e2c373f..1d761f07 100644 --- a/src/vampyr/treebuilders/project.h +++ b/src/vampyr/treebuilders/project.h @@ -1,7 +1,7 @@ #pragma once -#include #include "PyProjectors.h" +#include namespace vampyr { template void project(pybind11::module &m) { @@ -9,9 +9,9 @@ template void project(pybind11::module &m) { namespace py = pybind11; using namespace pybind11::literals; - m.def("ZeroTree", - [](const MultiResolutionAnalysis &mra, - const std::string &name) { + m.def( + "ZeroTree", + [](const MultiResolutionAnalysis &mra, const std::string &name) { auto out = std::make_unique>(mra, name); out->setZero(); return out; @@ -27,7 +27,6 @@ template void project(pybind11::module &m) { .def( "__call__", [](PyScalingProjector &P, std::function &r)> func) { - try { // When the analytic function func is badly defined, it kills the kernel // of Notebooks. This evaluates func in a point, and if it is not successful @@ -54,7 +53,6 @@ template void project(pybind11::module &m) { .def( "__call__", [](PyWaveletProjector &P, std::function &r)> func) { - try { auto arr = std::array(); arr.fill(111111.111); // A number which hopefully does not divide by zero diff --git a/src/vampyr/trees/trees.h b/src/vampyr/trees/trees.h index 5950455a..31a63582 100644 --- a/src/vampyr/trees/trees.h +++ b/src/vampyr/trees/trees.h @@ -13,7 +13,8 @@ namespace vampyr { template -auto impl__add__(mrcpp::FunctionTree *inp_a, mrcpp::FunctionTree *inp_b) -> std::unique_ptr> { +auto impl__add__(mrcpp::FunctionTree *inp_a, mrcpp::FunctionTree *inp_b) + -> std::unique_ptr> { using namespace mrcpp; auto out = std::make_unique>(inp_a->getMRA()); FunctionTreeVector vec;