diff options
author | Sebastián Barschkis <sebbas@sebbas.org> | 2019-12-16 17:40:15 +0300 |
---|---|---|
committer | Sebastián Barschkis <sebbas@sebbas.org> | 2019-12-16 18:27:26 +0300 |
commit | 4ff7c5eed6b546ae42692f3a869a5ccc095a9cb4 (patch) | |
tree | 03f8233788ae46e66672f711e3cf42d8d00d01cc /extern/mantaflow/helper/util/vectorbase.cpp | |
parent | 6a3f2b30d206df23120cd212132adea821b6c20e (diff) |
Mantaflow [Part 1]: Added preprocessed Mantaflow source files
Includes preprocessed Mantaflow source files for both OpenMP and TBB (if OpenMP is not present, TBB files will be used instead).
These files come directly from the Mantaflow repository. Future updates to the core fluid solver will take place by updating the files.
Reviewed By: sergey, mont29
Maniphest Tasks: T59995
Differential Revision: https://developer.blender.org/D3850
Diffstat (limited to 'extern/mantaflow/helper/util/vectorbase.cpp')
-rw-r--r-- | extern/mantaflow/helper/util/vectorbase.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/extern/mantaflow/helper/util/vectorbase.cpp b/extern/mantaflow/helper/util/vectorbase.cpp new file mode 100644 index 00000000000..413ae086d1c --- /dev/null +++ b/extern/mantaflow/helper/util/vectorbase.cpp @@ -0,0 +1,49 @@ +/****************************************************************************** + * + * MantaFlow fluid solver framework + * Copyright 2011 Tobias Pfaff, Nils Thuerey + * + * This program is free software, distributed under the terms of the + * Apache License, Version 2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Basic vector class + * + ******************************************************************************/ + +#include "vectorbase.h" + +using namespace std; + +namespace Manta { + +template<> const Vector3D<int> Vector3D<int>::Zero(0, 0, 0); +template<> const Vector3D<float> Vector3D<float>::Zero(0.f, 0.f, 0.f); +template<> const Vector3D<double> Vector3D<double>::Zero(0., 0., 0.); +template<> +const Vector3D<float> Vector3D<float>::Invalid(numeric_limits<float>::quiet_NaN(), + numeric_limits<float>::quiet_NaN(), + numeric_limits<float>::quiet_NaN()); +template<> +const Vector3D<double> Vector3D<double>::Invalid(numeric_limits<double>::quiet_NaN(), + numeric_limits<double>::quiet_NaN(), + numeric_limits<double>::quiet_NaN()); + +template<> bool Vector3D<float>::isValid() const +{ + return !c_isnan(x) && !c_isnan(y) && !c_isnan(z); +} +template<> bool Vector3D<double>::isValid() const +{ + return !c_isnan(x) && !c_isnan(y) && !c_isnan(z); +} + +//! Specialization for readable ints +template<> std::string Vector3D<int>::toString() const +{ + char buf[256]; + snprintf(buf, 256, "[%d,%d,%d]", (*this)[0], (*this)[1], (*this)[2]); + return std::string(buf); +} + +} // namespace Manta |