27 #include "libmesh/function_base.h" 33 const std::string& prefix):
38 sys.system().get_mesh().sub_point_locator();
57 const libMesh::FEType&
60 return _system.variable_type(i);
70 libmesh_assert_equal_to(sol.size(),
_vars.size());
73 class SolutionFunction:
74 public libMesh::FunctionBase<Real> {
77 libMesh::FunctionBase<Real>() {
78 _sol.resize((
unsigned int)s.size());
79 for (
unsigned int i=0; i<s.size(); i++) _sol(i) = s(i);
84 libMesh::FunctionBase<Real>(),
87 virtual std::unique_ptr<libMesh::FunctionBase<Real> > clone ()
const {
88 libMesh::FunctionBase<Real> *rval =
new SolutionFunction(_sol);
89 return std::unique_ptr<libMesh::FunctionBase<Real> >(rval);
93 virtual Real operator()
94 (
const libMesh::Point& p,
const Real time) {libmesh_assert(
false);}
97 operator() (
const libMesh::Point& p,
99 libMesh::DenseVector<Real>& output) {
106 SolutionFunction sol_func(sol);
108 _system.project_solution(&sol_func);
118 class SolutionFunction:
119 public libMesh::FunctionBase<Real> {
121 SolutionFunction(
const unsigned int n_vars,
123 libMesh::FunctionBase<Real>(),
127 virtual std::unique_ptr<libMesh::FunctionBase<Real> > clone ()
const {
128 libMesh::FunctionBase<Real> *rval =
new SolutionFunction(_nvars, _sol);
129 return std::unique_ptr<libMesh::FunctionBase<Real> >(rval);
133 virtual Real operator()
134 (
const libMesh::Point& p,
const Real time) {libmesh_assert(
false);}
137 operator() (
const libMesh::Point& p,
139 libMesh::DenseVector<Real>& output) {
146 const unsigned int _nvars;
150 SolutionFunction sol_func(
_vars.size(), sol);
152 _system.project_solution(&sol_func);
void initialize_solution(const RealVectorX &sol)
initializes the FE solution vector to the constant solution provided in sol.
std::vector< unsigned int > _vars
This class implements a system for solution of nonlinear systems.
virtual ~SystemInitialization()
virtual destructor
unsigned int n_vars() const
SystemInitialization(MAST::NonlinearSystem &sys, const std::string &prefix)
initialize the variables in the provided system sys of order and family.
const libMesh::FEType & fetype(unsigned int i) const
libMesh::DenseVector< Real > DenseRealVector
void copy(DenseRealMatrix &m1, const RealMatrixX &m2)
Matrix< Real, Dynamic, 1 > RealVectorX
MAST::NonlinearSystem & _system