ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/outil/src/ot_tenseur.h
Revision: 951
Committed: Fri Aug 10 15:17:17 2018 UTC (6 years, 9 months ago) by couturad
Content type: text/plain
File size: 9093 byte(s)
Log Message:
-> Ajout de Project Chrono (voir CMakeLists.txt).
-> Ajout d'un générateur de microstructure basé sur la dynamique des corps rigides (MSTRUCT_GENERATEUR_DCR).
-> Ajout d'un opérateur de décallage de la topologie (MG_CG_OP_TRANSF_DECALLAGE).
-> Retrait de «using namespace std»  (conflit avec namespace chrono) et modification des fichiers affectés.
-> Modification de mailleur2d.cpp afin d'enregistrer un fichier MAGiC (void.magic) lorsque le nombre d'itération dépasse la valeur maximale.

File Contents

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