libMesh
include
numerics
const_fem_function.h
Go to the documentation of this file.
1
// The libMesh Finite Element Library.
2
// Copyright (C) 2002-2025 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3
4
// This library is free software; you can redistribute it and/or
5
// modify it under the terms of the GNU Lesser General Public
6
// License as published by the Free Software Foundation; either
7
// version 2.1 of the License, or (at your option) any later version.
8
9
// This library is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
// Lesser General Public License for more details.
13
14
// You should have received a copy of the GNU Lesser General Public
15
// License along with this library; if not, write to the Free Software
16
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18
#ifndef LIBMESH_CONST_FEM_FUNCTION_H
19
#define LIBMESH_CONST_FEM_FUNCTION_H
20
21
// libMesh includes
22
#include "libmesh/dense_vector.h"
23
#include "libmesh/fem_function_base.h"
24
#include "libmesh/int_range.h"
25
26
// C++ includes
27
#include <memory>
28
#include <string>
29
30
namespace
libMesh
31
{
32
33
// Forward declarations
34
class
Point;
35
44
template
<
typename
Output=Number>
45
class
ConstFEMFunction
:
public
FEMFunctionBase
<Output>
46
{
47
public
:
48
ConstFEMFunction
(
const
Output c) :
_c
(c) {}
49
53
ConstFEMFunction
(
ConstFEMFunction
&&) =
default
;
54
ConstFEMFunction
(
const
ConstFEMFunction
&) =
default
;
55
ConstFEMFunction
&
operator=
(
const
ConstFEMFunction
&) =
default
;
56
ConstFEMFunction
&
operator=
(
ConstFEMFunction
&&) =
default
;
57
virtual
~ConstFEMFunction
() =
default
;
58
59
virtual
std::unique_ptr<FEMFunctionBase<Output>>
clone
()
const override
60
{
return
std::make_unique<ConstFEMFunction>(*this); }
61
62
virtual
Output
operator()
(
const
FEMContext
&,
63
const
Point
&,
64
const
Real
/* time */
= 0.)
override
65
{
return
_c
; }
66
67
virtual
void
operator()
(
const
FEMContext
&,
68
const
Point
&,
69
const
Real
,
70
DenseVector<Output>
& output)
override
71
{
72
for
(
auto
i :
index_range
(output))
73
output(i) =
_c
;
74
}
75
76
private
:
77
Output
_c
;
78
};
79
80
}
// namespace libMesh;
81
82
83
#endif // LIBMESH_CONST_FEM_FUNCTION_H
libMesh::ConstFEMFunction::_c
Output _c
Definition:
const_fem_function.h:77
libMesh::ConstFEMFunction::ConstFEMFunction
ConstFEMFunction(const Output c)
Definition:
const_fem_function.h:48
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
libMesh::ConstFEMFunction::operator()
virtual Output operator()(const FEMContext &, const Point &, const Real=0.) override
Definition:
const_fem_function.h:62
libMesh::ConstFEMFunction::clone
virtual std::unique_ptr< FEMFunctionBase< Output > > clone() const override
Definition:
const_fem_function.h:59
libMesh::FEMContext
This class provides all data required for a physics package (e.g.
Definition:
fem_context.h:62
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition:
libmesh_common.h:144
libMesh::ConstFEMFunction::~ConstFEMFunction
virtual ~ConstFEMFunction()=default
libMesh::ConstFEMFunction
FEMFunction that returns a single value, regardless of the time and location inputs.
Definition:
const_fem_function.h:45
libMesh::DenseVector< Output >
libMesh::ConstFEMFunction::operator=
ConstFEMFunction & operator=(const ConstFEMFunction &)=default
libMesh::FEMFunctionBase
FEMFunctionBase is a base class from which users can derive in order to define "function-like" object...
Definition:
dirichlet_boundaries.h:43
libMesh::Point
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition:
point.h:39
libMesh::index_range
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition:
int_range.h:117
Generated on Thu Jul 17 2025 01:29:04 for libMesh by
1.8.14