From e6247c8776b0dff478e7822811ffe6aa69860b76 Mon Sep 17 00:00:00 2001 From: Thomas Witkowski <thomas.witkowski@gmx.de> Date: Fri, 6 Aug 2010 11:57:32 +0000 Subject: [PATCH] Several small changes. --- AMDiS/other/include/Makefile_AMDiS.mk | 3 ++- AMDiS/src/Boundary.cc | 23 +++++++++----------- AMDiS/src/DOFMatrix.cc | 4 +--- AMDiS/src/OEMSolver.h | 30 ++++++++++----------------- AMDiS/src/UmfPackSolver.h | 14 ++++++------- 5 files changed, 31 insertions(+), 43 deletions(-) diff --git a/AMDiS/other/include/Makefile_AMDiS.mk b/AMDiS/other/include/Makefile_AMDiS.mk index 6931fd50..8770524e 100644 --- a/AMDiS/other/include/Makefile_AMDiS.mk +++ b/AMDiS/other/include/Makefile_AMDiS.mk @@ -43,6 +43,7 @@ LIBS += -lboost_iostreams -lboost_filesystem -lboost_system -lboost_date_time ifeq ($(strip $(USE_UMFPACK)), 1) LIBS += $(UMFPACK_LIB) + CPPFLAGS += -DHAVE_UMFPACK -DMTL_HAS_UMFPACK endif ifeq ($(strip $(USE_MKL)), 1) @@ -104,7 +105,7 @@ endif ifeq ($(strip $(DEBUG)), 0) CPPFLAGS += -O3 else - CPPFLAGS += -g -O0 + CPPFLAGS += -g -O0 -DDEBUG=1 endif ifeq ($(strip $(USE_OPENMP)), 1) diff --git a/AMDiS/src/Boundary.cc b/AMDiS/src/Boundary.cc index fa0ecb4c..7627d128 100644 --- a/AMDiS/src/Boundary.cc +++ b/AMDiS/src/Boundary.cc @@ -7,24 +7,21 @@ namespace AMDiS { BoundaryType newBound(BoundaryType oldBound, BoundaryType newBound) { if (newBound <= INTERIOR) { - /*************************************************************************/ - /* face on NEUMANN-boundary or interior face; weak type */ - /*************************************************************************/ - return(oldBound); + // Face on NEUMANN-boundary or interior face; weak type. + + return oldBound; } else { - /*************************************************************************/ - /* node is already node on the DIRICHLET boundary */ - /*************************************************************************/ + // Node is already node on the DIRICHLET boundary. + if (oldBound > newBound) - return(oldBound); + return oldBound; else - return(newBound); + return newBound; } - /**************************************************************************/ - /* new face is interior face; node type is always stronger */ - /**************************************************************************/ - return(newBound); + // New face is interior face; node type is always stronger. + + return newBound; } } diff --git a/AMDiS/src/DOFMatrix.cc b/AMDiS/src/DOFMatrix.cc index c410707e..519aa4bb 100644 --- a/AMDiS/src/DOFMatrix.cc +++ b/AMDiS/src/DOFMatrix.cc @@ -245,10 +245,8 @@ namespace AMDiS { std::vector<Operator*>::iterator it = operators.begin(); std::vector<double*>::iterator factorIt = operatorFactor.begin(); for (; it != operators.end(); ++it, ++factorIt) - if ((*it)->getNeedDualTraverse() == false) { - // MSG("OP NO NEED DT!\n"); + if ((*it)->getNeedDualTraverse() == false) (*it)->getElementMatrix(elInfo, elementMatrix, *factorIt ? **factorIt : 1.0); - } if (factor != 1.0) elementMatrix *= factor; diff --git a/AMDiS/src/OEMSolver.h b/AMDiS/src/OEMSolver.h index cbe01727..4ccd2320 100644 --- a/AMDiS/src/OEMSolver.h +++ b/AMDiS/src/OEMSolver.h @@ -73,10 +73,7 @@ namespace AMDiS { /// virtual ~OEMSolver() - { - if (leftPrecon) delete leftPrecon; - if (rightPrecon) delete rightPrecon; - } + {} void initParameters() { @@ -96,9 +93,7 @@ namespace AMDiS { */ void setLeftPrecon(ITL_BasePreconditioner* p) { - if (leftPrecon) - delete leftPrecon; - leftPrecon = p; + leftPrecon = p; } /** Set right Preconditioner @@ -108,24 +103,21 @@ namespace AMDiS { */ void setRightPrecon(ITL_BasePreconditioner* p) { - if (rightPrecon) - delete rightPrecon; - rightPrecon = p; + rightPrecon = p; } /// Linear System to be solved in the derived class - virtual int solveSystem(const DOFMatrix::base_matrix_type& A, - mtl::dense_vector<value_type>& x, - const mtl::dense_vector<value_type>& b) = 0; + virtual int solveSystem(const DOFMatrix::base_matrix_type& A, + mtl::dense_vector<value_type>& x, + const mtl::dense_vector<value_type>& b) = 0; /// Solve a linear system for a scalar problem. int solveSystem(const SolverMatrix<DOFMatrix>& A, - DOFVector<double>& x, - DOFVector<double>& b) + DOFVector<double>& x, + DOFVector<double>& b) { - mtl::dense_vector<value_type> xx(x.getUsedSize()), - bb(b.getUsedSize()); + mtl::dense_vector<value_type> xx(x.getUsedSize()), bb(b.getUsedSize()); // Copy rhs vector int counter = 0; @@ -236,13 +228,13 @@ namespace AMDiS { /// Returns number of iterations in last run of an iterative solver inline int getIterations() { - return iterations; + return iterations; } /// Returns error code in last run of an iterative solver inline int getErrorCode() { - return error; + return error; } /// Sets \ref info diff --git a/AMDiS/src/UmfPackSolver.h b/AMDiS/src/UmfPackSolver.h index 91213a9c..c68a4db8 100644 --- a/AMDiS/src/UmfPackSolver.h +++ b/AMDiS/src/UmfPackSolver.h @@ -58,7 +58,7 @@ namespace AMDiS { }; /// Constructor - UmfPackSolver(::std::string name) + UmfPackSolver(std::string name) : OEMSolver(name), solver(0), store_symbolic(0), @@ -76,9 +76,9 @@ namespace AMDiS { } /// Solves the system directly - int solveSystem(const DOFMatrix::base_matrix_type& A, - mtl::dense_vector<value_type>& x, - const mtl::dense_vector<value_type>& b) + int solveSystem(const DOFMatrix::base_matrix_type& A, + mtl::dense_vector<value_type>& x, + const mtl::dense_vector<value_type>& b) { if (!solver) { if (!symmetric_strategy) @@ -90,10 +90,10 @@ namespace AMDiS { if (store_symbolic) solver->update_numeric(); else - solver->update(); - } + solver->update(); + } - int code= (*solver)(x, b); + int code = (*solver)(x, b); mtl::dense_vector<value_type> r(b); r -= A * x; residual = two_norm(r); -- GitLab