-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstencil_code.hpp
More file actions
5312 lines (4171 loc) · 391 KB
/
stencil_code.hpp
File metadata and controls
5312 lines (4171 loc) · 391 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Automatically generated code; do not edit.
////// Implementation of the 'awp' stencil //////
#include <fstream>
namespace yask {
////// Overall stencil-context class //////
struct StencilContext_awp : public StencilContext {
// Grids.
const idx_t vel_x_halo_x = 2;
const idx_t vel_x_halo_y = 2;
const idx_t vel_x_halo_z = 2;
Grid_TXYZ* vel_x; // updated by stencil.
const idx_t vel_y_halo_x = 2;
const idx_t vel_y_halo_y = 2;
const idx_t vel_y_halo_z = 2;
Grid_TXYZ* vel_y; // updated by stencil.
const idx_t vel_z_halo_x = 2;
const idx_t vel_z_halo_y = 2;
const idx_t vel_z_halo_z = 2;
Grid_TXYZ* vel_z; // updated by stencil.
const idx_t stress_xx_halo_x = 2;
const idx_t stress_xx_halo_y = 0;
const idx_t stress_xx_halo_z = 0;
Grid_TXYZ* stress_xx; // updated by stencil.
const idx_t stress_yy_halo_x = 0;
const idx_t stress_yy_halo_y = 2;
const idx_t stress_yy_halo_z = 0;
Grid_TXYZ* stress_yy; // updated by stencil.
const idx_t stress_zz_halo_x = 0;
const idx_t stress_zz_halo_y = 0;
const idx_t stress_zz_halo_z = 2;
Grid_TXYZ* stress_zz; // updated by stencil.
const idx_t stress_xy_halo_x = 2;
const idx_t stress_xy_halo_y = 2;
const idx_t stress_xy_halo_z = 0;
Grid_TXYZ* stress_xy; // updated by stencil.
const idx_t stress_xz_halo_x = 2;
const idx_t stress_xz_halo_y = 0;
const idx_t stress_xz_halo_z = 2;
Grid_TXYZ* stress_xz; // updated by stencil.
const idx_t stress_yz_halo_x = 0;
const idx_t stress_yz_halo_y = 2;
const idx_t stress_yz_halo_z = 2;
Grid_TXYZ* stress_yz; // updated by stencil.
const idx_t stress_mem_xx_halo_x = 0;
const idx_t stress_mem_xx_halo_y = 0;
const idx_t stress_mem_xx_halo_z = 0;
Grid_TXYZ* stress_mem_xx; // updated by stencil.
const idx_t stress_mem_yy_halo_x = 0;
const idx_t stress_mem_yy_halo_y = 0;
const idx_t stress_mem_yy_halo_z = 0;
Grid_TXYZ* stress_mem_yy; // updated by stencil.
const idx_t stress_mem_zz_halo_x = 0;
const idx_t stress_mem_zz_halo_y = 0;
const idx_t stress_mem_zz_halo_z = 0;
Grid_TXYZ* stress_mem_zz; // updated by stencil.
const idx_t stress_mem_xy_halo_x = 0;
const idx_t stress_mem_xy_halo_y = 0;
const idx_t stress_mem_xy_halo_z = 0;
Grid_TXYZ* stress_mem_xy; // updated by stencil.
const idx_t stress_mem_xz_halo_x = 0;
const idx_t stress_mem_xz_halo_y = 0;
const idx_t stress_mem_xz_halo_z = 0;
Grid_TXYZ* stress_mem_xz; // updated by stencil.
const idx_t stress_mem_yz_halo_x = 0;
const idx_t stress_mem_yz_halo_y = 0;
const idx_t stress_mem_yz_halo_z = 0;
Grid_TXYZ* stress_mem_yz; // updated by stencil.
const idx_t weight_halo_x = 0;
const idx_t weight_halo_y = 0;
const idx_t weight_halo_z = 0;
Grid_XYZ* weight; // not updated by stencil.
const idx_t tau2_halo_x = 0;
const idx_t tau2_halo_y = 0;
const idx_t tau2_halo_z = 0;
Grid_XYZ* tau2; // not updated by stencil.
const idx_t anelastic_ap_halo_x = 0;
const idx_t anelastic_ap_halo_y = 0;
const idx_t anelastic_ap_halo_z = 0;
Grid_XYZ* anelastic_ap; // not updated by stencil.
const idx_t anelastic_as_diag_halo_x = 0;
const idx_t anelastic_as_diag_halo_y = 0;
const idx_t anelastic_as_diag_halo_z = 0;
Grid_XYZ* anelastic_as_diag; // not updated by stencil.
const idx_t anelastic_xy_halo_x = 0;
const idx_t anelastic_xy_halo_y = 0;
const idx_t anelastic_xy_halo_z = 0;
Grid_XYZ* anelastic_xy; // not updated by stencil.
const idx_t anelastic_xz_halo_x = 0;
const idx_t anelastic_xz_halo_y = 0;
const idx_t anelastic_xz_halo_z = 0;
Grid_XYZ* anelastic_xz; // not updated by stencil.
const idx_t anelastic_yz_halo_x = 0;
const idx_t anelastic_yz_halo_y = 0;
const idx_t anelastic_yz_halo_z = 0;
Grid_XYZ* anelastic_yz; // not updated by stencil.
const idx_t lambda_halo_x = 1;
const idx_t lambda_halo_y = 1;
const idx_t lambda_halo_z = 1;
Grid_XYZ* lambda; // not updated by stencil.
const idx_t rho_halo_x = 1;
const idx_t rho_halo_y = 1;
const idx_t rho_halo_z = 1;
Grid_XYZ* rho; // not updated by stencil.
const idx_t mu_halo_x = 1;
const idx_t mu_halo_y = 1;
const idx_t mu_halo_z = 1;
Grid_XYZ* mu; // not updated by stencil.
const idx_t sponge_halo_x = 0;
const idx_t sponge_halo_y = 0;
const idx_t sponge_halo_z = 0;
Grid_XYZ* sponge; // not updated by stencil.
// Max halos across all grids.
const idx_t max_halo_x = 2;
const idx_t max_halo_y = 2;
const idx_t max_halo_z = 2;
// Parameters.
GenericGrid0d<real_t>* delta_t;
GenericGrid0d<real_t>* h;
StencilContext_awp() {
name = "awp";
vel_x = 0;
vel_y = 0;
vel_z = 0;
stress_xx = 0;
stress_yy = 0;
stress_zz = 0;
stress_xy = 0;
stress_xz = 0;
stress_yz = 0;
stress_mem_xx = 0;
stress_mem_yy = 0;
stress_mem_zz = 0;
stress_mem_xy = 0;
stress_mem_xz = 0;
stress_mem_yz = 0;
weight = 0;
tau2 = 0;
anelastic_ap = 0;
anelastic_as_diag = 0;
anelastic_xy = 0;
anelastic_xz = 0;
anelastic_yz = 0;
lambda = 0;
rho = 0;
mu = 0;
sponge = 0;
delta_t = 0;
h = 0;
}
virtual void allocGrids() {
//std::ifstream in;
//in.open("alloc.txt");
int where[17];
for(int i=0; i<17; i++)
where[i] = 1;//in >> where[i];
// Good 4 grids:
//where[1] = 0;
//where[10] = 0;
//where[14] = 0;
//where[15] = 0;
// Good 7 grids:
where[0] = 0;
where[6] = 0;
where[7] = 0;
where[9] = 0;
where[12] = 0;
where[14] = 0;
where[16] = 0;
gridPtrs.clear();
eqGridPtrs.clear();
vel_x = new Grid_TXYZ(dx, dy, dz, vel_x_halo_x + px, vel_x_halo_y + py, vel_x_halo_z + pz, "vel_x", std::cout, true);
gridPtrs.push_back(vel_x);
eqGridPtrs.push_back(vel_x);
vel_y = new Grid_TXYZ(dx, dy, dz, vel_y_halo_x + px, vel_y_halo_y + py, vel_y_halo_z + pz, "vel_y", std::cout, true);
gridPtrs.push_back(vel_y);
eqGridPtrs.push_back(vel_y);
vel_z = new Grid_TXYZ(dx, dy, dz, vel_z_halo_x + px, vel_z_halo_y + py, vel_z_halo_z + pz, "vel_z", std::cout, true);
gridPtrs.push_back(vel_z);
eqGridPtrs.push_back(vel_z);
stress_xx = new Grid_TXYZ(dx, dy, dz, stress_xx_halo_x + px, stress_xx_halo_y + py, stress_xx_halo_z + pz, "stress_xx", std::cout, true);
gridPtrs.push_back(stress_xx);
eqGridPtrs.push_back(stress_xx);
stress_yy = new Grid_TXYZ(dx, dy, dz, stress_yy_halo_x + px, stress_yy_halo_y + py, stress_yy_halo_z + pz, "stress_yy", std::cout, true);
gridPtrs.push_back(stress_yy);
eqGridPtrs.push_back(stress_yy);
stress_zz = new Grid_TXYZ(dx, dy, dz, stress_zz_halo_x + px, stress_zz_halo_y + py, stress_zz_halo_z + pz, "stress_zz", std::cout, true);
gridPtrs.push_back(stress_zz);
eqGridPtrs.push_back(stress_zz);
stress_xy = new Grid_TXYZ(dx, dy, dz, stress_xy_halo_x + px, stress_xy_halo_y + py, stress_xy_halo_z + pz, "stress_xy", std::cout, true);
gridPtrs.push_back(stress_xy);
eqGridPtrs.push_back(stress_xy);
stress_xz = new Grid_TXYZ(dx, dy, dz, stress_xz_halo_x + px, stress_xz_halo_y + py, stress_xz_halo_z + pz, "stress_xz", std::cout, true);
gridPtrs.push_back(stress_xz);
eqGridPtrs.push_back(stress_xz);
stress_yz = new Grid_TXYZ(dx, dy, dz, stress_yz_halo_x + px, stress_yz_halo_y + py, stress_yz_halo_z + pz, "stress_yz", std::cout, true);
gridPtrs.push_back(stress_yz);
eqGridPtrs.push_back(stress_yz);
stress_mem_xx = new Grid_TXYZ(dx, dy, dz, stress_mem_xx_halo_x + px, stress_mem_xx_halo_y + py, stress_mem_xx_halo_z + pz, "stress_mem_xx", std::cout, where[0]);
gridPtrs.push_back(stress_mem_xx);
eqGridPtrs.push_back(stress_mem_xx);
stress_mem_yy = new Grid_TXYZ(dx, dy, dz, stress_mem_yy_halo_x + px, stress_mem_yy_halo_y + py, stress_mem_yy_halo_z + pz, "stress_mem_yy", std::cout, where[1]);
gridPtrs.push_back(stress_mem_yy);
eqGridPtrs.push_back(stress_mem_yy);
stress_mem_zz = new Grid_TXYZ(dx, dy, dz, stress_mem_zz_halo_x + px, stress_mem_zz_halo_y + py, stress_mem_zz_halo_z + pz, "stress_mem_zz", std::cout, where[2]);
gridPtrs.push_back(stress_mem_zz);
eqGridPtrs.push_back(stress_mem_zz);
stress_mem_xy = new Grid_TXYZ(dx, dy, dz, stress_mem_xy_halo_x + px, stress_mem_xy_halo_y + py, stress_mem_xy_halo_z + pz, "stress_mem_xy", std::cout, where[3]);
gridPtrs.push_back(stress_mem_xy);
eqGridPtrs.push_back(stress_mem_xy);
stress_mem_xz = new Grid_TXYZ(dx, dy, dz, stress_mem_xz_halo_x + px, stress_mem_xz_halo_y + py, stress_mem_xz_halo_z + pz, "stress_mem_xz", std::cout, where[4]);
gridPtrs.push_back(stress_mem_xz);
eqGridPtrs.push_back(stress_mem_xz);
stress_mem_yz = new Grid_TXYZ(dx, dy, dz, stress_mem_yz_halo_x + px, stress_mem_yz_halo_y + py, stress_mem_yz_halo_z + pz, "stress_mem_yz", std::cout, where[5]);
gridPtrs.push_back(stress_mem_yz);
eqGridPtrs.push_back(stress_mem_yz);
weight = new Grid_XYZ(dx, dy, dz, weight_halo_x + px, weight_halo_y + py, weight_halo_z + pz, "weight", std::cout, where[6]);
gridPtrs.push_back(weight);
tau2 = new Grid_XYZ(dx, dy, dz, tau2_halo_x + px, tau2_halo_y + py, tau2_halo_z + pz, "tau2", std::cout, where[7]);
gridPtrs.push_back(tau2);
anelastic_ap = new Grid_XYZ(dx, dy, dz, anelastic_ap_halo_x + px, anelastic_ap_halo_y + py, anelastic_ap_halo_z + pz, "anelastic_ap", std::cout, where[8]);
gridPtrs.push_back(anelastic_ap);
anelastic_as_diag = new Grid_XYZ(dx, dy, dz, anelastic_as_diag_halo_x + px, anelastic_as_diag_halo_y + py, anelastic_as_diag_halo_z + pz, "anelastic_as_diag", std::cout, where[9]);
gridPtrs.push_back(anelastic_as_diag);
anelastic_xy = new Grid_XYZ(dx, dy, dz, anelastic_xy_halo_x + px, anelastic_xy_halo_y + py, anelastic_xy_halo_z + pz, "anelastic_xy", std::cout, where[10]);
gridPtrs.push_back(anelastic_xy);
anelastic_xz = new Grid_XYZ(dx, dy, dz, anelastic_xz_halo_x + px, anelastic_xz_halo_y + py, anelastic_xz_halo_z + pz, "anelastic_xz", std::cout, where[11]);
gridPtrs.push_back(anelastic_xz);
anelastic_yz = new Grid_XYZ(dx, dy, dz, anelastic_yz_halo_x + px, anelastic_yz_halo_y + py, anelastic_yz_halo_z + pz, "anelastic_yz", std::cout, where[12]);
gridPtrs.push_back(anelastic_yz);
lambda = new Grid_XYZ(dx, dy, dz, lambda_halo_x + px, lambda_halo_y + py, lambda_halo_z + pz, "lambda", std::cout, where[13]);
gridPtrs.push_back(lambda);
rho = new Grid_XYZ(dx, dy, dz, rho_halo_x + px, rho_halo_y + py, rho_halo_z + pz, "rho", std::cout, where[14]);
gridPtrs.push_back(rho);
mu = new Grid_XYZ(dx, dy, dz, mu_halo_x + px, mu_halo_y + py, mu_halo_z + pz, "mu", std::cout, where[15]);
gridPtrs.push_back(mu);
sponge = new Grid_XYZ(dx, dy, dz, sponge_halo_x + px, sponge_halo_y + py, sponge_halo_z + pz, "sponge", std::cout, where[16]);
gridPtrs.push_back(sponge);
}
virtual void allocParams() {
paramPtrs.clear();
delta_t = new GenericGrid0d<real_t>();
paramPtrs.push_back(delta_t);
h = new GenericGrid0d<real_t>();
paramPtrs.push_back(h);
}
};
////// Stencil equation 'velocity' //////
struct Stencil_velocity {
std::string name = "velocity";
// 78 FP operation(s) per point:
// vel_x(t+1, x, y, z) = ((vel_x(t, x, y, z) + ((delta_t / (h * (rho(x, y, z) + rho(x, y-1, z) + rho(x, y, z-1) + rho(x, y-1, z-1)) * 0.25)) * ((1.125 * (stress_xx(t, x, y, z) - stress_xx(t, x-1, y, z))) + (-0.0416667 * (stress_xx(t, x+1, y, z) - stress_xx(t, x-2, y, z))) + (1.125 * (stress_xy(t, x, y, z) - stress_xy(t, x, y-1, z))) + (-0.0416667 * (stress_xy(t, x, y+1, z) - stress_xy(t, x, y-2, z))) + (1.125 * (stress_xz(t, x, y, z) - stress_xz(t, x, y, z-1))) + (-0.0416667 * (stress_xz(t, x, y, z+1) - stress_xz(t, x, y, z-2)))))) * sponge(x, y, z)).
// vel_y(t+1, x, y, z) = ((vel_y(t, x, y, z) + ((delta_t / (h * (rho(x, y, z) + rho(x+1, y, z) + rho(x, y, z-1) + rho(x+1, y, z-1)) * 0.25)) * ((1.125 * (stress_xy(t, x+1, y, z) - stress_xy(t, x, y, z))) + (-0.0416667 * (stress_xy(t, x+2, y, z) - stress_xy(t, x-1, y, z))) + (1.125 * (stress_yy(t, x, y+1, z) - stress_yy(t, x, y, z))) + (-0.0416667 * (stress_yy(t, x, y+2, z) - stress_yy(t, x, y-1, z))) + (1.125 * (stress_yz(t, x, y, z) - stress_yz(t, x, y, z-1))) + (-0.0416667 * (stress_yz(t, x, y, z+1) - stress_yz(t, x, y, z-2)))))) * sponge(x, y, z)).
// vel_z(t+1, x, y, z) = ((vel_z(t, x, y, z) + ((delta_t / (h * (rho(x, y, z) + rho(x+1, y, z) + rho(x, y-1, z) + rho(x+1, y-1, z)) * 0.25)) * ((1.125 * (stress_xz(t, x+1, y, z) - stress_xz(t, x, y, z))) + (-0.0416667 * (stress_xz(t, x+2, y, z) - stress_xz(t, x-1, y, z))) + (1.125 * (stress_yz(t, x, y, z) - stress_yz(t, x, y-1, z))) + (-0.0416667 * (stress_yz(t, x, y+1, z) - stress_yz(t, x, y-2, z))) + (1.125 * (stress_zz(t, x, y, z+1) - stress_zz(t, x, y, z))) + (-0.0416667 * (stress_zz(t, x, y, z+2) - stress_zz(t, x, y, z-1)))))) * sponge(x, y, z)).
const int scalar_fp_ops = 78;
// All grids updated by this equation.
std::vector<RealVecGridBase*> eqGridPtrs;
void init(StencilContext_awp& context) {
eqGridPtrs.clear();
eqGridPtrs.push_back(context.vel_x);
eqGridPtrs.push_back(context.vel_y);
eqGridPtrs.push_back(context.vel_z);
}
// Calculate one scalar result relative to indices t, x, y, z.
void calc_scalar(StencilContext_awp& context, idx_t t, idx_t x, idx_t y, idx_t z) {
// temp1 = delta_t().
real_t temp1 = (*context.delta_t)();
// temp2 = h().
real_t temp2 = (*context.h)();
// temp3 = rho(x, y, z).
real_t temp3 = context.rho->readElem(x, y, z, __LINE__);
// temp4 = rho(x, y-1, z).
real_t temp4 = context.rho->readElem(x, y-1, z, __LINE__);
// temp5 = rho(x, y, z) + rho(x, y-1, z).
real_t temp5 = temp3 + temp4;
// temp6 = rho(x, y, z-1).
real_t temp6 = context.rho->readElem(x, y, z-1, __LINE__);
// temp7 = rho(x, y, z) + rho(x, y-1, z) + rho(x, y, z-1).
real_t temp7 = temp5 + temp6;
// temp8 = rho(x, y, z) + rho(x, y-1, z) + rho(x, y, z-1) + rho(x, y-1, z-1).
real_t temp8 = temp7 + context.rho->readElem(x, y-1, z-1, __LINE__);
// temp9 = h() * (rho(x, y, z) + rho(x, y-1, z) + rho(x, y, z-1) + rho(x, y-1, z-1)).
real_t temp9 = temp2 * temp8;
// temp10 = 0.25.
real_t temp10 = 2.50000000000000000e-01;
// temp11 = h() * (rho(x, y, z) + rho(x, y-1, z) + rho(x, y, z-1) + rho(x, y-1, z-1)) * 0.25.
real_t temp11 = temp9 * temp10;
// temp12 = (delta_t / (h * (rho(x, y, z) + rho(x, y-1, z) + rho(x, y, z-1) + rho(x, y-1, z-1)) * 0.25)).
real_t temp12 = temp1 / temp11;
// temp13 = 1.125.
real_t temp13 = 1.12500000000000000e+00;
// temp14 = 1.125 * (stress_xx(t, x, y, z) - stress_xx(t, x-1, y, z)).
real_t temp14 = temp13 * (context.stress_xx->readElem(t, x, y, z, __LINE__) - context.stress_xx->readElem(t, x-1, y, z, __LINE__));
// temp15 = -0.0416667.
real_t temp15 = -4.16666666666666644e-02;
// temp16 = -0.0416667 * (stress_xx(t, x+1, y, z) - stress_xx(t, x-2, y, z)).
real_t temp16 = temp15 * (context.stress_xx->readElem(t, x+1, y, z, __LINE__) - context.stress_xx->readElem(t, x-2, y, z, __LINE__));
// temp17 = (1.125 * (stress_xx(t, x, y, z) - stress_xx(t, x-1, y, z))) + (-0.0416667 * (stress_xx(t, x+1, y, z) - stress_xx(t, x-2, y, z))).
real_t temp17 = temp14 + temp16;
// temp18 = stress_xy(t, x, y, z).
real_t temp18 = context.stress_xy->readElem(t, x, y, z, __LINE__);
// temp19 = (stress_xy(t, x, y, z) - stress_xy(t, x, y-1, z)).
real_t temp19 = temp18 - context.stress_xy->readElem(t, x, y-1, z, __LINE__);
// temp20 = 1.125 * (stress_xy(t, x, y, z) - stress_xy(t, x, y-1, z)).
real_t temp20 = temp13 * temp19;
// temp21 = (1.125 * (stress_xx(t, x, y, z) - stress_xx(t, x-1, y, z))) + (-0.0416667 * (stress_xx(t, x+1, y, z) - stress_xx(t, x-2, y, z))) + (1.125 * (stress_xy(t, x, y, z) - stress_xy(t, x, y-1, z))).
real_t temp21 = temp17 + temp20;
// temp22 = -0.0416667 * (stress_xy(t, x, y+1, z) - stress_xy(t, x, y-2, z)).
real_t temp22 = temp15 * (context.stress_xy->readElem(t, x, y+1, z, __LINE__) - context.stress_xy->readElem(t, x, y-2, z, __LINE__));
// temp23 = (1.125 * (stress_xx(t, x, y, z) - stress_xx(t, x-1, y, z))) + (-0.0416667 * (stress_xx(t, x+1, y, z) - stress_xx(t, x-2, y, z))) + (1.125 * (stress_xy(t, x, y, z) - stress_xy(t, x, y-1, z))) + (-0.0416667 * (stress_xy(t, x, y+1, z) - stress_xy(t, x, y-2, z))).
real_t temp23 = temp21 + temp22;
// temp24 = stress_xz(t, x, y, z).
real_t temp24 = context.stress_xz->readElem(t, x, y, z, __LINE__);
// temp25 = (stress_xz(t, x, y, z) - stress_xz(t, x, y, z-1)).
real_t temp25 = temp24 - context.stress_xz->readElem(t, x, y, z-1, __LINE__);
// temp26 = 1.125 * (stress_xz(t, x, y, z) - stress_xz(t, x, y, z-1)).
real_t temp26 = temp13 * temp25;
// temp27 = (1.125 * (stress_xx(t, x, y, z) - stress_xx(t, x-1, y, z))) + (-0.0416667 * (stress_xx(t, x+1, y, z) - stress_xx(t, x-2, y, z))) + (1.125 * (stress_xy(t, x, y, z) - stress_xy(t, x, y-1, z))) + (-0.0416667 * (stress_xy(t, x, y+1, z) - stress_xy(t, x, y-2, z))) + (1.125 * (stress_xz(t, x, y, z) - stress_xz(t, x, y, z-1))).
real_t temp27 = temp23 + temp26;
// temp28 = -0.0416667 * (stress_xz(t, x, y, z+1) - stress_xz(t, x, y, z-2)).
real_t temp28 = temp15 * (context.stress_xz->readElem(t, x, y, z+1, __LINE__) - context.stress_xz->readElem(t, x, y, z-2, __LINE__));
// temp29 = (1.125 * (stress_xx(t, x, y, z) - stress_xx(t, x-1, y, z))) + (-0.0416667 * (stress_xx(t, x+1, y, z) - stress_xx(t, x-2, y, z))) + (1.125 * (stress_xy(t, x, y, z) - stress_xy(t, x, y-1, z))) + (-0.0416667 * (stress_xy(t, x, y+1, z) - stress_xy(t, x, y-2, z))) + (1.125 * (stress_xz(t, x, y, z) - stress_xz(t, x, y, z-1))) + (-0.0416667 * (stress_xz(t, x, y, z+1) - stress_xz(t, x, y, z-2))).
real_t temp29 = temp27 + temp28;
// temp30 = (delta_t / (h * (rho(x, y, z) + rho(x, y-1, z) + rho(x, y, z-1) + rho(x, y-1, z-1)) * 0.25)) * ((1.125 * (stress_xx(t, x, y, z) - stress_xx(t, x-1, y, z))) + (-0.0416667 * (stress_xx(t, x+1, y, z) - stress_xx(t, x-2, y, z))) + (1.125 * (stress_xy(t, x, y, z) - stress_xy(t, x, y-1, z))) + (-0.0416667 * (stress_xy(t, x, y+1, z) - stress_xy(t, x, y-2, z))) + (1.125 * (stress_xz(t, x, y, z) - stress_xz(t, x, y, z-1))) + (-0.0416667 * (stress_xz(t, x, y, z+1) - stress_xz(t, x, y, z-2)))).
real_t temp30 = temp12 * temp29;
// temp31 = vel_x(t, x, y, z) + ((delta_t / (h * (rho(x, y, z) + rho(x, y-1, z) + rho(x, y, z-1) + rho(x, y-1, z-1)) * 0.25)) * ((1.125 * (stress_xx(t, x, y, z) - stress_xx(t, x-1, y, z))) + (-0.0416667 * (stress_xx(t, x+1, y, z) - stress_xx(t, x-2, y, z))) + (1.125 * (stress_xy(t, x, y, z) - stress_xy(t, x, y-1, z))) + (-0.0416667 * (stress_xy(t, x, y+1, z) - stress_xy(t, x, y-2, z))) + (1.125 * (stress_xz(t, x, y, z) - stress_xz(t, x, y, z-1))) + (-0.0416667 * (stress_xz(t, x, y, z+1) - stress_xz(t, x, y, z-2))))).
real_t temp31 = context.vel_x->readElem(t, x, y, z, __LINE__) + temp30;
// temp32 = sponge(x, y, z).
real_t temp32 = context.sponge->readElem(x, y, z, __LINE__);
// temp33 = (vel_x(t, x, y, z) + ((delta_t / (h * (rho(x, y, z) + rho(x, y-1, z) + rho(x, y, z-1) + rho(x, y-1, z-1)) * 0.25)) * ((1.125 * (stress_xx(t, x, y, z) - stress_xx(t, x-1, y, z))) + (-0.0416667 * (stress_xx(t, x+1, y, z) - stress_xx(t, x-2, y, z))) + (1.125 * (stress_xy(t, x, y, z) - stress_xy(t, x, y-1, z))) + (-0.0416667 * (stress_xy(t, x, y+1, z) - stress_xy(t, x, y-2, z))) + (1.125 * (stress_xz(t, x, y, z) - stress_xz(t, x, y, z-1))) + (-0.0416667 * (stress_xz(t, x, y, z+1) - stress_xz(t, x, y, z-2)))))) * sponge(x, y, z).
real_t temp33 = temp31 * temp32;
// temp34 = ((vel_x(t, x, y, z) + ((delta_t / (h * (rho(x, y, z) + rho(x, y-1, z) + rho(x, y, z-1) + rho(x, y-1, z-1)) * 0.25)) * ((1.125 * (stress_xx(t, x, y, z) - stress_xx(t, x-1, y, z))) + (-0.0416667 * (stress_xx(t, x+1, y, z) - stress_xx(t, x-2, y, z))) + (1.125 * (stress_xy(t, x, y, z) - stress_xy(t, x, y-1, z))) + (-0.0416667 * (stress_xy(t, x, y+1, z) - stress_xy(t, x, y-2, z))) + (1.125 * (stress_xz(t, x, y, z) - stress_xz(t, x, y, z-1))) + (-0.0416667 * (stress_xz(t, x, y, z+1) - stress_xz(t, x, y, z-2)))))) * sponge(x, y, z)).
real_t temp34 = temp33;
// Save result to vel_x(t+1, x, y, z):
context.vel_x->writeElem(temp34, t+1, x, y, z, __LINE__);
// temp35 = rho(x+1, y, z).
real_t temp35 = context.rho->readElem(x+1, y, z, __LINE__);
// temp36 = rho(x, y, z) + rho(x+1, y, z).
real_t temp36 = temp3 + temp35;
// temp37 = rho(x, y, z) + rho(x+1, y, z) + rho(x, y, z-1).
real_t temp37 = temp36 + temp6;
// temp38 = rho(x, y, z) + rho(x+1, y, z) + rho(x, y, z-1) + rho(x+1, y, z-1).
real_t temp38 = temp37 + context.rho->readElem(x+1, y, z-1, __LINE__);
// temp39 = h() * (rho(x, y, z) + rho(x+1, y, z) + rho(x, y, z-1) + rho(x+1, y, z-1)).
real_t temp39 = temp2 * temp38;
// temp40 = h() * (rho(x, y, z) + rho(x+1, y, z) + rho(x, y, z-1) + rho(x+1, y, z-1)) * 0.25.
real_t temp40 = temp39 * temp10;
// temp41 = (delta_t / (h * (rho(x, y, z) + rho(x+1, y, z) + rho(x, y, z-1) + rho(x+1, y, z-1)) * 0.25)).
real_t temp41 = temp1 / temp40;
// temp42 = (stress_xy(t, x+1, y, z) - stress_xy(t, x, y, z)).
real_t temp42 = context.stress_xy->readElem(t, x+1, y, z, __LINE__) - temp18;
// temp43 = 1.125 * (stress_xy(t, x+1, y, z) - stress_xy(t, x, y, z)).
real_t temp43 = temp13 * temp42;
// temp44 = -0.0416667 * (stress_xy(t, x+2, y, z) - stress_xy(t, x-1, y, z)).
real_t temp44 = temp15 * (context.stress_xy->readElem(t, x+2, y, z, __LINE__) - context.stress_xy->readElem(t, x-1, y, z, __LINE__));
// temp45 = (1.125 * (stress_xy(t, x+1, y, z) - stress_xy(t, x, y, z))) + (-0.0416667 * (stress_xy(t, x+2, y, z) - stress_xy(t, x-1, y, z))).
real_t temp45 = temp43 + temp44;
// temp46 = 1.125 * (stress_yy(t, x, y+1, z) - stress_yy(t, x, y, z)).
real_t temp46 = temp13 * (context.stress_yy->readElem(t, x, y+1, z, __LINE__) - context.stress_yy->readElem(t, x, y, z, __LINE__));
// temp47 = (1.125 * (stress_xy(t, x+1, y, z) - stress_xy(t, x, y, z))) + (-0.0416667 * (stress_xy(t, x+2, y, z) - stress_xy(t, x-1, y, z))) + (1.125 * (stress_yy(t, x, y+1, z) - stress_yy(t, x, y, z))).
real_t temp47 = temp45 + temp46;
// temp48 = -0.0416667 * (stress_yy(t, x, y+2, z) - stress_yy(t, x, y-1, z)).
real_t temp48 = temp15 * (context.stress_yy->readElem(t, x, y+2, z, __LINE__) - context.stress_yy->readElem(t, x, y-1, z, __LINE__));
// temp49 = (1.125 * (stress_xy(t, x+1, y, z) - stress_xy(t, x, y, z))) + (-0.0416667 * (stress_xy(t, x+2, y, z) - stress_xy(t, x-1, y, z))) + (1.125 * (stress_yy(t, x, y+1, z) - stress_yy(t, x, y, z))) + (-0.0416667 * (stress_yy(t, x, y+2, z) - stress_yy(t, x, y-1, z))).
real_t temp49 = temp47 + temp48;
// temp50 = stress_yz(t, x, y, z).
real_t temp50 = context.stress_yz->readElem(t, x, y, z, __LINE__);
// temp51 = (stress_yz(t, x, y, z) - stress_yz(t, x, y, z-1)).
real_t temp51 = temp50 - context.stress_yz->readElem(t, x, y, z-1, __LINE__);
// temp52 = 1.125 * (stress_yz(t, x, y, z) - stress_yz(t, x, y, z-1)).
real_t temp52 = temp13 * temp51;
// temp53 = (1.125 * (stress_xy(t, x+1, y, z) - stress_xy(t, x, y, z))) + (-0.0416667 * (stress_xy(t, x+2, y, z) - stress_xy(t, x-1, y, z))) + (1.125 * (stress_yy(t, x, y+1, z) - stress_yy(t, x, y, z))) + (-0.0416667 * (stress_yy(t, x, y+2, z) - stress_yy(t, x, y-1, z))) + (1.125 * (stress_yz(t, x, y, z) - stress_yz(t, x, y, z-1))).
real_t temp53 = temp49 + temp52;
// temp54 = -0.0416667 * (stress_yz(t, x, y, z+1) - stress_yz(t, x, y, z-2)).
real_t temp54 = temp15 * (context.stress_yz->readElem(t, x, y, z+1, __LINE__) - context.stress_yz->readElem(t, x, y, z-2, __LINE__));
// temp55 = (1.125 * (stress_xy(t, x+1, y, z) - stress_xy(t, x, y, z))) + (-0.0416667 * (stress_xy(t, x+2, y, z) - stress_xy(t, x-1, y, z))) + (1.125 * (stress_yy(t, x, y+1, z) - stress_yy(t, x, y, z))) + (-0.0416667 * (stress_yy(t, x, y+2, z) - stress_yy(t, x, y-1, z))) + (1.125 * (stress_yz(t, x, y, z) - stress_yz(t, x, y, z-1))) + (-0.0416667 * (stress_yz(t, x, y, z+1) - stress_yz(t, x, y, z-2))).
real_t temp55 = temp53 + temp54;
// temp56 = (delta_t / (h * (rho(x, y, z) + rho(x+1, y, z) + rho(x, y, z-1) + rho(x+1, y, z-1)) * 0.25)) * ((1.125 * (stress_xy(t, x+1, y, z) - stress_xy(t, x, y, z))) + (-0.0416667 * (stress_xy(t, x+2, y, z) - stress_xy(t, x-1, y, z))) + (1.125 * (stress_yy(t, x, y+1, z) - stress_yy(t, x, y, z))) + (-0.0416667 * (stress_yy(t, x, y+2, z) - stress_yy(t, x, y-1, z))) + (1.125 * (stress_yz(t, x, y, z) - stress_yz(t, x, y, z-1))) + (-0.0416667 * (stress_yz(t, x, y, z+1) - stress_yz(t, x, y, z-2)))).
real_t temp56 = temp41 * temp55;
// temp57 = vel_y(t, x, y, z) + ((delta_t / (h * (rho(x, y, z) + rho(x+1, y, z) + rho(x, y, z-1) + rho(x+1, y, z-1)) * 0.25)) * ((1.125 * (stress_xy(t, x+1, y, z) - stress_xy(t, x, y, z))) + (-0.0416667 * (stress_xy(t, x+2, y, z) - stress_xy(t, x-1, y, z))) + (1.125 * (stress_yy(t, x, y+1, z) - stress_yy(t, x, y, z))) + (-0.0416667 * (stress_yy(t, x, y+2, z) - stress_yy(t, x, y-1, z))) + (1.125 * (stress_yz(t, x, y, z) - stress_yz(t, x, y, z-1))) + (-0.0416667 * (stress_yz(t, x, y, z+1) - stress_yz(t, x, y, z-2))))).
real_t temp57 = context.vel_y->readElem(t, x, y, z, __LINE__) + temp56;
// temp58 = (vel_y(t, x, y, z) + ((delta_t / (h * (rho(x, y, z) + rho(x+1, y, z) + rho(x, y, z-1) + rho(x+1, y, z-1)) * 0.25)) * ((1.125 * (stress_xy(t, x+1, y, z) - stress_xy(t, x, y, z))) + (-0.0416667 * (stress_xy(t, x+2, y, z) - stress_xy(t, x-1, y, z))) + (1.125 * (stress_yy(t, x, y+1, z) - stress_yy(t, x, y, z))) + (-0.0416667 * (stress_yy(t, x, y+2, z) - stress_yy(t, x, y-1, z))) + (1.125 * (stress_yz(t, x, y, z) - stress_yz(t, x, y, z-1))) + (-0.0416667 * (stress_yz(t, x, y, z+1) - stress_yz(t, x, y, z-2)))))) * sponge(x, y, z).
real_t temp58 = temp57 * temp32;
// temp59 = ((vel_y(t, x, y, z) + ((delta_t / (h * (rho(x, y, z) + rho(x+1, y, z) + rho(x, y, z-1) + rho(x+1, y, z-1)) * 0.25)) * ((1.125 * (stress_xy(t, x+1, y, z) - stress_xy(t, x, y, z))) + (-0.0416667 * (stress_xy(t, x+2, y, z) - stress_xy(t, x-1, y, z))) + (1.125 * (stress_yy(t, x, y+1, z) - stress_yy(t, x, y, z))) + (-0.0416667 * (stress_yy(t, x, y+2, z) - stress_yy(t, x, y-1, z))) + (1.125 * (stress_yz(t, x, y, z) - stress_yz(t, x, y, z-1))) + (-0.0416667 * (stress_yz(t, x, y, z+1) - stress_yz(t, x, y, z-2)))))) * sponge(x, y, z)).
real_t temp59 = temp58;
// Save result to vel_y(t+1, x, y, z):
context.vel_y->writeElem(temp59, t+1, x, y, z, __LINE__);
// temp60 = rho(x, y, z) + rho(x+1, y, z).
real_t temp60 = temp3 + temp35;
// temp61 = rho(x, y, z) + rho(x+1, y, z) + rho(x, y-1, z).
real_t temp61 = temp60 + temp4;
// temp62 = rho(x, y, z) + rho(x+1, y, z) + rho(x, y-1, z) + rho(x+1, y-1, z).
real_t temp62 = temp61 + context.rho->readElem(x+1, y-1, z, __LINE__);
// temp63 = h() * (rho(x, y, z) + rho(x+1, y, z) + rho(x, y-1, z) + rho(x+1, y-1, z)).
real_t temp63 = temp2 * temp62;
// temp64 = h() * (rho(x, y, z) + rho(x+1, y, z) + rho(x, y-1, z) + rho(x+1, y-1, z)) * 0.25.
real_t temp64 = temp63 * temp10;
// temp65 = (delta_t / (h * (rho(x, y, z) + rho(x+1, y, z) + rho(x, y-1, z) + rho(x+1, y-1, z)) * 0.25)).
real_t temp65 = temp1 / temp64;
// temp66 = (stress_xz(t, x+1, y, z) - stress_xz(t, x, y, z)).
real_t temp66 = context.stress_xz->readElem(t, x+1, y, z, __LINE__) - temp24;
// temp67 = 1.125 * (stress_xz(t, x+1, y, z) - stress_xz(t, x, y, z)).
real_t temp67 = temp13 * temp66;
// temp68 = -0.0416667 * (stress_xz(t, x+2, y, z) - stress_xz(t, x-1, y, z)).
real_t temp68 = temp15 * (context.stress_xz->readElem(t, x+2, y, z, __LINE__) - context.stress_xz->readElem(t, x-1, y, z, __LINE__));
// temp69 = (1.125 * (stress_xz(t, x+1, y, z) - stress_xz(t, x, y, z))) + (-0.0416667 * (stress_xz(t, x+2, y, z) - stress_xz(t, x-1, y, z))).
real_t temp69 = temp67 + temp68;
// temp70 = (stress_yz(t, x, y, z) - stress_yz(t, x, y-1, z)).
real_t temp70 = temp50 - context.stress_yz->readElem(t, x, y-1, z, __LINE__);
// temp71 = 1.125 * (stress_yz(t, x, y, z) - stress_yz(t, x, y-1, z)).
real_t temp71 = temp13 * temp70;
// temp72 = (1.125 * (stress_xz(t, x+1, y, z) - stress_xz(t, x, y, z))) + (-0.0416667 * (stress_xz(t, x+2, y, z) - stress_xz(t, x-1, y, z))) + (1.125 * (stress_yz(t, x, y, z) - stress_yz(t, x, y-1, z))).
real_t temp72 = temp69 + temp71;
// temp73 = -0.0416667 * (stress_yz(t, x, y+1, z) - stress_yz(t, x, y-2, z)).
real_t temp73 = temp15 * (context.stress_yz->readElem(t, x, y+1, z, __LINE__) - context.stress_yz->readElem(t, x, y-2, z, __LINE__));
// temp74 = (1.125 * (stress_xz(t, x+1, y, z) - stress_xz(t, x, y, z))) + (-0.0416667 * (stress_xz(t, x+2, y, z) - stress_xz(t, x-1, y, z))) + (1.125 * (stress_yz(t, x, y, z) - stress_yz(t, x, y-1, z))) + (-0.0416667 * (stress_yz(t, x, y+1, z) - stress_yz(t, x, y-2, z))).
real_t temp74 = temp72 + temp73;
// temp75 = 1.125 * (stress_zz(t, x, y, z+1) - stress_zz(t, x, y, z)).
real_t temp75 = temp13 * (context.stress_zz->readElem(t, x, y, z+1, __LINE__) - context.stress_zz->readElem(t, x, y, z, __LINE__));
// temp76 = (1.125 * (stress_xz(t, x+1, y, z) - stress_xz(t, x, y, z))) + (-0.0416667 * (stress_xz(t, x+2, y, z) - stress_xz(t, x-1, y, z))) + (1.125 * (stress_yz(t, x, y, z) - stress_yz(t, x, y-1, z))) + (-0.0416667 * (stress_yz(t, x, y+1, z) - stress_yz(t, x, y-2, z))) + (1.125 * (stress_zz(t, x, y, z+1) - stress_zz(t, x, y, z))).
real_t temp76 = temp74 + temp75;
// temp77 = -0.0416667 * (stress_zz(t, x, y, z+2) - stress_zz(t, x, y, z-1)).
real_t temp77 = temp15 * (context.stress_zz->readElem(t, x, y, z+2, __LINE__) - context.stress_zz->readElem(t, x, y, z-1, __LINE__));
// temp78 = (1.125 * (stress_xz(t, x+1, y, z) - stress_xz(t, x, y, z))) + (-0.0416667 * (stress_xz(t, x+2, y, z) - stress_xz(t, x-1, y, z))) + (1.125 * (stress_yz(t, x, y, z) - stress_yz(t, x, y-1, z))) + (-0.0416667 * (stress_yz(t, x, y+1, z) - stress_yz(t, x, y-2, z))) + (1.125 * (stress_zz(t, x, y, z+1) - stress_zz(t, x, y, z))) + (-0.0416667 * (stress_zz(t, x, y, z+2) - stress_zz(t, x, y, z-1))).
real_t temp78 = temp76 + temp77;
// temp79 = (delta_t / (h * (rho(x, y, z) + rho(x+1, y, z) + rho(x, y-1, z) + rho(x+1, y-1, z)) * 0.25)) * ((1.125 * (stress_xz(t, x+1, y, z) - stress_xz(t, x, y, z))) + (-0.0416667 * (stress_xz(t, x+2, y, z) - stress_xz(t, x-1, y, z))) + (1.125 * (stress_yz(t, x, y, z) - stress_yz(t, x, y-1, z))) + (-0.0416667 * (stress_yz(t, x, y+1, z) - stress_yz(t, x, y-2, z))) + (1.125 * (stress_zz(t, x, y, z+1) - stress_zz(t, x, y, z))) + (-0.0416667 * (stress_zz(t, x, y, z+2) - stress_zz(t, x, y, z-1)))).
real_t temp79 = temp65 * temp78;
// temp80 = vel_z(t, x, y, z) + ((delta_t / (h * (rho(x, y, z) + rho(x+1, y, z) + rho(x, y-1, z) + rho(x+1, y-1, z)) * 0.25)) * ((1.125 * (stress_xz(t, x+1, y, z) - stress_xz(t, x, y, z))) + (-0.0416667 * (stress_xz(t, x+2, y, z) - stress_xz(t, x-1, y, z))) + (1.125 * (stress_yz(t, x, y, z) - stress_yz(t, x, y-1, z))) + (-0.0416667 * (stress_yz(t, x, y+1, z) - stress_yz(t, x, y-2, z))) + (1.125 * (stress_zz(t, x, y, z+1) - stress_zz(t, x, y, z))) + (-0.0416667 * (stress_zz(t, x, y, z+2) - stress_zz(t, x, y, z-1))))).
real_t temp80 = context.vel_z->readElem(t, x, y, z, __LINE__) + temp79;
// temp81 = (vel_z(t, x, y, z) + ((delta_t / (h * (rho(x, y, z) + rho(x+1, y, z) + rho(x, y-1, z) + rho(x+1, y-1, z)) * 0.25)) * ((1.125 * (stress_xz(t, x+1, y, z) - stress_xz(t, x, y, z))) + (-0.0416667 * (stress_xz(t, x+2, y, z) - stress_xz(t, x-1, y, z))) + (1.125 * (stress_yz(t, x, y, z) - stress_yz(t, x, y-1, z))) + (-0.0416667 * (stress_yz(t, x, y+1, z) - stress_yz(t, x, y-2, z))) + (1.125 * (stress_zz(t, x, y, z+1) - stress_zz(t, x, y, z))) + (-0.0416667 * (stress_zz(t, x, y, z+2) - stress_zz(t, x, y, z-1)))))) * sponge(x, y, z).
real_t temp81 = temp80 * temp32;
// temp82 = ((vel_z(t, x, y, z) + ((delta_t / (h * (rho(x, y, z) + rho(x+1, y, z) + rho(x, y-1, z) + rho(x+1, y-1, z)) * 0.25)) * ((1.125 * (stress_xz(t, x+1, y, z) - stress_xz(t, x, y, z))) + (-0.0416667 * (stress_xz(t, x+2, y, z) - stress_xz(t, x-1, y, z))) + (1.125 * (stress_yz(t, x, y, z) - stress_yz(t, x, y-1, z))) + (-0.0416667 * (stress_yz(t, x, y+1, z) - stress_yz(t, x, y-2, z))) + (1.125 * (stress_zz(t, x, y, z+1) - stress_zz(t, x, y, z))) + (-0.0416667 * (stress_zz(t, x, y, z+2) - stress_zz(t, x, y, z-1)))))) * sponge(x, y, z)).
real_t temp82 = temp81;
// Save result to vel_z(t+1, x, y, z):
context.vel_z->writeElem(temp82, t+1, x, y, z, __LINE__);
} // scalar calculation.
// Calculate 16 result(s) relative to indices t, x, y, z in a 'x=1 * y=1 * z=1' cluster of 'x=4 * y=4 * z=1' vector(s).
// Indices must be normalized, i.e., already divided by VLEN_*.
// SIMD calculations use 44 vector block(s) created from 38 aligned vector-block(s).
// There are 1248 FP operation(s) per cluster.
void calc_cluster(StencilContext_awp& context, idx_t tv, idx_t xv, idx_t yv, idx_t zv) {
// Un-normalized indices.
idx_t t = tv;
idx_t x = xv * 4;
idx_t y = yv * 4;
idx_t z = zv * 1;
// Read aligned vector block from vel_x at t, x, y, z.
real_vec_t temp_vec1 = context.vel_x->readVecNorm(tv, xv, yv, zv, __LINE__);
// Read aligned vector block from rho at x, y, z.
real_vec_t temp_vec2 = context.rho->readVecNorm(xv, yv, zv, __LINE__);
// Read aligned vector block from rho at x, y-4, z.
real_vec_t temp_vec3 = context.rho->readVecNorm(xv, yv-(4/4), zv, __LINE__);
// Construct unaligned vector block from rho at x, y-1, z.
real_vec_t temp_vec4;
// temp_vec4[0] = temp_vec3[12]; // for x, y-1, z;
// temp_vec4[1] = temp_vec3[13]; // for x+1, y-1, z;
// temp_vec4[2] = temp_vec3[14]; // for x+2, y-1, z;
// temp_vec4[3] = temp_vec3[15]; // for x+3, y-1, z;
// temp_vec4[4] = temp_vec2[0]; // for x, y, z;
// temp_vec4[5] = temp_vec2[1]; // for x+1, y, z;
// temp_vec4[6] = temp_vec2[2]; // for x+2, y, z;
// temp_vec4[7] = temp_vec2[3]; // for x+3, y, z;
// temp_vec4[8] = temp_vec2[4]; // for x, y+1, z;
// temp_vec4[9] = temp_vec2[5]; // for x+1, y+1, z;
// temp_vec4[10] = temp_vec2[6]; // for x+2, y+1, z;
// temp_vec4[11] = temp_vec2[7]; // for x+3, y+1, z;
// temp_vec4[12] = temp_vec2[8]; // for x, y+2, z;
// temp_vec4[13] = temp_vec2[9]; // for x+1, y+2, z;
// temp_vec4[14] = temp_vec2[10]; // for x+2, y+2, z;
// temp_vec4[15] = temp_vec2[11]; // for x+3, y+2, z;
// Get 12 element(s) from temp_vec2 and 4 from temp_vec3.
real_vec_align<12>(temp_vec4, temp_vec2, temp_vec3);
// Read aligned vector block from rho at x, y, z-1.
real_vec_t temp_vec5 = context.rho->readVecNorm(xv, yv, zv-(1/1), __LINE__);
// Read aligned vector block from rho at x, y-4, z-1.
real_vec_t temp_vec6 = context.rho->readVecNorm(xv, yv-(4/4), zv-(1/1), __LINE__);
// Construct unaligned vector block from rho at x, y-1, z-1.
real_vec_t temp_vec7;
// temp_vec7[0] = temp_vec6[12]; // for x, y-1, z-1;
// temp_vec7[1] = temp_vec6[13]; // for x+1, y-1, z-1;
// temp_vec7[2] = temp_vec6[14]; // for x+2, y-1, z-1;
// temp_vec7[3] = temp_vec6[15]; // for x+3, y-1, z-1;
// temp_vec7[4] = temp_vec5[0]; // for x, y, z-1;
// temp_vec7[5] = temp_vec5[1]; // for x+1, y, z-1;
// temp_vec7[6] = temp_vec5[2]; // for x+2, y, z-1;
// temp_vec7[7] = temp_vec5[3]; // for x+3, y, z-1;
// temp_vec7[8] = temp_vec5[4]; // for x, y+1, z-1;
// temp_vec7[9] = temp_vec5[5]; // for x+1, y+1, z-1;
// temp_vec7[10] = temp_vec5[6]; // for x+2, y+1, z-1;
// temp_vec7[11] = temp_vec5[7]; // for x+3, y+1, z-1;
// temp_vec7[12] = temp_vec5[8]; // for x, y+2, z-1;
// temp_vec7[13] = temp_vec5[9]; // for x+1, y+2, z-1;
// temp_vec7[14] = temp_vec5[10]; // for x+2, y+2, z-1;
// temp_vec7[15] = temp_vec5[11]; // for x+3, y+2, z-1;
// Get 12 element(s) from temp_vec5 and 4 from temp_vec6.
real_vec_align<12>(temp_vec7, temp_vec5, temp_vec6);
// Read aligned vector block from stress_xx at t, x, y, z.
real_vec_t temp_vec8 = context.stress_xx->readVecNorm(tv, xv, yv, zv, __LINE__);
// Read aligned vector block from stress_xx at t, x-4, y, z.
real_vec_t temp_vec9 = context.stress_xx->readVecNorm(tv, xv-(4/4), yv, zv, __LINE__);
// Construct unaligned vector block from stress_xx at t, x-1, y, z.
real_vec_t temp_vec10;
// temp_vec10[0] = temp_vec9[3]; // for t, x-1, y, z;
// temp_vec10[1] = temp_vec8[0]; // for t, x, y, z;
// temp_vec10[2] = temp_vec8[1]; // for t, x+1, y, z;
// temp_vec10[3] = temp_vec8[2]; // for t, x+2, y, z;
// temp_vec10[4] = temp_vec9[7]; // for t, x-1, y+1, z;
// temp_vec10[5] = temp_vec8[4]; // for t, x, y+1, z;
// temp_vec10[6] = temp_vec8[5]; // for t, x+1, y+1, z;
// temp_vec10[7] = temp_vec8[6]; // for t, x+2, y+1, z;
// temp_vec10[8] = temp_vec9[11]; // for t, x-1, y+2, z;
// temp_vec10[9] = temp_vec8[8]; // for t, x, y+2, z;
// temp_vec10[10] = temp_vec8[9]; // for t, x+1, y+2, z;
// temp_vec10[11] = temp_vec8[10]; // for t, x+2, y+2, z;
// temp_vec10[12] = temp_vec9[15]; // for t, x-1, y+3, z;
// temp_vec10[13] = temp_vec8[12]; // for t, x, y+3, z;
// temp_vec10[14] = temp_vec8[13]; // for t, x+1, y+3, z;
// temp_vec10[15] = temp_vec8[14]; // for t, x+2, y+3, z;
const real_vec_t_data ctrl_data_A3_B0_B1_B2_A7_B4_B5_B6_A11_B8_B9_B10_A15_B12_B13_B14 = { .ci = { 3, ctrl_sel_bit |0, ctrl_sel_bit |1, ctrl_sel_bit |2, 7, ctrl_sel_bit |4, ctrl_sel_bit |5, ctrl_sel_bit |6, 11, ctrl_sel_bit |8, ctrl_sel_bit |9, ctrl_sel_bit |10, 15, ctrl_sel_bit |12, ctrl_sel_bit |13, ctrl_sel_bit |14 } };
const real_vec_t ctrl_A3_B0_B1_B2_A7_B4_B5_B6_A11_B8_B9_B10_A15_B12_B13_B14(ctrl_data_A3_B0_B1_B2_A7_B4_B5_B6_A11_B8_B9_B10_A15_B12_B13_B14);
real_vec_permute2(temp_vec10, ctrl_A3_B0_B1_B2_A7_B4_B5_B6_A11_B8_B9_B10_A15_B12_B13_B14, temp_vec9, temp_vec8);
// Read aligned vector block from stress_xx at t, x+4, y, z.
real_vec_t temp_vec11 = context.stress_xx->readVecNorm(tv, xv+(4/4), yv, zv, __LINE__);
// Construct unaligned vector block from stress_xx at t, x+1, y, z.
real_vec_t temp_vec12;
// temp_vec12[0] = temp_vec8[1]; // for t, x+1, y, z;
// temp_vec12[1] = temp_vec8[2]; // for t, x+2, y, z;
// temp_vec12[2] = temp_vec8[3]; // for t, x+3, y, z;
// temp_vec12[3] = temp_vec11[0]; // for t, x+4, y, z;
// temp_vec12[4] = temp_vec8[5]; // for t, x+1, y+1, z;
// temp_vec12[5] = temp_vec8[6]; // for t, x+2, y+1, z;
// temp_vec12[6] = temp_vec8[7]; // for t, x+3, y+1, z;
// temp_vec12[7] = temp_vec11[4]; // for t, x+4, y+1, z;
// temp_vec12[8] = temp_vec8[9]; // for t, x+1, y+2, z;
// temp_vec12[9] = temp_vec8[10]; // for t, x+2, y+2, z;
// temp_vec12[10] = temp_vec8[11]; // for t, x+3, y+2, z;
// temp_vec12[11] = temp_vec11[8]; // for t, x+4, y+2, z;
// temp_vec12[12] = temp_vec8[13]; // for t, x+1, y+3, z;
// temp_vec12[13] = temp_vec8[14]; // for t, x+2, y+3, z;
// temp_vec12[14] = temp_vec8[15]; // for t, x+3, y+3, z;
// temp_vec12[15] = temp_vec11[12]; // for t, x+4, y+3, z;
const real_vec_t_data ctrl_data_A1_A2_A3_B0_A5_A6_A7_B4_A9_A10_A11_B8_A13_A14_A15_B12 = { .ci = { 1, 2, 3, ctrl_sel_bit |0, 5, 6, 7, ctrl_sel_bit |4, 9, 10, 11, ctrl_sel_bit |8, 13, 14, 15, ctrl_sel_bit |12 } };
const real_vec_t ctrl_A1_A2_A3_B0_A5_A6_A7_B4_A9_A10_A11_B8_A13_A14_A15_B12(ctrl_data_A1_A2_A3_B0_A5_A6_A7_B4_A9_A10_A11_B8_A13_A14_A15_B12);
real_vec_permute2(temp_vec12, ctrl_A1_A2_A3_B0_A5_A6_A7_B4_A9_A10_A11_B8_A13_A14_A15_B12, temp_vec8, temp_vec11);
// Construct unaligned vector block from stress_xx at t, x-2, y, z.
real_vec_t temp_vec13;
// temp_vec13[0] = temp_vec9[2]; // for t, x-2, y, z;
// temp_vec13[1] = temp_vec9[3]; // for t, x-1, y, z;
// temp_vec13[2] = temp_vec8[0]; // for t, x, y, z;
// temp_vec13[3] = temp_vec8[1]; // for t, x+1, y, z;
// temp_vec13[4] = temp_vec9[6]; // for t, x-2, y+1, z;
// temp_vec13[5] = temp_vec9[7]; // for t, x-1, y+1, z;
// temp_vec13[6] = temp_vec8[4]; // for t, x, y+1, z;
// temp_vec13[7] = temp_vec8[5]; // for t, x+1, y+1, z;
// temp_vec13[8] = temp_vec9[10]; // for t, x-2, y+2, z;
// temp_vec13[9] = temp_vec9[11]; // for t, x-1, y+2, z;
// temp_vec13[10] = temp_vec8[8]; // for t, x, y+2, z;
// temp_vec13[11] = temp_vec8[9]; // for t, x+1, y+2, z;
// temp_vec13[12] = temp_vec9[14]; // for t, x-2, y+3, z;
// temp_vec13[13] = temp_vec9[15]; // for t, x-1, y+3, z;
// temp_vec13[14] = temp_vec8[12]; // for t, x, y+3, z;
// temp_vec13[15] = temp_vec8[13]; // for t, x+1, y+3, z;
const real_vec_t_data ctrl_data_A2_A3_B0_B1_A6_A7_B4_B5_A10_A11_B8_B9_A14_A15_B12_B13 = { .ci = { 2, 3, ctrl_sel_bit |0, ctrl_sel_bit |1, 6, 7, ctrl_sel_bit |4, ctrl_sel_bit |5, 10, 11, ctrl_sel_bit |8, ctrl_sel_bit |9, 14, 15, ctrl_sel_bit |12, ctrl_sel_bit |13 } };
const real_vec_t ctrl_A2_A3_B0_B1_A6_A7_B4_B5_A10_A11_B8_B9_A14_A15_B12_B13(ctrl_data_A2_A3_B0_B1_A6_A7_B4_B5_A10_A11_B8_B9_A14_A15_B12_B13);
real_vec_permute2(temp_vec13, ctrl_A2_A3_B0_B1_A6_A7_B4_B5_A10_A11_B8_B9_A14_A15_B12_B13, temp_vec9, temp_vec8);
// Read aligned vector block from stress_xy at t, x, y, z.
real_vec_t temp_vec14 = context.stress_xy->readVecNorm(tv, xv, yv, zv, __LINE__);
// Read aligned vector block from stress_xy at t, x, y-4, z.
real_vec_t temp_vec15 = context.stress_xy->readVecNorm(tv, xv, yv-(4/4), zv, __LINE__);
// Construct unaligned vector block from stress_xy at t, x, y-1, z.
real_vec_t temp_vec16;
// temp_vec16[0] = temp_vec15[12]; // for t, x, y-1, z;
// temp_vec16[1] = temp_vec15[13]; // for t, x+1, y-1, z;
// temp_vec16[2] = temp_vec15[14]; // for t, x+2, y-1, z;
// temp_vec16[3] = temp_vec15[15]; // for t, x+3, y-1, z;
// temp_vec16[4] = temp_vec14[0]; // for t, x, y, z;
// temp_vec16[5] = temp_vec14[1]; // for t, x+1, y, z;
// temp_vec16[6] = temp_vec14[2]; // for t, x+2, y, z;
// temp_vec16[7] = temp_vec14[3]; // for t, x+3, y, z;
// temp_vec16[8] = temp_vec14[4]; // for t, x, y+1, z;
// temp_vec16[9] = temp_vec14[5]; // for t, x+1, y+1, z;
// temp_vec16[10] = temp_vec14[6]; // for t, x+2, y+1, z;
// temp_vec16[11] = temp_vec14[7]; // for t, x+3, y+1, z;
// temp_vec16[12] = temp_vec14[8]; // for t, x, y+2, z;
// temp_vec16[13] = temp_vec14[9]; // for t, x+1, y+2, z;
// temp_vec16[14] = temp_vec14[10]; // for t, x+2, y+2, z;
// temp_vec16[15] = temp_vec14[11]; // for t, x+3, y+2, z;
// Get 12 element(s) from temp_vec14 and 4 from temp_vec15.
real_vec_align<12>(temp_vec16, temp_vec14, temp_vec15);
// Read aligned vector block from stress_xy at t, x, y+4, z.
real_vec_t temp_vec17 = context.stress_xy->readVecNorm(tv, xv, yv+(4/4), zv, __LINE__);
// Construct unaligned vector block from stress_xy at t, x, y+1, z.
real_vec_t temp_vec18;
// temp_vec18[0] = temp_vec14[4]; // for t, x, y+1, z;
// temp_vec18[1] = temp_vec14[5]; // for t, x+1, y+1, z;
// temp_vec18[2] = temp_vec14[6]; // for t, x+2, y+1, z;
// temp_vec18[3] = temp_vec14[7]; // for t, x+3, y+1, z;
// temp_vec18[4] = temp_vec14[8]; // for t, x, y+2, z;
// temp_vec18[5] = temp_vec14[9]; // for t, x+1, y+2, z;
// temp_vec18[6] = temp_vec14[10]; // for t, x+2, y+2, z;
// temp_vec18[7] = temp_vec14[11]; // for t, x+3, y+2, z;
// temp_vec18[8] = temp_vec14[12]; // for t, x, y+3, z;
// temp_vec18[9] = temp_vec14[13]; // for t, x+1, y+3, z;
// temp_vec18[10] = temp_vec14[14]; // for t, x+2, y+3, z;
// temp_vec18[11] = temp_vec14[15]; // for t, x+3, y+3, z;
// temp_vec18[12] = temp_vec17[0]; // for t, x, y+4, z;
// temp_vec18[13] = temp_vec17[1]; // for t, x+1, y+4, z;
// temp_vec18[14] = temp_vec17[2]; // for t, x+2, y+4, z;
// temp_vec18[15] = temp_vec17[3]; // for t, x+3, y+4, z;
// Get 4 element(s) from temp_vec17 and 12 from temp_vec14.
real_vec_align<4>(temp_vec18, temp_vec17, temp_vec14);
// Construct unaligned vector block from stress_xy at t, x, y-2, z.
real_vec_t temp_vec19;
// temp_vec19[0] = temp_vec15[8]; // for t, x, y-2, z;
// temp_vec19[1] = temp_vec15[9]; // for t, x+1, y-2, z;
// temp_vec19[2] = temp_vec15[10]; // for t, x+2, y-2, z;
// temp_vec19[3] = temp_vec15[11]; // for t, x+3, y-2, z;
// temp_vec19[4] = temp_vec15[12]; // for t, x, y-1, z;
// temp_vec19[5] = temp_vec15[13]; // for t, x+1, y-1, z;
// temp_vec19[6] = temp_vec15[14]; // for t, x+2, y-1, z;
// temp_vec19[7] = temp_vec15[15]; // for t, x+3, y-1, z;
// temp_vec19[8] = temp_vec14[0]; // for t, x, y, z;
// temp_vec19[9] = temp_vec14[1]; // for t, x+1, y, z;
// temp_vec19[10] = temp_vec14[2]; // for t, x+2, y, z;
// temp_vec19[11] = temp_vec14[3]; // for t, x+3, y, z;
// temp_vec19[12] = temp_vec14[4]; // for t, x, y+1, z;
// temp_vec19[13] = temp_vec14[5]; // for t, x+1, y+1, z;
// temp_vec19[14] = temp_vec14[6]; // for t, x+2, y+1, z;
// temp_vec19[15] = temp_vec14[7]; // for t, x+3, y+1, z;
// Get 8 element(s) from temp_vec14 and 8 from temp_vec15.
real_vec_align<8>(temp_vec19, temp_vec14, temp_vec15);
// Read aligned vector block from stress_xz at t, x, y, z.
real_vec_t temp_vec20 = context.stress_xz->readVecNorm(tv, xv, yv, zv, __LINE__);
// Read aligned vector block from stress_xz at t, x, y, z-1.
real_vec_t temp_vec21 = context.stress_xz->readVecNorm(tv, xv, yv, zv-(1/1), __LINE__);
// Read aligned vector block from stress_xz at t, x, y, z+1.
real_vec_t temp_vec22 = context.stress_xz->readVecNorm(tv, xv, yv, zv+(1/1), __LINE__);
// Read aligned vector block from stress_xz at t, x, y, z-2.
real_vec_t temp_vec23 = context.stress_xz->readVecNorm(tv, xv, yv, zv-(2/1), __LINE__);
// Read aligned vector block from sponge at x, y, z.
real_vec_t temp_vec24 = context.sponge->readVecNorm(xv, yv, zv, __LINE__);
// temp_vec25 = delta_t().
real_vec_t temp_vec25 = (*context.delta_t)();
// temp_vec26 = h().
real_vec_t temp_vec26 = (*context.h)();
// temp_vec27 = rho(x, y, z).
real_vec_t temp_vec27 = temp_vec2;
// temp_vec28 = rho(x, y-1, z).
real_vec_t temp_vec28 = temp_vec4;
// temp_vec29 = rho(x, y, z) + rho(x, y-1, z).
real_vec_t temp_vec29 = temp_vec27 + temp_vec28;
// temp_vec30 = rho(x, y, z-1).
real_vec_t temp_vec30 = temp_vec5;
// temp_vec31 = rho(x, y, z) + rho(x, y-1, z) + rho(x, y, z-1).
real_vec_t temp_vec31 = temp_vec29 + temp_vec30;
// temp_vec32 = rho(x, y, z) + rho(x, y-1, z) + rho(x, y, z-1) + rho(x, y-1, z-1).
real_vec_t temp_vec32 = temp_vec31 + temp_vec7;
// temp_vec33 = h() * (rho(x, y, z) + rho(x, y-1, z) + rho(x, y, z-1) + rho(x, y-1, z-1)).
real_vec_t temp_vec33 = temp_vec26 * temp_vec32;
// temp_vec34 = 0.25.
real_vec_t temp_vec34 = 2.50000000000000000e-01;
// temp_vec35 = h() * (rho(x, y, z) + rho(x, y-1, z) + rho(x, y, z-1) + rho(x, y-1, z-1)) * 0.25.
real_vec_t temp_vec35 = temp_vec33 * temp_vec34;
// temp_vec36 = (delta_t / (h * (rho(x, y, z) + rho(x, y-1, z) + rho(x, y, z-1) + rho(x, y-1, z-1)) * 0.25)).
real_vec_t temp_vec36 = temp_vec25 / temp_vec35;
// temp_vec37 = 1.125.
real_vec_t temp_vec37 = 1.12500000000000000e+00;
// temp_vec38 = 1.125 * (stress_xx(t, x, y, z) - stress_xx(t, x-1, y, z)).
real_vec_t temp_vec38 = temp_vec37 * (temp_vec8 - temp_vec10);
// temp_vec39 = -0.0416667.
real_vec_t temp_vec39 = -4.16666666666666644e-02;
// temp_vec40 = -0.0416667 * (stress_xx(t, x+1, y, z) - stress_xx(t, x-2, y, z)).
real_vec_t temp_vec40 = temp_vec39 * (temp_vec12 - temp_vec13);
// temp_vec41 = (1.125 * (stress_xx(t, x, y, z) - stress_xx(t, x-1, y, z))) + (-0.0416667 * (stress_xx(t, x+1, y, z) - stress_xx(t, x-2, y, z))).
real_vec_t temp_vec41 = temp_vec38 + temp_vec40;
// temp_vec42 = stress_xy(t, x, y, z).
real_vec_t temp_vec42 = temp_vec14;
// temp_vec43 = (stress_xy(t, x, y, z) - stress_xy(t, x, y-1, z)).
real_vec_t temp_vec43 = temp_vec42 - temp_vec16;
// temp_vec44 = 1.125 * (stress_xy(t, x, y, z) - stress_xy(t, x, y-1, z)).
real_vec_t temp_vec44 = temp_vec37 * temp_vec43;
// temp_vec45 = (1.125 * (stress_xx(t, x, y, z) - stress_xx(t, x-1, y, z))) + (-0.0416667 * (stress_xx(t, x+1, y, z) - stress_xx(t, x-2, y, z))) + (1.125 * (stress_xy(t, x, y, z) - stress_xy(t, x, y-1, z))).
real_vec_t temp_vec45 = temp_vec41 + temp_vec44;
// temp_vec46 = -0.0416667 * (stress_xy(t, x, y+1, z) - stress_xy(t, x, y-2, z)).
real_vec_t temp_vec46 = temp_vec39 * (temp_vec18 - temp_vec19);
// temp_vec47 = (1.125 * (stress_xx(t, x, y, z) - stress_xx(t, x-1, y, z))) + (-0.0416667 * (stress_xx(t, x+1, y, z) - stress_xx(t, x-2, y, z))) + (1.125 * (stress_xy(t, x, y, z) - stress_xy(t, x, y-1, z))) + (-0.0416667 * (stress_xy(t, x, y+1, z) - stress_xy(t, x, y-2, z))).
real_vec_t temp_vec47 = temp_vec45 + temp_vec46;
// temp_vec48 = stress_xz(t, x, y, z).
real_vec_t temp_vec48 = temp_vec20;
// temp_vec49 = (stress_xz(t, x, y, z) - stress_xz(t, x, y, z-1)).
real_vec_t temp_vec49 = temp_vec48 - temp_vec21;
// temp_vec50 = 1.125 * (stress_xz(t, x, y, z) - stress_xz(t, x, y, z-1)).
real_vec_t temp_vec50 = temp_vec37 * temp_vec49;
// temp_vec51 = (1.125 * (stress_xx(t, x, y, z) - stress_xx(t, x-1, y, z))) + (-0.0416667 * (stress_xx(t, x+1, y, z) - stress_xx(t, x-2, y, z))) + (1.125 * (stress_xy(t, x, y, z) - stress_xy(t, x, y-1, z))) + (-0.0416667 * (stress_xy(t, x, y+1, z) - stress_xy(t, x, y-2, z))) + (1.125 * (stress_xz(t, x, y, z) - stress_xz(t, x, y, z-1))).
real_vec_t temp_vec51 = temp_vec47 + temp_vec50;
// temp_vec52 = -0.0416667 * (stress_xz(t, x, y, z+1) - stress_xz(t, x, y, z-2)).
real_vec_t temp_vec52 = temp_vec39 * (temp_vec22 - temp_vec23);
// temp_vec53 = (1.125 * (stress_xx(t, x, y, z) - stress_xx(t, x-1, y, z))) + (-0.0416667 * (stress_xx(t, x+1, y, z) - stress_xx(t, x-2, y, z))) + (1.125 * (stress_xy(t, x, y, z) - stress_xy(t, x, y-1, z))) + (-0.0416667 * (stress_xy(t, x, y+1, z) - stress_xy(t, x, y-2, z))) + (1.125 * (stress_xz(t, x, y, z) - stress_xz(t, x, y, z-1))) + (-0.0416667 * (stress_xz(t, x, y, z+1) - stress_xz(t, x, y, z-2))).
real_vec_t temp_vec53 = temp_vec51 + temp_vec52;
// temp_vec54 = (delta_t / (h * (rho(x, y, z) + rho(x, y-1, z) + rho(x, y, z-1) + rho(x, y-1, z-1)) * 0.25)) * ((1.125 * (stress_xx(t, x, y, z) - stress_xx(t, x-1, y, z))) + (-0.0416667 * (stress_xx(t, x+1, y, z) - stress_xx(t, x-2, y, z))) + (1.125 * (stress_xy(t, x, y, z) - stress_xy(t, x, y-1, z))) + (-0.0416667 * (stress_xy(t, x, y+1, z) - stress_xy(t, x, y-2, z))) + (1.125 * (stress_xz(t, x, y, z) - stress_xz(t, x, y, z-1))) + (-0.0416667 * (stress_xz(t, x, y, z+1) - stress_xz(t, x, y, z-2)))).
real_vec_t temp_vec54 = temp_vec36 * temp_vec53;
// temp_vec55 = vel_x(t, x, y, z) + ((delta_t / (h * (rho(x, y, z) + rho(x, y-1, z) + rho(x, y, z-1) + rho(x, y-1, z-1)) * 0.25)) * ((1.125 * (stress_xx(t, x, y, z) - stress_xx(t, x-1, y, z))) + (-0.0416667 * (stress_xx(t, x+1, y, z) - stress_xx(t, x-2, y, z))) + (1.125 * (stress_xy(t, x, y, z) - stress_xy(t, x, y-1, z))) + (-0.0416667 * (stress_xy(t, x, y+1, z) - stress_xy(t, x, y-2, z))) + (1.125 * (stress_xz(t, x, y, z) - stress_xz(t, x, y, z-1))) + (-0.0416667 * (stress_xz(t, x, y, z+1) - stress_xz(t, x, y, z-2))))).
real_vec_t temp_vec55 = temp_vec1 + temp_vec54;
// temp_vec56 = sponge(x, y, z).
real_vec_t temp_vec56 = temp_vec24;
// temp_vec57 = (vel_x(t, x, y, z) + ((delta_t / (h * (rho(x, y, z) + rho(x, y-1, z) + rho(x, y, z-1) + rho(x, y-1, z-1)) * 0.25)) * ((1.125 * (stress_xx(t, x, y, z) - stress_xx(t, x-1, y, z))) + (-0.0416667 * (stress_xx(t, x+1, y, z) - stress_xx(t, x-2, y, z))) + (1.125 * (stress_xy(t, x, y, z) - stress_xy(t, x, y-1, z))) + (-0.0416667 * (stress_xy(t, x, y+1, z) - stress_xy(t, x, y-2, z))) + (1.125 * (stress_xz(t, x, y, z) - stress_xz(t, x, y, z-1))) + (-0.0416667 * (stress_xz(t, x, y, z+1) - stress_xz(t, x, y, z-2)))))) * sponge(x, y, z).
real_vec_t temp_vec57 = temp_vec55 * temp_vec56;
// temp_vec58 = ((vel_x(t, x, y, z) + ((delta_t / (h * (rho(x, y, z) + rho(x, y-1, z) + rho(x, y, z-1) + rho(x, y-1, z-1)) * 0.25)) * ((1.125 * (stress_xx(t, x, y, z) - stress_xx(t, x-1, y, z))) + (-0.0416667 * (stress_xx(t, x+1, y, z) - stress_xx(t, x-2, y, z))) + (1.125 * (stress_xy(t, x, y, z) - stress_xy(t, x, y-1, z))) + (-0.0416667 * (stress_xy(t, x, y+1, z) - stress_xy(t, x, y-2, z))) + (1.125 * (stress_xz(t, x, y, z) - stress_xz(t, x, y, z-1))) + (-0.0416667 * (stress_xz(t, x, y, z+1) - stress_xz(t, x, y, z-2)))))) * sponge(x, y, z)).
real_vec_t temp_vec58 = temp_vec57;
// Save result to vel_x(t+1, x, y, z):
// Write aligned vector block to vel_x at t+1, x, y, z.
context.vel_x->writeVecNorm(temp_vec58, tv+(1/1), xv, yv, zv, __LINE__);
;
// Read aligned vector block from vel_y at t, x, y, z.
real_vec_t temp_vec59 = context.vel_y->readVecNorm(tv, xv, yv, zv, __LINE__);
// Read aligned vector block from rho at x+4, y, z.
real_vec_t temp_vec60 = context.rho->readVecNorm(xv+(4/4), yv, zv, __LINE__);
// Construct unaligned vector block from rho at x+1, y, z.
real_vec_t temp_vec61;
// temp_vec61[0] = temp_vec2[1]; // for x+1, y, z;
// temp_vec61[1] = temp_vec2[2]; // for x+2, y, z;
// temp_vec61[2] = temp_vec2[3]; // for x+3, y, z;
// temp_vec61[3] = temp_vec60[0]; // for x+4, y, z;
// temp_vec61[4] = temp_vec2[5]; // for x+1, y+1, z;
// temp_vec61[5] = temp_vec2[6]; // for x+2, y+1, z;
// temp_vec61[6] = temp_vec2[7]; // for x+3, y+1, z;
// temp_vec61[7] = temp_vec60[4]; // for x+4, y+1, z;
// temp_vec61[8] = temp_vec2[9]; // for x+1, y+2, z;
// temp_vec61[9] = temp_vec2[10]; // for x+2, y+2, z;
// temp_vec61[10] = temp_vec2[11]; // for x+3, y+2, z;
// temp_vec61[11] = temp_vec60[8]; // for x+4, y+2, z;
// temp_vec61[12] = temp_vec2[13]; // for x+1, y+3, z;
// temp_vec61[13] = temp_vec2[14]; // for x+2, y+3, z;
// temp_vec61[14] = temp_vec2[15]; // for x+3, y+3, z;
// temp_vec61[15] = temp_vec60[12]; // for x+4, y+3, z;
real_vec_permute2(temp_vec61, ctrl_A1_A2_A3_B0_A5_A6_A7_B4_A9_A10_A11_B8_A13_A14_A15_B12, temp_vec2, temp_vec60);
// Read aligned vector block from rho at x+4, y, z-1.
real_vec_t temp_vec62 = context.rho->readVecNorm(xv+(4/4), yv, zv-(1/1), __LINE__);
// Construct unaligned vector block from rho at x+1, y, z-1.
real_vec_t temp_vec63;
// temp_vec63[0] = temp_vec5[1]; // for x+1, y, z-1;
// temp_vec63[1] = temp_vec5[2]; // for x+2, y, z-1;
// temp_vec63[2] = temp_vec5[3]; // for x+3, y, z-1;
// temp_vec63[3] = temp_vec62[0]; // for x+4, y, z-1;
// temp_vec63[4] = temp_vec5[5]; // for x+1, y+1, z-1;
// temp_vec63[5] = temp_vec5[6]; // for x+2, y+1, z-1;
// temp_vec63[6] = temp_vec5[7]; // for x+3, y+1, z-1;
// temp_vec63[7] = temp_vec62[4]; // for x+4, y+1, z-1;
// temp_vec63[8] = temp_vec5[9]; // for x+1, y+2, z-1;
// temp_vec63[9] = temp_vec5[10]; // for x+2, y+2, z-1;
// temp_vec63[10] = temp_vec5[11]; // for x+3, y+2, z-1;
// temp_vec63[11] = temp_vec62[8]; // for x+4, y+2, z-1;
// temp_vec63[12] = temp_vec5[13]; // for x+1, y+3, z-1;
// temp_vec63[13] = temp_vec5[14]; // for x+2, y+3, z-1;
// temp_vec63[14] = temp_vec5[15]; // for x+3, y+3, z-1;
// temp_vec63[15] = temp_vec62[12]; // for x+4, y+3, z-1;
real_vec_permute2(temp_vec63, ctrl_A1_A2_A3_B0_A5_A6_A7_B4_A9_A10_A11_B8_A13_A14_A15_B12, temp_vec5, temp_vec62);
// Read aligned vector block from stress_xy at t, x+4, y, z.
real_vec_t temp_vec64 = context.stress_xy->readVecNorm(tv, xv+(4/4), yv, zv, __LINE__);
// Construct unaligned vector block from stress_xy at t, x+1, y, z.
real_vec_t temp_vec65;
// temp_vec65[0] = temp_vec14[1]; // for t, x+1, y, z;
// temp_vec65[1] = temp_vec14[2]; // for t, x+2, y, z;
// temp_vec65[2] = temp_vec14[3]; // for t, x+3, y, z;
// temp_vec65[3] = temp_vec64[0]; // for t, x+4, y, z;
// temp_vec65[4] = temp_vec14[5]; // for t, x+1, y+1, z;
// temp_vec65[5] = temp_vec14[6]; // for t, x+2, y+1, z;
// temp_vec65[6] = temp_vec14[7]; // for t, x+3, y+1, z;
// temp_vec65[7] = temp_vec64[4]; // for t, x+4, y+1, z;
// temp_vec65[8] = temp_vec14[9]; // for t, x+1, y+2, z;
// temp_vec65[9] = temp_vec14[10]; // for t, x+2, y+2, z;
// temp_vec65[10] = temp_vec14[11]; // for t, x+3, y+2, z;
// temp_vec65[11] = temp_vec64[8]; // for t, x+4, y+2, z;
// temp_vec65[12] = temp_vec14[13]; // for t, x+1, y+3, z;
// temp_vec65[13] = temp_vec14[14]; // for t, x+2, y+3, z;
// temp_vec65[14] = temp_vec14[15]; // for t, x+3, y+3, z;
// temp_vec65[15] = temp_vec64[12]; // for t, x+4, y+3, z;
real_vec_permute2(temp_vec65, ctrl_A1_A2_A3_B0_A5_A6_A7_B4_A9_A10_A11_B8_A13_A14_A15_B12, temp_vec14, temp_vec64);
// Construct unaligned vector block from stress_xy at t, x+2, y, z.
real_vec_t temp_vec66;
// temp_vec66[0] = temp_vec14[2]; // for t, x+2, y, z;
// temp_vec66[1] = temp_vec14[3]; // for t, x+3, y, z;
// temp_vec66[2] = temp_vec64[0]; // for t, x+4, y, z;
// temp_vec66[3] = temp_vec64[1]; // for t, x+5, y, z;
// temp_vec66[4] = temp_vec14[6]; // for t, x+2, y+1, z;
// temp_vec66[5] = temp_vec14[7]; // for t, x+3, y+1, z;
// temp_vec66[6] = temp_vec64[4]; // for t, x+4, y+1, z;
// temp_vec66[7] = temp_vec64[5]; // for t, x+5, y+1, z;
// temp_vec66[8] = temp_vec14[10]; // for t, x+2, y+2, z;
// temp_vec66[9] = temp_vec14[11]; // for t, x+3, y+2, z;
// temp_vec66[10] = temp_vec64[8]; // for t, x+4, y+2, z;
// temp_vec66[11] = temp_vec64[9]; // for t, x+5, y+2, z;
// temp_vec66[12] = temp_vec14[14]; // for t, x+2, y+3, z;
// temp_vec66[13] = temp_vec14[15]; // for t, x+3, y+3, z;
// temp_vec66[14] = temp_vec64[12]; // for t, x+4, y+3, z;
// temp_vec66[15] = temp_vec64[13]; // for t, x+5, y+3, z;
real_vec_permute2(temp_vec66, ctrl_A2_A3_B0_B1_A6_A7_B4_B5_A10_A11_B8_B9_A14_A15_B12_B13, temp_vec14, temp_vec64);
// Read aligned vector block from stress_xy at t, x-4, y, z.
real_vec_t temp_vec67 = context.stress_xy->readVecNorm(tv, xv-(4/4), yv, zv, __LINE__);
// Construct unaligned vector block from stress_xy at t, x-1, y, z.
real_vec_t temp_vec68;
// temp_vec68[0] = temp_vec67[3]; // for t, x-1, y, z;
// temp_vec68[1] = temp_vec14[0]; // for t, x, y, z;
// temp_vec68[2] = temp_vec14[1]; // for t, x+1, y, z;
// temp_vec68[3] = temp_vec14[2]; // for t, x+2, y, z;
// temp_vec68[4] = temp_vec67[7]; // for t, x-1, y+1, z;
// temp_vec68[5] = temp_vec14[4]; // for t, x, y+1, z;
// temp_vec68[6] = temp_vec14[5]; // for t, x+1, y+1, z;
// temp_vec68[7] = temp_vec14[6]; // for t, x+2, y+1, z;
// temp_vec68[8] = temp_vec67[11]; // for t, x-1, y+2, z;
// temp_vec68[9] = temp_vec14[8]; // for t, x, y+2, z;
// temp_vec68[10] = temp_vec14[9]; // for t, x+1, y+2, z;
// temp_vec68[11] = temp_vec14[10]; // for t, x+2, y+2, z;
// temp_vec68[12] = temp_vec67[15]; // for t, x-1, y+3, z;
// temp_vec68[13] = temp_vec14[12]; // for t, x, y+3, z;
// temp_vec68[14] = temp_vec14[13]; // for t, x+1, y+3, z;
// temp_vec68[15] = temp_vec14[14]; // for t, x+2, y+3, z;
real_vec_permute2(temp_vec68, ctrl_A3_B0_B1_B2_A7_B4_B5_B6_A11_B8_B9_B10_A15_B12_B13_B14, temp_vec67, temp_vec14);
// Read aligned vector block from stress_yy at t, x, y, z.
real_vec_t temp_vec69 = context.stress_yy->readVecNorm(tv, xv, yv, zv, __LINE__);
// Read aligned vector block from stress_yy at t, x, y+4, z.
real_vec_t temp_vec70 = context.stress_yy->readVecNorm(tv, xv, yv+(4/4), zv, __LINE__);
// Construct unaligned vector block from stress_yy at t, x, y+1, z.