MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MueLu_AlgebraicPermutationStrategy_decl.hpp
Go to the documentation of this file.
1 /*
2  * MueLu_AlgebraicPermutationStrategy_decl.hpp
3  *
4  * Created on: Feb 20, 2013
5  * Author: tobias
6  */
7 
8 #ifndef MUELU_ALGEBRAICPERMUTATIONSTRATEGY_DECL_HPP_
9 #define MUELU_ALGEBRAICPERMUTATIONSTRATEGY_DECL_HPP_
10 
11 #include <Xpetra_Matrix_fwd.hpp>
12 #include <Xpetra_Vector_fwd.hpp>
15 #include <Xpetra_Export_fwd.hpp>
17 #include <Xpetra_Import_fwd.hpp>
18 
19 #include "MueLu_ConfigDefs.hpp"
20 #include "MueLu_Level.hpp"
21 #include "MueLu_BaseClass.hpp"
22 
23 namespace MueLu {
24 
25 // template struct for comparing pairs
26 template <class Scalar = DefaultScalar, class LocalOrdinal = DefaultGlobalOrdinal>
27 struct CompPairs {
28  CompPairs(const std::vector<Scalar>& v)
29  : vinternal_(v) {}
30  std::vector<Scalar> vinternal_;
32  // return vinternal_[a] < vinternal_[b];
34  }
35 };
36 
37 // template function for comparison
38 template <class Scalar, class LocalOrdinal>
39 CompPairs<Scalar, LocalOrdinal> CreateCmpPairs(const std::vector<Scalar>& v) {
41 }
42 
43 // template function for sorting permutations
44 template <class Scalar, class LocalOrdinal>
45 void sortingPermutation(const std::vector<Scalar>& values, std::vector<LocalOrdinal>& v) {
46  size_t size = values.size();
47  v.clear();
48  v.reserve(size);
49  for (size_t i = 0; i < size; ++i)
50  v.push_back(i);
51 
52  std::sort(v.begin(), v.end(), MueLu::CreateCmpPairs<Scalar, LocalOrdinal>(values));
53 }
54 
56 
62 template <class Scalar = DefaultScalar,
65  class Node = DefaultNode>
66 class AlgebraicPermutationStrategy : public BaseClass {
67 #undef MUELU_ALGEBRAICPERMUTATIONSTRATEGY_SHORT
68 #include "MueLu_UseShortNames.hpp"
69  public:
75 
77 
79 
94  void BuildPermutation(const Teuchos::RCP<Matrix>& A, const Teuchos::RCP<const Map>& permRowMap,
95  Level& currentLevel, const FactoryBase* genFactory) const;
96 
98 
99  private:
100 };
101 
102 } // namespace MueLu
103 
104 #define MUELU_ALGEBRAICPERMUTATIONSTRATEGY_SHORT
105 
106 #endif /* MUELU_ALGEBRAICPERMUTATIONSTRATEGY_DECL_HPP_ */
void BuildPermutation(const Teuchos::RCP< Matrix > &A, const Teuchos::RCP< const Map > &permRowMap, Level &currentLevel, const FactoryBase *genFactory) const
build permutation operators
MueLu::DefaultLocalOrdinal LocalOrdinal
Tpetra::KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
void sortingPermutation(const std::vector< Scalar > &values, std::vector< LocalOrdinal > &v)
MueLu::DefaultNode Node
bool operator()(LocalOrdinal a, LocalOrdinal b)
MueLu::DefaultScalar Scalar
Tpetra::Details::DefaultTypes::scalar_type DefaultScalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
CompPairs(const std::vector< Scalar > &v)
Class which defines local permutations of matrix columns.
static magnitudeType magnitude(T a)
CompPairs< Scalar, LocalOrdinal > CreateCmpPairs(const std::vector< Scalar > &v)