MAST
complex_mesh_field_function.h
Go to the documentation of this file.
1 /*
2  * MAST: Multidisciplinary-design Adaptation and Sensitivity Toolkit
3  * Copyright (C) 2013-2019 Manav Bhatia
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #ifndef __mast__complex_mesh_field_function__
21 #define __mast__complex_mesh_field_function__
22 
23 // MAST includes
25 
26 
27 // libMesh includes
28 #include "libmesh/numeric_vector.h"
29 #include "libmesh/mesh_function.h"
30 
31 
32 
33 namespace MAST {
34 
35  // Forward declerations
36  class SystemInitialization;
37 
38 
44  public MAST::FieldFunction<ComplexVectorX> {
45 
46  public:
51  const std::string& nm);
52 
53 
57  virtual ~ComplexMeshFieldFunction();
58 
59 
60  virtual void operator() (const libMesh::Point& p,
61  const Real t,
62  ComplexVectorX& v) const;
63 
64 
65  virtual void perturbation (const libMesh::Point& p,
66  const Real t,
67  ComplexVectorX& v) const;
68 
69 
70  void init(const libMesh::NumericVector<Real>& sol_re,
71  const libMesh::NumericVector<Real>& sol_im);
72 
73 
74  void init_perturbation(const libMesh::NumericVector<Real>& dsol_re,
75  const libMesh::NumericVector<Real>& dsol_im);
76 
77 
81  std::pair<libMesh::MeshFunction*, libMesh::MeshFunction*>
83 
84  libmesh_assert(_function_re);
85 
86  return std::pair<libMesh::MeshFunction*, libMesh::MeshFunction*>
88  }
89 
94  std::pair<libMesh::MeshFunction*, libMesh::MeshFunction*>
96 
97  libmesh_assert(_perturbed_function_re);
98 
99  return std::pair<libMesh::MeshFunction*, libMesh::MeshFunction*>
101  }
102 
103 
107  void clear();
108 
109  protected:
110 
115 
119  libMesh::NumericVector<Real>
121  *_sol_im,
124 
128  libMesh::MeshFunction
130  *_function_im,
133 
134  };
135 }
136 
137 #endif // __mast__complex_mesh_field_function__
138 
libMesh::NumericVector< Real > * _sol_im
libMesh::NumericVector< Real > * _perturbed_sol_im
void init_perturbation(const libMesh::NumericVector< Real > &dsol_re, const libMesh::NumericVector< Real > &dsol_im)
std::pair< libMesh::MeshFunction *, libMesh::MeshFunction * > get_perturbed_function()
libMesh::MeshFunction * _function_re
the MeshFunction object that performs the interpolation
Matrix< Complex, Dynamic, 1 > ComplexVectorX
libMesh::Real Real
void clear()
clear the solution and mesh function data structures
libMesh::NumericVector< Real > * _perturbed_sol_re
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...
This provides a wrapper FieldFunction compatible class that interpolates the solution using libMesh&#39;s...
std::pair< libMesh::MeshFunction *, libMesh::MeshFunction * > get_function()
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