Skip to content
Snippets Groups Projects
Commit c321e652 authored by Jean-François Remacle's avatar Jean-François Remacle
Browse files

gbricteux

parent cc86cd49
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
// bugs and problems to <gmsh@geuz.org>. // bugs and problems to <gmsh@geuz.org>.
#include <complex> #include <complex>
#include <string.h>
#include "GmshConfig.h" #include "GmshConfig.h"
#include "GmshMatrix.h" #include "GmshMatrix.h"
#include "GmshMessage.h" #include "GmshMessage.h"
...@@ -120,11 +121,11 @@ bool gmshMatrix<double>::invertInPlace() ...@@ -120,11 +121,11 @@ bool gmshMatrix<double>::invertInPlace()
int *ipiv = new int[N]; int *ipiv = new int[N];
double * invA = new double[N*N]; double * invA = new double[N*N];
for (size_t i=0;i<N*N;i++) invA[i ] = 0.; for (size_t i = 0; i < N * N; i++) invA[i] = 0.;
for (size_t i=0;i<N;i++) invA[i*N+i] = 1.; for (size_t i = 0; i < N; i++) invA[i * N + i] = 1.;
dgesv_(&N, &nrhs, _data, &lda, ipiv, invA, &ldb, &info); dgesv_(&N, &nrhs, _data, &lda, ipiv, invA, &ldb, &info);
std::memcpy(_data,invA,N*N*sizeof(double)); memcpy(_data, invA, N * N * sizeof(double));
delete [] invA; delete [] invA;
delete [] ipiv; delete [] ipiv;
......
...@@ -78,7 +78,7 @@ class gmshMatrix ...@@ -78,7 +78,7 @@ class gmshMatrix
gmshMatrix(const gmshMatrix<scalar> &other) : _r(other._r), _c(other._c) gmshMatrix(const gmshMatrix<scalar> &other) : _r(other._r), _c(other._c)
{ {
_data = new scalar[_r * _c]; _data = new scalar[_r * _c];
memcpy(other); gM_memcpy(other);
} }
gmshMatrix() : _r(0), _c(0), _data(0) {} gmshMatrix() : _r(0), _c(0), _data(0) {}
~gmshMatrix() { if(_data) delete [] _data; } ~gmshMatrix() { if(_data) delete [] _data; }
...@@ -90,11 +90,11 @@ class gmshMatrix ...@@ -90,11 +90,11 @@ class gmshMatrix
_r = other._r; _r = other._r;
_c = other._c; _c = other._c;
_data = new scalar[_r * _c]; _data = new scalar[_r * _c];
memcpy(other); gM_memcpy(other);
} }
return *this; return *this;
} }
void memcpy(const gmshMatrix<scalar> &other) void gM_memcpy(const gmshMatrix<scalar> &other)
{ {
for(int i = 0; i < _r * _c; ++i) _data[i] = other._data[i]; for(int i = 0; i < _r * _c; ++i) _data[i] = other._data[i];
} }
......
...@@ -41,7 +41,7 @@ void gmshLaplaceTerm::elementMatrix(MElement *e, gmshMatrix<double> &m) const ...@@ -41,7 +41,7 @@ void gmshLaplaceTerm::elementMatrix(MElement *e, gmshMatrix<double> &m) const
for (int k = 0; k <= j; k++){ for (int k = 0; k <= j; k++){
m(j, k) += (Grads[j][0] * Grads[k][0] + m(j, k) += (Grads[j][0] * Grads[k][0] +
Grads[j][1] * Grads[k][1] + Grads[j][1] * Grads[k][1] +
Grads[j][2] * Grads[k][2]) * weight * detJ * _diff * 0.5; Grads[j][2] * Grads[k][2]) * weight * detJ * _diff;
} }
} }
} }
......
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