1 |
francois |
17 |
//---------------------------------------------------------------------------
|
2 |
|
|
|
3 |
|
|
#ifndef ot_tenseurH
|
4 |
|
|
#define ot_tenseurH
|
5 |
|
|
//---------------------------------------------------------------------------
|
6 |
|
|
|
7 |
souaissa |
58 |
#ifdef WINDOWS_VERSION
|
8 |
francois |
17 |
#ifdef BUILT_DLL_OUTIL
|
9 |
souaissa |
58 |
#define DLLPORTVECTORISATION __declspec(dllexport)
|
10 |
francois |
17 |
#else
|
11 |
souaissa |
58 |
#define DLLPORTVECTORISATION __declspec(dllimport)
|
12 |
francois |
17 |
#endif
|
13 |
|
|
#else
|
14 |
souaissa |
58 |
#define DLLPORTVECTORISATION
|
15 |
francois |
17 |
#endif
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
#include "ot_doubleprecision.h"
|
19 |
souaissa |
58 |
#include <vector>
|
20 |
|
|
#include <iostream>
|
21 |
francois |
17 |
|
22 |
|
|
using namespace std;
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
souaissa |
58 |
template class DLLPORTVECTORISATION std::vector<int>;
|
27 |
|
|
template class DLLPORTVECTORISATION std::vector<double>;
|
28 |
|
|
template class DLLPORTVECTORISATION std::vector<float>;
|
29 |
|
|
template class DLLPORTVECTORISATION std::vector<double2>;
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
template <class T1,int Dim=3>
|
33 |
|
|
class DLLPORTVECTORISATION OT_TNS
|
34 |
|
|
{
|
35 |
|
|
|
36 |
|
|
public:
|
37 |
|
|
OT_TNS();
|
38 |
|
|
OT_TNS(vector<T1>&,vector<T1>&);
|
39 |
|
|
OT_TNS(vector<T1>&);
|
40 |
|
|
OT_TNS(int n1,T1* tab);
|
41 |
|
|
OT_TNS(int n1,int n2,T1* tab1,T1* tab2);
|
42 |
|
|
OT_TNS(const OT_TNS& ot);
|
43 |
|
|
virtual ~OT_TNS();
|
44 |
|
|
|
45 |
|
|
OT_TNS<T1,Dim>& operator = (const OT_TNS<T1,Dim>& ot);
|
46 |
|
|
vector<T1> operator[](int i);
|
47 |
|
|
T1& operator()(int i,int j);
|
48 |
|
|
T1& operator()(int i,int j)const;
|
49 |
|
|
friend OT_TNS<T1,Dim> operator+(const OT_TNS<T1,Dim>& ot1,const OT_TNS<T1,Dim>& ot2)
|
50 |
|
|
{
|
51 |
|
|
assert (ot1.nb_lgns()==ot2.nb_lgns()&&ot1.nb_cols()==ot2.nb_cols());
|
52 |
|
|
OT_TNS<T1,Dim> res;
|
53 |
|
|
for(int i=0;i<ot1.nb_lgns();i++)
|
54 |
|
|
{
|
55 |
|
|
for(int j=0;j<ot2.nb_cols();j++)
|
56 |
|
|
{
|
57 |
|
|
res(i,j)=ot1(i,j)+ot2(i,j);
|
58 |
|
|
}
|
59 |
|
|
}
|
60 |
|
|
|
61 |
|
|
return res;
|
62 |
|
|
}
|
63 |
|
|
friend int operator == (const OT_TNS<T1,Dim>& t1,const OT_TNS<T1,Dim>&t2){ int equa=0;
|
64 |
|
|
if(t1.nb_lgns()!=t2.nb_lgns()||t1.nb_cols()!=t2.nb_cols()) return 0;
|
65 |
|
|
else {
|
66 |
|
|
for(int i=0;i<t1.nb_lgns();i++)
|
67 |
|
|
{
|
68 |
|
|
for(int j=0;j<t1.nb_cols();j++)
|
69 |
|
|
{
|
70 |
|
|
double2 val1=t1(i,j);
|
71 |
|
|
double2 val2=t1(i,j);
|
72 |
|
|
if(!(val1==val2))
|
73 |
|
|
return equa;
|
74 |
|
|
}
|
75 |
|
|
|
76 |
|
|
}
|
77 |
|
|
}
|
78 |
|
|
equa=1;
|
79 |
|
|
return equa;
|
80 |
|
|
}
|
81 |
|
|
int nb_lgns()const;
|
82 |
|
|
int nb_cols()const;
|
83 |
|
|
int get_spcedim()const;
|
84 |
|
|
friend std::ostream& operator<<(std::ostream& os,const OT_TNS<T1,Dim>& tns){
|
85 |
|
|
for(int i=0;i<tns.nb_lgns();i++) {
|
86 |
|
|
for(int j=0;j<tns.nb_cols();j++) {
|
87 |
|
|
os<<setw(18)<<tns(i,j);
|
88 |
|
|
}
|
89 |
|
|
os<<endl;
|
90 |
|
|
}
|
91 |
|
|
return os;
|
92 |
|
|
}
|
93 |
|
|
|
94 |
|
|
virtual int is_equivalent_at(const OT_TNS<double2,Dim>& tns);
|
95 |
|
|
virtual int existe(const vector<double2>& vct,double2 val,int& idx);
|
96 |
|
|
virtual int existe(const vector<int>& vct,int val,int& idx) ;
|
97 |
|
|
virtual int existe(const vector<double>& vct,double val,int& idx) ;
|
98 |
|
|
|
99 |
|
|
private:
|
100 |
|
|
|
101 |
|
|
T1* t;
|
102 |
|
|
int Dim_Spce;
|
103 |
|
|
int Dim_t1;
|
104 |
|
|
int Dim_t2;
|
105 |
|
|
} ;
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
template class DLLPORTVECTORISATION OT_TNS<double,3>;
|
109 |
|
|
template class DLLPORTVECTORISATION OT_TNS<double2,3>;
|
110 |
|
|
template class DLLPORTVECTORISATION OT_TNS<double,4>;
|
111 |
|
|
template class DLLPORTVECTORISATION OT_TNS<double2,4>;
|
112 |
|
|
|
113 |
|
|
DLLPORTVECTORISATION int operator==(const OT_TNS<double,3>& t1,const OT_TNS<double,3>&t2);
|
114 |
|
|
DLLPORTVECTORISATION int operator==(const OT_TNS<double2,3>& t1,const OT_TNS<double2,3>&t2);
|
115 |
|
|
DLLPORTVECTORISATION std::ostream& operator<<(std::ostream& os,const OT_TNS<double,3>& tns);
|
116 |
|
|
DLLPORTVECTORISATION std::ostream& operator<<(std::ostream& os,const OT_TNS<double2,3>& tns);
|
117 |
|
|
DLLPORTVECTORISATION OT_TNS<double,3> operator+(const OT_TNS<double,3>& ot1,const OT_TNS<double,3>& ot2) ;
|
118 |
|
|
DLLPORTVECTORISATION OT_TNS<int,3> operator+(const OT_TNS<int,3>& ot1,const OT_TNS<int,3>& ot2) ;
|
119 |
|
|
DLLPORTVECTORISATION OT_TNS<double2,3> operator+(const OT_TNS<double2,3>& ot1,const OT_TNS<double2,3>& ot2) ;
|
120 |
|
|
DLLPORTVECTORISATION OT_TNS<double,4> operator+(const OT_TNS<double,4>& ot1,const OT_TNS<double,4>& ot2) ;
|
121 |
|
|
DLLPORTVECTORISATION OT_TNS<int,4> operator+(const OT_TNS<int,4>& ot1,const OT_TNS<int,4>& ot2) ;
|
122 |
|
|
|
123 |
francois |
17 |
#endif
|
124 |
souaissa |
58 |
|
125 |
|
|
|
126 |
|
|
|