[Dune] [Fwd: Re: [Dune-Commit] dune-istl r929 - trunk/istl]
Markus Blatt
Markus.Blatt at ipvs.uni-stuttgart.de
Mon Aug 4 08:34:48 CEST 2008
On Wed, Jul 30, 2008 at 05:23:10PM +0200, Carsten Graeser wrote:
> Although I don't recognize why non-existence of a feature is better
> than a slow implementation of it I would suggest to remove the
> cast to avoid repeating the same arguments again and again.
>
> Probably we're the only ones using this class, but if we really need
> the cast we can keep in in our working copies.
>
Probably there is a misunderstanding. I never told you to remove it,
did I? I am just concerned about performance.
As the implicite conversion operator is not needed if we have
corresponding constructors and assignment operators in FieldMatrix I
propose the following:
1. We add an (explicit) conversion constructor and an assignment
constructor to FieldMatrix. Both will have a template parameter for
the other type and both call the method istl_assign_to_fmatrix which
does the assignment in an efficient way.
class FieldMatrix{
...
template<class T>
FieldMatrix(const T& other){
istl_asssign_to_fmatrix(*this, other)
}
...
};
2. You overload istl_assign_to_fmatrix for ScaledIdMatrix.
template<class T, int n>
inline void istl_assign_to_fmatrix(ScaledIdentityMatrix<T,n> s,
const FieldMatrix<T,n,n>&
other){
...
}
This should do the trick and make everybody happy because
ScaledIdMatrix stays in ISTL.
Objections?
Cheers,
Markus
More information about the Dune
mailing list