summaryrefslogtreecommitdiffstats
path: root/src/vZ
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-10-11 02:51:41 -0400
committerTavian Barnes <tavianator@gmail.com>2010-10-11 02:51:41 -0400
commitf123be63a5760782c563d81d7842de6cc3e5646b (patch)
treeceb533b40e917156cad556ca99c75ebe65ae2d21 /src/vZ
parent2c2b69e1df183f118c45d74c18c7e84934aaff1f (diff)
downloadvz-f123be63a5760782c563d81d7842de6cc3e5646b.tar.xz
Support adaptive integration with equation systems.
Diffstat (limited to 'src/vZ')
-rw-r--r--src/vZ/EquationSystem.hpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/vZ/EquationSystem.hpp b/src/vZ/EquationSystem.hpp
index 0963baf..6409f18 100644
--- a/src/vZ/EquationSystem.hpp
+++ b/src/vZ/EquationSystem.hpp
@@ -21,6 +21,8 @@
#ifndef VZ_EQUATIONSYSTEM_HPP
#define VZ_EQUATIONSYSTEM_HPP
+#include <algorithm>
+#include <cmath>
#include <cstddef>
namespace vZ
@@ -149,6 +151,18 @@ namespace vZ
}
return *this;
}
+
+ template <std::size_t N, typename T>
+ typename EquationSystem<N, T>::Scalar
+ abs(const EquationSystem<N, T>& es)
+ {
+ typename EquationSystem<N, T>::Scalar ret(0);
+ for (std::size_t i = 0; i < N; ++i) {
+ using std::abs;
+ ret = std::max(ret, abs(es[i]));
+ }
+ return ret;
+ }
}
#endif // VZ_EQUATIONSYSTEM_HPP