33 #ifndef __H__UG__LIB_DISC__OPERATOR__LINEAR_OPERATOR__EXTERNAL_SOLVER_
34 #define __H__UG__LIB_DISC__OPERATOR__LINEAR_OPERATOR__EXTERNAL_SOLVER_
57 virtual const char*
name()
const = 0;
61 template <
typename TAlgebra>
64 typename TAlgebra::vector_type>,
71 virtual const char*
name()
const
121 if( A.num_rows() == 0 || A.num_cols() == 0) {
m_size = 0;
return; }
122 STATIC_ASSERT(matrix_type::rows_sorted, Matrix_has_to_have_sorted_rows);
135 std::vector<IndexLayout::Element> vIndex;
152 size_t nInd = A_tmp.num_rows();
153 for (
size_t i = 0; i < nInd; ++i)
155 if (!A_tmp.num_connections(i))
198 for(
size_t i=0, k=0; i<v.size(); i++)
200 for(
size_t j=0; j<
GetSize(v[i]); j++)
207 for(
size_t i=0, k=0; i<v.size(); i++)
209 for(
size_t j=0; j<
GetSize(v[i]); j++)
267 if(!
apply(u, f))
return false;
272 UG_LOG(
"ERROR in 'LU::apply_return_defect': "
273 "Cannot apply matmul_minus.\n");
298 return copy_pos<Tdim, Tdim>(coord, get_positions<Tdim>());
308 return copy_pos(coord, get_positions<1>());
310 return copy_pos(coord, get_positions<2>());
312 return copy_pos(coord, get_positions<3>());
329 template<
int dim1,
int dim2>
336 for(
size_t i=0; i<src.size(); i++)
341 for(
size_t j=0; j<dim2; j++)
Definition: smart_pointer.h:108
Definition: external_solvers.h:66
CPUAlgebra::vector_type m_d
Definition: external_solvers.h:354
CPUAlgebra::vector_type m_c
Definition: external_solvers.h:354
virtual void double_init(const CPUAlgebra::matrix_type &mat)=0
virtual bool double_apply(CPUAlgebra::vector_type &c, const CPUAlgebra::vector_type &d)=0
void mat_preprocess(const matrix_type &A)
Definition: external_solvers.h:115
virtual bool apply(vector_type &c, const vector_type &d)
applies the inverse operator, i.e. returns u = A^{-1} * f
Definition: external_solvers.h:218
virtual const char * name() const
returns the name of the operator inverse
Definition: external_solvers.h:71
int get_dim()
Definition: external_solvers.h:284
bool get_positions(std::vector< MathVector< Tdim > > &coord)
Definition: external_solvers.h:292
SmartPtr< MatrixOperator< matrix_type, vector_type > > m_spOperator
Definition: external_solvers.h:172
virtual const char * double_name() const =0
size_t m_blockSize
Definition: external_solvers.h:356
virtual bool supports_parallel() const
returns if parallel solving is supported
Definition: external_solvers.h:106
bool copy_pos(std::vector< MathVector< dim1 > > &dest, const std::vector< MathVector< dim2 > > &src)
Definition: external_solvers.h:330
TAlgebra::vector_type vector_type
Definition: external_solvers.h:80
TAlgebra::matrix_type matrix_type
Definition: external_solvers.h:83
bool get_positions3(std::vector< MathVector< 3 > > &coord)
Definition: external_solvers.h:301
void get_vector(CPUAlgebra::vector_type &v_scalar, const vector_type &v)
Definition: external_solvers.h:196
SmartPtr< ILinearIterator< vector_type > > clone()
clone
Definition: external_solvers.h:98
void enable_consistent_interfaces(bool enable)
Definition: external_solvers.h:111
virtual bool postprocess()
Definition: external_solvers.h:351
bool m_bUseConsistentInterfaces
Definition: external_solvers.h:353
bool m_bDisablePreprocessing
Definition: external_solvers.h:357
const std::vector< MathVector< dim > > & get_positions()
Definition: external_solvers.h:320
virtual bool preprocess(SmartPtr< MatrixOperator< matrix_type, vector_type > > pOp)
Definition: external_solvers.h:188
void set_disable_preprocessing(bool bDisable)
disable preprocessing (if underlying matrix has not changed)
Definition: external_solvers.h:109
virtual bool init(SmartPtr< MatrixOperator< matrix_type, vector_type > > Op)
Definition: external_solvers.h:173
TAlgebra algebra_type
Definition: external_solvers.h:77
virtual bool apply_return_defect(vector_type &u, vector_type &f)
applies the inverse operator and updates the defect
Definition: external_solvers.h:264
size_t m_size
Definition: external_solvers.h:355
void set_vector(CPUAlgebra::vector_type &v_scalar, vector_type &v)
Definition: external_solvers.h:205
IExternalSolver()
Definition: external_solvers.h:89
Definition: external_solvers.h:53
virtual bool apply(CPUAlgebra::vector_type &c, const CPUAlgebra::vector_type &d)=0
virtual const char * name() const =0
virtual bool init(const CPUAlgebra::matrix_type &A)=0
virtual ~IExternalSolverImplementation()
Definition: external_solvers.h:58
describes an inverse linear mapping X->Y based on a matrix
Definition: matrix_operator_inverse.h:64
a mathematical Vector with N entries.
Definition: math_vector.h:97
Definition: matrix_operator.h:49
Wrapper for sequential matrices to handle them in parallel.
Definition: parallel_matrix.h:65
void set_storage_type(uint type)
sets the storage type
Definition: parallel_matrix.h:101
void set_layouts(ConstSmartPtr< AlgebraLayouts > layouts)
sets the algebra layouts
Definition: parallel_matrix.h:97
void set(number w, ParallelStorageType type)
set all entries to value and the storage type
Definition: parallel_vector_impl.h:223
void set_storage_type(uint type)
sets the storage type
Definition: parallel_vector.h:104
Definition: debug_writer.h:266
SmartPtr< IVectorDebugWriter< vector_type > > vector_debug_writer()
returns the debug writer
Definition: debug_writer.h:286
void resize(size_t newSize, bool bCopyValues=true)
Definition: vector.h:109
void MatAddSlaveRowsToMasterRowOverlap0(TMatrix &mat)
Generates a set of unique global algebra ids.
Definition: parallelization_util.h:106
void MatMakeConsistentOverlap0(TMatrix &mat)
Generates a set of unique global algebra ids.
Definition: parallelization_util.h:126
@ PST_CONSISTENT
Definition: parallel_storage_type.h:68
@ PST_UNIQUE
Definition: parallel_storage_type.h:70
@ PST_ADDITIVE
Definition: parallel_storage_type.h:69
size_t GetDoubleSparseFromBlockSparse(TDoubleSparse &A, const TSparseMatrix &S)
Definition: sparsematrix_util.h:1217
void SetDirichletRow(TSparseMatrix &A, size_t i, size_t alpha)
Definition: sparsematrix_util.h:796
void CollectUniqueElements(std::vector< typename TLayout::Element > &elemsOut, const TLayout &layout)
writes all elements in the interfaces into the resulting vector. avoids doubles.
Definition: pcl_layout_util.h:142
const NullSmartPtr SPNULL
The equivalent to NULL for smart pointers.
Definition: smart_pointer.h:90
#define UG_THROW(msg)
Definition: error.h:57
#define STATIC_ASSERT(expr, msg)
Definition: common.h:61
#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
double & BlockRef(T &vec, size_t i)
Definition: blocks.h:66
SmartPtr< AlgebraLayouts > CreateLocalAlgebraLayouts()
Definition: parallelization_util.cpp:936
size_t GetSize(const T &t)