Skip to content
Snippets Groups Projects
Commit 3d1046c2 authored by Nicolas Marsic's avatar Nicolas Marsic
Browse files

Port to fullVector (WARNING: Still use Vector<Polynomial>)

parent aa5959b2
No related branches found
No related tags found
No related merge requests found
......@@ -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}")
......@@ -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
#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();
}
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment