LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
Loading...
Searching...
No Matches
Classes | Concepts | Typedefs | Enumerations | Functions | Variables
lf::base Namespace Reference

Contains basic functionality that is used by other parts of LehrFEM++. More...

Classes

class  AutoTimer
 Measures execution time between construction and destruction. AutoTimer can output either to a std::ostream or to a spdlog::logger More...
 
class  InvalidTypeException
 Thrown to signal that an argument passed to a function had the wrong (polymorphic) type. More...
 
struct  IsScalar
 Base Traits class which can be used to determine if a type T is a scalar value. More...
 
struct  IsScalar< std::complex< T >, std::enable_if_t< std::is_arithmetic_v< T > > >
 Also std::complex is a "scalar" type if the underlying type is a std::is_arithmetic type. More...
 
struct  IsScalar< T, std::enable_if_t< std::is_arithmetic_v< T > > >
 any type that is a std::is_arithmetic is also a scalar type. More...
 
class  LehrFemInfo
 Provides extra information about this version of LehrFEM++, in particular licensing information. More...
 
class  LfException
 A simple, general purpose exception class that is thrown by LehrFEM++ if something is wrong. More...
 
class  LineFeedFormatter
 A spdlog formatter which wraps another formatter and makes sure that if there are new lines (\n) in the log message, that the log message is still properly indented. More...
 
class  PredicateTrue
 A Function Object that can be invoked with any arguments and that always returns the value true. More...
 
class  RefEl
 Represents a reference element with all its properties. More...
 
class  Timer
 Timer class to measure time. More...
 

Concepts

concept  EigenMatrix
 Check if a given type T is an Eigen::Matrix.
 
concept  EigenArray
 Check if a given type T is a Eigen::Array<...>&
 
concept  Scalar
 Concept which is fulfilled if a type T is a scalar type, i.e. if it is a "field" in the mathematical sense.
 

Typedefs

using size_type = unsigned int
 general type for variables related to size of arrays
 
using glb_idx_t = unsigned int
 type for global index of mesh entities (nodes, edges, cells)
 
using sub_idx_t = unsigned int
 type for local indices of sub-entities
 
using dim_t = unsigned int
 type for dimensions and co-dimensions and numbers derived from them
 

Enumerations

enum class  RefElType : unsigned char { kPoint = 1 , kSegment = 2 , kTria = 3 , kQuad = 4 }
 An enum that defines all possible RefEl types. More...
 

Functions

void AssertionFailed (const std::string &expr, const std::string &file, long line, const std::string &msg)
 
template<class TO , class FROM >
auto narrow (FROM from) noexcept -> TO
 cast from to TO using static_cast. An assert will fail if this would change the value (e.g. because of overflow when an std::int64_t is converted to a std::int32_t)
 
void PrintInfo (std::ostream &stream, const RefEl &ref_el, int output_ctrl)
 
std::ostream & operator<< (std::ostream &stream, const RefEl &ref_el)
 Operator overload to print a RefEl to a stream, such as std::cout
 
std::shared_ptr< spdlog::logger > InitLogger (const std::string &name)
 Create a spdlog logger, register it in the spdlog registry and initialize it with LehrFEM++ specific settings.
 

Variables

const unsigned int kIdxNil = static_cast<unsigned int>(-1)
 Index flagged as invalid.
 
constexpr double kPi = 3.14159265358979323846
 

Detailed Description

Contains basic functionality that is used by other parts of LehrFEM++.

Enumeration Type Documentation

◆ RefElType

enum class lf::base::RefElType : unsigned char
strong

An enum that defines all possible RefEl types.

This enum is only rarely used direcly because there is a one-to-one relation between every enum value and an instance of the lf::base::RefEl class:

Also the enum representation is convertible into a lf::base::RefEl instance and back:

auto segment = RefEl(RefElType::kSegment);
Enumerator
kPoint 

Returns the (0-dimensional) reference point.

kSegment 

Returns the (1-dimensional) reference segment.

Node numbering with (1D) node coordinates

kTria 

Returns the reference triangle.

Node numbering with (2D) node coordinates and segment orientation.

