|
FEAT 3
Finite Element Analysis Toolbox
|
Permutation class. More...
#include <permutation.hpp>
Public Types | |
| enum class | ConstrType { none , identity , perm , swap , inv_perm , inv_swap } |
| Construction type enumeration. More... | |
| using | IndexVector = std::vector< Index > |
Public Member Functions | |
| Permutation () | |
| default CTOR More... | |
| Permutation (Index num_entries, ConstrType constr_type=ConstrType::none, const Index *v=nullptr) | |
| Constructor. More... | |
| Permutation (Index num_entries, Random &random) | |
| Random constructor. More... | |
| Permutation (Permutation &&other) | |
| move ctor More... | |
| virtual | ~Permutation () |
| virtual destructor More... | |
| template<typename Tx_ > | |
| void | apply (Tx_ *x, bool invert=false) const |
| Applies In-Situ permutation. More... | |
| template<typename Ty_ , typename Tx_ > | |
| void | apply (Ty_ *y, const Tx_ *x, bool invert=false) const |
| Applies permutation. More... | |
| void | calc_perm_from_swap () |
| Computes the permutation-position vector from the swap-position vector. More... | |
| void | calc_swap_from_perm () |
| Computes the swap-position vector from the permutation-position vector. More... | |
| Permutation | clone () const |
| Clones this permutation. More... | |
| void | concat (const Permutation &p) |
| concatenates two permutations More... | |
| bool | empty () const |
| Checks whether the permutation is empty. More... | |
| Index * | get_perm_pos () |
| returns the permute-position array More... | |
| const Index * | get_perm_pos () const |
| returns the permute-position array More... | |
| Index * | get_swap_pos () |
| returns the swap-position array More... | |
| const Index * | get_swap_pos () const |
| returns the swap-position array More... | |
| Permutation | inverse () const |
| Computes the inverse permutation. More... | |
| template<typename IT_ > | |
| IT_ | map (IT_ i) const |
| Permutation & | operator= (Permutation &&) |
| move-assign operator More... | |
| Index | size () const |
| returns the size of the permutation More... | |
Private Attributes | |
| IndexVector | _perm_pos |
| the permute-position vector More... | |
| IndexVector | _swap_pos |
| the swap-position vector More... | |
Permutation class.
Definition at line 24 of file permutation.hpp.
| using FEAT::Adjacency::Permutation::IndexVector = std::vector < Index> |
Definition at line 27 of file permutation.hpp.
|
strong |
Construction type enumeration.
Definition at line 30 of file permutation.hpp.
|
inline |
|
explicit |
Constructor.
| [in] | num_entries | The size of the permutation to be created. |
| [in] | constr_type | Specifies the construction type:
|
| [in] | v | The transient input array for the initialization. The interpretation of the array's content depends on the constr_type parameter. |
Definition at line 14 of file permutation.cpp.
References _perm_pos, _swap_pos, calc_perm_from_swap(), calc_swap_from_perm(), identity, inv_perm, inv_swap, none, perm, swap, and XASSERTM.
Random constructor.
This constructor creates a random permutation using a random number generator.
| [in] | num_entries | The size of the permutation to be created. |
| [in] | random | The transient random number generator to be used. |
Definition at line 93 of file permutation.cpp.
References _swap_pos, calc_perm_from_swap(), and XASSERTM.
| FEAT::Adjacency::Permutation::Permutation | ( | Permutation && | other | ) |
move ctor
Definition at line 106 of file permutation.cpp.
|
virtual |
virtual destructor
Definition at line 123 of file permutation.cpp.
|
inline |
Applies In-Situ permutation.
This member function applies the permutation in-situ.
| [in,out] | x | The transient array that is to be permuted. |
| [in] | invert | Specifies whether to apply the forward (false) or inverse (true) permutation. |
Definition at line 198 of file permutation.hpp.
References _swap_pos, ASSERTM, size(), and XASSERT.
Referenced by calc_perm_from_swap(), FEAT::LAFEM::DenseVector< DT_, IT_ >::permute(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::permute(), FEAT::Geometry::VertexSet< num_coords_, Coord_ >::permute(), and FEAT::Geometry::IndexSet< num_indices_ >::permute().
|
inline |
Applies permutation.
This function applies the permutation on an array.
| [out] | y | The transient array that shall receive the permuted array. |
| [in] | x | The transient array that is to be permuted. |
| [in] | invert | Specifies whether to apply the forward (false) or inverse (true) permutation. |
Definition at line 252 of file permutation.hpp.
| void FEAT::Adjacency::Permutation::calc_perm_from_swap | ( | ) |
Computes the permutation-position vector from the swap-position vector.
Definition at line 140 of file permutation.cpp.
References _perm_pos, apply(), and size().
Referenced by Permutation().
| void FEAT::Adjacency::Permutation::calc_swap_from_perm | ( | ) |
Computes the swap-position vector from the permutation-position vector.
Definition at line 126 of file permutation.cpp.
References _perm_pos, _swap_pos, and size().
Referenced by Permutation(), FEAT::Adjacency::CuthillMcKee::compute(), and concat().
|
inline |
Clones this permutation.
Definition at line 114 of file permutation.hpp.
References Permutation(), _perm_pos, perm, and size().
Referenced by FEAT::Geometry::AdaptiveVertexSet< AdaptiveMeshType_ >::permute(), and FEAT::Geometry::AdaptiveIndexTuple< AdaptiveMeshType_, cell_dim_, face_dim_ >::permute_map().
| void FEAT::Adjacency::Permutation::concat | ( | const Permutation & | p | ) |
concatenates two permutations
Let P1 be the permutation denoted by this permutation and let P2 denote the permutation p, then this function computes the contatenation P3 := P1 * P2, such that P3(x) = P1(P2(x)).
| [in,out] | p | The concatenated permutation of the current permutation and p |
Definition at line 152 of file permutation.cpp.
References calc_swap_from_perm(), get_perm_pos(), size(), and XASSERT.
Referenced by FEAT::Geometry::AdaptiveVertexSet< AdaptiveMeshType_ >::permute().
|
inline |
Checks whether the permutation is empty.
Definition at line 143 of file permutation.hpp.
References _perm_pos.
Referenced by FEAT::Assembly::SymbolicAssembler::assemble_graph_intermesh(), FEAT::Assembly::GridTransfer::assemble_prolongation(), FEAT::Assembly::GridTransfer::assemble_truncation(), FEAT::Geometry::VertexSet< num_coords_, Coord_ >::permute(), FEAT::Geometry::IndexSet< num_indices_ >::permute(), FEAT::Assembly::GridTransfer::prolongate_vector(), and FEAT::Geometry::MeshPermutation< Shape_ >::validate_sizes().
|
inline |
returns the permute-position array
Definition at line 149 of file permutation.hpp.
References _perm_pos.
Referenced by FEAT::Adjacency::Graph::Graph(), FEAT::Adjacency::CuthillMcKee::compute(), concat(), FEAT::LAFEM::SparseMatrixBCSR< DT_, IT_, BlockHeight_, BlockWidth_ >::permute(), and FEAT::LAFEM::SparseMatrixCSR< DT_, IT_ >::permute().
|
inline |
returns the permute-position array
Definition at line 155 of file permutation.hpp.
References _perm_pos.
|
inline |
returns the swap-position array
Definition at line 161 of file permutation.hpp.
References _swap_pos.
|
inline |
returns the swap-position array
Definition at line 167 of file permutation.hpp.
References _swap_pos.
|
inline |
Computes the inverse permutation.
Definition at line 127 of file permutation.hpp.
References Permutation(), _perm_pos, inv_perm, and size().
Referenced by FEAT::LAFEM::SparseVector< DT_, IT_ >::permute(), FEAT::LAFEM::SparseVectorBlocked< DT_, IT_, BlockSize_ >::permute(), FEAT::LAFEM::SparseMatrixBCSR< DT_, IT_, BlockHeight_, BlockWidth_ >::permute(), FEAT::LAFEM::SparseMatrixCSR< DT_, IT_ >::permute(), and FEAT::Geometry::AdaptiveVertexSet< AdaptiveMeshType_ >::permute().
|
inline |
Definition at line 173 of file permutation.hpp.
| Permutation & FEAT::Adjacency::Permutation::operator= | ( | Permutation && | other | ) |
move-assign operator
Definition at line 111 of file permutation.cpp.
|
inline |
returns the size of the permutation
Definition at line 136 of file permutation.hpp.
References _perm_pos, _swap_pos, and XASSERTM.
Referenced by apply(), calc_perm_from_swap(), calc_swap_from_perm(), clone(), concat(), inverse(), FEAT::LAFEM::DenseVector< DT_, IT_ >::permute(), FEAT::LAFEM::DenseVectorBlocked< DT_, IT_, BlockSize_ >::permute(), FEAT::LAFEM::SparseVector< DT_, IT_ >::permute(), FEAT::LAFEM::SparseVectorBlocked< DT_, IT_, BlockSize_ >::permute(), FEAT::LAFEM::SparseMatrixBCSR< DT_, IT_, BlockHeight_, BlockWidth_ >::permute(), FEAT::LAFEM::SparseMatrixCSR< DT_, IT_ >::permute(), FEAT::Geometry::VertexSet< num_coords_, Coord_ >::permute(), FEAT::Geometry::IndexSet< num_indices_ >::permute(), FEAT::Adjacency::Graph::permute_indices(), and FEAT::Geometry::MeshPermutation< Shape_ >::validate_sizes().
|
private |
the permute-position vector
Definition at line 48 of file permutation.hpp.
Referenced by Permutation(), apply(), calc_perm_from_swap(), calc_swap_from_perm(), clone(), empty(), get_perm_pos(), inverse(), operator=(), and size().
|
private |
the swap-position vector
Definition at line 50 of file permutation.hpp.
Referenced by Permutation(), apply(), calc_swap_from_perm(), get_swap_pos(), operator=(), and size().