MueLu Version of the Day
Loading...
Searching...
No Matches
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>
13#include <Xpetra_VectorFactory_fwd.hpp>
14#include <Xpetra_CrsMatrixWrap_fwd.hpp>
15#include <Xpetra_Export_fwd.hpp>
16#include <Xpetra_ExportFactory_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
23namespace MueLu {
24
25// template struct for comparing pairs
26template<class Scalar = DefaultScalar, class LocalOrdinal = DefaultGlobalOrdinal>
27struct CompPairs {
28 CompPairs(const std::vector<Scalar> & v) : vinternal_(v) {}
29 std::vector<Scalar> vinternal_;
31 //return vinternal_[a] < vinternal_[b];
32 return Teuchos::ScalarTraits<Scalar>::magnitude(vinternal_[a]) > Teuchos::ScalarTraits<Scalar>::magnitude(vinternal_[b]);
33 }
34};
35
36// template function for comparison
37template<class Scalar, class LocalOrdinal>
38CompPairs<Scalar,LocalOrdinal> CreateCmpPairs(const std::vector<Scalar> & v) {
40}
41
42// template function for sorting permutations
43template<class Scalar, class LocalOrdinal>
44void sortingPermutation(const std::vector<Scalar> & values, std::vector<LocalOrdinal> & v) {
45 size_t size = values.size();
46 v.clear(); v.reserve(size);
47 for(size_t i=0; i<size; ++i)
48 v.push_back(i);
49
50 std::sort(v.begin(),v.end(), MueLu::CreateCmpPairs<Scalar,LocalOrdinal>(values));
51}
52
54
59
60 template <class Scalar = DefaultScalar,
63 class Node = DefaultNode>
65#undef MUELU_ALGEBRAICPERMUTATIONSTRATEGY_SHORT
67 public:
68
73
75
76
78
93 void BuildPermutation(const Teuchos::RCP<Matrix> & A, const Teuchos::RCP<const Map>& permRowMap,
94 Level & currentLevel, const FactoryBase* genFactory) const;
95
97
98
99 private:
100 };
101
102} // namespace MueLu
103
104#define MUELU_ALGEBRAICPERMUTATIONSTRATEGY_SHORT
105
106
107#endif /* MUELU_ALGEBRAICPERMUTATIONSTRATEGY_DECL_HPP_ */
MueLu::DefaultLocalOrdinal LocalOrdinal
MueLu::DefaultScalar Scalar
MueLu::DefaultGlobalOrdinal GlobalOrdinal
MueLu::DefaultNode Node
void BuildPermutation(const Teuchos::RCP< Matrix > &A, const Teuchos::RCP< const Map > &permRowMap, Level &currentLevel, const FactoryBase *genFactory) const
build permutation operators
Base class for MueLu classes.
Base class for factories (e.g., R, P, and A_coarse).
Class that holds all level-specific information.
Namespace for MueLu classes and methods.
void sortingPermutation(const std::vector< Scalar > &values, std::vector< LocalOrdinal > &v)
Tpetra::KokkosClassic::DefaultNode::DefaultNodeType DefaultNode
Tpetra::Details::DefaultTypes::scalar_type DefaultScalar
CompPairs< Scalar, LocalOrdinal > CreateCmpPairs(const std::vector< Scalar > &v)
CompPairs(const std::vector< Scalar > &v)
bool operator()(LocalOrdinal a, LocalOrdinal b)