Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GlobalOptimizationParameters.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File GlobalOptimizationParameters.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: Header file of global optimisation parameters class
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_LIB_MULTIREGIONS_GLOBALOPTIMIZATIONPARAMETERS_H
37 #define NEKTAR_LIB_MULTIREGIONS_GLOBALOPTIMIZATIONPARAMETERS_H
42 
43 namespace Nektar
44 {
45  namespace NekOptimize
46  {
47  // enumeration of all operations that are optimisable
49  {
61  };
62 
63  const char* const OptimizationOperationTypeMap[] =
64  {
65  "BwdTrans",
66  "IProductWRTBase",
67  "IProductWRTDerivBase",
68  "MassMatrixOp",
69  "LaplacianMatrixOp",
70  "LaplacianMatrixIJOp",
71  "WeakDerivMatrixOp",
72  "HelmholtzMatrixOp",
73  "HybridDGHelmBndLamMatrixOp",
74  "LinearAdvectionReactionOp"
75  };
76 
77  /// Processes global optimisation parameters from a session.
79  {
80  public:
81  /// Default constructor requires nel be given
82  MULTI_REGIONS_EXPORT GlobalOptParam(const int nel);
83 
84  /// Read optimisation parameters from a given file.
85  MULTI_REGIONS_EXPORT GlobalOptParam(const LibUtilities::SessionReaderSharedPtr& pSession, const int dim, const Array<OneD, const int> &NumShapeElements);
86 
87  /// For a given matrix type, determines if the operation should
88  /// be done globally.
89  // inline
91 
92 
93  /// For a given matrix type, determines if the operation should be
94  /// done with a block matrix
95  // inline
96  inline const Array<OneD, const bool> &DoBlockMatOp(const StdRegions::MatrixType i) const;
97 
99  inline const Array<OneD, const int> &GetShapeNumElements() const;
100 
101  private:
102  /// Default constructor should not be called
104 
105  /// Flags indicating if different matrices should be evaluated
106  /// globally.
108 
109  /// Array of Flags of first dimension of the number of
110  /// shapes within the space dimension, indicating if
111  /// different matrices should be evaluated using a block
112  /// matrix
114 
115  /// A list ExpansionTypes indicating the order in which
116  /// shapes are listed to call the appropriate key for the
117  /// block matrices.
119 
120  /// A list of number of elements contained within each shape type
122  };
123 
124  /// Pointer to a GlobalOptParam object.
125  typedef boost::shared_ptr<GlobalOptParam> GlobalOptParamSharedPtr;
126 
127  /// Pointer to an empty GlobalOptParam object.
128  static GlobalOptParamSharedPtr NullGlobalOptParamSharedPtr;
129 
130 
131  /**
132  * Determines the elemental optimisation type enum, given the
133  * MatrixType and returns the corresponding entry in the table.
134  * @param i Type of matrix.
135  * @returns True if this type of matrix should be evaluated globally.
136  */
138  {
140  switch(i)
141  {
143  {
144  type = eBwdTrans;
145  }
146  break;
148  {
149  type = eIProductWRTBase;
150  }
151  break;
152  case StdRegions::eMass:
153  {
154  type = eMassMatrixOp;
155  }
156  break;
158  {
159  type = eHelmholtzMatrixOp;
160  }
161  break;
163  {
164  type = eLaplacianMatrixOp;
165  }
166  break;
168  {
170  }
171  break;
173  {
175  }
176  break;
177  default:
178  {
179  ASSERTL0(false,"Optimisation suite not set up for this type"
180  " of matrix");
181  }
182  }
183  return m_doGlobalMatOp[type];
184  }
185 
186  /**
187  * Determines the elemental optimisation type enum, given the
188  * MatrixType and returns the corresponding entry in the table.
189  * @param i Type of matrix.
190  * @returns True if this type of matrix should be evaluated in block
191  * form.
192  */
194  {
196  switch(i)
197  {
199  {
200  type = eBwdTrans;
201  }
202  break;
204  {
205  type = eIProductWRTBase;
206  }
207  break;
208  case StdRegions::eMass:
209  {
210  type = eMassMatrixOp;
211  }
212  break;
214  {
215  type = eHelmholtzMatrixOp;
216  }
217  break;
219  {
220  type = eLaplacianMatrixOp;
221  }
222  break;
224  {
226  }
227  break;
229  {
231  }
232  break;
233  default:
234  {
235  ASSERTL0(false,"Optimisation suite not set up for this type"
236  " of matrix");
237  }
238  }
239 
240  return m_doBlockMatOp[type];
241  }
242 
244  {
245  return m_shapeNumElements;
246  }
247 
249  {
250  return m_shapeList;
251  }
252 
253 
254 
255  } // end of namespace
256 } // end of namespace
257 
258 #endif //NEKTAR_LIB_STDREGIONS_OPTIMIZATIONPARAMETERSACCESS_H
259 
260 
const char *const OptimizationOperationTypeMap[]
Array< OneD, const int > m_shapeNumElements
A list of number of elements contained within each shape type.
const Array< OneD, const int > & GetShapeNumElements() const
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
Array< OneD, Array< OneD, bool > > m_doBlockMatOp
Array of Flags of first dimension of the number of shapes within the space dimension, indicating if different matrices should be evaluated using a block matrix.
const Array< OneD, const LibUtilities::ShapeType > & GetShapeList() const
#define MULTI_REGIONS_EXPORT
bool DoGlobalMatOp(const StdRegions::MatrixType i) const
For a given matrix type, determines if the operation should be done globally.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
boost::shared_ptr< GlobalOptParam > GlobalOptParamSharedPtr
Pointer to a GlobalOptParam object.
const Array< OneD, const bool > & DoBlockMatOp(const StdRegions::MatrixType i) const
For a given matrix type, determines if the operation should be done with a block matrix.
Array< OneD, bool > m_doGlobalMatOp
Flags indicating if different matrices should be evaluated globally.
Processes global optimisation parameters from a session.
static GlobalOptParamSharedPtr NullGlobalOptParamSharedPtr
Pointer to an empty GlobalOptParam object.
Array< OneD, LibUtilities::ShapeType > m_shapeList
A list ExpansionTypes indicating the order in which shapes are listed to call the appropriate key for...
GlobalOptParam()
Default constructor should not be called.