kQuad 

Returns the reference quadrilateral.

Node numbering with (2D) node coordinates and segment orientation

Definition at line 31 of file ref_el.h.

Function Documentation

◆ AssertionFailed()

void lf::base::AssertionFailed ( const std::string & expr,
const std::string & file,
long line,
const std::string & msg )

Definition at line 12 of file lf_assert.cc.

◆ InitLogger()

std::shared_ptr< spdlog::logger > lf::base::InitLogger ( const std::string & name)

Create a spdlog logger, register it in the spdlog registry and initialize it with LehrFEM++ specific settings.

Parameters
nameThe name of the logger, is usually equal to the fully-scoped variable name, e.g. lf::mesh::hybrid2d::Mesh::Logger or lf::assemble::AssembleMatrixLogger
Returns
The initialized logger

LehrFEM++ uses spdlog loggers to provide the user with additional information about long running operations. These loggers are either associated with a class, in which case they are static, public member functions of this class (e.g. lf::mesh::hybrid2d::Mesh::Logger()) or they are associated with a free function in which case they are retrieved through a global free function lying in the same namespace as the free function (e.g. lf::assemble::AssembleMatrixLogger()).

You should use InitLogger() to initialize these loggers. In this way, we can set some sensible defaults for all LehrFEM++ loggers at one central location.

Note
So far a call to this method is essentially forwarded to spdlog::stdout_color_mt() and the formatter is set to a LineFeedFormatter.

Definition at line 16 of file spdlog_utils.cc.

Referenced by lf::assemble::AssembleMatrixLogger(), lf::fe::DiffusionElementMatrixProviderLogger(), lf::uscalfe::LinearFeLocalLoadVectorLogger(), lf::mesh::hybrid2d::Mesh::Logger(), lf::mesh::hybrid2d::MeshFactory::Logger(), lf::mesh::utils::TorusMeshBuilder::Logger(), lf::mesh::utils::TPQuadMeshBuilder::Logger(), lf::mesh::utils::TPTriagMeshBuilder::Logger(), lf::refinement::MeshHierarchy::Logger(), lf::uscalfe::LinearFELaplaceElementMatrix::Logger(), lf::fe::MassEdgeMatrixProviderLogger(), lf::uscalfe::MassEdgeMatrixProviderLogger(), lf::fe::MassElementMatrixProviderLogger(), lf::uscalfe::ReactionDiffusionElementMatrixProviderLogger(), lf::fe::ScalarLoadEdgeVectorProviderLogger(), lf::uscalfe::ScalarLoadEdgeVectorProviderLogger(), lf::fe::ScalarLoadElementVectorProviderLogger(), lf::uscalfe::ScalarLoadElementVectorProviderLogger(), and lf::mesh::test_utils::WatertightLogger().

◆ narrow()

template<class TO , class FROM >
auto lf::base::narrow ( FROM from) -> TO
noexcept

cast from to TO using static_cast. An assert will fail if this would change the value (e.g. because of overflow when an std::int64_t is converted to a std::int32_t)

Template Parameters
TOType to which we want to convert
FROMType from which we convert
Parameters
fromoriginal value
Returns
static_cast<TO>(std::forward<FROM>(from))

Definition at line 31 of file narrow.h.

◆ operator<<()

std::ostream & lf::base::operator<< ( std::ostream & stream,
const RefEl & ref_el )
inline

Operator overload to print a RefEl to a stream, such as std::cout

Parameters
streamThe stream to which this function should output
ref_elThe reference element to write to stream.
Returns
The stream itself.
Note
This function directly calls RefEl::ToString().

Usage example

Definition at line 535 of file ref_el.h.

References lf::base::RefEl::ToString().

◆ PrintInfo()

void lf::base::PrintInfo ( std::ostream & stream,
const RefEl & ref_el,
int output_ctrl )
related

Definition at line 17 of file ref_el.cc.

Variable Documentation

◆ kPi

constexpr double lf::base::kPi = 3.14159265358979323846
constexpr

Definition at line 39 of file types.h.

Referenced by lf::mesh::utils::TorusMeshBuilder::Build().