| 1 |
francois |
17 |
//---------------------------------------------------------------------------
|
| 2 |
|
|
|
| 3 |
|
|
#ifndef ot_tenseurH
|
| 4 |
|
|
#define ot_tenseurH
|
| 5 |
|
|
//---------------------------------------------------------------------------
|
| 6 |
|
|
|
| 7 |
souaissa |
66 |
#ifdef WINDOWS_VERSION
|
| 8 |
francois |
17 |
#ifdef BUILT_DLL_OUTIL
|
| 9 |
souaissa |
66 |
#define DLLPORTOUTIL __declspec(dllexport)
|
| 10 |
francois |
17 |
#else
|
| 11 |
souaissa |
66 |
#define DLLPORTOUTIL __declspec(dllimport)
|
| 12 |
francois |
17 |
#endif
|
| 13 |
|
|
#else
|
| 14 |
souaissa |
66 |
#define DLLPORTOUTIL
|
| 15 |
francois |
17 |
#endif
|
| 16 |
|
|
|
| 17 |
|
|
|
| 18 |
souaissa |
66 |
|
| 19 |
francois |
17 |
#include "ot_doubleprecision.h"
|
| 20 |
souaissa |
58 |
#include <vector>
|
| 21 |
|
|
#include <iostream>
|
| 22 |
souaissa |
69 |
#include "ot_mathematique.h"
|
| 23 |
francois |
17 |
|
| 24 |
souaissa |
69 |
|
| 25 |
francois |
17 |
using namespace std;
|
| 26 |
|
|
|
| 27 |
|
|
|
| 28 |
souaissa |
69 |
class OT_VECTEUR_4DD;
|
| 29 |
francois |
17 |
|
| 30 |
souaissa |
69 |
|
| 31 |
|
|
class DLLPORTOUTIL OT_TENSEUR
|
| 32 |
|
|
{
|
| 33 |
|
|
|
| 34 |
|
|
public:
|
| 35 |
|
|
OT_TENSEUR();
|
| 36 |
|
|
OT_TENSEUR(int n);
|
| 37 |
|
|
OT_TENSEUR(int n,int m);
|
| 38 |
|
|
OT_TENSEUR(vector<OT_VECTEUR_4DD>&,vector<OT_VECTEUR_4DD>&);
|
| 39 |
|
|
OT_TENSEUR(vector<OT_VECTEUR_4DD>&);
|
| 40 |
|
|
|
| 41 |
|
|
OT_TENSEUR(const OT_TENSEUR& ot);
|
| 42 |
|
|
virtual ~OT_TENSEUR();
|
| 43 |
|
|
|
| 44 |
|
|
OT_TENSEUR& operator = (const OT_TENSEUR& ot);
|
| 45 |
|
|
vector<OT_VECTEUR_4DD> operator[](int i);
|
| 46 |
|
|
double2& operator()(int i,int j);
|
| 47 |
|
|
// double2& operator()(int i,int j)const;
|
| 48 |
|
|
|
| 49 |
|
|
int Get_NbRows()const;
|
| 50 |
|
|
int Get_NbCols()const;
|
| 51 |
|
|
friend OT_TENSEUR operator*( OT_TENSEUR& ot1, OT_TENSEUR& ot2);
|
| 52 |
|
|
friend OT_TENSEUR operator*( double2& coef,OT_TENSEUR& ot );
|
| 53 |
|
|
friend OT_TENSEUR operator*( OT_TENSEUR& ot1, double2& coef);
|
| 54 |
|
|
friend OT_TENSEUR operator+( OT_TENSEUR& ot1, OT_TENSEUR& ot2);
|
| 55 |
|
|
friend int operator == ( OT_TENSEUR& t1, OT_TENSEUR& t2);
|
| 56 |
|
|
friend std::ostream& operator<<(std::ostream& os, OT_TENSEUR& tns);
|
| 57 |
|
|
|
| 58 |
|
|
virtual int is_equivalent_at( OT_TENSEUR& tns);
|
| 59 |
|
|
template<class T>int existe(const vector<T>& vct,T val,int& idx);
|
| 60 |
|
|
virtual void get_orthogonalisation(OT_TENSEUR& a,OT_VECTEUR_4DD& d,OT_TENSEUR& v,int n,int&nrot);
|
| 61 |
|
|
virtual OT_TENSEUR transpose();
|
| 62 |
|
|
|
| 63 |
|
|
private:
|
| 64 |
|
|
vector<double2> data;
|
| 65 |
|
|
int Dim1;
|
| 66 |
|
|
int Dim2;
|
| 67 |
|
|
} ;
|
| 68 |
|
|
|
| 69 |
|
|
|
| 70 |
|
|
DLLPORTOUTIL int operator==(const OT_TENSEUR& t1,const OT_TENSEUR&t2);
|
| 71 |
|
|
DLLPORTOUTIL std::ostream& operator<<(std::ostream& os,const OT_TENSEUR& tns);
|
| 72 |
|
|
DLLPORTOUTIL OT_TENSEUR operator+(const OT_TENSEUR& ot1,const OT_TENSEUR& ot2) ;
|
| 73 |
|
|
DLLPORTOUTIL template<class T>int existe(const vector<T>& vct,double val,int& idx);
|
| 74 |
|
|
DLLPORTOUTIL template<class T>int existe(const vector<T>& vct,double2 val,int& idx);
|
| 75 |
|
|
DLLPORTOUTIL template<class T>int existe(const vector<int>& vct,int val,int& idx);
|
| 76 |
|
|
DLLPORTOUTIL OT_TENSEUR operator*( OT_TENSEUR& ot1, double2& coef);
|
| 77 |
|
|
DLLPORTOUTIL OT_TENSEUR operator*( double2& coef,OT_TENSEUR& ot );
|
| 78 |
|
|
DLLPORTOUTIL OT_TENSEUR operator*( OT_TENSEUR& ot1, OT_TENSEUR& ot2);
|
| 79 |
|
|
#endif
|
| 80 |
|
|
|
| 81 |
|
|
|
| 82 |
|
|
|
| 83 |
|
|
|
| 84 |
|
|
|
| 85 |
|
|
|
| 86 |
|
|
|
| 87 |
|
|
|
| 88 |
|
|
|
| 89 |
|
|
|
| 90 |
|
|
|
| 91 |
|
|
|
| 92 |
|
|
|
| 93 |
|
|
|
| 94 |
|
|
|
| 95 |
|
|
|
| 96 |
|
|
|
| 97 |
|
|
|
| 98 |
|
|
|
| 99 |
|
|
|
| 100 |
|
|
|
| 101 |
|
|
|
| 102 |
|
|
|
| 103 |
|
|
|
| 104 |
|
|
|
| 105 |
|
|
|
| 106 |
|
|
|
| 107 |
|
|
|
| 108 |
|
|
|
| 109 |
|
|
|
| 110 |
|
|
|
| 111 |
|
|
|
| 112 |
|
|
|
| 113 |
|
|
|
| 114 |
|
|
|
| 115 |
|
|
|
| 116 |
|
|
|
| 117 |
|
|
|
| 118 |
|
|
|
| 119 |
|
|
/*
|
| 120 |
souaissa |
66 |
template class DLLPORTOUTIL std::vector<int>;
|
| 121 |
souaissa |
69 |
template class DLLPORTOUTIL std::vector<double2>;
|
| 122 |
souaissa |
66 |
template class DLLPORTOUTIL std::vector<float>;
|
| 123 |
souaissa |
69 |
template class DLLPORTOUTIL std::vector<double22>;
|
| 124 |
souaissa |
58 |
|
| 125 |
|
|
template <class T1,int Dim=3>
|
| 126 |
souaissa |
66 |
class DLLPORTOUTIL OT_TNS
|
| 127 |
souaissa |
58 |
{
|
| 128 |
|
|
|
| 129 |
|
|
public:
|
| 130 |
|
|
OT_TNS();
|
| 131 |
|
|
OT_TNS(vector<T1>&,vector<T1>&);
|
| 132 |
|
|
OT_TNS(vector<T1>&);
|
| 133 |
|
|
OT_TNS(int n1,T1* tab);
|
| 134 |
|
|
OT_TNS(int n1,int n2,T1* tab1,T1* tab2);
|
| 135 |
|
|
OT_TNS(const OT_TNS& ot);
|
| 136 |
|
|
virtual ~OT_TNS();
|
| 137 |
|
|
|
| 138 |
|
|
OT_TNS<T1,Dim>& operator = (const OT_TNS<T1,Dim>& ot);
|
| 139 |
|
|
vector<T1> operator[](int i);
|
| 140 |
|
|
T1& operator()(int i,int j);
|
| 141 |
|
|
T1& operator()(int i,int j)const;
|
| 142 |
|
|
friend OT_TNS<T1,Dim> operator+(const OT_TNS<T1,Dim>& ot1,const OT_TNS<T1,Dim>& ot2)
|
| 143 |
|
|
{
|
| 144 |
|
|
assert (ot1.nb_lgns()==ot2.nb_lgns()&&ot1.nb_cols()==ot2.nb_cols());
|
| 145 |
|
|
OT_TNS<T1,Dim> res;
|
| 146 |
|
|
for(int i=0;i<ot1.nb_lgns();i++)
|
| 147 |
|
|
{
|
| 148 |
|
|
for(int j=0;j<ot2.nb_cols();j++)
|
| 149 |
|
|
{
|
| 150 |
|
|
res(i,j)=ot1(i,j)+ot2(i,j);
|
| 151 |
|
|
}
|
| 152 |
|
|
}
|
| 153 |
|
|
|
| 154 |
|
|
return res;
|
| 155 |
|
|
}
|
| 156 |
|
|
friend int operator == (const OT_TNS<T1,Dim>& t1,const OT_TNS<T1,Dim>&t2){ int equa=0;
|
| 157 |
|
|
if(t1.nb_lgns()!=t2.nb_lgns()||t1.nb_cols()!=t2.nb_cols()) return 0;
|
| 158 |
|
|
else {
|
| 159 |
|
|
for(int i=0;i<t1.nb_lgns();i++)
|
| 160 |
|
|
{
|
| 161 |
|
|
for(int j=0;j<t1.nb_cols();j++)
|
| 162 |
|
|
{
|
| 163 |
souaissa |
69 |
double22 val1=t1(i,j);
|
| 164 |
|
|
double22 val2=t1(i,j);
|
| 165 |
souaissa |
58 |
if(!(val1==val2))
|
| 166 |
|
|
return equa;
|
| 167 |
|
|
}
|
| 168 |
|
|
|
| 169 |
|
|
}
|
| 170 |
|
|
}
|
| 171 |
|
|
equa=1;
|
| 172 |
|
|
return equa;
|
| 173 |
|
|
}
|
| 174 |
|
|
int nb_lgns()const;
|
| 175 |
|
|
int nb_cols()const;
|
| 176 |
|
|
int get_spcedim()const;
|
| 177 |
|
|
friend std::ostream& operator<<(std::ostream& os,const OT_TNS<T1,Dim>& tns){
|
| 178 |
|
|
for(int i=0;i<tns.nb_lgns();i++) {
|
| 179 |
|
|
for(int j=0;j<tns.nb_cols();j++) {
|
| 180 |
|
|
os<<setw(18)<<tns(i,j);
|
| 181 |
|
|
}
|
| 182 |
|
|
os<<endl;
|
| 183 |
|
|
}
|
| 184 |
|
|
return os;
|
| 185 |
|
|
}
|
| 186 |
|
|
|
| 187 |
souaissa |
69 |
virtual int is_equivalent_at(const OT_TNS<double22,Dim>& tns);
|
| 188 |
|
|
virtual int existe(const vector<double22>& vct,double22 val,int& idx);
|
| 189 |
souaissa |
58 |
virtual int existe(const vector<int>& vct,int val,int& idx) ;
|
| 190 |
souaissa |
69 |
virtual int existe(const vector<double2>& vct,double2 val,int& idx) ;
|
| 191 |
souaissa |
58 |
|
| 192 |
|
|
private:
|
| 193 |
|
|
|
| 194 |
|
|
T1* t;
|
| 195 |
|
|
int Dim_Spce;
|
| 196 |
|
|
int Dim_t1;
|
| 197 |
|
|
int Dim_t2;
|
| 198 |
|
|
} ;
|
| 199 |
|
|
|
| 200 |
|
|
|
| 201 |
souaissa |
66 |
template class DLLPORTOUTIL OT_TNS<double2,3>;
|
| 202 |
souaissa |
69 |
template class DLLPORTOUTIL OT_TNS<double22,3>;
|
| 203 |
souaissa |
66 |
template class DLLPORTOUTIL OT_TNS<double2,4>;
|
| 204 |
souaissa |
69 |
template class DLLPORTOUTIL OT_TNS<double22,4>;
|
| 205 |
souaissa |
58 |
|
| 206 |
souaissa |
66 |
DLLPORTOUTIL int operator==(const OT_TNS<double2,3>& t1,const OT_TNS<double2,3>&t2);
|
| 207 |
souaissa |
69 |
DLLPORTOUTIL int operator==(const OT_TNS<double22,3>& t1,const OT_TNS<double22,3>&t2);
|
| 208 |
souaissa |
66 |
DLLPORTOUTIL std::ostream& operator<<(std::ostream& os,const OT_TNS<double2,3>& tns);
|
| 209 |
souaissa |
69 |
DLLPORTOUTIL std::ostream& operator<<(std::ostream& os,const OT_TNS<double22,3>& tns);
|
| 210 |
|
|
DLLPORTOUTIL OT_TNS<double2,3> operator+(const OT_TNS<double2,3>& ot1,const OT_TNS<double2,3>& ot2) ;
|
| 211 |
souaissa |
66 |
DLLPORTOUTIL OT_TNS<int,3> operator+(const OT_TNS<int,3>& ot1,const OT_TNS<int,3>& ot2) ;
|
| 212 |
souaissa |
69 |
DLLPORTOUTIL OT_TNS<double22,3> operator+(const OT_TNS<double22,3>& ot1,const OT_TNS<double22,3>& ot2) ;
|
| 213 |
|
|
DLLPORTOUTIL OT_TNS<double2,4> operator+(const OT_TNS<double2,4>& ot1,const OT_TNS<double2,4>& ot2) ;
|
| 214 |
souaissa |
66 |
DLLPORTOUTIL OT_TNS<int,4> operator+(const OT_TNS<int,4>& ot1,const OT_TNS<int,4>& ot2) ;
|
| 215 |
souaissa |
58 |
|
| 216 |
souaissa |
69 |
#endif */
|
| 217 |
souaissa |
58 |
|
| 218 |
|
|
|
| 219 |
|
|
|