Skip to content

Commit

Permalink
includes some minor changes in the overall code style
Browse files Browse the repository at this point in the history
  • Loading branch information
remo committed Feb 14, 2024
1 parent 017e718 commit 4727ca1
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 35 deletions.
3 changes: 3 additions & 0 deletions Bembel/HomogenisedLaplace
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// This file is part of Bembel, the higher order C++ boundary element library.
//
// Copyright (C) 2022 see <http://www.bembel.eu>
//
// It was written as part of a cooperation of J. Doelz, H. Harbrecht, S. Kurz,
// M. Multerer, S. Schoeps, and F. Wolf at Technische Universitaet Darmstadt,
// Universitaet Basel, and Universita della Svizzera italiana, Lugano. This
Expand Down
10 changes: 3 additions & 7 deletions Bembel/src/HomogenisedLaplace/Coefficients.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
#define POINT_DEGREE 20 /** the number of points on the surface of the cube */
#endif

#ifndef PI
#define PI M_PI
#endif

#include <Eigen/Dense>
#include <Bembel/HomogenisedLaplace>
#include <Bembel/Quadrature>
Expand Down Expand Up @@ -301,7 +297,7 @@ inline double k_mod(Eigen::Vector3d in) {
}
}

r /= (4 * PI);
r /= (4 * M_PI);

/* the part to ensure the vanishing mean on the Laplacian */
r += (in.dot(in)) / 6.0;
Expand Down Expand Up @@ -329,7 +325,7 @@ inline Eigen::Vector3d Dk_mod(Eigen::Vector3d in) {
}
}

r /= (4.0 * PI);
r /= (4.0 * M_PI);

/* the part to ensure the vanishing mean on the Laplacian */
r += in / 3.0;
Expand Down Expand Up @@ -382,7 +378,7 @@ double calculateFirstCoefficient(Eigen::VectorXd cs, unsigned int deg,

res += (1.0 / 24);

return -2.0 * sqrt(PI) * res;
return -2.0 * sqrt(M_PI) * res;
}

} /* namespace Bembel */
Expand Down
18 changes: 9 additions & 9 deletions Bembel/src/HomogenisedLaplace/SingleLayerOperator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,10 @@ struct LinearOperatorTraits<HomogenisedLaplaceSingleLayerOperator> {
/**
* \ingroup HomogenisedLaplace
*/
class HomogenisedLaplaceSingleLayerOperator: public LinearOperatorBase<
class HomogenisedLaplaceSingleLayerOperator : public LinearOperatorBase<
HomogenisedLaplaceSingleLayerOperator> {
// implementation of the kernel evaluation, which may be based on the
// information available from the superSpace
private:
/** The degree of the spherical harmonics expansion */
unsigned int deg;
/** The coefficients of the spherical harmonics expansion */
Eigen::VectorXd cs;
/** The precision of the periodicity of the kernel */
static double precision;

public:
/**
* \brief Constructs an object initialising the coefficients and the degree
Expand Down Expand Up @@ -143,6 +135,14 @@ class HomogenisedLaplaceSingleLayerOperator: public LinearOperatorBase<
static double getPrecision() {
return HomogenisedLaplaceSingleLayerOperator::precision;
}

private:
/** The degree of the spherical harmonics expansion */
unsigned int deg;
/** The coefficients of the spherical harmonics expansion */
Eigen::VectorXd cs;
/** The precision of the periodicity of the kernel */
static double precision;
};

double HomogenisedLaplaceSingleLayerOperator::precision = 0;
Expand Down
14 changes: 7 additions & 7 deletions Bembel/src/HomogenisedLaplace/SingleLayerPotential.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,11 @@ struct PotentialTraits<HomogenisedLaplaceSingleLayerPotential<LinOp>> {
* \ingroup HomogenisedLaplace
*/
template<typename LinOp>
class HomogenisedLaplaceSingleLayerPotential: public PotentialBase<
class HomogenisedLaplaceSingleLayerPotential : public PotentialBase<
HomogenisedLaplaceSingleLayerPotential<LinOp>, LinOp> {
// implementation of the kernel evaluation, which may be based on the
// information available from the superSpace

private:
/** The degree of the spherical harmonics expansion */
unsigned int deg;
/** The coefficients of the spherical harmonics expansion */
Eigen::VectorXd cs;

public:
/**
* \brief Constructs an object initialising the coefficients and the degree
Expand Down Expand Up @@ -90,6 +84,12 @@ class HomogenisedLaplaceSingleLayerPotential: public PotentialBase<
return k_mod(x - y)
+ evaluate_solid_sphericals(x - y, this->cs, this->deg, false);
}

private:
/** The degree of the spherical harmonics expansion */
unsigned int deg;
/** The coefficients of the spherical harmonics expansion */
Eigen::VectorXd cs;
};

} // namespace Bembel
Expand Down
6 changes: 3 additions & 3 deletions Bembel/src/util/Sphericals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <Eigen/Dense>

#if !defined pi
#define pi 3.1415926535897932385
#define pi BEMBEL_PI
#endif

namespace Bembel {
Expand Down Expand Up @@ -71,7 +71,7 @@ double evaluate_sphericals(Eigen::Vector3d x, Eigen::VectorXd cs,
double z1[2], z2[2], z3[2], z1_start[2];
double r, fac, rootTimesZ, root_2, root_3;

assert(abs(x.norm() - 1) < 1e-14);
assert(abs(x.norm() - 1) < Constants::generic_tolerance);

r = z1[1] = 0;
z1[0] = 0.5 / sqrt(pi);
Expand Down Expand Up @@ -216,7 +216,7 @@ Eigen::Vector3d evaluate_dsphericals(Eigen::Vector3d x, Eigen::VectorXd cs,
Eigen::Vector3d dr;
double fac, rootTimesZ, root_2, root_3;

assert(abs(x.norm() - 1) < 1e-14);
assert(abs(x.norm() - 1) < Constants::generic_tolerance);

z1[0] = sqrt(0.375 / pi);
z1[1] = 0;
Expand Down
4 changes: 2 additions & 2 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ set(CIFILES
LaplaceSingleLayerH2
HelmholtzSingleLayerFull
HelmholtzSingleLayerH2
HomogenisedLaplaceSingleLayerFull
HomogenisedLaplaceSingleLayerH2
HomogenisedLaplaceSingleLayerFull
HomogenisedLaplaceSingleLayerH2
MaxwellSingleLayerFull
MaxwellSingleLayerH2
)
Expand Down
6 changes: 3 additions & 3 deletions examples/HomogenisedLaplaceSingleLayerFull.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

#include <iostream>

#include "./Data.hpp"
#include "./Error.hpp"
#include "./Grids.hpp"
#include "examples/Data.hpp"
#include "examples/Error.hpp"
#include "examples/Grids.hpp"

int main() {
using Bembel::HomogenisedLaplaceSingleLayerOperator;
Expand Down
6 changes: 3 additions & 3 deletions examples/HomogenisedLaplaceSingleLayerH2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

#include <iostream>

#include "./Data.hpp"
#include "./Error.hpp"
#include "./Grids.hpp"
#include "examples/Data.hpp"
#include "examples/Error.hpp"
#include "examples/Grids.hpp"

int main() {
using Bembel::HomogenisedLaplaceSingleLayerOperator;
Expand Down
2 changes: 1 addition & 1 deletion tests/test_HomogenisedCoefficients.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <iostream>
#include <functional>

#include "./Test.hpp"
#include "tests/Test.hpp"

inline double k_per(Eigen::Vector3d in, Eigen::VectorXd coeffs,
unsigned int deg);
Expand Down

0 comments on commit 4727ca1

Please sign in to comment.