Skip to content
Snippets Groups Projects
Commit f25f162b authored by Oliver Sander's avatar Oliver Sander Committed by sander@FU-BERLIN.DE
Browse files

add infinity_norm() and operator<<

[[Imported from SVN: r6327]]
parent 56b49c7e
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,14 @@ class Tensor3
{
public:
T infinity_norm() const
{
dune_static_assert(N1>0, "infinity_norm not implemented for empty tensors");
T norm = (*this)[0].infinity_norm();
for (int i=1; i<N1; i++)
norm = std::max(norm, (*this)[i].infinity_norm());
return norm;
}
static Tensor3<T,N1,N2,N3> product(const Dune::FieldVector<T,N1>& a, const Dune::FieldVector<T,N2>& b, const Dune::FieldVector<T,N3>& c)
{
......@@ -90,4 +98,15 @@ class Tensor3
};
//! Output operator for array
template <class T, int N1, int N2, int N3>
inline std::ostream& operator<< (std::ostream& s, const Tensor3<T,N1,N2,N3>& tensor)
{
for (int i=0; i<N1; i++)
s << tensor[i];
return s;
}
#endif
\ No newline at end of file
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