21
21
#include "rheolef.h"
22
22
#include "rheolef/geo_element_curved_ball.h"
23
23
using namespace rheolef;
25
24
void put (const geo_basic<Float,sequential>& omega, size_t order, bool check_tetra_with_curved_edge) {
26
25
typedef geo_basic<Float,sequential>::size_type size_type;
27
26
typedef point_basic<size_type> ilat;
32
31
bool have_quad = false;
33
32
array<point,sequential> node = omega.get_nodes();
34
cout << setprecision(7)
35
<< "set xrange ["<<omega.xmin()[0]<<":"<<omega.xmax()[0]<<"]" << endl
36
<< "set yrange ["<<omega.xmin()[1]<<":"<<omega.xmax()[1]<<"]" << endl
33
std::cout << std::setprecision(7)
34
<< "set xrange ["<<omega.xmin()[0]<<":"<<omega.xmax()[0]<<"]" << std::endl
35
<< "set yrange ["<<omega.xmin()[1]<<":"<<omega.xmax()[1]<<"]" << std::endl
39
cout << "set size square" << endl;
38
std::cout << "set size square" << std::endl;
41
cout << "set zrange ["<<omega.xmin()[2]<<":"<<omega.xmax()[2]<<"]" << endl
42
<< "set xyplane at -0.1" << endl
43
<< "set view equal xyz # equal scales" << endl
40
std::cout << "set zrange ["<<omega.xmin()[2]<<":"<<omega.xmax()[2]<<"]" << std::endl
41
<< "set xyplane at -0.1" << std::endl
42
<< "set view equal xyz # equal scales" << std::endl
46
45
for (size_type ie = 0, ne = omega.size(); ie < ne; ie++) {
48
47
switch (K.variant()) {
49
48
case reference_element::t: {
50
49
center = point(-1,-1); radius = sqrt(Float(5));
51
curved_ball_t F (node[K[0]], node[K[1]], node[K[2]], 1, center, radius);
50
curved_ball_t<Float> F (node[K[0]], node[K[1]], node[K[2]], 1, center, radius);
52
51
for (size_type i = 1; i < order; i++) {
53
52
for (size_type j = 1; i+j < order; j++) {
54
53
size_type loc_inod = reference_element_t::ilat2loc_inod (order, ilat(i, j));
55
54
point hat_x (1.*i/order, 1.*j/order);
56
55
point x = F (hat_x);
57
cout << "set label \"(" << i << "," << j << ")\" at " << x[0] << "," << x[1] << endl;
56
std::cout << "set label \"(" << i << "," << j << ")\" at " << x[0] << "," << x[1] << std::endl;
62
61
case reference_element::q: {
64
curved_ball_q F (node[K[1]], node[K[2]], node[K[3]], node[K[0]]);
63
curved_ball_q<Float> F (node[K[1]], node[K[2]], node[K[3]], node[K[0]]);
65
64
for (size_type i = 1; i < order; i++) {
66
65
for (size_type j = 1; j < order; j++) {
67
66
size_type loc_inod = reference_element_q::ilat2loc_inod (order, ilat(i, j));
68
67
point hat_x (-1+2.*i/order, -1+2.*j/order);
69
68
point x = F (hat_x);
70
cout << "set label \"(" << i << "," << j << ")\" at " << x[0] << "," << x[1] << endl;
69
std::cout << "set label \"(" << i << "," << j << ")\" at " << x[0] << "," << x[1] << std::endl;
75
74
case reference_element::T: {
76
75
//center = point(-1,-1,-1); radius = sqrt(Float(6));
77
curved_ball_T F (node[K[0]], node[K[1]], node[K[2]], node[K[3]], center, radius);
76
curved_ball_T<Float> F (node[K[0]], node[K[1]], node[K[2]], node[K[3]], center, radius);
78
77
if (!check_tetra_with_curved_edge) {
79
78
F.set_boundary_face (3);
86
85
size_type loc_inod = reference_element_T::ilat2loc_inod (order, ilat(i, j, k));
87
86
point hat_x (1.*i/order, 1.*j/order, 1.*k/order);
88
87
point x = F (hat_x);
89
cout << "set label \"(" << i << "," << j << "," << k << ")\" at "
90
<< x[0] << "," << x[1] << "," << x[2] << endl;
88
std::cout << "set label \"(" << i << "," << j << "," << k << ")\" at "
89
<< x[0] << "," << x[1] << "," << x[2] << std::endl;
97
96
error_macro ("unexpected variant "<<K.variant());
100
cout << "r = " << radius << endl
101
<< "cx = " << center[0] << endl
102
<< "cy = " << center[1] << endl
99
std::cout << "r = " << radius << std::endl
100
<< "cx = " << center[0] << std::endl
101
<< "cy = " << center[1] << std::endl
105
cout << "cz = " << center[2] << endl;
104
std::cout << "cz = " << center[2] << std::endl;
109
cout << "bdry(x) = (x > 1./sqrt(2.)) ? (cy + sqrt(r**2-(x-cx)**2)) : (1 + ((1. - sqrt(2.))*x))" << endl;
108
std::cout << "bdry(x) = (x > 1./sqrt(2.)) ? (cy + sqrt(r**2-(x-cx)**2)) : (1 + ((1. - sqrt(2.))*x))" << std::endl;
111
cout << "bdry(x) = cy + sqrt(r**2-(x-cx)**2)" << endl;
110
std::cout << "bdry(x) = cy + sqrt(r**2-(x-cx)**2)" << std::endl;
113
cout << "plot bdry(x)" << endl;
112
std::cout << "plot bdry(x)" << std::endl;
115
cout << "bdry(x,y) = cz + sqrt(r**2-(x-cx)**2-(y-cy)**2)" << endl;
116
cout << "splot bdry(x,y)" << endl;
114
std::cout << "bdry(x,y) = cz + sqrt(r**2-(x-cx)**2-(y-cy)**2)" << std::endl;
115
std::cout << "splot bdry(x,y)" << std::endl;
118
cout << "pause -1 \"<retour>\"" << endl;
117
std::cout << "pause -1 \"<retour>\"" << std::endl;
120
119
int main(int argc, char**argv) {
121
120
environment rheolef (argc, argv);