Skip to content

Commit

Permalink
Run clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
robertodr committed Aug 26, 2023
1 parent 0a672fb commit 13c7eb8
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 49 deletions.
5 changes: 3 additions & 2 deletions src/vampyr/core/bases.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ void bases(pybind11::module &m) {

py::class_<PyWaveletFunction, RepresentableFunction<1>>(m, "WaveletFunction");

py::class_<ScalingBasis>(m, "ScalingBasis",
R"mydelimiter(
py::class_<ScalingBasis>(m,
"ScalingBasis",
R"mydelimiter(
Filler text
)mydelimiter")
.def(py::init<int, int>(), "order"_a, "type"_a)
Expand Down
5 changes: 3 additions & 2 deletions src/vampyr/functions/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ template <int D> void functions(pybind11::module &m) {
using namespace pybind11::literals;

// RepresentableFunction class
py::class_<RepresentableFunction<D>, PyRepresentableFunction<D>>(m, "RepresentableFunction",
R"mydelimiter(
py::class_<RepresentableFunction<D>, PyRepresentableFunction<D>>(m,
"RepresentableFunction",
R"mydelimiter(
Filler text
)mydelimiter")
.def(py::init<const std::vector<double> &, const std::vector<double> &>())
Expand Down
49 changes: 27 additions & 22 deletions src/vampyr/functions/gaussians.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ template <int D> void gaussians(pybind11::module &m) {
using namespace pybind11::literals;

// Gaussian class
py::class_<Gaussian<D>, PyGaussian<D>, RepresentableFunction<D>>(m, "Gaussian",
R"mydelimiter(
py::class_<Gaussian<D>, PyGaussian<D>, RepresentableFunction<D>>(m,
"Gaussian",
R"mydelimiter(
Parent class to the GaussFunc class.
Note: This is only a template. Do not use it directly.
Expand All @@ -36,8 +37,9 @@ template <int D> void gaussians(pybind11::module &m) {
});

// GaussFunc class
py::class_<GaussFunc<D>, PyGaussian<D, GaussFunc<D>>, Gaussian<D>>(m, "GaussFunc",
R"mydelimiter(
py::class_<GaussFunc<D>, PyGaussian<D, GaussFunc<D>>, Gaussian<D>>(m,
"GaussFunc",
R"mydelimiter(
An analytic Gaussian function in d dimensions:
.. math::
Expand Down Expand Up @@ -70,36 +72,39 @@ template <int D> void gaussians(pybind11::module &m) {
.def(
"differentiate",
[](const GaussFunc<D> &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<D>::calcSquareNorm)
.def("calcCoulombEnergy", &GaussFunc<D>::calcCoulombEnergy,
.def("calcCoulombEnergy",
&GaussFunc<D>::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_<GaussExp<D>, RepresentableFunction<D>>(m, "GaussExp",
R"mydelimiter(
py::class_<GaussExp<D>, RepresentableFunction<D>>(m,
"GaussExp",
R"mydelimiter(
test
)mydelimiter")
.def(py::init())
.def("size",
py::overload_cast<>(&GaussExp<D>::size, py::const_),
"Number of Gaussians in the GaussExp")
.def("size", py::overload_cast<>(&GaussExp<D>::size, py::const_), "Number of Gaussians in the GaussExp")
.def("func",
py::overload_cast<int>(&GaussExp<D>::getFunc),
"term"_a,
py::return_value_policy::reference_internal)
py::overload_cast<int>(&GaussExp<D>::getFunc),
"term"_a,
py::return_value_policy::reference_internal)
.def("append",
py::overload_cast<const Gaussian<D> &>(&GaussExp<D>::append),
"Append Gaussians to the end of the GaussExp")
.def("periodify", &GaussExp<D>::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<const Gaussian<D> &>(&GaussExp<D>::append),
"Append Gaussians to the end of the GaussExp")
.def("periodify",
&GaussExp<D>::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<D>::differentiate,
"dir"_a, "Differentiate all Gaussians in GaussExp along the specified axis")
&GaussExp<D>::differentiate,
"dir"_a,
"Differentiate all Gaussians in GaussExp along the specified axis")
.def("squaredNorm", &GaussExp<D>::calcSquareNorm)
.def("calcCoulombEnergy", &GaussExp<D>::calcCoulombEnergy)
.def("__str__", [](const GaussExp<D> &func) {
Expand Down
26 changes: 10 additions & 16 deletions src/vampyr/operators/convolutions.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

#include <pybind11/pybind11.h>

#include <MRCPP/operators/CartesianConvolution.h>
#include <MRCPP/operators/HelmholtzOperator.h>
#include <MRCPP/operators/IdentityConvolution.h>
#include <MRCPP/operators/PoissonOperator.h>
#include <MRCPP/operators/CartesianConvolution.h>
#include <MRCPP/treebuilders/apply.h>

namespace vampyr {
Expand All @@ -20,17 +20,14 @@ template <int D> void convolutions(pybind11::module &m) {
using namespace pybind11::literals;

py::class_<ConvolutionOperator<D>>(m, "ConvolutionOperator")
.def(py::init<const MultiResolutionAnalysis<D> &, GaussExp<1> &, double>(),
"mra"_a,
"kernel"_a,
"prec"_a)
.def(py::init<const MultiResolutionAnalysis<D> &, GaussExp<1> &, double, int, int>())
.def(
"__call__",
[](ConvolutionOperator<D> &C, FunctionTree<D> *inp) {
auto out = std::make_unique<FunctionTree<D>>(inp->getMRA());
apply<D>(C.getBuildPrec(), *out, C, *inp);
return out;
.def(py::init<const MultiResolutionAnalysis<D> &, GaussExp<1> &, double>(), "mra"_a, "kernel"_a, "prec"_a)
.def(py::init<const MultiResolutionAnalysis<D> &, GaussExp<1> &, double, int, int>())
.def(
"__call__",
[](ConvolutionOperator<D> &C, FunctionTree<D> *inp) {
auto out = std::make_unique<FunctionTree<D>>(inp->getMRA());
apply<D>(C.getBuildPrec(), *out, C, *inp);
return out;
},
"inp"_a);

Expand Down Expand Up @@ -61,10 +58,7 @@ void cartesian_convolution(pybind11::module &m) {
using namespace pybind11::literals;

py::class_<CartesianConvolution, ConvolutionOperator<3>>(m, "CartesianConvolution")
.def(py::init<const MultiResolutionAnalysis<3> &, GaussExp<1> &, double>(),
"mra"_a,
"kernel"_a,
"prec"_a)
.def(py::init<const MultiResolutionAnalysis<3> &, GaussExp<1> &, double>(), "mra"_a, "kernel"_a, "prec"_a)
.def(
"__call__",
[](CartesianConvolution &O, FunctionTree<3> *inp) {
Expand Down
10 changes: 4 additions & 6 deletions src/vampyr/treebuilders/project.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#pragma once

#include <pybind11/functional.h>
#include "PyProjectors.h"
#include <pybind11/functional.h>

namespace vampyr {
template <int D> void project(pybind11::module &m) {
using namespace mrcpp;
namespace py = pybind11;
using namespace pybind11::literals;

m.def("ZeroTree",
[](const MultiResolutionAnalysis<D> &mra,
const std::string &name) {
m.def(
"ZeroTree",
[](const MultiResolutionAnalysis<D> &mra, const std::string &name) {
auto out = std::make_unique<FunctionTree<D>>(mra, name);
out->setZero();
return out;
Expand All @@ -27,7 +27,6 @@ template <int D> void project(pybind11::module &m) {
.def(
"__call__",
[](PyScalingProjector<D> &P, std::function<double(const Coord<D> &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
Expand All @@ -54,7 +53,6 @@ template <int D> void project(pybind11::module &m) {
.def(
"__call__",
[](PyWaveletProjector<D> &P, std::function<double(const Coord<D> &r)> func) {

try {
auto arr = std::array<double, D>();
arr.fill(111111.111); // A number which hopefully does not divide by zero
Expand Down
3 changes: 2 additions & 1 deletion src/vampyr/trees/trees.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

namespace vampyr {
template <int D>
auto impl__add__(mrcpp::FunctionTree<D> *inp_a, mrcpp::FunctionTree<D> *inp_b) -> std::unique_ptr<mrcpp::FunctionTree<D>> {
auto impl__add__(mrcpp::FunctionTree<D> *inp_a, mrcpp::FunctionTree<D> *inp_b)
-> std::unique_ptr<mrcpp::FunctionTree<D>> {
using namespace mrcpp;
auto out = std::make_unique<FunctionTree<D>>(inp_a->getMRA());
FunctionTreeVector<D> vec;
Expand Down

0 comments on commit 13c7eb8

Please sign in to comment.