libMesh
examples
adjoints
adjoints_ex2
L-shaped.h
Go to the documentation of this file.
1
#include "libmesh/enum_fe_family.h"
2
#include "libmesh/fem_system.h"
3
#include "libmesh/parameter_vector.h"
4
#include "libmesh/qoi_set.h"
5
#include "libmesh/system.h"
6
#include "libmesh/parameter_pointer.h"
7
#include "libmesh/auto_ptr.h"
// libmesh_make_unique
8
9
// Bring in everything from the libMesh namespace
10
using namespace
libMesh
;
11
12
// FEMSystem, TimeSolver and NewtonSolver will handle most tasks,
13
// but we must specify element residuals
14
class
LaplaceSystem
:
public
FEMSystem
15
{
16
public
:
17
// Constructor
18
LaplaceSystem
(
EquationSystems
& es,
19
const
std::string & name_in,
20
const
unsigned
int
number_in)
21
:
FEMSystem
(es, name_in, number_in),
22
_fe_family(
"LAGRANGE"
),
23
_fe_order(1),
24
_analytic_jacobians(true)
25
{}
26
27
std::string &
fe_family
() {
return
_fe_family; }
28
unsigned
int
&
fe_order
() {
return
_fe_order; }
29
bool
&
analytic_jacobians
() {
return
_analytic_jacobians; }
30
31
Number
&
get_parameter_value
(
unsigned
int
parameter_index)
32
{
33
return
parameters[parameter_index];
34
}
35
36
ParameterVector
&
get_parameter_vector
()
37
{
38
parameter_vector.
clear
();
39
for
(std::size_t i = 0; i != parameters.size(); ++i)
40
parameter_vector.push_back(libmesh_make_unique<
ParameterPointer<Number>
>(¶meters[i]));
41
42
return
parameter_vector;
43
}
44
45
protected
:
46
// System initialization
47
virtual
void
init_data ();
48
49
// Context initialization
50
virtual
void
init_context (
DiffContext
& context);
51
52
// Element residual and jacobian calculations
53
// Time dependent parts
54
virtual
bool
element_time_derivative (
bool
request_jacobian,
55
DiffContext
& context);
56
57
// Constraint parts
58
virtual
bool
side_constraint (
bool
request_jacobian,
59
DiffContext
& context);
60
61
Number
exact_solution
(
const
Point
&);
62
63
// Parameters associated with the system
64
std::vector<Number>
parameters
;
65
66
// The ParameterVector object that will contain pointers to
67
// the system parameters
68
ParameterVector
parameter_vector
;
69
70
// The FE type to use
71
std::string _fe_family;
72
unsigned
int
_fe_order;
73
74
// Calculate Jacobians analytically or not?
75
bool
_analytic_jacobians;
76
};
libMesh::Number
Real Number
Definition:
libmesh_common.h:195
exact_solution
Number(* exact_solution)(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition:
adaptivity_ex4.C:132
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition:
factoryfunction.C:55
LaplaceSystem::LaplaceSystem
LaplaceSystem(EquationSystems &es, const std::string &name_in, const unsigned int number_in)
Definition:
L-shaped.h:18
libMesh::FEMSystem
This class provides a specific system class.
Definition:
fem_system.h:53
LaplaceSystem::analytic_jacobians
bool & analytic_jacobians()
Definition:
L-shaped.h:29
LaplaceSystem::get_parameter_value
Number & get_parameter_value(unsigned int parameter_index)
Definition:
L-shaped.h:31
LaplaceSystem::parameter_vector
ParameterVector parameter_vector
Definition:
L-shaped.h:68
LaplaceSystem
Definition:
L-shaped.h:11
libMesh::Point
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition:
point.h:38
libMesh::ParameterVector
Data structure for specifying which Parameters should be independent variables in a parameter sensiti...
Definition:
parameter_vector.h:44
libMesh::ParameterVector::clear
void clear()
Resets to "no parameters".
Definition:
parameter_vector.h:170
LaplaceSystem::fe_order
unsigned int & fe_order()
Definition:
L-shaped.h:28
libMesh::DiffContext
This class provides all data required for a physics package (e.g.
Definition:
diff_context.h:55
libMesh::EquationSystems
This is the EquationSystems class.
Definition:
equation_systems.h:74
libMesh::ParameterPointer
Accessor object allowing reading and modification of the independent variables in a parameter sensiti...
Definition:
parameter_pointer.h:45
LaplaceSystem::get_parameter_vector
ParameterVector & get_parameter_vector()
Definition:
L-shaped.h:36
LaplaceSystem::parameters
std::vector< Number > parameters
Definition:
L-shaped.h:64
LaplaceSystem::fe_family
std::string & fe_family()
Definition:
L-shaped.h:27
Generated on Sat Jan 25 2020 12:06:50 for libMesh by
1.8.16