File generator_context.hxx#

namespace bout

Provides access to the Hypre library, handling initialisation and finalisation.

Usage

#include <bout/hyprelib.hxx>

class MyClass { public:

private: HypreLib lib; };

This will then automatically initialise Hypre the first time an object is created, and finalise it when the last object is destroyed.

Copyright 2012 B.D.Dudson, S.Farley, M.V.Umansky, X.Q.Xu

Contact: Ben Dudson, bd512@york.ac.uk

This file is part of BOUT++.

BOUT++ is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

BOUT++ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with BOUT++. If not, see http://www.gnu.org/licenses/.

Explicit inversion of a 3x3 matrix a

If the matrix is singular (ill conditioned), the determinant is return. Otherwise, an empty std::optional is return

SNB model

namespace generator
class Context#

Public Functions

template<IND_TYPE N>
inline Context(const SpecificInd<N> &i, CELL_LOC loc, Mesh *msh, BoutReal t)#

Set using an index. Can be Ind2D, Ind3D or IndPerp.

inline Context(const Ind2D &i, CELL_LOC loc, Mesh *msh, BoutReal t)#
Context(int ix, int iy, int iz, CELL_LOC loc, Mesh *msh, BoutReal t)#

Specify a cell index, together with the cell location, mesh and time

Context(BoutReal x, BoutReal y, BoutReal z, Mesh *msh, BoutReal t)#

Specify the values directly.

Context() = default#

If constructed without parameters, contains no values (null). Requesting x,y,z or t throws an exception

Context(const BoundaryRegion *bndry, int iz, CELL_LOC loc, BoutReal t, Mesh *msh)#

The location on the boundary.

inline Context(const BoundaryRegion *bndry, CELL_LOC loc, BoutReal t, Mesh *msh)#
inline BoutReal x() const#
inline BoutReal y() const#
inline BoutReal z() const#
inline BoutReal t() const#
inline Context &set(const std::string &name, BoutReal value)#

Set the value of a parameter with given name.

template<typename ...Args>
inline Context &set(const std::string &name, BoutReal value, Args... args)#

Set multiple values, by passing alternating strings and values

eg. set(“x”, 1, “y”, 2)

inline BoutReal get(const std::string &name) const#

Retrieve a value previously set.

inline Mesh *getMesh() const#

Get the mesh for this context (position) If the mesh is null this will throw a BoutException (if CHECK >= 1)

Private Members

Mesh *localmesh = {nullptr}#

The mesh on which the position is defined.

std::map<std::string, BoutReal> parameters = {}#

Contains user-set values which can be set and retrieved.