26 #include "libmesh/dof_map.h" 27 #include "libmesh/numeric_vector.h" 32 const std::string& nm):
37 _perturbed_sol_re(nullptr),
38 _perturbed_sol_im(nullptr),
39 _function_re(nullptr),
40 _function_im(nullptr),
41 _perturbed_function_re(nullptr),
42 _perturbed_function_im(nullptr)
59 init(
const libMesh::NumericVector<Real>& sol_re,
60 const libMesh::NumericVector<Real>& sol_im) {
68 _sol_re = libMesh::NumericVector<Real>::build(system.comm()).release();
69 _sol_im = libMesh::NumericVector<Real>::build(system.comm()).release();
71 const std::vector<libMesh::dof_id_type>& send_list =
72 system.get_dof_map().get_send_list();
89 _sol_re->init(sol_re.size(),
true, libMesh::SERIAL);
91 _sol_im->init(sol_im.size(),
true, libMesh::SERIAL);
96 _function_re =
new libMesh::MeshFunction(system.get_equation_systems(),
102 _function_im =
new libMesh::MeshFunction(system.get_equation_systems(),
104 system.get_dof_map(),
115 const libMesh::NumericVector<Real>& sol_im) {
123 _perturbed_sol_re = libMesh::NumericVector<Real>::build(system.comm()).release();
124 _perturbed_sol_im = libMesh::NumericVector<Real>::build(system.comm()).release();
126 const std::vector<libMesh::dof_id_type>& send_list =
127 system.get_dof_map().get_send_list();
152 system.get_dof_map(),
158 system.get_dof_map(),
175 (*_function_re)(p, t, v_re);
176 (*_function_im)(p, t, v_im);
180 libmesh_assert(v_re.size());
183 v = ComplexVectorX::Zero(v_re.size());
184 for (
unsigned int i=0; i<v_re.size(); i++)
185 v(i) = std::complex<Real>(v_re(i), v_im(i));
201 (*_perturbed_function_re)(p, t, v_re);
202 (*_perturbed_function_im)(p, t, v_im);
206 libmesh_assert(v_re.size());
209 v = ComplexVectorX::Zero(v_re.size());
210 for (
unsigned int i=0; i<v_re.size(); i++)
211 v(i) = std::complex<Real>(v_re(i), v_im(i));
libMesh::NumericVector< Real > * _sol_im
const std::vector< unsigned int > vars() const
MAST::NonlinearSystem & system()
libMesh::NumericVector< Real > * _perturbed_sol_im
This class implements a system for solution of nonlinear systems.
void init_perturbation(const libMesh::NumericVector< Real > &dsol_re, const libMesh::NumericVector< Real > &dsol_im)
libMesh::MeshFunction * _function_re
the MeshFunction object that performs the interpolation
virtual ~ComplexMeshFieldFunction()
destructor
Matrix< Complex, Dynamic, 1 > ComplexVectorX
libMesh::MeshFunction * _function_im
void clear()
clear the solution and mesh function data structures
libMesh::NumericVector< Real > * _perturbed_sol_re
libMesh::DenseVector< Real > DenseRealVector
virtual void operator()(const libMesh::Point &p, const Real t, ComplexVectorX &v) const
calculates the value of the function at the specified point, p, and time, t, and returns it in v...
libMesh::MeshFunction * _perturbed_function_im
This creates the base class for functions that have a saptial and temporal dependence, and provide sensitivity operations with respect to the functions and parameters.
virtual void perturbation(const libMesh::Point &p, const Real t, ComplexVectorX &v) const
calculates the value of a perturbation in function at the specified point, p, and time...
void init(const libMesh::NumericVector< Real > &sol_re, const libMesh::NumericVector< Real > &sol_im)
libMesh::NumericVector< Real > * _sol_re
current solution that is going to be interpolated
libMesh::MeshFunction * _perturbed_function_re
MAST::SystemInitialization * _system
current system for which solution is to be interpolated
ComplexMeshFieldFunction(MAST::SystemInitialization &sys, const std::string &nm)
constructor