From 624d6177dfb6f7014c24f3fa6aa6a2be55c6cba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Tue, 14 Aug 2012 10:44:17 +0200 Subject: [PATCH 01/10] Restore coding conventions. Inadvertently lost in commit 064184b. --- opm/core/grid.c | 4 ++-- opm/core/grid/cart_grid.c | 22 ++++++++++------------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/opm/core/grid.c b/opm/core/grid.c index 07250ea3..9fa4cd67 100644 --- a/opm/core/grid.c +++ b/opm/core/grid.c @@ -104,7 +104,7 @@ allocate_grid(size_t ndims , nel = ncellfaces; G->cell_faces = malloc(nel * sizeof *G->cell_faces); - G->cell_facetag = malloc(nel * sizeof *G->cell_facetag); + G->cell_facetag = malloc(nel * sizeof *G->cell_facetag); nel = ncells + 1; G->cell_facepos = malloc(nel * sizeof *G->cell_facepos); @@ -123,7 +123,7 @@ allocate_grid(size_t ndims , (G->face_normals == NULL) || (G->face_areas == NULL) || (G->cell_faces == NULL) || - (G->cell_facetag == NULL) || + (G->cell_facetag == NULL) || (G->cell_facepos == NULL) || (G->cell_centroids == NULL) || (G->cell_volumes == NULL) ) diff --git a/opm/core/grid/cart_grid.c b/opm/core/grid/cart_grid.c index 25c04d24..989bbfe6 100644 --- a/opm/core/grid/cart_grid.c +++ b/opm/core/grid/cart_grid.c @@ -262,15 +262,13 @@ fill_cart_topology_3d(struct UnstructuredGrid *G) } } } - - for (k=0; k< nx*ny*nz;++k){ - for (i=0; i < 6; ++i){ - G->cell_facetag[k*6+i]=i; - } + + for (k = 0; k < nx * ny * nz; ++k) { + for (i = 0; i < 6; ++i) { + G->cell_facetag[k*6 + i] = i; + } } - - fnodes = G->face_nodes; fnodepos = G->face_nodepos; fcells = G->face_cells; @@ -572,11 +570,11 @@ fill_cart_topology_2d(struct UnstructuredGrid *G) } } - for (j=0; j< nx*ny;++j){ - G->cell_facetag[j*4+0]=0; - G->cell_facetag[j*4+1]=2; - G->cell_facetag[j*4+2]=1; - G->cell_facetag[j*4+3]=3; + for (j = 0; j < nx * ny; ++j) { + G->cell_facetag[j*4 + 0] = 0; + G->cell_facetag[j*4 + 1] = 2; + G->cell_facetag[j*4 + 2] = 1; + G->cell_facetag[j*4 + 3] = 3; } From 7a48d1342493b3c265c807c8238d9ef2d9a49ce7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Tue, 14 Aug 2012 10:57:06 +0200 Subject: [PATCH 02/10] Remove an unused header. We don't need to define the public interface of LinearsSolverAGMG. --- opm/core/linalg/LinearSolverAGMG.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/opm/core/linalg/LinearSolverAGMG.hpp b/opm/core/linalg/LinearSolverAGMG.hpp index f8c95ad7..a1e8b91b 100644 --- a/opm/core/linalg/LinearSolverAGMG.hpp +++ b/opm/core/linalg/LinearSolverAGMG.hpp @@ -44,7 +44,6 @@ #include #include -#include namespace Opm { From 56cd29108057a16eb091c8e9bf1246c3b638ee73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Tue, 14 Aug 2012 11:00:47 +0200 Subject: [PATCH 03/10] Replace s by eight spaces. While here, fix a misprint in comment. --- opm/core/linalg/LinearSolverAGMG.hpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/opm/core/linalg/LinearSolverAGMG.hpp b/opm/core/linalg/LinearSolverAGMG.hpp index a1e8b91b..c6ae8e3c 100644 --- a/opm/core/linalg/LinearSolverAGMG.hpp +++ b/opm/core/linalg/LinearSolverAGMG.hpp @@ -62,13 +62,17 @@ namespace Opm LinearSolverAGMG(const int max_it = 100 , const double rtol = 1.0e-6, const bool is_spd = false); - /** + + /** * Constructor. - * \param[in] param ParameterGroup object contianing the fields - * max_it,rtol,is_spd as used in the constructor - */ - LinearSolverAGMG(const parameter::ParameterGroup& param); - /// Destructor. + * \param[in] param ParameterGroup object containing the fields + * max_it,rtol,is_spd as used in the constructor. + */ + LinearSolverAGMG(const parameter::ParameterGroup& param); + + /** + * Destructor. + */ virtual ~LinearSolverAGMG(); using LinearSolverInterface::solve; From 9d9691a927937ae1829840d67cc98ee078af4ea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Tue, 14 Aug 2012 11:01:39 +0200 Subject: [PATCH 04/10] Fix misprints in Doxygen comment. --- opm/core/linalg/LinearSolverAGMG.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opm/core/linalg/LinearSolverAGMG.hpp b/opm/core/linalg/LinearSolverAGMG.hpp index c6ae8e3c..2e33f8d0 100644 --- a/opm/core/linalg/LinearSolverAGMG.hpp +++ b/opm/core/linalg/LinearSolverAGMG.hpp @@ -79,13 +79,13 @@ namespace Opm /// Solve a linear system, with a matrix given in compressed /// sparse row format. - /// \param[in] size Number of rows (and colums). + /// \param[in] size Number of rows (and columns). /// \param[in] nonzeros Number of (structural) non-zeros. /// \param[in] ia Row pointers. /// \param[in] ja Column indices. /// \param[in] sa (structurally) non-zero elements. /// \param[in] rhs System right-hand side. - /// \param[inout] solution System solution. + /// \param[in,out] solution System solution. /// \return Solver meta-data concerning most recent system solve. virtual LinearSolverInterface::LinearSolverReport solve(const int size, const int nonzeros, From 5986b4a24dbf3c96447c0e964294f625a577bbf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Tue, 14 Aug 2012 11:03:33 +0200 Subject: [PATCH 05/10] Re-adjust Doxygen layout for commit 9d9691a. --- opm/core/linalg/LinearSolverAGMG.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/opm/core/linalg/LinearSolverAGMG.hpp b/opm/core/linalg/LinearSolverAGMG.hpp index 2e33f8d0..9038ba75 100644 --- a/opm/core/linalg/LinearSolverAGMG.hpp +++ b/opm/core/linalg/LinearSolverAGMG.hpp @@ -79,12 +79,12 @@ namespace Opm /// Solve a linear system, with a matrix given in compressed /// sparse row format. - /// \param[in] size Number of rows (and columns). - /// \param[in] nonzeros Number of (structural) non-zeros. - /// \param[in] ia Row pointers. - /// \param[in] ja Column indices. - /// \param[in] sa (structurally) non-zero elements. - /// \param[in] rhs System right-hand side. + /// \param[in] size Number of rows (and columns). + /// \param[in] nonzeros Number of (structural) non-zeros. + /// \param[in] ia Row pointers. + /// \param[in] ja Column indices. + /// \param[in] sa (structurally) non-zero elements. + /// \param[in] rhs System right-hand side. /// \param[in,out] solution System solution. /// \return Solver meta-data concerning most recent system solve. virtual LinearSolverInterface::LinearSolverReport From 0841cea042bb6410e9f83f27b73d85111742a2cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Tue, 14 Aug 2012 11:05:09 +0200 Subject: [PATCH 06/10] Restore coding conventions. Inadvertently lost in commit 064184b. --- opm/core/linalg/LinearSolverFactory.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/opm/core/linalg/LinearSolverFactory.cpp b/opm/core/linalg/LinearSolverFactory.cpp index 98552c84..4e2f3679 100644 --- a/opm/core/linalg/LinearSolverFactory.cpp +++ b/opm/core/linalg/LinearSolverFactory.cpp @@ -30,6 +30,7 @@ #if HAVE_DUNE_ISTL #include #endif + #if HAVE_AGMG #include #endif @@ -73,12 +74,14 @@ namespace Opm solver_.reset(new LinearSolverIstl(param)); #endif } - else if (ls == "agmg") { + + else if (ls == "agmg") { #if HAVE_AGMG solver_.reset(new LinearSolverAGMG(param)); #endif - } - else { + } + + else { THROW("Linear solver " << ls << " is unknown."); } From f8825976f0276de8b57021f164036bad753e5f4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Tue, 14 Aug 2012 11:26:07 +0200 Subject: [PATCH 07/10] Restore original method spacing. No functional changes. --- opm/core/linalg/LinearSolverAGMG.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/opm/core/linalg/LinearSolverAGMG.cpp b/opm/core/linalg/LinearSolverAGMG.cpp index 5ce7dfca..086c9316 100644 --- a/opm/core/linalg/LinearSolverAGMG.cpp +++ b/opm/core/linalg/LinearSolverAGMG.cpp @@ -66,6 +66,7 @@ namespace Opm is_spd_(is_spd) { } + LinearSolverAGMG::LinearSolverAGMG(const parameter::ParameterGroup& param) : max_it_(100) , rtol_ (1.0e-6), @@ -76,11 +77,8 @@ namespace Opm is_spd_ = param.getDefault("is_spd", is_spd_); } - LinearSolverAGMG::~LinearSolverAGMG() {} - - LinearSolverInterface::LinearSolverReport LinearSolverAGMG::solve(const int size , const int nonzeros, From 736020e6fe7714f1b9ecc29c5c61df845c63aeed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Tue, 14 Aug 2012 12:42:47 +0200 Subject: [PATCH 08/10] Always #define "HAVE_AGMG". Define the symbol to zero (false) if unavailable or unwanted. This prevents a diagnostic message concerning an undefined preprocessor symbol (i.e., "HAVE_AGMG") when used in the form #if HAVE_AGMG /* ... */ #endif --- m4/agmg.m4 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/m4/agmg.m4 b/m4/agmg.m4 index 9e09157b..9321b79a 100644 --- a/m4/agmg.m4 +++ b/m4/agmg.m4 @@ -13,8 +13,12 @@ AC_DEFUN([OPM_AGMG],dnl AC_DEFINE([HAVE_AGMG], [1],dnl [Define to `1' if Notay's AGMG solver is included])[]dnl build_agmg="yes"],dnl - [build_agmg="no"])],dnl - [build_agmg="no"])[]dnl + [AC_DEFINE([HAVE_AGMG], [0],dnl + [Define to 0 if Notay's AGMG solver is unavailable.])[]dnl + build_agmg="no"])],dnl + [AC_DEFINE([HAVE_AGMG], [0],dnl + [Define to 0 if Notay's AGMG solver is unwanted.])[]dnl + build_agmg="no"])[]dnl AS_IF([test x"$build_agmg" = x"yes"],dnl [AC_PROG_FC_C_O[]dnl From 05410ac950147f7e13f0d0dd8a09e791a2565cac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Tue, 14 Aug 2012 12:49:56 +0200 Subject: [PATCH 09/10] Always #define "HAVE_DUNE_ISTL". Define the symbol to zero (false) if unavailable. This prevents a diagnostic message concerning an undefined preprocessor symbol when used in the form #if HAVE_DUNE_ISTL /* ... */ #endif --- m4/ax_dune_istl.m4 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/m4/ax_dune_istl.m4 b/m4/ax_dune_istl.m4 index 2f0fd55b..40fa9072 100644 --- a/m4/ax_dune_istl.m4 +++ b/m4/ax_dune_istl.m4 @@ -31,7 +31,9 @@ AC_DEFUN([AX_DUNE_ISTL], "x$ax_cv_dune_common_available" = "xyes"],dnl [AC_DEFINE([HAVE_DUNE_ISTL], [1],dnl [Define to 1 if `dune-istl' is available]) - ])[]dnl + ],dnl + [AC_DEFINE([HAVE_DUNE_ISTL], [0],dnl + [Define to 0 if `dune-istl' is unavailable.])])[]dnl AM_CONDITIONAL([DUNE_ISTL], [test "x$ax_cv_dune_istl_available" = "xyes" -a \ From 7ccf0350bc2892bb253b49b0598e61e1ca91e651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Tue, 14 Aug 2012 12:55:57 +0200 Subject: [PATCH 10/10] Tighten grammar of "HAVE_AGMG" symbol description. --- m4/agmg.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m4/agmg.m4 b/m4/agmg.m4 index 9321b79a..0a16e9b3 100644 --- a/m4/agmg.m4 +++ b/m4/agmg.m4 @@ -11,7 +11,7 @@ AC_DEFUN([OPM_AGMG],dnl [AS_IF([test -f "$with_agmg/dagmg.f90"],dnl [AC_SUBST([AGMG_SRCDIR], [$with_agmg])[]dnl AC_DEFINE([HAVE_AGMG], [1],dnl - [Define to `1' if Notay's AGMG solver is included])[]dnl + [Define to 1 if Notay's AGMG solver is included.])[]dnl build_agmg="yes"],dnl [AC_DEFINE([HAVE_AGMG], [0],dnl [Define to 0 if Notay's AGMG solver is unavailable.])[]dnl