33 #ifndef __H__UG__LIB_DISC__ORDERING_STRATEGIES_ALGORITHMS__LEXORDER__
34 #define __H__UG__LIB_DISC__ORDERING_STRATEGIES_ALGORITHMS__LEXORDER__
53 std::vector<std::pair<MathVector<dim>,
size_t> >& vPos,
54 size_t orderDim = 0,
bool increasing =
true);
57 template <
typename TDomain>
59 size_t orderDim = 0,
bool increasing =
true);
62 template <
typename TDomain>
63 void OrderLex(ApproximationSpace<TDomain>& approxSpace,
const char *order);
66 template <
typename TAlgebra,
typename TDomain,
typename O_t>
70 typedef typename TAlgebra::matrix_type
M_t;
71 typedef typename TAlgebra::vector_type
V_t;
78 typedef typename std::pair<MathVector<TDomain::dim>,
size_t>
Position_t;
92 if(
sizeof(
m_dir) == 0){
96 std::cout <<
name() <<
"::parse()" << std::endl;
97 std::cout <<
"length: " << strlen(
m_dir) << std::endl;
101 size_t len = strlen(
m_dir);
108 bool increasing =
true;
130 UG_LOG(
name() <<
"::compute: LexOrdering in " << sign <<
"x direction.\n")
131 ComputeLexicographicOrder<TDomain::dim>(
o,
m_vPositions, 0, increasing);
136 UG_LOG(
name() <<
"::compute: LexOrdering in " << sign <<
"y direction.\n")
137 ComputeLexicographicOrder<TDomain::dim>(
o,
m_vPositions, 1, increasing);
142 UG_LOG(
name() <<
"::compute: LexOrdering in " << sign <<
"z direction.\n")
143 ComputeLexicographicOrder<TDomain::dim>(
o,
m_vPositions, 2, increasing);
148 UG_THROW(
name() <<
"::compute: Invalid token in direction string, valid tokens: +, -, x, y, z");
166 if(strcmp(
m_dir,
"") == 0){
172 if((pGridF =
dynamic_cast<const GridFunc_t*
>(&V)) == 0){
173 UG_THROW(
name() <<
"::init: No DoFDistribution specified.");
178 size_t indN = dd->num_indices();
180 if(indN != A->num_rows ()){
191 #ifdef UG_ENABLE_DEBUG_LOGS
199 UG_THROW(
name() <<
"::init: Cannot initialize smoother without a geometry. Specify the 2nd argument for init!");
203 UG_THROW(
name() <<
"::init: induced subgraph version not implemented yet!");
207 UG_THROW(
name() <<
"::init: induced subgraph version not implemented yet!");
210 virtual const char*
name()
const {
return "LexOrdering";}
Definition: smart_pointer.h:108
represents numerical solutions on a grid using an algebraic vector
Definition: grid_function.h:121
SmartPtr< TDomain > domain()
returns domain
Definition: grid_function.h:342
Definition: IOrderingAlgorithm.h:52
Definition: lexorder.h:68
TAlgebra::vector_type V_t
Definition: lexorder.h:71
const char * m_dir
Definition: lexorder.h:220
virtual const char * name() const
Definition: lexorder.h:210
void parse()
Definition: lexorder.h:91
GridFunction< TDomain, TAlgebra > GridFunc_t
Grid function type for the solution.
Definition: lexorder.h:75
void set_direction(const char *dir)
Definition: lexorder.h:212
IOrderingAlgorithm< TAlgebra, O_t > baseclass
Definition: lexorder.h:72
void compute()
Definition: lexorder.h:100
M_t * mat
Definition: lexorder.h:218
LexOrdering()
Definition: lexorder.h:80
std::pair< MathVector< TDomain::dim >, size_t > Position_t
Position attachment type.
Definition: lexorder.h:78
std::vector< Position_t > m_vPositions
Definition: lexorder.h:221
SmartPtr< IOrderingAlgorithm< TAlgebra, O_t > > clone()
Definition: lexorder.h:86
LexOrdering(const LexOrdering< TAlgebra, TDomain, O_t > &parent)
clone constructor
Definition: lexorder.h:83
void init(M_t *)
Definition: lexorder.h:198
O_t o
Definition: lexorder.h:217
TAlgebra::matrix_type M_t
Definition: lexorder.h:70
void check()
Definition: lexorder.h:155
O_t & ordering()
Definition: lexorder.h:161
void init(M_t *, const V_t &, const O_t &)
Definition: lexorder.h:202
void init(M_t *, const O_t &)
Definition: lexorder.h:206
void init(M_t *A, const V_t &V)
Definition: lexorder.h:165
#define UG_THROW(msg)
Definition: error.h:57
#define UG_LOG(msg)
Definition: log.h:367
void ExtractPositions(ConstSmartPtr< TDomain > domain, ConstSmartPtr< DoFDistribution > dd, std::vector< MathVector< TDomain::dim > > &vPos)
Definition: dof_position_util.cpp:424
void OrderLexForDofDist(SmartPtr< DoFDistribution > dd, ConstSmartPtr< TDomain > domain, size_t orderDim, bool increasing)
orders the dof distribution using Cuthill-McKee
Definition: lexorder.cpp:117
bool is_permutation(O_t &o)
Definition: permutation_util.h:135
void ComputeLexicographicOrder(std::vector< size_t > &vNewIndex, std::vector< std::pair< MathVector< dim >, size_t > > &vPos, size_t orderDim, bool increasing)
Definition: lexorder.cpp:50
void OrderLex(ApproximationSpace< TDomain > &approxSpace, const char *order)
orders the all DofDistributions of the ApproximationSpace using lexicographic order
Definition: lexorder.cpp:236
SmartPtr< T, FreePolicy > make_sp(T *inst)
returns a SmartPtr for the passed raw pointer
Definition: smart_pointer.h:836