00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef LOCA_EIGENVALUESORT_STRATEGIES_H
00043 #define LOCA_EIGENVALUESORT_STRATEGIES_H
00044
00045 #include "Teuchos_RCP.hpp"
00046
00047 #include "NOX_Abstract_Group.H"
00048
00049
00050 namespace Teuchos {
00051 class ParameterList;
00052 }
00053 namespace LOCA {
00054 class GlobalData;
00055 }
00056
00057 namespace LOCA {
00058
00060 namespace EigenvalueSort {
00061
00063
00096 class AbstractStrategy {
00097
00098 public:
00099
00101 AbstractStrategy() {}
00102
00104 virtual ~AbstractStrategy() {}
00105
00107
00115 virtual NOX::Abstract::Group::ReturnType
00116 sort(int n, double* evals, std::vector<int>* perm = NULL) const = 0;
00117
00119
00129 virtual NOX::Abstract::Group::ReturnType
00130 sort(int n, double* r_evals, double* i_evals = NULL,
00131 std::vector<int>* perm = NULL) const = 0;
00132
00133 private:
00134
00136 AbstractStrategy(const AbstractStrategy&);
00137
00139 AbstractStrategy& operator = (const AbstractStrategy&);
00140
00141 };
00142
00144
00149 class LargestMagnitude : public AbstractStrategy {
00150
00151 public:
00152
00154
00158 LargestMagnitude(
00159 const Teuchos::RCP<LOCA::GlobalData>& global_data,
00160 const Teuchos::RCP<Teuchos::ParameterList>& eigenParams) {}
00161
00163 ~LargestMagnitude() {}
00164
00166 virtual NOX::Abstract::Group::ReturnType
00167 sort(int n, double* evals, std::vector<int>* perm = NULL) const;
00168
00170 virtual NOX::Abstract::Group::ReturnType
00171 sort(int n, double* r_evals, double* i_evals,
00172 std::vector<int>* perm = NULL) const;
00173
00174 private:
00175
00177 LargestMagnitude(const LargestMagnitude&);
00178
00180 LargestMagnitude& operator = (const LargestMagnitude&);
00181
00182 };
00183
00185
00190 class SmallestMagnitude : public AbstractStrategy {
00191
00192 public:
00193
00195
00199 SmallestMagnitude(
00200 const Teuchos::RCP<LOCA::GlobalData>& global_data,
00201 const Teuchos::RCP<Teuchos::ParameterList>& eigenParams) {}
00202
00204 ~SmallestMagnitude() {}
00205
00207 virtual NOX::Abstract::Group::ReturnType
00208 sort(int n, double* evals, std::vector<int>* perm = NULL) const;
00209
00211 virtual NOX::Abstract::Group::ReturnType
00212 sort(int n, double* r_evals, double* i_evals,
00213 std::vector<int>* perm = NULL) const;
00214
00215 private:
00216
00218 SmallestMagnitude(const SmallestMagnitude&);
00219
00221 SmallestMagnitude& operator = (const SmallestMagnitude&);
00222
00223 };
00224
00226
00231 class LargestReal : public AbstractStrategy {
00232
00233 public:
00234
00236
00240 LargestReal(
00241 const Teuchos::RCP<LOCA::GlobalData>& global_data,
00242 const Teuchos::RCP<Teuchos::ParameterList>& eigenParams) {}
00243
00245 ~LargestReal() {}
00246
00248 virtual NOX::Abstract::Group::ReturnType
00249 sort(int n, double* evals, std::vector<int>* perm = NULL) const;
00250
00252 virtual NOX::Abstract::Group::ReturnType
00253 sort(int n, double* r_evals, double* i_evals,
00254 std::vector<int>* perm = NULL) const;
00255
00256 private:
00257
00259 LargestReal(const LargestReal&);
00260
00262 LargestReal& operator = (const LargestReal&);
00263
00264 };
00265
00267
00272 class SmallestReal : public AbstractStrategy {
00273
00274 public:
00275
00277
00281 SmallestReal(
00282 const Teuchos::RCP<LOCA::GlobalData>& global_data,
00283 const Teuchos::RCP<Teuchos::ParameterList>& eigenParams) {}
00284
00286 ~SmallestReal() {}
00287
00289 virtual NOX::Abstract::Group::ReturnType
00290 sort(int n, double* evals, std::vector<int>* perm = NULL) const;
00291
00293 virtual NOX::Abstract::Group::ReturnType
00294 sort(int n, double* r_evals, double* i_evals,
00295 std::vector<int>* perm = NULL) const;
00296
00297 private:
00298
00300 SmallestReal(const SmallestReal&);
00301
00303 SmallestReal& operator = (const SmallestReal&);
00304
00305 };
00306
00308
00313 class LargestImaginary : public AbstractStrategy {
00314
00315 public:
00316
00318
00322 LargestImaginary(
00323 const Teuchos::RCP<LOCA::GlobalData>& global_data,
00324 const Teuchos::RCP<Teuchos::ParameterList>& eigenParams) {}
00325
00327 ~LargestImaginary() {}
00328
00330 virtual NOX::Abstract::Group::ReturnType
00331 sort(int n, double* evals, std::vector<int>* perm = NULL) const;
00332
00334 virtual NOX::Abstract::Group::ReturnType
00335 sort(int n, double* r_evals, double* i_evals,
00336 std::vector<int>* perm = NULL) const;
00337
00338 private:
00339
00341 LargestImaginary(const LargestImaginary&);
00342
00344 LargestImaginary& operator = (const LargestImaginary&);
00345
00346 };
00347
00349
00354 class SmallestImaginary : public AbstractStrategy {
00355
00356 public:
00357
00359
00363 SmallestImaginary(
00364 const Teuchos::RCP<LOCA::GlobalData>& global_data,
00365 const Teuchos::RCP<Teuchos::ParameterList>& eigenParams) {}
00366
00368 ~SmallestImaginary() {}
00369
00371 virtual NOX::Abstract::Group::ReturnType
00372 sort(int n, double* evals, std::vector<int>* perm = NULL) const;
00373
00375 virtual NOX::Abstract::Group::ReturnType
00376 sort(int n, double* r_evals, double* i_evals,
00377 std::vector<int>* perm = NULL) const;
00378
00379 private:
00380
00382 SmallestImaginary(const SmallestImaginary&);
00383
00385 SmallestImaginary& operator = (const SmallestImaginary&);
00386
00387 };
00388
00390
00396 class LargestRealInverseCayley : public AbstractStrategy {
00397
00398 public:
00399
00401
00405 LargestRealInverseCayley(
00406 const Teuchos::RCP<LOCA::GlobalData>& global_data,
00407 const Teuchos::RCP<Teuchos::ParameterList>& eigenParams);
00408
00410 ~LargestRealInverseCayley() {}
00411
00413 virtual NOX::Abstract::Group::ReturnType
00414 sort(int n, double* evals, std::vector<int>* perm = NULL) const;
00415
00417 virtual NOX::Abstract::Group::ReturnType
00418 sort(int n, double* r_evals, double* i_evals,
00419 std::vector<int>* perm = NULL) const;
00420
00421 protected:
00422
00424 double realLambda(double er, double ei) const;
00425
00426 private:
00427
00429 LargestRealInverseCayley(const LargestRealInverseCayley&);
00430
00432 LargestRealInverseCayley& operator = (const LargestRealInverseCayley&);
00433
00434 protected:
00435
00437 double sigma;
00438
00440 double mu;
00441
00442 };
00443
00444 }
00445
00446 }
00447
00448 #endif // LOCA_EIGENVALUESORT_STRATEGIES_H