From 3d1046c22a774afd59c1631d5555ea52dc56c89e Mon Sep 17 00:00:00 2001 From: Nicolas Marsic <nicolas.marsic@gmail.com> Date: Fri, 1 Jun 2012 15:51:48 +0000 Subject: [PATCH] Port to fullVector (WARNING: Still use Vector<Polynomial>) --- FunctionSpace/CMakeLists.txt | 5 ++-- FunctionSpace/Vector.h | 12 ++------ FunctionSpace/VectorDouble.cpp | 44 ------------------------------ FunctionSpace/VectorPolynomial.cpp | 8 +++--- 4 files changed, 8 insertions(+), 61 deletions(-) delete mode 100644 FunctionSpace/VectorDouble.cpp diff --git a/FunctionSpace/CMakeLists.txt b/FunctionSpace/CMakeLists.txt index 8f229bd95c..7ac05285d6 100644 --- a/FunctionSpace/CMakeLists.txt +++ b/FunctionSpace/CMakeLists.txt @@ -4,7 +4,6 @@ # bugs and problems to <gmsh@geuz.org>. set(SRC - VectorDouble.cpp VectorPolynomial.cpp Polynomial.cpp Legendre.cpp @@ -22,5 +21,5 @@ set(SRC file(GLOB HDR RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h) append_gmsh_src(FunctionSpace "${SRC};${HDR}") -## Compatibility wicth SmallFEM (TO BE REMOVED !!!) -add_sources_in_gmsh(FunctionSpace "${SRC}") \ No newline at end of file +## Compatibility with SmallFEM (TO BE REMOVED !!!) +add_sources_in_gmsh(FunctionSpace "${SRC}") diff --git a/FunctionSpace/Vector.h b/FunctionSpace/Vector.h index b808b73a74..361a16c263 100644 --- a/FunctionSpace/Vector.h +++ b/FunctionSpace/Vector.h @@ -7,6 +7,7 @@ extern "C"{ #include <cblas.h> } +#include "fullMatrix.h" #include "Exception.h" /** @@ -49,7 +50,7 @@ class Vector{ T get(const int i) const; void set(const int i, const T a); - Vector<double> at(const double x, const double y, const double z) const; + fullVector<double> at(const double x, const double y, const double z) const; Vector<T> operator+(const Vector<T>& other); Vector<T> operator-(const Vector<T>& other); @@ -223,13 +224,4 @@ inline void Vector<T>::set(const int i, const T a){ v[i] = a; } -////////////////////////////////////////////////////////////////////// -// Inline Vector<double> Implementations // -////////////////////////////////////////////////////////////////////// - -template<> -inline double Vector<double>::dot(const Vector<double>& v) const{ - return cblas_ddot(N, (*this).v, 1, v.v, 1); -} - #endif diff --git a/FunctionSpace/VectorDouble.cpp b/FunctionSpace/VectorDouble.cpp deleted file mode 100644 index a0c1dcbe98..0000000000 --- a/FunctionSpace/VectorDouble.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include <sstream> -#include "Vector.h" - -using namespace std; - -template<> -void Vector<double>::allToZero(void){ - for(int i = 0; i < N; i++) - v[i] = 0.0; -} - -template<> -void Vector<double>::add(const Vector<double>& b){ - if(this->N != b.N) - throw Exception("Vectors must be with of the same size"); - - for(int i = 0; i < N; i++) - v[i] += b.v[i]; -} - -template<> -void Vector<double>::sub(const Vector<double>& b){ - if(this->N != b.N) - throw Exception("Vectors must be with of the same size"); - - for(int i = 0; i < N; i++) - v[i] -= b.v[i]; -} - -template<> -void Vector<double>::mul(const double& alpha){ - for(int i = 0; i < N; i++) - v[i] *= alpha; -} - -template<> -string Vector<double>::toString(void) const{ - stringstream s; - - for(int i = 0; i < N; i++) - s << scientific << showpos << v[i] << endl; - - return s.str(); -} diff --git a/FunctionSpace/VectorPolynomial.cpp b/FunctionSpace/VectorPolynomial.cpp index 7cd83e08dc..9aa3d249c5 100644 --- a/FunctionSpace/VectorPolynomial.cpp +++ b/FunctionSpace/VectorPolynomial.cpp @@ -5,10 +5,10 @@ using namespace std; template<> -Vector<double> Vector<Polynomial>::at(const double x, - const double y, - const double z) const{ - Vector<double> val(N); +fullVector<double> Vector<Polynomial>::at(const double x, + const double y, + const double z) const{ + fullVector<double> val(N); for(int i = 0; i < N; i++) val(i) = v[i].at(x, y, z); -- GitLab