Skip to content
Snippets Groups Projects
Commit 306cb100 authored by Markus Blatt's avatar Markus Blatt
Browse files

some doku fixes.

OverlappingSchwarz has an additional template parameter now.

[[Imported from SVN: r816]]
parent 82941f72
No related branches found
No related tags found
No related merge requests found
......@@ -20,17 +20,27 @@
namespace Dune
{
/**
* @addtogroup ISTL
*
* @{
*/
/**
* @file
* @author Markus Blatt
* @brief Classes for using SuperLU with ISTL matrices.
*/
template<class Matrix>
class SuperLU
{};
template<class M, class T, class TA>
template<class M, class T, class TM, class TA>
class SeqOverlappingSchwarz;
/**
* @brief SuperLu Solver
*
* Uses the the well known <a href="http://crd.lbl.gov/~xiaoye/SuperLU/">SuperLU
* Uses the well known <a href="http://crd.lbl.gov/~xiaoye/SuperLU/">SuperLU
* package</a> to solve the
* system.
*/
......@@ -86,7 +96,7 @@ namespace Dune
private:
friend class std::mem_fun_ref_t<void,SuperLU>;
template<class M,class X, class T1>
template<class M,class X, class TM, class T1>
friend class SeqOverlappingSchwarz;
/** @brief free allocated space. */
......@@ -327,6 +337,7 @@ namespace Dune
if ( options.PrintStat ) StatPrint(&stat);
StatFree(&stat);
}
/** @} */
};
#endif
......
......@@ -58,7 +58,7 @@ namespace Dune
struct SuperMatrixInitializer
{};
template<class M, class X, class T1>
template<class M, class X, class TM, class T1>
class SeqOverlappingSchwarz;
/**
......@@ -67,7 +67,7 @@ namespace Dune
template<class B, class TA, int n, int m>
class SuperLUMatrix<BCRSMatrix<FieldMatrix<B,n,m>,TA> >
{
template<class M, class X, class T1>
template<class M, class X, class TM, class T1>
friend class SeqOverlappingSchwarz;
friend class SuperMatrixInitializer<BCRSMatrix<FieldMatrix<B,n,m>,TA> >;
......@@ -94,6 +94,11 @@ namespace Dune
return A;
}
/** @brief Cast to a SuperLU Matrix */
operator const SuperMatrix&() const
{
return A;
}
bool operator==(const Matrix& mat) const;
/**
......@@ -131,6 +136,46 @@ namespace Dune
SuperMatrix A;
};
template<class T, class A, int n, int m>
void writeCompColMatrixToMatlab(const SuperLUMatrix<BCRSMatrix<FieldMatrix<T,n,m>,A> >& mat,
std::ostream& os)
{
const SuperMatrix a=static_cast<const SuperMatrix&>(mat);
NCformat *astore = (NCformat *) a.Store;
double* dp = (double*)astore->nzval;
// remember old flags
std::ios_base::fmtflags oldflags = os.flags();
// set the output format
//os.setf(std::ios_base::scientific, std::ios_base::floatfield);
int oldprec = os.precision();
//os.precision(10);
//dPrint_CompCol_Matrix("A", const_cast<SuperMatrix*>(&a));
os <<"[";
for(int row=0; row<a.nrow; ++row) {
for(int col= 0; col < a.ncol; ++col) {
// linear search for col
int i;
for(i=astore->colptr[col]; i < astore->colptr[col+1]; ++i)
if(astore->rowind[i]==row) {
os<<dp[i]<<" ";
break;
}
if(i==astore->colptr[col+1])
// entry not present
os<<0<<" ";
}
if(row==a.nrow-1)
os<<"]";
os<<std::endl;
}
// reset the output format
os.flags(oldflags);
os.precision(oldprec);
}
template<class T, class A, int n, int m>
class SuperMatrixInitializer<BCRSMatrix<FieldMatrix<T,n,m>,A> >
{
......@@ -185,7 +230,7 @@ namespace Dune
template<class T, class A, int n, int m>
SuperMatrixInitializer<BCRSMatrix<FieldMatrix<T,n,m>,A> >::SuperMatrixInitializer()
: mat(0), marker(0)
: mat(0), cols(0), marker(0)
{}
template<class T, class A, int n, int m>
......@@ -392,7 +437,7 @@ namespace Dune
copyToSuperMatrix(initializer,mat);
#ifdef DUNE_ISTL_WITH_CHECKING
if(N_<30)
if(N_<0)
dPrint_CompCol_Matrix("A",&A);
assert(*this==mat);
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment