Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DriverModifiedArnoldi.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File DriverModifiedArnoldi.h
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Driver class for eigenvalue analysis using the modified Arnoldi
33 // method.
34 //
35 ///////////////////////////////////////////////////////////////////////////////
36 
37 #ifndef NEKTAR_SOLVERUTILS_DRIVERMODIFIEDARNOLDI_H
38 #define NEKTAR_SOLVERUTILS_DRIVERMODIFIEDARNOLDI_H
39 
41 
42 namespace Nektar
43 {
44 namespace SolverUtils
45 {
46 
48 {
49  public:
51 
52  /// Creates an instance of this class
55  {
57  ::AllocateSharedPtr(pSession);
58  p->InitObject();
59  return p;
60  }
61 
62  ///Name of the class
63  static std::string className;
64 
65  protected:
66 
67  /// Constructor
69 
70  /// Destructor
71  virtual ~DriverModifiedArnoldi();
72 
73  /// Virtual function for initialisation implementation.
74  virtual void v_InitObject(ostream &out = cout );
75 
76  /// Virtual function for solve implementation.
77  virtual void v_Execute(ostream &out = cout);
78 
79  private:
80  /// Generates a new vector in the sequence by applying the linear operator.
83 
84  /// Generates the upper Hessenberg matrix H and computes its eigenvalues.
86  const int ntot,
87  const Array<OneD, NekDouble> &alpha,
88  const int kdim,
92  NekDouble &resnorm);
93 
94  /// Tests for convergence of eigenvalues of H.
95  int EV_test( const int itrn,
96  const int kdim,
100  const NekDouble resnorm,
101  const int nvec,
102  ofstream &evlout,
103  NekDouble &resid0);
104 
105 
106  /// Sorts a sequence of eigenvectors/eigenvalues by magnitude.
107  void EV_sort( Array<OneD, NekDouble> &evec,
111  const int dim);
112 
113  void EV_post( Array<OneD, Array<OneD, NekDouble> > &Tseq,
115  const int ntot,
116  const int kdim,
117  const int nvec,
121  const int icon);
122 
123  void EV_big( Array<OneD, Array<OneD, NekDouble> > &bvecs,
125  const int ntot,
126  const int kdim,
127  const int nvec,
131 
132  static std::string driverLookupId;
133 };
134 
135 }
136 }
137 
138 #endif //NEKTAR_SOLVERS_AUXILIARY_ADRBASE_H
139 
virtual void v_InitObject(ostream &out=cout)
Virtual function for initialisation implementation.
boost::shared_ptr< Driver > DriverSharedPtr
A shared pointer to a Driver object.
Definition: Driver.h:52
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
static std::string className
Name of the class.
void EV_small(Array< OneD, Array< OneD, NekDouble > > &Kseq, const int ntot, const Array< OneD, NekDouble > &alpha, const int kdim, Array< OneD, NekDouble > &zvec, Array< OneD, NekDouble > &wr, Array< OneD, NekDouble > &wi, NekDouble &resnorm)
Generates the upper Hessenberg matrix H and computes its eigenvalues.
DriverModifiedArnoldi(const LibUtilities::SessionReaderSharedPtr pSession)
Constructor.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
void EV_sort(Array< OneD, NekDouble > &evec, Array< OneD, NekDouble > &wr, Array< OneD, NekDouble > &wi, Array< OneD, NekDouble > &test, const int dim)
Sorts a sequence of eigenvectors/eigenvalues by magnitude.
void EV_update(Array< OneD, NekDouble > &src, Array< OneD, NekDouble > &tgt)
Generates a new vector in the sequence by applying the linear operator.
static DriverSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession)
Creates an instance of this class.
virtual void v_Execute(ostream &out=cout)
Virtual function for solve implementation.
double NekDouble
void EV_post(Array< OneD, Array< OneD, NekDouble > > &Tseq, Array< OneD, Array< OneD, NekDouble > > &Kseq, const int ntot, const int kdim, const int nvec, Array< OneD, NekDouble > &zvec, Array< OneD, NekDouble > &wr, Array< OneD, NekDouble > &wi, const int icon)
void EV_big(Array< OneD, Array< OneD, NekDouble > > &bvecs, Array< OneD, Array< OneD, NekDouble > > &evecs, const int ntot, const int kdim, const int nvec, Array< OneD, NekDouble > &zvec, Array< OneD, NekDouble > &wr, Array< OneD, NekDouble > &wi)
Base class for the development of solvers.
Definition: DriverArnoldi.h:47
int EV_test(const int itrn, const int kdim, Array< OneD, NekDouble > &zvec, Array< OneD, NekDouble > &wr, Array< OneD, NekDouble > &wi, const NekDouble resnorm, const int nvec, ofstream &evlout, NekDouble &resid0)
Tests for convergence of eigenvalues of H.