Skip to content
Snippets Groups Projects
Commit 321d444f authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

Merge branch 'vdgnguyen' into 'master'

add equal tensor operations

See merge request gmsh/gmsh!43
parents 52c24ab5 73086aa9
No related branches found
No related tags found
No related merge requests found
......@@ -281,8 +281,9 @@ class STensor3 {
return ithis;
}
void operator = (const STensor3 &other){
STensor3& operator = (const STensor3 &other){
for (int i = 0; i < 9; i++) _val[i] = other._val[i];
return *this;
}
STensor3 operator + (const STensor3 &other) const
......
......@@ -70,6 +70,12 @@ class SVector3 {
P[0] = v; P[1] = v; P[2] = v;
return *this;
}
SVector3 & operator = (const SVector3& a)
{
P[0] = a[0]; P[1] = a[1]; P[2] = a[2];
return *this;
}
operator double *() { return P; }
void print(std::string name="") const
{
......
......@@ -83,11 +83,17 @@ class STensor43 {
for (int i = 0; i < 81; i++) _val[i] -= other._val[i];
return *this;
}
STensor43& operator = (const STensor43 &other)
{
for (int i = 0; i < 81; i++) _val[i] = other._val[i];
return *this;
}
STensor43& operator *= (const double &other)
{
for (int i = 0; i < 81; i++) _val[i] *= other;
return *this;
}
STensor43 transpose (int n, int m) const
{
STensor43 ithis;
......
......@@ -18,6 +18,15 @@ class STensor53 {
inline double operator()(int i, int j, int k, int l, int m) const{
return _val[i][j][k][l][m];
};
STensor53& operator = (const STensor53 &other){
for (int i=0; i<3; i++)
for (int j=0; j<3; j++)
for (int k=0; k<3; k++)
for (int l=0; l<3; l++)
for (int m=0; m<3; m++)
_val[i][j][k][l][m] = other._val[i][j][k][l][m];
return *this;
};
STensor53& operator += (const STensor53 &other){
for (int i=0; i<3; i++)
for (int j=0; j<3; j++)
......
......@@ -18,6 +18,16 @@ class STensor63{
inline double operator()(int i, int j, int k, int l, int m, int n) const{
return _val[i][j][k][l][m][n];
};
STensor63& operator = (const STensor63 &other){
for (int i=0; i<3; i++)
for (int j=0; j<3; j++)
for (int k=0; k<3; k++)
for (int l=0; l<3; l++)
for (int m=0; m<3; m++)
for (int n=0; n<3; n++)
_val[i][j][k][l][m][n] = other._val[i][j][k][l][m][n];
return *this;
};
STensor63& operator += (const STensor63 &other){
for (int i=0; i<3; i++)
for (int j=0; j<3; j++)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment