hp-FEM
Adaptive hp-FEM suite for nano-optics
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Functions | Variables
hpfem Namespace Reference

Namespaces

namespace  adaptivity
 
namespace  assembly
 
namespace  constants
 
namespace  fespace
 
namespace  io
 
namespace  materials
 
namespace  mesh
 
namespace  physics
 
namespace  pml
 
namespace  solvers
 

Classes

class  AnisotropicUnsupported
 
class  Cancelled
 Thrown by a solve whose progress callback returned false. More...
 
class  Error
 
class  InvalidArgument
 
class  NotImplemented
 
struct  ProgressEvent
 A phase of a solve starting (or, with step == num_steps, the solve being done). More...
 
class  ProgressReporter
 

Typedefs

using ProgressCallback = std::function< bool(const ProgressEvent &)>
 
using Timing = std::map< std::string, double >
 Wall-clock seconds per phase by name, plus "total".
 
using Real = double
 
using Complex = std::complex< double >
 
using Index = std::int64_t
 global indices (DoFs, entities)
 
using LocalIndex = std::int32_t
 element-local indices
 
using Vector = Eigen::Matrix< Complex, Eigen::Dynamic, 1 >
 
using RealVector = Eigen::Matrix< Real, Eigen::Dynamic, 1 >
 
using Matrix = Eigen::Matrix< Complex, Eigen::Dynamic, Eigen::Dynamic >
 
using RealMatrix = Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic >
 
using SparseMatrix = Eigen::SparseMatrix< Complex, Eigen::RowMajor, Index >
 
template<int Dim>
using Point = Eigen::Matrix< Real, Dim, 1 >
 

Functions

void assertion_failed (const char *expr, const char *file, int line, const std::string &msg)
 
spdlog::logger & log ()
 Returns the library logger. Usage: hpfem::log().debug("{} cells", n);
 
bool has_openmp () noexcept
 True if the library was built with OpenMP.
 
int num_threads () noexcept
 Number of threads a parallel loop uses (1 without OpenMP).
 
void set_num_threads (int threads) noexcept
 
int thread_index () noexcept
 Index of the calling thread inside a parallel loop, 0 outside.
 
template<class Body >
void parallel_for (Index n, Body &&body)
 
Real cyl_bessel_j (Real nu, Real x)
 
Real cyl_neumann (Real nu, Real x)
 
Real sph_bessel (unsigned order, Real x)
 Spherical Bessel function of the first kind \( j_n(x) \), x ≥ 0 (std::sph_bessel).
 
Real sph_neumann (unsigned order, Real x)
 Spherical Bessel function of the second kind \( y_n(x) \), x > 0 (std::sph_neumann).
 
Real bessel_j (int order, Real x)
 
Real bessel_y (int order, Real x)
 Bessel function of the second kind \( Y_n(x) \), x > 0, any integer order.
 
