Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GlobalLinSysIterativeStaticCond.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: GlobalLinSysIterativeStaticCond.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: GlobalLinSysIterativeStaticCond header
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 #ifndef NEKTAR_LIB_MULTIREGIONS_GLOBALLINSYSITERATIVESTATICCOND_H
36 #define NEKTAR_LIB_MULTIREGIONS_GLOBALLINSYSITERATIVESTATICCOND_H
37 
42 
43 
44 namespace Nektar
45 {
46  namespace MultiRegions
47  {
48  // Forward declarations
49  class ExpList;
51 
52  typedef boost::shared_ptr<GlobalLinSysIterativeStaticCond>
54 
56  {
61  };
62 
63  const char* const LocalMatrixStorageStrategyMap[] =
64  {
65  "Contiguous",
66  "Non-contiguous",
67  "Sparse"
68  };
69 
70 
71  /// A global linear system.
73  virtual public GlobalLinSysStaticCond
74  {
75  public:
78  typedef boost::shared_ptr<DNekSmvBsrDiagBlkMat>
80 
81  /// Creates an instance of this class
83  const GlobalLinSysKey &pLinSysKey,
84  const boost::weak_ptr<ExpList> &pExpList,
85  const boost::shared_ptr<AssemblyMap> &pLocToGloMap)
86  {
89  AllocateSharedPtr(pLinSysKey, pExpList, pLocToGloMap);
90  p->InitObject();
91  return p;
92  }
93 
94  /// Name of class
95  static std::string className;
96  static std::string className2;
97 
98  /// Constructor for full direct matrix solve.
100  const GlobalLinSysKey &mkey,
101  const boost::weak_ptr<ExpList> &pExpList,
102  const boost::shared_ptr<AssemblyMap> &locToGloMap);
103 
104  /// Constructor for full direct matrix solve.
106  const GlobalLinSysKey &mkey,
107  const boost::weak_ptr<ExpList> &pExpList,
108  const DNekScalBlkMatSharedPtr pSchurCompl,
109  const DNekScalBlkMatSharedPtr pBinvD,
110  const DNekScalBlkMatSharedPtr pC,
111  const DNekScalBlkMatSharedPtr pInvD,
112  const boost::shared_ptr<AssemblyMap> &locToGloMap,
113  const PreconditionerSharedPtr pPrecon);
114 
116 
117  protected:
118  virtual DNekScalBlkMatSharedPtr v_GetStaticCondBlock(unsigned int n);
120  const GlobalLinSysKey &mkey,
121  const boost::weak_ptr<ExpList> &pExpList,
122  const DNekScalBlkMatSharedPtr pSchurCompl,
123  const DNekScalBlkMatSharedPtr pBinvD,
124  const DNekScalBlkMatSharedPtr pC,
125  const DNekScalBlkMatSharedPtr pInvD,
126  const boost::shared_ptr<AssemblyMap> &locToGloMap);
127 
129  int scLevel,
130  NekVector<NekDouble> &F_GlobBnd);
131  virtual void v_BasisTransform(
132  Array<OneD, NekDouble>& pInOut,
133  int offset);
134  virtual void v_BasisInvTransform(
135  Array<OneD, NekDouble>& pInOut);
136 
137  private:
139  /// Dense storage for block Schur complement matrix
140  std::vector<double> m_storage;
141  /// Vector of pointers to local matrix data
142  std::vector<const double*> m_denseBlocks;
143  /// Ranks of local matrices
144  Array<OneD, unsigned int> m_rows;
145  /// Scaling factors for local matrices
146  Array<OneD, NekDouble> m_scale;
147  /// Sparse representation of Schur complement matrix at this level
149  /// Utility strings
150  static std::string storagedef;
151  static std::string storagelookupIds[];
152 
153  virtual void v_InitObject();
154 
155  /// Assemble the Schur complement matrix.
157  const boost::shared_ptr<AssemblyMap> locToGloMap);
158 
159  /// Prepares local representation of Schur complement
160  /// stored as a sparse block-diagonal matrix.
162 
163  /// Perform a Shur-complement matrix multiply operation.
164  virtual void v_DoMatrixMultiply(
165  const Array<OneD, NekDouble>& pInput,
166  Array<OneD, NekDouble>& pOutput);
167 
168  virtual void v_UniqueMap();
169  };
170  }
171 }
172 
173 #endif