From a2b22e5e47aa49acd14c907b7a373ea945120df1 Mon Sep 17 00:00:00 2001 From: Mark Berrill Date: Mon, 17 May 2021 12:00:40 -0400 Subject: [PATCH] Fixing bug in PoissonSolver --- CMakeLists.txt | 4 +++- IO/IOHelpers.h | 2 +- IO/silo.h | 7 +++++-- IO/silo.hpp | 6 ++++-- cmake/macros.cmake | 4 +++- models/PoissonSolver.cpp | 42 +++++++++++++++++++--------------------- models/PoissonSolver.h | 1 - 7 files changed, 36 insertions(+), 30 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a45f71f5..31518d86 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,8 @@ # Set some CMake properties CMAKE_MINIMUM_REQUIRED( VERSION 3.9 ) -CMAKE_POLICY( SET CMP0115 OLD ) +if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.20.0") + CMAKE_POLICY( SET CMP0115 OLD ) +endif() MESSAGE("====================") diff --git a/IO/IOHelpers.h b/IO/IOHelpers.h index 4389c619..a7ba6096 100644 --- a/IO/IOHelpers.h +++ b/IO/IOHelpers.h @@ -57,6 +57,6 @@ inline std::vector splitList( const char *line, const char token ) } -}; // namespace IO +} // namespace IO #endif diff --git a/IO/silo.h b/IO/silo.h index 5e1068fe..a3edfeb7 100644 --- a/IO/silo.h +++ b/IO/silo.h @@ -18,7 +18,8 @@ typedef int DBfile; #endif -namespace IO::silo { +namespace IO { +namespace silo { enum FileMode { READ, WRITE, CREATE }; @@ -256,7 +257,9 @@ void writeMultiVar( DBfile *fid, const std::string &varname, const std::vector &subVarNames, const std::vector &subVarTypes ); -}; // namespace IO::silo +} // namespace silo +} // namespace IO + #endif #include "IO/silo.hpp" diff --git a/IO/silo.hpp b/IO/silo.hpp index b76ebd28..72ff7041 100644 --- a/IO/silo.hpp +++ b/IO/silo.hpp @@ -13,7 +13,8 @@ #include -namespace IO::silo { +namespace IO { +namespace silo { /**************************************************** @@ -413,7 +414,8 @@ Array readTriMeshVariable( DBfile *fid, const std::string &varname ) } -}; // namespace IO::silo +} // namespace silo +} // namespace IO #endif diff --git a/cmake/macros.cmake b/cmake/macros.cmake index c8da0a45..f0ed8c67 100644 --- a/cmake/macros.cmake +++ b/cmake/macros.cmake @@ -1,6 +1,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.18.3) CMAKE_POLICY( SET CMP0057 NEW ) -CMAKE_POLICY( SET CMP0115 OLD ) +if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.20.0") + CMAKE_POLICY( SET CMP0115 OLD ) +endif() INCLUDE(CheckCCompilerFlag) INCLUDE(CheckCSourceCompiles) diff --git a/models/PoissonSolver.cpp b/models/PoissonSolver.cpp index 25a31600..739b16bf 100644 --- a/models/PoissonSolver.cpp +++ b/models/PoissonSolver.cpp @@ -218,20 +218,19 @@ void ScaLBL_Poisson::ReadInput(){ void ScaLBL_Poisson::AssignSolidBoundary(double *poisson_solid) { - size_t NLABELS=0; signed char VALUE=0; double AFFINITY=0.f; auto LabelList = electric_db->getVector( "SolidLabels" ); auto AffinityList = electric_db->getVector( "SolidValues" ); - NLABELS=LabelList.size(); + size_t NLABELS = LabelList.size(); if (NLABELS != AffinityList.size()){ ERROR("Error: LB-Poisson Solver: SolidLabels and SolidValues must be the same length! \n"); } - double label_count[NLABELS]; - double label_count_global[NLABELS]; + std::vector label_count( NLABELS, 0.0 ); + std::vector label_count_global( NLABELS, 0.0 ); // Assign the labels for (size_t idx=0; idx db0);