Real bessel_j_derivative (int order, Real x)
 Derivative \( J_n'(x) = J_{n-1}(x) - \frac{n}{x} J_n(x) \).
 
Complex hankel1 (int order, Real x)
 Hankel function of the first kind \( H_n^{(1)}(x) = J_n(x) + iY_n(x) \), x > 0.
 
Complex hankel1_derivative (int order, Real x)
 Derivative \( H_n^{(1)\prime}(x) = H_{n-1}^{(1)}(x) - \frac{n}{x} H_n^{(1)}(x) \).
 
Real spherical_bessel_j (int order, Real x)
 Spherical Bessel function of the first kind \( j_n(x) \), n ≥ 0, real x ≥ 0.
 
Real spherical_bessel_y (int order, Real x)
 Spherical Bessel function of the second kind \( y_n(x) \), n ≥ 0, x > 0.
 
Complex spherical_hankel1 (int order, Real x)
 
std::vector< Complex > spherical_bessel_j (int max_order, Complex z)
 
std::vector< Real > bessel_i_scaled (int max_order, Real x)
 
constexpr std::size_t as_size (Index i) noexcept
 Converts a non-negative global or local index to a container index.
 
std::string_view version () noexcept
 Library version as "major.minor.patch".
 

Variables

constexpr Complex kI {0.0, 1.0}
 
constexpr Index kInvalidIndex = -1
 "No entity" marker, e.g. the neighbour across a boundary facet.
 

Typedef Documentation

◆ Complex

using hpfem::Complex = typedef std::complex<double>

◆ Index

using hpfem::Index = typedef std::int64_t

global indices (DoFs, entities)

◆ LocalIndex

using hpfem::LocalIndex = typedef std::int32_t

element-local indices

◆ Matrix

using hpfem::Matrix = typedef Eigen::Matrix<Complex, Eigen::Dynamic, Eigen::Dynamic>

◆ Point

template<int Dim>
using hpfem::Point = typedef Eigen::Matrix<Real, Dim, 1>

◆ ProgressCallback

using hpfem::ProgressCallback = typedef std::function<bool(const ProgressEvent&)>

Return false to cancel: the solve stops before the phase and throws Cancelled. The callback runs on the calling thread between the phases, never inside a parallel loop.

◆ Real

using hpfem::Real = typedef double

◆ RealMatrix

using hpfem::RealMatrix = typedef Eigen::Matrix<Real, Eigen::Dynamic, Eigen::Dynamic>

◆ RealVector

using hpfem::RealVector = typedef Eigen::Matrix<Real, Eigen::Dynamic, 1>

◆ SparseMatrix

using hpfem::SparseMatrix = typedef Eigen::SparseMatrix<Complex, Eigen::RowMajor, Index>

◆ Timing

using hpfem::Timing = typedef std::map<std::string, double>

Wall-clock seconds per phase by name, plus "total".

◆ Vector

using hpfem::Vector = typedef Eigen::Matrix<Complex, Eigen::Dynamic, 1>

Function Documentation

◆ as_size()

constexpr std::size_t hpfem::as_size ( Index  i)
constexprnoexcept

Converts a non-negative global or local index to a container index.

◆ assertion_failed()

void hpfem::assertion_failed ( const char *  expr,
const char *  file,
int  line,
const std::string &  msg 
)

◆ bessel_i_scaled()

std::vector< Real > hpfem::bessel_i_scaled ( int  max_order,
Real  x 
)
inline

Exponentially scaled modified Bessel functions \( e^{-x} I_n(x) \) of the integer orders n = 0 … max_order for x ≥ 0 ( \( I_{-n} = I_n \)): Miller's backward recurrence \( I_{n-1} = \frac{2n}{x} I_n + I_{n+1} \), normalised by \( e^{-x}(I_0 + 2\sum_{k\ge1} I_k) = 1 \). Stable for every x (no overflow: the scaled values are ≤ 1); the start order \( N = n_{max} + 32 + \lceil\sqrt{80x}\rceil \) lies where \( e^{-x}I_N \) is below \( e^{-40} \) of the largest term. The azimuthal orders of a Gaussian off the axis.

Exceptions
InvalidArgumentfor max_order < 0 or x < 0.

◆ bessel_j()

Real hpfem::bessel_j ( int  order,
Real  x 
)
inline

Bessel function of the first kind \( J_n(x) \), any integer order ( \( J_{-n} = (-1)^n J_n \)).

◆ bessel_j_derivative()

Real hpfem::bessel_j_derivative ( int  order,
Real  x 
)
inline

Derivative \( J_n'(x) = J_{n-1}(x) - \frac{n}{x} J_n(x) \).

◆ bessel_y()

Real hpfem::bessel_y ( int  order,
Real  x 
)
inline

Bessel function of the second kind \( Y_n(x) \), x > 0, any integer order.

◆ cyl_bessel_j()

Real hpfem::cyl_bessel_j ( Real  nu,
Real  x 
)
inline

Bessel function of the first kind \( J_\nu(x) \) of real order ν ≥ 0, x ≥ 0 (std::cyl_bessel_j).

◆ cyl_neumann()

Real hpfem::cyl_neumann ( Real  nu,
Real  x 
)
inline

Bessel function of the second kind \( Y_\nu(x) \) of real order ν ≥ 0, x > 0 (std::cyl_neumann).

◆ hankel1()

Complex hpfem::hankel1 ( int  order,
Real  x 
)
inline

Hankel function of the first kind \( H_n^{(1)}(x) = J_n(x) + iY_n(x) \), x > 0.

◆ hankel1_derivative()

Complex hpfem::hankel1_derivative ( int  order,
Real  x 
)
inline

Derivative \( H_n^{(1)\prime}(x) = H_{n-1}^{(1)}(x) - \frac{n}{x} H_n^{(1)}(x) \).

◆ has_openmp()

bool hpfem::has_openmp ( )
noexcept

True if the library was built with OpenMP.

◆ log()

spdlog::logger & hpfem::log ( )
inline

Returns the library logger. Usage: hpfem::log().debug("{} cells", n);

◆ num_threads()

int hpfem::num_threads ( )
noexcept

Number of threads a parallel loop uses (1 without OpenMP).

◆ parallel_for()

template<class Body >
void hpfem::parallel_for ( Index  n,
Body &&  body 
)

Runs body(i, thread) for i in [0, n) on all threads with dynamic scheduling. An exception thrown by the body stops the loop (remaining indices are skipped) and is rethrown on the calling thread once all threads have finished; with several throwing bodies the first one caught wins.

◆ set_num_threads()

void hpfem::set_num_threads ( int  threads)
noexcept

Sets the number of threads of subsequent parallel loops (ignored without OpenMP; values < 1 restore the OpenMP default).

◆ sph_bessel()

Real hpfem::sph_bessel ( unsigned  order,
Real  x 
)
inline

Spherical Bessel function of the first kind \( j_n(x) \), x ≥ 0 (std::sph_bessel).

◆ sph_neumann()

Real hpfem::sph_neumann ( unsigned  order,
Real  x 
)
inline

Spherical Bessel function of the second kind \( y_n(x) \), x > 0 (std::sph_neumann).

◆ spherical_bessel_j() [1/2]

std::vector< Complex > hpfem::spherical_bessel_j ( int  max_order,
Complex  z 
)
inline

\( j_0(z), \dots, j_N(z) \) for complex z (e.g. inside an absorbing sphere) by downward recurrence \( j_{n-1} = \frac{2n+1}{z} j_n - j_{n+1} \) started well above N and normalised with \( j_0 = \sin z / z \) (stable for all orders, unlike the upward recurrence). For |z| < 1e-300 the limit \( j_n(0) = \delta_{n0} \) is returned.

Exceptions
InvalidArgumentfor max_order < 0.

◆ spherical_bessel_j() [2/2]

Real hpfem::spherical_bessel_j ( int  order,
Real  x 
)
inline

Spherical Bessel function of the first kind \( j_n(x) \), n ≥ 0, real x ≥ 0.

◆ spherical_bessel_y()

Real hpfem::spherical_bessel_y ( int  order,
Real  x 
)
inline

Spherical Bessel function of the second kind \( y_n(x) \), n ≥ 0, x > 0.

◆ spherical_hankel1()

Complex hpfem::spherical_hankel1 ( int  order,
Real  x 
)
inline

Spherical Hankel function of the first kind \( h_n^{(1)}(x) = j_n(x) + i y_n(x) \) (outgoing for exp(−iωt)), x > 0.

◆ thread_index()

int hpfem::thread_index ( )
inlinenoexcept

Index of the calling thread inside a parallel loop, 0 outside.

◆ version()

std::string_view hpfem::version ( )
noexcept

Library version as "major.minor.patch".

Variable Documentation

◆ kI

constexpr Complex hpfem::kI {0.0, 1.0}
inlineconstexpr

imaginary unit

◆ kInvalidIndex

constexpr Index hpfem::kInvalidIndex = -1
inlineconstexpr

"No entity" marker, e.g. the neighbour across a boundary facet.