Skip to content
Snippets Groups Projects
Commit 3bf85ffc authored by Oliver Sander's avatar Oliver Sander
Browse files

- Disable operator K

- add cast to FieldMatrix
- add operator[]

Thanks to Carsten Gräser for the patch.

[[Imported from SVN: r929]]
parent b058cb3e
No related branches found
No related tags found
No related merge requests found
......@@ -310,7 +310,20 @@ namespace Dune {
//===== conversion operator
/** \brief Cast to a scalar */
operator K () const {return p_;}
// operator K () const {return p_;}
/** \brief Cast to FieldMatrix
* Might be inefficient, but operator= has to be a member of FieldMatrix
* */
operator FieldMatrix<K,n,n>() const
{
FieldMatrix<K, n, n> fm = 0.0;
for(int i=0; i<n; ++i)
fm[i][i] = p_;
return fm;
}
/** \brief Sends the matrix to an output stream */
friend std::ostream& operator<< (std::ostream& s, const ScaledIdentityMatrix<K,n>& a)
......@@ -323,6 +336,18 @@ namespace Dune {
return s;
}
/** \brief Return FieldVector as row replacement
* This might be inefficient.
* */
const FieldVector<K,n> operator[](size_type i) const
{
FieldVector<K, n> fv;
fv = 0.0;
fv[i] = p_;
return fv;
}
private:
// the data, very simply a single number
K p_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment