25 #include "sll_memory.h"
26 #include "sll_assert.h"
27 #include "sll_errors.h"
28 #include "sll_working_precision.h"
67 sll_int32 :: num_cells
68 sll_int32 :: num_pts_tot
69 sll_int32 :: num_triangles
70 sll_int32 :: num_edges
72 sll_real64 :: center_x1
73 sll_real64 :: center_x2
83 sll_real64,
pointer,
dimension(:, :) :: cartesian_coord
85 sll_int32,
pointer,
dimension(:, :) :: hex_coord
88 sll_int32,
pointer,
dimension(:) :: global_indices
91 sll_real64,
pointer,
dimension(:, :) :: center_cartesian_coord
94 sll_int32,
pointer,
dimension(:, :) :: center_index
98 sll_int32 :: extra_tables
99 sll_real64,
pointer,
dimension(:, :) :: &
100 edge_center_cartesian_coord
103 sll_int32,
pointer,
dimension(:, :) :: edge_center_index
153 #define TEST_PRESENCE_AND_ASSIGN_VAL( obj, arg, slot, default_val ) \
154 if (
present(arg)) then; \
157 obj%slot = default_val; \
190 EXTRA_TABLES)
result(mesh)
193 sll_int32,
intent(in) :: num_cells
194 sll_real64,
optional,
intent(in) :: radius
195 sll_real64,
optional,
intent(in) :: center_x1
196 sll_real64,
optional,
intent(in) :: center_x2
197 sll_real64,
optional,
intent(in) :: r11, r12
198 sll_real64,
optional,
intent(in) :: r21, r22
199 sll_real64,
optional,
intent(in) :: r31, r32
200 sll_int32,
optional,
intent(in) :: extra_tables
203 sll_allocate(mesh, ierr)
252 sll_int32,
intent(in) :: num_cells
253 sll_real64,
optional,
intent(in) :: radius
254 sll_real64,
optional,
intent(in) :: center_x1
255 sll_real64,
optional,
intent(in) :: center_x2
256 sll_real64,
optional,
intent(in) :: r1_x1, r1_x2
257 sll_real64,
optional,
intent(in) :: r2_x1, r2_x2
258 sll_real64,
optional,
intent(in) :: r3_x1, r3_x2
259 sll_int32,
optional,
intent(in) :: extra_tables
261 sll_int32 :: i, j, global
262 sll_real64 :: position_x1
263 sll_real64 :: position_x2
265 sll_int32 :: index_tab
267 sll_int32 :: num_cells_plus1
268 sll_int32 :: num_cells_plus2
271 test_presence_and_assign_val(mesh, center_x1, center_x1, 0.0_f64)
272 test_presence_and_assign_val(mesh, center_x2, center_x2, 0.0_f64)
275 test_presence_and_assign_val(mesh, radius, radius, 1.0_f64)
281 test_presence_and_assign_val(mesh, r1_x1, r1_x1,
sll_p_sqrt3*0.5_f64)
282 test_presence_and_assign_val(mesh, r1_x2, r1_x2, 0.5_f64)
283 test_presence_and_assign_val(mesh, r2_x1, r2_x1, -
sll_p_sqrt3*0.5_f64)
284 test_presence_and_assign_val(mesh, r2_x2, r2_x2, 0.5_f64)
285 test_presence_and_assign_val(mesh, r3_x1, r3_x1, 0.0_f64)
286 test_presence_and_assign_val(mesh, r3_x2, r3_x2, 1.0_f64)
288 mesh%num_cells = num_cells
289 mesh%delta = mesh%radius/real(num_cells, f64)
292 mesh%num_pts_tot = 3*mesh%num_cells*(mesh%num_cells + 1) + 1
295 mesh%r1_x1 = mesh%r1_x1*mesh%delta
296 mesh%r1_x2 = mesh%r1_x2*mesh%delta
297 mesh%r2_x1 = mesh%r2_x1*mesh%delta
298 mesh%r2_x2 = mesh%r2_x2*mesh%delta
299 mesh%r3_x1 = mesh%r3_x1*mesh%delta
300 mesh%r3_x2 = mesh%r3_x2*mesh%delta
302 if (mesh%radius <= 0.0_f64)
then
303 print *,
'ERROR, initialize_hex_mesh_2d(): ', &
304 'Problem to construct the mesh 2d '
305 print *,
'because radius <= 0.'
308 if (mesh%num_cells <= 0)
then
309 print *,
'ERROR, initialize_hex_mesh_2d(): ', &
310 'Problem to construct the mesh 2d '
311 print *,
'because num_cells <= 0.'
317 sll_allocate(mesh%cartesian_coord(2, mesh%num_pts_tot), ierr)
318 sll_allocate(mesh%hex_coord(2, mesh%num_pts_tot), ierr)
319 sll_allocate(mesh%global_indices(mesh%num_pts_tot), ierr)
320 mesh%cartesian_coord(:, :) = 0._f64
321 mesh%hex_coord(:, :) = 0
322 mesh%global_indices(:) = -1
325 mesh%cartesian_coord(1, 1) = mesh%center_x1
326 mesh%cartesian_coord(2, 1) = mesh%center_x2
329 num_cells_plus1 = num_cells + 1
330 num_cells_plus2 = num_cells + 2
337 position_x1 = mesh%center_x1
338 position_x2 = mesh%center_x2
339 mesh%cartesian_coord(1, global) = position_x1
340 mesh%cartesian_coord(2, global) = position_x2
344 position_x1 = position_x1 + mesh%r1_x1
345 position_x2 = position_x2 + mesh%r1_x2
352 mesh%cartesian_coord(1, global) = position_x1
353 mesh%cartesian_coord(2, global) = position_x2
355 mesh%hex_coord(1, global) = i
356 mesh%hex_coord(2, global) = j - 1
358 position_x1 = position_x1 + mesh%r2_x1
359 position_x2 = position_x2 + mesh%r2_x2
366 mesh%cartesian_coord(1, global) = position_x1
367 mesh%cartesian_coord(2, global) = position_x2
369 mesh%hex_coord(1, global) = i - j + 1
370 mesh%hex_coord(2, global) = i
372 position_x1 = position_x1 - mesh%r1_x1
373 position_x2 = position_x2 - mesh%r1_x2
380 mesh%cartesian_coord(1, global) = position_x1
381 mesh%cartesian_coord(2, global) = position_x2
383 mesh%hex_coord(1, global) = -j + 1
384 mesh%hex_coord(2, global) = i - j + 1
386 position_x1 = position_x1 - mesh%r3_x1
387 position_x2 = position_x2 - mesh%r3_x2
394 mesh%cartesian_coord(1, global) = position_x1
395 mesh%cartesian_coord(2, global) = position_x2
397 mesh%hex_coord(1, global) = -i
398 mesh%hex_coord(2, global) = -j + 1
400 position_x1 = position_x1 - mesh%r2_x1
401 position_x2 = position_x2 - mesh%r2_x2
408 mesh%cartesian_coord(1, global) = position_x1
409 mesh%cartesian_coord(2, global) = position_x2
411 mesh%hex_coord(1, global) = -i + j - 1
412 mesh%hex_coord(2, global) = -i
414 position_x1 = position_x1 + mesh%r1_x1
415 position_x2 = position_x2 + mesh%r1_x2
422 mesh%cartesian_coord(1, global) = position_x1
423 mesh%cartesian_coord(2, global) = position_x2
425 mesh%hex_coord(1, global) = j - 1
426 mesh%hex_coord(2, global) = -i + j - 1
428 position_x1 = position_x1 + mesh%r3_x1
429 position_x2 = position_x2 + mesh%r3_x2
434 do global = 1, mesh%num_pts_tot
436 k1 = mesh%hex_coord(1, global)
437 k2 = mesh%hex_coord(2, global)
446 mesh%global_indices(index_tab) = global
450 mesh%num_triangles = 6*num_cells*num_cells
451 sll_allocate(mesh%center_cartesian_coord(2, mesh%num_triangles), ierr)
452 sll_allocate(mesh%center_index(2, mesh%num_pts_tot), ierr)
459 mesh%num_edges = 3*num_cells*(3*num_cells + 1)
461 test_presence_and_assign_val(mesh, extra_tables, extra_tables, 0)
462 if (mesh%EXTRA_TABLES .eq. 1)
then
463 sll_allocate(mesh%edge_center_cartesian_coord(2, mesh%num_edges), ierr)
464 sll_allocate(mesh%edge_center_index(3, mesh%num_pts_tot), ierr)
480 sll_int32 :: center_index, global
482 sll_real64 :: x1, x2, x3
483 sll_real64 :: y1, y2, y3
484 sll_real64 :: xx, yy, r1x1
485 sll_real64 :: jacob, k1c, k2c
488 jacob = mesh%r1_x1*mesh%r2_x2 - mesh%r2_x1*mesh%r1_x2
490 mesh%center_cartesian_coord(:, :) = 0._f64
491 mesh%center_index(:, :) = -1
495 r1x1 = mesh%r1_x1*real(mesh%num_cells, f64)
497 do global = 1, mesh%num_pts_tot
501 k1 = real(mesh%hex_coord(1, global), f64)
502 k2 = real(mesh%hex_coord(2, global), f64)
506 x1 = k1*mesh%r1_x1 + k2*mesh%r2_x1
507 x2 = k1*mesh%r1_x1 + (k2 + 1)*mesh%r2_x1
508 x3 = (k1 + 1)*mesh%r1_x1 + (k2 + 1)*mesh%r2_x1
509 y1 = k1*mesh%r1_x2 + k2*mesh%r2_x2
510 y2 = k1*mesh%r1_x2 + (k2 + 1)*mesh%r2_x2
511 y3 = (k1 + 1)*mesh%r1_x2 + (k2 + 1)*mesh%r2_x2
513 xx = x2 + ((x3 + x1)*0.5_f64 - x2)*2.0_f64/3.0_f64
514 yy = y2 + ((y3 + y1)*0.5_f64 - y2)*2.0_f64/3.0_f64
520 k1c = abs(mesh%r2_x2*xx - mesh%r2_x1*yy)/abs(jacob)
521 k2c = abs(mesh%r1_x1*yy - mesh%r1_x2*xx)/abs(jacob)
523 if (ceiling(k1c) > mesh%num_cells) inside = .false.
524 if (ceiling(k2c) > mesh%num_cells) inside = .false.
525 if (abs(xx) > r1x1) inside = .false.
528 center_index = center_index + 1
529 mesh%center_cartesian_coord(1, center_index) = xx
530 mesh%center_cartesian_coord(2, center_index) = yy
531 mesh%center_index(1, global) = center_index
535 x1 = k1*mesh%r1_x1 + k2*mesh%r2_x1
536 x2 = (k1 + 1)*mesh%r1_x1 + k2*mesh%r2_x1
537 x3 = (k1 + 1)*mesh%r1_x1 + (k2 + 1)*mesh%r2_x1
538 y1 = k1*mesh%r1_x2 + k2*mesh%r2_x2
539 y2 = (k1 + 1)*mesh%r1_x2 + k2*mesh%r2_x2
540 y3 = (k1 + 1)*mesh%r1_x2 + (k2 + 1)*mesh%r2_x2
542 xx = x2 + ((x3 + x1)*0.5_f64 - x2)*2.0_f64/3.0_f64
543 yy = y2 + ((y3 + y1)*0.5_f64 - y2)*2.0_f64/3.0_f64
549 k1c = abs(mesh%r2_x2*xx - mesh%r2_x1*yy)/abs(jacob)
550 k2c = abs(mesh%r1_x1*yy - mesh%r1_x2*xx)/abs(jacob)
552 if (ceiling(k1c) > mesh%num_cells) inside = .false.
553 if (ceiling(k2c) > mesh%num_cells) inside = .false.
554 if (abs(xx) > r1x1) inside = .false.
557 center_index = center_index + 1
558 mesh%center_cartesian_coord(1, center_index) = xx
559 mesh%center_cartesian_coord(2, center_index) = yy
560 mesh%center_index(2, global) = center_index
574 sll_int32 :: edge_index
575 sll_int32 :: global, num_cells
576 sll_int32 :: k1, k2, k1c, k2c
577 sll_real64 :: x1, x2_l, x2_r, x3, y1, y2_l, y2_r, y3, xx, yy
580 num_cells = mesh%num_cells
582 mesh%edge_center_cartesian_coord(:, :) = 0._f64
583 mesh%edge_center_index(:, :) = -1
586 do global = 1, mesh%num_pts_tot
590 k1 = mesh%hex_coord(1, global)
591 k2 = mesh%hex_coord(2, global)
593 x1 = real(k1, f64)*mesh%r1_x1 + real(k2, f64)*mesh%r2_x1
594 x2_l = real(k1, f64)*mesh%r1_x1 + real((k2 + 1), f64)*mesh%r2_x1
595 x2_r = real((k1 + 1), f64)*mesh%r1_x1 + real(k2, f64)*mesh%r2_x1
596 x3 = real((k1 + 1), f64)*mesh%r1_x1 + real((k2 + 1), f64)*mesh%r2_x1
597 y1 = real(k1, f64)*mesh%r1_x2 + real(k2, f64)*mesh%r2_x2
598 y2_l = real(k1, f64)*mesh%r1_x2 + real((k2 + 1), f64)*mesh%r2_x2
599 y2_r = real((k1 + 1), f64)*mesh%r1_x2 + real(k2, f64)*mesh%r2_x2
600 y3 = real((k1 + 1), f64)*mesh%r1_x2 + real((k2 + 1), f64)*mesh%r2_x2
609 if (abs(k1c) > num_cells .or. abs(k2c) > num_cells .or. &
610 (k1c)*(k2c) < 0 .and. (abs(k1c) + abs(k2c) > num_cells)) inside = .false.
614 xx = (x1 + x2_l)*0.5_f64
615 yy = (y1 + y2_l)*0.5_f64
616 edge_index = edge_index + 1
617 mesh%edge_center_cartesian_coord(1, edge_index) = xx
618 mesh%edge_center_cartesian_coord(2, edge_index) = yy
619 mesh%edge_center_index(1, global) = edge_index
629 if (abs(k1c) > num_cells .or. abs(k2c) > num_cells .or. &
630 (k1c)*(k2c) < 0 .and. (abs(k1c) + abs(k2c) > num_cells)) inside = .false.
634 xx = (x1 + x3)*0.5_f64
635 yy = (y1 + y3)*0.5_f64
636 edge_index = edge_index + 1
637 mesh%edge_center_cartesian_coord(1, edge_index) = xx
638 mesh%edge_center_cartesian_coord(2, edge_index) = yy
639 mesh%edge_center_index(2, global) = edge_index
649 if (abs(k1c) > num_cells .or. abs(k2c) > num_cells .or. &
650 (k1c)*(k2c) < 0 .and. (abs(k1c) + abs(k2c) > num_cells)) inside = .false.
654 xx = (x1 + x2_r)*0.5_f64
655 yy = (y1 + y2_r)*0.5_f64
656 edge_index = edge_index + 1
657 mesh%edge_center_cartesian_coord(1, edge_index) = xx
658 mesh%edge_center_cartesian_coord(2, edge_index) = yy
659 mesh%edge_center_index(3, global) = edge_index
679 sll_int32,
intent(in) :: k1, k2
680 sll_int32,
intent(out) :: index_tab
682 sll_int32 :: nk1, nk2
684 sll_int32 :: num_cells
685 sll_int32 :: num_cells_plus1
687 num_cells = mesh%num_cells
688 num_cells_plus1 = num_cells + 1
698 nk1 = num_cells*k + floor(real(k*(k + 1))*0.5)
699 nk2 = k2 + num_cells_plus1
703 n0 = num_cells**2 + floor(real(num_cells*num_cells_plus1)*0.5)
704 nk1 = n0 + k1*(2*num_cells + 1) - floor(real(k1*(k1 - 1))*0.5)
705 nk2 = k2 + num_cells_plus1 - k1
708 index_tab = nk1 + nk2
722 sll_int32,
intent(in) :: i
723 sll_int32,
intent(in) :: j
726 res = mesh%r1_x1*real(i, f64) + mesh%r2_x1*real(j, f64) + mesh%center_x1
740 sll_int32,
intent(in) :: i
741 sll_int32,
intent(in) :: j
744 res = mesh%r1_x2*real(i, f64) + mesh%r2_x2*real(j, f64) + mesh%center_x2
757 sll_int32,
intent(in) :: cell_num
760 sll_assert(0 < cell_num .and. cell_num <= mesh%num_triangles)
761 res = mesh%center_cartesian_coord(1, cell_num)
774 sll_int32,
intent(in) :: cell_num
777 sll_assert(0 < cell_num .and. cell_num <= mesh%num_triangles)
778 res = mesh%center_cartesian_coord(2, cell_num)
788 sll_int32,
intent(in) :: i, j
791 res = real(i + j + mesh%num_cells, f64)
792 print *,
"Error in eta1_cell() :"
793 print *,
" function only works with ONE parameter (num_cell)"
804 sll_int32,
intent(in) :: i, j
807 res = real(i + j + mesh%num_cells, f64)
808 print *,
"Error in eta2_cell() :"
809 print *,
" function only works with ONE parameter (num_cell)"
822 sll_int32,
intent(in) :: k1
823 sll_int32,
intent(in) :: k2
827 if (k1*k2 .gt. 0)
then
828 val = max(abs(k1), abs(k2))
830 val = abs(k1) + abs(k2)
846 sll_int32,
intent(in) :: num_ele
847 sll_int32,
intent(out) :: val
851 sll_int32 :: lower_index
860 x1 = mesh%center_cartesian_coord(1, num_ele)
861 y1 = mesh%center_cartesian_coord(2, num_ele)
871 if ((num_hex .lt. mesh%num_cells) .and. (mesh%num_cells .ne. 1))
then
872 if (modulo(num_ele, 2) .eq. 1)
then
877 elseif (mesh%num_cells .eq. 1)
then
878 if ((num_ele .eq. 1) .or. (num_ele .eq. 4) .or. (num_ele .eq. 6))
then
887 x2 = mesh%cartesian_coord(1, lower_index)
890 elseif (x2 > x1)
then
908 sll_int32,
intent(in) :: k1
909 sll_int32,
intent(in) :: k2
910 sll_int32 :: distance
911 sll_int32 :: index_tab
917 if (distance .le. mesh%num_cells)
then
920 val = mesh%global_indices(index_tab)
939 k1 = mesh%hex_coord(1, index)
953 k2 = mesh%hex_coord(2, index)
967 x1 = mesh%cartesian_coord(1, index)
981 x2 = mesh%cartesian_coord(2, index)
998 jacob = mesh%r1_x1*mesh%r2_x2 - mesh%r2_x1*mesh%r1_x2
999 k1 = floor((mesh%r2_x2*x1 - mesh%r2_x1*x2)/jacob)
1016 jacob = mesh%r1_x1*mesh%r2_x2 - mesh%r2_x1*mesh%r1_x2
1017 k2 = floor((mesh%r1_x1*x2 - mesh%r1_x2*x1)/jacob)
1031 sll_int32 :: ref_index
1033 sll_int32 :: k1_ref, k2_ref
1034 sll_int32 :: k1_glob, k2_glob
1037 if ((ref_index .le. mesh%num_pts_tot) .and. (ref_index .gt. 0) &
1038 .and. (global .le. mesh%num_pts_tot) .and. (global .gt. 0))
then
1040 k1_ref = mesh%hex_coord(1, ref_index)
1041 k2_ref = mesh%hex_coord(2, ref_index)
1042 k1_glob = mesh%hex_coord(1, global)
1043 k2_glob = mesh%hex_coord(2, global)
1045 local = mesh%hex_to_global(k1_ref - k1_glob, k2_ref - k2_glob)
1065 sll_int32 :: ref_index, local
1066 sll_int32 :: k1_ref, k2_ref
1067 sll_int32 :: k1_loc, k2_loc
1070 if ((ref_index .le. mesh%num_pts_tot) .and. (ref_index .gt. 0) &
1071 .and. (local .le. mesh%num_pts_tot) .and. (local .gt. 0))
then
1072 k1_ref = mesh%global_to_hex1(ref_index)
1073 k2_ref = mesh%global_to_hex2(ref_index)
1074 k1_loc = mesh%global_to_hex1(local)
1075 k2_loc = mesh%global_to_hex2(local)
1077 global = mesh%hex_to_global(k1_ref + k1_loc, k2_ref + k2_loc)
1098 sll_int32 :: k1_ref, k2_ref
1099 sll_int32 :: k1_loc, k2_loc
1103 k1_loc = mesh%global_to_hex1(local)
1104 k2_loc = mesh%global_to_hex2(local)
1107 global = mesh%hex_to_global(k1_ref + k1_loc, k2_ref + k2_loc)
1133 sll_real64,
intent(in) :: x
1134 sll_real64,
intent(in) :: y
1136 sll_int32,
intent(out) :: s1
1137 sll_int32,
intent(out) :: s2
1138 sll_int32,
intent(out) :: s3
1140 sll_real64 :: xi, radius, step
1141 sll_int32 :: num_cells
1144 num_cells = mesh%num_cells
1145 radius = mesh%radius
1159 xi = (real(i, f64) - real(j, f64))*step*
sll_p_sqrt3*0.5_f64
1168 else if (x < xi)
then
1172 else if (x == xi)
then
1177 elseif (x >= 0)
then
1201 sll_int32,
intent(in) :: k1
1202 sll_int32,
intent(in) :: k2
1204 sll_real64,
intent(in) :: x
1205 sll_int32,
intent(out) :: triangle_index
1217 if ((global .gt. 0) .and. (global .le. mesh%num_pts_tot))
then
1218 if (x < mesh%cartesian_coord(1, global))
then
1219 triangle_index = mesh%center_index(1, global)
1221 triangle_index = mesh%center_index(2, global)
1237 sll_int32,
intent(in) :: cell_index
1238 sll_int32,
intent(out) :: nei_1
1239 sll_int32,
intent(out) :: nei_2
1240 sll_int32,
intent(out) :: nei_3
1247 sll_real64 :: x1, y1
1248 sll_real64 :: x2, y2
1249 sll_real64 :: x3, y3
1257 xc = mesh%center_cartesian_coord(1, cell_index)
1258 yc = mesh%center_cartesian_coord(2, cell_index)
1264 x1 = mesh%cartesian_coord(1, s1)
1265 y1 = mesh%cartesian_coord(2, s1)
1266 x2 = mesh%cartesian_coord(1, s2)
1267 y2 = mesh%cartesian_coord(2, s2)
1268 x3 = mesh%cartesian_coord(1, s3)
1269 y3 = mesh%cartesian_coord(2, s3)
1273 coef = 2._f64*((xc - x1)*(x2 - x1) + &
1274 (yc - y1)*(y2 - y1))/((x2 - x1)**2 + &
1276 x = coef*(x2 - x1) - (xc - x1) + x1
1277 y = coef*(y2 - y1) - (yc - y1) + y1
1284 coef = 2._f64*((xc - x2)*(x3 - x2) + &
1285 (yc - y2)*(y3 - y2))/((x3 - x2)**2 + &
1287 x = coef*(x3 - x2) - (xc - x2) + x2
1288 y = coef*(y3 - y2) - (yc - y2) + y2
1295 coef = 2._f64*((xc - x1)*(x3 - x1) + &
1296 (yc - y1)*(y3 - y1))/((x3 - x1)**2 + &
1298 x = coef*(x3 - x1) - (xc - x1) + x1
1299 y = coef*(y3 - y1) - (yc - y1) + y1
1314 sll_real64,
intent(in) :: x
1315 sll_int32,
intent(in) :: k1, k2
1316 sll_int32,
intent(out) :: edge_index1, edge_index2, edge_index3
1317 sll_int32 :: global, global2
1335 if (x < mesh%cartesian_coord(1, global))
then
1336 edge_index1 = mesh%edge_center_index(1, global)
1337 edge_index2 = mesh%edge_center_index(2, global)
1339 edge_index3 = mesh%edge_center_index(3, global2)
1341 edge_index1 = mesh%edge_center_index(3, global)
1342 edge_index2 = mesh%edge_center_index(2, global)
1344 edge_index3 = mesh%edge_center_index(1, global2)
1347 if (edge_index1 == -1) print *,
"problem in sll_s_get_edge_index l", __line__
1348 if (edge_index2 == -1) print *,
"problem in sll_s_get_edge_index l", __line__
1349 if (edge_index3 == -1) print *,
"problem in sll_s_get_edge_index l", __line__
1372 sll_int32,
intent(in) :: i_elmt_old
1374 sll_int32 :: e1, e2, e3
1375 sll_int32 :: j1, j2, j3
1376 sll_int32 :: e1_k1, e1_k2
1377 sll_int32 :: e2_k1, e2_k2
1378 sll_int32 :: e3_k1, e3_k2
1379 sll_int32 :: e1_distance
1380 sll_int32 :: e2_distance
1381 sll_int32 :: e3_distance
1384 sll_int32 :: npts_layer
1385 sll_int32 :: npts_layer_1
1386 sll_int32 :: displacement
1388 if (i_elmt_old .eq. -1)
then
1395 mesh%center_cartesian_coord(2, i_elmt_old), &
1400 e1_k1 = mesh%hex_coord(1, e1)
1401 e1_k2 = mesh%hex_coord(2, e1)
1402 e2_k1 = mesh%hex_coord(1, e2)
1403 e2_k2 = mesh%hex_coord(2, e2)
1404 e3_k1 = mesh%hex_coord(1, e3)
1405 e3_k2 = mesh%hex_coord(2, e3)
1413 layer = e1_distance + e2_distance + e3_distance
1417 if ((e1_k1 >= 0) .and. (e1_k2 >= 0) .and. &
1418 (e2_k1 >= 0) .and. (e2_k2 >= 0) .and. &
1419 (e3_k1 >= 0) .and. (e3_k2 >= 0))
then
1420 if (e1_k1 + e2_k1 + e3_k1 .gt. e1_k2 + e2_k2 + e3_k2)
then
1425 elseif ((e1_k1 <= 0) .and. (e1_k2 <= 0) .and. &
1426 (e2_k1 <= 0) .and. (e2_k2 <= 0) .and. &
1427 (e3_k1 <= 0) .and. (e3_k2 <= 0))
then
1428 if (abs(e1_k1 + e2_k1 + e3_k1) .gt. abs(e1_k2 + e2_k2 + e3_k2))
then
1433 elseif ((e1_k1 <= 0) .and. (e1_k2 >= 0) .and. &
1434 (e2_k1 <= 0) .and. (e2_k2 >= 0) .and. &
1435 (e3_k1 <= 0) .and. (e3_k2 >= 0))
then
1441 if (layer .eq. 0)
then
1446 npts_layer = 3*(layer + 1)*layer + 1
1447 npts_layer_1 = 3*(layer - 1)*layer + 1
1448 j1 = e1 - npts_layer
1449 j2 = e2 - npts_layer
1450 j3 = e3 - npts_layer
1453 displacement = e3 - npts_layer
1454 if (mod(sixth, 2) .eq. 1)
then
1455 displacement = 2*(displacement - 1) - (sixth - 1)
1457 displacement = 2*(displacement - 1) - (sixth - 1)
1459 elseif (j3 <= 0)
then
1460 displacement = e2 - npts_layer
1461 if (mod(sixth, 2) .eq. 1)
then
1462 displacement = 2*(displacement - 1) - (sixth - 1)
1464 displacement = 2*(displacement - 1) - (sixth - 1)
1467 displacement = e1 - npts_layer_1
1468 if (mod(sixth, 2) .eq. 1)
then
1469 displacement = 2*(displacement - 1) + sixth
1471 displacement = 2*(displacement - 1) + sixth
1474 elseif (j2 <= 0)
then
1476 displacement = e1 - npts_layer
1477 if (mod(sixth, 2) .eq. 1)
then
1478 displacement = 2*(displacement - 1) - (sixth - 1)
1480 displacement = 2*(displacement - 1) - (sixth - 1)
1483 displacement = e2 - npts_layer_1
1484 if ((sixth .eq. 6) .and. (j1 .eq. 1))
then
1485 displacement = e3 - npts_layer_1
1486 elseif ((sixth .eq. 6) .and. (j3 .eq. 1))
then
1487 displacement = e1 - npts_layer_1
1489 displacement = 2*(displacement - 1) + sixth
1493 displacement = e3 - npts_layer_1
1494 if (mod(sixth, 2) .eq. 1)
then
1495 displacement = 2*(displacement - 1) + sixth
1497 displacement = 2*(displacement - 1) + sixth
1502 i_elmt = 6*layer*layer + displacement
1518 sll_int32,
intent(in) :: ind
1519 character(len=*),
intent(in) :: transf
1520 sll_real64,
intent(out) :: x_new
1521 sll_real64,
intent(out) :: y_new
1525 sll_real64 :: radius
1527 sll_real64 :: asin_gamma
1529 sll_real64 :: x_temp
1530 sll_real64 :: y_temp
1531 sll_real64 :: dist_to_origin
1534 sll_int32 :: cells_dist
1537 x = mesh%cartesian_coord(1, ind)
1538 y = mesh%cartesian_coord(2, ind)
1542 select case (transf)
1546 dist_to_origin = sqrt(x**2 + y**2)
1550 k1 = mesh%hex_coord(1, ind)
1551 k2 = mesh%hex_coord(2, ind)
1553 radius = mesh%radius/real(mesh%num_cells, f64)*real(cells_dist, f64)
1559 x_new = x*radius/dist_to_origin
1560 y_new = y*radius/dist_to_origin
1565 call mesh%hex_to_aligned_pt(ind,
"CIRCLE", x_temp, y_temp)
1567 radius = sqrt(x_temp**2 + y_temp**2)
1569 if (.not. ((x_temp .eq. 0._f64) .and. (y_temp .eq. 0._f64)))
then
1570 angle = atan2(y_temp, x_temp)
1575 asin_gamma = 0.4290421956533866_f64
1577 x_new = radius*cos(angle + asin_gamma*sin(angle))
1578 y_new = kappa*radius*sin(angle)
1581 print *,
"ERROR in hex_to_aligned_pt: no known transformation =>", transf
1582 print *,
" Options are : CIRCLE and TOKAMAK."
1598 sll_int32,
intent(in) :: i_elmt
1599 character(len=*),
intent(in) :: transf
1600 sll_real64,
dimension(2, 2),
intent(out) :: transf_mata
1601 sll_real64,
dimension(2),
intent(out) :: transf_vecb
1603 sll_real64 :: x_v1, y_v1
1604 sll_real64 :: x_v2, y_v2
1605 sll_real64 :: x_v3, y_v3
1606 sll_real64 :: xp_v1, yp_v1
1607 sll_real64 :: xp_v2, yp_v2
1608 sll_real64 :: xp_v3, yp_v3
1609 sll_real64 :: ccx, ccy
1613 sll_int32 :: error_flag
1614 sll_int32 :: error_flag2
1615 sll_real64,
dimension(3, 3) :: p
1616 sll_real64,
dimension(3, 1) :: bp1
1617 sll_real64,
dimension(3, 1) :: bp2
1618 sll_int32,
dimension(3) :: pivot
1621 ccx = mesh%center_cartesian_coord(1, i_elmt)
1622 ccy = mesh%center_cartesian_coord(2, i_elmt)
1626 x_v1 = mesh%cartesian_coord(1, e1)
1627 y_v1 = mesh%cartesian_coord(2, e1)
1628 x_v2 = mesh%cartesian_coord(1, e2)
1629 y_v2 = mesh%cartesian_coord(2, e2)
1630 x_v3 = mesh%cartesian_coord(1, e3)
1631 y_v3 = mesh%cartesian_coord(2, e3)
1634 call mesh%hex_to_aligned_pt(e1, transf, xp_v1, yp_v1)
1635 call mesh%hex_to_aligned_pt(e2, transf, xp_v2, yp_v2)
1636 call mesh%hex_to_aligned_pt(e3, transf, xp_v3, yp_v3)
1650 p(1, 1:2) = (/x_v1, y_v1/)
1651 p(2, 1:2) = (/x_v2, y_v2/)
1652 p(3, 1:2) = (/x_v3, y_v3/)
1666 call dgesv(3, 1, p, 3, pivot, bp1, 3, error_flag)
1668 p(1, 1:2) = (/x_v1, y_v1/)
1669 p(2, 1:2) = (/x_v2, y_v2/)
1670 p(3, 1:2) = (/x_v3, y_v3/)
1672 call dgesv(3, 1, p, 3, pivot, bp2, 3, error_flag2)
1673 if ((error_flag .ne. 0) .or. (error_flag2 .ne. 0))
then
1674 print *,
"LAPACK error flag for 1st sys = ", error_flag
1675 print *,
"LAPACK error flag for 2nd sys = ", error_flag2
1676 sll_error(
'hex_to_aligned_elmt',
"Error while calling DGESV from Lapack")
1679 transf_mata(1, 1) = bp1(1, 1)
1680 transf_mata(1, 2) = bp1(2, 1)
1681 transf_mata(2, 1) = bp2(1, 1)
1682 transf_mata(2, 2) = bp2(2, 1)
1684 transf_vecb(1) = bp1(3, 1)
1685 transf_vecb(2) = bp2(3, 1)
1705 sll_int32,
intent(in) :: i_elmt
1706 sll_real64,
dimension(2, 2),
intent(out) :: transf_mata
1707 sll_real64,
dimension(2),
intent(out) :: transf_vecb
1713 sll_real64 :: x1, y1
1718 x1 = mesh%center_cartesian_coord(1, i_elmt)
1719 y1 = mesh%center_cartesian_coord(2, i_elmt)
1723 x_v1 = mesh%cartesian_coord(1, e1)
1724 y_v1 = mesh%cartesian_coord(2, e1)
1727 call mesh%cell_type(i_elmt, type)
1730 transf_vecb(1:2) = (/x_v1, y_v1/)
1733 transf_mata(1, 1) = 0.5_f64/real(mesh%num_cells, f64)
1734 transf_mata(1, 2) = -
sll_p_sqrt3/2._f64/real(mesh%num_cells, f64)
1735 transf_mata(2, 1) =
sll_p_sqrt3/2._f64/real(mesh%num_cells, f64)
1736 transf_mata(2, 2) = 0.5_f64/real(mesh%num_cells, f64)
1738 transf_mata(1, 1) = 1._f64/real(mesh%num_cells, f64)
1739 transf_mata(1, 2) = 0._f64/real(mesh%num_cells, f64)
1740 transf_mata(2, 1) = 0._f64/real(mesh%num_cells, f64)
1741 transf_mata(2, 2) = 1._f64/real(mesh%num_cells, f64)
1759 sll_int32,
intent(in) :: i_elmt
1760 character(len=*),
intent(in) :: transf
1761 sll_real64,
dimension(2, 2),
intent(out) :: transf_mata
1762 sll_real64,
dimension(2),
intent(out) :: transf_vecb
1764 sll_real64,
dimension(2, 2) :: transf_mata1
1765 sll_real64,
dimension(2) :: transf_vecb1
1766 sll_real64,
dimension(2, 2) :: transf_mata2
1767 sll_real64,
dimension(2) :: transf_vecb2
1771 call mesh%ref_to_hex_elmt(i_elmt, transf_mata1, transf_vecb1)
1772 call mesh%hex_to_aligned_elmt(i_elmt, transf, transf_mata2, transf_vecb2)
1776 transf_mata = matmul(transf_mata2, transf_mata1)
1777 transf_vecb = matmul(transf_mata2, transf_vecb1) + transf_vecb2
1789 write (*,
"(/,(a))")
'2D mesh : num_cells num_pts center_x1 &
1792 write (*,
"(10x,2(i6,9x),3(g13.3,1x))") mesh%num_cells, &
1807 character(len=*),
intent(in) :: transf
1808 character(len=20),
parameter :: name_nodes =
"boxsplines_nodes.txt"
1809 character(len=23),
parameter :: name_elemt =
"boxsplines_elements.txt"
1810 character(len=24),
parameter :: name_diri =
"boxsplines_dirichlet.txt"
1811 sll_real64 :: x1, y1
1813 sll_int32 :: e1, e2, e3
1817 sll_int32 :: spline_deg
1819 sll_int32 :: num_pts_tot
1820 sll_int32 :: num_ele
1821 sll_int32 :: nei1, nei2, nei3
1822 sll_int32 :: num_cells_to_origin
1823 sll_int32 :: boundary
1824 sll_int32 :: dirichlet
1826 sll_int32,
parameter :: out_unit = 20
1827 sll_real64,
dimension(2, 2) :: mata
1828 sll_real64,
dimension(2) :: vecb
1831 open (unit=out_unit, file=name_nodes, action=
"write", status=
"replace")
1834 num_pts_tot = mesh%num_pts_tot
1835 write (out_unit,
"(i6)") num_pts_tot
1837 do i = 1, num_pts_tot
1838 k1 = mesh%hex_coord(1, i)
1839 k2 = mesh%hex_coord(2, i)
1842 if (num_cells_to_origin .eq. mesh%num_cells)
then
1846 if (transf .eq.
"IDENTITY")
then
1847 x1 = mesh%cartesian_coord(1, i)
1848 y1 = mesh%cartesian_coord(2, i)
1850 call mesh%hex_to_aligned_pt(i, transf, x1, y1)
1854 write (out_unit,
"((i6),(a,1x),(g25.17),(a,1x),(g25.17))") boundary, &
1865 open (unit=out_unit, file=name_elemt, action=
"write", status=
"replace")
1868 num_ele = mesh%num_triangles
1869 write (out_unit,
"(i6)") num_ele
1874 write (out_unit,
"(i6)") spline_deg
1881 call mesh%cell_type(i, type)
1882 write (out_unit,
"(i6)")
type
1884 write (out_unit,
"(i6)") spline_deg
1886 write (out_unit,
"((f22.17),(a,1x))", advance=
'no') scale,
","
1888 call mesh%get_neighbours(i, nei1, nei2, nei3)
1889 write (out_unit,
"(3((i6),(a,1x)))", advance=
'no') &
1894 x1 = mesh%center_cartesian_coord(1, i)
1895 y1 = mesh%center_cartesian_coord(2, i)
1897 if (
type .ne. 2) then
1902 write (out_unit,
"((i6),(a,1x),(i6),(a,1x),(i6))") e1,
",", e2,
",", e3
1904 select case (transf)
1906 call mesh%ref_to_hex_elmt(i, mata, vecb)
1908 call mesh%ref_to_aligned_elmt(i, transf, mata, vecb)
1910 call mesh%ref_to_aligned_elmt(i, transf, mata, vecb)
1912 print *,
"ERROR in write_caid_files(): Not known transfromation."
1913 print *,
" Options are : CIRCLE, TOKAMAK and IDENTITY."
1917 write (out_unit,
"(5((f22.17), (a,1x)), (f22.17))") &
1918 mata(1, 1),
",", mata(1, 2),
",", mata(2, 1),
",", mata(2, 2),
",", &
1919 vecb(1),
",", vecb(2)
1934 open (unit=out_unit, file=name_diri, action=
"write", status=
"replace")
1937 num_ele = mesh%num_triangles
1938 write (out_unit,
"(i6)") num_ele
1941 nen = 3*spline_deg*spline_deg
1949 write (out_unit,
"(i6)") nen
1952 write (out_unit,
"((i6),(a,1x))", advance=
'no') dirichlet,
","
1954 write (out_unit, *)
""
1969 character(len=*),
intent(in) :: name
1972 sll_int32 :: num_pts_tot
1974 sll_int32 :: out_unit
1976 open (file=name, status=
"replace", form=
"formatted", newunit=out_unit)
1978 num_pts_tot = mesh%num_pts_tot
1983 do i = 1, num_pts_tot
1984 k1 = mesh%global_to_hex1(i)
1985 k2 = mesh%global_to_hex2(i)
1986 write (out_unit,
"(3(i6,1x),2(g13.3,1x))") i, &
1989 mesh%global_to_x1(i), &
1990 mesh%global_to_x2(i)
2007 sll_real64,
dimension(:),
intent(in) :: field
2008 character(len=*),
intent(in) :: name
2011 sll_int32 :: num_triangles
2012 sll_int32 :: num_pts_tot
2013 sll_real64,
allocatable :: coor(:, :)
2014 sll_int32,
allocatable :: ntri(:, :)
2016 sll_real64 :: x1, x2
2018 num_pts_tot = mesh%num_pts_tot
2019 num_triangles = mesh%num_triangles
2020 sll_allocate(coor(2, num_pts_tot), error)
2021 sll_allocate(ntri(3, num_triangles), error)
2023 do i = 1, num_pts_tot
2024 coor(1, i) = mesh%global_to_x1(i)
2025 coor(2, i) = mesh%global_to_x2(i)
2028 do i = 1, num_triangles
2029 x1 = mesh%center_cartesian_coord(1, i)
2030 x2 = mesh%center_cartesian_coord(2, i)
2033 ntri(1, i), ntri(2, i), ntri(3, i))
2038 num_pts_tot, num_triangles, field,
'values')
2052 character(len=*),
intent(in) :: mtv_file
2054 sll_real64 :: coor(2, mesh%num_pts_tot)
2055 sll_int32 :: ntri(3, mesh%num_triangles)
2061 sll_int32 :: out_unit
2064 open (file=mtv_file, status=
"replace", form=
"formatted", newunit=out_unit)
2067 write (out_unit,
"(a)")
"$DATA=CURVE3D"
2068 write (out_unit,
"(a)")
"%equalscale=T"
2069 write (out_unit,
"(a)")
"%toplabel='Mesh' "
2071 do i = 1, mesh%num_triangles
2072 x1 = mesh%center_cartesian_coord(1, i)
2073 y1 = mesh%center_cartesian_coord(2, i)
2081 coor(1, is1) = mesh%global_to_x1(is1)
2082 coor(2, is1) = mesh%global_to_x2(is1)
2083 coor(1, is2) = mesh%global_to_x1(is2)
2084 coor(2, is2) = mesh%global_to_x2(is2)
2085 coor(1, is3) = mesh%global_to_x1(is3)
2086 coor(2, is3) = mesh%global_to_x2(is3)
2088 write (out_unit,
"(3f10.5)") coor(:, ntri(1, i)), 0.
2089 write (out_unit,
"(3f10.5)") coor(:, ntri(2, i)), 0.
2090 write (out_unit,
"(3f10.5)") coor(:, ntri(3, i)), 0.
2091 write (out_unit,
"(3f10.5)") coor(:, ntri(1, i)), 0.
2097 write (out_unit,
"(a)")
"$DATA=CURVE3D"
2098 write (out_unit,
"(a)")
"%equalscale=T"
2099 write (out_unit,
"(a)")
"%toplabel='Numeber of knots and triangles' "
2101 do i = 1, mesh%num_triangles
2102 write (out_unit,
"(3f10.5)") coor(:, ntri(1, i)), 0.
2103 write (out_unit,
"(3f10.5)") coor(:, ntri(2, i)), 0.
2104 write (out_unit,
"(3f10.5)") coor(:, ntri(3, i)), 0.
2105 write (out_unit,
"(3f10.5)") coor(:, ntri(1, i)), 0.
2109 do i = 1, mesh%num_triangles
2110 x1 = (coor(1, ntri(1, i)) &
2111 + coor(1, ntri(2, i)) &
2112 + coor(1, ntri(3, i)))/3.0_f64
2113 y1 = (coor(2, ntri(1, i)) &
2114 + coor(2, ntri(2, i)) &
2115 + coor(2, ntri(3, i)))/3.0_f64
2116 write (out_unit,
"(a)", advance=
"no")
"@text x1="
2117 write (out_unit,
"(f8.5)", advance=
"no") x1
2118 write (out_unit,
"(a)", advance=
"no")
" y1="
2119 write (out_unit,
"(f8.5)", advance=
"no") y1
2120 write (out_unit,
"(a)", advance=
"no")
" z1=0. lc=4 ll='"
2121 write (out_unit,
"(i4)", advance=
"no") i
2122 write (out_unit,
"(a)")
"'"
2125 do i = 1, mesh%num_pts_tot
2128 write (out_unit,
"(a)", advance=
"no")
"@text x1="
2129 write (out_unit,
"(g15.3)", advance=
"no") x1
2130 write (out_unit,
"(a)", advance=
"no")
" y1="
2131 write (out_unit,
"(g15.3)", advance=
"no") y1
2132 write (out_unit,
"(a)", advance=
"no")
" z1=0. lc=5 ll='"
2133 write (out_unit,
"(i4)", advance=
"no") i
2134 write (out_unit,
"(a)")
"'"
2138 write (out_unit, *)
"$DATA=CURVE3D"
2139 write (out_unit, *)
"%equalscale=T"
2140 write (out_unit, *)
"%toplabel='Knots number' "
2142 do i = 1, mesh%num_triangles
2143 write (out_unit,
"(3f10.5)") coor(:, ntri(1, i)), 0.
2144 write (out_unit,
"(3f10.5)") coor(:, ntri(2, i)), 0.
2145 write (out_unit,
"(3f10.5)") coor(:, ntri(3, i)), 0.
2146 write (out_unit,
"(3f10.5)") coor(:, ntri(1, i)), 0.
2150 do i = 1, mesh%num_pts_tot
2153 write (out_unit,
"(a)", advance=
"no")
"@text x1="
2154 write (out_unit,
"(g15.3)", advance=
"no") x1
2155 write (out_unit,
"(a)", advance=
"no")
" y1="
2156 write (out_unit,
"(g15.3)", advance=
"no") y1
2157 write (out_unit,
"(a)", advance=
"no")
" z1=0. lc=5 ll='"
2158 write (out_unit,
"(i4)", advance=
"no") i
2159 write (out_unit,
"(a)")
"'"
2163 write (out_unit, *)
"$DATA=CURVE3D"
2164 write (out_unit, *)
"%equalscale=T"
2165 write (out_unit, *)
"%toplabel='Triangles number' "
2167 do i = 1, mesh%num_triangles
2168 write (out_unit,
"(3f10.5)") coor(:, ntri(1, i)), 0.
2169 write (out_unit,
"(3f10.5)") coor(:, ntri(2, i)), 0.
2170 write (out_unit,
"(3f10.5)") coor(:, ntri(3, i)), 0.
2171 write (out_unit,
"(3f10.5)") coor(:, ntri(1, i)), 0.
2175 do i = 1, mesh%num_triangles
2176 x1 = (coor(1, ntri(1, i)) &
2177 + coor(1, ntri(2, i)) &
2178 + coor(1, ntri(3, i)))/3.0_f64
2179 y1 = (coor(2, ntri(1, i)) &
2180 + coor(2, ntri(2, i)) &
2181 + coor(2, ntri(3, i)))/3.0_f64
2182 write (out_unit,
"(a)", advance=
"no")
"@text x1="
2183 write (out_unit,
"(g15.3)", advance=
"no") x1
2184 write (out_unit,
"(a)", advance=
"no")
" y1="
2185 write (out_unit,
"(g15.3)", advance=
"no") y1
2186 write (out_unit,
"(a)", advance=
"no")
" z1=0. lc=4 ll='"
2187 write (out_unit,
"(i4)", advance=
"no") i
2188 write (out_unit,
"(a)")
"'"
2191 write (out_unit, *)
"$END"
2204 sll_deallocate(mesh%cartesian_coord, ierr)
2205 sll_deallocate(mesh%hex_coord, ierr)
2206 sll_deallocate(mesh%global_indices, ierr)
2207 if (mesh%EXTRA_TABLES .eq. 1)
then
2208 sll_deallocate(mesh%center_cartesian_coord, ierr)
2209 sll_deallocate(mesh%center_index, ierr)
2210 sll_deallocate(mesh%edge_center_cartesian_coord, ierr)
2211 sll_deallocate(mesh%edge_center_index, ierr)
2216 #undef TEST_PRESENCE_AND_ASSIGN_VAL
Fortran module where set some physical and mathematical constants.
real(kind=f64), parameter, public sll_p_sqrt3
real(kind=f64), parameter, public sll_p_epsilon_0
recursive subroutine hex_to_aligned_pt(mesh, ind, transf, x_new, y_new)
Computes the coordinate transformation hex->aligned for a point.
subroutine, public sll_s_get_triangle_index(k1, k2, mesh, x, triangle_index)
Given a mesh point and the first cartesian coordinate of a point (that is not on the mesh) we return ...
subroutine, public sll_s_delete_hex_mesh_2d(mesh)
Deletes an hexagonal mesh.
subroutine write_hex_mesh_mtv(mesh, mtv_file)
Same as write_hex_mesh but output is mtv file.
function global_to_hex1(mesh, index)
Gives the 1st hexagonal coordinate to point of global index "index".
function, public sll_f_local_to_global(mesh, ref_index, local)
Transforms local index in a given reference local indexation to a global index from the mesh.
subroutine index_hex_to_global(mesh, k1, k2, index_tab)
Finds the index in the global array of the point which coordinates where passed as parameter.
real(kind=f64) function eta2_cell_hex(mesh, cell_num)
Computes the 2nd cartesian coordinate of the center of the cell.
function global_to_local(mesh, ref_index, global)
Transforms global to local index in respect to a reference index.
function hex_to_global(mesh, k1, k2)
Transform hexagonal coordinates to global index.
real(kind=f64) function eta2_cell_hex_two_arg(mesh, i, j)
NOT IMPLEMENTED.
function local_hex_to_global(mesh, k1_ref, k2_ref, local)
Same as sll_f_local_to_global but taking hexagonal coordinates as reference indexing.
subroutine get_neighbours(mesh, cell_index, nei_1, nei_2, nei_3)
returns the indices of the neighbouring cells/triangles
subroutine write_hex_mesh_2d(mesh, name)
Writes the hexagonal mesh into a given file.
subroutine init_edge_center_triangle(mesh)
<BRIEF_DESCRIPTION>
subroutine hex_to_aligned_elmt(mesh, i_elmt, transf, transf_matA, transf_vecB)
Computes the coordinate transformation hex->aligned for an element.
function, public sll_f_change_elements_notation(mesh, i_elmt_old)
Function that allows to change from the current element notation to one more intuitive.
integer(kind=i32) function, public sll_f_cells_to_origin(k1, k2)
Computes the number of cell from point to origin.
function, public sll_f_cart_to_hex2(mesh, x1, x2)
Transform cartesian coordinates to 2ndst hexagonal coordinates.
subroutine ref_to_hex_elmt(mesh, i_elmt, transf_matA, transf_vecB)
Computes the coordinate transformation ref->hex for an element.
real(kind=f64) function eta2_node_hex(mesh, i, j)
Computes the second cartesian coordinate of a given point.
subroutine, public sll_s_hex_mesh_2d_init(mesh, num_cells, radius, center_x1, center_x2, r1_x1, r1_x2, r2_x1, r2_x2, r3_x1, r3_x2, EXTRA_TABLES)
initializes a previously allocated 2d hex-mesh
subroutine cell_type(mesh, num_ele, val)
Computes the type of triangle of a given cell.
function global_to_x1(mesh, index)
Gives the 1st cartesian coordinate to point of global index "index".
subroutine, public sll_s_write_caid_files(mesh, transf, spline_deg)
Writes files for CAID.
function, public sll_f_cart_to_hex1(mesh, x1, x2)
Transform cartesian coordinates to 1st hexagonal coordinates.
function eta1_cell_hex(mesh, cell_num)
Computes the first cartesian coordinate of the center of the cell.
subroutine, public sll_s_get_cell_vertices_index(x, y, mesh, s1, s2, s3)
Returns indices of the edges of a given cell.
type(sll_t_hex_mesh_2d) function, pointer, public sll_f_new_hex_mesh_2d(num_cells, center_x1, center_x2, r11, r12, r21, r22, r31, r32, radius, EXTRA_TABLES)
Creates and initializes a new hexagonal mesh.
subroutine ref_to_aligned_elmt(mesh, i_elmt, transf, transf_matA, transf_vecB)
Computes the coordinate transformation ref->aligned for an element.
function global_to_hex2(mesh, index)
Gives the 2nd hexagonal coordinate to point of global index "index".
real(kind=f64) function eta1_node_hex(mesh, i, j)
Computes the first cartesian coordinate of a given point.
subroutine init_center_points_triangle(mesh)
<BRIEF_DESCRIPTION>
subroutine write_field_hex_mesh_xmf(mesh, field, name)
Same as write_field_hex_mesh but output in xmf.
real(kind=f64) function eta1_cell_hex_two_arg(mesh, i, j)
NOT IMPLEMENTED.
function global_to_x2(mesh, index)
Gives the 2nd cartesian coordinate to point of global index "index".
subroutine, public sll_s_display_hex_mesh_2d(mesh)
Displays hexagonal mesh in terminal.
subroutine, public sll_s_get_edge_index(k1, k2, mesh, x, edge_index1, edge_index2, edge_index3)
<BRIEF_DESCRIPTION>
subroutine, public sll_s_write_tri_mesh_xmf(filename, coor, ntri, nbs, nbt, field, label)