muMECH  1.0
mesoface.cpp
Go to the documentation of this file.
1 //********************************************************************************************************
2 // code: ### ### ##### #### ## ##
3 // ## ## ######## ## ## ## ## ##
4 // ## ## ## ## ## ### ## ######
5 // ## ## ## ## ## ## ## ## ##
6 // ##### ## ## ##### #### ## ##
7 // ##
8 //
9 // name: mesoface.cpp
10 // author(s): Lukas Zrubek, Ladislav Svoboda
11 // language: C, C++
12 // license: This program is free software; you can redistribute it and/or modify
13 // it under the terms of the GNU Lesser General Public License as published by
14 // the Free Software Foundation; either version 2 of the License, or
15 // (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU Lesser General Public License for more details.
21 //
22 // You should have received a copy of the GNU Lesser General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 //********************************************************************************************************
26 
27 #include "mesoface.h"
28 #include "meso2d.h"
29 #include "meso3d.h"
30 #include "inclusion.h"
31 #include "mathlib.h"
32 
33 namespace mumech {
34 
35 
37 int MesoFace :: ellipsoids_overlap (const Inclusion* inc1, const Inclusion* inc2)
38 {
39  meso3d::ellipsoid_rec first, second;
40 
41  fill_ellipsoid_rec (inc1, first);
44 
45  fill_ellipsoid_rec (inc2, second);
48 
49  return meso3d::check_ellipsoid_ellipsoid_overlap (&first, &second);
50 }
51 
53 bool MesoFace :: ellipses_overlap (const Inclusion *inc1, const Inclusion *inc2)
54 {
55  meso2d::ellipse_rec first, second;
56 
57  fill_ellipse_rec (inc1, first);
60 
61  fill_ellipse_rec (inc2, second);
64 
65  return meso2d::check_ellipse_ellipse_overlap (&first, &second);
66 }
67 
70 {
71  // id of ellipsoid
72  L.id = inc->id;
73 
74  // coordinates of center of ellipsoid in global coordinate system
75  L.center.x = inc->origin[0];
76  L.center.y = inc->origin[1];
77  L.center.z = inc->origin[2];
78 
79  // TOTO tady nemusi byt, major, minor a middle nakrmime radkami rotacni matice na inkluzi
80  // coordinates of point on the positive major semiaxe
81  L.major.x = inc->a[0]; L.major.y = 0.0; L.major.z = 0.0;
82  // potreba spocita polohu tohoto bodu v zavislosti na natoceni inkluze
84  // potreba posunout bod o souradnice stredu inkluze
85  L.major.x += inc->origin[0]; L.major.y += inc->origin[1]; L.major.z += inc->origin[2];
86 
87  // coordinates of point on the positive middle semiaxe
88  // nenacita se => neni treba
89  // L.middle.x = 1; L.middle.y = 1; L.middle.z = 1;
90 
91  // coordinates of point on half plane given by major axis and positive minor axis
92  L.minor.x = 0.0; L.minor.y = 0.0; L.minor.z = inc->a[2];
93  // potreba spocita polohu tohoto bodu v zavislosti na natoceni inkluze
95  // potreba posunout bod o souradnice stredu inkluze
96  L.minor.x += inc->origin[0]; L.minor.y += inc->origin[1]; L.minor.z += inc->origin[2];
97  // TOTO
98 
99  // size of major semiaxe
100  L.max = inc->a[0];
101  // size of middle semiaxe
102  L.mid = inc->a[1];
103  // size of minor semiaxe
104  L.min = inc->a[2];
105 
106  // msz = mesh size
107  // size of internal mesh size
108  L.internal_msz = 0.0;
109  // size of boundary mesh size
110  L.boundary_msz = 0.0;
111 
112  L.property = 0; L.interface = 0; L.bc = 0; L.region = 0;
113  // L.crack = NULL; // neni nutne, je zakomentovano ve strukture
114 
115  return;
116 }
117 
119 {
120  rotate_point_about_Z_axis (eAngles[2], point, COUNTER_CLOCKWISE);
121  rotate_point_about_X_axis (eAngles[1], point, COUNTER_CLOCKWISE);
122  rotate_point_about_Z_axis (eAngles[0], point, COUNTER_CLOCKWISE);
123 
124  return;
125 }
126 
129 {
130  // id of ellipsoid
131  L.id = inc->id;
132 
133  // coordinates of center of ellipsoid in global coordinate system
134  L.center.x = inc->origin[0];
135  L.center.y = inc->origin[1];
136 
137  // angle of ellipse
138  L.angle = inc->eAngles[0];
139 
140  // size of major semiaxe
141  L.max = inc->a[0];
142  // size of min semiaxe
143  L.min = inc->a[1];
144 
145  // msz = mesh size
146  // size of internal mesh size
147  L.internal_msz = 0.0;
148  // size of boundary mesh size
149  L.boundary_msz = 0.0;
150 
151  L.property = 0; L.interface = 0; L.bc = 0;
152  // L.crack = NULL; // commented in structure
153 
154  return;
155 }
156 
157 
158 
161 {
162  double Rx[3][3];
163  if (r == CLOCKWISE) {
164  Rx[0][0] = 1.0; Rx[0][1] = 0.0; Rx[0][2] = 0.0;
165  Rx[1][0] = 0.0; Rx[1][1] = cos (alpha); Rx[1][2] = sin (alpha);
166  Rx[2][0] = 0.0; Rx[2][1] = -sin (alpha); Rx[2][2] = cos (alpha);
167  }
168  if (r == COUNTER_CLOCKWISE) {
169  Rx[0][0] = 1.0; Rx[0][1] = 0.0; Rx[0][2] = 0.0;
170  Rx[1][0] = 0.0; Rx[1][1] = cos (alpha); Rx[1][2] = -sin (alpha);
171  Rx[2][0] = 0.0; Rx[2][1] = sin (alpha); Rx[2][2] = cos (alpha);
172  }
173 
174  double x = point.x, y = point.y, z = point.z;
175  point.x = Rx[0][0] * x + Rx[0][1] * y + Rx[0][2] * z;
176  point.y = Rx[1][0] * x + Rx[1][1] * y + Rx[1][2] * z;
177  point.z = Rx[2][0] * x + Rx[2][1] * y + Rx[2][2] * z;
178 
179  return;
180 }
181 
184 {
185  double Ry[3][3];
186  if (r == CLOCKWISE) {
187  Ry[0][0] = cos (alpha); Ry[0][1] = 0.0; Ry[0][2] = -sin (alpha);
188  Ry[1][0] = 0.0; Ry[1][1] = 1.0; Ry[1][2] = 0.0;
189  Ry[2][0] = sin (alpha); Ry[2][1] = 0.0; Ry[2][2] = cos (alpha);
190  }
191  if (r == COUNTER_CLOCKWISE) {
192  Ry[0][0] = cos (alpha); Ry[0][1] = 0.0; Ry[0][2] = sin (alpha);
193  Ry[1][0] = 0.0; Ry[1][1] = 1.0; Ry[1][2] = 0.0;
194  Ry[2][0] = -sin (alpha); Ry[2][1] = 0.0; Ry[2][2] = cos (alpha);
195  }
196 
197  double x = point.x, y = point.y, z = point.z;
198  point.x = Ry[0][0] * x + Ry[0][1] * y + Ry[0][2] * z;
199  point.y = Ry[1][0] * x + Ry[1][1] * y + Ry[1][2] * z;
200  point.z = Ry[2][0] * x + Ry[2][1] * y + Ry[2][2] * z;
201 
202  return;
203 }
204 
207 {
208  double Rz[3][3];
209  if (r == CLOCKWISE) {
210  Rz[0][0] = cos (alpha); Rz[0][1] = sin (alpha); Rz[0][2] = 0.0;
211  Rz[1][0] = -sin (alpha); Rz[1][1] = cos (alpha); Rz[1][2] = 0.0;
212  Rz[2][0] = 0.0; Rz[2][1] = 0.0; Rz[2][2] = 1.0;
213  }
214  if (r == COUNTER_CLOCKWISE) {
215  Rz[0][0] = cos (alpha); Rz[0][1] = -sin (alpha); Rz[0][2] = 0.0;
216  Rz[1][0] = sin (alpha); Rz[1][1] = cos (alpha); Rz[1][2] = 0.0;
217  Rz[2][0] = 0.0; Rz[2][1] = 0.0; Rz[2][2] = 1.0;
218  }
219 
220  double x = point.x, y = point.y, z = point.z;
221  point.x = Rz[0][0] * x + Rz[0][1] * y + Rz[0][2] * z;
222  point.y = Rz[1][0] * x + Rz[1][1] * y + Rz[1][2] * z;
223  point.z = Rz[2][0] * x + Rz[2][1] * y + Rz[2][2] * z;
224 
225  return;
226 }
227 
228 
229 
230 } // end of namespace mumech
231 
232 /*end of file*/
void check_ellipsoid_rec_consistency(meso3d::ellipsoid_rec &L)
ADDED for muMech needs.
Definition: meso3d.cpp:884
double * origin
coordinates of the inclusions' centorids
Definition: inclusion.h:75
static void rotate_point_about_X_axis(const double alpha, meso3d::point_rec &point, rotation r)
Definition: mesoface.cpp:160
int check_ellipsoid_ellipsoid_overlap(ellipsoid_rec *ellipsoid1, ellipsoid_rec *ellipsoid2)
Definition: meso3d.cpp:10164
point_rec center
Definition: meso2d.h:61
Ellipsoid record.
Definition: meso3d.h:65
Class InclusionRecord contains and handles all inclusion data.
Definition: inclusion.h:60
void transfom_ellipsoid_rec(meso3d::ellipsoid_rec &L)
ADDED for muMech needs.
Definition: meso3d.cpp:948
double boundary_msz
Definition: meso3d.h:72
point_rec minor
Definition: meso3d.h:70
Ellipsoid record.
Definition: meso2d.h:57
void transfom_ellipse_rec(meso2d::ellipse_rec &L)
ADDED for muMech needs.
Definition: meso2d.cpp:317
MESO2d - library of functions for geometry analysis of ellipses and preprocesor for T3d...
double * eAngles
Euller angles.
Definition: inclusion.h:77
static void fill_ellipsoid_rec(const Inclusion *inc, meso3d::ellipsoid_rec &L)
Definition: mesoface.cpp:69
static void rotate_point_by_euler_angles_in_313_notation(const double *eAngles, meso3d::point_rec &point)
Definition: mesoface.cpp:118
point_rec center
Definition: meso3d.h:69
bool check_ellipse_ellipse_overlap(ellipse_rec *ellipse1, ellipse_rec *ellipse2)
Definition: meso2d.cpp:2392
Class inclusion contains and handles all inclusion data.
double internal_msz
Definition: meso2d.h:63
static void rotate_point_about_Z_axis(const double alpha, meso3d::point_rec &point, rotation r)
Definition: mesoface.cpp:206
rotation
Definition: types.h:72
double * a
Inclusion semiaxes' dimensions in global arrangement.
Definition: inclusion.h:76
static bool ellipses_overlap(const Inclusion *inc1, const Inclusion *inc2)
Definition: mesoface.cpp:53
point_rec major
Definition: meso3d.h:70
Mathematic functions.
long id
identification number
Definition: inclusion.h:68
static void rotate_point_about_Y_axis(const double alpha, meso3d::point_rec &point, rotation r)
Definition: mesoface.cpp:183
Class mesoface.
double internal_msz
Definition: meso3d.h:72
MESO3d - library of functions for geometry analysis of ellipsoids and preprocesor for T3d...
double boundary_msz
Definition: meso2d.h:63
Point record.
Definition: meso3d.h:50
static int ellipsoids_overlap(const Inclusion *inc1, const Inclusion *inc2)
Definition: mesoface.cpp:37
void check_ellipse_rec_consistency(meso2d::ellipse_rec &L)
ADDED for muMech needs.
Definition: meso2d.cpp:282
static void fill_ellipse_rec(const Inclusion *inc, meso2d::ellipse_rec &L)
Definition: mesoface.cpp:128