33 #ifndef __H__LIB_ALGEBRA__LAPACK_AGGLOMERATING_LU_OPERATOR__
34 #define __H__LIB_ALGEBRA__LAPACK_AGGLOMERATING_LU_OPERATOR__
59 collectedVec, vec, type, bRoot);
71 agglomerationLayout.
comm(), vec, collectedVec, type, bRoot);
75 template <
typename TBase,
typename TAlgebra>
107 m_bEmpty = A.layouts()->proc_comm().empty();
125 }
UG_CATCH_THROW(
"AgglomeratingBase::" << __FUNCTION__ <<
" failed")
158 return m_pMatrix->layouts()->proc_comm().is_local() ||
m_pMatrix->layouts()->proc_comm().empty();
179 m_pMatrix->layouts()->proc_comm().barrier();
184 {
UG_LOG(
"ERROR in LUOperator::init: Cannot init LU Decomposition.\n");
return false;}
194 UG_LOG(
"Agglomerated on proc 0. Size is " <<
collectedX.size() <<
"(was on this proc: "
203 }
UG_CATCH_THROW(
"AgglomeratingBase::" << __FUNCTION__ <<
" failed")
211 A.template cast_dynamic<MatrixOperator<matrix_type,vector_type> >();
215 UG_THROW(
"IMatrixOperatorInverse::init:"
216 " Passed operator is not matrix-based.");
229 if(
empty())
return true;
239 }
UG_CATCH_THROW(
"AgglomeratingBase::" << __FUNCTION__ <<
" failed")
250 if(!
apply(u, f))
return false;
256 UG_LOG(
"ERROR in 'LUSolver::apply_return_defect': Cannot apply matmul_minus.\n");
268 if(!
apply(u, f))
return false;
272 UG_LOG(
"ERROR in 'LUSolver::apply_return_defect': Cannot apply matmul_minus.\n");
306 template <
typename TAlgebra>
308 AgglomeratingBase<IMatrixOperatorInverse< typename TAlgebra::matrix_type, typename TAlgebra::vector_type>, TAlgebra >
327 UG_COND_THROW(linOpInverse.valid()==
false,
"linOpInverse has to be != NULL");
329 m_name = std::string(
"AgglomeratingSolver(") + linOpInverse->name() +
")";
336 }
UG_CATCH_THROW(
"AgglomeratingSolver::" << __FUNCTION__ <<
" failed")
342 }
UG_CATCH_THROW(
"AgglomeratingSolver::" << __FUNCTION__ <<
" failed")
349 virtual const char*
name()
const
358 return std::string(
"AgglomeratingSolver: ") +
m_pLinOpInverse->config_string();
382 template <
typename TAlgebra>
402 UG_COND_THROW(splinIt.valid()==
false,
"linOpInverse has to be != NULL");
404 m_name = std::string(
"AgglomeratingIterator(") + splinIt->name() + std::string(
")");
411 }
UG_CATCH_THROW(
"AgglomeratingIterator::" << __FUNCTION__ <<
" failed")
417 }
UG_CATCH_THROW(
"AgglomeratingIterator::" << __FUNCTION__ <<
" failed")
424 virtual const char*
name()
const
440 return std::string(
"AgglomeratingIterator: ") +
m_splinIt->config_string();
459 template <
typename TAlgebra>
479 UG_COND_THROW(splinIt.valid()==
false,
"linOpInverse has to be != NULL");
481 m_name = std::string(
"AgglomeratingPreconditioner(") + splinIt->name() + std::string(
")");
488 }
UG_CATCH_THROW(
"AgglomeratingIterator::" << __FUNCTION__ <<
" failed")
494 }
UG_CATCH_THROW(
"AgglomeratingIterator::" << __FUNCTION__ <<
" failed")
501 virtual const char*
name()
const
517 return std::string(
"AgglomeratingPreconditioner: ") +
m_splinIt->config_string();
Definition: smart_pointer.h:108
bool invalid() const
returns true if the pointer is invalid, false if not.
Definition: smart_pointer.h:212
Definition: agglomerating_solver.h:77
virtual bool apply(vector_type &x, const vector_type &b)
Definition: agglomerating_solver.h:222
virtual bool apply_update_defect(vector_type &u, vector_type &f)
Definition: agglomerating_solver.h:264
virtual ~AgglomeratingBase()
Definition: agglomerating_solver.h:90
bool is_serial()
Definition: agglomerating_solver.h:154
HorizontalAlgebraLayouts agglomerationLayout
Definition: agglomerating_solver.h:294
bool m_bEmpty
Definition: agglomerating_solver.h:300
void gather_vector_on_one(vector_type &collectedB, const vector_type &b, ParallelStorageType type)
Definition: agglomerating_solver.h:140
TAlgebra algebra_type
Definition: agglomerating_solver.h:80
TAlgebra::vector_type vector_type
Definition: agglomerating_solver.h:83
SmartPtr< MatrixOperator< matrix_type, vector_type > > m_spCollectedOp
Definition: agglomerating_solver.h:295
TAlgebra::matrix_type matrix_type
Definition: agglomerating_solver.h:86
virtual bool init_agglomerated(SmartPtr< MatrixOperator< matrix_type, vector_type > > Op)=0
bool base_init(SmartPtr< MatrixOperator< matrix_type, vector_type > > Op)
Preprocess routine.
Definition: agglomerating_solver.h:166
vector_type collectedB
Definition: agglomerating_solver.h:293
SmartPtr< AlgebraLayouts > m_spLocalAlgebraLayouts
Definition: agglomerating_solver.h:296
bool init_mat(const matrix_type &A)
Definition: agglomerating_solver.h:103
virtual bool step(SmartPtr< MatrixOperator< matrix_type, vector_type > > pOp, vector_type &c, const vector_type &d)
Definition: agglomerating_solver.h:280
matrix_type * m_pMatrix
Definition: agglomerating_solver.h:291
virtual bool apply_agglomerated(vector_type &x, const vector_type &b)=0
vector_type collectedX
Definition: agglomerating_solver.h:293
virtual bool apply_return_defect(vector_type &u, vector_type &f)
Definition: agglomerating_solver.h:246
bool empty()
Definition: agglomerating_solver.h:98
bool m_bRoot
Definition: agglomerating_solver.h:299
void init_collected_vec(vector_type &collectedX)
Definition: agglomerating_solver.h:130
void broadcast_vector_from_one(vector_type &x, const vector_type &collectedX, ParallelStorageType type)
Definition: agglomerating_solver.h:145
bool i_am_root()
Definition: agglomerating_solver.h:92
virtual bool base_init(SmartPtr< ILinearOperator< vector_type > > A)
Definition: agglomerating_solver.h:207
Definition: agglomerating_solver.h:385
virtual bool init(SmartPtr< ILinearOperator< vector_type > > A)
Definition: agglomerating_solver.h:444
AgglomeratingIterator(SmartPtr< ILinearIterator< vector_type > > splinIt)
Definition: agglomerating_solver.h:400
virtual bool init(SmartPtr< ILinearOperator< vector_type > > A, const vector_type &u)
Definition: agglomerating_solver.h:448
virtual bool supports_parallel() const
returns if parallel solving is supported
Definition: agglomerating_solver.h:429
virtual SmartPtr< ILinearIterator< vector_type > > clone()
Clone.
Definition: agglomerating_solver.h:432
AgglomeratingBase< ILinearIterator< vector_type >, algebra_type > base_type
Base type.
Definition: agglomerating_solver.h:397
virtual std::string config_string() const
Definition: agglomerating_solver.h:438
SmartPtr< ILinearIterator< vector_type > > m_splinIt
Definition: agglomerating_solver.h:455
virtual ~AgglomeratingIterator()
Definition: agglomerating_solver.h:421
virtual bool apply_agglomerated(vector_type &x, const vector_type &b)
Definition: agglomerating_solver.h:413
TAlgebra::vector_type vector_type
Definition: agglomerating_solver.h:391
virtual bool init_agglomerated(SmartPtr< MatrixOperator< matrix_type, vector_type > > Op)
Definition: agglomerating_solver.h:407
TAlgebra::matrix_type matrix_type
Definition: agglomerating_solver.h:394
virtual const char * name() const
returns the name of iterator
Definition: agglomerating_solver.h:424
std::string m_name
Definition: agglomerating_solver.h:456
TAlgebra algebra_type
Definition: agglomerating_solver.h:388
Definition: agglomerating_solver.h:462
TAlgebra::matrix_type matrix_type
Definition: agglomerating_solver.h:471
AgglomeratingPreconditioner(SmartPtr< ILinearIterator< vector_type > > splinIt)
Definition: agglomerating_solver.h:477
virtual SmartPtr< ILinearIterator< vector_type > > clone()
Clone.
Definition: agglomerating_solver.h:509
virtual bool postprocess()
cleans the operator
Definition: agglomerating_solver.h:520
SmartPtr< ILinearIterator< vector_type > > m_splinIt
Definition: agglomerating_solver.h:528
virtual ~AgglomeratingPreconditioner()
Definition: agglomerating_solver.h:498
std::string m_name
Definition: agglomerating_solver.h:529
virtual bool preprocess(SmartPtr< MatrixOperator< typename TAlgebra::matrix_type, typename TAlgebra::vector_type > > pOp)
initializes the preconditioner
Definition: agglomerating_solver.h:521
virtual bool apply_agglomerated(vector_type &x, const vector_type &b)
Definition: agglomerating_solver.h:490
TAlgebra algebra_type
Definition: agglomerating_solver.h:465
TAlgebra::vector_type vector_type
Definition: agglomerating_solver.h:468
virtual const char * name() const
returns the name of iterator
Definition: agglomerating_solver.h:501
virtual bool init_agglomerated(SmartPtr< MatrixOperator< matrix_type, vector_type > > Op)
Definition: agglomerating_solver.h:484
AgglomeratingBase< IPreconditioner< TAlgebra >, TAlgebra > base_type
Base type.
Definition: agglomerating_solver.h:474
virtual bool supports_parallel() const
returns if parallel solving is supported
Definition: agglomerating_solver.h:506
virtual std::string config_string() const
Definition: agglomerating_solver.h:515
Definition: agglomerating_solver.h:309
virtual bool init_agglomerated(SmartPtr< MatrixOperator< matrix_type, vector_type > > Op)
Definition: agglomerating_solver.h:332
virtual bool init(SmartPtr< ILinearOperator< vector_type > > A, const vector_type &u)
Definition: agglomerating_solver.h:365
virtual ~AgglomeratingSolver()
Definition: agglomerating_solver.h:346
virtual bool apply_agglomerated(vector_type &x, const vector_type &b)
Definition: agglomerating_solver.h:338
virtual bool init(SmartPtr< ILinearOperator< vector_type > > A)
Definition: agglomerating_solver.h:361
virtual bool init(SmartPtr< MatrixOperator< matrix_type, vector_type > > Op)
Definition: agglomerating_solver.h:369
SmartPtr< ILinearOperatorInverse< vector_type, vector_type > > m_pLinOpInverse
Definition: agglomerating_solver.h:376
virtual std::string config_string() const
returns information about configuration parameters
Definition: agglomerating_solver.h:356
TAlgebra::vector_type vector_type
Definition: agglomerating_solver.h:315
std::string m_name
Definition: agglomerating_solver.h:377
virtual bool supports_parallel() const
returns if parallel solving is supported
Definition: agglomerating_solver.h:354
AgglomeratingBase< IMatrixOperatorInverse< matrix_type, vector_type >, algebra_type > base_type
Base type.
Definition: agglomerating_solver.h:321
AgglomeratingSolver(SmartPtr< ILinearOperatorInverse< vector_type, vector_type > > linOpInverse)
Definition: agglomerating_solver.h:325
virtual const char * name() const
returns the name of the operator inverse
Definition: agglomerating_solver.h:349
TAlgebra algebra_type
Definition: agglomerating_solver.h:312
TAlgebra::matrix_type matrix_type
Definition: agglomerating_solver.h:318
TAlgebra::vector_type vector_type
type of vector
Definition: debug_writer.h:360
Holds Interfaces and communicators for horizontal communication.
Definition: algebra_layouts.h:48
const pcl::ProcessCommunicator & proc_comm() const
returns process communicator
Definition: algebra_layouts.h:68
const IndexLayout & slave() const
Definition: algebra_layouts.h:63
const IndexLayout & master() const
Definition: algebra_layouts.h:61
pcl::InterfaceCommunicator< IndexLayout > & comm() const
returns (non-const !!!) communicator
Definition: algebra_layouts.h:78
describes a linear iterator
Definition: linear_iterator.h:81
describes a linear mapping X->Y
Definition: linear_operator.h:80
describes an inverse linear mapping X->Y
Definition: linear_operator_inverse.h:80
Definition: matrix_operator.h:49
Definition: parallel_vector.h:60
ConstSmartPtr< AlgebraLayouts > layouts() const
returns the algebra layouts
Definition: parallel_vector.h:97
ParallelStorageType
Definition: parallel_storage_type.h:66
@ PST_CONSISTENT
Definition: parallel_storage_type.h:68
@ PST_ADDITIVE
Definition: parallel_storage_type.h:69
int ProcRank()
returns the rank of the process
Definition: pcl_base.cpp:83
bool AllProcsTrue(bool bFlag, ProcessCommunicator comm)
Definition: pcl_util.cpp:54
#define UG_CATCH_THROW(msg)
Definition: error.h:64
#define UG_THROW(msg)
Definition: error.h:57
#define UG_LOG(msg)
Definition: log.h:367
#define UG_COND_THROW(cond, msg)
UG_COND_THROW(cond, msg) : performs a UG_THROW(msg) if cond == true.
Definition: error.h:61
void CollectMatrixOnOneProc(const matrix_type &A, matrix_type &collectedA, IndexLayout &masterLayout, IndexLayout &slaveLayout)
Definition: collect_matrix.h:246
void GatherVectorOnOne(HorizontalAlgebraLayouts &agglomerationLayout, ParallelVector< T > &collectedVec, const ParallelVector< T > &vec, ParallelStorageType type)
Definition: agglomerating_solver.h:53
void BroadcastVectorFromOne(HorizontalAlgebraLayouts &agglomerationLayout, ParallelVector< T > &vec, const ParallelVector< T > &collectedVec, ParallelStorageType type)
Definition: agglomerating_solver.h:65
SmartPtr< AlgebraLayouts > CreateLocalAlgebraLayouts()
Definition: parallelization_util.cpp:936
#define PROFILE_BEGIN(name)
Definition: profiler.h:254
#define PROFILE_END()
Definition: profiler.h:256
#define PROFILE_FUNC()
Definition: profiler.h:257
SmartPtr< T, FreePolicy > make_sp(T *inst)
returns a SmartPtr for the passed raw pointer
Definition: smart_pointer.h:836