From 73fd276900065e404d9220a49f765a3c69f080e0 Mon Sep 17 00:00:00 2001 From: Michael NDJINGA Date: Mon, 14 Sep 2020 14:49:59 +0200 Subject: [PATCH] Corrected environment files and enabled testing --- CDMATH/base/inc/GenericMatrix.hxx | 4 +++ CDMATH/base/src/GenericMatrix.cxx | 15 ++++++++++ CDMATH/mesh/inc/Field.hxx | 2 +- CDMATH/mesh/src/Field.cxx | 29 ++++++++++--------- CDMATH/postprocessing/VTK_routines.py | 15 +++++----- CDMATH/tests/CMakeLists.txt | 7 ++--- CDMATH/tests/cdmath/CMakeLists.txt | 2 +- .../HeatEquation1DImplicit/CMakeLists.txt | 4 +-- .../Poisson1DEF/FiniteElements1DPoisson.py | 4 +-- .../Poisson1DVF/FiniteVolumes1DPoisson.py | 2 +- .../TransportEquationUpwind.py | 4 +-- .../1DTransportEquationCenteredExplicit.py | 9 +++--- .../CMakeLists.txt | 8 ++--- .../CMakeLists.txt | 4 +-- CDMATH/tests/swig/CMakeLists.txt | 2 +- CMakeLists.txt | 9 +++--- CoreFlows/env_CoreFlows.sh | 2 +- env_SOLVERLAB.sh | 2 +- 18 files changed, 72 insertions(+), 52 deletions(-) mode change 100644 => 100755 CDMATH/base/src/GenericMatrix.cxx mode change 100644 => 100755 CDMATH/tests/examples/HeatEquation1DImplicit/CMakeLists.txt mode change 100644 => 100755 CDMATH/tests/examples/TransportEquation1DCenteredImplicit/CMakeLists.txt mode change 100644 => 100755 CDMATH/tests/examples/TransportEquation1DUpwindImplicit/CMakeLists.txt diff --git a/CDMATH/base/inc/GenericMatrix.hxx b/CDMATH/base/inc/GenericMatrix.hxx index 3cf2231..77735d5 100755 --- a/CDMATH/base/inc/GenericMatrix.hxx +++ b/CDMATH/base/inc/GenericMatrix.hxx @@ -53,6 +53,10 @@ class GenericMatrix virtual double operator ()( int i, int j ) const = 0; + double max() const; + + double min() const; + virtual bool isSymmetric(double tol=1e-6) const ; bool isSquare() const ; diff --git a/CDMATH/base/src/GenericMatrix.cxx b/CDMATH/base/src/GenericMatrix.cxx old mode 100644 new mode 100755 index f9e15be..0d2f5eb --- a/CDMATH/base/src/GenericMatrix.cxx +++ b/CDMATH/base/src/GenericMatrix.cxx @@ -98,6 +98,21 @@ GenericMatrix::coefficient(int index) const return (-1); } + +double +GenericMatrix::max() const +{ + return _values.max(); +} + + +double +GenericMatrix::min() const +{ + return _values.max(); +} + + void GenericMatrix::view() const { diff --git a/CDMATH/mesh/inc/Field.hxx b/CDMATH/mesh/inc/Field.hxx index 752f15c..4323fe0 100755 --- a/CDMATH/mesh/inc/Field.hxx +++ b/CDMATH/mesh/inc/Field.hxx @@ -243,7 +243,7 @@ class Field void setFieldByDataArrayDouble ( const MEDCoupling::DataArrayDouble* array ); - DoubleTab getNormEuclidean( void ) const ; + Vector getNormEuclidean( void ) const ; double max( int component=0 ) const ; diff --git a/CDMATH/mesh/src/Field.cxx b/CDMATH/mesh/src/Field.cxx index 64044f6..699285d 100755 --- a/CDMATH/mesh/src/Field.cxx +++ b/CDMATH/mesh/src/Field.cxx @@ -401,18 +401,21 @@ Field::readFieldMed( const std::string & fileNameRadical, } -DoubleTab +Vector Field::getNormEuclidean() const { - DoubleTab norm(getNumberOfElements(),_field->magnitude()->getArray()->getConstPointer()); - return norm; + Vector result(_numberOfComponents); + DoubleTab norm(_numberOfComponents,_field->magnitude()->getArray()->getConstPointer()); + result.setValues(norm); + + return result; } double Field::max(int component) const { - if( component >= getNumberOfComponents() ) - throw CdmathException("double Field::max() : component number should be smaller than field number of components"); + if( component >= getNumberOfComponents() || component < 0) + throw CdmathException("double Field::max() : component number should be between 0 and the field number of components"); double result=-1e100; for(int i=0; i= getNumberOfComponents() ) - throw CdmathException("double Field::min() : component number should be smaller than field number of components"); + if( component >= getNumberOfComponents() || component < 0) + throw CdmathException("double Field::min() : component number should be between 0 and the field number of components"); double result=1e100; for(int i=0; igetNumberOfComponents(); - int nbElems=getNumberOfElements(); - - Vector result(nbComp);//Vector containing the Linfinity norm of each component + double res[nbComp];//Pointer containing the L2 norm of each component + _field->normMax(res); + Vector result(nbComp);//Vector containing the L2 norm of each component - for(int i=0; iresult(j)) - result(j)=fabs((*this)(i,j)); + for(int i=0; i