From dd99dc3fe05f7db95df25c594ed1ef3cb3cedb45 Mon Sep 17 00:00:00 2001 From: Tobias Reiter Date: Mon, 17 Jun 2024 14:15:17 +0200 Subject: [PATCH] Use explicit namespacing in lsInternal to avoid duplicate symbols --- include/viennals/lsEnquistOsher.hpp | 15 ++++++++------- include/viennals/lsLaxFriedrichs.hpp | 16 ++++++++-------- include/viennals/lsLocalLaxFriedrichs.hpp | 16 +++++++++------- .../viennals/lsLocalLaxFriedrichsAnalytical.hpp | 16 +++++++++------- include/viennals/lsLocalLocalLaxFriedrichs.hpp | 16 +++++++++------- .../lsStencilLocalLaxFriedrichsScalar.hpp | 11 ++++++----- 6 files changed, 49 insertions(+), 41 deletions(-) diff --git a/include/viennals/lsEnquistOsher.hpp b/include/viennals/lsEnquistOsher.hpp index 43fae596..19ac1f33 100644 --- a/include/viennals/lsEnquistOsher.hpp +++ b/include/viennals/lsEnquistOsher.hpp @@ -11,27 +11,28 @@ namespace lsInternal { -using namespace viennals; +using namespace viennacore; /// Engquist osher integration scheme based on the /// upwind integration scheme. Offers high performance /// but lower accuracy for complex velocity fields. template class EnquistOsher { - SmartPointer> levelSet; - SmartPointer> velocities; + SmartPointer> levelSet; + SmartPointer> velocities; hrleSparseStarIterator, order> neighborIterator; bool calculateNormalVectors = true; static T pow2(const T &value) { return value * value; } public: - static void prepareLS(SmartPointer> passedlsDomain) { + static void prepareLS(SmartPointer> passedlsDomain) { assert(order == 1 || order == 2); - Expand(passedlsDomain, 2 * order + 1).apply(); + viennals::Expand(passedlsDomain, 2 * order + 1).apply(); } - EnquistOsher(SmartPointer> passedlsDomain, - SmartPointer> vel, bool calcNormal = true) + EnquistOsher(SmartPointer> passedlsDomain, + SmartPointer> vel, + bool calcNormal = true) : levelSet(passedlsDomain), velocities(vel), neighborIterator(hrleSparseStarIterator, order>( levelSet->getDomain())), diff --git a/include/viennals/lsLaxFriedrichs.hpp b/include/viennals/lsLaxFriedrichs.hpp index 53aa7092..95fd454d 100644 --- a/include/viennals/lsLaxFriedrichs.hpp +++ b/include/viennals/lsLaxFriedrichs.hpp @@ -10,15 +10,15 @@ namespace lsInternal { -using namespace viennals; +using namespace viennacore; /// Lax Friedrichs integration scheme with constant alpha /// value for dissipation. This alpha value should be fitted /// based on the results of the advection and passed to the /// advection Kernel. template class LaxFriedrichs { - SmartPointer> levelSet; - SmartPointer> velocities; + SmartPointer> levelSet; + SmartPointer> velocities; hrleSparseStarIterator, order> neighborIterator; bool calculateNormalVectors = true; const double alpha = 1.0; @@ -26,14 +26,14 @@ template class LaxFriedrichs { static T pow2(const T &value) { return value * value; } public: - static void prepareLS(SmartPointer> passedlsDomain) { + static void prepareLS(SmartPointer> passedlsDomain) { assert(order == 1 || order == 2); - Expand(passedlsDomain, 2 * order + 1).apply(); + viennals::Expand(passedlsDomain, 2 * order + 1).apply(); } - LaxFriedrichs(SmartPointer> passedlsDomain, - SmartPointer> vel, bool calcNormal = true, - double a = 1.0) + LaxFriedrichs(SmartPointer> passedlsDomain, + SmartPointer> vel, + bool calcNormal = true, double a = 1.0) : levelSet(passedlsDomain), velocities(vel), neighborIterator(hrleSparseStarIterator, order>( levelSet->getDomain())), diff --git a/include/viennals/lsLocalLaxFriedrichs.hpp b/include/viennals/lsLocalLaxFriedrichs.hpp index 061dc9d2..f4e8e3a6 100644 --- a/include/viennals/lsLocalLaxFriedrichs.hpp +++ b/include/viennals/lsLocalLaxFriedrichs.hpp @@ -5,12 +5,13 @@ #include #include +#include #include namespace lsInternal { -using namespace viennals; +using namespace viennacore; /// Lax Friedrichs integration scheme, which uses a first neighbour /// stencil to calculate the alpha values for all neighbours. @@ -18,8 +19,8 @@ using namespace viennals; /// Slower than lsLocalLocalLaxFriedrichs or lsEngquistOsher /// but more reliable for complex velocity fields. template class LocalLaxFriedrichs { - SmartPointer> levelSet; - SmartPointer> velocities; + SmartPointer> levelSet; + SmartPointer> velocities; hrleSparseBoxIterator> neighborIterator; const double alphaFactor; @@ -43,16 +44,17 @@ template class LocalLaxFriedrichs { } public: - static void prepareLS(SmartPointer> passedlsDomain) { + static void prepareLS(SmartPointer> passedlsDomain) { assert(order == 1 || order == 2); // at least order+1 layers since we need neighbor neighbors for // dissipation alpha calculation - Expand(passedlsDomain, 2 * (order + 2) + 1).apply(); + viennals::Expand(passedlsDomain, 2 * (order + 2) + 1).apply(); } // neighboriterator always needs order 2 for alpha calculation - LocalLaxFriedrichs(SmartPointer> passedlsDomain, - SmartPointer> vel, double a = 1.0) + LocalLaxFriedrichs(SmartPointer> passedlsDomain, + SmartPointer> vel, + double a = 1.0) : levelSet(passedlsDomain), velocities(vel), neighborIterator(levelSet->getDomain(), 2), alphaFactor(a) {} diff --git a/include/viennals/lsLocalLaxFriedrichsAnalytical.hpp b/include/viennals/lsLocalLaxFriedrichsAnalytical.hpp index 5eebd992..bbb89b5e 100644 --- a/include/viennals/lsLocalLaxFriedrichsAnalytical.hpp +++ b/include/viennals/lsLocalLaxFriedrichsAnalytical.hpp @@ -5,12 +5,13 @@ #include #include +#include #include namespace lsInternal { -using namespace viennals; +using namespace viennacore; /// Lax Friedrichs integration scheme, which uses alpha values /// provided by the user in getDissipationAlphas in lsVelocityField. @@ -18,8 +19,8 @@ using namespace viennals; /// and the alpha values, this integration scheme should be used and never /// otherwise. template class LocalLaxFriedrichsAnalytical { - SmartPointer> levelSet; - SmartPointer> velocities; + SmartPointer> levelSet; + SmartPointer> velocities; hrleSparseBoxIterator> neighborIterator; static T pow2(const T &value) { return value * value; } @@ -42,16 +43,17 @@ template class LocalLaxFriedrichsAnalytical { } public: - static void prepareLS(SmartPointer> passedlsDomain) { + static void prepareLS(SmartPointer> passedlsDomain) { assert(order == 1 || order == 2); // at least order+1 layers since we need neighbor neighbors for // dissipation alpha calculation - Expand(passedlsDomain, 2 * (order + 2) + 1).apply(); + viennals::Expand(passedlsDomain, 2 * (order + 2) + 1).apply(); } // neighboriterator always needs order 2 for alpha calculation - LocalLaxFriedrichsAnalytical(SmartPointer> passedlsDomain, - SmartPointer> vel) + LocalLaxFriedrichsAnalytical( + SmartPointer> passedlsDomain, + SmartPointer> vel) : levelSet(passedlsDomain), velocities(vel), neighborIterator(levelSet->getDomain(), 2) {} diff --git a/include/viennals/lsLocalLocalLaxFriedrichs.hpp b/include/viennals/lsLocalLocalLaxFriedrichs.hpp index e2095c14..72156cee 100644 --- a/include/viennals/lsLocalLocalLaxFriedrichs.hpp +++ b/include/viennals/lsLocalLocalLaxFriedrichs.hpp @@ -5,32 +5,34 @@ #include #include +#include #include namespace lsInternal { -using namespace viennals; +using namespace viennacore; /// Lax Friedrichs integration scheme, which considers only the current /// point for alpha calculation. Faster than lsLocalLaxFriedrichs but /// not as accurate. template class LocalLocalLaxFriedrichs { - SmartPointer> levelSet; - SmartPointer> velocities; + SmartPointer> levelSet; + SmartPointer> velocities; hrleSparseStarIterator, order> neighborIterator; const double alphaFactor; static T pow2(const T &value) { return value * value; } public: - static void prepareLS(SmartPointer> passedlsDomain) { + static void prepareLS(SmartPointer> passedlsDomain) { assert(order == 1 || order == 2); - Expand(passedlsDomain, 2 * order + 1).apply(); + viennals::Expand(passedlsDomain, 2 * order + 1).apply(); } - LocalLocalLaxFriedrichs(SmartPointer> passedlsDomain, - SmartPointer> vel, double a = 1.0) + LocalLocalLaxFriedrichs(SmartPointer> passedlsDomain, + SmartPointer> vel, + double a = 1.0) : levelSet(passedlsDomain), velocities(vel), neighborIterator(hrleSparseStarIterator, order>( levelSet->getDomain())), diff --git a/include/viennals/lsStencilLocalLaxFriedrichsScalar.hpp b/include/viennals/lsStencilLocalLaxFriedrichsScalar.hpp index e83e3b22..46a4ec68 100644 --- a/include/viennals/lsStencilLocalLaxFriedrichsScalar.hpp +++ b/include/viennals/lsStencilLocalLaxFriedrichsScalar.hpp @@ -6,10 +6,11 @@ #include #include #include +#include namespace lsInternal { -using namespace viennals; +using namespace viennacore; /// Stencil Local Lax Friedrichs Integration Scheme. /// It uses a stencil of order around active points, in order to @@ -18,11 +19,11 @@ using namespace viennals; /// see Toifl et al., 2019. ISBN: 978-1-7281-0938-1; /// DOI: 10.1109/SISPAD.2019.8870443 template class StencilLocalLaxFriedrichsScalar { - using LevelSetType = SmartPointer>; + using LevelSetType = SmartPointer>; using LevelSetsType = std::vector; LevelSetType levelSet; - SmartPointer> velocities; + SmartPointer> velocities; const DifferentiationSchemeEnum finiteDifferenceScheme = DifferentiationSchemeEnum::FIRST_ORDER; hrleSparseBoxIterator> neighborIterator; @@ -132,11 +133,11 @@ template class StencilLocalLaxFriedrichsScalar { static void prepareLS(LevelSetType passedlsDomain) { // Expansion of sparse field must depend on spatial derivative order // AND slf stencil order! --> currently assume scheme = 3rd order always - Expand(passedlsDomain, 2 * (order + 1) + 4).apply(); + viennals::Expand(passedlsDomain, 2 * (order + 1) + 4).apply(); } StencilLocalLaxFriedrichsScalar( - LevelSetType passedlsDomain, SmartPointer> vel, + LevelSetType passedlsDomain, SmartPointer> vel, double a = 1.0, DifferentiationSchemeEnum scheme = DifferentiationSchemeEnum::FIRST_ORDER) : levelSet(passedlsDomain), velocities(vel),