33#ifndef __H__UG__LIB_DISC__COMMON__LOCAL_ALGEBRA__
34#define __H__UG__LIB_DISC__COMMON__LOCAL_ALGEBRA__
38#define UG_LOCALALGEBRA_ASSERT(cond, exp) UG_ASSERT((cond), exp)
169 for(
size_t fct = 0; fct <
num_fct(); fct++)
170 for(
size_t dof = 0; dof <
num_dof(fct); dof++)
219 for(
size_t fct = 0; fct <
m_vvValue.size(); ++fct)
236 for (
size_t fct = 0; fct < numFcts; ++fct)
250 for(
size_t fct = 0; fct <
m_vvValue.size(); ++fct)
251 for(
size_t dof = 0; dof <
m_vvValue[fct].size(); ++dof)
265 for(
size_t fct = 0; fct <
m_vvValue.size(); ++fct)
266 for(
size_t dof = 0; dof <
m_vvValue[fct].size(); ++dof)
275 for(
size_t fct = 0; fct <
m_vvValue.size(); ++fct)
276 for(
size_t dof = 0; dof <
m_vvValue[fct].size(); ++dof)
285 for(
size_t fct = 0; fct <
m_vvValue.size(); ++fct)
286 for(
size_t dof = 0; dof <
m_vvValue[fct].size(); ++dof)
295 for(
size_t fct = 0; fct <
m_vvValue.size(); ++fct)
296 for(
size_t dof = 0; dof <
m_vvValue[fct].size(); ++dof)
309 for(
size_t i = 0; i < funcMap.
num_fct(); ++i)
311 const size_t mapFct = funcMap[i];
348 else return m_vvValue[ (*m_pFuncMap)[fct] ].size();
393 <<dof<<
", num_dof: "<<
num_dof(fct)<<
" of fct: "<<fct);
553 const size_t rowMapFct = rowFuncMap[i];
554 const size_t colMapFct = colFuncMap[j];
605 size_t colFct,
size_t colDoF)
607 check_dof(rowFct, rowDoF, colFct, colDoF);
608 return (*
m_CplMatAcc(rowFct,colFct))(rowDoF, colDoF);
613 size_t colFct,
size_t colDoF)
const
615 check_dof(rowFct, rowDoF, colFct, colDoF);
616 return (*
m_CplMatAcc(rowFct,colFct))(rowDoF, colDoF);
637 size_t colFct,
size_t colDoF)
640 return (
m_CplMat(rowFct,colFct))(rowDoF, colDoF);
645 size_t colFct,
size_t colDoF)
const
648 return (
m_CplMat(rowFct,colFct))(rowDoF, colDoF);
653 inline void check_fct(
size_t rowFct,
size_t colFct)
const
660 size_t colFct,
size_t colDoF)
const
674 size_t colFct,
size_t colDoF)
const
715 for(
size_t fct1 = 0; fct1 < mat.
num_row_fct(); ++fct1)
716 for(
size_t fct2 = 0; fct2 < mat.
num_col_fct(); ++fct2)
717 for(
size_t dof1 = 0; dof1 < mat.
num_row_dof(fct1); ++dof1)
718 for(
size_t dof2 = 0; dof2 < mat.
num_col_dof(fct2); ++dof2)
720 outStream <<
"[("<< fct1 <<
"," << dof1 <<
") x ("
721 << fct2 <<
"," << dof2 <<
")]: "
722 << mat(fct1, dof1, fct2, dof2) <<
"\n";
730 for(
size_t fct = 0; fct < vec.
num_fct(); ++fct)
731 for(
size_t dof = 0; dof < vec.
num_dof(fct); ++dof)
733 outStream <<
"["<<fct<<
","<<dof<<
"]:" << vec(fct, dof) <<
"\n";
738template <
typename TVector>
744 for(
size_t dof=0; dof < lvec.
num_all_dof(fct); ++dof)
746 const size_t index = ind.
index(fct,dof);
747 const size_t comp = ind.
comp(fct,dof);
752template <
typename TVector>
758 for(
size_t dof=0; dof < lvec.
num_all_dof(fct); ++dof)
760 const size_t index = ind.
index(fct,dof);
761 const size_t comp = ind.
comp(fct,dof);
766template <
typename TMatrix>
776 const size_t rowIndex = rowInd.
index(fct1,dof1);
777 const size_t rowComp = rowInd.
comp(fct1,dof1);
782 const size_t colIndex = colInd.
index(fct2,dof2);
783 const size_t colComp = colInd.
comp(fct2,dof2);
785 BlockRef(mat(rowIndex, colIndex), rowComp, colComp)
786 += lmat.
value(fct1,dof1,fct2,dof2);
Definition densematrix.h:57
describes a mapping between two local index sets
Definition function_group.h:186
size_t num_fct() const
returns the number of indices that are mapped
Definition function_group.h:195
void clear()
removes all connections
Definition function_group.h:189
Identifier for Local Finite Elements.
Definition local_finite_element_id.h:98
Definition local_algebra.h:50
const DoFIndex & multi_index(size_t fct, size_t dof) const
global algebra multi-index for (fct, dof)
Definition local_algebra.h:132
const LFEID & local_finite_element_id(size_t fct) const
returns the local finite element id of a function
Definition local_algebra.h:77
size_t num_dof(size_t fct) const
number of dofs for accessible function
Definition local_algebra.h:117
size_t num_dof() const
number of dofs of all accessible (sum)
Definition local_algebra.h:124
void push_back_index(size_t fct, size_t index)
adds an index (increases size)
Definition local_algebra.h:101
void reserve_dof(size_t fct, size_t numDoF)
reserves memory for the number of dofs
Definition local_algebra.h:94
void clear_dof(size_t fct)
clears the dofs of a function
Definition local_algebra.h:91
index_type index(size_t fct, size_t dof) const
global algebra index for (fct, dof)
Definition local_algebra.h:139
std::vector< LFEID > m_vLFEID
Definition local_algebra.h:194
size_t index_type
Index type used by algebra.
Definition local_algebra.h:53
void clear()
clears all fct
Definition local_algebra.h:111
void resize_dof(size_t fct, size_t numDoF)
sets the number of dofs of a function
Definition local_algebra.h:84
void check_dof(size_t fct, size_t dof) const
checks correct dof index in debug mode
Definition local_algebra.h:183
void set_lfeID(size_t fct, const LFEID &lfeID)
sets the local finite element id for a function
Definition local_algebra.h:70
bool contains_index(index_type ind)
checks if the local index object references a given index
Definition local_algebra.h:167
LocalIndices()
Default Constructor.
Definition local_algebra.h:60
size_t num_fct() const
number of functions
Definition local_algebra.h:114
void resize_fct(size_t numFct)
sets the number of functions
Definition local_algebra.h:63
std::vector< std::vector< DoFIndex > > m_vvIndex
Definition local_algebra.h:191
void check_fct(size_t fct) const
checks correct fct index in debug mode
Definition local_algebra.h:178
comp_type comp(size_t fct, size_t dof) const
algebra comp for (fct, dof)
Definition local_algebra.h:153
index_type & index(size_t fct, size_t dof)
global algebra index for (fct, dof)
Definition local_algebra.h:146
index_type comp_type
Component type used by algebra.
Definition local_algebra.h:56
void push_back_multi_index(size_t fct, size_t index, size_t comp)
adds an index (increases size)
Definition local_algebra.h:104
comp_type & comp(size_t fct, size_t dof)
algebra comp for (fct, dof)
Definition local_algebra.h:160
Definition local_algebra.h:422
number value(size_t rowFct, size_t rowDoF, size_t colFct, size_t colDoF) const
const access to coupling (rowFct, rowDoF) x (colFct, colDoF)
Definition local_algebra.h:644
const FunctionIndexMapping * m_pRowFuncMap
Row Access Mapping.
Definition local_algebra.h:689
this_type & scale_append(number s, const this_type &rhs)
add scaled matrix
Definition local_algebra.h:523
size_t num_all_col_fct() const
returns the number of all functions
Definition local_algebra.h:627
size_t num_col_fct() const
returns the number of currently accessible (restricted) functions
Definition local_algebra.h:581
DenseMatrix< VariableArray2< value_type > > LocalCplMatrix
Definition local_algebra.h:697
size_t num_row_fct() const
returns the number of currently accessible (restricted) functions
Definition local_algebra.h:574
const LocalIndices & get_row_indices() const
get current local indices
Definition local_algebra.h:467
this_type & operator*(number val)
multiply all entries
Definition local_algebra.h:486
this_type & operator=(number val)
set all entries
Definition local_algebra.h:477
DenseMatrix< VariableArray2< LocalCplMatrix * > > FctCplAccMatrix
Definition local_algebra.h:703
number operator()(size_t rowFct, size_t rowDoF, size_t colFct, size_t colDoF) const
const access to (restricted) coupling (rowFct, rowDoF) x (colFct, colDoF)
Definition local_algebra.h:612
void check_dof(size_t rowFct, size_t rowDoF, size_t colFct, size_t colDoF) const
checks correct (dof1,dof2) index in debug mode
Definition local_algebra.h:659
this_type & operator*=(number val)
multiply matrix
Definition local_algebra.h:492
size_t num_all_row_fct() const
returns the number of all functions
Definition local_algebra.h:624
size_t num_all_col_dof(size_t fct) const
returns the number of dofs for a function
Definition local_algebra.h:633
number value_type
Entry type used by algebra.
Definition local_algebra.h:428
void resize(const LocalIndices &rowInd, const LocalIndices &colInd)
resize for current local indices
Definition local_algebra.h:448
void check_all_dof(size_t rowFct, size_t rowDoF, size_t colFct, size_t colDoF) const
checks correct (dof1,dof2) index in debug mode
Definition local_algebra.h:673
LocalMatrix(const LocalIndices &rowInd, const LocalIndices &colInd)
Constructor.
Definition local_algebra.h:438
const LocalIndices & get_col_indices() const
get current local indices
Definition local_algebra.h:470
DenseMatrix< VariableArray2< LocalCplMatrix > > FctCplMatrix
Definition local_algebra.h:700
void check_fct(size_t rowFct, size_t colFct) const
checks correct (fct1,fct2) index in debug mode
Definition local_algebra.h:653
size_t num_all_row_dof(size_t fct) const
returns the number of dofs for a function
Definition local_algebra.h:630
void access_by_map(const FunctionIndexMapping &funcMap)
access only part of the functions using mapping (restrict functions)
Definition local_algebra.h:538
const LocalIndices * m_pColIndex
Definition local_algebra.h:686
const FunctionIndexMapping * m_pColFuncMap
Column Access Mapping.
Definition local_algebra.h:692
this_type & operator+=(const this_type &rhs)
add matrix
Definition local_algebra.h:501
LocalMatrix()
Constructor.
Definition local_algebra.h:432
void access_by_map(const FunctionIndexMapping &rowFuncMap, const FunctionIndexMapping &colFuncMap)
access only part of the functions using mapping (restrict functions)
Definition local_algebra.h:544
number & value(size_t rowFct, size_t rowDoF, size_t colFct, size_t colDoF)
access to coupling (rowFct, rowDoF) x (colFct, colDoF)
Definition local_algebra.h:636
void resize(const LocalIndices &ind)
resize for same ind in row and column
Definition local_algebra.h:445
FctCplMatrix m_CplMat
Definition local_algebra.h:706
number & operator()(size_t rowFct, size_t rowDoF, size_t colFct, size_t colDoF)
access to (restricted) coupling (rowFct, rowDoF) x (colFct, colDoF)
Definition local_algebra.h:604
LocalMatrix this_type
own type
Definition local_algebra.h:425
size_t num_col_dof(size_t fct) const
returns the number of dofs for the currently accessible (restricted) function
Definition local_algebra.h:596
const LocalIndices * m_pRowIndex
Definition local_algebra.h:683
this_type & operator-=(const this_type &rhs)
subtract matrix
Definition local_algebra.h:512
FctCplAccMatrix m_CplMatAcc
Definition local_algebra.h:709
size_t num_row_dof(size_t fct) const
returns the number of dofs for the currently accessible (restricted) function
Definition local_algebra.h:588
void check_all_fct(size_t rowFct, size_t colFct) const
checks correct (fct1,fct2) index in debug mode
Definition local_algebra.h:667
void access_all()
access all functions
Definition local_algebra.h:561
Definition local_algebra.h:198
const LFEID & local_finite_element_id(size_t fct) const
returns the local finite element id of a function
Definition local_algebra.h:335
std::vector< std::vector< value_type > > m_vvValue
Entries (fct, dof)
Definition local_algebra.h:418
this_type & operator*=(number val)
multiply all components of the vector
Definition local_algebra.h:263
void check_all_fct(size_t fct) const
checks correct fct index in debug mode
Definition local_algebra.h:396
number & operator()(size_t fct, size_t dof)
access to dof of currently accessible function fct
Definition local_algebra.h:352
size_t num_dof(size_t fct) const
returns the number of dofs for the currently accessible function
Definition local_algebra.h:344
const LocalIndices * m_pIndex
Indices.
Definition local_algebra.h:409
LocalVector()
default Constructor
Definition local_algebra.h:208
void check_fct(size_t fct) const
checks correct fct index in debug mode
Definition local_algebra.h:383
this_type & operator=(number val)
set all components of the vector
Definition local_algebra.h:248
number value_type
Type to store DoF values.
Definition local_algebra.h:204
size_t num_all_fct() const
returns the number of all functions
Definition local_algebra.h:370
number operator()(size_t fct, size_t dof) const
const access to dof of currently accessible function fct
Definition local_algebra.h:359
this_type & operator*(number val)
multiply all components of the vector
Definition local_algebra.h:257
void check_all_dof(size_t fct, size_t dof) const
checks correct dof index in debug mode
Definition local_algebra.h:401
LocalVector this_type
own type
Definition local_algebra.h:201
const FunctionIndexMapping * m_pFuncMap
Access Mapping.
Definition local_algebra.h:412
const LocalIndices & get_indices() const
get current local indices
Definition local_algebra.h:225
size_t num_fct() const
returns the number of currently accessible functions
Definition local_algebra.h:328
number & value(size_t fct, size_t dof)
access to dof of a fct (unrestricted functions)
Definition local_algebra.h:376
void access_all()
access all functions
Definition local_algebra.h:317
this_type & operator+=(const this_type &rhs)
add a local vector
Definition local_algebra.h:272
this_type & operator=(const this_type &other)
Definition local_algebra.h:231
void access_by_map(const FunctionIndexMapping &funcMap)
access only part of the functions using mapping (restrict functions)
Definition local_algebra.h:306
std::vector< value_type * > m_vvValueAcc
Entries (fct, dof)
Definition local_algebra.h:415
void resize(const LocalIndices &ind)
resize for current local indices
Definition local_algebra.h:214
this_type & scale_append(number s, const this_type &rhs)
add a scaled vector
Definition local_algebra.h:292
void check_dof(size_t fct, size_t dof) const
checks correct dof index in debug mode
Definition local_algebra.h:389
this_type & operator-=(const this_type &rhs)
subtract a local vector
Definition local_algebra.h:282
const number & value(size_t fct, size_t dof) const
const access to dof of a fct (unrestricted functions)
Definition local_algebra.h:379
size_t num_all_dof(size_t fct) const
returns the number of dofs for a function (unrestricted functions)
Definition local_algebra.h:373
LocalVector(const LocalIndices &ind)
Constructor.
Definition local_algebra.h:211
Definition multi_index.h:50
bool resize(size_type newRows, size_type newCols, bool bCopyValues=true)
Definition variable_array_impl.h:237
size_type num_rows() const
Definition variable_array_impl.h:222
size_type num_cols() const
Definition variable_array_impl.h:229
std::ostream & operator<<(std::ostream &outStream, const ug::MathMatrix< 2, 2 > &m)
Definition math_matrix.cpp:38
void MatScaleAppend(matrix_t &mOut, typename matrix_t::value_type s, const matrix_t &m)
scales a matrix_t and adds to result to a second matrix
Definition math_matrix_functions_common_impl.hpp:329
#define UG_ASSERT(expr, msg)
Definition assert.h:70
double number
Definition types.h:124
#define UG_LOCALALGEBRA_ASSERT(cond, exp)
Definition local_algebra.h:38
double & BlockRef(T &vec, size_t i)
Definition blocks.h:66
MultiIndex< 2 > DoFIndex
type of DoF-Index used to identify an DoF in the Algebra
Definition multi_index.h:272
void GetLocalVector(LocalVector &lvec, const TVector &vec)
Definition local_algebra.h:739
void AddLocalVector(TVector &vec, const LocalVector &lvec)
Definition local_algebra.h:753
void AddLocalMatrixToGlobal(TMatrix &mat, const LocalMatrix &lmat)
Definition local_algebra.h:767