hexsha
stringlengths 40
40
| size
int64 7
1.05M
| ext
stringclasses 13
values | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 4
269
| max_stars_repo_name
stringlengths 5
109
| max_stars_repo_head_hexsha
stringlengths 40
40
| max_stars_repo_licenses
listlengths 1
9
| max_stars_count
int64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 4
269
| max_issues_repo_name
stringlengths 5
116
| max_issues_repo_head_hexsha
stringlengths 40
40
| max_issues_repo_licenses
listlengths 1
9
| max_issues_count
int64 1
48.5k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 4
269
| max_forks_repo_name
stringlengths 5
116
| max_forks_repo_head_hexsha
stringlengths 40
40
| max_forks_repo_licenses
listlengths 1
9
| max_forks_count
int64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 7
1.05M
| avg_line_length
float64 1.21
330k
| max_line_length
int64 6
990k
| alphanum_fraction
float64 0.01
0.99
| author_id
stringlengths 2
40
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cf217ad36abf80dcdd19174a48ad7546ea61723f
| 552
|
cpp
|
C++
|
2021CCPC_val_final/Q1.cpp
|
Leon-Francis/AlgorithmPractice
|
bfff066da64ebbb00ecd33d94ebbe5bcc382867c
|
[
"MIT"
] | 1
|
2020-10-07T12:03:12.000Z
|
2020-10-07T12:03:12.000Z
|
2021CCPC_val_final/Q1.cpp
|
Leon-Francis/AlgorithmPractice
|
bfff066da64ebbb00ecd33d94ebbe5bcc382867c
|
[
"MIT"
] | null | null | null |
2021CCPC_val_final/Q1.cpp
|
Leon-Francis/AlgorithmPractice
|
bfff066da64ebbb00ecd33d94ebbe5bcc382867c
|
[
"MIT"
] | null | null | null |
#include <stdio.h>
using namespace std;
long long labs(long long x)
{
if (x < 0)
{
return -x;
}
return x;
}
int main()
{
long long T;
scanf("%lld", &T);
long long A, B;
for (long long i = 0; i < T; i++)
{
scanf("%lld%lld", &A, &B);
long long C = A - B;
if (A < 0 || B < 0)
{
printf("NO\n");
}
else if (labs(C) > 1)
{
printf("NO\n");
}
else
{
printf("YES\n");
}
}
return 0;
}
| 15.333333
| 37
| 0.36413
|
Leon-Francis
|
cf240d70e760c14fe01ee9c18b9db0b675ffa217
| 772
|
hh
|
C++
|
test/DBAL/DriverTest.hh
|
decouple/decouple.io
|
c841e905fbc8bd9507759a0ef6e56e1985c56c5a
|
[
"MIT"
] | null | null | null |
test/DBAL/DriverTest.hh
|
decouple/decouple.io
|
c841e905fbc8bd9507759a0ef6e56e1985c56c5a
|
[
"MIT"
] | null | null | null |
test/DBAL/DriverTest.hh
|
decouple/decouple.io
|
c841e905fbc8bd9507759a0ef6e56e1985c56c5a
|
[
"MIT"
] | null | null | null |
<?hh // strict
namespace Test\DBAL;
use Decouple\Console\CLI\CLI;
use Decouple\Test\TestCase;
use Decouple\DBAL\DPDO\DPDOMySQLDriver;
use Decouple\Registry\Paths;
class DriverTest extends TestCase {
public function __construct() {}
public function execute(Paths $paths): void {
$db_config = hack_require($paths->get('config') . '/database.hh');
$test_db = $db_config->get('test');
$driver = new DPDOMySQLDriver();
$connected = $driver->connect(
$test_db->get('params'),
$test_db->get('user'),
$test_db->get('password'),
);
$this->assertEquals($connected, true);
$schema = $driver->schema('decouple_test');
if(!$schema->exists()) {
$schema->create();
}
$this->assertEquals($schema->exists(), true);
}
}
| 29.692308
| 70
| 0.647668
|
decouple
|
cf26dd7e25fcef3fff46825da9cab3aaad586b3f
| 2,340
|
cpp
|
C++
|
ivb-3-14/bykosvkyAS/lab2.cpp
|
bykovskyy/2014
|
474c6eb940978d4f323ef4dc2eac8e0360f19612
|
[
"BSD-2-Clause"
] | null | null | null |
ivb-3-14/bykosvkyAS/lab2.cpp
|
bykovskyy/2014
|
474c6eb940978d4f323ef4dc2eac8e0360f19612
|
[
"BSD-2-Clause"
] | null | null | null |
ivb-3-14/bykosvkyAS/lab2.cpp
|
bykovskyy/2014
|
474c6eb940978d4f323ef4dc2eac8e0360f19612
|
[
"BSD-2-Clause"
] | null | null | null |
// 2.cpp вариант 7:
#include "stdafx.h"
#include <conio.h>
#include <stdio.h>
#include <iostream>
#include <clocale>
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
int i, j; /для циклов
bool opt1 = false; //есть ли нули в матрицах
bool opt2 = false;
//Зададим размеры 2-х матриц
const int N1 = 2;
const int N2 = 3;
const int M1 = 4;
const int M2 = 5;
int c1[N1]; //счетчик отрицательных элементов столбцов
int c2[N2];
//зададим 2 матрицы N1xM1 и N2xM2
int m1[N1][M1];
int m2[N2][M2];
//рандомим числа от -3 до 3
for(i = 0; i < N1; i++)
for(j = 0; j < M1; j++)
m1[i][j] = rand() % 6 - 3;
for(i = 0; i < N2; i++)
for(j = 0; j < M2; j++)
m2[i][j] = rand() % 6 - 3;
cout << "Матрица 1:" << endl;
for(i = 0; i < N1; i++) {
for(j = 0; j < M1; j++)
cout << m1[i][j] << ' ';
cout << endl;
}
cout << endl << "Матрица 2:" << endl;
for(i = 0; i < N2; i++) {
for(j = 0; j < M2; j++)
cout << m2[i][j] << ' ';
cout << endl;
}
//поиск нулей в массивах
for(i = 0; i < N1; i++) {
for(j = 0; j < M1; j++)
if(m1[i][j] == 0) {
opt1 = true;
break;
}
if(opt1)
break;
}
for(i = 0; i < N2; i++) {
for(j = 0; j < M2; j++)
if(m2[i][j] == 0) {
opt2 = true;
break;
}
if(opt2)
break;
}
//находим количество отрицательных элементов в каждой строке
if(opt1) {
cout << endl << "в первой матрице есть 0" << endl << endl;
for(i = 0; i < N1; i++) {
c1[i] = 0;
for(j = 0; j < M1; j++)
if(m1[i][j] < 0)
c1[i]++;
cout << "количество отрицательных элеметнов в "<< i << "-й строке: " << c1[i] << endl;
}
}
if(opt2) {
cout << endl << "во второй матрице есть 0" << endl << endl;
for(i = 0; i < N2; i++) {
c2[i] = 0;
for(j = 0; j < M2; j++)
if(m2[i][j] < 0)
c2[i]++;
cout << "количество отрицательных элементов в "<< i << "-й строке: " << c2[i] << endl;
}
}
_getch();
}
| 26.896552
| 98
| 0.406838
|
bykovskyy
|
cf27452c0f664212fde5611aaa396ea362b7201e
| 180,551
|
cpp
|
C++
|
csl/cslbase/cmfont-widths.cpp
|
arthurcnorman/general
|
5e8fef0cc7999fa8ab75d8fdf79ad5488047282b
|
[
"BSD-2-Clause"
] | null | null | null |
csl/cslbase/cmfont-widths.cpp
|
arthurcnorman/general
|
5e8fef0cc7999fa8ab75d8fdf79ad5488047282b
|
[
"BSD-2-Clause"
] | null | null | null |
csl/cslbase/cmfont-widths.cpp
|
arthurcnorman/general
|
5e8fef0cc7999fa8ab75d8fdf79ad5488047282b
|
[
"BSD-2-Clause"
] | null | null | null |
//
// cmfont-widths.cpp
// Widths for characters in Computer Modern Fonts
//
// extracted from wxfonts/tfm
//
//
// $Id: cmfont-widths.cpp 5331 2020-04-25 13:47:28Z arthurcnorman $
#include <stdint.h>
typedef struct font_width
{ const char *name;
int32_t checksum;
int32_t designsize;
int32_t charwidth[128];
} font_width;
static font_width cm_font_width[] =
{ { "cmb10", -770990554, 10485760, { // 32202717046 10.0
629149, 873816, 815562, 734006, 699053, 821387, 757307, 815562,
757307, 815562, 757307, 611672, 582544, 582544, 873816, 873816,
291272, 320400, 524290, 524290, 524290, 524290, 524290, 792261,
466035, 586912, 757307, 815562, 524290, 949547,1066056, 815562,
291272, 320398, 570893, 873816, 524290, 873816, 815562, 291272,
407781, 407781, 524290, 815562, 291272, 349526, 291272, 524290,
524290, 524290, 524290, 524290, 524290, 524290, 524290, 524290,
524290, 524290, 291272, 291272, 320398, 815562, 495163, 495163,
815562, 792261, 745658, 757307, 803912, 687403, 658277, 824301,
821387, 416520, 541766, 821389, 629149, 996150, 821387, 786435,
716530, 786435, 796629, 582544, 728181, 806824, 792261,1083533,
792261, 792261, 640798, 293603, 570893, 293603, 524290, 291272,
291272, 509726, 582544, 466035, 582544, 489336, 320400, 524290,
582544, 291272, 320400, 553418, 291272, 873816, 582544, 524290,
582544, 553416, 448560, 413606, 409237, 582544, 553418, 757307,
553418, 553418, 466035, 524290,1048579, 524290, 524290, 524290
}
},
{ "cmbsy10", -523662324, 10485760, { // 34062306014 10.0
937888, 334960, 937888, 602928, 937888, 602928, 937888, 937888,
937888, 937888, 937888, 937888, 937888,1205856, 602928, 602928,
937888, 937888, 937888, 937888, 937888, 937888, 937888, 937888,
937888, 937888, 937888, 937888,1205856,1205856, 937888, 937888,
1205856,1205856, 602928, 602928,1205856,1205856,1205856, 937888,
1205856,1205856, 736912, 736912,1205856,1205856,1205856, 937888,
361174,1205856, 803904, 803904,1071872,1071872, 0, 0,
669920, 669920, 803904, 602928, 870896, 870896, 937888, 937888,
736912, 965453, 784171, 642758, 935413, 636424, 853634, 714704,
1035352, 673595, 817302, 913571, 826477,1444755, 982853, 949539,
849197, 984782,1037646, 730213, 675432, 749432, 773176,1225371,
856395, 795459, 858229, 803904, 803904, 803904, 803904, 803904,
736912, 736912, 535936, 535936, 535936, 535936, 602928, 602928,
468944, 468944, 334960, 602928, 602928, 736912, 602928, 334960,
1004880, 943714,1004880, 596378, 803904, 803904, 937888, 937888,
551957, 535936, 535936, 736912, 937888, 937888, 937888, 937888
}
},
{ "cmbsy6", 565139544, 6291456, { // 4153654130 6.00
1139835, 432051,1139835, 746621,1139835, 746621,1139835,1139835,
1139835,1139835,1139835,1139835,1139835,1454405, 746621, 746621,
1139835,1139835,1139835,1139835,1139835,1139835,1139835,1139835,
1139835,1139835,1139835,1139835,1454405,1454405,1139835,1139835,
1454405,1454405, 746621, 746621,1454405,1454405,1454405,1139835,
1454405,1454405, 903907, 903907,1454405,1454405,1454405,1139835,
449525,1454405, 982549, 982549,1297120,1297120, 0, 0,
825264, 825264, 982549, 746621,1061192,1061192,1139835,1139835,
903907,1175323, 950005, 802763,1143187, 785947,1025291, 874709,
1274584, 849915, 998280,1105035,1002795,1722277,1184803,1141000,
1048232,1194888,1275712, 896045, 854077, 908464, 959589,1490427,
1039701, 960123,1027555, 982549, 982549, 982549, 982549, 982549,
903907, 903907, 667979, 667979, 667979, 667979, 746621, 746621,
589336, 589336, 432051, 746621, 746621, 903907, 746621, 432051,
1199059,1135952,1218477, 716768, 982549, 982549,1139835,1139835,
681088, 667979, 667979, 903907,1139835,1139835,1139835,1139835
}
},
{ "cmbsy7", -778919009, 7340032, { // 32144521637 7.00
1059397, 389056,1059397, 686985,1059397, 686985,1059397,1059397,
1059397,1059397,1059397,1059397,1059397,1357326, 686985, 686985,
1059397,1059397,1059397,1059397,1059397,1059397,1059397,1059397,
1059397,1059397,1059397,1059397,1357326,1357326,1059397,1059397,
1357326,1357326, 686985, 686985,1357326,1357326,1357326,1059397,
1357326,1357326, 835950, 835950,1357326,1357326,1357326,1059397,
406530,1357326, 910432, 910432,1208361,1208361, 0, 0,
761467, 761467, 910432, 686985, 984914, 984914,1059397,1059397,
835950,1092055, 882459, 737301,1060667, 724226, 955666, 809248,
1180830, 778626, 925328,1028341, 931509,1617451,1104361,1064306,
968832,1111534,1182377, 828501, 781961, 844183, 885737,1388491,
965918, 892999, 958763, 910432, 910432, 910432, 910432, 910432,
835950, 835950, 612503, 612503, 612503, 612503, 686985, 686985,
538021, 538021, 389056, 686985, 686985, 835950, 686985, 389056,
1125557,1058981,1133879, 670654, 910432, 910432,1059397,1059397,
629771, 612503, 612503, 835950,1059397,1059397,1059397,1059397
}
},
{ "cmbsy8", 2042927564, 8388608, { // 17161114714 8.00
999068, 356810, 999068, 642258, 999068, 642258, 999068, 999068,
999068, 999068, 999068, 999068, 999068,1284516, 642258, 642258,
999068, 999068, 999068, 999068, 999068, 999068, 999068, 999068,
999068, 999068, 999068, 999068,1284516,1284516, 999068, 999068,
1284516,1284516, 642258, 642258,1284516,1284516,1284516, 999068,
1284516,1284516, 784982, 784982,1284516,1284516,1284516, 999068,
381568,1284516, 856344, 856344,1141792,1141792, 0, 0,
713620, 713620, 856344, 642258, 927706, 927706, 999068, 999068,
784982,1029604, 831806, 688208, 998780, 677942, 903454, 760152,
1110518, 725164, 870618, 970820, 878046,1538832,1044034,1006788,
909286,1049024,1112376, 777848, 727872, 795976, 830350,1312044,
910584, 842656, 907172, 856344, 856344, 856344, 856344, 856344,
784982, 784982, 570896, 570896, 570896, 570896, 642258, 642258,
499534, 499534, 356810, 642258, 642258, 784982, 642258, 356810,
1070430,1001250,1070430, 632424, 856344, 856344, 999068, 999068,
587644, 570896, 570896, 784982, 999068, 999068, 999068, 999068
}
},
{ "cmbsy9", 1730424146, 9437184, { // 14711026522 9.00
965067, 344667, 965067, 620400, 965067, 620400, 965067, 965067,
965067, 965067, 965067, 965067, 965067,1240800, 620400, 620400,
965067, 965067, 965067, 965067, 965067, 965067, 965067, 965067,
965067, 965067, 965067, 965067,1240800,1240800, 965067, 965067,
1240800,1240800, 620400, 620400,1240800,1240800,1240800, 965067,
1240800,1240800, 758267, 758267,1240800,1240800,1240800, 965067,
375093,1240800, 827200, 827200,1102933,1102933, 0, 0,
689333, 689333, 827200, 620400, 896133, 896133, 965067, 965067,
758267, 993952, 805333, 662949, 963563, 654869, 875767, 734896,
1068745, 696505, 840987, 939004, 849387,1490597,1010034, 974971,
875892,1013321,1070844, 751374, 698729, 770108, 800196,1265495,
880469, 816425, 879972, 827200, 827200, 827200, 827200, 827200,
758267, 758267, 551467, 551467, 551467, 551467, 620400, 620400,
482533, 482533, 344667, 620400, 620400, 758267, 620400, 344667,
1034000, 969276,1034000, 615632, 827200, 827200, 965067, 965067,
567812, 551467, 551467, 758267, 965067, 965067, 965067, 965067
}
},
{ "cmbx10", 452076118, 10485760, { // 3274421126 10.0
725261,1004880, 937888, 844682, 803904, 943714, 870896, 937888,
870896, 937888, 870896, 703416, 669920, 669920,1004880,1004880,
334960, 368456, 602928, 602928, 602928, 602928, 602928, 911674,
535936, 626230, 870896, 937888, 602928,1092261,1226245, 937888,
334960, 367000, 632056,1004880, 602928,1004880, 937888, 334960,
468944, 468944, 602928, 937888, 334960, 401952, 334960, 602928,
602928, 602928, 602928, 602928, 602928, 602928, 602928, 602928,
602928, 602928, 334960, 334960, 367000, 937888, 569432, 569432,
937888, 911674, 857789, 870896, 924781, 792253, 758757, 948083,
943714, 457294, 623317, 945170, 725261,1144690, 943714, 905848,
824293, 905848, 904392, 669920, 838856, 927694, 911674,1246634,
911674, 911674, 736912, 334960, 632056, 334960, 602928, 334960,
334960, 586179, 669920, 535936, 669920, 552685, 368456, 602928,
669920, 334960, 368456, 636424, 334960,1004880, 669920, 602928,
669920, 636424, 496616, 475643, 468944, 669920, 636424, 870896,
636424, 636424, 535936, 602928,1205856, 602928, 602928, 602928
}
},
{ "cmbx12", -1026142560, 12582912, { // 30265447240 12.0
708760, 983040, 917504, 825269, 786432, 922360, 851968, 917504,
851968, 917504, 851968, 688128, 655360, 655360, 983040, 983040,
327680, 360448, 589824, 589824, 589824, 589824, 589824, 890805,
524288, 601961, 851968, 917504, 589824,1067995,1199067, 917504,
327680, 359235, 609243, 983040, 589824, 983040, 917504, 327680,
458752, 458752, 589824, 917504, 327680, 393216, 327680, 589824,
589824, 589824, 589824, 589824, 589824, 589824, 589824, 589824,
589824, 589824, 327680, 327680, 359235, 917504, 557056, 557056,
917504, 890805, 838619, 851968, 904155, 774296, 741528, 927213,
922360, 439335, 609243, 923573, 708760,1118968, 922360, 885949,
805851, 885949, 879883, 655360, 820413, 906583, 890805,1218485,
890805, 890805, 720896, 327680, 609243, 327680, 589824, 327680,
327680, 573440, 655360, 524288, 655360, 538245, 360448, 589824,
655360, 327680, 360448, 622592, 327680, 983040, 655360, 589824,
655360, 622592, 481812, 465307, 458752, 655360, 622592, 851968,
622592, 622592, 524288, 589824,1179648, 589824, 589824, 589824
}
},
{ "cmbx5", -1423078296, 5242880, { // 25313306150 5.00
940787,1301958,1217491,1083507,1048557,1208752,1133024,1217491,
1133024,1217491,1133024, 956806, 914573, 914573,1371859,1371859,
457286, 499520, 795155, 795155, 795155, 795155, 795155,1167974,
710688, 799533,1133024,1217491, 795155,1403901,1572835,1217491,
457286, 498064, 806810,1301958, 795155,1301958,1217491, 457286,
626221, 626221, 795155,1217491, 457286, 541754, 457286, 795155,
795155, 795155, 795155, 795155, 795155, 795155, 795155, 795155,
795155, 795155, 457286, 457286, 498064,1217491, 752922, 752922,
1217491,1167974,1108266,1133024,1192733,1025254, 983021,1226230,
1208752, 576704, 812630,1210208, 940787,1462154,1208752,1176714,
1066032,1176714,1156326, 879622,1092246,1188365,1167974,1590310,
1167974,1167974, 964090, 460141, 806810, 460141, 795155, 457286,
457286, 774038, 879622, 710688, 879622, 725981, 499520, 795155,
879622, 457286, 499520, 837389, 457286,1301958, 879622, 795155,
879622, 837389, 652438, 634669, 626221, 879622, 837389,1133024,
837389, 837389, 710688, 795155,1590310, 795155, 795155, 795155
}
},
{ "cmbx6", -2142912396, 6291456, { // 20021340164 6.00
865072,1199059,1120416,1000027, 963131,1116533,1041773,1120416,
1041773,1120416,1041773, 864587, 825264, 825264,1237896,1237896,
412632, 451955, 727203, 727203, 727203, 727203, 727203,1078669,
648560, 742256,1041773,1120416, 727203,1296149,1453435,1120416,
412632, 450496, 744680,1199059, 727203,1199059,1120416, 412632,
569917, 569917, 727203,1120416, 412632, 491275, 412632, 727203,
727203, 727203, 727203, 727203, 727203, 727203, 727203, 727203,
727203, 727203, 412632, 412632, 450496,1120416, 687883, 687883,
1120416,1078669,1020901,1041773,1099544, 943715, 904395,1129640,
1116533, 531085, 745651,1117992, 865072,1352461,1116533,1082552,
981579,1082552,1068960, 805845,1003909,1097603,1078669,1471883,
1078669,1078669, 884488, 414381, 744680, 414381, 727203, 412632,
412632, 707541, 805845, 648560, 805845, 664824, 451955, 727203,
805845, 412632, 451955, 766525, 412632,1199059, 805845, 727203,
805845, 766523, 598805, 577781, 569917, 805845, 766525,1041773,
766525, 766525, 648560, 727203,1454405, 727203, 727203, 727203
}
},
{ "cmbx7", 1712792792, 7340032, { // 14605622330 7.00
810981,1125554,1051072, 940389, 902107,1050656, 976590,1051072,
976590,1051072, 976590, 798704, 761463, 761463,1142194,1142194,
380731, 417973, 678661, 678661, 678661, 678661, 678661,1014871,
604178, 701339, 976590,1051072, 678661,1219177,1368142,1051072,
380731, 416517, 700297,1125554, 678661,1125554,1051072, 380731,
529696, 529696, 678661,1051072, 380731, 455214, 380731, 678661,
678661, 678661, 678661, 678661, 678661, 678661, 678661, 678661,
678661, 678661, 380731, 380731, 416517,1051072, 641419, 641419,
1051072,1014871, 958489, 976590,1032971, 885463, 848222,1060642,
1050656, 502649, 697801,1052112, 810981,1274103,1050656,1015287,
921248,1015287,1006549, 753143, 940805,1032763,1014871,1387282,
1014871,1014871, 827625, 381689, 700297, 381689, 678661, 380731,
380731, 660039, 753143, 604178, 753143, 621136, 417973, 678661,
753143, 380731, 417973, 715902, 380731,1125554, 753143, 678661,
753143, 715902, 560489, 537145, 529696, 753143, 715902, 976590,
715902, 715902, 604178, 678661,1357321, 678661, 678661, 678661
}
},
{ "cmbx8", 851919049, 8388608, { // 6261640311 8.00
770418,1070430, 999068, 895664, 856344,1001250, 927706, 999068,
927706, 999068, 927706, 749302, 713620, 713620,1070430,1070430,
356810, 392492, 642258, 642258, 642258, 642258, 642258, 967026,
570896, 668834, 927706, 999068, 642258,1161452,1304176, 999068,
356810, 391034, 667014,1070430, 642258,1070430, 999068, 356810,
499534, 499534, 642258, 999068, 356810, 428172, 356810, 642258,
642258, 642258, 642258, 642258, 642258, 642258, 642258, 642258,
642258, 642258, 356810, 356810, 391034, 999068, 606578, 606578,
999068, 967026, 911686, 927706, 983048, 841780, 806100,1008898,
1001250, 481326, 661918,1002708, 770418,1215336,1001250, 964844,
876004, 964844, 959744, 713620, 893482, 984138, 967026,1323836,
967026, 967026, 784982, 356810, 667014, 356810, 642258, 356810,
356810, 624418, 713620, 570896, 713620, 588372, 392492, 642258,
713620, 356810, 392492, 677940, 356810,1070430, 713620, 642258,
713620, 677938, 530846, 506670, 499534, 713620, 677940, 927706,
677940, 677940, 570896, 642258,1284516, 642258, 642258, 642258
}
},
{ "cmbx9", 1946978618, 9437184, { // 16403104472 9.00
745321,1034000, 965067, 867332, 827200, 969276, 896133, 965067,
896133, 965067, 896133, 723801, 689333, 689333,1034000,1034000,
344667, 379134, 620400, 620400, 620400, 620400, 620400, 936265,
551467, 646782, 896133, 965067, 620400,1122999,1260866, 965067,
344667, 377678, 647588,1034000, 620400,1034000, 965067, 344667,
482533, 482533, 620400, 965067, 344667, 413600, 344667, 620400,
620400, 620400, 620400, 620400, 620400, 620400, 620400, 620400,
620400, 620400, 344667, 344667, 377678, 965067, 585934, 585934,
965067, 936265, 881733, 896133, 950667, 814254, 779788, 975100,
969276, 467973, 640466, 970732, 745321,1176076, 969276, 932055,
847266, 932055, 929794, 689333, 863122, 952772, 936265,1280932,
936265, 936265, 758267, 344667, 647588, 344667, 620400, 344667,
344667, 603166, 689333, 551467, 689333, 569349, 379134, 620400,
689333, 344667, 379134, 654868, 344667,1034000, 689333, 620400,
689333, 654866, 511826, 489428, 482533, 689333, 654868, 896133,
654868, 654868, 551467, 620400,1240800, 620400, 620400, 620400
}
},
{ "cmbxsl10", -1907513578, 10485760, { // 21623323426 10.0
725261,1004880, 937888, 844682, 803904, 943714, 870896, 937888,
870896, 937888, 870896, 703416, 669920, 669920,1004880,1004880,
334960, 368456, 602928, 602928, 602928, 602928, 602928, 969930,
535936, 626230, 870896, 937888, 602928,1092261,1226245, 937888,
334960, 367000, 632056,1004880, 602928,1004880, 937888, 334960,
468944, 468944, 602928, 937888, 334960, 401952, 334960, 602928,
602928, 602928, 602928, 602928, 602928, 602928, 602928, 602928,
602928, 602928, 334960, 334960, 367000, 937888, 569432, 569432,
937888, 911674, 857789, 870896, 924781, 792253, 758757, 948083,
943714, 457294, 623317, 945170, 725261,1144690, 943714, 905848,
824293, 905848, 904392, 669920, 838856, 927694, 911674,1246634,
911674, 911674, 736912, 334960, 632056, 334960, 602928, 334960,
334960, 586179, 669920, 535936, 669920, 552685, 368456, 602928,
669920, 334960, 368456, 636424, 334960,1004880, 669920, 602928,
669920, 636424, 496616, 475643, 468944, 669920, 636424, 870896,
636424, 636424, 535936, 602928,1205856, 602928, 602928, 602928
}
},
{ "cmbxti10", 1175274390, 10485760, { // 10603241626 10.0
731666, 990312, 928563, 845843, 805066, 939632, 866814, 928563,
866814, 928563, 866814, 792256, 707205, 738078,1095466,1110902,
372824, 403699, 619819, 619819, 619819, 619819, 619819, 994973,
558070, 697302, 866814, 866814, 619819,1072450,1195947, 928563,
311075, 404864, 650696, 990312, 910723, 990312, 928563, 372824,
496322, 496322, 619819, 928563, 372824, 434573, 372824, 619819,
619819, 619819, 619819, 619819, 619819, 619819, 619819, 619819,
619819, 619819, 372824, 372824, 404864, 928563, 619819, 619819,
928563, 907592, 856330, 866814, 918078, 793414, 762541, 938758,
939632, 494576, 640208, 938467, 731666,1124878, 939632, 896523,
825454, 896523, 901186, 681568, 834774, 923613, 907592,1216336,
907592, 907592, 743317, 373408, 650696, 373408, 619819, 372824,
372824, 619819, 558070, 558070, 619819, 558070, 419432, 558070,
619819, 372824, 372824, 558070, 311075, 990312, 681568, 619819,
619819, 558070, 526034, 510595, 403699, 650694, 558070, 805066,
587782, 588946, 514382, 619819,1239638, 619819, 619819, 619819
}
},
{ "cmcsc10", -1943144428, 10485760, { // 21413374024 10.0
716520, 946622, 885456, 792250, 763123, 853416, 824290, 885456,
824290, 885456, 824290, 579624, 579624, 334958, 334958, 549042,
316902, 445061, 579624, 579624, 579624, 579624, 579624, 853416,
518458, 960026, 771283, 864490, 666426,1022352,1144685, 885456,
334958, 334958, 579624, 946622, 579624, 946622, 885456, 334958,
457291, 457291, 579624, 885456, 334958, 396125, 334958, 579624,
579624, 579624, 579624, 579624, 579624, 579624, 579624, 579624,
579624, 579624, 334958, 334958, 885456, 885456, 885456, 549042,
885456, 853416, 808270, 824290, 869437, 777686, 747104, 892738,
853416, 425251, 594187, 884000, 716520,1036915, 853416, 885456,
777686, 885456, 838853, 640790, 824290, 853416, 853416,1159248,
853416, 853416, 701957, 334958, 579624, 334958, 579624, 334958,
334958, 643125, 608173, 619822, 654776, 584870, 561570, 672251,
643125, 316902, 445061, 666427, 538267, 782934, 643125, 666426,
584870, 666426, 631474, 480013, 619822, 643125, 643125, 876141,
643125, 643125, 526616, 579624,1159248, 579624, 579624, 579624
}
},
{ "cmcsc8", -1587116571, 8388608, { // 24131502745 8.00
754028,1001244, 935708, 834492, 804636, 900028, 870172, 935708,
870172, 935708, 870172, 608028, 608028, 345884, 345884, 575260,
332780, 464946, 608028, 608028, 608028, 608028, 608028, 900028,
542492,1004896, 796270, 890934, 691776,1081708,1212780, 935708,
345884, 345884, 608028,1001244, 608028,1001244, 935708, 345884,
476956, 476956, 608028, 935708, 345884, 411420, 345884, 608028,
608028, 608028, 608028, 608028, 608028, 608028, 608028, 608028,
608028, 608028, 345884, 345884, 935708, 935708, 935708, 575260,
935708, 900028, 852332, 870172, 917868, 819564, 786796, 943172,
900028, 441276, 622956, 932796, 754028,1096636, 900028, 935708,
819564, 935708, 885100, 673564, 870172, 900028, 900028,1227708,
900028, 900028, 739100, 345884, 608028, 345884, 608028, 345884,
345884, 664104, 630608, 644444, 677940, 606942, 583276, 696692,
664104, 332780, 464946, 687770, 559610, 806100, 664104, 691776,
606942, 691776, 654274, 502448, 644444, 664104, 664104, 900764,
664104, 664104, 549780, 608028,1216056, 608028, 608028, 608028
}
},
{ "cmcsc9", -804709715, 9437184, { // 32002215255 9.00
713931, 945003, 883513, 790308, 760533, 851797, 822023, 883513,
822023, 883513, 822023, 576064, 576064, 330105, 330105, 545319,
326222, 455996, 576064, 576064, 576064, 576064, 576064, 851797,
514574, 983836, 784480, 878332, 679623,1021380,1144359, 883513,
330105, 330105, 576064, 945003, 576064, 945003, 883513, 330105,
453084, 453084, 576064, 883513, 330105, 391595, 330105, 576064,
576064, 576064, 576064, 576064, 576064, 576064, 576064, 576064,
576064, 576064, 330105, 330105, 883513, 883513, 883513, 545319,
883513, 851797, 806165, 822023, 867655, 775420, 744676, 890956,
851797, 421369, 590951, 882542, 713931,1036267, 851797, 883513,
775420, 883513, 836910, 637554, 822023, 851797, 851797,1159246,
851797, 851797, 699044, 330105, 576064, 330105, 576064, 330105,
330105, 654706, 620238, 632697, 667164, 596775, 573312, 685125,
654706, 326222, 455996, 678169, 549849, 795484, 654706, 679623,
596775, 679623, 643701, 491918, 632697, 654706, 654706, 889337,
654706, 654706, 538844, 576064,1152128, 576064, 576064, 576064
}
},
{ "cmdunh10", 1274110073, 10485760, { // 11374260171 10.0
655362, 873816, 815562, 728179, 699053, 786434, 757307, 815562,
757307, 815562, 757307, 611672, 582544, 582544, 873816, 873816,
291272, 320400, 524290, 524290, 524290, 524290, 524290, 786434,
466035, 524291, 757307, 815562, 524290, 946634,1063142, 815562,
291272, 291272, 524290, 873816, 524290, 873816, 815562, 291272,
407781, 407781, 524290, 815562, 291272, 349526, 291272, 524290,
524290, 524290, 524290, 524290, 524290, 524290, 524290, 524290,
524290, 524290, 291272, 291272, 291272, 815562, 495163, 495163,
815562, 786434, 742744, 757307, 800998, 713616, 684490, 822843,
786434, 378653, 538853, 815562, 655362, 961197, 786434, 815562,
713616, 815562, 771870, 582544, 757307, 786434, 786434,1077706,
786434, 786434, 640798, 291272, 524290, 291272, 524290, 291272,
291272, 524290, 582544, 466035, 582544, 466035, 320400, 524290,
582544, 291272, 320400, 553418, 291272, 873816, 582544, 524290,
582544, 553416, 410694, 413606, 407781, 582544, 553418, 757307,
553418, 553418, 466035, 524290,1048579, 524290, 524290, 524290
}
},
{ "cmex10", -89033454, 10485760, { // 37254272422 10.0
480600, 480600, 436909, 436909, 495163, 495163, 495163, 495163,
611672, 611672, 495163, 495163, 349526, 582544, 605845, 605845,
626235, 626235, 771872, 771872, 553418, 553418, 611672, 611672,
611672, 611672, 786434, 786434, 786434, 786434,1095182,1095182,
830126, 830126, 611672, 611672, 669926, 669926, 669926, 669926,
844691, 844691, 844691, 844691,1339851,1339851, 850515, 850515,
917507, 917507, 699053, 699053, 699053, 699053, 699053, 699053,
932070, 932070, 932070, 932070, 932070, 932070, 932070, 699053,
917507, 917507, 917507, 917507, 640798, 640798, 873816,1165088,
495162, 582544,1165088,1584520,1165088,1584520,1165088,1584520,
1106834, 990325, 495162, 873816, 873816, 873816, 873816, 873816,
1514614,1339851, 582544,1165088,1165088,1165088,1165088,1165088,
990325,1339851, 582544,1048579,1514614, 582544,1048579,1514614,
495163, 495163, 553418, 553418, 553418, 553418, 699053, 699053,
1048579,1048579,1048579,1048579,1106834,1106834,1106834, 815562,
699053, 699053, 471864, 471864, 471864, 471864, 815562, 815562
}
},
{ "cmex7", 388214957, 7340032, { // 2710730255 7.00
565383, 565383, 517010, 517010, 581506, 581506, 581506, 581506,
710498, 710498, 581506, 581506, 420265, 678249, 670759, 670759,
726622, 726622, 887863, 887863, 646002, 646002, 710498, 710498,
710498, 710498, 903984, 903984, 903984, 903984,1212526,1212526,
952359, 952359, 710498, 710498, 774994, 774994, 774994, 774994,
968485, 968485, 968485, 968485,1483408,1483408, 941641, 941641,
1049102,1049102, 807241, 807241, 807241, 807241, 807241, 807241,
1065225,1065225,1065225,1065225,1065225,1065225,1065225, 807241,
1049102,1049102,1049102,1049102, 742745, 742745,1000729,1323209,
581504, 678249,1323209,1787579,1323209,1787579,1323209,1787579,
1258713,1129721, 581504,1000729,1000729,1000729,1000729,1000729,
1710185,1516697, 678249,1323209,1323209,1323209,1323209,1323209,
1129721,1516697, 678249,1194217,1710185, 678249,1194217,1710185,
581506, 581506, 646002, 646002, 646002, 646002, 807241, 807241,
1177573,1177573,1177573,1177573,1242069,1242069,1242069, 936233,
807241, 807241, 505154, 505154, 505154, 505154, 936233, 936233
}
},
{ "cmex8", 16867638, 8388608, { // 100260466 8.00
510642, 510642, 464220, 464220, 526116, 526116, 526116, 526116,
649908, 649908, 526116, 526116, 371376, 618960, 643718, 643718,
665382, 665382, 820122, 820122, 588012, 588012, 649908, 649908,
649908, 649908, 835596, 835596, 835596, 835596,1163644,1163644,
882018, 882018, 649908, 649908, 711804, 711804, 711804, 711804,
897492, 897492, 897492, 897492,1423608,1423608, 903682, 903682,
974862, 974862, 742752, 742752, 742752, 742752, 742752, 742752,
990336, 990336, 990336, 990336, 990336, 990336, 990336, 742752,
974862, 974862, 974862, 974862, 680856, 680856, 928440,1237920,
526116, 618960,1237920,1683572,1237920,1683572,1237920,1683572,
1176024,1052232, 526116, 928440, 928440, 928440, 928440, 928440,
1609296,1423608, 618960,1237920,1237920,1237920,1237920,1237920,
1052232,1423608, 618960,1114128,1609296, 618960,1114128,1609296,
526116, 526116, 588012, 588012, 588012, 588012, 742752, 742752,
1114128,1114128,1114128,1114128,1176024,1176024,1176024, 866544,
742752, 742752, 471864, 471864, 471864, 471864, 866544, 866544
}
},
{ "cmex9", 2059457385, 9437184, { // 17260151551 9.00
493943, 493943, 449040, 449040, 508912, 508912, 508912, 508912,
628658, 628658, 508914, 508914, 359232, 598720, 622668, 622668,
643623, 643623, 793303, 793303, 568784, 568784, 628656, 628656,
628656, 628656, 808274, 808274, 808274, 808274,1125595,1125595,
853175, 853175, 628656, 628656, 688528, 688528, 688528, 688528,
868144, 868144, 868144, 868144,1377056,1377056, 874132, 874132,
942983, 942983, 718464, 718464, 718464, 718464, 718464, 718464,
957952, 957952, 957952, 957952, 957952, 957952, 957952, 718464,
942983, 942983, 942983, 942983, 658592, 658592, 898080,1197440,
508912, 598720,1197440,1628517,1197440,1628517,1197440,1628517,
1137568,1017824, 508912, 898080, 898080, 898080, 898080, 898080,
1556672,1377056, 598720,1197440,1197440,1197440,1197440,1197440,
1017824,1377056, 598720,1077696,1556672, 598720,1077696,1556672,
508912, 508912, 568784, 568784, 568784, 568784, 718464, 718464,
1077696,1077696,1077696,1077696,1137568,1137568,1137568, 838208,
718464, 718464, 471865, 471865, 471865, 471865, 838208, 838208
}
},
{ "cmff10", -1927996437, 10485760, { // 21505215753 10.0
559238, 710699, 664096, 547587, 570890, 547587, 617493, 664096,
617493, 664096, 617493, 512637, 480597, 480597, 725264, 725264,
227192, 250494, 431080, 431080, 431080, 431080, 431080, 582539,
384477, 422344, 617493, 664096, 431080, 745651, 838858, 664096,
227192, 198064, 431080, 710699, 431080, 710699, 655358, 244667,
337874, 337874, 431080, 664096, 244667, 291270, 244667, 431080,
431080, 431080, 431080, 431080, 431080, 431080, 431080, 431080,
431080, 431080, 244667, 244667, 198064, 664096, 407779, 407779,
664096, 594190, 582541, 617493, 629144, 605842, 582541, 658270,
547587, 267968, 419429, 617493, 559238, 687397, 547587, 710699,
559238, 710699, 605842, 477683, 664096, 570888, 594190, 827206,
594190, 594190, 524286, 247581, 431080, 247581, 431080, 244667,
244667, 422342, 460208, 384477, 460208, 384477, 267970, 431080,
460208, 227192, 250494, 436907, 227192, 693224, 460208, 431080,
460208, 436906, 329136, 342534, 337874, 460208, 436907, 600018,
436907, 436907, 380107, 431080, 862160, 431080, 431080, 431080
}
},
{ "cmfi10", 319521934, 10485760, { // 2302702216 10.0
719434, 929147, 867981, 722346, 745648, 736909, 806814, 867981,
806814, 867981, 806814, 634968, 573802, 604384, 906576, 921867,
317483, 348067, 562149, 562149, 562149, 562149, 562149, 795163,
500982, 592734, 806814, 806814, 562149, 978662,1100995, 867981,
256317, 270880, 562149, 929147, 763126, 929147, 867981, 317483,
439816, 439816, 562149, 867981, 317483, 378650, 317483, 562149,
562149, 562149, 562149, 562149, 562149, 562149, 562149, 562149,
562149, 562149, 317483, 317483, 270880, 867981, 562149, 562149,
867981, 783512, 764581, 806814, 825747, 780600, 750018, 862155,
736909, 355347, 550498, 814096, 719434, 920408, 736909, 914584,
733997, 914584, 795163, 623315, 853418, 760210, 783512,1089344,
783512, 783512, 684482, 317483, 562149, 317483, 562149, 317483,
317483, 562149, 500982, 500982, 562149, 500982, 317485, 500982,
562149, 317483, 317483, 500982, 256317, 929147, 623315, 562149,
562149, 500982, 455109, 439816, 348067, 592733, 500982, 745648,
500984, 531566, 439818, 562149,1124298, 562149, 562149, 562149
}
},
{ "cmfib8", -844143043, 8388608, { // 31553663075 8.00
841038,1146870,1070412, 917496, 917496, 993954, 993954,1070412,
993954,1070412, 993954, 802810, 757298, 757298,1139588,1139588,
367726, 405956, 688122, 688122, 688122, 688122, 688122, 993954,
611664, 680842, 993954,1070412, 688122,1223328,1376244,1070412,
367726, 382290, 688122,1146870, 688122,1146870,1063130, 382290,
535206, 535206, 688122,1070412, 382290, 458748, 382290, 688122,
688122, 688122, 688122, 688122, 688122, 688122, 688122, 688122,
688122, 688122, 382290, 382290, 382290,1070412, 649894, 649894,
1070412, 993954, 955726, 993954,1032184, 917496, 879268,1070412,
993954, 458748, 688122,1032184, 841038,1223328, 993954,1070412,
917496,1070412, 993954, 764580, 993954, 993954, 993954,1376244,
993954, 993954, 841038, 382292, 688122, 382292, 688122, 382290,
382290, 661726, 750016, 611664, 750016, 625318, 420520, 688122,
750016, 367726, 405956, 711788, 367726,1132306, 750016, 688122,
750016, 711786, 537028, 542852, 535206, 750016, 711788, 979390,
711788, 711788, 608022, 688122,1376244, 688122, 688122, 688122
}
},
{ "cminch", -566337077, 109124000, { // 33617460713 104.
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
576717, 576717, 576717, 576717, 576717, 576717, 576717, 576717,
576717, 576717, 0, 0, 0, 0, 0, 0,
0, 768955, 768956, 736916, 833035, 672836, 640796, 768956,
833035, 346613, 544677, 800995, 608756,1025274, 833035, 833035,
736916, 833035, 736916, 640796, 768956, 800995, 768955,1089354,
768955, 768955, 704876, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
}
},
{ "cmitt10", -538297224, 10485760, { // 33772436170 10.0
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498
}
},
{ "cmmi10", -1725937524, 10485760, { // 23110044214 10.0
645166, 873816, 799829, 728179, 778424, 871630, 817746, 611669,
699051, 641962, 809918, 670776, 593102, 542880, 466034, 425621,
458754, 520651, 492248, 371130, 604147, 611672, 631819, 517979,
458754, 597717, 542130, 599171, 458390, 566525, 624778, 656086,
683034, 652691, 488970, 620170, 868357, 542130, 380474, 685944,
1048579,1048579,1048579,1048579, 291272, 291272, 524290, 524290,
524290, 524290, 524290, 524290, 524290, 524290, 524290, 524290,
524290, 524290, 291272, 291272, 815562, 524290, 815562, 524290,
556693, 786434, 795355, 749440, 868134, 774054, 674294, 824442,
871630, 460938, 581450, 890563, 713616,1017266, 842502, 799829,
673200, 828957, 796173, 642982, 612763, 715944, 611670, 990323,
868718, 608758, 715800, 407781, 407781, 407781,1048579,1048579,
436910, 554267, 450014, 453778, 545771, 488245, 513368, 500138,
604147, 361248, 431811, 545893, 312874, 920664, 629392, 508269,
527566, 468099, 473075, 491520, 378654, 600266, 508270, 750694,
599291, 514098, 487640, 338120, 402685, 667376, 524290, 291272
}
},
{ "cmmi12", -871742625, 12582912, { // 31402441537 12.0
636120, 855600, 784652, 712637, 764064, 850688, 802991, 598920,
684480, 627085, 794435, 653047, 579624, 532560, 454741, 414572,
448432, 506564, 478468, 362872, 591032, 598920, 617732, 507293,
448432, 582416, 529563, 583568, 445883, 553409, 607657, 643219,
667489, 639333, 480472, 605109, 848199, 529563, 371365, 672585,
1026720,1026720,1026720,1026720, 285200, 285200, 513360, 513360,
513360, 513360, 513360, 513360, 513360, 513360, 513360, 513360,
513360, 513360, 285200, 285200, 798560, 513360, 798560, 513360,
542001, 769677, 779993, 734567, 852471, 760029, 664640, 809872,
850688, 452833, 567491, 873504, 698559, 993288, 822168, 784652,
661788, 813172, 781496, 631447, 601772, 697309, 598557, 969317,
852113, 595705, 702747, 399280, 399280, 399280,1026720,1026720,
430836, 538967, 436537, 441877, 533507, 475860, 506080, 491636,
591032, 350260, 424768, 533992, 305832, 898076, 612876, 493577,
515303, 455228, 462692, 483628, 370760, 584356, 496369, 733935,
583448, 500617, 476952, 327676, 396248, 653655, 513360, 285200
}
},
{ "cmmi5", 1799862295, 5242880, { // 15321734027 5.00
873094,1208794,1098397,1013638,1067158,1164371,1117040, 881107,
990336, 936886,1112125, 957686, 829040, 783187, 685949, 643350,
699059, 779891, 709978, 576480, 867757, 881107, 891059, 746634,
699059, 871520, 761318, 854768, 714717, 830134, 882560, 906592,
975773, 929411, 707430, 896886,1200419, 761318, 606214, 962662,
1427251,1427251,1427251,1427251, 480602, 480602, 771878, 771878,
771878, 771878, 771878, 771878, 771878, 771878, 771878, 771878,
771878, 771878, 480602, 480602,1135974, 771878,1135974, 771878,
785344,1086458,1087366,1044368,1163789,1055872, 909504,1115728,
1164371, 657187, 810470,1194230,1001987,1346419,1127962,1098397,
917878,1134806,1079994, 897856, 872733, 989750, 868000,1341325,
1166922, 864358, 988880, 626240, 626240, 626240,1427251,1427251,
626237, 812048, 664102, 680973, 775638, 709904, 717261, 734618,
867757, 559491, 616771, 794938, 503661,1287683, 923587, 736922,
775642, 690925, 703914, 702698, 591046, 887178, 757315,1057997,
830131, 766054, 722118, 559491, 580362, 932445, 771878, 480602
}
},
{ "cmmi6", -214548420, 6291456, { // 36315440074 6.00
778661,1077696, 979440, 900992, 951483,1048085, 997843, 771864,
873808, 819144, 991955, 843592, 731941, 683656, 593707, 548680,
599531, 675259, 618955, 489093, 760944, 771864, 786432, 651715,
599531, 762032, 670048, 751355, 610331, 723320, 778179, 804632,
859245, 817739, 615184, 787157,1071507, 670048, 511541, 850992,
1281584,1281584,1281584,1281584, 398069, 398069, 669920, 669920,
669920, 669920, 669920, 669920, 669920, 669920, 669920, 669920,
669920, 669920, 398069, 398069,1009733, 669920,1009733, 669920,
690677, 968955, 971565, 926624,1046773, 943472, 812643, 999200,
1048085, 574288, 714707,1075512, 887400,1217992,1014104, 979440,
817861,1013421, 966923, 793469, 766645, 878808, 765069,1206827,
1050027, 761669, 878421, 533995, 533995, 533995,1281584,1281584,
543707, 707667, 574291, 586304, 673685, 617616, 629872, 637269,
760944, 467248, 536424, 692981, 421131,1146875, 807061, 642253,
673685, 598437, 608027, 612883, 500013, 773080, 655357, 936613,
731816, 663851, 625019, 467248, 502443, 825387, 669920, 398069
}
},
{ "cmmi7", 675789302, 7340032, { // 5021734766 7.00
727454,1000729, 911138, 836370, 885520, 981070, 929367, 710494,
807239, 751710, 922789, 778757, 679239, 629225, 544471, 499273,
545095, 617189, 570578, 443326, 701310, 710498, 728359, 600578,
545095, 700496, 621504, 694149, 552430, 663687, 720274, 748466,
792679, 754640, 565952, 723365, 996103, 621504, 460574, 787893,
1194217,1194217,1194217,1194217, 355769, 355769, 613753, 613753,
613753, 613753, 613753, 613753, 613753, 613753, 613753, 613753,
613753, 613753, 355769, 355769, 936233, 613753, 936233, 613753,
639705, 900866, 905106, 859191, 979445, 879435, 759703, 932631,
981070, 530898, 662747,1006558, 821806,1142309, 948821, 911138,
762665, 943387, 902414, 735568, 707531, 816021, 707378,1126601,
982370, 704155, 816187, 484761, 484761, 484761,1194217,1194217,
501408, 649765, 526786, 535335, 623584, 568347, 584110, 584402,
701310, 423819, 495687, 636814, 378827,1062974, 740494, 591282,
617515, 549033, 556194, 565381, 452514, 708247, 599191, 866581,
679289, 607515, 572320, 418014, 463440, 765579, 613753, 355769
}
},
{ "cmmi8", -1852389792, 8388608, { // 22145543140 8.00
674118, 928440, 845352, 772608, 821486, 915240, 863448, 649908,
742752, 686572, 856348, 715566, 625148, 573836, 492984, 450384,
489708, 559066, 519742, 394434, 642018, 649908, 670234, 547658,
489708, 639774, 570534, 636680, 494440, 604396, 662288, 691776,
728188, 692750, 514464, 662772, 924980, 570534, 407786, 726004,
1114128,1114128,1114128,1114128, 309480, 309480, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 309480, 309480, 866544, 557064, 866544, 557064,
586918, 834504, 840328, 794052, 914020, 816480, 705066, 868144,
915240, 483062, 608582, 939544, 757680,1069980, 884292, 845352,
706340, 876300, 839098, 677578, 648634, 753728, 648816,1051140,
916334, 645722, 754948, 433272, 433272, 433272,1114128,1114128,
455116, 591774, 476600, 482546, 573264, 516832, 535216, 530182,
642018, 379316, 450564, 580122, 332538, 985480, 676000, 538496,
560826, 497414, 502752, 515192, 402324, 645052, 542500, 799490,
627150, 550692, 518226, 366520, 419616, 706160, 557064, 309480
}
},
{ "cmmi9", 227285477, 9437184, { // 1543014745 9.00
658188, 898080, 820052, 748238, 797552, 891447, 838048, 628656,
718464, 661776, 830542, 690672, 607339, 556631, 478005, 436620,
472503, 538121, 504464, 381483, 620971, 628656, 649289, 531566,
472503, 616802, 555154, 616236, 474404, 583348, 641440, 671943,
703092, 670485, 500295, 639095, 893913, 555154, 392606, 703739,
1077696,1077696,1077696,1077696, 299360, 299360, 538848, 538848,
538848, 538848, 538848, 538848, 538848, 538848, 538848, 538848,
538848, 538848, 299360, 299360, 838208, 538848, 838208, 538848,
570119, 808110, 815493, 769259, 888679, 793063, 688124, 843856,
891447, 471088, 593787, 912645, 733351,1041127, 861511, 820052,
688084, 849988, 815403, 658350, 628697, 733012, 628496,1017664,
890192, 625500, 733191, 419104, 419104, 419104,1077696,1077696,
444996, 570928, 461824, 466556, 558388, 501024, 523072, 513886,
620971, 368772, 440546, 561099, 321611, 949458, 650098, 521696,
540994, 481524, 486260, 502037, 389168, 620162, 523476, 772370,
610859, 530757, 501227, 350738, 410610, 685010, 538848, 299360
}
},
{ "cmmib10", 987124668, 10485760, { // 7265451674 10.0
688853,1004880, 909344, 844682, 882110,1030003, 928059, 703416,
803904, 748706, 921597, 797594, 691766, 618691, 547586, 506810,
533024, 629144, 589093, 432051, 700019, 703416, 742254, 604870,
533024, 715554, 641523, 719194, 546131, 661182, 747106, 752934,
795166, 752688, 554506, 725141,1022358, 641523, 444186, 783514,
1205856,1205856,1205856,1205856, 334960, 334960, 602928, 602928,
602928, 602928, 602928, 602928, 602928, 602928, 602928, 602928,
602928, 602928, 334960, 334960, 937888, 602928, 937888, 602928,
658997, 911674, 908490, 856624, 983691, 849416, 722349, 929806,
1030003, 535938, 661912,1018352, 792253,1197483, 996507, 877304,
758213, 910800, 914725, 726355, 667552, 839149, 710699,1146147,
993230, 707347, 810094, 468944, 468944, 468944,1205856,1205856,
496618, 663610, 546130, 538363, 639338, 580501, 595651, 571373,
700019, 424459, 493704, 633027, 365059,1082554, 747594, 613122,
630114, 568461, 554386, 557056, 435448, 714098, 594190, 871869,
691040, 618949, 582056, 412634, 460208, 776234, 602928, 334960
}
},
{ "cmmib6", -1525994067, 6291456, { // 24502626655 6.00
810219,1218477,1093808,1019445,1058717,1215445,1112531, 864581,
982547, 930264,1108979, 978672, 832067, 756557, 669437, 627203,
670891, 786917, 709488, 547592, 862163, 864587, 900029, 732544,
670891, 884976, 761917, 868715, 702445, 823325, 899541, 910221,
980611, 922109, 676109, 899667,1238384, 761917, 570400, 950512,
1454405,1454405,1454405,1454405, 432051, 432051, 746621, 746621,
746621, 746621, 746621, 746621, 746621, 746621, 746621, 746621,
746621, 746621, 432051, 432051,1139835, 746621,1139835, 746621,
788131,1098088,1088107,1038179,1166219,1014472, 849541,1108448,
1215445, 627691, 790677,1207680, 963133,1412051,1176123,1055944,
899963,1095267,1085952, 875875, 814160,1006141, 862160,1373336,
1178189, 858229, 974176, 589336, 589336, 589336,1454405,1454405,
590797, 821387, 663613, 666040, 782064, 708080, 697597, 703416,
862163, 546624, 586427, 783520, 468947,1333051, 939837, 742256,
782064, 691768, 688373, 669680, 568709, 900517, 744683,1068963,
826968, 770899, 717987, 546624, 547107, 933035, 746621, 432051
}
},
{ "cmmib7", 1940741258, 7340032, { // 16353256212 7.00
758553,1133879,1019616, 948713, 987328,1139653,1038331, 798709,
910432, 857106,1033742, 906203, 774162, 699003, 618121, 574224,
613335, 723810, 659211, 498007, 795936, 798709, 836923, 680190,
613335, 817712, 712683, 809079, 638302, 757099, 837824, 845733,
906064, 853287, 624363, 829017,1154478, 712683, 517008, 882553,
1357326,1357326,1357326,1357326, 389056, 389056, 686985, 686985,
686985, 686985, 686985, 686985, 686985, 686985, 686985, 686985,
686985, 686985, 389056, 389056,1059397, 686985,1059397, 686985,
734734,1023195,1015641, 965024,1092715, 947205, 795794,1036334,
1139653, 587431, 735513,1131746, 893787,1325858,1102411, 983831,
841022,1021072,1016206, 814158, 753481, 936937, 799751,1283886,
1103815, 796025, 907259, 538021, 538021, 538021,1357326,1357326,
551961, 757239, 614377, 612642, 719998, 655031, 662231, 648981,
795936, 490448, 546553, 721454, 423525,1235271, 862859, 688859,
719998, 641493, 635321, 624261, 511842, 825618, 682617, 990256,
773225, 709872, 664240, 490448, 509312, 870279, 686985, 389056
}
},
{ "cmmib8", -1661369540, 8388608, { // 23476301474 8.00
719808,1070430, 963966, 895664, 933786,1082442, 982684, 749298,
856342, 802240, 977314, 851854, 730732, 655834, 579632, 537034,
570168, 674666, 621502, 460820, 746268, 749302, 787774, 639102,
570168, 765444, 673932, 762528, 590194, 707432, 791534, 797358,
850156, 801668, 585548, 776036,1089728, 673932, 476960, 831584,
1284516,1284516,1284516,1284516, 356810, 356810, 642258, 642258,
642258, 642258, 642258, 642258, 642258, 642258, 642258, 642258,
642258, 642258, 356810, 356810, 999068, 642258, 999068, 642258,
694684, 967026, 961294, 910156,1037586, 896758, 755490, 982244,
1082442, 558696, 693774,1074798, 841780,1260846,1046760, 929742,
796812, 965424, 965434, 767870, 707976, 884668, 752940,1216792,
1048036, 749372, 857072, 499534, 499534, 499534,1284516,1284516,
519194, 709130, 577448, 572594, 673448, 614876, 632056, 606332,
746268, 450988, 514824, 674906, 389456,1161942, 805132, 648810,
673450, 601964, 595532, 590188, 469196, 769452, 636070, 931228,
732914, 662286, 620292, 448322, 479144, 821390, 642258, 356810
}
},
{ "cmmib9", -1141540475, 9437184, { // 27375274605 9.00
702601,1034000, 933607, 867332, 905067,1054110, 952324, 723797,
827198, 772487, 946348, 822510, 709888, 635191, 562633, 521049,
549524, 649367, 605113, 444832, 720565, 723801, 762476, 620078,
549524, 737719, 656731, 739257, 565707, 681730, 768464, 772670,
819596, 774448, 568295, 747751,1052288, 656731, 458745, 804869,
1240800,1240800,1240800,1240800, 344667, 344667, 620400, 620400,
620400, 620400, 620400, 620400, 620400, 620400, 620400, 620400,
620400, 620400, 344667, 344667, 965067, 620400, 965067, 620400,
676473, 936265, 931948, 880404,1007634, 870444, 737068, 953099,
1054110, 546050, 676672,1043429, 814254,1226443,1019643, 900596,
775360, 935063, 938871, 744796, 685506, 860180, 729465,1177531,
1017579, 726020, 830964, 482533, 482533, 482533,1240800,1240800,
506647, 684644, 561664, 554380, 654060, 596583, 615067, 586094,
720565, 437228, 503086, 651632, 375897,1117822, 773156, 630597,
650176, 584156, 574286, 573396, 448958, 738690, 612796, 898238,
711264, 638203, 599044, 428489, 468620, 796293, 620400, 344667
}
},
{ "cmr10", 1274110073, 10485760, { // 11374260171 10.0
655362, 873816, 815562, 728179, 699053, 786434, 757307, 815562,
757307, 815562, 757307, 611672, 582544, 582544, 873816, 873816,
291272, 320400, 524290, 524290, 524290, 524290, 524290, 786434,
466035, 524291, 757307, 815562, 524290, 946634,1063142, 815562,
291272, 291272, 524290, 873816, 524290, 873816, 815562, 291272,
407781, 407781, 524290, 815562, 291272, 349526, 291272, 524290,
524290, 524290, 524290, 524290, 524290, 524290, 524290, 524290,
524290, 524290, 291272, 291272, 291272, 815562, 495163, 495163,
815562, 786434, 742744, 757307, 800998, 713616, 684490, 822843,
786434, 378653, 538853, 815562, 655362, 961197, 786434, 815562,
713616, 815562, 771870, 582544, 757307, 786434, 786434,1077706,
786434, 786434, 640798, 291272, 524290, 291272, 524290, 291272,
291272, 524290, 582544, 466035, 582544, 466035, 320400, 524290,
582544, 291272, 320400, 553418, 291272, 873816, 582544, 524290,
582544, 553416, 410694, 413606, 407781, 582544, 553418, 757307,
553418, 553418, 466035, 524290,1048579, 524290, 524290, 524290
}
},
{ "cmr12", 1487622411, 12582912, { // 13052650413 12.0
641519, 855600, 798560, 712637, 684480, 769677, 741520, 798560,
741520, 798560, 741520, 598920, 570400, 570400, 855600, 855600,
285200, 313720, 513360, 513360, 513360, 513360, 513360, 769677,
456320, 513360, 741520, 798560, 513360, 926719,1040799, 798560,
285200, 285200, 513360, 855600, 513360, 855600, 798560, 285200,
399280, 399280, 513360, 798560, 285200, 342240, 285200, 513360,
513360, 513360, 513360, 513360, 513360, 513360, 513360, 513360,
513360, 513360, 285200, 285200, 285200, 798560, 484840, 484840,
798560, 769677, 727079, 741520, 784119, 698559, 670039, 805600,
769677, 370397, 527439, 798197, 641519, 940797, 769677, 798560,
698559, 798560, 755599, 570400, 741520, 769677, 769677,1054877,
769677, 769677, 627440, 285200, 513360, 285200, 513360, 285200,
285200, 513360, 570400, 456320, 570400, 456320, 313720, 513360,
570400, 285200, 313720, 541880, 285200, 855600, 570400, 513360,
570400, 541880, 399280, 404984, 399280, 570400, 541880, 741520,
541880, 541880, 456320, 513360,1026720, 513360, 513360, 513360
}
},
{ "cmr17", 1154739572, 18119392, { // 10464766564 17.3
603944, 809585, 754804, 672211, 645241, 726993, 700022, 754804,
700022, 754804, 700022, 550932, 523541, 523541, 785311, 785311,
261770, 289161, 480896, 480896, 480896, 480896, 480896, 726993,
426115, 480896, 700022, 754804, 480896, 877852, 987415, 754804,
261770, 261770, 480896, 809585, 480896, 809585, 754804, 261770,
371333, 371333, 480896, 754804, 261770, 316552, 261770, 480896,
480896, 480896, 480896, 480896, 480896, 480896, 480896, 480896,
480896, 480896, 261770, 261770, 261770, 754804, 453506, 453506,
754804, 726993, 686117, 700022, 740898, 658726, 631335, 761546,
726993, 343522, 494382, 754383, 603944, 891337, 726993, 754804,
658726, 754804, 713507, 535678, 700022, 726993, 726993,1000900,
726993, 726993, 590459, 261770, 480896, 261770, 480896, 261770,
261770, 480896, 535678, 426115, 535678, 426115, 289161, 480896,
535678, 261770, 289161, 508287, 261770, 809585, 535678, 480896,
535678, 508287, 371333, 376812, 371333, 535678, 508287, 700022,
508287, 508287, 426115, 480896, 961793, 480896, 480896, 480896
}
},
{ "cmr5", -2046583974, 5242880, { // 20600715532 5.00
870915,1150541,1077722, 955386, 932083,1028205,1004902,1077722,
1004902,1077722,1004902, 713626, 713626, 422349, 422349, 677216,
422349, 458758, 713626, 713626, 713626, 713626, 713626,1028205,
640806, 713626,1004902,1077722, 713626,1235011,1380650,1077722,
422349, 422349, 713626,1150541, 713626,1150541,1077722, 422349,
567987, 567987, 713626,1077722, 422349, 495168, 422349, 713626,
713626, 713626, 713626, 713626, 713626, 713626, 713626, 713626,
713626, 713626, 422349, 422349,1077722,1077722,1077722, 677216,
1077722,1028205, 980144,1004902,1052963, 943734, 907325,1083549,
1028205, 518470, 725277,1064614, 870915,1246662,1028205,1077722,
943734,1077722,1016554, 786445,1004902,1028205,1028205,1392301,
1028205,1028205, 859264, 422349, 713626, 422349, 713626, 422349,
422349, 713626, 786445, 640806, 786445, 640806, 458758, 713626,
786445, 422349, 458758, 750035, 422349,1150541, 786445, 713626,
786445, 750035, 567987, 575270, 567987, 786445, 750035,1004902,
750035, 750035, 640806, 713626,1427251, 713626, 713626, 713626
}
},
{ "cmr6", -1186897496, 6291456, { // 27120260650 6.00
790307,1048565, 980603, 871861, 844677, 939824, 912640, 980603,
912640, 980603, 912640, 771859, 737877, 737877,1106816,1106816,
368939, 402920, 640789, 640789, 640789, 640789, 640789, 939824,
572827, 640789, 912640, 980603, 640789,1130120,1266045, 980603,
368939, 368939, 640789,1048565, 640789,1048565, 980603, 368939,
504864, 504864, 640789, 980603, 368939, 436901, 368939, 640789,
640789, 640789, 640789, 640789, 640789, 640789, 640789, 640789,
640789, 640789, 368939, 368939, 368939, 980603, 606808, 606808,
980603, 939824, 892251, 912640, 960213, 858269, 824288, 987400,
939824, 464085, 654381, 973805, 790307,1143712, 939824, 980603,
858269, 980603, 926232, 708752, 912640, 939824, 939824,1279637,
939824, 939824, 776715, 368939, 640789, 368939, 640789, 368939,
368939, 640789, 708752, 572827, 708752, 572829, 402920, 640789,
708752, 368939, 402920, 674771, 368939,1048565, 708752, 640789,
708752, 674771, 504864, 511661, 504864, 708752, 674771, 912640,
674771, 674771, 572827, 640789,1281579, 640789, 640789, 640789
}
},
{ "cmr7", -644636590, 7340032, { // 33144720122 7.00
740665, 984085, 919589, 819726, 790597, 884222, 855093, 919589,
855093, 919589, 855093, 710498, 678249, 678249,1017374,1017374,
339125, 371374, 597109, 597109, 597109, 597109, 597109, 884222,
532613, 597111, 855093, 919589, 597109,1063145,1192137, 919589,
339125, 339125, 597109, 984085, 597109, 984085, 919589, 339125,
468117, 468117, 597109, 919589, 339125, 403621, 339125, 597109,
597109, 597109, 597109, 597109, 597109, 597109, 597109, 597109,
597109, 597109, 339125, 339125, 339125, 919589, 564862, 564862,
919589, 884222, 837410, 855093, 901906, 805161, 772914, 926871,
884222, 432750, 611673, 916471, 740665,1077710, 884222, 919589,
805161, 919589, 869657, 661605, 855093, 884222, 884222,1206702,
884222, 884222, 726101, 339125, 597109, 339125, 597109, 339125,
339125, 597109, 661605, 532613, 661605, 532613, 371374, 597109,
661605, 339125, 371374, 629358, 339125, 984085, 661605, 597109,
661605, 629355, 468117, 474567, 468117, 661605, 629358, 855093,
629358, 629358, 532613, 597109,1194217, 597109, 597109, 597109
}
},
{ "cmr8", 2088458503, 8388608, { // 17436654407 8.00
695784, 928440, 866544, 772608, 742752, 834504, 804648, 866544,
804648, 866544, 804648, 649908, 618960, 618960, 928440, 928440,
309480, 340428, 557064, 557064, 557064, 557064, 557064, 834504,
495168, 557064, 804648, 866544, 557064,1005264,1129056, 866544,
309480, 309480, 557064, 928440, 557064, 928440, 866544, 309480,
433272, 433272, 557064, 866544, 309480, 371376, 309480, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 309480, 309480, 309480, 866544, 526116, 526116,
866544, 834504, 788628, 804648, 850524, 757680, 726732, 874008,
834504, 401232, 571992, 865452, 695784,1020192, 834504, 866544,
757680, 866544, 819576, 618960, 804648, 834504, 834504,1143984,
834504, 834504, 680856, 309480, 557064, 309480, 557064, 309480,
309480, 557064, 618960, 495168, 618960, 495168, 340428, 557064,
618960, 309480, 340428, 588012, 309480, 928440, 618960, 557064,
618960, 588012, 434182, 439462, 433272, 618960, 588012, 804648,
588012, 588012, 495168, 557064,1114128, 557064, 557064, 557064
}
},
{ "cmr9", 1874103239, 9437184, { // 15755105707 9.00
673479, 898080, 838208, 748238, 718464, 808110, 778336, 838208,
778336, 838208, 778336, 628656, 598720, 598720, 898080, 898080,
299360, 329296, 538848, 538848, 538848, 538848, 538848, 808110,
478976, 538848, 778336, 838208, 538848, 972839,1092583, 838208,
299360, 299360, 538848, 898080, 538848, 898080, 838208, 299360,
419104, 419104, 538848, 838208, 299360, 359232, 299360, 538848,
538848, 538848, 538848, 538848, 538848, 538848, 538848, 538848,
538848, 538848, 299360, 299360, 299360, 838208, 508912, 508912,
838208, 808110, 763287, 778336, 823159, 733351, 703415, 845652,
808110, 389006, 553735, 838046, 673479, 987726, 808110, 838208,
733351, 838208, 793223, 598720, 778336, 808110, 808110,1107470,
808110, 808110, 658592, 299360, 538848, 299360, 538848, 299360,
299360, 538848, 598720, 478976, 598720, 479381, 329296, 538848,
598720, 299360, 329296, 568784, 299360, 898080, 598720, 538848,
598720, 568784, 421532, 425092, 419104, 598720, 568784, 778336,
568784, 568784, 478976, 538848,1077696, 538848, 538848, 538848
}
},
{ "cmsl10", 1890463818, 10485760, { // 16053430112 10.0
655362, 873816, 815562, 728179, 699053, 786434, 757307, 815562,
757307, 815562, 757307, 611672, 582544, 582544, 873816, 873816,
291272, 320400, 524290, 524290, 524290, 524290, 524290, 847926,
466035, 524291, 757307, 815562, 524290, 946634,1063142, 815562,
291272, 291272, 524290, 873816, 524290, 873816, 815562, 291272,
407781, 407781, 524290, 815562, 291272, 349526, 291272, 524290,
524290, 524290, 524290, 524290, 524290, 524290, 524290, 524290,
524290, 524290, 291272, 291272, 291272, 815562, 495163, 495163,
815562, 786434, 742744, 757307, 800998, 713616, 684490, 822843,
786434, 378653, 538853, 815562, 655362, 961197, 786434, 815562,
713616, 815562, 771870, 582544, 757307, 786434, 786434,1077706,
786434, 786434, 640798, 291272, 524290, 291272, 524290, 291272,
291272, 524290, 582544, 466035, 582544, 466035, 320400, 524290,
582544, 291272, 320400, 553418, 291272, 873816, 582544, 524290,
582544, 553416, 410694, 413606, 407781, 582544, 553418, 757307,
553418, 553418, 466035, 524290,1048579, 524290, 524290, 524290
}
},
{ "cmsl12", 2103976403, 12582912, { // 17532020723 12.0
641519, 855600, 798560, 712637, 684480, 769677, 741520, 798560,
741520, 798560, 741520, 598920, 570400, 570400, 855600, 855600,
285200, 313720, 513360, 513360, 513360, 513360, 513360, 831169,
456320, 513360, 741520, 798560, 513360, 926719,1040799, 798560,
285200, 285200, 513360, 855600, 513360, 855600, 798560, 285200,
399280, 399280, 513360, 798560, 285200, 342240, 285200, 513360,
513360, 513360, 513360, 513360, 513360, 513360, 513360, 513360,
513360, 513360, 285200, 285200, 285200, 798560, 484840, 484840,
798560, 769677, 727079, 741520, 784119, 698559, 670039, 805600,
769677, 370397, 527439, 798197, 641519, 940797, 769677, 798560,
698559, 798560, 755599, 570400, 741520, 769677, 769677,1054877,
769677, 769677, 627440, 285200, 513360, 285200, 513360, 285200,
285200, 513360, 570400, 456320, 570400, 456320, 313720, 513360,
570400, 285200, 313720, 541880, 285200, 855600, 570400, 513360,
570400, 541880, 399280, 404984, 399280, 570400, 541880, 741520,
541880, 541880, 456320, 513360,1026720, 513360, 513360, 513360
}
},
{ "cmsl8", -1590154801, 8388608, { // 24116024717 8.00
695784, 928440, 866544, 772608, 742752, 834504, 804648, 866544,
804648, 866544, 804648, 649908, 618960, 618960, 928440, 928440,
309480, 340428, 557064, 557064, 557064, 557064, 557064, 895996,
495168, 557064, 804648, 866544, 557064,1005264,1129056, 866544,
309480, 309480, 557064, 928440, 557064, 928440, 866544, 309480,
433272, 433272, 557064, 866544, 309480, 371376, 309480, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 309480, 309480, 309480, 866544, 526116, 526116,
866544, 834504, 788628, 804648, 850524, 757680, 726732, 874008,
834504, 401232, 571992, 865452, 695784,1020192, 834504, 866544,
757680, 866544, 819576, 618960, 804648, 834504, 834504,1143984,
834504, 834504, 680856, 309480, 557064, 309480, 557064, 309480,
309480, 557064, 618960, 495168, 618960, 495168, 340428, 557064,
618960, 309480, 340428, 588012, 309480, 928440, 618960, 557064,
618960, 588012, 434182, 439462, 433272, 618960, 588012, 804648,
588012, 588012, 495168, 557064,1114128, 557064, 557064, 557064
}
},
{ "cmsl9", -1804510312, 9437184, { // 22434255630 9.00
673479, 898080, 838208, 748238, 718464, 808110, 778336, 838208,
778336, 838208, 778336, 628656, 598720, 598720, 898080, 898080,
299360, 329296, 538848, 538848, 538848, 538848, 538848, 869602,
478976, 538848, 778336, 838208, 538848, 972839,1092583, 838208,
299360, 299360, 538848, 898080, 538848, 898080, 838208, 299360,
419104, 419104, 538848, 838208, 299360, 359232, 299360, 538848,
538848, 538848, 538848, 538848, 538848, 538848, 538848, 538848,
538848, 538848, 299360, 299360, 299360, 838208, 508912, 508912,
838208, 808110, 763287, 778336, 823159, 733351, 703415, 845652,
808110, 389006, 553735, 838046, 673479, 987726, 808110, 838208,
733351, 838208, 793223, 598720, 778336, 808110, 808110,1107470,
808110, 808110, 658592, 299360, 538848, 299360, 538848, 299360,
299360, 538848, 598720, 478976, 598720, 479381, 329296, 538848,
598720, 299360, 329296, 568784, 299360, 898080, 598720, 538848,
598720, 568784, 421532, 425092, 419104, 598720, 568784, 778336,
568784, 568784, 478976, 538848,1077696, 538848, 538848, 538848
}
},
{ "cmsltt10", -538297224, 10485760, { // 33772436170 10.0
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498
}
},
{ "cmss10", 1831058770, 10485760, { // 15510736522 10.0
567981, 873816, 815562, 640800, 699053, 742746, 757307, 815562,
757307, 815562, 757307, 611672, 562155, 562155, 853427, 853427,
250494, 279622, 524290, 524290, 524290, 524290, 524290, 699054,
466035, 503902, 757307, 815562, 524290, 902944,1019453, 815562,
250494, 334963, 524290, 873816, 524290, 873816, 795173, 291272,
407781, 407781, 524290, 815562, 291272, 349526, 291272, 524290,
524290, 524290, 524290, 524290, 524290, 524290, 524290, 524290,
524290, 524290, 291272, 291272, 334963, 815562, 495163, 495163,
699053, 699054, 699054, 669926, 757309, 626235, 597109, 699053,
742746, 291274, 495163, 728182, 567981, 917509, 742746, 771870,
669926, 771870, 677208, 582544, 713616, 720901, 699054, 990326,
699054, 699054, 640798, 302923, 524290, 302923, 524290, 291272,
291272, 503901, 541766, 466035, 541766, 466035, 320400, 524290,
541766, 250494, 279622, 512640, 250494, 833038, 541766, 524290,
541766, 541766, 358266, 401955, 378653, 541766, 483512, 716530,
483512, 483512, 455840, 524290,1048579, 524290, 524290, 524290
}
},
{ "cmss12", -2100407754, 12582912, { // 20263451066 12.0
554621, 855600, 798560, 621371, 684480, 719675, 741520, 798560,
741520, 798560, 741520, 598920, 548555, 548555, 833755, 833755,
241509, 270029, 513360, 513360, 513360, 513360, 513360, 678411,
456320, 491515, 741520, 798560, 513360, 881085, 995165, 798560,
241509, 326464, 513360, 855600, 513360, 855600, 776715, 285200,
399280, 399280, 513360, 798560, 285200, 342240, 285200, 513360,
513360, 513360, 513360, 513360, 513360, 513360, 513360, 513360,
513360, 513360, 285200, 285200, 326464, 798560, 484840, 484840,
684480, 678411, 681445, 655960, 738485, 611661, 583141, 684480,
719675, 279131, 481805, 706931, 554621, 890795, 719675, 757296,
652925, 757296, 660813, 570400, 700256, 699043, 678411, 963611,
678411, 678411, 627440, 296731, 513360, 296731, 513360, 285200,
285200, 491515, 526709, 456320, 526709, 456320, 313720, 513360,
526709, 241509, 270029, 498189, 241509, 811909, 526709, 513360,
526709, 526709, 348915, 393576, 370760, 526709, 469669, 697829,
469669, 469669, 445397, 513360,1026720, 513360, 513360, 513360
}
},
{ "cmss17", 97961503, 18119392, { // 565543037 17.3
533486, 821722, 766941, 600067, 657378, 695303, 712159, 766941,
712159, 766941, 712159, 575206, 527588, 527588, 801495, 801495,
233454, 260844, 493033, 493033, 493033, 493033, 493033, 654848,
438252, 472807, 712159, 766941, 493033, 847848, 957411, 766941,
233454, 314362, 493033, 821722, 493033, 821722, 746714, 273907,
383470, 383470, 493033, 766941, 273907, 328689, 273907, 493033,
493033, 493033, 493033, 493033, 493033, 493033, 493033, 493033,
493033, 493033, 273907, 273907, 314362, 766941, 465643, 465643,
657378, 654848, 656113, 629987, 710894, 588268, 560877, 657378,
695303, 271378, 464378, 682239, 533486, 859647, 695303, 726486,
628722, 726486, 635885, 547815, 671705, 675076, 654848, 928756,
654848, 654848, 602596, 286129, 493033, 286129, 493033, 273907,
273907, 472807, 507361, 438252, 507361, 438252, 301298, 493033,
507361, 233454, 260844, 479970, 233454, 781269, 507361, 493033,
507361, 507361, 335853, 377993, 356080, 507361, 452580, 671706,
452580, 452580, 428138, 493033, 986067, 493033, 493033, 493033
}
},
{ "cmss8", -965527919, 8388608, { // 30634633221 8.00
606218, 928440, 866544, 680856, 742752, 786442, 804648, 866544,
804648, 866544, 804648, 649908, 597114, 597114, 906594, 906594,
265788, 296736, 557064, 557064, 557064, 557064, 557064, 742752,
495168, 535218, 804648, 866544, 557064, 959388,1083180, 866544,
265788, 353170, 557064, 928440, 557064, 928440, 844698, 309480,
433272, 433272, 557064, 866544, 309480, 371376, 309480, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 309480, 309480, 353170, 866544, 526116, 526116,
742752, 742752, 742752, 711804, 804648, 668114, 637166, 742752,
786442, 309480, 526116, 773700, 606218, 972130, 786442, 822854,
711804, 822854, 720906, 618960, 760958, 764598, 742752,1052232,
742752, 742752, 680856, 324044, 557064, 324044, 557064, 309480,
309480, 535218, 575268, 495168, 575268, 495168, 340428, 557064,
575268, 265788, 296736, 544320, 265788, 884748, 575268, 557064,
575268, 575268, 380478, 427082, 402324, 575268, 513372, 760956,
513372, 513372, 484244, 557064,1114128, 557064, 557064, 557064
}
},
{ "cmss9", -764426377, 9437184, { // 32233743567 9.00
587392, 898080, 838208, 660210, 718464, 762155, 778336, 838208,
778336, 838208, 778336, 628656, 577684, 577684, 877044, 877044,
257287, 287223, 538848, 538848, 538848, 538848, 538848, 720082,
478976, 517812, 778336, 838208, 538848, 928825,1048569, 838208,
257287, 341433, 538848, 898080, 538848, 898080, 817172, 299360,
419104, 419104, 538848, 838208, 299360, 359232, 299360, 538848,
538848, 538848, 538848, 538848, 538848, 538848, 538848, 538848,
538848, 538848, 299360, 299360, 341433, 838208, 508912, 508912,
718464, 720082, 719273, 688528, 779145, 647264, 617328, 718464,
762155, 300978, 509721, 750018, 587392, 941771, 762155, 796135,
689337, 796135, 698236, 598720, 736263, 741118, 720082,1019442,
720082, 720082, 658592, 313115, 538848, 313115, 538848, 299360,
299360, 517812, 556647, 478976, 556647, 478978, 329296, 538848,
556647, 257287, 287223, 526711, 257287, 856007, 556647, 538848,
556647, 556647, 368132, 413118, 389168, 556647, 496775, 736263,
496775, 496775, 468457, 538848,1077696, 538848, 538848, 538848
}
},
{ "cmssbx10", -244629176, 10485760, { // 36132640510 10.0
608760, 961200, 897120, 704880, 768960, 833040, 833040, 897120,
833040, 897120, 833040, 672840, 614586, 614586, 934986, 934986,
267971, 300011, 576720, 576720, 576720, 576720, 576720, 768960,
512640, 592739, 833040, 897120, 576720, 993240,1121400, 897120,
267971, 384480, 585458, 961200, 576720,1079109, 870906, 320400,
448560, 448560, 576720, 897120, 320400, 384480, 320400, 576720,
576720, 576720, 576720, 576720, 576720, 576720, 576720, 576720,
576720, 576720, 320400, 320400, 384480, 897120, 544680, 544680,
768960, 768960, 768960, 736920, 833040, 672840, 640800, 768960,
833040, 346614, 544680, 801000, 608760,1025280, 833040, 833040,
736920, 833040, 736920, 640800, 768960, 801000, 768960,1089360,
768960, 768960, 704880, 359722, 585458, 359722, 576720, 320400,
320400, 550506, 588371, 512640, 588371, 535942, 352440, 576720,
588371, 267971, 300011, 556331, 267971, 908771, 588371, 576720,
588371, 588371, 390306, 442152, 423802, 588371, 524291, 780611,
524291, 524291, 499533, 576720,1153440, 576720, 576720, 576720
}
},
{ "cmssdc10", 1893393257, 10485760, { // 16066561551 10.0
538843, 830112, 774771, 611661, 664090, 710693, 719430, 774771,
719430, 774771, 719430, 581078, 530106, 530106, 806810, 806810,
230099, 257770, 498067, 498067, 498067, 498067, 498067, 667002,
442726, 490789, 719430, 774771, 498067, 859238, 969920, 774771,
230099, 320395, 498069, 830112, 498067, 922162, 751469, 276704,
387386, 387386, 498067, 774771, 276704, 332045, 276704, 498067,
498067, 498067, 498067, 498067, 498067, 498067, 498067, 498067,
498067, 498067, 276704, 276704, 320395, 774771, 470397, 470397,
664090, 667002, 665546, 636419, 720886, 594184, 566514, 664090,
710693, 297094, 471853, 694672, 538843, 876715, 710693, 731080,
637875, 731080, 643699, 553408, 675739, 688848, 667002, 943706,
667002, 667002, 608749, 307288, 498069, 307288, 498067, 276704,
276704, 474765, 506803, 442726, 506803, 459475, 304374, 506803,
506803, 230099, 257770, 479133, 230099, 783507, 506803, 498067,
506803, 506803, 336413, 381853, 362629, 506803, 451462, 672826,
451462, 451462, 431075, 498067, 996134, 498067, 498067, 498067
}
},
{ "cmssi10", -984248855, 10485760, { // 30525306751 10.0
567981, 873816, 815562, 640800, 699053, 742746, 757307, 815562,
757307, 815562, 757307, 611672, 562155, 562155, 853427, 853427,
250494, 279622, 524290, 524290, 524290, 524290, 524290, 773347,
466035, 503902, 757307, 815562, 524290, 902944,1019453, 815562,
250494, 334963, 524290, 873816, 524290, 873816, 795173, 291272,
407781, 407781, 524290, 815562, 291272, 349526, 291272, 524290,
524290, 524290, 524290, 524290, 524290, 524290, 524290, 524290,
524290, 524290, 291272, 291272, 334963, 815562, 495163, 495163,
699053, 699054, 699054, 669926, 757309, 626235, 597109, 699053,
742746, 291274, 495163, 728182, 567981, 917509, 742746, 771870,
669926, 771870, 677208, 582544, 713616, 720901, 699054, 990326,
699054, 699054, 640798, 302923, 524290, 302923, 524290, 291272,
291272, 503901, 541766, 466035, 541766, 466035, 320400, 524290,
541766, 250494, 279622, 512640, 250494, 833038, 541766, 524290,
541766, 541766, 358266, 401955, 378653, 541766, 483512, 716530,
483512, 483512, 455840, 524290,1048579, 524290, 524290, 524290
}
},
{ "cmssi12", -637328691, 12582912, { // 33200621315 12.0
554621, 855600, 798560, 621371, 684480, 719675, 741520, 798560,
741520, 798560, 741520, 598920, 548555, 548555, 833755, 833755,
241509, 270029, 513360, 513360, 513360, 513360, 513360, 752704,
456320, 491515, 741520, 798560, 513360, 881085, 995165, 798560,
241509, 326464, 513360, 855600, 513360, 855600, 776715, 285200,
399280, 399280, 513360, 798560, 285200, 342240, 285200, 513360,
513360, 513360, 513360, 513360, 513360, 513360, 513360, 513360,
513360, 513360, 285200, 285200, 326464, 798560, 484840, 484840,
684480, 678411, 681445, 655960, 738485, 611661, 583141, 684480,
719675, 279131, 481805, 706931, 554621, 890795, 719675, 757296,
652925, 757296, 660813, 570400, 700256, 699043, 678411, 963611,
678411, 678411, 627440, 296731, 513360, 296731, 513360, 285200,
285200, 491515, 526709, 456320, 526709, 456320, 313720, 513360,
526709, 241509, 270029, 498189, 241509, 811909, 526709, 513360,
526709, 526709, 348915, 393576, 370760, 526709, 469669, 697829,
469669, 469669, 445397, 513360,1026720, 513360, 513360, 513360
}
},
{ "cmssi17", -1601180043, 18119392, { // 24043767165 17.3
533486, 821722, 766941, 600067, 657378, 695303, 712159, 766941,
712159, 766941, 712159, 575206, 527588, 527588, 801495, 801495,
233454, 260844, 493033, 493033, 493033, 493033, 493033, 733288,
438252, 472807, 712159, 766941, 493033, 847848, 957411, 766941,
233454, 314362, 493033, 821722, 493033, 821722, 746714, 273907,
383470, 383470, 493033, 766941, 273907, 328689, 273907, 493033,
493033, 493033, 493033, 493033, 493033, 493033, 493033, 493033,
493033, 493033, 273907, 273907, 314362, 766941, 465643, 465643,
657378, 654848, 656113, 629987, 710894, 588268, 560877, 657378,
695303, 271378, 464378, 682239, 533486, 859647, 695303, 726486,
628722, 726486, 635885, 547815, 671705, 675076, 654848, 928756,
654848, 654848, 602596, 286129, 493033, 286129, 493033, 273907,
273907, 472807, 507361, 438252, 507361, 438252, 301298, 493033,
507361, 233454, 260844, 479970, 233454, 781269, 507361, 493033,
507361, 507361, 335853, 377993, 356080, 507361, 452580, 671706,
452580, 452580, 428138, 493033, 986067, 493033, 493033, 493033
}
},
{ "cmssi8", 542250684, 8388608, { // 4024413274 8.00
606218, 928440, 866544, 680856, 742752, 786442, 804648, 866544,
804648, 866544, 804648, 649908, 597114, 597114, 906594, 906594,
265788, 296736, 557064, 557064, 557064, 557064, 557064, 817046,
495168, 535218, 804648, 866544, 557064, 959388,1083180, 866544,
265788, 353170, 557064, 928440, 557064, 928440, 844698, 309480,
433272, 433272, 557064, 866544, 309480, 371376, 309480, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 309480, 309480, 353170, 866544, 526116, 526116,
742752, 742752, 742752, 711804, 804648, 668114, 637166, 742752,
786442, 309480, 526116, 773700, 606218, 972130, 786442, 822854,
711804, 822854, 720906, 618960, 760958, 764598, 742752,1052232,
742752, 742752, 680856, 324044, 557064, 324044, 557064, 309480,
309480, 535218, 575268, 495168, 575268, 495168, 340428, 557064,
575268, 265788, 296736, 544320, 265788, 884748, 575268, 557064,
575268, 575268, 380478, 427082, 402324, 575268, 513372, 760956,
513372, 513372, 484244, 557064,1114128, 557064, 557064, 557064
}
},
{ "cmssi9", 732010263, 9437184, { // 5350313427 9.00
587392, 898080, 838208, 660210, 718464, 762155, 778336, 838208,
778336, 838208, 778336, 628656, 577684, 577684, 877044, 877044,
257287, 287223, 538848, 538848, 538848, 538848, 538848, 794375,
478976, 517812, 778336, 838208, 538848, 928825,1048569, 838208,
257287, 341433, 538848, 898080, 538848, 898080, 817172, 299360,
419104, 419104, 538848, 838208, 299360, 359232, 299360, 538848,
538848, 538848, 538848, 538848, 538848, 538848, 538848, 538848,
538848, 538848, 299360, 299360, 341433, 838208, 508912, 508912,
718464, 720082, 719273, 688528, 779145, 647264, 617328, 718464,
762155, 300978, 509721, 750018, 587392, 941771, 762155, 796135,
689337, 796135, 698236, 598720, 736263, 741118, 720082,1019442,
720082, 720082, 658592, 313115, 538848, 313115, 538848, 299360,
299360, 517812, 556647, 478976, 556647, 478978, 329296, 538848,
556647, 257287, 287223, 526711, 257287, 856007, 556647, 538848,
556647, 556647, 368132, 413118, 389168, 556647, 496775, 736263,
496775, 496775, 468457, 538848,1077696, 538848, 538848, 538848
}
},
{ "cmssq8", 1265911151, 8388608, { // 11335042557 8.00
742744,1092270,1019452, 771872, 873816, 851972, 946634,1019452,
946634,1019452, 946634, 764590, 691772, 691772,1055862,1055862,
291274, 327684, 655362, 655362, 655362, 655362, 655362, 844690,
582544, 618956, 946634,1019452, 655362,1114116,1259752,1019452,
291274, 371372, 655362,1092270, 655362,1092270, 983044, 364090,
509726, 509726, 655362,1019452, 364090, 436908, 364090, 655362,
655362, 655362, 655362, 655362, 655362, 655362, 655362, 655362,
655362, 655362, 364090, 364090, 371372,1019452, 618954, 618954,
873816, 844690, 859254, 837408, 932072, 815562, 779154, 873816,
851972, 334964, 604390, 881100, 742744,1070426, 851972,1012170,
822844,1012170, 855612, 728180, 939352, 848332, 844690,1208780,
844690, 844690, 800998, 369552, 655362, 369552, 655362, 364090,
364090, 618954, 655364, 582544, 655364, 582544, 400500, 655364,
655364, 291274, 327684, 618956, 291274,1019454, 655364, 655362,
655364, 655364, 436910, 502444, 473316, 655364, 582546, 873818,
582546, 582546, 564340, 655362,1310724, 655362, 655362, 655362
}
},
{ "cmssqi8", -1660616191, 8388608, { // 23501201001 8.00
742744,1092270,1019452, 771872, 873816, 851972, 946634,1019452,
946634,1019452, 946634, 764590, 691772, 691772,1055862,1055862,
291274, 327684, 655362, 655362, 655362, 655362, 655362, 896282,
582544, 618956, 946634,1019452, 655362,1114116,1259752,1019452,
291274, 371372, 655362,1092270, 655362,1092270, 983044, 364090,
509726, 509726, 655362,1019452, 364090, 436908, 364090, 655362,
655362, 655362, 655362, 655362, 655362, 655362, 655362, 655362,
655362, 655362, 364090, 364090, 371372,1019452, 618954, 618954,
873816, 844690, 859254, 837408, 932072, 815562, 779154, 873816,
851972, 334964, 604390, 881100, 742744,1070426, 851972,1012170,
822844,1012170, 855612, 728180, 939352, 848332, 844690,1208780,
844690, 844690, 800998, 369552, 655362, 369552, 655362, 364090,
364090, 618954, 655364, 582544, 655364, 582544, 400500, 655364,
655364, 291274, 327684, 618956, 291274,1019454, 655364, 655362,
655364, 655364, 436910, 502444, 473316, 655364, 582546, 873818,
582546, 582546, 564340, 655362,1310724, 655362, 655362, 655362
}
},
{ "cmsy10", 555887770, 10485760, { // 4110426232 10.0
815562, 291272, 815562, 524290, 815562, 524290, 815562, 815562,
815562, 815562, 815562, 815562, 815562,1048579, 524290, 524290,
815562, 815562, 815562, 815562, 815562, 815562, 815562, 815562,
815562, 815562, 815562, 815562,1048579,1048579, 815562, 815562,
1048579,1048579, 524290, 524290,1048579,1048579,1048579, 815562,
1048579,1048579, 640798, 640798,1048579,1048579,1048579, 815562,
288358,1048579, 699053, 699053, 932070, 932070, 0, 0,
582544, 582544, 699053, 524290, 757307, 757307, 815562, 815562,
640798, 837258, 688715, 552106, 808864, 553419, 753662, 623762,
885541, 570966, 710704, 798963, 723229,1259235, 860347, 834786,
729347, 856341, 888672, 634974, 571101, 656232, 642549,1035766,
747946, 700802, 759930, 699053, 699053, 699053, 699053, 699053,
640798, 640798, 466035, 466035, 466035, 466035, 524290, 524290,
407781, 407781, 291272, 524290, 524290, 640798, 524290, 291272,
873816, 786434, 873816, 436909, 699053, 699053, 815562, 815562,
466037, 466035, 466035, 640798, 815562, 815562, 815562, 815562
}
},
{ "cmsy5", -1327746962, 5242880, { // 26067030156 5.00
1135974, 480602,1135974, 771878,1135974, 771878,1135974,1135974,
1135974,1135974,1135974,1135974,1135974,1427251, 771878, 771878,
1135974,1135974,1135974,1135974,1135974,1135974,1135974,1135974,
1135974,1135974,1135974,1135974,1427251,1427251,1135974,1135974,
1427251,1427251, 771878, 771878,1427251,1427251,1427251,1135974,
1427251,1427251, 917517, 917517,1427251,1427251,1427251,1135974,
462397,1427251, 990336, 990336,1281613,1281613, 0, 0,
844698, 844698, 990336, 771878,1063155,1063155,1135974,1135974,
917517,1167574, 963974, 820083,1136560, 808288,1036208, 891741,
1252560, 859338,1004899,1106269,1011600,1644022,1180758,1142090,
1046118,1186947,1254237, 910234, 862384, 916202, 942570,1434099,
1045053, 974608,1039562, 990336, 990336, 990336, 990336, 990336,
917517, 917517, 699059, 699059, 699059, 699059, 771878, 771878,
626240, 626240, 480602, 771878, 771878, 917517, 771878, 480602,
1150541,1086458,1208794, 662650, 990336, 990336,1135974,1135974,
699059, 699059, 699059, 917517,1135974,1135974,1135974,1135974
}
},
{ "cmsy6", 1906386187, 6291456, { // 16150222413 6.00
1009733, 398069,1009733, 669920,1009733, 669920,1009733,1009733,
1009733,1009733,1009733,1009733,1009733,1281584, 669920, 669920,
1009733,1009733,1009733,1009733,1009733,1009733,1009733,1009733,
1009733,1009733,1009733,1009733,1281584,1281584,1009733,1009733,
1281584,1281584, 669920, 669920,1281584,1281584,1281584,1009733,
1281584,1281584, 805845, 805845,1281584,1281584,1281584,1009733,
383507,1281584, 873808, 873808,1145659,1145659, 0, 0,
737883, 737883, 873808, 669920, 941771, 941771,1009733,1009733,
805845,1038029, 852789, 711328,1007888, 703901, 922592, 782979,
1110776, 743779, 887400, 984397, 896043,1496560,1054517,1020219,
921091,1057307,1112939, 799048, 745856, 812053, 823371,1282117,
926581, 863909, 926917, 873808, 873808, 873808, 873808, 873808,
805845, 805845, 601957, 601957, 601957, 601957, 669920, 669920,
533995, 533995, 398069, 669920, 669920, 805845, 669920, 398069,
1048568, 968955,1077696, 567979, 873808, 873808,1009733,1009733,
601957, 601957, 601957, 805845,1009733,1009733,1009733,1009733
}
},
{ "cmsy7", 1327620741, 7340032, { // 11710361205 7.00
936233, 355769, 936233, 613753, 936233, 613753, 936233, 936233,
936233, 936233, 936233, 936233, 936233,1194217, 613753, 613753,
936233, 936233, 936233, 936233, 936233, 936233, 936233, 936233,
936233, 936233, 936233, 936233,1194217,1194217, 936233, 936233,
1194217,1194217, 613753, 613753,1194217,1194217,1194217, 936233,
1194217,1194217, 742745, 742745,1194217,1194217,1194217, 936233,
345365,1194217, 807241, 807241,1065225,1065225, 0, 0,
678249, 678249, 807241, 613753, 871737, 871737, 936233, 936233,
742745, 962176, 790037, 650311, 932656, 646005, 858107, 721963,
1026183, 677906, 820142, 914021, 830171,1407911, 981017, 949840,
848457, 981383,1028690, 736297, 679289, 752667, 754898,1190247,
858633, 801502, 863127, 807241, 807241, 807241, 807241, 807241,
742745, 742745, 549257, 549257, 549257, 549257, 613753, 613753,
484761, 484761, 355769, 613753, 613753, 742745, 613753, 355769,
984085, 900866,1000729, 517531, 807241, 807241, 936233, 936233,
549259, 549257, 549257, 742745, 936233, 936233, 936233, 936233
}
},
{ "cmsy8", -1102329845, 8388608, { // 27622744013 8.00
866544, 309480, 866544, 557064, 866544, 557064, 866544, 866544,
866544, 866544, 866544, 866544, 866544,1114128, 557064, 557064,
866544, 866544, 866544, 866544, 866544, 866544, 866544, 866544,
866544, 866544, 866544, 866544,1114128,1114128, 866544, 866544,
1114128,1114128, 557064, 557064,1114128,1114128,1114128, 866544,
1114128,1114128, 680856, 680856,1114128,1114128,1114128, 866544,
302194,1114128, 742752, 742752, 990336, 990336, 0, 0,
618960, 618960, 742752, 557064, 804648, 804648, 866544, 866544,
680856, 890716, 728406, 589978, 861666, 588012, 795176, 661632,
948174, 613934, 755132, 846668, 766198,1325946, 911326, 882490,
779418, 909872, 950942, 674666, 614800, 695014, 688068,1105866,
793100, 740130, 800716, 742752, 742752, 742752, 742752, 742752,
680856, 680856, 495168, 495168, 495168, 495168, 557064, 557064,
433272, 433272, 309480, 557064, 557064, 680856, 557064, 309480,
928440, 834504, 928440, 465130, 742752, 742752, 866544, 866544,
495168, 495168, 495168, 680856, 866544, 866544, 866544, 866544
}
},
{ "cmsy9", -1447980854, 9437184, { // 25154310312 9.00
838208, 299360, 838208, 538848, 838208, 538848, 838208, 838208,
838208, 838208, 838208, 838208, 838208,1077696, 538848, 538848,
838208, 838208, 838208, 838208, 838208, 838208, 838208, 838208,
838208, 838208, 838208, 838208,1077696,1077696, 838208, 838208,
1077696,1077696, 538848, 538848,1077696,1077696,1077696, 838208,
1077696,1077696, 658592, 658592,1077696,1077696,1077696, 838208,
292889,1077696, 718464, 718464, 957952, 957952, 0, 0,
598720, 598720, 718464, 538848, 778336, 778336, 838208, 838208,
658592, 861003, 706345, 568928, 832318, 568784, 772103, 640583,
913360, 590053, 730437, 820153, 742316,1288868, 882990, 855975,
751588, 880117, 916331, 652604, 590512, 673460, 662768,1066903,
768004, 718274, 778046, 718464, 718464, 718464, 718464, 718464,
658592, 658592, 478976, 478976, 478976, 478976, 538848, 538848,
419104, 419104, 299360, 538848, 538848, 658592, 538848, 299360,
898080, 808110, 898080, 449042, 718464, 718464, 838208, 838208,
478976, 478976, 478976, 658592, 838208, 838208, 838208, 838208
}
},
{ "cmtcsc10", -751363667, 10485760, { // 32315614655 10.0
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498,1100995, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498
}
},
{ "cmtex10", -538297224, 10485760, { // 33772436170 10.0
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498
}
},
{ "cmtex8", -549205389, 8388608, { // 33720745163 8.00
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064
}
},
{ "cmtex9", -542880256, 9437184, { // 33751047000 9.00
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496
}
},
{ "cmti10", -50321606, 10485760, { // 37500023472 10.0
657686, 857498, 803904, 725843, 696717, 779437, 750310, 803904,
750310, 803904, 750310, 643123, 589530, 616326, 924490, 937888,
321562, 348358, 535936, 535936, 535936, 535936, 535936, 871672,
482342, 562733, 750310, 750310, 535936, 925654,1032842, 803904,
267968, 321562, 539432, 857498, 806453, 857498, 803904, 321562,
428749, 428749, 535936, 803904, 321562, 375155, 321562, 535936,
535936, 535936, 535936, 535936, 535936, 535936, 535936, 535936,
535936, 535936, 321562, 321562, 321562, 803904, 535936, 535936,
803904, 779437, 738077, 750310, 791670, 711280, 684483, 811186,
779437, 404282, 550499, 806234, 657686, 940218, 779437, 803904,
711280, 803904, 764874, 589530, 750310, 779437, 779437,1047405,
779437, 779437, 643123, 321562, 539432, 321562, 535936, 321562,
321562, 535936, 482342, 482342, 535936, 482342, 321562, 482342,
535936, 321562, 321562, 482342, 267968, 857498, 589530, 535936,
535936, 482342, 442147, 428749, 348358, 562733, 482342, 696717,
486421, 509139, 428749, 535936,1071872, 535936, 535936, 535936
}
},
{ "cmti12", -1682208704, 12582912, { // 23356704100 12.0
643231, 838869, 786440, 709739, 681581, 762168, 734011, 786440,
734011, 786440, 734011, 629152, 576724, 602939, 904408, 917515,
314576, 340791, 524293, 524293, 524293, 524293, 524293, 854404,
471864, 550508, 734011, 734011, 524293, 905377,1010236, 786440,
262147, 314576, 524293, 838869, 791900, 838869, 786440, 314576,
419435, 419435, 524293, 786440, 314576, 367005, 314576, 524293,
524293, 524293, 524293, 524293, 524293, 524293, 524293, 524293,
524293, 524293, 314576, 314576, 314576, 786440, 524293, 524293,
786440, 762168, 721875, 734011, 774304, 695660, 669445, 793480,
762168, 395163, 538372, 788383, 643231, 919456, 762168, 786440,
695660, 786440, 748089, 576723, 734011, 762168, 762168,1024315,
762168, 762168, 629152, 314576, 524293, 314576, 524293, 314576,
314576, 524293, 471864, 471864, 524293, 471864, 314576, 471864,
524293, 314576, 314576, 471864, 262147, 838869, 576723, 524293,
524293, 471864, 432543, 419436, 340791, 550508, 471864, 681581,
471864, 498079, 419435, 524293,1048587, 524293, 524293, 524293
}
},
{ "cmti7", 1954372810, 7340032, { // 16437256312 7.00
770215,1001986, 940402, 846363, 817234, 907947, 878818, 940402,
878818, 940402, 878818, 772295, 710713, 741504,1112254,1127650,
386146, 416939, 632482, 632482, 632482, 632482, 632482,1000183,
570898, 663278, 878818, 878818, 632482,1078135,1201303, 940402,
324562, 386146, 632482,1001986, 922976,1001986, 940402, 386146,
509314, 509314, 632482, 940402, 386146, 447730, 386146, 632482,
632482, 632482, 632482, 632482, 632482, 632482, 632482, 632482,
632482, 632482, 386146, 386146, 386146, 940402, 632482, 632482,
940402, 907947, 862592, 878818, 924176, 831799, 801008, 947685,
907947, 476859, 647047, 938741, 770215,1092699, 907947, 940402,
831799, 940402, 893383, 694066, 878818, 907947, 907947,1215867,
907947, 907947, 755650, 386146, 632482, 386146, 632482, 386146,
386146, 632482, 570898, 570898, 632482, 570898, 386149, 570898,
632482, 386146, 386146, 570898, 324562,1001986, 694066, 632482,
632482, 570898, 524711, 509314, 416939, 663275, 570898, 817234,
570901, 601691, 509317, 632482,1264965, 632482, 632482, 632482
}
},
{ "cmti8", 600925840, 8388608, { // 4364263220 8.00
705242, 920418, 862892, 777696, 747840, 835222, 805366, 862892,
805366, 862892, 805366, 690318, 632794, 661556, 992332,1006714,
345158, 373922, 575262, 575262, 575262, 575262, 575262, 927458,
517736, 604028, 805366, 805366, 575262, 992872,1107924, 862892,
287632, 345158, 576718, 920418, 855610, 920418, 862892, 345158,
460210, 460210, 575262, 862892, 345158, 402684, 345158, 575262,
575262, 575262, 575262, 575262, 575262, 575262, 575262, 575262,
575262, 575262, 345158, 345158, 345158, 862892, 575262, 575262,
862892, 835222, 791532, 805366, 849058, 762768, 734006, 870356,
835222, 432540, 590190, 863986, 705242,1007800, 835222, 862892,
762768, 862892, 820294, 632788, 805366, 835222, 835222,1122852,
835222, 835222, 690314, 345158, 576718, 345158, 575262, 345158,
345158, 575262, 517736, 517736, 575262, 517736, 345160, 517736,
575262, 345158, 345158, 517736, 287632, 920418, 632788, 575262,
575262, 517736, 474592, 460210, 373922, 604026, 517736, 747840,
518830, 546500, 460212, 575262,1150524, 575262, 575262, 575262
}
},
{ "cmti9", -1133866567, 9437184, { // 27432510671 9.00
675111, 880299, 825280, 745017, 715243, 800036, 770261, 825280,
770261, 825280, 770261, 660224, 605205, 632715, 949072, 962827,
330112, 357621, 550187, 550187, 550187, 550187, 550187, 892272,
495168, 577696, 770261, 770261, 550187, 950204,1060242, 825280,
275093, 330112, 553422, 880299, 824267, 880299, 825280, 330112,
440149, 440149, 550187, 825280, 330112, 385131, 330112, 550187,
550187, 550187, 550187, 550187, 550187, 550187, 550187, 550187,
550187, 550187, 330112, 330112, 330112, 825280, 550187, 550187,
825280, 800036, 757639, 770261, 812658, 730130, 702620, 832724,
800036, 414905, 565074, 827545, 675111, 965092, 800036, 825280,
730130, 825280, 785148, 605205, 770261, 800036, 800036,1075129,
800036, 800036, 660224, 330112, 553422, 330112, 550187, 330112,
330112, 550187, 495168, 495168, 550187, 495168, 330112, 495168,
550187, 330112, 330112, 495168, 275093, 880299, 605205, 550187,
550187, 495168, 453904, 440149, 357621, 577696, 495168, 715243,
496786, 522677, 440149, 550187,1100373, 550187, 550187, 550187
}
},
{ "cmtt10", -538297224, 10485760, { // 33772436170 10.0
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498
}
},
{ "cmtt12", -544819884, 12582912, { // 33741532524 12.0
539580, 539580, 539580, 539580, 539580, 539580, 539580, 539580,
539580, 539580, 539580, 539580, 539580, 539580, 539580, 539580,
539580, 539580, 539580, 539580, 539580, 539580, 539580, 539580,
539580, 539580, 539580, 539580, 539580, 539580, 539580, 539580,
539580, 539580, 539580, 539580, 539580, 539580, 539580, 539580,
539580, 539580, 539580, 539580, 539580, 539580, 539580, 539580,
539580, 539580, 539580, 539580, 539580, 539580, 539580, 539580,
539580, 539580, 539580, 539580, 539580, 539580, 539580, 539580,
539580, 539580, 539580, 539580, 539580, 539580, 539580, 539580,
539580, 539580, 539580, 539580, 539580, 539580, 539580, 539580,
539580, 539580, 539580, 539580, 539580, 539580, 539580, 539580,
539580, 539580, 539580, 539580, 539580, 539580, 539580, 539580,
539580, 539580, 539580, 539580, 539580, 539580, 539580, 539580,
539580, 539580, 539580, 539580, 539580, 539580, 539580, 539580,
539580, 539580, 539580, 539580, 539580, 539580, 539580, 539580,
539580, 539580, 539580, 539580, 539580, 539580, 539580, 539580
}
},
{ "cmtt8", -549205389, 8388608, { // 33720745163 8.00
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064,
557064, 557064, 557064, 557064, 557064, 557064, 557064, 557064
}
},
{ "cmtt9", -542880256, 9437184, { // 33751047000 9.00
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496,
550496, 550496, 550496, 550496, 550496, 550496, 550496, 550496
}
},
{ "cmu10", 320884962, 10485760, { // 2310050342 10.0
713614, 932069, 873814, 786432, 757306, 844686, 815560, 873814,
815560, 873814, 815560, 699051, 640797, 669923,1004885,1019448,
349525, 378653, 582542, 582542, 582542, 582542, 582542, 844686,
524288, 611672, 815560, 815560, 582542,1004886,1121395, 873814,
291270, 349525, 582542, 932069, 728178, 932069, 873814, 349525,
466034, 466034, 582542, 873814, 349525, 407779, 349525, 582542,
582542, 582542, 582542, 582542, 582542, 582542, 582542, 582542,
582542, 582542, 349525, 349525, 349525, 873814, 582542, 582542,
873814, 844686, 800997, 815560, 859251, 771869, 742742, 881096,
844686, 436906, 597106, 873814, 713614,1019450, 844686, 873814,
771869, 873814, 830123, 640797, 815560, 844686, 844686,1135958,
844686, 844686, 699051, 349525, 582542, 349525, 582542, 349525,
349525, 582542, 524288, 524288, 582542, 524288, 349526, 524288,
582542, 349525, 349525, 524288, 291270, 932069, 640797, 582542,
582542, 524288, 480598, 466034, 378653, 611670, 524288, 757306,
533027, 553416, 466035, 582542,1165085, 582542, 582542, 582542
}
},
{ "cmvtt10", -1029646951, 10485760, { // 30250152631 10.0
672830, 917496, 856330, 733997, 733997, 795163, 795163, 856330,
795163, 856330, 795163, 642248, 611664, 611664, 917496, 917496,
305832, 336416, 550498, 550498, 550498, 550498, 550498, 795163,
489331, 550499, 795163, 856330, 550498, 978662,1100995, 856330,
305832, 305832, 550498, 917496, 550498, 917496, 856330, 305832,
428165, 428165, 550498, 856330, 305832, 366998, 305832, 550498,
550498, 550498, 550498, 550498, 550498, 550498, 550498, 550498,
550498, 550498, 305832, 305832, 305832, 856330, 519915, 519915,
733997, 795163, 764581, 795163, 825747, 733997, 703414, 856330,
795163, 366998, 550498, 825747, 672830, 978662, 795163, 856330,
733997, 856330, 795163, 611664, 795163, 795163, 795163,1100995,
795163, 795163, 672830, 311659, 550498, 311659, 550498, 305832,
305832, 535206, 611664, 489331, 611664, 489331, 336416, 550498,
611664, 305832, 336416, 581082, 305832, 917496, 611664, 550498,
611664, 581080, 428165, 434282, 428165, 611664, 581082, 795163,
581082, 581082, 489331, 550498,1100995, 550498, 550498, 550498
}
},
{ "euex10", 1644650801, 10485760, { // 14201660461 10.0
0, 0, 0, 0, 0, 0, 0, 0,
611672, 611672, 699053, 699053, 786434, 786434, 844691, 844691,
0, 0, 0, 0, 0, 0, 0, 0,
1048579,1048579,1048579,1048579, 0, 0, 0, 0,
1048579,1048579, 524290, 524290,1048579,1048579,1048579, 0,
1048579,1048579, 699053, 699053,1048579,1048579,1048579, 0,
0,1048579, 0, 0, 0, 0, 0, 0,
932070, 932070, 932070, 932070, 932070, 932070, 932070, 0,
0, 0, 0, 0, 0, 0, 0, 0,
553416, 466035, 0, 0, 0, 0, 0, 0,
1106834,1106834, 553416, 0, 0, 0, 0, 0,
1514614,1479661, 466035, 0, 0, 0, 0, 0,
1106834,1479661, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 524290, 699053, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 471864, 471864, 471864, 471864, 0, 0
}
},
{ "euex7", 1796464529, 7340032, { // 15304757621 7.00
0, 0, 0, 0, 0, 0, 0, 0,
693854, 693854, 790597, 790597, 887339, 887339, 951840, 951840,
0, 0, 0, 0, 0, 0, 0, 0,
1177573,1177573,1177573,1177573, 0, 0, 0, 0,
1177573,1177573, 597109, 597109,1177573,1177573,1177573, 0,
1177573,1177573, 790597, 790597,1177573,1177573,1177573, 0,
0,1177573, 0, 0, 0, 0, 0, 0,
1048581,1048581,1048581,1048581,1048581,1048581,1048581, 0,
0, 0, 0, 0, 0, 0, 0, 0,
629355, 532613, 0, 0, 0, 0, 0, 0,
1242069,1242069, 629355, 0, 0, 0, 0, 0,
1693541,1654843, 532613, 0, 0, 0, 0, 0,
1242069,1654843, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 597109, 790597, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 488510, 488510, 488510, 488510, 0, 0
}
},
{ "euex8", 604371431, 8388608, { // 4401374747 8.00
0, 0, 0, 0, 0, 0, 0, 0,
649908, 649908, 742752, 742752, 835596, 835596, 897492, 897492,
0, 0, 0, 0, 0, 0, 0, 0,
1114128,1114128,1114128,1114128, 0, 0, 0, 0,
1114128,1114128, 557064, 557064,1114128,1114128,1114128, 0,
1114128,1114128, 742752, 742752,1114128,1114128,1114128, 0,
0,1114128, 0, 0, 0, 0, 0, 0,
990336, 990336, 990336, 990336, 990336, 990336, 990336, 0,
0, 0, 0, 0, 0, 0, 0, 0,
588012, 495168, 0, 0, 0, 0, 0, 0,
1176024,1176024, 588012, 0, 0, 0, 0, 0,
1609296,1572158, 495168, 0, 0, 0, 0, 0,
1176024,1572158, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 557064, 742752, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 471864, 471864, 471864, 471864, 0, 0
}
},
{ "euex9", -2032658551, 9437184, { // 20666013611 9.00
0, 0, 0, 0, 0, 0, 0, 0,
628658, 628658, 718464, 718464, 808274, 808274, 868144, 868144,
0, 0, 0, 0, 0, 0, 0, 0,
1077696,1077696,1077696,1077696, 0, 0, 0, 0,
1077696,1077696, 538848, 538848,1077696,1077696,1077696, 0,
1077696,1077696, 718464, 718464,1077696,1077696,1077696, 0,
0,1077696, 0, 0, 0, 0, 0, 0,
957952, 957952, 957952, 957952, 957952, 957952, 957952, 0,
0, 0, 0, 0, 0, 0, 0, 0,
568784, 478976, 0, 0, 0, 0, 0, 0,
1137568,1137570, 568784, 0, 0, 0, 0, 0,
1556672,1520748, 478976, 0, 0, 0, 0, 0,
1137570,1520748, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 538848, 718464, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 471865, 471865, 471865, 471865, 0, 0
}
},
{ "eufb10", -661254937, 10485760, { // 33045406347 10.0
0, 615965, 412650, 406296, 621315, 412315, 416997, 0,
1028280, 762098, 0, 0, 0, 0, 0, 0,
0, 0, 265848, 265848, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 366168, 0, 0, 0, 0, 913581, 262504,
481202, 481202, 343763, 936320, 343763, 936320, 343763, 621315,
621315, 621315, 621315, 621315, 621315, 621315, 621315, 621315,
621315, 621315, 267520, 267520, 0, 609946, 0, 448765,
0, 888501,1094491, 758419,1029618, 820618, 756747, 972435,
891845, 686523, 683848, 827640, 824630,1299478,1030286,1023933,
1024602,1023933,1025270,1025939, 828309, 891845,1029283,1295131,
890507,1031290, 745378, 269192, 0, 269192, 618640, 0,
0, 632016, 618640, 486218, 617302, 494912, 407299, 623656,
645392, 347442, 347776, 486552, 353126, 966082, 685520, 638704,
633019, 624659, 481870, 548082, 412315, 617302, 633688, 962069,
481202, 617637, 483542, 0, 0, 265848, 0, 568480
}
},
{ "eufb5", -1562321527, 5242880, { // 24270156611 5.00
0, 898656, 674912, 667920, 904544, 674544, 679696, 0,
1352400,1059472, 0, 0, 0, 0, 0, 0,
0, 0, 513360, 513360, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 623760, 0, 0, 0, 0,1226176, 509680,
750352, 750352, 599104,1251200, 599104,1251200, 599104, 904544,
904544, 904544, 904544, 904544, 904544, 904544, 904544, 904544,
904544, 904544, 515200, 515200, 0, 892032, 0, 714656,
0,1198576,1425264,1055424,1353872,1123872,1053584,1290944,
1202256, 976304, 973360,1131600,1128288,1650848,1354608,1347616,
1348352,1347616,1349088,1349824,1132336,1202256,1353504,1646064,
1200784,1355712,1041072, 517040, 0, 517040, 901600, 0,
0, 916320, 901600, 755872, 900128, 765440, 669024, 907120,
931040, 603152, 603520, 756240, 609408,1283952, 975200, 923680,
917424, 908224, 751088, 823952, 674544, 900128, 918160,1279536,
750352, 900496, 752928, 0, 0, 513360, 0, 846400
}
},
{ "eufb6", 953717986, 6291456, { // 7066112342 6.00
0, 759696, 544059, 537320, 765371, 543704, 548669, 0,
1197000, 914685, 0, 0, 0, 0, 0, 0,
0, 0, 388360, 388360, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 494760, 0, 0, 0, 0,1075349, 384813,
616765, 616765, 470997,1099467, 470997,1099467, 470997, 765371,
765371, 765371, 765371, 765371, 765371, 765371, 765371, 765371,
765371, 765371, 390133, 390133, 0, 753312, 0, 582363,
0,1048749,1267224, 910784,1198419, 976752, 909011,1137771,
1052296, 834531, 831693, 984200, 981008,1484635,1199128,1192389,
1193099,1192389,1193808,1194517, 984909,1052296,1198064,1480024,
1050877,1200192, 896952, 391907, 0, 391907, 762533, 0,
0, 776720, 762533, 622085, 761115, 631307, 538384, 767853,
790907, 474899, 475253, 622440, 480928,1131032, 833467, 783813,
777784, 768917, 617475, 687699, 543704, 761115, 778493,1126776,
616765, 761469, 619248, 0, 0, 388360, 0, 709333
}
},
{ "eufb7", -1933153063, 7340032, { // 21461466331 7.00
0, 695447, 488379, 481909, 700896, 488039, 492807, 0,
1115371, 844277, 0, 0, 0, 0, 0, 0,
0, 0, 338869, 338869, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 441040, 0, 0, 0, 0, 998555, 335463,
558197, 558197, 418222,1021714, 418222,1021714, 418222, 700896,
700896, 700896, 700896, 700896, 700896, 700896, 700896, 700896,
700896, 700896, 340571, 340571, 0, 689317, 0, 525161,
0, 973013,1182805, 840530,1116734, 903877, 838827,1058496,
976418, 767307, 764583, 911029, 907963,1391575,1117415,1110944,
1111625,1110944,1112306,1112987, 911710, 976418,1116393,1387147,
975056,1118437, 827248, 342274, 0, 342274, 698171, 0,
0, 711794, 698171, 563305, 696809, 572160, 482930, 703280,
725417, 421968, 422309, 563646, 427758,1052025, 766286, 718606,
712816, 704302, 558878, 626311, 488039, 696809, 713497,1047938,
558197, 697150, 560581, 0, 0, 338869, 0, 647086
}
},
{ "eufb8", -1314401225, 8388608, { // 26151752067 8.00
0, 622596, 417092, 410670, 628004, 416754, 421486, 0,
1039350, 770302, 0, 0, 0, 0, 0, 0,
0, 0, 268710, 268710, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 370110, 0, 0, 0, 0, 923416, 265330,
486382, 486382, 347464, 946400, 347464, 946400, 347464, 628004,
628004, 628004, 628004, 628004, 628004, 628004, 628004, 628004,
628004, 628004, 270400, 270400, 0, 616512, 0, 453596,
0, 898066,1106274, 766584,1040702, 829452, 764894, 982904,
901446, 693914, 691210, 836550, 833508,1313468,1041378,1034956,
1035632,1034956,1036308,1036984, 837226, 901446,1040364,1309074,
900094,1042392, 753402, 272090, 0, 272090, 625300, 0,
0, 638820, 625300, 491452, 623948, 500240, 411684, 630370,
652340, 351182, 351520, 491790, 356928, 976482, 692900, 645580,
639834, 631384, 487058, 553982, 416754, 623948, 640510, 972426,
486382, 624286, 488748, 0, 0, 268710, 0, 574600
}
},
{ "eufb9", 1295088986, 9437184, { // 11514276532 9.00
0, 615637, 412430, 406080, 620985, 412096, 416775, 0,
1027733, 761692, 0, 0, 0, 0, 0, 0,
0, 0, 265707, 265707, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 365973, 0, 0, 0, 0, 913095, 262364,
480946, 480946, 343580, 935822, 343580, 935822, 343580, 620985,
620985, 620985, 620985, 620985, 620985, 620985, 620985, 620985,
620985, 620985, 267378, 267378, 0, 609621, 0, 448526,
0, 888028,1093909, 758016,1029070, 820181, 756345, 971918,
891371, 686158, 683484, 827200, 824192,1298788,1029739,1023388,
1024057,1023388,1024725,1025394, 827868, 891371,1028736,1294443,
890034,1030741, 744981, 269049, 0, 269049, 618311, 0,
0, 631680, 618311, 485959, 616974, 494649, 407083, 623324,
645049, 347257, 347591, 486293, 352939, 965568, 685156, 638364,
632683, 624327, 481614, 547790, 412096, 616974, 633351, 961557,
480946, 617308, 483285, 0, 0, 265707, 0, 568178
}
},
{ "eufm10", -1893372238, 10485760, { // 21711267262 10.0
521654, 522504, 349469, 345221, 527885, 349186, 350318, 525053,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 225144, 225144, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 310104, 0, 0, 0, 0, 773702, 222312,
407525, 407525, 291130, 792960, 291130, 792960, 291130, 526186,
526186, 526186, 526186, 526186, 526186, 526186, 526186, 526186,
526186, 526186, 226560, 226560, 0, 792960, 0, 380054,
0, 752462, 926914, 642298, 871973, 694973, 640882, 823546,
755294, 581410, 579144, 700920, 698371,1100515, 872539, 867158,
867725, 867158, 868291, 868858, 701486, 677131, 871690,1096834,
754162, 873389, 631253, 291130, 0, 291130, 523920, 0,
0, 524770, 538080, 408374, 522787, 419986, 342106, 528168,
546576, 292546, 294528, 408374, 293112, 804005, 552240, 512592,
524770, 512875, 408091, 464165, 349186, 542328, 536664, 811085,
407525, 523070, 409507, 0, 0, 225144, 0, 396480
}
},
{ "eufm5", -1194741804, 5242880, { // 27062327724 5.00
828326, 829344, 622093, 617005, 835789, 621754, 623110, 832397,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 473184, 473184, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 574944, 0, 0, 0, 0,1130214, 469792,
691629, 691629, 552218,1153280, 552218,1153280, 552218, 833754,
833754, 833754, 833754, 833754, 833754, 833754, 833754, 833754,
833754, 833754, 474880, 474880, 0,1153280, 0, 658726,
0,1104774,1313722, 972826,1247917,1035917, 971130,1189914,
1108166, 899898, 897184,1043040,1039987,1521651,1248595,1242150,
1242829,1242150,1243507,1244186,1043718,1014547,1247578,1517242,
1106810,1249613, 959597, 552218, 0, 552218, 831040, 0,
0, 832058, 848000, 692646, 829683, 706554, 613274, 836128,
858176, 553914, 556288, 692646, 554592,1166509, 864960, 817472,
832058, 817811, 692307, 759469, 621754, 853088, 846304,1174989,
691629, 830022, 694003, 0, 0, 473184, 0, 678400
}
},
{ "eufm6", 1695972292, 6291456, { // 14505475704 6.00
691152, 692120, 494971, 490131, 698251, 494648, 495939, 695024,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 353320, 353320, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 450120, 0, 0, 0, 0, 978325, 350093,
561117, 561117, 428501,1000267, 428501,1000267, 428501, 696315,
696315, 696315, 696315, 696315, 696315, 696315, 696315, 696315,
696315, 696315, 354933, 354933, 0,1000267, 0, 529819,
0, 954125,1152888, 828608,1090291, 888624, 826995,1035115,
957352, 759235, 756653, 895400, 892496,1350683,1090936,1084805,
1085451,1084805,1086096,1086741, 896045, 868296,1089968,1346488,
956061,1091904, 816024, 428501, 0, 428501, 693733, 0,
0, 694701, 709867, 562085, 692443, 575315, 486581, 698573,
719547, 430115, 432373, 562085, 430760,1012851, 726000, 680827,
694701, 681149, 561763, 625651, 494648, 714707, 708253,1020917,
561117, 692765, 563376, 0, 0, 353320, 0, 548533
}
},
{ "eufm7", 1491936770, 7340032, { // 13073223002 7.00
625435, 626354, 439214, 434619, 632174, 438907, 440133, 629111,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 304754, 304754, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 396640, 0, 0, 0, 0, 898030, 301691,
502002, 502002, 376119, 918857, 376119, 918857, 376119, 630336,
630336, 630336, 630336, 630336, 630336, 630336, 630336, 630336,
630336, 630336, 306286, 306286, 0, 918857, 0, 472293,
0, 875058,1063730, 755913,1004311, 812882, 754382, 951936,
878121, 690062, 687611, 819314, 816558,1251483,1004923, 999104,
999717, 999104,1000329,1000942, 819927, 793586,1004005,1247502,
876896,1005842, 743968, 376119, 0, 376119, 627886, 0,
0, 628805, 643200, 502921, 626661, 515479, 431250, 632480,
652389, 377650, 379794, 502921, 378263, 930802, 658514, 615634,
628805, 615941, 502615, 563259, 438907, 647794, 641669, 938459,
502002, 626967, 504146, 0, 0, 304754, 0, 490057
}
},
{ "eufm8", 1553433125, 8388608, { // 13445701045 8.00
541548, 542430, 362796, 358386, 548016, 362502, 363678, 545076,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 233730, 233730, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 321930, 0, 0, 0, 0, 803208, 230790,
423066, 423066, 302232, 823200, 302232, 823200, 302232, 546252,
546252, 546252, 546252, 546252, 546252, 546252, 546252, 546252,
546252, 546252, 235200, 235200, 0, 823200, 0, 394548,
0, 781158, 962262, 666792, 905226, 721476, 665322, 854952,
784098, 603582, 601230, 727650, 725004,1142484, 905814, 900228,
900816, 900228, 901404, 901992, 728238, 702954, 904932,1138662,
782922, 906696, 655326, 302232, 0, 302232, 543900, 0,
0, 544782, 558600, 423948, 542724, 436002, 355152, 548310,
567420, 303702, 305760, 423948, 304290, 834666, 573300, 532140,
544782, 532434, 423654, 481866, 362502, 563010, 557130, 842016,
423066, 543018, 425124, 0, 0, 233730, 0, 411600
}
},
{ "eufm9", -130813009, 9437184, { // 37014771657 9.00
533771, 534640, 357586, 353239, 540146, 357296, 358455, 537248,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 230373, 230373, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 317307, 0, 0, 0, 0, 791673, 227476,
416990, 416990, 297892, 811378, 297892, 811378, 297892, 538407,
538407, 538407, 538407, 538407, 538407, 538407, 538407, 538407,
538407, 538407, 231822, 231822, 0, 811378, 0, 388882,
0, 769940, 948443, 657216, 892226, 711115, 655767, 842674,
772837, 594914, 592596, 717200, 714592,1126076, 892805, 887300,
887879, 887300, 888459, 889038, 717780, 692859, 891936,1122309,
771678, 893675, 645915, 297892, 0, 297892, 536089, 0,
0, 536958, 550578, 417860, 534930, 429740, 350052, 540436,
559271, 299340, 301369, 417860, 299920, 822679, 565067, 524498,
536958, 524788, 417570, 474946, 357296, 554924, 549129, 829924,
416990, 535220, 419019, 0, 0, 230373, 0, 405689
}
},
{ "eurb10", -1855621176, 10485760, { // 22131273710 10.0
562362, 820872,1015560, 888888, 684216, 886080, 747240, 833040,
1020864, 819624,1006512, 749424, 734136, 677352, 612456, 616200,
549120, 683280, 680472, 371280, 611520, 625248, 677664, 669552,
616512, 696696, 640536, 734136, 609024, 652080, 916032, 616200,
861744,1020552, 557856, 670488, 978432, 0, 0, 856752,
0, 0, 0, 0, 0, 0, 0, 0,
577200, 577200, 577200, 577200, 577200, 577200, 577200, 577200,
577200, 577200, 320736, 320736, 380640, 579696, 378768, 0,
674544, 870168, 761592, 827736, 943800, 671736, 550992, 887016,
898560, 483600, 479856, 784368, 650832,1214616, 967200, 925080,
697320, 963768, 748800, 686400, 569675, 900432, 781698,1180365,
773136, 612350, 769392, 0, 0, 0, 0, 0,
430560, 697320, 706056, 575952, 706056, 643656, 451776, 690144,
697008, 385008, 380640, 640848, 386568,1037088, 703560, 705744,
694824, 704496, 521040, 522912, 458640, 702936, 572832, 964080,
577200, 702624, 570960, 385008, 385008, 707304, 0, 0
}
},
{ "eurb5", 706752412, 5242880, { // 5210027634 5.00
868723,1168330,1393968,1247158,1009949,1243904,1082992,1182432,
1400115,1166883,1383482,1085523,1067805,1001994, 926781, 931120,
853376,1008864,1005610, 647264, 925696, 941606,1002355, 992954,
931482,1024413, 959325,1067805, 922803, 972704,1278618, 931120,
1215699,1399754, 863501, 994038,1350938, 0, 0,1209914,
0, 0, 0, 0, 0, 0, 0, 0,
885920, 885920, 885920, 885920, 885920, 885920, 885920, 885920,
885920, 885920, 588685, 588685, 658112, 888813, 655942, 0,
998739,1225462,1099626,1176285,1310800, 995485, 855546,1244989,
1258368, 777440, 773101,1126022, 971258,1624669,1337920,1289104,
1025136,1333942,1084800,1012480, 877200,1260538,1122928,1584973,
1113005, 926659,1108666, 0, 0, 0, 0, 0,
715968,1025136,1035261, 884474,1035261, 962941, 740557,1016819,
1024774, 663174, 658112, 959686, 664982,1418918,1032368,1034899,
1022243,1033453, 820832, 823002, 748512,1031645, 880858,1334304,
885920,1031283, 878688, 663174, 663174,1036707, 0, 0
}
},
{ "eurb6", -1573580899, 6291456, { // 24215207635 6.00
734453,1023896,1241880,1100051, 870888,1096907, 941453,1037520,
1247819,1022499,1231749, 943899, 926781, 863203, 790541, 794733,
719627, 869840, 866696, 520507, 789493, 804864, 863552, 854469,
795083, 884861, 821981, 926781, 786699, 834907,1130443, 794733,
1069659,1247469, 729408, 855517,1200309, 0, 0,1064069,
0, 0, 0, 0, 0, 0, 0, 0,
751067, 751067, 751067, 751067, 751067, 751067, 751067, 751067,
751067, 751067, 463915, 463915, 530987, 753861, 528891, 0,
860059,1079091, 957523,1031581,1161533, 856915, 721723,1097955,
1110880, 646267, 642075, 983024, 833509,1464755,1187733,1140573,
885560,1183891, 943200, 873333, 742643,1112976, 980035,1426405,
970448, 790424, 966256, 0, 0, 0, 0, 0,
586880, 885560, 895341, 749669, 895341, 825475, 610635, 877525,
885211, 535877, 530987, 822331, 537624,1265984, 892547, 894992,
882765, 893595, 688187, 690283, 618320, 891848, 746176,1184240,
751067, 891499, 744080, 535877, 535877, 896739, 0, 0
}
},
{ "eurb7", 1231305095, 7340032, { // 11131034607 7.00
681975, 964158,1176674,1038402, 814987,1035337, 883783, 977440,
1182464, 962795,1166798, 886167, 869479, 807495, 736656, 740743,
667520, 813966, 810901, 473394, 735634, 750619, 807835, 798981,
741083, 828610, 767307, 869479, 732910, 779909,1068032, 740743,
1008773,1182123, 677056, 800002,1136146, 0, 0,1003323,
0, 0, 0, 0, 0, 0, 0, 0,
698171, 698171, 698171, 698171, 698171, 698171, 698171, 698171,
698171, 698171, 418222, 418222, 483611, 700896, 481568, 0,
804430,1017968, 899449, 971650,1098343, 801365, 669563,1036359,
1048960, 596000, 591913, 924311, 778546,1393959,1123886,1077909,
829291,1120139, 885486, 817371, 689959,1051003, 921397,1356571,
912050, 736542, 907963, 0, 0, 0, 0, 0,
538103, 829291, 838827, 696809, 838827, 770713, 561262, 821458,
828951, 488379, 483611, 767648, 490082,1200174, 836103, 838487,
826567, 837125, 636869, 638912, 568754, 835422, 693403,1120480,
698171, 835081, 691360, 488379, 488379, 840190, 0, 0
}
},
{ "eurb8", -2144170547, 8388608, { // 20014506715 8.00
598412, 873492,1080660, 945868, 728076, 942880, 795140, 886440,
1086304, 872164,1071032, 797464, 781196, 720772, 651716, 655700,
584320, 727080, 724092, 395080, 650720, 665328, 721104, 712472,
656032, 741356, 681596, 781196, 648064, 693880, 974752, 655700,
916984,1085972, 593616, 713468,1041152, 0, 0, 911672,
0, 0, 0, 0, 0, 0, 0, 0,
614200, 614200, 614200, 614200, 614200, 614200, 614200, 614200,
614200, 614200, 341296, 341296, 405040, 616856, 403048, 0,
717784, 925948, 810412, 880796,1004300, 714796, 586312, 943876,
956160, 514600, 510616, 834648, 692552,1292476,1029200, 984380,
742020,1025548, 796800, 730400, 606196, 958152, 831808,1256030,
822696, 651606, 818712, 0, 0, 0, 0, 0,
458160, 742020, 751316, 612872, 751316, 684916, 480736, 734384,
741688, 409688, 405040, 681928, 411348,1103568, 748660, 750984,
739364, 749656, 554440, 556432, 488040, 747996, 609552,1025880,
614200, 747664, 607560, 409688, 409688, 752644, 0, 0
}
},
{ "eurb9", -2099972077, 9437184, { // 20265174023 9.00
573579, 837243,1035813, 906615, 697861, 903751, 762142, 849653,
1041223, 835970,1026585, 764370, 748777, 690860, 624670, 628489,
560071, 696907, 694043, 378684, 623716, 637717, 691179, 682905,
628807, 710590, 653310, 748777, 621170, 665084, 934300, 628489,
878930,1040905, 568981, 683860, 997945, 0, 0, 873838,
0, 0, 0, 0, 0, 0, 0, 0,
588711, 588711, 588711, 588711, 588711, 588711, 588711, 588711,
588711, 588711, 327132, 327132, 388231, 591257, 386322, 0,
687996, 887522, 776780, 844244, 962622, 685132, 561980, 904706,
916480, 493244, 489426, 800011, 663812,1238839, 986489, 943529,
711227, 982988, 763733, 700089, 581040, 918389, 797289,1203906,
788555, 624565, 784736, 0, 0, 0, 0, 0,
439147, 711227, 720137, 587438, 720137, 656492, 460786, 703908,
710908, 392686, 388231, 653628, 394277,1057771, 717591, 719819,
708681, 718546, 531431, 533340, 467787, 716955, 584256, 983307,
588711, 716636, 582347, 392686, 392686, 721410, 0, 0
}
},
{ "eurm10", 586924345, 10485760, { // 4276740471 10.0
449405, 747931, 794376, 808253, 625022, 757843, 677981, 751046,
873672, 737453, 918134, 690442, 694690, 638050, 525336, 576878,
536947, 587357, 581126, 351168, 582259, 568099, 647678, 628421,
579994, 638616, 574613, 634651, 538930, 615677, 762941, 604632,
790978, 892363, 510043, 578861, 918418, 0, 0, 800323,
0, 0, 0, 0, 0, 0, 0, 0,
523920, 523920, 523920, 523920, 523920, 523920, 523920, 523920,
523920, 523920, 291130, 291130, 792960, 526186, 792960, 0,
587640, 807970, 687326, 749347, 868574, 634368, 523637, 802589,
821280, 413472, 421685, 701203, 586224,1094851, 869990, 842237,
604066, 869141, 638616, 584242, 516806, 811934, 677602,1034371,
698371, 582101, 698938, 0, 0, 0, 0, 0,
407242, 638616, 617093, 510610, 633235, 523920, 440376, 596419,
651926, 377506, 348053, 582826, 383170, 960331, 696672, 590755,
618226, 634934, 453120, 478042, 436978, 673733, 519672, 851582,
551674, 622757, 493618, 349186, 348053, 633802, 0, 0
}
},
{ "eurm5", 926664423, 5242880, { // 6716743347 5.00
741798,1099347,1154976,1171597, 952134,1111219,1015565,1103078,
1249952,1086797,1303206,1030490,1035578, 967738, 832736, 894470,
846643, 907021, 899558, 624128, 900915, 883955, 979270, 956205,
898202, 968416, 891757, 963667, 849018, 940941,1117325, 927712,
1150906,1272339, 814419, 896845,1303546, 0, 0,1162099,
0, 0, 0, 0, 0, 0, 0, 0,
831040, 831040, 831040, 831040, 831040, 831040, 831040, 831040,
831040, 831040, 552218, 552218,1153280, 833754,1153280, 0,
907360,1171258,1026758,1101043,1243846, 963328, 830701,1164813,
1187200, 698752, 708589,1043379, 905664,1514867,1245542,1212301,
927034,1244525, 968416, 903290, 822528,1176006,1015117,1442432,
1039987, 900730,1040666, 0, 0, 0, 0, 0,
691290, 968416, 942637, 815098, 961971, 831040, 730976, 917875,
984358, 655674, 620397, 901594, 662458,1353747,1037952, 911091,
943994, 964006, 746240, 776090, 726906,1010477, 825952,1223494,
864282, 949421, 794746, 621754, 620397, 962650, 0, 0
}
},
{ "eurm6", -468944857, 6291456, { // 34403074047 6.00
618896, 964648,1018440,1034512, 822296, 976128, 883632, 968256,
1110280, 952512,1161776, 898064, 902984, 837384, 706840, 766536,
720288, 778672, 771456, 505120, 772768, 756368, 848536, 826232,
770144, 838040, 763912, 833448, 722584, 811472, 982032, 798680,
1014504,1131928, 689128, 768832,1162104, 0, 0,1025328,
0, 0, 0, 0, 0, 0, 0, 0,
705200, 705200, 705200, 705200, 705200, 705200, 705200, 705200,
705200, 705200, 435584, 435584,1016800, 707824,1016800, 0,
779000,1034184, 894456, 966288,1104376, 833120, 704872,1027952,
1049600, 577280, 586792, 910528, 777360,1366448,1106016,1073872,
798024,1105032, 838040, 775064, 696960,1038776, 883192,1296400,
907248, 772584, 907904, 0, 0, 0, 0, 0,
570064, 838040, 813112, 689784, 831808, 705200, 608440, 789168,
853456, 535624, 501512, 773424, 542184,1210648, 905280, 782608,
814424, 833776, 623200, 652064, 604504, 878712, 700280,1084696,
737344, 819672, 670104, 502824, 501512, 832464, 0, 0
}
},
{ "eurm7", -88373412, 7340032, { // 37256703534 7.00
571803, 909120, 961600, 977280, 770240, 920320, 830080, 912640,
1051200, 897280,1101440, 844160, 848960, 784960, 657600, 715840,
670720, 727680, 720640, 460800, 721920, 705920, 795840, 774080,
719360, 785600, 713280, 781120, 672960, 759680, 926080, 747200,
957760,1072320, 640320, 718080,1101760, 0, 0, 968320,
0, 0, 0, 0, 0, 0, 0, 0,
656000, 656000, 656000, 656000, 656000, 656000, 656000, 656000,
656000, 656000, 392960, 392960, 960000, 658560, 960000, 0,
728000, 976960, 840640, 910720,1045440, 780800, 655680, 970880,
992000, 531200, 540480, 856320, 726400,1301120,1047040,1015680,
746560,1046080, 785600, 724160, 647963, 981440, 829653,1232782,
853120, 721742, 853760, 0, 0, 0, 0, 0,
524160, 785600, 761280, 640960, 779520, 656000, 561600, 737920,
800640, 490560, 457280, 722560, 496960,1149120, 851200, 731520,
762560, 781440, 576000, 604160, 557760, 825280, 651200,1026240,
687360, 767680, 621760, 458560, 457280, 780160, 0, 0
}
},
{ "eurm8", 2026293814, 8388608, { // 17061545066 8.00
485588, 808146, 858330, 873324, 675342, 818856, 732564, 811512,
944010, 796824, 992052, 746028, 750618, 689418, 567630, 623322,
580176, 634644, 627912, 379440, 629136, 613836, 699822, 679014,
626688, 690030, 620874, 685746, 582318, 665244, 824364, 653310,
854658, 964206, 551106, 625464, 992358, 0, 0, 864756,
0, 0, 0, 0, 0, 0, 0, 0,
566100, 566100, 566100, 566100, 566100, 566100, 566100, 566100,
566100, 566100, 314568, 314568, 856800, 568548, 856800, 0,
634950, 873018, 742662, 809676, 938502, 685440, 565794, 867204,
887400, 446760, 455634, 757656, 633420,1182996, 940032, 910044,
652698, 939114, 690030, 631278, 558416, 877302, 732156,1117648,
754596, 628966, 755208, 0, 0, 0, 0, 0,
440028, 690030, 666774, 551718, 684216, 566100, 475830, 644436,
704412, 407898, 376074, 629748, 414018,1037646, 752760, 638316,
667998, 686052, 489600, 516528, 472158, 727974, 561510, 920142,
596088, 672894, 533358, 377298, 376074, 684828, 0, 0
}
},
{ "eurm9", -1792823819, 9437184, { // 22510726765 9.00
462663, 769998, 817813, 832100, 643463, 780203, 697984, 773205,
899449, 759211, 945223, 710812, 715186, 656875, 540836, 593899,
552789, 604686, 598272, 361529, 599438, 584860, 666788, 646962,
597106, 657458, 591566, 653376, 554830, 633842, 785451, 622471,
814315, 918692, 525092, 595940, 945515, 0, 0, 823936,
0, 0, 0, 0, 0, 0, 0, 0,
539378, 539378, 539378, 539378, 539378, 539378, 539378, 539378,
539378, 539378, 299719, 299719, 816356, 541710, 816356, 0,
604978, 831808, 707605, 771456, 894201, 653084, 539086, 826268,
845511, 425671, 434126, 721892, 603520,1127154, 895659, 867086,
621888, 894784, 657458, 601479, 532053, 835890, 697593,1064889,
718976, 599275, 719559, 0, 0, 0, 0, 0,
419257, 657458, 635300, 525675, 651918, 539378, 453369, 614016,
671161, 388644, 358322, 600021, 394475, 988665, 717227, 608185,
636466, 653668, 466489, 492146, 449870, 693611, 535004, 876708,
567950, 641131, 508181, 359488, 358322, 652501, 0, 0
}
},
{ "eusb10", -1332376429, 10485760, { // 26045306223 10.0
896000, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
653440, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 810880, 0, 981120, 656960, 0, 0,
917760, 928960, 906240, 713920, 984000, 720640, 792000, 716160,
1048000, 590720, 599680, 975040, 847680,1163840, 917120, 838400,
782720, 802560, 856320, 627840, 685760, 838080, 787520,1172160,
849280, 713920, 778240, 0, 0, 0, 918400, 918400,
0, 0, 0, 0, 0, 0, 379200, 379200,
0, 0, 252800, 0, 0, 0, 594560, 0,
0, 0, 0, 0, 0, 0, 0, 0,
610240, 0, 0, 0, 0, 0, 0, 0
}
},
{ "eusb5", 689891563, 5242880, { // 5107564353 5.00
1229440, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
955347, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0,1133254, 0,1325626, 959325, 0, 0,
1254029,1266685,1241011,1023690,1328880,1031283,1111920,1026221,
1401200, 884474, 894598,1318755,1174838,1532099,1253306,1164352,
1101434,1123853,1184602, 926419, 991869,1163990,1106858,1541501,
1176646,1023690,1096371, 0, 0, 0,1254752,1254752,
0, 0, 0, 0, 0, 0, 645456, 645456,
0, 0, 502624, 0, 0, 0, 888813, 0,
0, 0, 0, 0, 0, 0, 0, 0,
906531, 0, 0, 0, 0, 0, 0, 0
}
},
{ "eusb6", -1896571298, 6291456, { // 21675117136 6.00
1091200, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
824384, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 997568, 0,1184832, 828256, 0, 0,
1115136,1127456,1102464, 890912,1188000, 898304, 976800, 893376,
1258400, 755392, 765248,1178144,1038048,1385824,1114432,1027840,
966592, 988416,1047552, 796224, 859936,1027488, 971872,1394976,
1039808, 890912, 961664, 0, 0, 0,1115840,1115840,
0, 0, 0, 0, 0, 0, 522720, 522720,
0, 0, 383680, 0, 0, 0, 759616, 0,
0, 0, 0, 0, 0, 0, 0, 0,
776864, 0, 0, 0, 0, 0, 0, 0
}
},
{ "eusb7", -611365609, 7340032, { // 33343646427 7.00
1028571, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
768686, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 937371, 0,1119771, 772457, 0, 0,
1051886,1063886,1039543, 833486,1122857, 840686, 917143, 835886,
1191429, 701486, 711086,1113257, 976800,1315543,1051200, 966857,
907200, 928457, 986057, 741257, 803314, 966514, 912343,1324457,
978514, 833486, 902400, 0, 0, 0,1052571,1052571,
0, 0, 0, 0, 0, 0, 474857, 474857,
0, 0, 339429, 0, 0, 0, 705600, 0,
0, 0, 0, 0, 0, 0, 0, 0,
722400, 0, 0, 0, 0, 0, 0, 0
}
},
{ "eusb8", 1734325818, 8388608, { // 14727733072 8.00
935200, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
682028, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 846356, 0,1024044, 685702, 0, 0,
957912, 969602, 945888, 745154,1027050, 752168, 826650, 747492,
1093850, 616564, 625916,1017698, 884766,1214758, 957244, 875080,
816964, 837672, 893784, 655308, 715762, 874746, 821974,1223442,
886436, 745154, 812288, 0, 0, 0, 958580, 958580,
0, 0, 0, 0, 0, 0, 395790, 395790,
0, 0, 263860, 0, 0, 0, 620572, 0,
0, 0, 0, 0, 0, 0, 0, 0,
636938, 0, 0, 0, 0, 0, 0, 0
}
},
{ "eusb9", 512982202, 9437184, { // 3644676272 9.00
910933, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
664331, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 824395, 0, 997472, 667909, 0, 0,
933056, 944443, 921344, 725819,1000400, 732651, 805200, 728096,
1065467, 600565, 609675, 991291, 861808,1183237, 932405, 852373,
795765, 815936, 870592, 638304, 697189, 852048, 800645,1191696,
863435, 725819, 791211, 0, 0, 0, 933707, 933707,
0, 0, 0, 0, 0, 0, 385520, 385520,
0, 0, 257013, 0, 0, 0, 604469, 0,
0, 0, 0, 0, 0, 0, 0, 0,
620411, 0, 0, 0, 0, 0, 0, 0
}
},
{ "eusm10", 1280485294, 10485760, { // 11424523656 10.0
792960, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
578294, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 717629, 0, 868291, 581410, 0, 0,
812218, 807970, 798058, 631819, 870840, 637766, 680813, 633802,
927480, 451704, 530717, 862910, 750197,1029998, 811651, 741984,
692707, 694690, 757843, 568382, 615394, 748781, 696955,1037362,
751613, 624739, 688742, 0, 0, 0, 812784, 812784,
0, 0, 0, 0, 0, 0, 335592, 335592,
0, 0, 223728, 0, 0, 0, 526186, 0,
0, 0, 0, 0, 0, 0, 0, 0,
540062, 0, 0, 0, 0, 0, 0, 0
}
},
{ "eusm5", -1810016425, 5242880, { // 22407253527 5.00
1153280, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
896166, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0,1063053, 0,1243507, 899898, 0, 0,
1176346,1171258,1159386, 960275,1246560, 967398,1018957, 962650,
1314400, 744544, 839181,1237062,1102061,1437190,1175667,1092224,
1033203,1035578,1111219, 884294, 940602,1100365,1038291,1446010,
1103757, 951795,1028454, 0, 0, 0,1177024,1177024,
0, 0, 0, 0, 0, 0, 605472, 605472,
0, 0, 471488, 0, 0, 0, 833754, 0,
0, 0, 0, 0, 0, 0, 0, 0,
850374, 0, 0, 0, 0, 0, 0, 0
}
},
{ "eusm6", -65501254, 6291456, { // 37406103672 6.00
1016800, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
768176, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 929552, 0,1104048, 771784, 0, 0,
1039104,1034184,1022704, 830168,1107000, 837056, 886912, 832464,
1172600, 621560, 713072,1097816, 967272,1291336,1038448, 957760,
900688, 902984, 976128, 756696, 811144, 965632, 905608,1299864,
968912, 821968, 896096, 0, 0, 0,1039760,1039760,
0, 0, 0, 0, 0, 0, 487080, 487080,
0, 0, 357520, 0, 0, 0, 707824, 0,
0, 0, 0, 0, 0, 0, 0, 0,
723896, 0, 0, 0, 0, 0, 0, 0
}
},
{ "eusm7", 1779696870, 7340032, { // 15205002346 7.00
960000, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
717440, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 874880, 0,1045120, 720960, 0, 0,
981760, 976960, 965760, 777920,1048000, 784640, 833280, 780160,
1112000, 574400, 663680,1039040, 911680,1227840, 981120, 902400,
846720, 848960, 920320, 706240, 759360, 910080, 851520,1236160,
913280, 769920, 842240, 0, 0, 0, 982400, 982400,
0, 0, 0, 0, 0, 0, 443200, 443200,
0, 0, 316800, 0, 0, 0, 658560, 0,
0, 0, 0, 0, 0, 0, 0, 0,
674240, 0, 0, 0, 0, 0, 0, 0
}
},
{ "eusm8", -1561757812, 8388608, { // 24272273614 8.00
862400, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
628936, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 780472, 0, 944328, 632324, 0, 0,
883344, 878724, 867944, 687148, 947100, 693616, 740432, 689304,
1008700, 491260, 577192, 938476, 815892,1120196, 882728, 806960,
753368, 755524, 824208, 618156, 669284, 814352, 757988,1128204,
817432, 679448, 749056, 0, 0, 0, 883960, 883960,
0, 0, 0, 0, 0, 0, 364980, 364980,
0, 0, 243320, 0, 0, 0, 572264, 0,
0, 0, 0, 0, 0, 0, 0, 0,
587356, 0, 0, 0, 0, 0, 0, 0
}
},
{ "eusm9", 1977502424, 9437184, { // 16567445330 9.00
826311, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
602617, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 747812, 0, 904811, 605863, 0, 0,
846379, 841952, 831623, 658393, 907467, 664590, 709447, 660459,
966489, 470702, 553038, 899204, 781749,1073319, 845788, 773191,
721842, 723908, 789717, 592288, 641276, 780274, 726268,1080992,
783225, 651015, 717710, 0, 0, 0, 846969, 846969,
0, 0, 0, 0, 0, 0, 349707, 349707,
0, 0, 233138, 0, 0, 0, 548316, 0,
0, 0, 0, 0, 0, 0, 0, 0,
562777, 0, 0, 0, 0, 0, 0, 0
}
},
{ "msam10", -1749815603, 10485760, { // 22754767315 10.0
815562, 815562, 815562, 815562, 815562, 291272, 699053, 699053,
815562, 815562,1048579,1048579, 815562, 757307, 932070, 640798,
1048579,1048579,1048579,1048579, 873816, 873816, 436909, 436909,
436909, 436909,1165088,1165088,1048579,1048579, 524290, 524290,
1048579,1456360,1048579,1048579, 815562, 815562, 815562, 815562,
1165088, 699053, 699053, 815562, 815562, 815562, 815562, 815562,
815562, 815562, 815562, 815562, 815562, 815562, 815562, 815562,
288358, 524290, 815562, 815562, 815562, 815562, 815562, 815562,
815562, 815562, 815562, 815562, 815562, 815562, 990323, 524290,
757307, 815562, 815562, 524290, 524290, 757307, 757307, 757307,
815562, 815562, 815562, 815562, 815562, 786434,1048579,1048579,
873816, 640798, 640798, 640798, 757307, 757307, 757307, 815562,
815562, 815562, 815562, 815562, 699053, 699053, 797355, 797355,
815562, 815562, 815562, 815562, 815562, 815562,1398106,1398106,
524290, 524290, 992648, 946045, 699053, 815562, 815562, 815562,
524290, 524290, 873816, 524290, 582544, 815562, 815562, 815562
}
},
{ "msam5", 579411064, 5242880, { // 4242216170 5.00
1135974,1135974,1135974,1135974,1135974, 480602, 990336, 990336,
1135974,1135974,1427251,1427251,1135974,1063155,1281613, 917517,
1427251,1427251,1427251,1427251,1208794,1208794, 662650, 662650,
662650, 662650,1572890,1572890,1427251,1427251, 771878, 771878,
1427251,1936986,1427251,1427251,1135974,1135974,1135974,1135974,
1572890, 990336, 990336,1135974,1019469,1135974,1135974,1135974,
1135974,1135974,1135974,1135974,1135974,1135974,1135974,1135974,
462397, 655373,1135974,1135974,1135974,1135974,1135974,1135974,
1135974,1135974,1135974,1135974,1135974,1135974,1121395, 771878,
917507,1135974,1135974, 655373, 655373, 917507, 917507, 917507,
1135974,1135974,1135974,1135974,1135974,1086458,1427251,1427251,
1208794, 917517, 917517, 917517,1063155,1063155,1063155,1135974,
1135974,1135974,1135974,1135974, 990336, 990336,1084986,1084986,
1135974,1135974,1135974,1135974,1135974,1135974,1864166,1864166,
771878, 771878,1086458,1036941, 990336,1135974,1135974,1135974,
771878, 771878,1208794, 771878, 844698,1135974,1135974,1135974
}
},
{ "msam6", 205908534, 6291456, { // 1421365066 6.00
1009733,1009733,1009733,1009733,1009733, 398069, 873808, 873808,
1009733,1009733,1281584,1281584,1009733, 941771,1145659, 805845,
1281584,1281584,1281584,1281584,1077696,1077696, 567976, 567976,
567976, 567976,1417509,1417509,1281584,1281584, 669920, 669920,
1281584,1757323,1281584,1281584,1009733,1009733,1009733,1009733,
1417509, 873808, 873808,1009733, 951477,1009733,1009733,1009733,
1009733,1009733,1009733,1009733,1009733,1009733,1009733,1009733,
383507, 611664,1009733,1009733,1009733,1009733,1009733,1009733,
1009733,1009733,1009733,1009733,1009733,1009733,1058288, 669920,
844688,1009733,1009733, 611664, 611664, 844688, 844688, 844688,
1009733,1009733,1009733,1009733,1009733, 968955,1281584,1281584,
1077696, 805845, 805845, 805845, 941771, 941771, 941771,1009733,
1009733,1009733,1009733,1009733, 873808, 873808, 984739, 984739,
1009733,1009733,1009733,1009733,1009733,1009733,1689360,1689360,
669920, 669920,1058261,1009717, 873808,1009733,1009733,1009733,
669920, 669920,1077696, 669920, 737883,1009733,1009733,1009733
}
},
{ "msam7", -1200230857, 7340032, { // 27035367067 7.00
936233, 936233, 936233, 936233, 936233, 355769, 807241, 807241,
936233, 936233,1194217,1194217, 936233, 871737,1065225, 742745,
1194217,1194217,1194217,1194217,1000729,1000729, 517010, 517010,
517010, 517010,1323209,1323209,1194217,1194217, 613753, 613753,
1194217,1645689,1194217,1194217, 936233, 936233, 936233, 936233,
1323209, 807241, 807241, 936233, 902944, 936233, 936233, 936233,
936233, 936233, 936233, 936233, 936233, 936233, 936233, 936233,
345365, 580464, 936233, 936233, 936233, 936233, 936233, 936233,
936233, 936233, 936233, 936233, 936233, 936233,1029856, 613753,
809321, 936233, 936233, 580464, 580464, 809321, 809321, 809321,
936233, 936233, 936233, 936233, 936233, 900866,1194217,1194217,
1000729, 742745, 742745, 742745, 871737, 871737, 871737, 936233,
936233, 936233, 936233, 936233, 807241, 807241, 923333, 923333,
936233, 936233, 936233, 936233, 936233, 936233,1581193,1581193,
613753, 613753,1038169, 990318, 807241, 936233, 936233, 936233,
613753, 613753,1000729, 613753, 678249, 936233, 936233, 936233
}
},
{ "msam8", -1353038669, 8388608, { // 25726442263 8.00
866544, 866544, 866544, 866544, 866544, 309480, 742752, 742752,
866544, 866544,1114128,1114128, 866544, 804648, 990336, 680856,
1114128,1114128,1114128,1114128, 928440, 928440, 464220, 464220,
464220, 464220,1237920,1237920,1114128,1114128, 557064, 557064,
1114128,1547400,1114128,1114128, 866544, 866544, 866544, 866544,
1237920, 742752, 742752, 866544, 866544, 866544, 866544, 866544,
866544, 866544, 866544, 866544, 866544, 866544, 866544, 866544,
302194, 557064, 866544, 866544, 866544, 866544, 866544, 866544,
866544, 866544, 866544, 866544, 866544, 866544, 993964, 557064,
768232, 866544, 866544, 557064, 557064, 768232, 768232, 768232,
866544, 866544, 866544, 866544, 866544, 834504,1114128,1114128,
928440, 680856, 680856, 680856, 804648, 804648, 804648, 866544,
866544, 866544, 866544, 866544, 742752, 742752, 857068, 857068,
866544, 866544, 866544, 866544, 866544, 866544,1485504,1485504,
557064, 557064,1023100, 975768, 742752, 866544, 866544, 866544,
557064, 557064, 928440, 557064, 618960, 866544, 866544, 866544
}
},
{ "msam9", -743339001, 9437184, { // 32354306007 9.00
838208, 838208, 838208, 838208, 838208, 299360, 718464, 718464,
838208, 838208,1077696,1077696, 838208, 778336, 957952, 658592,
1077696,1077696,1077696,1077696, 898080, 898080, 449040, 449040,
449040, 449040,1197440,1197440,1077696,1077696, 538848, 538848,
1077696,1496800,1077696,1077696, 838208, 838208, 838208, 838208,
1197440, 718464, 718464, 838208, 838208, 838208, 838208, 838208,
838208, 838208, 838208, 838208, 838208, 838208, 838208, 838208,
292889, 538848, 838208, 838208, 838208, 838208, 838208, 838208,
838208, 838208, 838208, 838208, 838208, 838208, 991940, 538848,
762160, 838208, 838208, 538848, 538848, 762160, 762160, 762160,
838208, 838208, 838208, 838208, 838208, 808110,1077696,1077696,
898080, 658592, 658592, 658592, 778336, 778336, 778336, 838208,
838208, 838208, 838208, 838208, 718464, 718464, 826398, 826398,
838208, 838208, 838208, 838208, 838208, 838208,1436928,1436928,
538848, 538848,1008107, 961180, 718464, 838208, 838208, 838208,
538848, 538848, 898080, 538848, 598720, 838208, 838208, 838208
}
},
{ "msbm10", -2001332536, 10485760, { // 21055413310 10.0
815562, 815562, 815562, 815562, 815562, 815562, 815562, 815562,
815562, 815562, 815562, 815562, 815562, 815562, 815562, 815562,
815562, 815562, 815562, 815562, 815562, 815562, 815562, 815562,
815562, 815562, 815562, 815562, 815562, 815562, 932070, 932070,
815562, 815562, 815562, 815562, 815562, 815562, 815562, 815562,
815562, 815562, 815562, 815562, 524290, 291272, 233018, 407781,
640798, 757307, 640798, 757307, 815562, 815562, 815562, 815562,
1048579,1048579,1048579,1048579,1048579,1048579, 815562, 815562,
582544, 757307, 699053, 757307, 757307, 699053, 640798, 815562,
815562, 407781, 524290, 815562, 699053, 990325, 757307, 815562,
640798, 815562, 757307, 582544, 699053, 757307, 757307,1048579,
757307, 757307, 699053,1980650,2446685,1980650,2446685, 0,
582544, 669925, 0, 0, 0, 0, 757307, 582544,
815562, 699053, 466035, 699053, 815562, 815562, 815562, 815562,
233018, 407781, 815562, 815562, 815562, 815562, 815562, 815562,
1048579,1048579, 815562, 699053, 582544, 566525, 566525, 450016
}
},
{ "msbm5", -34201321, 5242880, { // 37575420427 5.00
1135974,1135974,1135974,1135974,1135974,1135974,1135974,1135974,
1135974,1135974,1135974,1135974,1135974,1135974,1135974,1135974,
1135974,1135974,1135974,1135974,1135974,1135974,1135974,1135974,
1135974,1135974,1135974,1135974,1135974,1135974,1281613,1281613,
1135974,1135974,1135974,1135974,1135974,1135974,1135974,1135974,
1135974,1135974,1135974,1135974, 771878, 480602, 407782, 626240,
917517,1063155, 917517,1063155,1135974,1135974,1135974,1135974,
1427251,1427251,1427251,1427251,1427251,1427251,1135974,1135974,
844698, 757286, 699034, 757286, 757286, 699034, 640781, 815539,
815539, 407770, 524275, 815539, 699034, 990298, 757286, 815539,
640781, 815539, 757286, 582528, 699034, 757286, 757286,1048550,
757286, 757286, 699034,2592358,3174912,2592358,3174912, 0,
844698, 953926, 0, 0, 0, 0,1063155, 844698,
1135974, 990336, 699059, 990336,1135974,1135974,1135974,1135974,
407782, 626240,1135974,1135974,1135974,1135974,1135974,1135974,
1427251,1427251,1135974, 990336, 582528, 830134, 830134, 677213
}
},
{ "msbm6", 1327105067, 6291456, { // 11706402053 6.00
1009733,1009733,1009733,1009733,1009733,1009733,1009733,1009733,
1009733,1009733,1009733,1009733,1009733,1009733,1009733,1009733,
1009733,1009733,1009733,1009733,1009733,1009733,1009733,1009733,
1009733,1009733,1009733,1009733,1009733,1009733,1145659,1145659,
1009733,1009733,1009733,1009733,1009733,1009733,1009733,1009733,
1009733,1009733,1009733,1009733, 669920, 398069, 330107, 533995,
805845, 941771, 805845, 941771,1009733,1009733,1009733,1009733,
1281584,1281584,1281584,1281584,1281584,1281584,1009733,1009733,
737883, 757293, 699040, 757293, 757293, 699040, 640787, 815547,
815547, 407773, 524280, 815547, 699040, 990307, 757293, 815547,
640787, 815547, 757293, 582533, 699040, 757293, 757293,1048560,
757293, 757293, 699040,2368987,2912688,2368987,2912688, 0,
737883, 839827, 0, 0, 0, 0, 941771, 737883,
1009733, 873808, 601957, 873808,1009733,1009733,1009733,1009733,
330107, 533995,1009733,1009733,1009733,1009733,1009733,1009733,
1281584,1281584,1009733, 873808, 582533, 723320, 723320, 582541
}
},
{ "msbm7", 1903804545, 7340032, { // 16136340201 7.00
936233, 936233, 936233, 936233, 936233, 936233, 936233, 936233,
936233, 936233, 936233, 936233, 936233, 936233, 936233, 936233,
936233, 936233, 936233, 936233, 936233, 936233, 936233, 936233,
936233, 936233, 936233, 936233, 936233, 936233,1065225,1065225,
936233, 936233, 936233, 936233, 936233, 936233, 936233, 936233,
936233, 936233, 936233, 936233, 613753, 355769, 291273, 484761,
742745, 871737, 742745, 871737, 936233, 936233, 936233, 936233,
1194217,1194217,1194217,1194217,1194217,1194217, 936233, 936233,
678249, 757298, 699045, 757298, 757298, 699045, 640791, 815552,
815552, 407776, 524283, 815552, 699045, 990313, 757298, 815552,
640791, 815552, 757298, 582537, 699045, 757298, 757298,1048567,
757298, 757298, 699045,2226153,2742121,2226153,2742121, 0,
678249, 774992, 0, 0, 0, 0, 871737, 678249,
936233, 807241, 549257, 807241, 936233, 936233, 936233, 936233,
291273, 484761, 936233, 936233, 936233, 936233, 936233, 936233,
1194217,1194217, 936233, 807241, 582537, 663687, 663687, 531573
}
},
{ "msbm8", 1892315340, 8388608, { // 16062470314 8.00
866544, 866544, 866544, 866544, 866544, 866544, 866544, 866544,
866544, 866544, 866544, 866544, 866544, 866544, 866544, 866544,
866544, 866544, 866544, 866544, 866544, 866544, 866544, 866544,
866544, 866544, 866544, 866544, 866544, 866544, 990336, 990336,
866544, 866544, 866544, 866544, 866544, 866544, 866544, 866544,
866544, 866544, 866544, 866544, 557064, 309480, 247584, 433272,
680856, 804648, 680856, 804648, 866544, 866544, 866544, 866544,
1114128,1114128,1114128,1114128,1114128,1114128, 866544, 866544,
618960, 757302, 699048, 757302, 757302, 699048, 640794, 815556,
815556, 407778, 524286, 815556, 699048, 990318, 757302, 815556,
640794, 815556, 757302, 582540, 699048, 757302, 757302,1048572,
757302, 757302, 699048,2104464,2599632,2104464,2599632, 0,
618960, 711804, 0, 0, 0, 0, 804648, 618960,
866544, 742752, 495168, 742752, 866544, 866544, 866544, 866544,
247584, 433272, 866544, 866544, 866544, 866544, 866544, 866544,
1114128,1114128, 866544, 742752, 582540, 604396, 604396, 478784
}
},
{ "msbm9", -1442794143, 9437184, { // 25200132541 9.00
838208, 838208, 838208, 838208, 838208, 838208, 838208, 838208,
838208, 838208, 838208, 838208, 838208, 838208, 838208, 838208,
838208, 838208, 838208, 838208, 838208, 838208, 838208, 838208,
838208, 838208, 838208, 838208, 838208, 838208, 957952, 957952,
838208, 838208, 838208, 838208, 838208, 838208, 838208, 838208,
838208, 838208, 838208, 838208, 538848, 299360, 239488, 419104,
658592, 778336, 658592, 778336, 838208, 838208, 838208, 838208,
1077696,1077696,1077696,1077696,1077696,1077696, 838208, 838208,
598720, 757305, 699051, 757305, 757305, 699051, 640796, 815559,
815559, 407780, 524288, 815559, 699051, 990322, 757305, 815559,
640796, 815559, 757305, 582542, 699051, 757305, 757305,1048576,
757305, 757305, 699051,2035648,2514624,2035648,2514624, 0,
598720, 688528, 0, 0, 0, 0, 778336, 598720,
838208, 718464, 478976, 718464, 838208, 838208, 838208, 838208,
239488, 419104, 838208, 838208, 838208, 838208, 838208, 838208,
1077696,1077696, 838208, 718464, 582542, 583348, 583348, 462795
}
},
{nullptr, 0, 0, {0}}
};
// End of cmfont-widths.cpp
| 67.169271
| 76
| 0.577626
|
arthurcnorman
|
cf29e2709db8fc6534b8a061cdd3efeb43d6beff
| 1,214
|
cpp
|
C++
|
examples/zoo/main.cpp
|
sinkarl/asp_db
|
8dc5b40257b438872a689f5894416ae80db7d7ca
|
[
"MIT"
] | null | null | null |
examples/zoo/main.cpp
|
sinkarl/asp_db
|
8dc5b40257b438872a689f5894416ae80db7d7ca
|
[
"MIT"
] | null | null | null |
examples/zoo/main.cpp
|
sinkarl/asp_db
|
8dc5b40257b438872a689f5894416ae80db7d7ca
|
[
"MIT"
] | null | null | null |
/**
* asp_db - db api of the project 'asp_therm'
* ===================================================================
* * zoo_example main *
* ===================================================================
*
* Copyright (c) 2020 Mishutinski Yurii
*
* This library is distributed under the MIT License.
* See LICENSE file in the project root for full license information.
*/
#include "Logging.h"
#include "animals.h"
#include "db_connection.h"
#include "db_connection_manager.h"
#include "zoo_tables.h"
#include <iostream>
#include <assert.h>
using namespace asp_db;
db_parameters get_parameters() {
db_parameters d;
d.is_dry_run = false;
d.supplier = db_client::POSTGRESQL;
d.name = "zoo";
d.username = "stephen";
d.password = "crocodile_hunter";
d.host = "127.0.0.1";
d.port = 5432;
return d;
}
int test_table() {
auto dp = get_parameters();
assert(0 && "dbm input not null");
DBConnectionManager dbm(nullptr);
mstatus_t st = dbm.ResetConnectionParameters(dp);
if (!is_status_ok(st)) {
std::cout << "reset connection error: " << dbm.GetErrorMessage();
return -1;
}
}
int main(int argc, char* argv[]) {
Logging::InitDefault();
return test_table();
}
| 23.803922
| 70
| 0.602142
|
sinkarl
|
cf2a9d7eea9ebb6abe5e6acffcfa85a09a4458f3
| 115
|
cpp
|
C++
|
tests/main.cpp
|
maksym-lepekh/cpp-primitivo
|
a39a3ccbf6a13427406a56ab9a1a3938555c61ee
|
[
"MIT"
] | null | null | null |
tests/main.cpp
|
maksym-lepekh/cpp-primitivo
|
a39a3ccbf6a13427406a56ab9a1a3938555c61ee
|
[
"MIT"
] | null | null | null |
tests/main.cpp
|
maksym-lepekh/cpp-primitivo
|
a39a3ccbf6a13427406a56ab9a1a3938555c61ee
|
[
"MIT"
] | null | null | null |
#include <primitivo/p.hpp>
#include <iostream>
int main()
{
std::cout << p::text << std::endl;
return 0;
}
| 14.375
| 38
| 0.591304
|
maksym-lepekh
|
cf2dce3a11a3bc2cafa1bdffaf40e28ea4e62b8d
| 2,780
|
hpp
|
C++
|
sdk/include/xcLayerSheet.hpp
|
qianxj/XExplorer
|
00e326da03ffcaa21115a2345275452607c6bab5
|
[
"MIT"
] | null | null | null |
sdk/include/xcLayerSheet.hpp
|
qianxj/XExplorer
|
00e326da03ffcaa21115a2345275452607c6bab5
|
[
"MIT"
] | null | null | null |
sdk/include/xcLayerSheet.hpp
|
qianxj/XExplorer
|
00e326da03ffcaa21115a2345275452607c6bab5
|
[
"MIT"
] | null | null | null |
#pragma once
#include "commctrl.h"
#include "xframe.h"
#include "vector"
namespace Hxsoft{ namespace XFrame
{
#define XTabStyle int;
#define XTabState int;
#define LYSN_PRESELECTSHEET 0x0001;
#define LYSN_SELECTEDSHEET 0x0002;
#define LYSN_CLOSESHEET 0x0003;
struct LYSNMHDR : public NMHDR
{
int nSheet;
};
class XLayers;
class XCONTROL_API xcLayerSheet : public xfControl
{
public:
enum XTabDrawStyle{tdsRoundRect,tdsRoundRectEx,tdsShape,tdsEclips,tdsEclipsEx,tdsCanClose};
enum XTabArraow{taTop,taBottom,taLeft,taRight};
enum sheetState{_hidden, _show};
public:
xcLayerSheet(void);
~xcLayerSheet(void);
public:
XLayers* m_pLayer;
RECT FRect;
int m_iCurSheet;
int m_iStartSheet;
LPTSTR * m_pSheets;
int * m_pSheetsImage;
int m_SheetSize;
int m_SheetAllocSize;
int * m_pWidths;
HIMAGELIST m_hImageList;
int m_cxImage;
int m_cyImage;
XTabArraow m_TabArrow;
XTabDrawStyle m_TabDrawStyle;
public:
int AddSheet(LPTSTR pSheet,int iImage = -1,bool bToCurrent = false);
int InsertSheet(int iPos,LPTSTR pSheet,int iImage=-1,bool bToCurrent = false);
int RemoveSheet(int iPos);
int Clear();
int MoveSheet(int From,int To);
int AppendSheetAlloc(int inc);
int GetSheetCount();
public:
void SetImageList(HIMAGELIST hImageList){m_hImageList = hImageList;}
HIMAGELIST GetImageList(){return m_hImageList;}
void SetImageExtent(int cx = 16,int cy=16);
public:
int Redraw();
int EventSheetChanged(int NewCurSheet);
int ReCalcWidths(HDC hdc);
int SelectSheet(int NewCurSheet);
public:
virtual int OnDraw(HDC hdc);
virtual int DrawSheet(HDC hdc,int iSheet, RECT rect);
virtual int DrawEclipseSheet(HDC hdc,int iSheet, RECT rect);
virtual int DrawEclipseExSheet(HDC hdc,int iSheet, RECT rect);
virtual int DrawShapeSheet(HDC hdc,int iSheet, RECT rect);
virtual int DrawCloseSheet(HDC hdc,int iSheet, RECT rect);
virtual int DrawRoundRectSheet(HDC hdc,int iSheet, RECT rect);
virtual int DrawRoundRectExSheet(HDC hdc,int iSheet, RECT rect);
public:
RECT GetSheetRect(int Index);
int GetSheetFromPoint(POINT & pt);
public:
bool EvtLButtonDown(TEvent* pEvent,LPARAM lParam);
bool EvtPaint(TEvent* pEvent,LPARAM lParam);
public:
bool m_bMdiSheet;
xfMdiFrame * m_pFrame;
std::vector<HWND>* m_pHwnds;
public:
virtual void Initial();
virtual int DoDraw(HDC hPaintDC,RECT * pDrawRect=NULL);
public:
xbObject * GetInterface();
public:
virtual int GetXml(BSTR &bstr);
public:
bool m_bClose;
int SetCloseButton(int nSheet, bool bClose);
public:
std::vector<sheetState>* m_pSheetState;
int SetSheetState(int sheet, int state);
int GetSheetState(int sheet);
int SetSheetText(int sheet, LPTSTR text);
LPTSTR GetSheetText(int sheet);
};
}}
| 26.226415
| 93
| 0.743525
|
qianxj
|
cf353a2fc4d340a971f6871327531bd2b31b89bf
| 19,271
|
hpp
|
C++
|
include/samurai/subset/node_op.hpp
|
tbellotti/samurai
|
b10fa2115d69eb184609103579ba433ff09891df
|
[
"BSD-3-Clause"
] | 13
|
2021-01-07T19:23:42.000Z
|
2022-01-26T13:07:41.000Z
|
include/samurai/subset/node_op.hpp
|
gouarin/samurai
|
7ae877997e8b9bdb85b84acaabb3c0483ff78689
|
[
"BSD-3-Clause"
] | 1
|
2021-07-04T17:30:47.000Z
|
2021-07-04T17:30:47.000Z
|
include/samurai/subset/node_op.hpp
|
gouarin/samurai
|
7ae877997e8b9bdb85b84acaabb3c0483ff78689
|
[
"BSD-3-Clause"
] | 2
|
2021-01-07T15:54:49.000Z
|
2021-02-24T13:11:42.000Z
|
// Copyright 2021 SAMURAI TEAM. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#pragma once
#include <memory>
#include <type_traits>
#include <xtensor/xexpression.hpp>
#include <xtensor/xfixed.hpp>
#include <xtl/xtype_traits.hpp>
#include "../level_cell_array.hpp"
#include "../algorithm.hpp"
#include "../utils.hpp"
namespace samurai
{
/**********************
* node_op definition *
**********************/
/** @class node_op
* @brief Define the CRTP used by the algebra of sets.
*
* A node_op is the final node of the graph defining the
* algebra of sets. It's a mesh or a transformation of a
* mesh.
*
* @tparam D Concrete node
*/
template<class D>
class node_op {
public:
using derived_type = D;
derived_type &derived_cast() & noexcept;
const derived_type &derived_cast() const &noexcept;
derived_type derived_cast() && noexcept;
auto index(int i) const noexcept;
auto size(std::size_t dim) const noexcept;
auto start(std::size_t dim, std::size_t index) const noexcept;
auto end(std::size_t dim, std::size_t index) const noexcept;
auto offset(std::size_t dim, std::size_t index) const noexcept;
auto interval(std::size_t dim, std::size_t index) const noexcept;
template<class T>
auto find(std::size_t dim, std::size_t start, std::size_t end,
T coord) const noexcept;
template<class T>
auto transform(std::size_t dim, T coord) const noexcept;
auto offsets_size(std::size_t dim) const noexcept;
auto data() const noexcept;
template<class Mesh>
void data(Mesh &mesh) noexcept;
template<class T>
auto create_interval(T start, T end) const noexcept;
auto create_index_yz() const noexcept;
std::size_t level() const noexcept;
bool is_empty() const noexcept;
protected:
node_op(){};
~node_op() = default;
node_op(const node_op &) = default;
node_op &operator=(const node_op &) = default;
node_op(node_op &&) = default;
node_op &operator=(node_op &&) = default;
};
/**************************
* node_op implementation *
**************************/
template<class D>
inline auto node_op<D>::derived_cast() & noexcept -> derived_type &
{
return *static_cast<derived_type *>(this);
}
template<class D>
inline auto node_op<D>::derived_cast() const & noexcept -> const derived_type &
{
return *static_cast<const derived_type *>(this);
}
template<class D>
inline auto node_op<D>::derived_cast() && noexcept -> derived_type
{
return *static_cast<derived_type *>(this);
}
template<class D>
inline auto node_op<D>::index(int i) const noexcept
{
return this->derived_cast().m_data.index(i);
}
template<class D>
inline auto node_op<D>::size(std::size_t dim) const noexcept
{
return this->derived_cast().m_data.size(dim);
}
template<class D>
inline auto node_op<D>::start(std::size_t dim, std::size_t index) const noexcept
{
return this->derived_cast().m_data.start(dim, index);
}
template<class D>
inline auto node_op<D>::end(std::size_t dim, std::size_t index) const noexcept
{
return this->derived_cast().m_data.end(dim, index);
}
template<class D>
inline auto node_op<D>::offset(std::size_t dim, std::size_t index) const noexcept
{
return this->derived_cast().m_data.offset(dim, index);
}
template<class D>
inline auto node_op<D>::interval(std::size_t dim, std::size_t index) const noexcept
{
return this->derived_cast().m_data.interval(dim, index);
}
template<class D>
template<class T>
inline auto node_op<D>::find(std::size_t dim, std::size_t start,
std::size_t end, T coord) const noexcept
{
return this->derived_cast().m_data.find(dim, start, end, coord);
}
template<class D>
template<class T>
inline auto node_op<D>::transform(std::size_t dim, T coord) const noexcept
{
return this->derived_cast().m_data.transform(dim, coord);
}
template<class D>
inline auto node_op<D>::offsets_size(std::size_t dim) const noexcept
{
return this->derived_cast().m_data.offsets_size(dim);
}
template<class D>
inline auto node_op<D>::data() const noexcept
{
return this->derived_cast().m_data.data();
}
template<class D>
template<class Mesh>
inline void node_op<D>::data(Mesh &mesh) noexcept
{
return this->derived_cast().m_data.data(mesh);
}
template<class D>
inline std::size_t node_op<D>::level() const noexcept
{
return this->derived_cast().m_data.level();
}
template<class D>
inline bool node_op<D>::is_empty() const noexcept
{
return this->derived_cast().m_data.is_empty();
}
template<class D>
template<class T>
inline auto node_op<D>::create_interval(T start, T end) const noexcept
{
return this->derived_cast().m_data.create_interval(start, end);
}
template<class D>
inline auto node_op<D>::create_index_yz() const noexcept
{
return this->derived_cast().create_index_yz();
}
template<class E>
using is_node_op = xt::is_crtp_base_of<node_op, E>;
/************************
* mesh_node definition *
************************/
/** @class mesh_node
* @brief Define a mesh node in the algebra of sets.
*
* @tparam Mesh The type of the mesh used
*/
template<class Mesh>
struct mesh_node : public node_op<mesh_node<Mesh>>
{
using mesh_type = Mesh;
static constexpr std::size_t dim = mesh_type::dim;
using interval_t = typename mesh_type::interval_t;
using coord_index_t = typename mesh_type::coord_index_t;
mesh_node(const Mesh &v);
// mesh_node() : m_data{nullptr}
// {}
mesh_node(const mesh_node &) = default;
mesh_node &operator=(const mesh_node &) = default;
mesh_node(mesh_node &&) = default;
mesh_node &operator=(mesh_node &&) = default;
auto index(int i) const noexcept;
auto size(std::size_t dim) const noexcept;
auto start(std::size_t dim, std::size_t index) const noexcept;
auto end(std::size_t dim, std::size_t index) const noexcept;
auto offset(std::size_t dim, std::size_t off_ind) const noexcept;
auto offsets_size(std::size_t dim) const noexcept;
auto interval(std::size_t dim, std::size_t index) const noexcept;
auto find(std::size_t dim, std::size_t start, std::size_t end, coord_index_t coord) const noexcept;
auto transform(std::size_t dim, coord_index_t coord) const noexcept;
const Mesh &data() const noexcept;
void data(const Mesh &mesh) noexcept;
std::size_t level() const noexcept;
bool is_empty() const noexcept;
auto create_interval(coord_index_t start, coord_index_t end) const
noexcept;
auto create_index_yz() const noexcept;
private:
// std::shared_ptr<Mesh> m_data;
// const Mesh* m_data;
const Mesh& m_data;
friend class node_op<mesh_node<Mesh>>;
};
/****************************
* mesh_node implementation *
****************************/
template<class Mesh>
inline mesh_node<Mesh>::mesh_node(const Mesh &v)
// : m_data{std::make_shared<Mesh>(v)}
// : m_data{&v}
: m_data(v)
{}
template<class Mesh>
inline auto mesh_node<Mesh>::index(int i) const noexcept
{
return i;
}
template<class Mesh>
inline auto mesh_node<Mesh>::size(std::size_t dim) const noexcept
{
// return (*m_data)[dim].size();
return m_data[dim].size();
}
template<class Mesh>
inline auto mesh_node<Mesh>::start(std::size_t dim, std::size_t index) const
noexcept
{
if (m_data.empty())
{
return std::numeric_limits<coord_index_t>::max();
}
return m_data[dim][index].start;
}
template<class Mesh>
inline auto mesh_node<Mesh>::end(std::size_t dim, std::size_t index) const
noexcept
{
if (m_data.empty())
{
return std::numeric_limits<coord_index_t>::max();
}
return m_data[dim][index].end;
}
template<class Mesh>
inline auto mesh_node<Mesh>::offset(std::size_t dim,
std::size_t off_ind) const noexcept
{
return m_data.offsets(dim)[off_ind];
}
template<class Mesh>
inline auto mesh_node<Mesh>::offsets_size(std::size_t dim) const noexcept
{
return m_data.offsets(dim).size();
}
template<class Mesh>
inline auto mesh_node<Mesh>::interval(std::size_t dim,
std::size_t index) const noexcept
{
return m_data[dim][index];
}
template<class Mesh>
inline auto mesh_node<Mesh>::find(std::size_t dim, std::size_t start,
std::size_t end,
coord_index_t coord) const noexcept
{
return find_on_dim(m_data, dim, start, end, coord);
}
template<class Mesh>
inline auto mesh_node<Mesh>::transform(std::size_t /*dim*/, coord_index_t coord) const noexcept
{
return coord;
}
template<class Mesh>
inline const Mesh &mesh_node<Mesh>::data() const noexcept
{
// return *(m_data.get());
return m_data;
}
template<class Mesh>
inline void mesh_node<Mesh>::data(const Mesh &mesh) noexcept
{
m_data = mesh;
}
template<class Mesh>
inline std::size_t mesh_node<Mesh>::level() const noexcept
{
return m_data.level();
}
template<class Mesh>
inline bool mesh_node<Mesh>::is_empty() const noexcept
{
return m_data.empty();
}
template<class Mesh>
inline auto mesh_node<Mesh>::create_interval(coord_index_t start,
coord_index_t end) const
noexcept
{
return interval_t{start, end};
}
template<class Mesh>
inline auto mesh_node<Mesh>::create_index_yz() const noexcept
{
return xt::xtensor_fixed<coord_index_t, xt::xshape<dim - 1>>{};
}
/***********************************
* translate_op definition *
***********************************/
template<class T>
struct translate_op : public node_op<translate_op<T>>
{
using mesh_type = typename T::mesh_type;
static constexpr std::size_t dim = mesh_type::dim;
using interval_t = typename mesh_type::interval_t;
using coord_index_t = typename mesh_type::coord_index_t;
using stencil_t =
typename xt::xtensor_fixed<coord_index_t, xt::xshape<dim>>;
translate_op(T &&v, stencil_t &&stencil);
translate_op(const T &v, const stencil_t &stencil);
auto start(std::size_t dim, std::size_t index) const noexcept;
auto end(std::size_t dim, std::size_t index) const noexcept;
auto transform(std::size_t dim, coord_index_t coord) const noexcept;
auto create_interval(coord_index_t start, coord_index_t end) const
noexcept;
auto create_index_yz() const noexcept;
private:
T m_data;
stencil_t m_stencil;
friend class node_op<translate_op<T>>;
};
/*******************************
* translate_op implementation *
*******************************/
template<class T>
inline translate_op<T>::translate_op(T &&v, stencil_t &&stencil)
: m_data{std::forward<T>(v)},
m_stencil{std::forward<stencil_t>(stencil)}
{}
template<class T>
inline translate_op<T>::translate_op(const T &v, const stencil_t &stencil)
: m_data{v}, m_stencil{stencil}
{}
template<class T>
inline auto translate_op<T>::start(std::size_t dim, std::size_t index) const noexcept
{
return m_data.start(dim, index) + m_stencil[dim];
}
template<class T>
inline auto translate_op<T>::end(std::size_t dim,
std::size_t index) const noexcept
{
return m_data.end(dim, index) + m_stencil[dim];
}
template<class T>
inline auto
translate_op<T>::transform(std::size_t dim, coord_index_t coord) const noexcept
{
return coord - m_stencil[dim];
}
template<class T>
inline auto
translate_op<T>::create_interval(coord_index_t start,
coord_index_t end) const noexcept
{
return interval_t{start, end};
}
template<class T>
inline auto translate_op<T>::create_index_yz() const noexcept
{
return xt::xtensor_fixed<coord_index_t, xt::xshape<dim - 1>>{};
}
/*****************************
* contraction_op definition *
*****************************/
template<class T>
struct contraction_op : public node_op<contraction_op<T>>
{
using mesh_type = typename T::mesh_type;
static constexpr std::size_t dim = mesh_type::dim;
using interval_t = typename mesh_type::interval_t;
using coord_index_t = typename mesh_type::coord_index_t;
contraction_op(const T& v, std::size_t size = 1);
contraction_op(const T& v, const std::array<std::size_t, dim>& contraction);
auto start(std::size_t dim, std::size_t index) const noexcept;
auto end(std::size_t dim, std::size_t index) const noexcept;
auto create_interval(coord_index_t start, coord_index_t end) const noexcept;
auto create_index_yz() const noexcept;
private:
T m_data;
std::array<std::size_t, dim> m_contraction;
friend class node_op<contraction_op<T>>;
};
/*********************************
* contraction_op implementation *
*********************************/
template<class T>
inline contraction_op<T>::contraction_op(const T& v, std::size_t size)
: m_data(v)
{
m_contraction.fill(size);
}
template<class T>
inline contraction_op<T>::contraction_op(const T& v, const std::array<std::size_t, dim>& contraction)
: m_data(v)
, m_contraction(contraction)
{}
template<class T>
inline auto contraction_op<T>::start(std::size_t dim,
std::size_t index) const noexcept
{
return m_data.start(dim, index) + m_contraction[dim];
}
template<class T>
inline auto contraction_op<T>::end(std::size_t dim, std::size_t index) const
noexcept
{
return m_data.end(dim, index) - m_contraction[dim];
}
template<class T>
inline auto contraction_op<T>::create_interval(coord_index_t start,
coord_index_t end) const
noexcept
{
return interval_t{start, end};
}
template<class T>
inline auto contraction_op<T>::create_index_yz() const noexcept
{
return xt::xtensor_fixed<coord_index_t, xt::xshape<dim - 1>>{};
}
/*****************************
* expand_op definition *
*****************************/
template<class T>
struct expand_op : public node_op<expand_op<T>>
{
using mesh_type = typename T::mesh_type;
static constexpr std::size_t dim = mesh_type::dim;
using interval_t = typename mesh_type::interval_t;
using coord_index_t = typename mesh_type::coord_index_t;
expand_op(T &&v);
expand_op(const T &v);
auto start(std::size_t dim, std::size_t index) const noexcept;
auto end(std::size_t dim, std::size_t index) const noexcept;
auto create_interval(coord_index_t start, coord_index_t end) const
noexcept;
auto create_index_yz() const noexcept;
private:
T m_data;
friend class node_op<expand_op<T>>;
};
/****************************
* expand_op implementation *
****************************/
template<class T>
inline expand_op<T>::expand_op(T &&v) : m_data{std::forward<T>(v)}
{}
template<class T>
inline expand_op<T>::expand_op(const T &v) : m_data{v}
{}
template<class T>
inline auto expand_op<T>::start(std::size_t dim, std::size_t index) const
noexcept
{
return m_data.start(dim, index) - 1;
}
template<class T>
inline auto expand_op<T>::end(std::size_t dim, std::size_t index) const
noexcept
{
return m_data.end(dim, index) + 1;
}
template<class T>
inline auto expand_op<T>::create_interval(coord_index_t start,
coord_index_t end) const noexcept
{
return interval_t{start, end};
}
template<class T>
inline auto expand_op<T>::create_index_yz() const noexcept
{
return xt::xtensor_fixed<coord_index_t, xt::xshape<dim - 1>>{};
}
namespace detail
{
template<class T>
struct get_arg_node_impl
{
template<class R>
decltype(auto) operator()(R &&r)
{
return std::forward<R>(r);
}
};
template<std::size_t Dim, class TInterval>
struct get_arg_node_impl<LevelCellArray<Dim, TInterval>>
{
using mesh_t = LevelCellArray<Dim, TInterval>;
decltype(auto) operator()(const LevelCellArray<Dim, TInterval> &r)
{
return mesh_node<mesh_t>(r);
}
};
}
template<class T>
decltype(auto) get_arg_node(T &&t)
{
detail::get_arg_node_impl<std::decay_t<T>> inv;
return inv(std::forward<T>(t));
}
template<class T1, class T2>
inline auto translate(T1 &&t, T2 &&stencil)
{
auto arg = get_arg_node(std::forward<T1>(t));
using arg_t = decltype(arg);
return translate_op<arg_t>{std::forward<arg_t>(arg),
std::forward<T2>(stencil)};
}
template<class T>
inline auto contraction(T &&t, std::size_t size = 1)
{
auto arg = get_arg_node(std::forward<T>(t));
using arg_t = decltype(arg);
return contraction_op<arg_t>{std::forward<arg_t>(arg), size};
}
template<class T, std::size_t dim>
inline auto contraction(T &&t, const std::array<std::size_t, dim>& c)
{
auto arg = get_arg_node(std::forward<T>(t));
using arg_t = decltype(arg);
return contraction_op<arg_t>{std::forward<arg_t>(arg), c};
}
template<class T>
inline auto expand(T &&t)
{
auto arg = get_arg_node(std::forward<T>(t));
using arg_t = decltype(arg);
return expand_op<arg_t>{std::forward<arg_t>(arg)};
}
} // namespace samurai
| 29.287234
| 107
| 0.587463
|
tbellotti
|
cf3d247eb6cfe75159784950a2513b695abd87d5
| 2,635
|
cpp
|
C++
|
KNN.cpp
|
Quanhaoli2641/MachineLearningVoter
|
244ed7dd18d0c497a903e3ada5fe3f9aa4ec18c7
|
[
"MIT"
] | 4
|
2016-12-16T16:42:41.000Z
|
2017-01-27T23:49:33.000Z
|
KNN.cpp
|
Quanhaoli2641/MachineLearningVoter
|
244ed7dd18d0c497a903e3ada5fe3f9aa4ec18c7
|
[
"MIT"
] | null | null | null |
KNN.cpp
|
Quanhaoli2641/MachineLearningVoter
|
244ed7dd18d0c497a903e3ada5fe3f9aa4ec18c7
|
[
"MIT"
] | null | null | null |
#include <stdio.h>
#include <string>
#include <random>
#include <math.h>
#include "KNN.h"
#include "Data.h"
#include <iostream>
using namespace std;
using namespace DataEntries;
// Calculates the Euclidean distance between two data entries
namespace KNN {
float getDistance (Data& trainingOne, Data& trainingTwo) {
float dist = 0;
// sum of difference of squares
dist += pow(trainingOne.getPop() - trainingTwo.getPop(),2);
dist += pow(trainingOne.getPopChange() - trainingTwo.getPopChange(),2);
dist += pow(trainingOne.getAgeSFP() - trainingTwo.getAgeSFP(),2);
dist += pow(trainingOne.getBlack() - trainingTwo.getBlack(),2);
dist += pow(trainingOne.getHispanic() - trainingTwo.getHispanic(),2);
dist += pow(trainingOne.getEBach() - trainingTwo.getEBach(),2);
dist += pow(trainingOne.getIncome() - trainingTwo.getIncome(),2);
dist += pow(trainingOne.getPoverty() - trainingTwo.getPoverty(),2);
dist += pow(trainingOne.getDensity() - trainingTwo.getDensity(),2);
// returns square root
return sqrtf(dist);
}
// Comparator function
bool checker (pair<Data*,float>& dataOne, pair<Data*,float>& dataTwo) {
return dataOne.second < dataTwo.second;
}
// Finds x closest neighbors
vector<Data*> getNeighbors (vector<Data*>& trainingSet, Data& testInstance, int range) {
vector<pair<Data*,float>> v{};
// for every data entry
for (int i = 0; i < trainingSet.size(); i++) {
// calculate the Euclidean distance
float dist = KNN::getDistance(testInstance, *trainingSet[i]);
pair<Data*, float> p;
p.first = trainingSet[i];
p.second = dist;
// store it in a vector
v.push_back(p);
}
// sort the vector
sort(v.begin(), v.end(), KNN::checker);
vector<Data*> ret;
// appends the x closest neighbors to a new vector and returns
for (int j = 0; j < range; j++) {
ret.push_back(v[j].first);
}
return ret;
}
// Determine if a county might vote republic or democrat
bool getResponse (vector<Data*>& d) {
int num = 0;
// loops through neighbors
for (int i = 0; i<d.size();i++) {
// check if neighbors are republican or democrat
if (d[i]->getDem() == 1) {
num+=1;
}
else num-=1;
}
// return republican or democrat
return num > 0;
}
}
| 29.277778
| 92
| 0.566983
|
Quanhaoli2641
|
cf3fd2ea2950e0728189fa09032dae6ede750ff7
| 479
|
cpp
|
C++
|
1022-Circle in Square.cpp
|
BRAINIAC2677/Lightoj-Solutions
|
e75f56b2cb4ef8f7e00de39fed447b1b37922427
|
[
"MIT"
] | null | null | null |
1022-Circle in Square.cpp
|
BRAINIAC2677/Lightoj-Solutions
|
e75f56b2cb4ef8f7e00de39fed447b1b37922427
|
[
"MIT"
] | null | null | null |
1022-Circle in Square.cpp
|
BRAINIAC2677/Lightoj-Solutions
|
e75f56b2cb4ef8f7e00de39fed447b1b37922427
|
[
"MIT"
] | null | null | null |
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/
#include <stdio.h>
#include <math.h>
using namespace std;
int main()
{
double r;
double sarea;
double carea;
double area;
int t;
scanf("%d", &t);
for (int i = 1; i <= t; i++) {
scanf("%lf", &r);
carea = 2 * acos(0.0) * r * r;
sarea = (2 * r) * (2 * r);
area = sarea - carea;
printf("Case %d: %.2lf\n",i, area);
}
}
| 15.451613
| 49
| 0.48643
|
BRAINIAC2677
|
cf44917ab7d700a5e022b4a34a32bd1055dbf27d
| 2,224
|
cpp
|
C++
|
OrbitCore/src/Game/CompositeTree/Node.cpp
|
JusticesHand/orbit-engine
|
fd9bd160f6e54fb49a9e720f0c409ae5deb6e676
|
[
"MIT"
] | null | null | null |
OrbitCore/src/Game/CompositeTree/Node.cpp
|
JusticesHand/orbit-engine
|
fd9bd160f6e54fb49a9e720f0c409ae5deb6e676
|
[
"MIT"
] | 8
|
2017-09-05T04:12:03.000Z
|
2017-10-26T03:17:07.000Z
|
OrbitCore/src/Game/CompositeTree/Node.cpp
|
JusticesHand/orbit-engine
|
fd9bd160f6e54fb49a9e720f0c409ae5deb6e676
|
[
"MIT"
] | null | null | null |
/*! @file Game/CompositeTree/Node.cpp */
#include "Game/CompositeTree/Node.h"
#include "Game/CompositeTree/Visitor.h"
#include "Render/Model.h"
#include <glm/gtc/matrix_transform.hpp>
using namespace Orbit;
Node::Node(const std::string& name, const std::shared_ptr<Model>& model)
: _name(name), _model(model)
{
}
Node::Node(const Input& input, const std::string& name, const std::shared_ptr<Model>& model)
: _input(&input), _name(name), _model(model)
{
}
Node::Node(Node&& rhs)
: _input(rhs._input), _name(std::move(rhs._name)), _model(rhs._model)
{
}
Node& Node::operator=(Node&& rhs)
{
_input = rhs._input;
_destroyed = rhs._destroyed;
_name = std::move(rhs._name);
_model = rhs._model;
return *this;
}
void Node::acceptVisitor(Visitor* visitor)
{
visitor->visitElement(this);
}
void Node::destroy()
{
setDestroyed(true);
}
std::string Node::getName() const
{
return _name;
}
bool Node::destroyed() const
{
std::lock_guard<std::mutex> lock(_mutex);
return _destroyed;
}
void Node::setDestroyed(bool value)
{
std::lock_guard<std::mutex> lock(_mutex);
_destroyed = value;
}
bool Node::hasModel() const
{
return _model != nullptr;
}
std::shared_ptr<Model> Node::getModel() const
{
return _model;
}
std::shared_ptr<Node> Node::find(std::string name)
{
if (_name == name)
return shared_from_this();
return nullptr;
}
std::shared_ptr<const Node> Node::find(std::string name) const
{
if (_name == name)
return shared_from_this();
return nullptr;
}
glm::vec3 Node::position() const
{
return _position;
}
glm::quat Node::rotation() const
{
return _rotation;
}
float Node::scale() const
{
return _scale;
}
glm::mat4 Node::modelMatrix() const
{
glm::mat4 result = glm::translate(glm::mat4(), _position);
result *= glm::mat4_cast(_rotation);
return glm::scale(result, glm::vec3(_scale));
}
void Node::setPosition(const glm::vec3& newPos)
{
_position = newPos;
}
void Node::setRotation(const glm::quat& newRot)
{
_rotation = newRot;
}
void Node::setScale(float newScale)
{
_scale = newScale;
}
const Input& Node::getInput() const
{
if (_input == nullptr)
throw std::runtime_error("Attempted to get input for a node whose input was uninitialized!");
return *_input;
}
| 16.597015
| 95
| 0.696942
|
JusticesHand
|
cf4aea52b0be67acd6a760cb474aaf2d2361ef85
| 3,251
|
cpp
|
C++
|
src/CoreGuid.cpp
|
heikopanjas/ultraschall-core-model
|
6f3449adb7725c1e5273157e7d0ad6d92a89eaf6
|
[
"MIT"
] | null | null | null |
src/CoreGuid.cpp
|
heikopanjas/ultraschall-core-model
|
6f3449adb7725c1e5273157e7d0ad6d92a89eaf6
|
[
"MIT"
] | null | null | null |
src/CoreGuid.cpp
|
heikopanjas/ultraschall-core-model
|
6f3449adb7725c1e5273157e7d0ad6d92a89eaf6
|
[
"MIT"
] | null | null | null |
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) The Ultraschall Project (http://ultraschall.fm)
//
// The MIT License (MIT)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
////////////////////////////////////////////////////////////////////////////////
#include <CoreGuid.h>
#include "Common.h"
#ifdef _WIN32
#include <rpc.h>
#include <windows.h>
void InitializeGUID(uint8_t* data, const size_t dataSize)
{
PRECONDITION(data != nullptr);
PRECONDITION(dataSize >= sizeof(UUID));
UUID uuid = {0};
RPC_STATUS status = UuidCreate(&uuid);
if(RPC_S_OK == status)
{
memcpy(data, &uuid, dataSize);
}
}
#endif // #ifdef _WIN32
namespace Ultraschall { namespace Core {
struct Guid::Impl
{
public:
static constexpr size_t GUID_DATA_SIZE = 16;
Impl();
virtual ~Impl();
Impl(const Impl& rhs);
bool operator==(const Impl& rhs) const;
bool operator<(const Impl& rhs) const;
uint8_t data_[GUID_DATA_SIZE];
};
Guid::Impl::Impl() : data_{0} {}
Guid::Impl::~Impl()
{
memset(data_, 0, sizeof(uint8_t) * GUID_DATA_SIZE);
}
Guid::Impl::Impl(const Guid::Impl& rhs) : data_{0}
{
*this = rhs;
}
bool Guid::Impl::operator==(const Impl& rhs) const
{
return memcmp(data_, rhs.data_, sizeof(uint8_t) * GUID_DATA_SIZE) == 0;
}
bool Guid::Impl::operator<(const Impl& rhs) const
{
return memcmp(data_, rhs.data_, sizeof(uint8_t) * GUID_DATA_SIZE) < 0;
}
Guid::Guid() : impl_(nullptr) {}
Guid::~Guid()
{
SafeDelete(impl_);
}
Guid::Guid(const Guid& rhs) : impl_(nullptr)
{
*this = rhs;
}
Guid& Guid::operator=(const Guid& rhs)
{
memcpy(impl_->data_, rhs.impl_->data_, Impl::GUID_DATA_SIZE);
return *this;
}
bool Guid::operator==(const Guid& rhs) const
{
return impl_->operator==(*rhs.impl_);
}
bool Guid::operator<(const Guid& rhs) const
{
return impl_->operator<(*rhs.impl_);
}
Guid Guid::New()
{
return Guid();
}
const Guid& Guid::Null()
{
static Guid* pGuid = nullptr;
if(nullptr == pGuid)
{
pGuid = new Guid();
memset(pGuid->impl_->data_, 0, Impl::GUID_DATA_SIZE);
}
return *pGuid;
}
}} // namespace Ultraschall::Core
| 23.729927
| 80
| 0.64411
|
heikopanjas
|
cf5d9093d1d04eda1c43bfd468533d60a2073b10
| 5,051
|
cpp
|
C++
|
src/tools/SimpleTraversabilityRadialLUT.cpp
|
skasperski/slam-maps
|
916c2ab77573162a17df2567cf6df16c300538bc
|
[
"BSD-2-Clause"
] | 15
|
2016-05-20T05:21:45.000Z
|
2021-07-21T02:34:18.000Z
|
src/tools/SimpleTraversabilityRadialLUT.cpp
|
skasperski/slam-maps
|
916c2ab77573162a17df2567cf6df16c300538bc
|
[
"BSD-2-Clause"
] | 19
|
2016-06-22T18:43:36.000Z
|
2021-09-28T15:20:31.000Z
|
src/tools/SimpleTraversabilityRadialLUT.cpp
|
skasperski/slam-maps
|
916c2ab77573162a17df2567cf6df16c300538bc
|
[
"BSD-2-Clause"
] | 12
|
2017-03-10T10:19:46.000Z
|
2021-06-04T05:50:10.000Z
|
//
// Copyright (c) 2015-2017, Deutsches Forschungszentrum für Künstliche Intelligenz GmbH.
// Copyright (c) 2015-2017, University of Bremen
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#include "SimpleTraversabilityRadialLUT.hpp"
#include <boost/tuple/tuple.hpp>
using namespace maps;
using namespace tools;
void SimpleTraversabilityRadialLUT::precompute(double distance, double resolutionX, double resolutionY)
{
const double radius2 = distance * distance;
width = 2 * ceil(distance / resolutionX) + 1;
height = 2 * ceil(distance / resolutionY) + 1;
inDistance.resize(boost::extents[height][width]);
std::fill(inDistance.data(), inDistance.data() + inDistance.num_elements(), false);
parents.resize(boost::extents[height][width]);
std::fill(parents.data(), parents.data() + parents.num_elements(), std::make_pair(-1, -1));
centerX = width / 2;
centerY = height / 2;
parents[centerY][centerX] = std::make_pair(-1, -1);
for (unsigned int y = 0; y < height; ++y)
{
for (unsigned int x = 0; x < width; ++x)
{
int dx = (x - centerX);
int dy = (y - centerY);
if (dx == 0 && dy == 0)
continue;
double d2 = dx * dx * resolutionX * resolutionX + dy * dy * resolutionY * resolutionY;
inDistance[y][x] = (d2 < radius2);
if (abs(dx) > abs(dy))
{
int parentx = x - dx / abs(dx);
int parenty = y - rint(static_cast<double>(dy) / abs(dx));
parents[y][x] = std::make_pair(parenty, parentx);
}
else
{
int parentx = x - rint(static_cast<double>(dx) / abs(dy));
int parenty = y - dy / abs(dy);
parents[y][x] = std::make_pair(parenty, parentx);
}
}
}
}
void SimpleTraversabilityRadialLUT::markAllRadius(grid::TraversabilityGrid& traversabilityGrid, int centerX, int centerY, int targetedValue) const
{
int baseX = centerX - this->centerX;
int baseY = centerY - this->centerY;
for (unsigned int y = 0; y < height; ++y)
{
int mapY = baseY + y;
if (mapY < 0 || mapY >= static_cast<int>(traversabilityGrid.getNumCells()[1]))
continue;
for (unsigned int x = 0; x < width; ++x)
{
int mapX = baseX + x;
if (mapX < 0 || mapX >= static_cast<int>(traversabilityGrid.getNumCells()[0]))
continue;
if (inDistance[y][x] && traversabilityGrid.at(grid::Index(mapX, mapY)).getTraversabilityClassId() == targetedValue)
{
markSingleRadius(traversabilityGrid, centerX, centerY, x, y, targetedValue, targetedValue);
}
}
}
}
void SimpleTraversabilityRadialLUT::markSingleRadius(grid::TraversabilityGrid& traversabilityGrid, int centerX, int centerY, int targetX, int targetY, int expectedValue, int markValue) const
{
boost::tie(targetY, targetX) = parents[targetY][targetX];
while (targetX != -1 && targetY != -1)
{
int mapX = centerX + targetX - this->centerX;
int mapY = centerY + targetY - this->centerY;
if (mapX < 0 || mapX >= static_cast<int>(traversabilityGrid.getNumCells()[0]) || mapY < 0 || mapY >= static_cast<int>(traversabilityGrid.getNumCells()[1]))
{
boost::tie(targetY, targetX) = parents[targetY][targetX];
continue;
}
if (traversabilityGrid.at(grid::Index(mapX, mapY)).getTraversabilityClassId() != expectedValue)
{
traversabilityGrid.setTraversabilityAndProbability(markValue, 1, mapX, mapY);
}
boost::tie(targetY, targetX) = parents[targetY][targetX];
}
}
| 38.853846
| 190
| 0.639477
|
skasperski
|
cf66f8acd01b4d0d3d2558c3a53e79b28b442f18
| 1,295
|
cpp
|
C++
|
plugins/opengl/src/vertex/unset_buffer.cpp
|
cpreh/spacegameengine
|
313a1c34160b42a5135f8223ffaa3a31bc075a01
|
[
"BSL-1.0"
] | 2
|
2016-01-27T13:18:14.000Z
|
2018-05-11T01:11:32.000Z
|
plugins/opengl/src/vertex/unset_buffer.cpp
|
cpreh/spacegameengine
|
313a1c34160b42a5135f8223ffaa3a31bc075a01
|
[
"BSL-1.0"
] | null | null | null |
plugins/opengl/src/vertex/unset_buffer.cpp
|
cpreh/spacegameengine
|
313a1c34160b42a5135f8223ffaa3a31bc075a01
|
[
"BSL-1.0"
] | 3
|
2018-05-11T01:11:34.000Z
|
2021-04-24T19:47:45.000Z
|
// Copyright Carl Philipp Reh 2006 - 2019.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <sge/opengl/context/object_fwd.hpp>
#include <sge/opengl/context/use.hpp>
#include <sge/opengl/vertex/buffer.hpp>
#include <sge/opengl/vertex/context.hpp>
#include <sge/opengl/vertex/declaration.hpp>
#include <sge/opengl/vertex/unset_buffer.hpp>
#include <sge/renderer/vertex/buffer.hpp>
#include <sge/renderer/vf/dynamic/part_index.hpp>
#include <fcppt/make_ref.hpp>
#include <fcppt/assert/optional_error.hpp>
#include <fcppt/cast/static_downcast.hpp>
void sge::opengl::vertex::unset_buffer(
sge::opengl::context::object &_context, sge::renderer::vertex::buffer const &_buffer)
{
sge::opengl::vertex::context &context(
sge::opengl::context::use<sge::opengl::vertex::context>(fcppt::make_ref(_context)));
sge::renderer::vf::dynamic::part_index const index(_buffer.format_part_index());
fcppt::cast::static_downcast<sge::opengl::vertex::buffer const &>(_buffer).unuse(
FCPPT_ASSERT_OPTIONAL_ERROR(context.vertex_declaration()).get().gl_format_part(index));
context.vertex_buffer(index, sge::opengl::vertex::context::optional_buffer());
}
| 41.774194
| 93
| 0.744402
|
cpreh
|
cf67e9394991fb4ab11bd4270c3818fa07864387
| 4,326
|
cpp
|
C++
|
smolengine/src/Core/Engine.cpp
|
YellowDummy/SmolEngine
|
a5638f7592cc5f5f036c44bab33c51841969e9b1
|
[
"Apache-2.0"
] | 16
|
2020-06-30T16:27:12.000Z
|
2021-09-09T15:38:03.000Z
|
smolengine/src/Core/Engine.cpp
|
YellowDummy/SmolEngine
|
a5638f7592cc5f5f036c44bab33c51841969e9b1
|
[
"Apache-2.0"
] | null | null | null |
smolengine/src/Core/Engine.cpp
|
YellowDummy/SmolEngine
|
a5638f7592cc5f5f036c44bab33c51841969e9b1
|
[
"Apache-2.0"
] | 2
|
2021-05-18T05:44:19.000Z
|
2021-08-24T09:37:11.000Z
|
#include "stdafx.h"
#include "Core/Engine.h"
#include "ECS/Systems/ScriptingSystem.h"
#include "ECS/Components/Singletons/GraphicsEngineSComponent.h"
#include "ECS/Components/Singletons/JobsSystemStateSComponent.h"
#include <frostium/Common/DebugLog.h>
#include <frostium/GraphicsContext.h>
#include <frostium/Multithreading/JobsSystemInstance.h>
namespace SmolEngine
{
Engine* Engine::s_Instance = nullptr;
Engine::Engine()
{
if (s_Instance != nullptr)
{
RUNTIME_ERROR("Engine already instantiated.");
}
s_Instance = this;
Log* log = new Log();
}
Engine::~Engine()
{
NATIVE_INFO("[Engine]: State = Shutdown");
m_Running = false;
}
void Engine::Init()
{
NATIVE_INFO("[Engine]: State = Startup");
//---------------------------------------------------------------------///
CreateGraphicsModule();
CreateEngineModule();
CreateScriptModule();
OnInitializationComplete(m_World);
NATIVE_INFO("[Engine]: Initialized successfully");
m_Running = true;
Run();
}
void Engine::Shutdown()
{
if (m_Running)
{
NATIVE_INFO("[Engine]: State = Shutdown");
m_Running = false;
m_GraphicsContext->ShutDown();
exit(EXIT_SUCCESS);
}
}
void Engine::Run()
{
NATIVE_INFO("[Engine]: State = Runtime");
while (m_Running)
{
float deltaTime = m_GraphicsContext->CalculateDeltaTime();
m_GraphicsContext->ProcessEvents();
if (m_GraphicsContext->IsWindowMinimized())
continue;
m_GraphicsContext->BeginFrame(deltaTime);
{
for (Layer* layer : *m_LayerHandler)
layer->OnBeginFrame(deltaTime);
m_World->OnBeginFrame();
{
for (Layer* layer : *m_LayerHandler)
{
layer->OnUpdate(deltaTime);
layer->OnImGuiRender();
}
m_World->OnUpdate(deltaTime);
for (Layer* layer : *m_LayerHandler)
layer->OnEndFrame(deltaTime);
}
m_World->OnEndFrame();
}
m_GraphicsContext->SwapBuffers();
}
}
void Engine::OnEvent(Event& e)
{
if (e.IsType(EventType::WINDOW_CLOSE))
OnWindowClose(e);
for (auto result = m_LayerHandler->end(); result != m_LayerHandler->begin();)
{
(*--result)->OnEvent(e);
if (e.m_Handled)
break;
}
}
void Engine::OnWindowClose(Event& e)
{
Shutdown();
}
void Engine::SetOnSceneLoadedCallback(const std::function<void(Scene*)>& callback)
{
}
void Engine::SetOnSceneUnLoadedCallback(const std::function<void(Scene*)>& callback)
{
}
void Engine::CreateGraphicsModule()
{
WindowCreateInfo windowCI = {};
windowCI.bFullscreen = false;
windowCI.bVSync = false;
windowCI.Width = 720;
windowCI.Height = 480;
windowCI.Title = "SmolEngine";
GraphicsContextInitInfo graphicsContextCI = {};
graphicsContextCI.eMSAASamples = MSAASamples::SAMPLE_COUNT_1;
graphicsContextCI.pWindowCI = &windowCI;
graphicsContextCI.ResourcesFolderPath = "../resources/";
OnGraphicsModuleCreation(&graphicsContextCI);
DebugLog* log = new DebugLog([](const std::string&& msg, LogLevel level) { NATIVE_LOG(level, msg); });
m_GraphicsContext = new GraphicsContext(&graphicsContextCI);
m_GraphicsContext->SetEventCallback(std::bind_front(&Engine::OnEvent, this));
}
void Engine::CreatePhysicsModule()
{
PhysicsModuleCreateInfo physicsContextCI = {};
OnPhysicsModuleCreation(&physicsContextCI);
}
void Engine::CreateEngineModule()
{
m_World = new WorldAdmin();
{
GraphicsEngineSComponent* graphicsEngine = GraphicsEngineSComponent::Get();
graphicsEngine->Storage.Initilize();
graphicsEngine->Storage2D.Initilize();
m_GraphicsContext->PushStorage(&graphicsEngine->Storage);
m_GraphicsContext->PushStorage(&graphicsEngine->Storage2D);
}
EngineModuleCreateInfo engineContextCI = {};
OnEngineModuleCreation(&engineContextCI);
m_AssetsFolder = engineContextCI.AssetsFolder;
m_LayerHandler = new LayerManager();
OnLayerModuleCreation(m_LayerHandler);
// Graphics engine and game engine use the same jobs system, but different queues in use
JobsSystemStateSComponent::GetSingleton()->Executor = m_GraphicsContext->GetJobsSystemInstance()->GetExecutor();
}
void Engine::CreateScriptModule()
{
Scope<ScriptingSystem> system = std::make_unique<ScriptingSystem>();
OnScriptModuleCreation(system.get());
}
std::string Engine::GetAssetsFolder() const
{
return m_AssetsFolder;
}
}
| 22.768421
| 114
| 0.700416
|
YellowDummy
|
cf6c136ae76b45885c6329f4b9529c85f0a846ea
| 7,019
|
hpp
|
C++
|
src/map/three-stage-image-managers.hpp
|
tilnewman/heroespath-src
|
a7784e44d8b5724f305ef8b8671fed54e2e5fd69
|
[
"BSL-1.0",
"Beerware"
] | 2
|
2019-02-28T00:28:08.000Z
|
2019-10-20T14:39:48.000Z
|
src/map/three-stage-image-managers.hpp
|
tilnewman/heroespath-src
|
a7784e44d8b5724f305ef8b8671fed54e2e5fd69
|
[
"BSL-1.0",
"Beerware"
] | null | null | null |
src/map/three-stage-image-managers.hpp
|
tilnewman/heroespath-src
|
a7784e44d8b5724f305ef8b8671fed54e2e5fd69
|
[
"BSL-1.0",
"Beerware"
] | null | null | null |
// ----------------------------------------------------------------------------
// "THE BEER-WARE LICENSE" (Revision 42):
// <ztn@zurreal.com> wrote this file. As long as you retain this notice you
// can do whatever you want with this stuff. If we meet some day, and you think
// this stuff is worth it, you can buy me a beer in return. Ziesche Til Newman
// ----------------------------------------------------------------------------
#ifndef HEROESPATH_MAP_THREE_STAGE_IMAGE_MANAGERS_HPP_INCLUDED
#define HEROESPATH_MAP_THREE_STAGE_IMAGE_MANAGERS_HPP_INCLUDED
//
// three-stage-image-managers.hpp
//
#include "gui/cached-texture.hpp"
#include "map/map-anim.hpp"
#include "map/map-tile-draw.hpp"
#include "misc/vector-map.hpp"
#include "sfutil/vertex.hpp"
#include <SFML/Graphics/RenderTexture.hpp>
#include <SFML/Graphics/Sprite.hpp>
#include <SFML/Graphics/Texture.hpp>
#include <vector>
namespace heroespath
{
namespace gui
{
class Animation;
using AnimationUPtr_t = std::unique_ptr<Animation>;
} // namespace gui
namespace map
{
using VertexVec_t = std::vector<sf::Vertex>;
using VertQuadArray_t = std::array<sf::Vertex, sfutil::VERTS_PER_QUAD>;
// combines a source texture with a collection of vert quads
using IndexVertsPair_t = std::pair<std::size_t, VertexVec_t>;
using IndexVertsPairVec_t = std::vector<IndexVertsPair_t>;
class MapDisplay;
// Respobsible for a source image, an offscreen RenderTexture where that soure image is drawn
// to, and for drawing from that offscreen image to the screen.
class ThreeStageImageManagerBase
{
public:
ThreeStageImageManagerBase();
virtual ~ThreeStageImageManagerBase() = default;
void SourceToOffScreen_Update(const MapDisplay & MAP_DISPLAY);
void SourceToOffScreen_Draw(const MapDisplay & MAP_DISPLAY);
void OffScreenToOnScreen_Update(const MapDisplay & MAP_DISPLAY);
void OffScreenToOnScreen_Draw(sf::RenderTarget & target, sf::RenderStates states) const;
void UpdateAllAndDrawOffScreen(const MapDisplay & MAP_DISPLAY);
void MoveOffscreenTextureRects(const sf::Vector2f & MOVE_V);
protected:
virtual void ResetBase(const sf::Vector2i & OFFSCREEN_TEXTURE_SIZE_V);
virtual void SourceToOffScreen_Update_Impl(
const MapDisplay & MAP_DISPLAY, IndexVertsPairVec_t & drawPairs)
= 0;
virtual void SourceToOffScreen_Draw_Impl(
const MapDisplay & MAP_DISPLAY,
const IndexVertsPairVec_t & DRAW_PAIRS,
sf::RenderTexture & renderTexture)
= 0;
virtual bool OffScreenToOnScreen_Update_Impl(
const MapDisplay & MAP_DISPLAY,
const bool WILL_DRAW_OFFSCREEN,
VertQuadArray_t & offScreenToOnScreenQuadVerts,
const IndexVertsPairVec_t & DRAW_PAIRS)
= 0;
private:
bool willDrawOffScreen_;
bool willDrawOnScreen_;
sf::RenderTexture offScreenTexture_;
VertQuadArray_t offScreenToOnScreenQuadVerts_;
IndexVertsPairVec_t sourceToOffScreenDrawPairs_;
};
class ThreeStageImageManagerMapLayer : public ThreeStageImageManagerBase
{
public:
ThreeStageImageManagerMapLayer(const std::vector<sf::Texture> & MAP_TILE_TEXTURES);
virtual ~ThreeStageImageManagerMapLayer() = default;
void Reset(
const sf::Vector2i & OFFSCREEN_TEXTURE_SIZE_V, const TileDrawVec_t & MAP_TILE_DRAWS);
protected:
void SourceToOffScreen_Update_Impl(
const MapDisplay & MAP_DISPLAY, IndexVertsPairVec_t & drawPairs) final;
void SourceToOffScreen_Draw_Impl(
const MapDisplay &,
const IndexVertsPairVec_t & DRAW_PAIRS,
sf::RenderTexture & renderTexture) final;
bool OffScreenToOnScreen_Update_Impl(
const MapDisplay & MAP_DISPLAY,
const bool WILL_DRAW_OFFSCREEN,
VertQuadArray_t & offScreenToOnScreenQuadVerts,
const IndexVertsPairVec_t & DRAW_PAIRS) final;
private:
const std::vector<sf::Texture> & mapTileTextures_;
TileDrawVec_t mapTileDraws_;
};
class ThreeStageImageManagerAvatarSprites : public ThreeStageImageManagerBase
{
public:
ThreeStageImageManagerAvatarSprites();
virtual ~ThreeStageImageManagerAvatarSprites() = default;
void Reset(const sf::Vector2i & OFFSCREEN_TEXTURE_SIZE_V)
{
ResetBase(OFFSCREEN_TEXTURE_SIZE_V);
}
std::vector<sf::Sprite> & AvatarSprites() { return avatarSprites_; }
protected:
void SourceToOffScreen_Update_Impl(
const MapDisplay & MAP_DISPLAY, IndexVertsPairVec_t & drawPairs) final;
void SourceToOffScreen_Draw_Impl(
const MapDisplay &,
const IndexVertsPairVec_t & DRAW_PAIRS,
sf::RenderTexture & renderTexture) final;
bool OffScreenToOnScreen_Update_Impl(
const MapDisplay & MAP_DISPLAY,
const bool WILL_DRAW_OFFSCREEN,
VertQuadArray_t & offScreenToOnScreenQuadVerts,
const IndexVertsPairVec_t & DRAW_PAIRS) final;
private:
std::vector<sf::Sprite> avatarSprites_;
// the avatar shadow sprite has been created so that (1) it will match the opacity of all
// the map shadows (2) it can be drawn at the same top/left position as an avatar sprite and
// its position will be correct (3) it can/should be scaled to match the avatar sprite's
// scale
gui::CachedTexture npcShadowCachedTexture_;
sf::Sprite npcShadowSprite_;
};
class ThreeStageImageManagerAnimations : public ThreeStageImageManagerBase
{
public:
ThreeStageImageManagerAnimations(std::vector<gui::AnimationUPtr_t> & animUPtrVec);
virtual ~ThreeStageImageManagerAnimations() = default;
void Reset(const sf::Vector2i & OFFSCREEN_TEXTURE_SIZE_V)
{
ResetBase(OFFSCREEN_TEXTURE_SIZE_V);
}
protected:
void SourceToOffScreen_Update_Impl(
const MapDisplay & MAP_DISPLAY, IndexVertsPairVec_t & drawPairs) final;
void SourceToOffScreen_Draw_Impl(
const MapDisplay &,
const IndexVertsPairVec_t & DRAW_PAIRS,
sf::RenderTexture & renderTexture) final;
bool OffScreenToOnScreen_Update_Impl(
const MapDisplay & MAP_DISPLAY,
const bool WILL_DRAW_OFFSCREEN,
VertQuadArray_t & offScreenToOnScreenQuadVerts,
const IndexVertsPairVec_t & DRAW_PAIRS) final;
private:
std::vector<gui::AnimationUPtr_t> & animUPtrVec_;
};
} // namespace map
} // namespace heroespath
#endif // HEROESPATH_MAP_THREE_STAGE_IMAGE_MANAGERS_HPP_INCLUDED
| 37.137566
| 101
| 0.66035
|
tilnewman
|
cf6f03e439e0c5ed3a9a87663cb2daab90528044
| 14,680
|
cpp
|
C++
|
Povox/src/Povox/Renderer/VoxelRenderer.cpp
|
PowerOfNames/PonX
|
cac2c67168857409b40f9f76e9570868668370fd
|
[
"Apache-2.0"
] | null | null | null |
Povox/src/Povox/Renderer/VoxelRenderer.cpp
|
PowerOfNames/PonX
|
cac2c67168857409b40f9f76e9570868668370fd
|
[
"Apache-2.0"
] | null | null | null |
Povox/src/Povox/Renderer/VoxelRenderer.cpp
|
PowerOfNames/PonX
|
cac2c67168857409b40f9f76e9570868668370fd
|
[
"Apache-2.0"
] | null | null | null |
#include "pxpch.h"
#include "Povox/Renderer/VoxelRenderer.h"
#include "Povox/Renderer/VertexArray.h"
#include "Povox/Renderer/Shader.h"
#include "Povox/Renderer/Texture.h"
#include "Povox/Renderer/RenderCommand.h"
#include "Povox/Renderer/Renderer2D.h"
#include "Povox/Utility/Misc.h"
#include <glm/gtc/matrix_transform.hpp>
#define MAX_CUBE_COUNT 20000
#define MAX_VERTEX_COUNT MAX_CUBE_COUNT * 8
#define MAX_INDEX_COUNT MAX_CUBE_COUNT * 6 * 6
#define MAX_TEXTURES 32
namespace Povox {
struct VoxelRendererData
{
ShaderLibrary ShaderLib;
Texture2DLibrary Texture2DLib;
Ref<VertexArray> VoxelVertexArray;
Ref<VertexBuffer> VoxelVertexBuffer;
Ref<IndexBuffer> VoxelIndexBuffer;
Ref<Texture2D> WhiteTexture;
uint32_t WhiteTextureSlot = 0;
Vertex* CubeBufferBase = nullptr;
Vertex* CubeBufferPtr = nullptr;
uint32_t* IndexBufferBase = nullptr;
uint32_t* IndexBufferPtr = nullptr;
uint32_t IndexCount = 0;
uint32_t IndexOffset = 0;
std::array<Ref<Texture>, MAX_TEXTURES> TextureSlots;
uint32_t TextureSlotIndex = 1;
VoxelRenderer::Stats Stats;
};
static VoxelRendererData* s_VoxelData;
void VoxelRenderer::Init()
{
PX_PROFILE_FUNCTION();
RenderCommand::Init();
RenderCommand::SetCulling(true, false);
Renderer2D::Init();
s_VoxelData = new VoxelRendererData();
s_VoxelData->CubeBufferBase = new Vertex[MAX_VERTEX_COUNT];
s_VoxelData->IndexBufferBase = new uint32_t[MAX_INDEX_COUNT];
s_VoxelData->VoxelVertexArray = VertexArray::Create();
s_VoxelData->VoxelVertexBuffer = VertexBuffer::Create(MAX_VERTEX_COUNT * sizeof(Vertex));
//Set the layout
s_VoxelData->VoxelVertexBuffer->SetLayout({
{ ShaderDataType::Float3, "a_Position" },
{ ShaderDataType::Float4, "a_Color" },
{ ShaderDataType::Float2, "a_TexCoord" },
{ ShaderDataType::Float, "a_TexID" }
});
s_VoxelData->VoxelVertexArray->AddVertexBuffer(s_VoxelData->VoxelVertexBuffer);
s_VoxelData->VoxelIndexBuffer = IndexBuffer::Create(MAX_INDEX_COUNT);
s_VoxelData->WhiteTexture = Texture2D::Create("WhiteTexture", 1, 1);
s_VoxelData->Texture2DLib.Add(s_VoxelData->WhiteTexture);
uint32_t whiteTextureData = 0xffffffff;
s_VoxelData->Texture2DLib.Get("WhiteTexture")->SetData(&whiteTextureData, sizeof(uint32_t));
int samplers[MAX_TEXTURES];
for (int i = 0; i < MAX_TEXTURES; i++)
samplers[i] = i;
s_VoxelData->ShaderLib.Load("assets/shaders/CubeFlatColored.glsl")->Bind();
s_VoxelData->ShaderLib.Get("CubeFlatColored")->SetIntArray("u_Textures", samplers, MAX_TEXTURES);
s_VoxelData->TextureSlots[s_VoxelData->WhiteTextureSlot] = s_VoxelData->Texture2DLib.Get("WhiteTexture");
}
void VoxelRenderer::Shutdown()
{
PX_PROFILE_FUNCTION();
delete[] s_VoxelData->CubeBufferBase;
delete[] s_VoxelData->IndexBufferBase;
delete s_VoxelData;
}
void VoxelRenderer::BeginScene(PerspectiveCamera& camera)
{
PX_PROFILE_FUNCTION();
s_VoxelData->ShaderLib.Get("CubeFlatColored")->Bind();
s_VoxelData->ShaderLib.Get("CubeFlatColored")->SetMat4("u_ViewProjection", camera.GetViewProjection());
s_VoxelData->CubeBufferPtr = s_VoxelData->CubeBufferBase;
s_VoxelData->IndexBufferPtr = s_VoxelData->IndexBufferBase;
s_VoxelData->IndexCount = 0;
s_VoxelData->IndexOffset = 0;
s_VoxelData->TextureSlotIndex = 1;
}
void VoxelRenderer::EndScene()
{
PX_PROFILE_FUNCTION();
s_VoxelData->VoxelVertexBuffer->Submit(s_VoxelData->CubeBufferBase, (uint32_t)( (uint8_t*)s_VoxelData->CubeBufferPtr - (uint8_t*)s_VoxelData->CubeBufferBase ));
s_VoxelData->VoxelIndexBuffer->Submit(s_VoxelData->IndexBufferBase, (uint32_t)((uint8_t*)s_VoxelData->IndexBufferPtr - (uint8_t*)s_VoxelData->IndexBufferBase));
s_VoxelData->VoxelVertexArray->SetIndexBuffer(s_VoxelData->VoxelIndexBuffer);
s_VoxelData->VoxelVertexArray->SubmitVertexData(s_VoxelData->CubeBufferBase, (uint8_t*)s_VoxelData->CubeBufferPtr - (uint8_t*)s_VoxelData->CubeBufferBase);
s_VoxelData->VoxelVertexArray->SubmitIndices(s_VoxelData->IndexBufferBase, (uint8_t*)s_VoxelData->IndexBufferPtr - (uint8_t*)s_VoxelData->IndexBufferBase);
Flush();
}
void VoxelRenderer::Flush()
{
PX_PROFILE_FUNCTION();
if (s_VoxelData->IndexCount == 0)
return; // Nothing to draw
for (uint32_t i = 0; i < s_VoxelData->TextureSlotIndex; i++)
s_VoxelData->TextureSlots[i]->Bind(i);
RenderCommand::DrawIndexed(s_VoxelData->VoxelVertexArray, s_VoxelData->IndexCount);
s_VoxelData->Stats.DrawCount++;
}
void VoxelRenderer::FlushAndReset()
{
EndScene();
s_VoxelData->CubeBufferPtr = s_VoxelData->CubeBufferBase;
s_VoxelData->IndexBufferPtr = s_VoxelData->IndexBufferBase;
s_VoxelData->IndexCount = 0;
s_VoxelData->IndexOffset = 0;
s_VoxelData->TextureSlotIndex = 1;
}
//FlatColoredCube
void VoxelRenderer::DrawCube(glm::vec3 position, float scale, glm::vec4 color)
{
if (s_VoxelData->IndexCount >= MAX_INDEX_COUNT)
FlushAndReset();
float textureIndex = 0.0f;
s_VoxelData->CubeBufferPtr->Position = { position.x, position.y, position.z };
s_VoxelData->CubeBufferPtr->Color = color;
s_VoxelData->CubeBufferPtr->TexCoord = { 0.0f, 0.0f };
s_VoxelData->CubeBufferPtr->TexID = textureIndex;
s_VoxelData->CubeBufferPtr++;
s_VoxelData->CubeBufferPtr->Position = { position.x + scale, position.y, position.z };
s_VoxelData->CubeBufferPtr->Color = color;
s_VoxelData->CubeBufferPtr->TexCoord = { 1.0f, 0.0f };
s_VoxelData->CubeBufferPtr->TexID = textureIndex;
s_VoxelData->CubeBufferPtr++;
s_VoxelData->CubeBufferPtr->Position = { position.x + scale, position.y, position.z + scale };
s_VoxelData->CubeBufferPtr->Color = color;
s_VoxelData->CubeBufferPtr->TexCoord = { 1.0f, 1.0f };
s_VoxelData->CubeBufferPtr->TexID = textureIndex;
s_VoxelData->CubeBufferPtr++;
s_VoxelData->CubeBufferPtr->Position = { position.x, position.y, position.z + scale };
s_VoxelData->CubeBufferPtr->Color = color;
s_VoxelData->CubeBufferPtr->TexCoord = { 0.0f, 1.0f };
s_VoxelData->CubeBufferPtr->TexID = textureIndex;
s_VoxelData->CubeBufferPtr++;
s_VoxelData->CubeBufferPtr->Position = { position.x, position.y + scale, position.z };
s_VoxelData->CubeBufferPtr->Color = color;
s_VoxelData->CubeBufferPtr->TexCoord = { 0.0f, 0.0f };
s_VoxelData->CubeBufferPtr->TexID = textureIndex;
s_VoxelData->CubeBufferPtr++;
s_VoxelData->CubeBufferPtr->Position = { position.x + scale, position.y + scale, position.z };
s_VoxelData->CubeBufferPtr->Color = color;
s_VoxelData->CubeBufferPtr->TexCoord = { 1.0f, 0.0f };
s_VoxelData->CubeBufferPtr->TexID = textureIndex;
s_VoxelData->CubeBufferPtr++;
s_VoxelData->CubeBufferPtr->Position = { position.x + scale, position.y + scale, position.z + scale };
s_VoxelData->CubeBufferPtr->Color = color;
s_VoxelData->CubeBufferPtr->TexCoord = { 1.0f, 1.0f };
s_VoxelData->CubeBufferPtr->TexID = textureIndex;
s_VoxelData->CubeBufferPtr++;
s_VoxelData->CubeBufferPtr->Position = { position.x, position.y + scale, position.z + scale };
s_VoxelData->CubeBufferPtr->Color = color;
s_VoxelData->CubeBufferPtr->TexCoord = { 0.0f, 1.0f };
s_VoxelData->CubeBufferPtr->TexID = textureIndex;
s_VoxelData->CubeBufferPtr++;
uint32_t offset = s_VoxelData->IndexOffset;
*s_VoxelData->IndexBufferPtr++ = offset + 0;
//PX_CORE_INFO("BufferBase: '{0}'", *s_VoxelData->IndexBufferPtr);
*s_VoxelData->IndexBufferPtr++ = offset + 1;
*s_VoxelData->IndexBufferPtr++ = offset + 5;
*s_VoxelData->IndexBufferPtr++ = offset + 5;
*s_VoxelData->IndexBufferPtr++ = offset + 4;
*s_VoxelData->IndexBufferPtr++ = offset + 0;
*s_VoxelData->IndexBufferPtr++ = offset + 1;
*s_VoxelData->IndexBufferPtr++ = offset + 2;
*s_VoxelData->IndexBufferPtr++ = offset + 6;
*s_VoxelData->IndexBufferPtr++ = offset + 6;
*s_VoxelData->IndexBufferPtr++ = offset + 5;
*s_VoxelData->IndexBufferPtr++ = offset + 1;
*s_VoxelData->IndexBufferPtr++ = offset + 2;
*s_VoxelData->IndexBufferPtr++ = offset + 3;
*s_VoxelData->IndexBufferPtr++ = offset + 7;
*s_VoxelData->IndexBufferPtr++ = offset + 7;
*s_VoxelData->IndexBufferPtr++ = offset + 6;
*s_VoxelData->IndexBufferPtr++ = offset + 2;
*s_VoxelData->IndexBufferPtr++ = offset + 3;
*s_VoxelData->IndexBufferPtr++ = offset + 0;
*s_VoxelData->IndexBufferPtr++ = offset + 4;
*s_VoxelData->IndexBufferPtr++ = offset + 4;
*s_VoxelData->IndexBufferPtr++ = offset + 7;
*s_VoxelData->IndexBufferPtr++ = offset + 3;
*s_VoxelData->IndexBufferPtr++ = offset + 4;
*s_VoxelData->IndexBufferPtr++ = offset + 5;
*s_VoxelData->IndexBufferPtr++ = offset + 6;
*s_VoxelData->IndexBufferPtr++ = offset + 6;
*s_VoxelData->IndexBufferPtr++ = offset + 7;
*s_VoxelData->IndexBufferPtr++ = offset + 4;
*s_VoxelData->IndexBufferPtr++ = offset + 3;
*s_VoxelData->IndexBufferPtr++ = offset + 2;
*s_VoxelData->IndexBufferPtr++ = offset + 1;
*s_VoxelData->IndexBufferPtr++ = offset + 1;
*s_VoxelData->IndexBufferPtr++ = offset + 0;
*s_VoxelData->IndexBufferPtr++ = offset + 3;
s_VoxelData->IndexOffset += 8;
s_VoxelData->IndexCount += 36;
s_VoxelData->Stats.CubeCount++;
s_VoxelData->Stats.TriangleCount += 12;
}
//TexturedCube
void VoxelRenderer::DrawCube(glm::vec3 position, float scale, const std::string& filepath)
{
std::string textureName = GetNameFromPath(filepath);
if (s_VoxelData->IndexCount >= MAX_INDEX_COUNT)
FlushAndReset();
int textureIndex = 0;
for (uint32_t i = 1; i < s_VoxelData->TextureSlotIndex; i++)
{
if (s_VoxelData->TextureSlots[i]->GetName() == textureName)
{
textureIndex = i;
break;
}
}
if (textureIndex == 0)
{
if (s_VoxelData->TextureSlotIndex > MAX_TEXTURES)
FlushAndReset();
textureIndex = s_VoxelData->TextureSlotIndex;
if (!s_VoxelData->Texture2DLib.Contains(textureName))
{
PX_CORE_INFO("Texture: {0} not already in TextureArray. Added now", textureName);
s_VoxelData->TextureSlots[textureIndex] = s_VoxelData->Texture2DLib.Load(filepath);
s_VoxelData->TextureSlotIndex++;
}
else
{
s_VoxelData->TextureSlots[textureIndex] = s_VoxelData->Texture2DLib.Get(textureName);
}
}
constexpr glm::vec4 color = { 1.0f, 1.0f, 1.0f, 1.0f };
s_VoxelData->CubeBufferPtr->Position = { position.x, position.y, position.z };
s_VoxelData->CubeBufferPtr->Color = color;
s_VoxelData->CubeBufferPtr->TexCoord = { 0.0f, 0.0f };
s_VoxelData->CubeBufferPtr->TexID = textureIndex;
s_VoxelData->CubeBufferPtr++;
s_VoxelData->CubeBufferPtr->Position = { position.x + scale, position.y, position.z };
s_VoxelData->CubeBufferPtr->Color = color;
s_VoxelData->CubeBufferPtr->TexCoord = { 1.0f, 0.0f };
s_VoxelData->CubeBufferPtr->TexID = textureIndex;
s_VoxelData->CubeBufferPtr++;
s_VoxelData->CubeBufferPtr->Position = { position.x + scale, position.y, position.z + scale };
s_VoxelData->CubeBufferPtr->Color = color;
s_VoxelData->CubeBufferPtr->TexCoord = { 1.0f, 1.0f };
s_VoxelData->CubeBufferPtr->TexID = textureIndex;
s_VoxelData->CubeBufferPtr++;
s_VoxelData->CubeBufferPtr->Position = { position.x, position.y, position.z + scale };
s_VoxelData->CubeBufferPtr->Color = color;
s_VoxelData->CubeBufferPtr->TexCoord = { 0.0f, 1.0f };
s_VoxelData->CubeBufferPtr->TexID = textureIndex;
s_VoxelData->CubeBufferPtr++;
s_VoxelData->CubeBufferPtr->Position = { position.x, position.y + scale, position.z };
s_VoxelData->CubeBufferPtr->Color = color;
s_VoxelData->CubeBufferPtr->TexCoord = { 0.0f, 0.0f };
s_VoxelData->CubeBufferPtr->TexID = textureIndex;
s_VoxelData->CubeBufferPtr++;
s_VoxelData->CubeBufferPtr->Position = { position.x + scale, position.y + scale, position.z };
s_VoxelData->CubeBufferPtr->Color = color;
s_VoxelData->CubeBufferPtr->TexCoord = { 1.0f, 0.0f };
s_VoxelData->CubeBufferPtr->TexID = textureIndex;
s_VoxelData->CubeBufferPtr++;
s_VoxelData->CubeBufferPtr->Position = { position.x + scale, position.y + scale, position.z + scale };
s_VoxelData->CubeBufferPtr->Color = color;
s_VoxelData->CubeBufferPtr->TexCoord = { 1.0f, 1.0f };
s_VoxelData->CubeBufferPtr->TexID = textureIndex;
s_VoxelData->CubeBufferPtr++;
s_VoxelData->CubeBufferPtr->Position = { position.x, position.y + scale, position.z + scale };
s_VoxelData->CubeBufferPtr->Color = color;
s_VoxelData->CubeBufferPtr->TexCoord = { 0.0f, 1.0f };
s_VoxelData->CubeBufferPtr->TexID = textureIndex;
s_VoxelData->CubeBufferPtr++;
uint32_t offset = s_VoxelData->IndexOffset;
*s_VoxelData->IndexBufferPtr++ = offset + 0;
*s_VoxelData->IndexBufferPtr++ = offset + 1;
*s_VoxelData->IndexBufferPtr++ = offset + 5;
*s_VoxelData->IndexBufferPtr++ = offset + 5;
*s_VoxelData->IndexBufferPtr++ = offset + 4;
*s_VoxelData->IndexBufferPtr++ = offset + 0;
*s_VoxelData->IndexBufferPtr++ = offset + 1;
*s_VoxelData->IndexBufferPtr++ = offset + 2;
*s_VoxelData->IndexBufferPtr++ = offset + 6;
*s_VoxelData->IndexBufferPtr++ = offset + 6;
*s_VoxelData->IndexBufferPtr++ = offset + 5;
*s_VoxelData->IndexBufferPtr++ = offset + 1;
*s_VoxelData->IndexBufferPtr++ = offset + 2;
*s_VoxelData->IndexBufferPtr++ = offset + 3;
*s_VoxelData->IndexBufferPtr++ = offset + 7;
*s_VoxelData->IndexBufferPtr++ = offset + 7;
*s_VoxelData->IndexBufferPtr++ = offset + 6;
*s_VoxelData->IndexBufferPtr++ = offset + 2;
*s_VoxelData->IndexBufferPtr++ = offset + 3;
*s_VoxelData->IndexBufferPtr++ = offset + 0;
*s_VoxelData->IndexBufferPtr++ = offset + 4;
*s_VoxelData->IndexBufferPtr++ = offset + 4;
*s_VoxelData->IndexBufferPtr++ = offset + 7;
*s_VoxelData->IndexBufferPtr++ = offset + 3;
*s_VoxelData->IndexBufferPtr++ = offset + 4;
*s_VoxelData->IndexBufferPtr++ = offset + 5;
*s_VoxelData->IndexBufferPtr++ = offset + 6;
*s_VoxelData->IndexBufferPtr++ = offset + 6;
*s_VoxelData->IndexBufferPtr++ = offset + 7;
*s_VoxelData->IndexBufferPtr++ = offset + 4;
*s_VoxelData->IndexBufferPtr++ = offset + 3;
*s_VoxelData->IndexBufferPtr++ = offset + 2;
*s_VoxelData->IndexBufferPtr++ = offset + 1;
*s_VoxelData->IndexBufferPtr++ = offset + 1;
*s_VoxelData->IndexBufferPtr++ = offset + 0;
*s_VoxelData->IndexBufferPtr++ = offset + 3;
s_VoxelData->IndexOffset += 8;
s_VoxelData->IndexCount += 36;
s_VoxelData->Stats.CubeCount++;
s_VoxelData->Stats.TriangleCount += 12;
}
void VoxelRenderer::OnWindowResize(uint32_t width, uint32_t height)
{
PX_PROFILE_FUNCTION();
RenderCommand::SetViewport(0, 0, width, height);
}
const VoxelRenderer::Stats& VoxelRenderer::GetStats()
{
return s_VoxelData->Stats;
}
void VoxelRenderer::ResetStats()
{
memset(&s_VoxelData->Stats, 0, sizeof(Stats));
}
}
| 34.060325
| 162
| 0.722207
|
PowerOfNames
|
cf728ead837fd4e28ad83d375637b3f3b05ceab8
| 3,108
|
cpp
|
C++
|
libjobject/ClassRegistryWindows.cpp
|
klemenm81/reflection
|
4b15a5d33c376414cb6a2ff0f57175d515b47c70
|
[
"Apache-2.0"
] | null | null | null |
libjobject/ClassRegistryWindows.cpp
|
klemenm81/reflection
|
4b15a5d33c376414cb6a2ff0f57175d515b47c70
|
[
"Apache-2.0"
] | null | null | null |
libjobject/ClassRegistryWindows.cpp
|
klemenm81/reflection
|
4b15a5d33c376414cb6a2ff0f57175d515b47c70
|
[
"Apache-2.0"
] | null | null | null |
#include "ClassRegistry.h"
#include "exceptions/InternalErrorException.h"
#include <windows.h>
#include <tchar.h>
#include <dbghelp.h>
#include <stdio.h>
BOOL CALLBACK MyEnumSymbolsCallback(SYMBOL_INFO* pSymInfo, ULONG SymbolSize, PVOID UserContext) {
std::vector<std::string>& classFactoryNames =
*(reinterpret_cast<std::vector<std::string>*>(UserContext));
classFactoryNames.push_back(pSymInfo->Name);
return TRUE;
}
std::atomic<int> ClassRegistry::m_counter = 0;
void ClassRegistry::Initialize() {
char executableName[MAX_PATH];
GetModuleFileNameA(NULL, executableName, MAX_PATH);
if (!m_libraryName.empty()) {
m_libraryName = m_libraryName + ".dll";
}
if (m_counter == 0) {
if (!::SymInitialize(
GetCurrentProcess(),
NULL,
FALSE
)) {
std::string error =
std::string("SymInitialize() failed. Error code: ") +
std::to_string(::GetLastError());
throw InternalErrorException(error.c_str());
}
m_counter++;
}
DWORD64 modBase;
if ((modBase = ::SymLoadModuleEx(
GetCurrentProcess(),
NULL,
!m_libraryName.empty() ? m_libraryName.c_str() : executableName,
NULL,
0,
0,
NULL,
SLMFLAG_NO_SYMBOLS
)) == 0) {
std::string error =
std::string("SymLoadModuleEx() failed. Error code: ") +
std::to_string(::GetLastError());
throw InternalErrorException(error.c_str());
}
std::vector<std::string> classFactoryNames;
if (!::SymEnumSymbols(
GetCurrentProcess(),
modBase,
"*",
MyEnumSymbolsCallback,
reinterpret_cast<void*>(&classFactoryNames)
)) {
std::string error =
std::string("SymEnumSymbols() failed. Error code: ") +
std::to_string(::GetLastError());
throw InternalErrorException(error.c_str());
}
if (!::SymUnloadModule(GetCurrentProcess(), modBase)) {
std::string error =
std::string("SymUnloadModule() failed. Error code: ") +
std::to_string(::GetLastError());
throw InternalErrorException(error.c_str());
}
if (!m_libraryName.empty()) {
m_libraryHandle = LoadLibraryA(m_libraryName.c_str());
if (m_libraryHandle == nullptr) {
std::string error =
std::string("LoadLibraryA() failed. Error code: ") +
std::to_string(::GetLastError());
throw InternalErrorException(error.c_str());
}
}
else {
m_libraryHandle = GetModuleHandleA(nullptr);
if (m_libraryHandle == nullptr) {
std::string error =
std::string("LoadLibraryA() failed. Error code: ") +
std::to_string(::GetLastError());
throw InternalErrorException(error.c_str());
}
}
for (std::string classFactoryName : classFactoryNames) {
if (classFactoryName.compare(0, std::string("Factory_").length(), "Factory_") == 0) {
const IClass& (*ClassFactoryFcn)() =
(const IClass & (*)())GetProcAddress(reinterpret_cast<HMODULE>(m_libraryHandle), classFactoryName.c_str());
m_classes.emplace(classFactoryName.substr(std::string("Factory_").length()), Class(ClassFactoryFcn()));
}
}
}
void ClassRegistry::Uninitialize() {
if (!m_libraryName.empty()) {
FreeLibrary(reinterpret_cast<HMODULE>(m_libraryHandle));
}
m_counter--;
if (m_counter == 0) {
::SymCleanup(GetCurrentProcess());
}
}
| 26.793103
| 111
| 0.692728
|
klemenm81
|
cf7815a2382d77de44a665c50ad6af7c14edfd86
| 2,032
|
cpp
|
C++
|
Netcode/Graphics/DX12/DX12ShaderCompiler.cpp
|
tyekx/netcode
|
c46fef1eeb33ad029d0c262d39309dfa83f76c4d
|
[
"MIT"
] | null | null | null |
Netcode/Graphics/DX12/DX12ShaderCompiler.cpp
|
tyekx/netcode
|
c46fef1eeb33ad029d0c262d39309dfa83f76c4d
|
[
"MIT"
] | null | null | null |
Netcode/Graphics/DX12/DX12ShaderCompiler.cpp
|
tyekx/netcode
|
c46fef1eeb33ad029d0c262d39309dfa83f76c4d
|
[
"MIT"
] | null | null | null |
#include "DX12ShaderCompiler.h"
#include <memory>
#include <Netcode/HandleTypes.h>
#include <Netcode/Utility.h>
#include "DX12Common.h"
#include "DX12Includes.h"
#include <d3dcompiler.h>
namespace Netcode::Graphics::DX12 {
static const char * GetShaderVersion(ShaderType type) {
switch(type) {
case ShaderType::VERTEX_SHADER: return "vs_5_0";
case ShaderType::PIXEL_SHADER: return "ps_5_0";
case ShaderType::GEOMETRY_SHADER: return "gs_5_0";
case ShaderType::HULL_SHADER: return "hs_5_0";
case ShaderType::DOMAIN_SHADER: return "ds_5_0";
default:
return "";
}
}
com_ptr<ID3DBlob> CompileShader(const std::string & shaderSource, const std::string & entryFunction, ShaderType type) {
std::map<std::string, std::string> nodefs;
return CompileShader(shaderSource, entryFunction, type, nodefs);
}
com_ptr<ID3DBlob> CompileShader(const std::string & shaderSource, const std::string & entryFunction, ShaderType type, const std::map<std::string, std::string> & definitions) {
com_ptr<ID3DBlob> byteCode;
Unique<D3D_SHADER_MACRO[]> preprocDefinitions{ nullptr };
if(definitions.size() > 0) {
preprocDefinitions = std::make_unique<D3D_SHADER_MACRO[]>(definitions.size() + 1);
int preprocIt = 0;
for(const auto & kv : definitions) {
preprocDefinitions[preprocIt].Name = kv.first.c_str();
preprocDefinitions[preprocIt].Definition = (kv.second.size() > 0) ? kv.second.c_str() : nullptr;
++preprocIt;
}
// "NULL" termination, API requires this, dont delete
preprocDefinitions[preprocIt].Name = nullptr;
preprocDefinitions[preprocIt].Definition = nullptr;
}
com_ptr<ID3DBlob> errorMsg;
D3DCompile(shaderSource.c_str(), shaderSource.size(), nullptr, preprocDefinitions.get(), nullptr, entryFunction.c_str(), GetShaderVersion(type), 0, 0, byteCode.GetAddressOf(), errorMsg.GetAddressOf());
if(errorMsg != nullptr) {
Netcode::Utility::Debugf("Error while compiling vertex shader (-Wall): \r\n");
DebugPrintBlob(errorMsg);
}
return byteCode;
}
}
| 33.866667
| 203
| 0.724902
|
tyekx
|
cf78fbf3a30403757cf3a6f8e904e29af49c05c4
| 13,207
|
cc
|
C++
|
test/extensions/transport_sockets/tls/test_private_key_method_provider.cc
|
dong-qiu/envoy
|
e550d8fe66666ac9cf7e15dc28985565f2255a61
|
[
"Apache-2.0"
] | null | null | null |
test/extensions/transport_sockets/tls/test_private_key_method_provider.cc
|
dong-qiu/envoy
|
e550d8fe66666ac9cf7e15dc28985565f2255a61
|
[
"Apache-2.0"
] | null | null | null |
test/extensions/transport_sockets/tls/test_private_key_method_provider.cc
|
dong-qiu/envoy
|
e550d8fe66666ac9cf7e15dc28985565f2255a61
|
[
"Apache-2.0"
] | null | null | null |
#include "test/extensions/transport_sockets/tls/test_private_key_method_provider.h"
#include <memory>
#include "envoy/api/api.h"
#include "openssl/ssl.h"
namespace Envoy {
namespace Extensions {
namespace PrivateKeyMethodProvider {
void TestPrivateKeyConnection::delayed_op() {
const std::chrono::milliseconds timeout_0ms{0};
timer_ = dispatcher_.createTimer([this]() -> void {
finished_ = true;
this->cb_.onPrivateKeyMethodComplete();
});
timer_->enableTimer(timeout_0ms);
}
static int calculateDigest(const EVP_MD* md, const uint8_t* in, size_t in_len, unsigned char* hash,
unsigned int* hash_len) {
bssl::ScopedEVP_MD_CTX ctx;
// Calculate the message digest for signing.
if (!EVP_DigestInit_ex(ctx.get(), md, nullptr) || !EVP_DigestUpdate(ctx.get(), in, in_len) ||
!EVP_DigestFinal_ex(ctx.get(), hash, hash_len)) {
return 0;
}
return 1;
}
static ssl_private_key_result_t ecdsaPrivateKeySign(SSL* ssl, uint8_t* out, size_t* out_len,
size_t max_out, uint16_t signature_algorithm,
const uint8_t* in, size_t in_len) {
unsigned char hash[EVP_MAX_MD_SIZE];
unsigned int hash_len;
TestPrivateKeyConnection* ops = static_cast<TestPrivateKeyConnection*>(
SSL_get_ex_data(ssl, TestPrivateKeyMethodProvider::ecdsaConnectionIndex()));
unsigned int out_len_unsigned;
if (!ops) {
return ssl_private_key_failure;
}
if (ops->test_options_.method_error_) {
// Have an artificial test failure.
return ssl_private_key_failure;
}
if (!ops->test_options_.sign_expected_) {
return ssl_private_key_failure;
}
const EVP_MD* md = SSL_get_signature_algorithm_digest(signature_algorithm);
if (!md) {
return ssl_private_key_failure;
}
if (!calculateDigest(md, in, in_len, hash, &hash_len)) {
return ssl_private_key_failure;
}
bssl::UniquePtr<EC_KEY> ec_key(EVP_PKEY_get1_EC_KEY(ops->getPrivateKey()));
if (!ec_key) {
return ssl_private_key_failure;
}
// Borrow "out" because it has been already initialized to the max_out size.
if (!ECDSA_sign(0, hash, hash_len, out, &out_len_unsigned, ec_key.get())) {
return ssl_private_key_failure;
}
if (ops->test_options_.sync_mode_) {
// Return immediately with the results.
if (out_len_unsigned > max_out) {
return ssl_private_key_failure;
}
*out_len = out_len_unsigned;
return ssl_private_key_success;
}
ops->output_.assign(out, out + out_len_unsigned);
// Tell SSL socket that the operation is ready to be called again.
ops->delayed_op();
return ssl_private_key_retry;
}
static ssl_private_key_result_t ecdsaPrivateKeyDecrypt(SSL*, uint8_t*, size_t*, size_t,
const uint8_t*, size_t) {
return ssl_private_key_failure;
}
static ssl_private_key_result_t rsaPrivateKeySign(SSL* ssl, uint8_t* out, size_t* out_len,
size_t max_out, uint16_t signature_algorithm,
const uint8_t* in, size_t in_len) {
TestPrivateKeyConnection* ops = static_cast<TestPrivateKeyConnection*>(
SSL_get_ex_data(ssl, TestPrivateKeyMethodProvider::rsaConnectionIndex()));
unsigned char hash[EVP_MAX_MD_SIZE];
unsigned int hash_len;
if (!ops) {
return ssl_private_key_failure;
}
if (ops->test_options_.method_error_) {
return ssl_private_key_failure;
}
if (!ops->test_options_.sign_expected_) {
return ssl_private_key_failure;
}
const EVP_MD* md = SSL_get_signature_algorithm_digest(signature_algorithm);
if (!md) {
return ssl_private_key_failure;
}
if (!calculateDigest(md, in, in_len, hash, &hash_len)) {
return ssl_private_key_failure;
}
RSA* rsa = EVP_PKEY_get0_RSA(ops->getPrivateKey());
if (rsa == nullptr) {
return ssl_private_key_failure;
}
if (ops->test_options_.crypto_error_) {
// Flip the bits in the first byte of the digest so that the handshake will fail.
hash[0] ^= hash[0];
}
// Perform RSA signing.
if (SSL_is_signature_algorithm_rsa_pss(signature_algorithm)) {
RSA_sign_pss_mgf1(rsa, out_len, out, max_out, hash, hash_len, md, nullptr, -1);
} else {
unsigned int out_len_unsigned;
if (!RSA_sign(EVP_MD_type(md), hash, hash_len, out, &out_len_unsigned, rsa)) {
return ssl_private_key_failure;
}
if (out_len_unsigned > max_out) {
return ssl_private_key_failure;
}
*out_len = out_len_unsigned;
}
if (ops->test_options_.sync_mode_) {
return ssl_private_key_success;
}
ops->output_.assign(out, out + *out_len);
ops->delayed_op();
return ssl_private_key_retry;
}
static ssl_private_key_result_t rsaPrivateKeyDecrypt(SSL* ssl, uint8_t* out, size_t* out_len,
size_t max_out, const uint8_t* in,
size_t in_len) {
TestPrivateKeyConnection* ops = static_cast<TestPrivateKeyConnection*>(
SSL_get_ex_data(ssl, TestPrivateKeyMethodProvider::rsaConnectionIndex()));
if (!ops) {
return ssl_private_key_failure;
}
if (ops->test_options_.method_error_) {
return ssl_private_key_failure;
}
if (!ops->test_options_.decrypt_expected_) {
return ssl_private_key_failure;
}
RSA* rsa = EVP_PKEY_get0_RSA(ops->getPrivateKey());
if (rsa == nullptr) {
return ssl_private_key_failure;
}
if (!RSA_decrypt(rsa, out_len, out, max_out, in, in_len, RSA_NO_PADDING)) {
return ssl_private_key_failure;
}
if (ops->test_options_.sync_mode_) {
return ssl_private_key_success;
}
ops->output_.assign(out, out + *out_len);
ops->delayed_op();
return ssl_private_key_retry;
}
static ssl_private_key_result_t privateKeyComplete(SSL* ssl, uint8_t* out, size_t* out_len,
size_t max_out, int id) {
TestPrivateKeyConnection* ops = static_cast<TestPrivateKeyConnection*>(SSL_get_ex_data(ssl, id));
if (!ops->finished_) {
// The operation didn't finish yet, retry.
return ssl_private_key_retry;
}
if (ops->test_options_.async_method_error_) {
return ssl_private_key_failure;
}
if (ops->output_.size() > max_out) {
return ssl_private_key_failure;
}
std::copy(ops->output_.begin(), ops->output_.end(), out);
*out_len = ops->output_.size();
return ssl_private_key_success;
}
static ssl_private_key_result_t rsaPrivateKeyComplete(SSL* ssl, uint8_t* out, size_t* out_len,
size_t max_out) {
return privateKeyComplete(ssl, out, out_len, max_out,
TestPrivateKeyMethodProvider::rsaConnectionIndex());
}
static ssl_private_key_result_t ecdsaPrivateKeyComplete(SSL* ssl, uint8_t* out, size_t* out_len,
size_t max_out) {
return privateKeyComplete(ssl, out, out_len, max_out,
TestPrivateKeyMethodProvider::ecdsaConnectionIndex());
}
Ssl::BoringSslPrivateKeyMethodSharedPtr
TestPrivateKeyMethodProvider::getBoringSslPrivateKeyMethod() {
return method_;
}
bool TestPrivateKeyMethodProvider::checkFips() {
if (mode_ == "rsa") {
RSA* rsa_private_key = EVP_PKEY_get0_RSA(pkey_.get());
if (rsa_private_key == nullptr || !RSA_check_fips(rsa_private_key)) {
return false;
}
} else { // if (mode_ == "ecdsa")
const EC_KEY* ecdsa_private_key = EVP_PKEY_get0_EC_KEY(pkey_.get());
if (ecdsa_private_key == nullptr || !EC_KEY_check_fips(ecdsa_private_key)) {
return false;
}
}
return true;
}
TestPrivateKeyConnection::TestPrivateKeyConnection(
Ssl::PrivateKeyConnectionCallbacks& cb, Event::Dispatcher& dispatcher,
bssl::UniquePtr<EVP_PKEY> pkey, TestPrivateKeyConnectionTestOptions& test_options)
: test_options_(test_options), cb_(cb), dispatcher_(dispatcher), pkey_(std::move(pkey)) {}
void TestPrivateKeyMethodProvider::registerPrivateKeyMethod(SSL* ssl,
Ssl::PrivateKeyConnectionCallbacks& cb,
Event::Dispatcher& dispatcher) {
TestPrivateKeyConnection* ops;
// In multi-cert case, when the same provider is used in different modes with the same SSL object,
// we need to keep both rsa and ecdsa connection objects in store because the test options for the
// two certificates may be different. We need to be able to deduct in the signing, decryption, and
// completion functions which options to use, so we associate the connection objects to the same
// SSL object using different user data indexes.
//
// Another way to do this would be to store both test options in one connection object.
int index = mode_ == "rsa" ? TestPrivateKeyMethodProvider::rsaConnectionIndex()
: TestPrivateKeyMethodProvider::ecdsaConnectionIndex();
// Check if there is another certificate of the same mode associated with the context. This would
// be an error.
ops = static_cast<TestPrivateKeyConnection*>(SSL_get_ex_data(ssl, index));
if (ops != nullptr) {
throw EnvoyException(
"Can't distinguish between two registered providers for the same SSL object.");
}
ops = new TestPrivateKeyConnection(cb, dispatcher, bssl::UpRef(pkey_), test_options_);
SSL_set_ex_data(ssl, index, ops);
}
void TestPrivateKeyMethodProvider::unregisterPrivateKeyMethod(SSL* ssl) {
int index = mode_ == "rsa" ? TestPrivateKeyMethodProvider::rsaConnectionIndex()
: TestPrivateKeyMethodProvider::ecdsaConnectionIndex();
TestPrivateKeyConnection* ops =
static_cast<TestPrivateKeyConnection*>(SSL_get_ex_data(ssl, index));
SSL_set_ex_data(ssl, index, nullptr);
delete ops;
}
static int createIndex() {
int index = SSL_get_ex_new_index(0, nullptr, nullptr, nullptr, nullptr);
RELEASE_ASSERT(index >= 0, "Failed to get SSL user data index.");
return index;
}
int TestPrivateKeyMethodProvider::rsaConnectionIndex() {
CONSTRUCT_ON_FIRST_USE(int, createIndex());
}
int TestPrivateKeyMethodProvider::ecdsaConnectionIndex() {
CONSTRUCT_ON_FIRST_USE(int, createIndex());
}
TestPrivateKeyMethodProvider::TestPrivateKeyMethodProvider(
const ProtobufWkt::Struct& config,
Server::Configuration::TransportSocketFactoryContext& factory_context) {
std::string private_key_path;
for (auto& value_it : config.fields()) {
auto& value = value_it.second;
if (value_it.first == "private_key_file" &&
value.kind_case() == ProtobufWkt::Value::kStringValue) {
private_key_path = value.string_value();
}
if (value_it.first == "sync_mode" && value.kind_case() == ProtobufWkt::Value::kBoolValue) {
test_options_.sync_mode_ = value.bool_value();
}
if (value_it.first == "crypto_error" && value.kind_case() == ProtobufWkt::Value::kBoolValue) {
test_options_.crypto_error_ = value.bool_value();
}
if (value_it.first == "method_error" && value.kind_case() == ProtobufWkt::Value::kBoolValue) {
test_options_.method_error_ = value.bool_value();
}
if (value_it.first == "async_method_error" &&
value.kind_case() == ProtobufWkt::Value::kBoolValue) {
test_options_.async_method_error_ = value.bool_value();
}
if (value_it.first == "expected_operation" &&
value.kind_case() == ProtobufWkt::Value::kStringValue) {
if (value.string_value() == "decrypt") {
test_options_.decrypt_expected_ = true;
} else if (value.string_value() == "sign") {
test_options_.sign_expected_ = true;
}
}
if (value_it.first == "mode" && value.kind_case() == ProtobufWkt::Value::kStringValue) {
mode_ = value.string_value();
}
}
std::string private_key = factory_context.api().fileSystem().fileReadToEnd(private_key_path);
bssl::UniquePtr<BIO> bio(
BIO_new_mem_buf(const_cast<char*>(private_key.data()), private_key.size()));
bssl::UniquePtr<EVP_PKEY> pkey(PEM_read_bio_PrivateKey(bio.get(), nullptr, nullptr, nullptr));
if (pkey == nullptr) {
throw EnvoyException("Failed to read private key from disk.");
}
method_ = std::make_shared<SSL_PRIVATE_KEY_METHOD>();
// Have two modes, "rsa" and "ecdsa", for testing multi-cert use cases.
if (mode_ == "rsa") {
if (EVP_PKEY_id(pkey.get()) != EVP_PKEY_RSA) {
throw EnvoyException("Private key is not RSA.");
}
method_->sign = rsaPrivateKeySign;
method_->decrypt = rsaPrivateKeyDecrypt;
method_->complete = rsaPrivateKeyComplete;
} else if (mode_ == "ecdsa") {
if (EVP_PKEY_id(pkey.get()) != EVP_PKEY_EC) {
throw EnvoyException("Private key is not ECDSA.");
}
method_->sign = ecdsaPrivateKeySign;
method_->decrypt = ecdsaPrivateKeyDecrypt;
method_->complete = ecdsaPrivateKeyComplete;
} else {
throw EnvoyException("Unknown test provider mode, supported modes are \"rsa\" and \"ecdsa\".");
}
pkey_ = std::move(pkey);
}
} // namespace PrivateKeyMethodProvider
} // namespace Extensions
} // namespace Envoy
| 34.939153
| 100
| 0.682668
|
dong-qiu
|
cf7a51eb39090efc37a8cbc218f8674b95708b5c
| 2,966
|
cpp
|
C++
|
Source.cpp
|
kenjinote/INIFile
|
7c4006bc1054b7815cf87fd2a8b678c52234ddca
|
[
"MIT"
] | 2
|
2017-10-29T15:00:06.000Z
|
2018-07-07T01:36:29.000Z
|
Source.cpp
|
kenjinote/INIFile
|
7c4006bc1054b7815cf87fd2a8b678c52234ddca
|
[
"MIT"
] | null | null | null |
Source.cpp
|
kenjinote/INIFile
|
7c4006bc1054b7815cf87fd2a8b678c52234ddca
|
[
"MIT"
] | null | null | null |
#pragma comment(linker, "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#pragma comment(lib, "shlwapi")
#include <windows.h>
#include <shlwapi.h>
TCHAR szClassName[] = TEXT("Window");
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static HWND hButton1;
static HWND hButton2;
static TCHAR szINIFilePath[MAX_PATH];
TCHAR szText[256];
switch (msg)
{
case WM_CREATE:
// INIファイルのパスを作成(exeの隣にする)
GetModuleFileName(((LPCREATESTRUCT)lParam)->hInstance, szINIFilePath, MAX_PATH);
PathRemoveExtension(szINIFilePath);
PathAddExtension(szINIFilePath, TEXT(".ini"));
// ボタンの作成
hButton1 = CreateWindow(TEXT("BUTTON"), TEXT("INIファイル書き込み"),
WS_VISIBLE | WS_CHILD, 10, 10, 256, 32, hWnd, (HMENU)100,
((LPCREATESTRUCT)lParam)->hInstance, 0);
hButton2 = CreateWindow(TEXT("BUTTON"), TEXT("INIファイル読み込み"),
WS_VISIBLE | WS_CHILD, 10, 50, 256, 32, hWnd, (HMENU)101,
((LPCREATESTRUCT)lParam)->hInstance, 0);
break;
case WM_COMMAND:
if (LOWORD(wParam) == 100) // INIファイル書き込み
{
#ifdef UNICODE
// Unicode で書き込むためには、あらかじめ BOM を設定しておく必要があります。
HANDLE hFile = CreateFile(szINIFilePath, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL);
if (hFile != INVALID_HANDLE_VALUE)
{
BYTE bom[2] = { 0xFF, 0xFE };
DWORD dwWritten;
WriteFile(hFile, bom, 2, &dwWritten, NULL);
CloseHandle(hFile);
}
#endif
// 文字列をINIファイルに保存
WritePrivateProfileString(TEXT("APP"), TEXT("VALUE1"), TEXT("あいうえお"), szINIFilePath);
// 整数値をINIファイルに保存(実際には数値を書き込むAPIは無いので文字列に変換して保存)
wsprintf(szText, TEXT("%d"), 123);
WritePrivateProfileString(TEXT("APP"), TEXT("VALUE2"), szText, szINIFilePath);
}
else if (LOWORD(wParam) == 101) // INIファイル読み込み
{
// INIファイルから文字列を取得
GetPrivateProfileString(TEXT("APP"), TEXT("VALUE1"), TEXT("DEFAULT"), szText, 256, szINIFilePath);
MessageBox(hWnd, szText, TEXT("確認"), 0);
// INIファイルから整数値を取得
const int nValue = GetPrivateProfileInt(TEXT("APP"), TEXT("VALUE2"), -1, szINIFilePath);
wsprintf(szText, TEXT("%d"), nValue);
MessageBox(hWnd, szText, TEXT("確認"), 0);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, msg, wParam, lParam);
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst, LPSTR pCmdLine, int nCmdShow)
{
MSG msg;
WNDCLASS wndclass = {
CS_HREDRAW | CS_VREDRAW,
WndProc,
0,
0,
hInstance,
0,
LoadCursor(0,IDC_ARROW),
(HBRUSH)(COLOR_WINDOW + 1),
0,
szClassName
};
RegisterClass(&wndclass);
HWND hWnd = CreateWindow(
szClassName,
TEXT("Window"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
0,
CW_USEDEFAULT,
0,
0,
0,
hInstance,
0
);
ShowWindow(hWnd, SW_SHOWDEFAULT);
UpdateWindow(hWnd);
while (GetMessage(&msg, 0, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int)msg.wParam;
}
| 27.211009
| 196
| 0.694538
|
kenjinote
|
cf80f50fc4932297b7eb2904d08061c20a6fb2aa
| 2,954
|
cpp
|
C++
|
src/http/http_connection.cpp
|
hsbyhub/libxco
|
e71f995839886c69e710ca5811403f025b8d0c4f
|
[
"MulanPSL-1.0"
] | 3
|
2022-03-12T03:01:24.000Z
|
2022-03-23T11:02:48.000Z
|
src/http/http_connection.cpp
|
hsbyhub/libxco
|
e71f995839886c69e710ca5811403f025b8d0c4f
|
[
"MulanPSL-1.0"
] | null | null | null |
src/http/http_connection.cpp
|
hsbyhub/libxco
|
e71f995839886c69e710ca5811403f025b8d0c4f
|
[
"MulanPSL-1.0"
] | 1
|
2022-03-21T05:36:03.000Z
|
2022-03-21T05:36:03.000Z
|
/*================================================================*
Copyright (C) 2021 All rights reserved, www.hsby.link.
文件名称:http_session.cc
创 建 者:汉森伯逸
创建日期:2021/12/30
*================================================================*/
#include "http/http_connection.h"
#include "http/http_paser.h"
XCO_NAMESPAVE_START
namespace http {
HttpConnection::HttpConnection(Socket::Ptr socket, bool auto_close) : SocketStream(socket, auto_close) {
}
HttpConnection::Ptr HttpConnection::Create(Socket::Ptr socket, bool auto_close) {
return std::make_shared<HttpConnection>(socket, auto_close);
}
HttpResponse::Ptr HttpConnection::RecvResponse() {
auto http_rsp_parser = HttpResponseParser::Create();
if (!http_rsp_parser) {
return nullptr;
}
int buff_size = HttpRequestParser::GetHttpRequestMaxBodySize();
std::vector<char> buffer(buff_size, 0);
char* data = &buffer[0];
size_t parse_off = 0;
size_t data_len = 0;
int ret = ReadHandle(data, buff_size, [&parse_off, &data_len, http_rsp_parser, data](int len) -> int{
if (len <= 0) {
return -1;
}
parse_off = 0;
data_len = len;
while (parse_off < (size_t)len) {
size_t parse_len = http_rsp_parser->Parse(data, len, 0, false);
if (parse_len <= 0 || http_rsp_parser->HasError()) {
return -1;
}
parse_off += parse_len;
if (http_rsp_parser->IsFinished()) {
return 0;
}
}
return 1;
});
if (ret != 0) {
Close();
return nullptr;
}
size_t body_length = http_rsp_parser->GetContentLength();
std::string body;
auto parser = http_rsp_parser->GetParser();
if (parser.chunked) {
}else {
// 填充body
if (body_length > 0) {
body.resize(body_length);
int len = std::min(data_len - parse_off, body_length);
memcpy(&body[0], data + parse_off, len);
body_length -= len;
// 追加body
if (body_length > 0) {
if (ReadFixSize(&body[len], body_length) <= 0) {
Close();
return nullptr;
}
}
http_rsp_parser->GetResponse()->SetBody(body);
}
}
// 初始化
// http_rsp_parser->GetResponse()->Init();
auto rsp = http_rsp_parser->GetResponse();
if (rsp) {
auto conn_value = rsp->GetHeader("connection");
if (strcasecmp(conn_value.c_str(), "keep-alive") == 0) {
rsp->SetIsClose(false);
}else {
rsp->SetIsClose(true);
}
}
return http_rsp_parser->GetResponse();
}
int HttpConnection::SendRequest(HttpRequest::Ptr req) {
std::stringstream ss;
auto data = req->ToString();
return WriteFixSize(data.c_str(), data.size());
}
}//namespace http
XCO_NAMESPAVE_END
| 29.247525
| 105
| 0.545701
|
hsbyhub
|
cf81b19407d8f9067110ded9557085cdfad08621
| 709
|
cpp
|
C++
|
acmicpcnet/2104.cpp
|
irresi/algostudy
|
489739d641d6e36bbedf86be6391d1db27456585
|
[
"MIT"
] | null | null | null |
acmicpcnet/2104.cpp
|
irresi/algostudy
|
489739d641d6e36bbedf86be6391d1db27456585
|
[
"MIT"
] | null | null | null |
acmicpcnet/2104.cpp
|
irresi/algostudy
|
489739d641d6e36bbedf86be6391d1db27456585
|
[
"MIT"
] | null | null | null |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll,ll>;
const int inf=1e9+3;
#define all(x) (x).begin(),(x).end()
#define sync() {ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0); //do not use ;
ll sum[100003],arr[100003],ans,n;
vector<pll> v;
set<ll> lib;
int main()
{
int i,j;
cin>>n;
for(i=1;i<=n;i++){
cin>>arr[i];
sum[i]=sum[i-1]+arr[i];
v.push_back({arr[i],i});
}
lib.insert(0);
lib.insert(n+1);
sort(all(v));
set<ll>::iterator si,sj;
for(auto [val,idx] : v){
sj = lib.lower_bound(idx);
si=sj; --si;
ans=max(ans,val*(sum[*sj-1]-sum[*si]));
lib.insert(idx);
}
cout<<ans;
return 0;
}
| 21.484848
| 84
| 0.551481
|
irresi
|
cf81eb237624ea699f3ce181c30652a5980a9323
| 17,994
|
cpp
|
C++
|
simulation/simulation_interface/test/test_conversions.cpp
|
autocore-ai/scenario_simulator_v2
|
bb9569043e20649f0e4390e9225b6bb7b4de10b6
|
[
"Apache-2.0"
] | null | null | null |
simulation/simulation_interface/test/test_conversions.cpp
|
autocore-ai/scenario_simulator_v2
|
bb9569043e20649f0e4390e9225b6bb7b4de10b6
|
[
"Apache-2.0"
] | null | null | null |
simulation/simulation_interface/test/test_conversions.cpp
|
autocore-ai/scenario_simulator_v2
|
bb9569043e20649f0e4390e9225b6bb7b4de10b6
|
[
"Apache-2.0"
] | null | null | null |
// Copyright 2015-2020 Tier IV, Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <geometry_msgs.pb.h>
#include <gtest/gtest.h>
#include <geometry_msgs/msg/accel.hpp>
#include <geometry_msgs/msg/point.hpp>
#include <geometry_msgs/msg/pose.hpp>
#include <geometry_msgs/msg/quaternion.hpp>
#include <geometry_msgs/msg/twist.hpp>
#include <geometry_msgs/msg/vector3.hpp>
#include <scenario_simulator_exception/exception.hpp>
#include <simulation_interface/conversions.hpp>
#include <string>
#define EXPECT_CONTROL_COMMAND_EQ(msg, proto) \
EXPECT_DOUBLE_EQ(msg.velocity, proto.velocity()); \
EXPECT_DOUBLE_EQ(msg.steering_angle_velocity, proto.steering_angle_velocity()); \
EXPECT_DOUBLE_EQ(msg.steering_angle, proto.steering_angle()); \
EXPECT_DOUBLE_EQ(msg.acceleration, proto.acceleration());
#define EXPECT_HEADER_EQ(msg, proto) \
EXPECT_STREQ(msg.frame_id.c_str(), proto.frame_id().c_str()); \
EXPECT_EQ(msg.stamp.sec, proto.stamp().sec()); \
EXPECT_EQ(msg.stamp.nanosec, proto.stamp().nanosec());
TEST(Conversion, ConvertPoint)
{
geometry_msgs::Point proto;
geometry_msgs::msg::Point p;
p.x = 1.0;
p.y = 2;
p.z = 3.1;
simulation_interface::toProto(p, proto);
EXPECT_DOUBLE_EQ(p.x, proto.x());
EXPECT_DOUBLE_EQ(p.y, proto.y());
EXPECT_DOUBLE_EQ(p.z, proto.z());
p = geometry_msgs::msg::Point();
EXPECT_DOUBLE_EQ(p.x, 0);
simulation_interface::toMsg(proto, p);
EXPECT_DOUBLE_EQ(p.x, proto.x());
EXPECT_DOUBLE_EQ(p.y, proto.y());
EXPECT_DOUBLE_EQ(p.z, proto.z());
}
TEST(Conversion, ConvertQuaternion)
{
geometry_msgs::Quaternion proto;
geometry_msgs::msg::Quaternion q;
q.x = 1.0;
q.y = 2;
q.z = 3.1;
q.w = -10;
simulation_interface::toProto(q, proto);
EXPECT_DOUBLE_EQ(q.x, proto.x());
EXPECT_DOUBLE_EQ(q.y, proto.y());
EXPECT_DOUBLE_EQ(q.z, proto.z());
EXPECT_DOUBLE_EQ(q.w, proto.w());
q = geometry_msgs::msg::Quaternion();
EXPECT_DOUBLE_EQ(q.x, 0);
simulation_interface::toMsg(proto, q);
EXPECT_DOUBLE_EQ(q.x, proto.x());
EXPECT_DOUBLE_EQ(q.y, proto.y());
EXPECT_DOUBLE_EQ(q.z, proto.z());
EXPECT_DOUBLE_EQ(q.w, proto.w());
}
TEST(Conversion, ConvertPose)
{
geometry_msgs::Pose proto;
geometry_msgs::msg::Pose p;
p.position.x = 1.0;
p.position.y = 2;
p.position.z = 3.1;
p.orientation.x = 0;
p.orientation.y = 0;
p.orientation.z = 0;
p.orientation.w = 1;
simulation_interface::toProto(p, proto);
EXPECT_DOUBLE_EQ(p.position.x, proto.position().x());
EXPECT_DOUBLE_EQ(p.position.y, proto.position().y());
EXPECT_DOUBLE_EQ(p.position.z, proto.position().z());
EXPECT_DOUBLE_EQ(p.orientation.x, proto.orientation().x());
EXPECT_DOUBLE_EQ(p.orientation.y, proto.orientation().y());
EXPECT_DOUBLE_EQ(p.orientation.z, proto.orientation().z());
EXPECT_DOUBLE_EQ(p.orientation.w, proto.orientation().w());
p = geometry_msgs::msg::Pose();
EXPECT_DOUBLE_EQ(p.position.x, 0);
simulation_interface::toMsg(proto, p);
EXPECT_DOUBLE_EQ(p.position.x, proto.position().x());
EXPECT_DOUBLE_EQ(p.position.y, proto.position().y());
EXPECT_DOUBLE_EQ(p.position.z, proto.position().z());
EXPECT_DOUBLE_EQ(p.orientation.x, proto.orientation().x());
EXPECT_DOUBLE_EQ(p.orientation.y, proto.orientation().y());
EXPECT_DOUBLE_EQ(p.orientation.z, proto.orientation().z());
EXPECT_DOUBLE_EQ(p.orientation.w, proto.orientation().w());
}
TEST(Conversion, ConvertVector)
{
geometry_msgs::Vector3 proto;
geometry_msgs::msg::Vector3 vec;
vec.x = 1;
vec.y = 2;
vec.z = 3.0;
simulation_interface::toProto(vec, proto);
EXPECT_DOUBLE_EQ(vec.x, proto.x());
EXPECT_DOUBLE_EQ(vec.y, proto.y());
EXPECT_DOUBLE_EQ(vec.z, proto.z());
vec = geometry_msgs::msg::Vector3();
EXPECT_DOUBLE_EQ(vec.x, 0);
simulation_interface::toMsg(proto, vec);
EXPECT_DOUBLE_EQ(vec.x, proto.x());
EXPECT_DOUBLE_EQ(vec.y, proto.y());
EXPECT_DOUBLE_EQ(vec.z, proto.z());
}
TEST(Conversion, ConvertTwist)
{
geometry_msgs::Twist proto;
geometry_msgs::msg::Twist twist;
twist.linear.x = 1;
twist.linear.y = 2;
twist.linear.z = 3.0;
simulation_interface::toProto(twist, proto);
EXPECT_DOUBLE_EQ(twist.linear.x, proto.linear().x());
EXPECT_DOUBLE_EQ(twist.linear.y, proto.linear().y());
EXPECT_DOUBLE_EQ(twist.linear.z, proto.linear().z());
EXPECT_DOUBLE_EQ(twist.angular.x, proto.angular().x());
EXPECT_DOUBLE_EQ(twist.angular.y, proto.angular().y());
EXPECT_DOUBLE_EQ(twist.angular.z, proto.angular().z());
twist = geometry_msgs::msg::Twist();
EXPECT_DOUBLE_EQ(twist.linear.x, 0);
simulation_interface::toMsg(proto, twist);
EXPECT_DOUBLE_EQ(twist.linear.x, proto.linear().x());
EXPECT_DOUBLE_EQ(twist.linear.y, proto.linear().y());
EXPECT_DOUBLE_EQ(twist.linear.z, proto.linear().z());
EXPECT_DOUBLE_EQ(twist.angular.x, proto.angular().x());
EXPECT_DOUBLE_EQ(twist.angular.y, proto.angular().y());
EXPECT_DOUBLE_EQ(twist.angular.z, proto.angular().z());
}
TEST(Conversion, ConvertAccel)
{
geometry_msgs::Accel proto;
geometry_msgs::msg::Accel accel;
accel.linear.x = 1;
accel.linear.y = 2;
accel.linear.z = 3.0;
simulation_interface::toProto(accel, proto);
EXPECT_DOUBLE_EQ(accel.linear.x, proto.linear().x());
EXPECT_DOUBLE_EQ(accel.linear.y, proto.linear().y());
EXPECT_DOUBLE_EQ(accel.linear.z, proto.linear().z());
EXPECT_DOUBLE_EQ(accel.angular.x, proto.angular().x());
EXPECT_DOUBLE_EQ(accel.angular.y, proto.angular().y());
EXPECT_DOUBLE_EQ(accel.angular.z, proto.angular().z());
accel = geometry_msgs::msg::Accel();
EXPECT_DOUBLE_EQ(accel.linear.x, 0);
simulation_interface::toMsg(proto, accel);
EXPECT_DOUBLE_EQ(accel.linear.x, proto.linear().x());
EXPECT_DOUBLE_EQ(accel.linear.y, proto.linear().y());
EXPECT_DOUBLE_EQ(accel.linear.z, proto.linear().z());
EXPECT_DOUBLE_EQ(accel.angular.x, proto.angular().x());
EXPECT_DOUBLE_EQ(accel.angular.y, proto.angular().y());
EXPECT_DOUBLE_EQ(accel.angular.z, proto.angular().z());
}
TEST(Conversion, ConvertPerformance)
{
openscenario_msgs::Performance proto;
openscenario_msgs::msg::Performance performance;
performance.max_speed = 10;
performance.max_deceleration = 3;
simulation_interface::toProto(performance, proto);
EXPECT_DOUBLE_EQ(performance.max_acceleration, proto.max_acceleration());
EXPECT_DOUBLE_EQ(performance.max_deceleration, proto.max_deceleration());
EXPECT_DOUBLE_EQ(performance.max_speed, proto.max_speed());
performance = openscenario_msgs::msg::Performance();
EXPECT_DOUBLE_EQ(performance.max_speed, 0);
simulation_interface::toMsg(proto, performance);
EXPECT_DOUBLE_EQ(performance.max_acceleration, proto.max_acceleration());
EXPECT_DOUBLE_EQ(performance.max_deceleration, proto.max_deceleration());
EXPECT_DOUBLE_EQ(performance.max_speed, proto.max_speed());
}
TEST(Conversion, ConvertAxle)
{
openscenario_msgs::Axle proto;
openscenario_msgs::msg::Axle axle;
axle.max_steering = 30;
axle.position_x = 3;
axle.position_z = 14;
axle.track_width = -10;
axle.wheel_diameter = 53;
simulation_interface::toProto(axle, proto);
EXPECT_DOUBLE_EQ(axle.max_steering, proto.max_steering());
EXPECT_DOUBLE_EQ(axle.position_x, proto.position_x());
EXPECT_DOUBLE_EQ(axle.position_z, proto.position_z());
EXPECT_DOUBLE_EQ(axle.track_width, proto.track_width());
EXPECT_DOUBLE_EQ(axle.wheel_diameter, proto.wheel_diameter());
axle = openscenario_msgs::msg::Axle();
EXPECT_DOUBLE_EQ(axle.max_steering, 0);
simulation_interface::toMsg(proto, axle);
EXPECT_DOUBLE_EQ(axle.max_steering, proto.max_steering());
EXPECT_DOUBLE_EQ(axle.position_x, proto.position_x());
EXPECT_DOUBLE_EQ(axle.position_z, proto.position_z());
EXPECT_DOUBLE_EQ(axle.track_width, proto.track_width());
EXPECT_DOUBLE_EQ(axle.wheel_diameter, proto.wheel_diameter());
}
TEST(Conversion, ConvertAxles)
{
openscenario_msgs::Axles proto;
openscenario_msgs::msg::Axles axles;
axles.front_axle.max_steering = 3;
axles.front_axle.position_x = 35;
axles.front_axle.position_z = 234;
axles.front_axle.track_width = 1;
axles.front_axle.wheel_diameter = 123;
axles.rear_axle.max_steering = 13;
axles.rear_axle.position_x = 3;
axles.rear_axle.position_z = 23;
axles.rear_axle.track_width = 14;
axles.rear_axle.wheel_diameter = 122;
simulation_interface::toProto(axles, proto);
EXPECT_DOUBLE_EQ(axles.front_axle.max_steering, proto.front_axle().max_steering());
EXPECT_DOUBLE_EQ(axles.front_axle.position_x, proto.front_axle().position_x());
EXPECT_DOUBLE_EQ(axles.front_axle.position_z, proto.front_axle().position_z());
EXPECT_DOUBLE_EQ(axles.front_axle.track_width, proto.front_axle().track_width());
EXPECT_DOUBLE_EQ(axles.front_axle.wheel_diameter, proto.front_axle().wheel_diameter());
EXPECT_DOUBLE_EQ(axles.rear_axle.max_steering, proto.rear_axle().max_steering());
EXPECT_DOUBLE_EQ(axles.rear_axle.position_x, proto.rear_axle().position_x());
EXPECT_DOUBLE_EQ(axles.rear_axle.position_z, proto.rear_axle().position_z());
EXPECT_DOUBLE_EQ(axles.rear_axle.track_width, proto.rear_axle().track_width());
EXPECT_DOUBLE_EQ(axles.rear_axle.wheel_diameter, proto.rear_axle().wheel_diameter());
axles = openscenario_msgs::msg::Axles();
EXPECT_DOUBLE_EQ(axles.front_axle.max_steering, 0);
simulation_interface::toMsg(proto, axles);
EXPECT_DOUBLE_EQ(axles.front_axle.max_steering, proto.front_axle().max_steering());
EXPECT_DOUBLE_EQ(axles.front_axle.position_x, proto.front_axle().position_x());
EXPECT_DOUBLE_EQ(axles.front_axle.position_z, proto.front_axle().position_z());
EXPECT_DOUBLE_EQ(axles.front_axle.track_width, proto.front_axle().track_width());
EXPECT_DOUBLE_EQ(axles.front_axle.wheel_diameter, proto.front_axle().wheel_diameter());
EXPECT_DOUBLE_EQ(axles.rear_axle.max_steering, proto.rear_axle().max_steering());
EXPECT_DOUBLE_EQ(axles.rear_axle.position_x, proto.rear_axle().position_x());
EXPECT_DOUBLE_EQ(axles.rear_axle.position_z, proto.rear_axle().position_z());
EXPECT_DOUBLE_EQ(axles.rear_axle.track_width, proto.rear_axle().track_width());
EXPECT_DOUBLE_EQ(axles.rear_axle.wheel_diameter, proto.rear_axle().wheel_diameter());
}
/*
TEST(Conversion, ConvertProperty)
{
openscenario_msgs::Property proto;
openscenario_msgs::msg::Property p;
EXPECT_NO_THROW(simulation_interface::toProto(p, proto));
EXPECT_NO_THROW(simulation_interface::toMsg(proto, p));
// p.is_ego = true;
// EXPECT_EQ(proto.is_ego(), p.is_ego);
// p.is_ego = false;
// EXPECT_EQ(proto.is_ego(), p.is_ego);
}
*/
TEST(Conversion, ConvertVehicleParametrs)
{
openscenario_msgs::VehicleParameters proto;
openscenario_msgs::msg::VehicleParameters p;
// p.property.is_ego = true;
EXPECT_NO_THROW(simulation_interface::toProto(p, proto));
// EXPECT_EQ(proto.property().is_ego(), p.property.is_ego);
// p.property.is_ego = false;
EXPECT_NO_THROW(simulation_interface::toMsg(proto, p));
// EXPECT_EQ(proto.property().is_ego(), p.property.is_ego);
}
TEST(Conversion, ConvertMiscObjectParametrs)
{
openscenario_msgs::MiscObjectParameters proto;
openscenario_msgs::msg::MiscObjectParameters p;
p.misc_object_category = "obstacle";
EXPECT_NO_THROW(simulation_interface::toProto(p, proto));
EXPECT_STREQ(p.misc_object_category.c_str(), proto.misc_object_category().c_str());
p.misc_object_category = "";
EXPECT_NO_THROW(simulation_interface::toMsg(proto, p));
EXPECT_STREQ(p.misc_object_category.c_str(), proto.misc_object_category().c_str());
}
TEST(Conversion, ConvertActionStatus)
{
openscenario_msgs::ActionStatus proto;
openscenario_msgs::msg::ActionStatus action;
action.current_action = "test";
action.twist.linear.x = 1.0;
action.twist.linear.y = 2.0;
action.twist.linear.z = 3.0;
action.twist.angular.x = -20;
action.twist.angular.y = -4.2;
action.twist.angular.z = 9;
action.accel.linear.x = 3.0;
action.accel.linear.y = 908;
action.accel.linear.z = 987.0;
action.accel.angular.x = 0.3;
action.accel.angular.y = 0.5;
action.accel.angular.z = 98;
simulation_interface::toProto(action, proto);
EXPECT_STREQ(action.current_action.c_str(), proto.current_action().c_str());
EXPECT_DOUBLE_EQ(action.twist.linear.x, proto.twist().linear().x());
EXPECT_DOUBLE_EQ(action.twist.linear.y, proto.twist().linear().y());
EXPECT_DOUBLE_EQ(action.twist.linear.z, proto.twist().linear().z());
EXPECT_DOUBLE_EQ(action.twist.angular.x, proto.twist().angular().x());
EXPECT_DOUBLE_EQ(action.twist.angular.y, proto.twist().angular().y());
EXPECT_DOUBLE_EQ(action.twist.angular.z, proto.twist().angular().z());
EXPECT_DOUBLE_EQ(action.accel.linear.x, proto.accel().linear().x());
EXPECT_DOUBLE_EQ(action.accel.linear.y, proto.accel().linear().y());
EXPECT_DOUBLE_EQ(action.accel.linear.z, proto.accel().linear().z());
EXPECT_DOUBLE_EQ(action.accel.angular.x, proto.accel().angular().x());
EXPECT_DOUBLE_EQ(action.accel.angular.y, proto.accel().angular().y());
EXPECT_DOUBLE_EQ(action.accel.angular.z, proto.accel().angular().z());
}
TEST(Conversion, Time)
{
builtin_interfaces::Time proto;
builtin_interfaces::msg::Time msg;
msg.nanosec = 1;
msg.sec = 2;
simulation_interface::toProto(msg, proto);
EXPECT_EQ(msg.nanosec, proto.nanosec());
EXPECT_EQ(msg.sec, proto.sec());
msg.nanosec = 0;
msg.sec = 0;
simulation_interface::toMsg(proto, msg);
EXPECT_EQ(msg.nanosec, proto.nanosec());
EXPECT_EQ(msg.sec, proto.sec());
}
TEST(Conversion, Duration)
{
builtin_interfaces::Duration proto;
builtin_interfaces::msg::Duration msg;
msg.nanosec = 1;
msg.sec = 2;
simulation_interface::toProto(msg, proto);
EXPECT_EQ(msg.nanosec, proto.nanosec());
EXPECT_EQ(msg.sec, proto.sec());
msg.nanosec = 0;
msg.sec = 0;
simulation_interface::toMsg(proto, msg);
EXPECT_EQ(msg.nanosec, proto.nanosec());
EXPECT_EQ(msg.sec, proto.sec());
}
TEST(Conversion, Header)
{
std_msgs::Header proto;
std_msgs::msg::Header msg;
msg.frame_id = "base_link";
msg.stamp.nanosec = 4;
msg.stamp.sec = 1;
simulation_interface::toProto(msg, proto);
EXPECT_HEADER_EQ(msg, proto);
msg.frame_id = "";
msg.stamp.nanosec = 0;
msg.stamp.sec = 0;
simulation_interface::toMsg(proto, msg);
EXPECT_HEADER_EQ(msg, proto);
}
TEST(Conversion, ControlCommand)
{
autoware_control_msgs::ControlCommand proto;
autoware_control_msgs::msg::ControlCommand msg;
msg.acceleration = 3;
msg.steering_angle = 1.4;
msg.steering_angle_velocity = 13.4;
msg.velocity = 11.3;
simulation_interface::toProto(msg, proto);
EXPECT_CONTROL_COMMAND_EQ(msg, proto);
msg.acceleration = 0;
msg.steering_angle = 0;
msg.steering_angle_velocity = 0;
msg.velocity = 0;
simulation_interface::toMsg(proto, msg);
}
TEST(Conversion, Shift)
{
autoware_vehicle_msgs::Shift proto;
proto.set_data(autoware_vehicle_msgs::SHIFT_POSITIONS::PARKING);
autoware_vehicle_msgs::msg::Shift msg;
msg.data = autoware_vehicle_msgs::msg::Shift::LOW;
simulation_interface::toProto(msg, proto);
EXPECT_EQ(msg.data, proto.data());
msg.data = autoware_vehicle_msgs::msg::Shift::NEUTRAL;
EXPECT_FALSE(msg.data == proto.data());
simulation_interface::toMsg(proto, msg);
EXPECT_EQ(msg.data, proto.data());
msg.data = 1023;
EXPECT_THROW(
simulation_interface::toProto(msg, proto), common::scenario_simulator_exception::SemanticError);
}
TEST(Conversion, VehicleCommand)
{
autoware_vehicle_msgs::VehicleCommand proto;
autoware_vehicle_msgs::msg::VehicleCommand msg;
msg.control.velocity = 1.2;
msg.control.steering_angle_velocity = 19.3;
msg.control.steering_angle = 12.0;
msg.control.steering_angle_velocity = 192.4;
msg.shift.data = autoware_vehicle_msgs::msg::Shift::NEUTRAL;
msg.emergency = 1;
msg.header.frame_id = "base_link";
msg.header.stamp.nanosec = 99;
msg.header.stamp.sec = 3;
simulation_interface::toProto(msg, proto);
EXPECT_CONTROL_COMMAND_EQ(msg.control, proto.control());
EXPECT_EQ(msg.shift.data, proto.shift().data());
EXPECT_TRUE(msg.shift.data == proto.shift().data());
EXPECT_EQ(msg.shift.data, proto.shift().data());
msg.shift.data = 1023;
EXPECT_THROW(
simulation_interface::toProto(msg, proto), common::scenario_simulator_exception::SemanticError);
EXPECT_HEADER_EQ(msg.header, proto.header());
EXPECT_EQ(msg.emergency, proto.emergency());
msg = autoware_vehicle_msgs::msg::VehicleCommand();
simulation_interface::toMsg(proto, msg);
EXPECT_CONTROL_COMMAND_EQ(msg.control, proto.control());
EXPECT_EQ(msg.shift.data, proto.shift().data());
EXPECT_TRUE(msg.shift.data == proto.shift().data());
EXPECT_EQ(msg.shift.data, proto.shift().data());
msg.shift.data = 1023;
EXPECT_THROW(
simulation_interface::toProto(msg, proto), common::scenario_simulator_exception::SemanticError);
EXPECT_HEADER_EQ(msg.header, proto.header());
EXPECT_EQ(msg.emergency, proto.emergency());
}
TEST(Conversion, EntityType)
{
openscenario_msgs::EntityType proto;
openscenario_msgs::msg::EntityType msg;
msg.type = msg.VEHICLE;
EXPECT_NO_THROW(simulation_interface::toProto(msg, proto));
EXPECT_EQ(proto, openscenario_msgs::EntityType::VEHICLE);
msg.type = msg.EGO;
EXPECT_NO_THROW(simulation_interface::toMsg(proto, msg));
EXPECT_EQ(msg.type, openscenario_msgs::msg::EntityType::VEHICLE);
}
int main(int argc, char ** argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
| 38.366738
| 100
| 0.73619
|
autocore-ai
|
cf8b7d4183916362f6840e937f3e33a8c970ead9
| 965
|
hh
|
C++
|
Buggy/EncoderTest/Encoder.hh
|
FJFranklin/cariot
|
9e4e93a7f4438c59fa6376dd792ddba44bd1fa6a
|
[
"MIT"
] | null | null | null |
Buggy/EncoderTest/Encoder.hh
|
FJFranklin/cariot
|
9e4e93a7f4438c59fa6376dd792ddba44bd1fa6a
|
[
"MIT"
] | null | null | null |
Buggy/EncoderTest/Encoder.hh
|
FJFranklin/cariot
|
9e4e93a7f4438c59fa6376dd792ddba44bd1fa6a
|
[
"MIT"
] | null | null | null |
#include <Arduino.h>
class Encoder {
private:
void (*ch_A_interrupt)();
void (*ch_B_interrupt)();
float (*synchronise)(unsigned long & last_elapsed, unsigned long & last_count); // returns latest elapsed time and pulse count
float cpr; // counts per revolution = 4 * ppr
float sense; // 1 for clockwise-is-positive; -1 otherwise
float rev_s;
elapsedMicros dsync;
public:
elapsedMicros timer; // for interrupt use only
int ch_A_pin; // use init() to set
int ch_B_pin;
Encoder(void (*ch_A_int)(), void (*ch_B_int)(), float (*sync)(unsigned long & last_elapsed, unsigned long & last_count)) :
ch_A_interrupt(ch_A_int),
ch_B_interrupt(ch_B_int),
synchronise(sync)
{
// ...
}
~Encoder() {
// ...
}
void init(int pin_A, int pin_B, unsigned ppr, bool clockwise=true);
void sync();
inline float latest() const { return rev_s; }
};
extern Encoder E1;
extern Encoder E2;
extern Encoder E3;
extern Encoder E4;
| 23.536585
| 128
| 0.676684
|
FJFranklin
|
cf8c59a6caec7321b2149329a82507a33d36ec8c
| 3,146
|
cpp
|
C++
|
source/data_model/cxx/src/core/array.cpp
|
computationalgeography/lue
|
71993169bae67a9863d7bd7646d207405dc6f767
|
[
"MIT"
] | 2
|
2021-02-26T22:45:56.000Z
|
2021-05-02T10:28:48.000Z
|
source/data_model/cxx/src/core/array.cpp
|
pcraster/lue
|
e64c18f78a8b6d8a602b7578a2572e9740969202
|
[
"MIT"
] | 262
|
2016-08-11T10:12:02.000Z
|
2020-10-13T18:09:16.000Z
|
source/data_model/cxx/src/core/array.cpp
|
computationalgeography/lue
|
71993169bae67a9863d7bd7646d207405dc6f767
|
[
"MIT"
] | 1
|
2020-03-11T09:49:41.000Z
|
2020-03-11T09:49:41.000Z
|
#include "lue/core/array.hpp"
#include <cassert>
namespace lue {
namespace data_model {
Array::Array(
hdf5::Group const& parent,
std::string const& name):
hdf5::Dataset{parent, name},
_memory_datatype{hdf5::memory_datatype(datatype())}
{
assert(id().is_valid());
}
Array::Array(
hdf5::Group const& parent,
std::string const& name,
hdf5::Datatype const& memory_datatype):
hdf5::Dataset{parent, name},
_memory_datatype{memory_datatype}
{
assert(id().is_valid());
}
Array::Array(
hdf5::Dataset&& dataset,
hdf5::Datatype const& memory_datatype):
hdf5::Dataset{std::move(dataset)},
_memory_datatype{memory_datatype}
{
assert(id().is_valid());
}
Array::Array(
hdf5::Identifier&& id,
hdf5::Datatype const& memory_datatype):
hdf5::Dataset{std::move(id)},
_memory_datatype{memory_datatype}
{
assert(this->id().is_valid());
}
hdf5::Datatype const& Array::memory_datatype() const
{
return _memory_datatype;
}
hdf5::Datatype Array::file_datatype() const
{
return datatype();
}
void Array::read(
void* buffer) const
{
hdf5::Dataset::read(_memory_datatype, buffer);
}
void Array::read(
hdf5::Hyperslab const& hyperslab,
void* buffer) const
{
hdf5::Dataset::read(_memory_datatype, hyperslab, buffer);
}
void Array::read(
hdf5::Datatype const& memory_datatype,
hdf5::Hyperslab const& hyperslab,
void* buffer) const
{
hdf5::Dataset::read(memory_datatype, hyperslab, buffer);
}
void Array::read(
hdf5::Datatype const& memory_datatype,
hdf5::Hyperslab const& hyperslab,
TransferPropertyList const& transfer_property_list,
void* buffer) const
{
hdf5::Dataset::read(memory_datatype, hyperslab, transfer_property_list, buffer);
}
void Array::read(
hdf5::Dataspace const& memory_dataspace,
void* buffer) const
{
hdf5::Dataset::read(_memory_datatype, memory_dataspace, buffer);
}
void Array::write(
void const* buffer)
{
hdf5::Dataset::write(_memory_datatype, buffer);
}
void Array::write(
hdf5::Hyperslab const& hyperslab,
void const* buffer)
{
hdf5::Dataset::write(_memory_datatype, hyperslab, buffer);
}
void Array::write(
hdf5::Hyperslab const& hyperslab,
TransferPropertyList const& transfer_property_list,
void const* buffer)
{
hdf5::Dataset::write(_memory_datatype, hyperslab, transfer_property_list, buffer);
}
void Array::write(
hdf5::Dataspace const& memory_dataspace,
void const* buffer)
{
hdf5::Dataset::write(_memory_datatype, memory_dataspace, buffer);
}
void Array::write(
hdf5::Dataspace const& memory_dataspace,
hdf5::Hyperslab const& hyperslab,
void const* buffer)
{
hdf5::Dataset::write(_memory_datatype, memory_dataspace, hyperslab, buffer);
}
void Array::write(
hdf5::Dataspace const& memory_dataspace,
hdf5::Hyperslab const& hyperslab,
TransferPropertyList const& transfer_property_list,
void const* buffer)
{
hdf5::Dataset::write(_memory_datatype, memory_dataspace, hyperslab, transfer_property_list, buffer);
}
} // namespace data_model
} // namespace lue
| 19.300613
| 104
| 0.698029
|
computationalgeography
|
cf949649599b786fcb2d1a94246b0f9bc3ef9250
| 19,909
|
cpp
|
C++
|
artifact/storm/src/storm-gspn/builder/JaniGSPNBuilder.cpp
|
glatteis/tacas21-artifact
|
30b4f522bd3bdb4bebccbfae93f19851084a3db5
|
[
"MIT"
] | null | null | null |
artifact/storm/src/storm-gspn/builder/JaniGSPNBuilder.cpp
|
glatteis/tacas21-artifact
|
30b4f522bd3bdb4bebccbfae93f19851084a3db5
|
[
"MIT"
] | null | null | null |
artifact/storm/src/storm-gspn/builder/JaniGSPNBuilder.cpp
|
glatteis/tacas21-artifact
|
30b4f522bd3bdb4bebccbfae93f19851084a3db5
|
[
"MIT"
] | 1
|
2022-02-05T12:39:53.000Z
|
2022-02-05T12:39:53.000Z
|
#include "JaniGSPNBuilder.h"
#include <memory>
#include "storm/logic/Formulas.h"
#include "storm/exceptions/InvalidModelException.h"
namespace storm {
namespace builder {
storm::jani::Model* JaniGSPNBuilder::build(std::string const& automatonName) {
storm::jani::ModelType modelType = storm::jani::ModelType::MA;
if (gspn.getNumberOfTimedTransitions() == 0) {
modelType = storm::jani::ModelType::MDP;
} else if (gspn.getNumberOfImmediateTransitions() == 0) {
modelType = storm::jani::ModelType::CTMC;
}
storm::jani::Model* model = new storm::jani::Model(gspn.getName(), modelType, janiVersion, expressionManager);
storm::jani::Automaton mainAutomaton(automatonName, expressionManager->declareIntegerVariable("loc"));
addVariables(model);
uint64_t locId = addLocation(mainAutomaton);
addEdges(mainAutomaton, locId);
model->addAutomaton(mainAutomaton);
model->setStandardSystemComposition();
model->getModelFeatures().add(storm::jani::ModelFeature::DerivedOperators);
model->finalize();
return model;
}
void JaniGSPNBuilder::addVariables(storm::jani::Model* model) {
for (auto const& place : gspn.getPlaces()) {
storm::jani::Variable* janiVar = nullptr;
if (!place.hasRestrictedCapacity()) {
// Effectively no capacity limit known
janiVar = new storm::jani::UnboundedIntegerVariable(place.getName(), expressionManager->getVariable(place.getName()), expressionManager->integer(place.getNumberOfInitialTokens()));
} else {
assert(place.hasRestrictedCapacity());
janiVar = new storm::jani::BoundedIntegerVariable(place.getName(), expressionManager->getVariable(place.getName()), expressionManager->integer(place.getNumberOfInitialTokens()), expressionManager->integer(0), expressionManager->integer(place.getCapacity()));
}
assert(janiVar != nullptr);
assert(vars.count(place.getID()) == 0);
vars[place.getID()] = &model->addVariable(*janiVar);
delete janiVar;
}
}
uint64_t JaniGSPNBuilder::addLocation(storm::jani::Automaton& automaton) {
uint64_t janiLoc = automaton.addLocation(storm::jani::Location("loc"));
automaton.addInitialLocation("loc");
return janiLoc;
}
void JaniGSPNBuilder::addEdges(storm::jani::Automaton& automaton, uint64_t locId) {
uint64_t lastPriority = -1;
storm::expressions::Expression lastPriorityGuard = expressionManager->boolean(false);
storm::expressions::Expression priorityGuard = expressionManager->boolean(true);
for (auto const& partition : gspn.getPartitions()) {
storm::expressions::Expression guard = expressionManager->boolean(false);
assert(lastPriority >= partition.priority);
if (lastPriority > partition.priority) {
priorityGuard = priorityGuard && !lastPriorityGuard;
lastPriority = partition.priority;
} else {
assert(lastPriority == partition.priority);
}
// Compute enabled weight expression.
storm::expressions::Expression totalWeight = expressionManager->rational(0.0);
for (auto const& transId : partition.transitions) {
auto const& trans = gspn.getImmediateTransitions()[transId];
if (trans.noWeightAttached()) {
continue;
}
storm::expressions::Expression destguard = expressionManager->boolean(true);
for (auto const& inPlaceEntry : trans.getInputPlaces()) {
destguard = destguard && (vars[inPlaceEntry.first]->getExpressionVariable() >= inPlaceEntry.second);
}
for (auto const& inhibPlaceEntry : trans.getInhibitionPlaces()) {
destguard = destguard && (vars[inhibPlaceEntry.first]->getExpressionVariable() < inhibPlaceEntry.second);
}
totalWeight = totalWeight + storm::expressions::ite(destguard, expressionManager->rational(trans.getWeight()), expressionManager->rational(0.0));
}
totalWeight = totalWeight.simplify();
std::vector<storm::jani::OrderedAssignments> oas;
std::vector<storm::expressions::Expression> probabilities;
std::vector<uint64_t> destinationLocations;
for (auto const& transId : partition.transitions) {
auto const& trans = gspn.getImmediateTransitions()[transId];
if (trans.noWeightAttached()) {
std::cout << "ERROR -- no weights attached at transition" << std::endl;
continue;
}
storm::expressions::Expression destguard = expressionManager->boolean(true);
std::vector<storm::jani::Assignment> assignments;
for (auto const& inPlaceEntry : trans.getInputPlaces()) {
destguard = destguard && (vars[inPlaceEntry.first]->getExpressionVariable() >= inPlaceEntry.second);
if (trans.getOutputPlaces().count(inPlaceEntry.first) == 0) {
assignments.emplace_back(storm::jani::LValue(*vars[inPlaceEntry.first]), (vars[inPlaceEntry.first])->getExpressionVariable() - inPlaceEntry.second);
}
}
for (auto const& inhibPlaceEntry : trans.getInhibitionPlaces()) {
destguard = destguard && (vars[inhibPlaceEntry.first]->getExpressionVariable() < inhibPlaceEntry.second);
}
for (auto const& outputPlaceEntry : trans.getOutputPlaces()) {
if (trans.getInputPlaces().count(outputPlaceEntry.first) == 0) {
assignments.emplace_back(storm::jani::LValue(*vars[outputPlaceEntry.first]), (vars[outputPlaceEntry.first])->getExpressionVariable() + outputPlaceEntry.second );
} else {
assignments.emplace_back(storm::jani::LValue(*vars[outputPlaceEntry.first]), (vars[outputPlaceEntry.first])->getExpressionVariable() + outputPlaceEntry.second - trans.getInputPlaces().at(outputPlaceEntry.first));
}
}
destguard = destguard.simplify();
guard = guard || destguard;
oas.emplace_back(assignments);
destinationLocations.emplace_back(locId);
probabilities.emplace_back(storm::expressions::ite(destguard, (expressionManager->rational(trans.getWeight()) / totalWeight), expressionManager->rational(0.0)));
}
std::shared_ptr<storm::jani::TemplateEdge> templateEdge = std::make_shared<storm::jani::TemplateEdge>((priorityGuard && guard).simplify());
automaton.registerTemplateEdge(templateEdge);
for (auto const& oa : oas) {
templateEdge->addDestination(storm::jani::TemplateEdgeDestination(oa));
}
storm::jani::Edge e(locId, storm::jani::Model::SILENT_ACTION_INDEX, boost::none, templateEdge, destinationLocations, probabilities);
automaton.addEdge(e);
lastPriorityGuard = lastPriorityGuard || guard;
}
for (auto const& trans : gspn.getTimedTransitions()) {
if(storm::utility::isZero(trans.getRate())) {
STORM_LOG_WARN("Transitions with rate zero are not allowed in JANI. Skipping this transition");
continue;
}
storm::expressions::Expression guard = expressionManager->boolean(true);
std::vector<storm::jani::Assignment> assignments;
for (auto const& inPlaceEntry : trans.getInputPlaces()) {
guard = guard && (vars[inPlaceEntry.first]->getExpressionVariable() >= inPlaceEntry.second);
if (trans.getOutputPlaces().count(inPlaceEntry.first) == 0) {
assignments.emplace_back(storm::jani::LValue(*vars[inPlaceEntry.first]), (vars[inPlaceEntry.first])->getExpressionVariable() - inPlaceEntry.second);
}
}
for (auto const& inhibPlaceEntry : trans.getInhibitionPlaces()) {
guard = guard && (vars[inhibPlaceEntry.first]->getExpressionVariable() < inhibPlaceEntry.second);
}
for (auto const& outputPlaceEntry : trans.getOutputPlaces()) {
if (trans.getInputPlaces().count(outputPlaceEntry.first) == 0) {
assignments.emplace_back(storm::jani::LValue(*vars[outputPlaceEntry.first]), (vars[outputPlaceEntry.first])->getExpressionVariable() + outputPlaceEntry.second );
} else {
assignments.emplace_back(storm::jani::LValue(*vars[outputPlaceEntry.first]), (vars[outputPlaceEntry.first])->getExpressionVariable() + outputPlaceEntry.second - trans.getInputPlaces().at(outputPlaceEntry.first));
}
}
std::shared_ptr<storm::jani::TemplateEdge> templateEdge = std::make_shared<storm::jani::TemplateEdge>(guard);
automaton.registerTemplateEdge(templateEdge);
storm::expressions::Expression rate = expressionManager->rational(trans.getRate());
if (trans.hasInfiniteServerSemantics() || (trans.hasKServerSemantics() && !trans.hasSingleServerSemantics())) {
STORM_LOG_THROW(trans.hasKServerSemantics() || !trans.getInputPlaces().empty(), storm::exceptions::InvalidModelException, "Unclear semantics: Found a transition with infinite-server semantics and without input place.");
storm::expressions::Expression enablingDegree;
bool firstArgumentOfMinExpression = true;
if (trans.hasKServerSemantics()) {
enablingDegree = expressionManager->integer(trans.getNumberOfServers());
firstArgumentOfMinExpression = false;
}
for (auto const& inPlaceEntry : trans.getInputPlaces()) {
storm::expressions::Expression enablingDegreeInPlace = vars[inPlaceEntry.first]->getExpressionVariable() / expressionManager->integer(inPlaceEntry.second); // Integer division!
if (firstArgumentOfMinExpression == true) {
enablingDegree = enablingDegreeInPlace;
} else {
enablingDegree = storm::expressions::minimum(enablingDegree, enablingDegreeInPlace);
}
}
rate = rate * enablingDegree;
}
templateEdge->addDestination(assignments);
storm::jani::Edge e(locId, storm::jani::Model::SILENT_ACTION_INDEX, rate, templateEdge, {locId}, {expressionManager->integer(1)});
automaton.addEdge(e);
}
}
storm::jani::Variable const& JaniGSPNBuilder::addDeadlockTransientVariable(storm::jani::Model* model, std::string name, bool ignoreCapacities, bool ignoreInhibitorArcs, bool ignoreEmptyPlaces) {
storm::expressions::Expression transientValue = expressionManager->boolean(true);
// build the conjunction over all transitions
std::vector<storm::gspn::Transition const*> transitions;
transitions.reserve(gspn.getNumberOfImmediateTransitions() + gspn.getNumberOfTimedTransitions());
for (auto const& t : gspn.getImmediateTransitions()) {
transitions.push_back(&t);
}
for (auto const& t : gspn.getTimedTransitions()) {
transitions.push_back(&t);
}
bool firstTransition = true;
for (auto const& transition : transitions) {
// build the disjunction over all in/out places and inhibitor arcs
storm::expressions::Expression transitionDisabled = expressionManager->boolean(false);
bool firstPlace = true;
if (!ignoreEmptyPlaces) {
for (auto const& placeIdMult : transition->getInputPlaces()) {
storm::expressions::Expression placeBlocksTransition = (vars.at(placeIdMult.first)->getExpressionVariable() < expressionManager->integer(placeIdMult.second));
if (firstPlace) {
transitionDisabled = placeBlocksTransition;
firstPlace = false;
} else {
transitionDisabled = transitionDisabled || placeBlocksTransition;
}
}
}
if (!ignoreInhibitorArcs) {
for (auto const& placeIdMult : transition->getInhibitionPlaces()) {
storm::expressions::Expression placeBlocksTransition = (vars.at(placeIdMult.first)->getExpressionVariable() >= expressionManager->integer(placeIdMult.second));
if (firstPlace) {
transitionDisabled = placeBlocksTransition;
firstPlace = false;
} else {
transitionDisabled = transitionDisabled || placeBlocksTransition;
}
}
}
if (!ignoreCapacities) {
for (auto const& placeIdMult : transition->getOutputPlaces()) {
auto const& place = gspn.getPlace(placeIdMult.first);
if (place->hasRestrictedCapacity()) {
storm::expressions::Expression placeBlocksTransition = (vars.at(placeIdMult.first)->getExpressionVariable() + expressionManager->integer(placeIdMult.second) > expressionManager->integer(place->getCapacity()));
if (firstPlace) {
transitionDisabled = placeBlocksTransition;
firstPlace = false;
} else {
transitionDisabled = transitionDisabled || placeBlocksTransition;
}
}
}
}
if (firstTransition) {
transientValue = transitionDisabled;
firstTransition = false;
} else {
transientValue = transientValue && transitionDisabled;
}
}
return addTransientVariable(model, name, transientValue);
}
storm::jani::Variable const& JaniGSPNBuilder::addTransientVariable(storm::jani::Model* model, std::string name, storm::expressions::Expression expression) {
auto exprVar = expressionManager->declareBooleanVariable(name);
auto const& janiVar = model->addVariable(*storm::jani::makeBooleanVariable(name, exprVar, expressionManager->boolean(false), true));
storm::jani::Assignment assignment(storm::jani::LValue(janiVar), expression);
model->getAutomata().front().getLocations().front().addTransientAssignment(assignment);
return janiVar;
}
std::string getUniqueVarName(storm::expressions::ExpressionManager const& manager, std::string name) {
std::string res = name;
while (manager.hasVariable(res)) {
res.append("_");
}
return res;
}
std::vector<storm::jani::Property> JaniGSPNBuilder::getStandardProperties(storm::jani::Model* model, std::shared_ptr<storm::logic::AtomicExpressionFormula> atomicFormula, std::string name, std::string description, bool maximal) {
std::vector<storm::jani::Property> standardProperties;
std::string dirShort = maximal ? "Max" : "Min";
std::string dirLong = maximal ? "maximal" : "minimal";
storm::solver::OptimizationDirection optimizationDirection = maximal ? storm::solver::OptimizationDirection::Maximize : storm::solver::OptimizationDirection::Minimize;
std::set<storm::expressions::Variable> emptySet;
// Build reachability property
auto reachFormula = std::make_shared<storm::logic::ProbabilityOperatorFormula>(
std::make_shared<storm::logic::EventuallyFormula>(atomicFormula, storm::logic::FormulaContext::Probability),
storm::logic::OperatorInformation(optimizationDirection));
standardProperties.emplace_back(dirShort + "PrReach" + name, reachFormula, emptySet, "The " + dirLong + " probability to eventually reach " + description + ".");
// Build time bounded reachability property
// Add variable for time bound
auto exprTB = expressionManager->declareRationalVariable(getUniqueVarName(*expressionManager, "TIME_BOUND"));
auto janiTB = storm::jani::Constant(exprTB.getName(), exprTB);
model->addConstant(janiTB);
storm::logic::TimeBound tb(false, janiTB.getExpressionVariable().getExpression());
storm::logic::TimeBoundReference tbr(storm::logic::TimeBoundType::Time);
auto trueFormula = std::make_shared<storm::logic::BooleanLiteralFormula>(true);
auto reachTimeBoundFormula = std::make_shared<storm::logic::ProbabilityOperatorFormula>(
std::make_shared<storm::logic::BoundedUntilFormula>(trueFormula, atomicFormula, boost::none, tb, tbr),
storm::logic::OperatorInformation(optimizationDirection));
standardProperties.emplace_back(dirShort + "PrReach" + name + "TB", reachTimeBoundFormula, emptySet, "The " + dirLong + " probability to reach " + description + " within 'TIME_BOUND' steps.");
// Use complementary direction for expected time
dirShort = maximal ? "Min" : "Max";
dirLong = maximal ? "minimal" : "maximal";
optimizationDirection = maximal ? storm::solver::OptimizationDirection::Minimize : storm::solver::OptimizationDirection::Maximize;
// Build expected time property
auto expTimeFormula = std::make_shared<storm::logic::TimeOperatorFormula>(
std::make_shared<storm::logic::EventuallyFormula>(atomicFormula, storm::logic::FormulaContext::Time),
storm::logic::OperatorInformation(optimizationDirection));
standardProperties.emplace_back(dirShort + "ExpTime" + name, expTimeFormula, emptySet, "The " + dirLong + " expected time to reach " + description + ".");
return standardProperties;
}
std::vector<storm::jani::Property> JaniGSPNBuilder::getDeadlockProperties(storm::jani::Model* model) {
auto const& deadlockVar = addDeadlockTransientVariable(model, getUniqueVarName(*expressionManager, "deadl"));
auto deadlockFormula = std::make_shared<storm::logic::AtomicExpressionFormula>(deadlockVar.getExpressionVariable().getExpression());
return getStandardProperties(model, deadlockFormula, "Deadlock", "a deadlock", true);
}
}
}
| 62.021807
| 278
| 0.595761
|
glatteis
|
cfa3dfd0af0e35abcda596de535bc522ae1fb42c
| 1,108
|
cpp
|
C++
|
PAT_B/B1011|A+B 和 C|.cpp
|
FunamiYui/PAT_Code_Akari
|
52e06689b6bf8177c43ab9256719258c47e80b25
|
[
"MIT"
] | null | null | null |
PAT_B/B1011|A+B 和 C|.cpp
|
FunamiYui/PAT_Code_Akari
|
52e06689b6bf8177c43ab9256719258c47e80b25
|
[
"MIT"
] | null | null | null |
PAT_B/B1011|A+B 和 C|.cpp
|
FunamiYui/PAT_Code_Akari
|
52e06689b6bf8177c43ab9256719258c47e80b25
|
[
"MIT"
] | null | null | null |
#include <cstdio>
#define ll long long
int main() {
int T;
ll a, b, c;
scanf("%d", &T);
for (int i = 1; i <= T; i++) {
scanf("%lld%lld%lld", &a, &b, &c);
if (a + b > c) {
printf("Case #%d: true\n", i);
} else {
printf("Case #%d: false\n", i);
}
}
return 0;
}
#include <cstdio>
int main(){
int T;
long long A[20], B[20], C[20];
scanf("%d", &T);
for(int i = 0; i < T; i++) {
scanf("%lld%lld%lld", &A[i], &B[i], &C[i]);
}
for(int i = 0; i < T; i++) {
if(A[i] + B[i] > C[i]) {
printf("Case #%d: true\n", i + 1);
}
else {
printf("Case #%d: false\n", i + 1);
}
}
return 0;
}
/*
#include <cstdio> //这里单点测试,输出是按照输出样例这样一整组还是说可以一组输入一组输出?这关系到写法
int main() { //下面的是书上给的代码
int T, tcase = 1;
long long a, b, c;
scanf("%d", &T);
while(T--) {
scanf("%lld%lld%lld", &a, &b, &c);
if(a + b > c) {
printf("Case #%d: true\n", tcase++);
}
else {
printf("Case #%d: false\n", tcase++);
}
}
return 0;
}
*/
| 17.587302
| 81
| 0.411552
|
FunamiYui
|
cfa44f97261a3fc483d73ffec32cb241094440cd
| 23,301
|
hpp
|
C++
|
project/include/Alter/InstanceLevel.hpp
|
helixd2s/ZEON
|
b4b6394fa15e7a8ebeaa336d8bf6f45e2d096d46
|
[
"MIT"
] | null | null | null |
project/include/Alter/InstanceLevel.hpp
|
helixd2s/ZEON
|
b4b6394fa15e7a8ebeaa336d8bf6f45e2d096d46
|
[
"MIT"
] | null | null | null |
project/include/Alter/InstanceLevel.hpp
|
helixd2s/ZEON
|
b4b6394fa15e7a8ebeaa336d8bf6f45e2d096d46
|
[
"MIT"
] | null | null | null |
#pragma once
//
#ifdef __cplusplus
#include "./Core.hpp"
#include "./Instance.hpp"
#include "./Device.hpp"
#include "./Resource.hpp"
#include "./GeometryLevel.hpp"
//
#ifdef ALT_ENABLE_VMA
#include "./MemoryAllocatorVma.hpp"
#endif
//
namespace ANAMED {
//
class InstanceLevelObj : public BaseObj {
public:
using tType = WrapShared<InstanceLevelObj>;
using BaseObj::BaseObj;
//using BaseObj;
protected:
//
std::optional<InstanceLevelCreateInfo> cInfo = {};
vk::Buffer instanceBuffer = {};
vk::Buffer instanceScratch = {};
vk::Buffer instanceBuild = {};
vk::Buffer instanceExtBuffer = {};
//
WrapShared<ResourceObj> bindInstanceBuffer = {};
WrapShared<ResourceObj> bindInstanceScratch = {};
WrapShared<ResourceObj> bindInstanceBuild = {};
WrapShared<ResourceObj> bindInstanceExtBuffer = {};
//
std::array<vk::AccelerationStructureGeometryKHR, 1> instances = {};
std::array<vk::AccelerationStructureBuildRangeInfoKHR, 1> instanceRanges = {};
//
cpp21::shared_vector<InstanceDraw> instanceDraw = std::vector<InstanceDraw>{};
cpp21::shared_vector<InstanceDevInfo> instanceDevInfo = std::vector<InstanceDevInfo>{};
cpp21::shared_vector<InstanceInfo> instanceInfo = std::vector<InstanceInfo>{};
//cpp21::shared_vector<bool> firstUpdate = std::vector<bool>{};
//
vk::AccelerationStructureKHR accelStruct = {};
//
InstanceAddressInfo addressInfo = { .data = 0ull, .accelStruct = 0ull };
//
friend PipelineObj;
friend SwapchainObj;
friend InstanceLevelObj;
//
inline decltype(auto) SFT() { using T = std::decay_t<decltype(*this)>; return WrapShared<T>(std::dynamic_pointer_cast<T>(shared_from_this())); };
inline decltype(auto) SFT() const { using T = std::decay_t<decltype(*this)>; return WrapShared<T>(std::const_pointer_cast<T>(std::dynamic_pointer_cast<T const>(shared_from_this()))); };
public:
//
InstanceLevelObj(WrapShared<DeviceObj> deviceObj = {}, cpp21::const_wrap_arg<InstanceLevelCreateInfo> cInfo = InstanceLevelCreateInfo{}) : BaseObj(std::move(deviceObj->getHandle())), cInfo(cInfo), instanceDraw(std::vector<InstanceDraw>{}), instanceDevInfo(std::vector<InstanceDevInfo>{}) {
//this->construct(deviceObj, cInfo);
};
//
InstanceLevelObj(cpp21::const_wrap_arg<Handle> handle, cpp21::const_wrap_arg<InstanceLevelCreateInfo> cInfo = InstanceLevelCreateInfo{}) : BaseObj(handle), cInfo(cInfo), instanceDraw(std::vector<InstanceDraw>{}), instanceDevInfo(std::vector<InstanceDevInfo>{}) {
//this->construct(ANAMED::context->get<DeviceObj>(this->base), cInfo);
};
//
std::type_info const& type_info() const override {
return typeid(std::decay_t<decltype(this)>);
};
//
virtual tType registerSelf() {
ANAMED::context->get<DeviceObj>(this->base)->registerObj(this->handle, shared_from_this());
return SFT();
};
//
inline static tType make(cpp21::const_wrap_arg<Handle> handle, cpp21::const_wrap_arg<InstanceLevelCreateInfo> cInfo = InstanceLevelCreateInfo{}) {
auto shared = std::make_shared<InstanceLevelObj>(handle, cInfo);
shared->construct(ANAMED::context->get<DeviceObj>(handle), cInfo);
auto wrap = shared->registerSelf();
return wrap;
};
//
virtual WrapShared<ResourceObj> getInstancedResource() const {
return ANAMED::context->get<DeviceObj>(this->base)->get<ResourceObj>(this->instanceBuffer);
};
//
virtual WrapShared<ResourceObj> getInstanceInfoResource() const {
return ANAMED::context->get<DeviceObj>(this->base)->get<ResourceObj>(this->instanceExtBuffer);
};
//
virtual InstanceAddressInfo& getAddressInfo() { return addressInfo; };
virtual InstanceAddressInfo const& getAddressInfo() const { return addressInfo; };
//
virtual vk::Buffer& getInstancedBuffer() { return this->instanceBuffer; };
virtual vk::Buffer const& getInstancedBuffer() const { return this->instanceBuffer; };
//
//virtual std::vector<InstanceDevInfo>& getDevInstances() { return this->instanceDevInfo; };
//virtual std::vector<InstanceDevInfo> const& getDevInstances() const { return this->instanceDevInfo; };
//
virtual std::vector<InstanceInfo>& getInstances() { return this->instanceInfo; };
virtual std::vector<InstanceInfo> const& getInstances() const { return this->instanceInfo; };
//
virtual cpp21::shared_vector<InstanceDraw>& getDrawInfo() { return this->instanceDraw; };
virtual cpp21::shared_vector<InstanceDraw> const& getDrawInfo() const { return this->instanceDraw; };
//
virtual uintptr_t const& getInstanceInfoDeviceAddress() const { return this->getInstanceInfoResource()->getDeviceAddress(); };
virtual uintptr_t& getInstanceInfoDeviceAddress() { return this->getInstanceInfoResource()->getDeviceAddress(); };
//
virtual uintptr_t const& getInstancedDeviceAddress() const { return this->getInstancedResource()->getDeviceAddress(); };
virtual uintptr_t& getInstancedDeviceAddress() { return this->getInstancedResource()->getDeviceAddress(); };
//
virtual uintptr_t& getDeviceAddress() { return this->handle.as<uintptr_t>(); };
virtual uintptr_t const& getDeviceAddress() const { return this->handle.as<uintptr_t>(); };
//
virtual void updateInstances() {
decltype(auto) deviceObj = ANAMED::context->get<DeviceObj>(this->base);
//
this->instances = {};
this->instanceRanges = {};
this->addressInfo.instanceCount = this->cInfo->instances->size();
//
if (this->instanceDraw->size() < this->cInfo->instances->size()) {
for (uintptr_t idx = this->instanceDraw->size(); idx < this->cInfo->instances->size(); idx++) {
this->instanceDraw->push_back(InstanceDraw{});
this->instanceInfo->push_back(InstanceInfo{});
this->instanceDevInfo->push_back(InstanceDevInfo{});
//this->firstUpdate->push_back(true);
};
};
//
for (uintptr_t idx = 0ull; idx < this->cInfo->instances->size(); idx++) {
auto& instances = this->cInfo->instances[idx];
auto& instanceInfo = this->instanceInfo[idx];
auto& instanceDraw = this->instanceDraw[idx];
auto& instanceDevInfo = this->instanceDevInfo[idx];
//
instanceInfo = instances.instanceInfo;
instanceDevInfo = instances.instanceDevInfo;
//
decltype(auto) geometryLevel = deviceObj->get<GeometryLevelObj>(instanceDevInfo.accelerationStructureReference);
//
if (this->instanceExtBuffer && this->getInstanceInfoResource()) {
instanceDraw.drawInfos = geometryLevel->getDrawInfo();
instanceDraw.drawConst = PushConstantData{ .dataAddress = this->getInstanceInfoDeviceAddress() + sizeof(InstanceInfo) * idx, .instanceIndex = uint32_t(idx), .drawIndex = 0u };
};
//
//instanceInfo.prevTransform = this->firstUpdate[idx] ? reinterpret_cast<glm::mat3x4&>(instanceDevInfo.transform) : instanceInfo.transform;
//instanceInfo.transform = reinterpret_cast<glm::mat3x4&>(instanceDevInfo.transform);
instanceDevInfo.transform = reinterpret_cast<vk::TransformMatrixKHR&>(instanceInfo.transform);
instanceInfo.geometryCount = geometryLevel->getGeometries().size();
instanceInfo.geometryReference = geometryLevel->getGeometryDeviceAddress();
//
instances.instanceInfo = instanceInfo;
instances.instanceDevInfo = instanceDevInfo;
//
//this->firstUpdate[idx] = false;
};
{
instances[0] = vk::AccelerationStructureGeometryKHR{
.geometryType = vk::GeometryTypeKHR::eInstances,
.geometry = vk::AccelerationStructureGeometryDataKHR{.instances = vk::AccelerationStructureGeometryInstancesDataKHR{
.arrayOfPointers = false,
.data = reinterpret_cast<vk::DeviceOrHostAddressConstKHR&>(this->getInstancedDeviceAddress()),
}},
.flags = vk::GeometryFlagBitsKHR{}
};
instanceRanges[0] = vk::AccelerationStructureBuildRangeInfoKHR{
.primitiveCount = uint32_t(this->cInfo->instances->size()),
.primitiveOffset = 0u,
.firstVertex = 0u,
.transformOffset = 0u
};
};
};
//
virtual vk::CommandBuffer const& writeBuildStructureCmd(cpp21::const_wrap_arg<vk::CommandBuffer> cmdBuf = {}, vk::Buffer const& instanceDevOffset = {}, vk::Buffer const& instanceOffset = {}) {
decltype(auto) device = this->base.as<vk::Device>();
decltype(auto) deviceObj = ANAMED::context->get<DeviceObj>(this->base);
decltype(auto) uploaderObj = deviceObj->get<UploaderObj>(Handle(this->cInfo->uploader, HandleType::eUploader));
decltype(auto) accelInstInfo = infoMap->get<vk::AccelerationStructureBuildGeometryInfoKHR>(vk::StructureType::eAccelerationStructureBuildGeometryInfoKHR);
//
uploaderObj->writeUploadToResourceCmd(UploadCommandWriteInfo{
.cmdBuf = cmdBuf,
.bunchBuffer = instanceDevOffset,
.dstBuffer = BufferRegion{this->instanceBuffer, DataRegion{ 0ull, sizeof(InstanceDevInfo), this->cInfo->instances->size() * sizeof(InstanceDevInfo) }}
});
// parallelize by offset
uploaderObj->writeUploadToResourceCmd(UploadCommandWriteInfo{
.cmdBuf = cmdBuf,
.bunchBuffer = instanceOffset,
.dstBuffer = BufferRegion{this->instanceExtBuffer, DataRegion{ 0ull, sizeof(InstanceInfo), this->cInfo->instances->size() * sizeof(InstanceInfo) }}
});
//
decltype(auto) accelInfo = infoMap->get<vk::AccelerationStructureCreateInfoKHR>(vk::StructureType::eAccelerationStructureCreateInfoKHR);
decltype(auto) accelGeomInfo = infoMap->get<vk::AccelerationStructureBuildGeometryInfoKHR>(vk::StructureType::eAccelerationStructureBuildGeometryInfoKHR);
decltype(auto) accelSizes = infoMap->set(vk::StructureType::eAccelerationStructureBuildSizesInfoKHR, device.getAccelerationStructureBuildSizesKHR(vk::AccelerationStructureBuildTypeKHR::eDevice, accelGeomInfo->setGeometries(this->instances), this->cInfo->limit, deviceObj->getDispatch()));
decltype(auto) depInfo = vk::DependencyInfo{ .dependencyFlags = vk::DependencyFlagBits::eByRegion };
decltype(auto) accessMask = vk::AccessFlagBits2(vku::getAccessMaskByImageUsage(deviceObj->get<ResourceObj>(this->instanceBuild)->getBufferUsage()));
//
decltype(auto) bufferBarriersBegin = std::vector<vk::BufferMemoryBarrier2>{
vk::BufferMemoryBarrier2{
.srcStageMask = vku::getCorrectPipelineStagesByAccessMask<vk::PipelineStageFlagBits2>(accessMask) | (accessMask & vk::AccessFlagBits2(AccessFlagBitsSet::eShaderReadWrite) ? vk::PipelineStageFlagBits2::eAllCommands : vk::PipelineStageFlagBits2{}),
.srcAccessMask = accessMask,
.dstStageMask = vku::getCorrectPipelineStagesByAccessMask<vk::PipelineStageFlagBits2>(vk::AccessFlagBits2::eAccelerationStructureWriteKHR | vk::AccessFlagBits2::eAccelerationStructureReadKHR),
.dstAccessMask = vk::AccessFlagBits2::eAccelerationStructureWriteKHR | vk::AccessFlagBits2::eAccelerationStructureReadKHR,
.srcQueueFamilyIndex = this->cInfo->info->queueFamilyIndex,
.dstQueueFamilyIndex = this->cInfo->info->queueFamilyIndex,
.buffer = this->instanceBuild,
.offset = 0ull,
.size = std::min(accelSizes->accelerationStructureSize, accelInfo->size)
},
};
//
decltype(auto) bufferBarriersEnd = std::vector<vk::BufferMemoryBarrier2>{
vk::BufferMemoryBarrier2{
.srcStageMask = vku::getCorrectPipelineStagesByAccessMask<vk::PipelineStageFlagBits2>(vk::AccessFlagBits2::eAccelerationStructureWriteKHR | vk::AccessFlagBits2::eAccelerationStructureReadKHR),
.srcAccessMask = vk::AccessFlagBits2::eAccelerationStructureWriteKHR | vk::AccessFlagBits2::eAccelerationStructureReadKHR,
.dstStageMask = vku::getCorrectPipelineStagesByAccessMask<vk::PipelineStageFlagBits2>(accessMask) | (accessMask & vk::AccessFlagBits2(AccessFlagBitsSet::eShaderReadWrite) ? vk::PipelineStageFlagBits2::eAllCommands : vk::PipelineStageFlagBits2{}),
.dstAccessMask = accessMask,
.srcQueueFamilyIndex = this->cInfo->info->queueFamilyIndex,
.dstQueueFamilyIndex = this->cInfo->info->queueFamilyIndex,
.buffer = this->instanceBuild,
.offset = 0ull,
.size = std::min(accelSizes->accelerationStructureSize, accelInfo->size)
}
};
//
decltype(auto) memoryBarriersBegin = std::vector<vk::MemoryBarrier2>{
vk::MemoryBarrier2{
.srcStageMask = vku::getCorrectPipelineStagesByAccessMask<vk::PipelineStageFlagBits2>(AccessFlagBitsSet::eGeneralReadWrite),
.srcAccessMask = vk::AccessFlagBits2(AccessFlagBitsSet::eGeneralReadWrite),
.dstStageMask = vku::getCorrectPipelineStagesByAccessMask<vk::PipelineStageFlagBits2>(vk::AccessFlagBits2::eAccelerationStructureWriteKHR | vk::AccessFlagBits2::eAccelerationStructureReadKHR),
.dstAccessMask = vk::AccessFlagBits2::eAccelerationStructureWriteKHR | vk::AccessFlagBits2::eAccelerationStructureReadKHR
}
};
//
decltype(auto) memoryBarriersEnd = std::vector<vk::MemoryBarrier2>{
vk::MemoryBarrier2{
.srcStageMask = vku::getCorrectPipelineStagesByAccessMask<vk::PipelineStageFlagBits2>(vk::AccessFlagBits2::eAccelerationStructureWriteKHR | vk::AccessFlagBits2::eAccelerationStructureReadKHR),
.srcAccessMask = vk::AccessFlagBits2::eAccelerationStructureWriteKHR | vk::AccessFlagBits2::eAccelerationStructureReadKHR,
.dstStageMask = vku::getCorrectPipelineStagesByAccessMask<vk::PipelineStageFlagBits2>(AccessFlagBitsSet::eGeneralReadWrite),
.dstAccessMask = vk::AccessFlagBits2(AccessFlagBitsSet::eGeneralReadWrite)
}
};
//
cmdBuf->pipelineBarrier2(depInfo.setBufferMemoryBarriers(bufferBarriersBegin).setMemoryBarriers(memoryBarriersBegin));
cmdBuf->buildAccelerationStructuresKHR(1u, &accelInstInfo->setGeometries(this->instances).setMode(accelInstInfo->srcAccelerationStructure ? vk::BuildAccelerationStructureModeKHR::eUpdate : vk::BuildAccelerationStructureModeKHR::eBuild), cpp21::rvalue_to_ptr(instanceRanges.data()), deviceObj->getDispatch());
cmdBuf->pipelineBarrier2(depInfo.setBufferMemoryBarriers(bufferBarriersEnd).setMemoryBarriers(memoryBarriersEnd));
//
accelInstInfo->srcAccelerationStructure = accelInstInfo->dstAccelerationStructure;
//
return cmdBuf;
};
//
virtual FenceType buildStructure(cpp21::const_wrap_arg<QueueGetInfo> info = QueueGetInfo{}) {
this->updateInstances();
//
decltype(auto) submission = CommandOnceSubmission{ .submission = SubmissionInfo {.info = info ? info.value() : this->cInfo->info } };
decltype(auto) deviceObj = ANAMED::context->get<DeviceObj>(this->base);
decltype(auto) uploaderObj = deviceObj->get<UploaderObj>(Handle(this->cInfo->uploader, HandleType::eUploader));
//
decltype(auto) memReqs = uploaderObj->getMemoryRequirements();
uintptr_t instanceDevSize = cpp21::tiled(this->cInfo->instances->size() * sizeof(InstanceDevInfo), memReqs.alignment)* memReqs.alignment;
uintptr_t instanceSize = cpp21::tiled(this->cInfo->instances->size() * sizeof(InstanceInfo), memReqs.alignment)* memReqs.alignment;
//
uintptr_t instanceDevOffset = 0ull;
uintptr_t instanceOffset = instanceDevSize;
//
#ifdef AMD_VULKAN_MEMORY_ALLOCATOR_H
decltype(auto) instanceDevAlloc = uploaderObj->allocateMappedTemp(instanceDevSize, instanceDevOffset);
decltype(auto) instanceAlloc = uploaderObj->allocateMappedTemp(instanceSize, instanceOffset);
decltype(auto) mappedBlock = uploaderObj->getMappedBlock();
decltype(auto) instancePage = uploaderObj->allocatePage(instanceOffset, instanceSize);
decltype(auto) instanceDevPage = uploaderObj->allocatePage(instanceDevOffset, instanceDevSize);
#endif
//
memcpy(instanceDevPage->mapped, this->instanceDevInfo->data(), this->instanceDevInfo->size() * sizeof(InstanceDevInfo));
memcpy(instancePage->mapped, this->instanceInfo->data(), this->instanceInfo->size() * sizeof(InstanceInfo));
// TODO: Acceleration Structure Build Barriers per Buffers
submission.commandInits.push_back([instanceDevOffset, instanceOffset, instancePage, instanceDevPage, dispatch = deviceObj->getDispatch(), this](cpp21::const_wrap_arg<vk::CommandBuffer> cmdBuf) {
return this->writeBuildStructureCmd(cmdBuf, instanceDevPage->bunchBuffer, instancePage->bunchBuffer);
});
//
#ifdef AMD_VULKAN_MEMORY_ALLOCATOR_H
submission.submission.onDone.push_back([mappedBlock, instanceDevAlloc, instanceAlloc](cpp21::const_wrap_arg<vk::Result> result) {
vmaVirtualFree(mappedBlock, instanceDevAlloc);
vmaVirtualFree(mappedBlock, instanceAlloc);
});
#endif
//
uploaderObj->bindMemoryPages(submission.submission);
return ANAMED::context->get<DeviceObj>(this->base)->executeCommandOnce(submission);
};
//
virtual FenceType createStructure() {
this->updateInstances();
//
if (this->cInfo->limit <= 0u) {
this->cInfo->limit = this->cInfo->instances->size();
};
//
if (this->cInfo->instances->size() < this->cInfo->limit) {
for (uintptr_t i = this->cInfo->instances->size(); i < this->cInfo->limit; i++) {
decltype(auto) matrix = glm::mat3x4(1.f);
this->cInfo->instances->push_back(InstanceDataInfo{
.instanceDevInfo = InstanceDevInfo{
.transform = reinterpret_cast<vk::TransformMatrixKHR&>(matrix),
.instanceCustomIndex = 0u,
.mask = 0u,
.instanceShaderBindingTableRecordOffset = 0u,
.flags = 0u,
.accelerationStructureReference = 0u
},
.instanceInfo = InstanceInfo{
}
});
};
};
//
decltype(auto) device = this->base.as<vk::Device>();
decltype(auto) deviceObj = ANAMED::context->get<DeviceObj>(this->base);
decltype(auto) accelInstInfo = infoMap->get<vk::AccelerationStructureBuildGeometryInfoKHR>(vk::StructureType::eAccelerationStructureBuildGeometryInfoKHR);
decltype(auto) accelSizes = infoMap->set(vk::StructureType::eAccelerationStructureBuildSizesInfoKHR, device.getAccelerationStructureBuildSizesKHR(vk::AccelerationStructureBuildTypeKHR::eDevice, accelInstInfo->setGeometries(this->instances), this->cInfo->limit, deviceObj->getDispatch()));
decltype(auto) accelInfo = infoMap->get<vk::AccelerationStructureCreateInfoKHR>(vk::StructureType::eAccelerationStructureCreateInfoKHR);
//
this->instanceBuffer = (this->bindInstanceBuffer = ResourceObj::make(this->base, ResourceCreateInfo{
.bufferInfo = BufferCreateInfo{
.size = std::max(cInfo->instances->size(), size_t(cInfo->limit)) * sizeof(InstanceDevInfo),
.type = BufferType::eStorage
}
})).as<vk::Buffer>();
//
this->instanceScratch = (this->bindInstanceScratch = ResourceObj::make(this->base, ResourceCreateInfo{
.bufferInfo = BufferCreateInfo{
.size = std::max(accelSizes->buildScratchSize, accelSizes->updateScratchSize),
.type = BufferType::eStorage
}
})).as<vk::Buffer>();
//
this->instanceBuild = (this->bindInstanceBuild = ResourceObj::make(this->base, ResourceCreateInfo{
.bufferInfo = BufferCreateInfo{
.size = accelSizes->accelerationStructureSize,
.type = BufferType::eStorage
}
})).as<vk::Buffer>();
//
this->instanceExtBuffer = (this->bindInstanceExtBuffer = ResourceObj::make(this->base, ResourceCreateInfo{
.bufferInfo = BufferCreateInfo{
.size = std::max(cInfo->instances->size(), size_t(cInfo->limit)) * sizeof(InstanceInfo),
.type = BufferType::eStorage
}
})).as<vk::Buffer>();
//
//accelInfo->type = vk::AccelerationStructureTypeKHR::eBottomLevel;
accelInfo->buffer = this->instanceBuild;
accelInfo->offset = 0ull;
accelInfo->size = accelSizes->accelerationStructureSize;
//
accelInstInfo->type = accelInfo->type;
accelInstInfo->scratchData = reinterpret_cast<vk::DeviceOrHostAddressKHR&>(this->bindInstanceScratch->getDeviceAddress());
accelInstInfo->srcAccelerationStructure = vk::AccelerationStructureKHR{};
accelInstInfo->dstAccelerationStructure = (this->accelStruct = device.createAccelerationStructureKHR(accelInfo.ref(), nullptr, deviceObj->getDispatch()));
//
this->handle = device.getAccelerationStructureAddressKHR(vk::AccelerationStructureDeviceAddressInfoKHR{ .accelerationStructure = this->accelStruct }, deviceObj->getDispatch());
this->addressInfo = InstanceAddressInfo{ .data = this->getInstanceInfoDeviceAddress(), .accelStruct = this->handle.as<uintptr_t>(), .instanceCount = uint32_t(std::max(cInfo->instances->size(), size_t(cInfo->limit))) };
//
this->destructors.push_back([this, device, accellStruct = accelInstInfo->dstAccelerationStructure, dispatch = deviceObj->getDispatch()](BaseObj const* baseObj) {
device.waitIdle();
device.destroyAccelerationStructureKHR(accellStruct, nullptr, dispatch);
this->bindInstanceBuffer->destroy(baseObj);
this->bindInstanceScratch->destroy(baseObj);
this->bindInstanceBuild->destroy(baseObj);
this->bindInstanceExtBuffer->destroy(baseObj);
});
//
//return std::get<0>(*this->buildStructure())->get();
return this->buildStructure();
};
protected:
//
virtual void construct(std::shared_ptr<DeviceObj> deviceObj = {}, cpp21::const_wrap_arg<InstanceLevelCreateInfo> cInfo = InstanceLevelCreateInfo{}) {
//this->deviceObj = deviceObj;
if (cInfo) { this->cInfo = cInfo; };
decltype(auto) device = this->base.as<vk::Device>();
//decltype(auto) deviceObj = ANAMED::context->get<DeviceObj>(this->base);
//
decltype(auto) accelInfo = infoMap->set(vk::StructureType::eAccelerationStructureCreateInfoKHR, vk::AccelerationStructureCreateInfoKHR{
.createFlags = vk::AccelerationStructureCreateFlagsKHR{},
.type = vk::AccelerationStructureTypeKHR::eTopLevel
});
//
decltype(auto) accelInstInfo = infoMap->set(vk::StructureType::eAccelerationStructureBuildGeometryInfoKHR, vk::AccelerationStructureBuildGeometryInfoKHR{
.type = accelInfo->type,
.flags = vk::BuildAccelerationStructureFlagBitsKHR::eAllowUpdate | vk::BuildAccelerationStructureFlagBitsKHR::ePreferFastTrace,
.mode = vk::BuildAccelerationStructureModeKHR::eBuild
});
//
if (this->cInfo->instances->size() > 0 && !this->handle) {
this->createStructure();
};
//
if (!this->handle) {
this->handle = uintptr_t(this);
};
};
};
};
#endif
| 47.845996
| 314
| 0.696622
|
helixd2s
|
cfa48ad6c7b190e56690d7eee32d88aa91d4bb44
| 1,555
|
cpp
|
C++
|
sources/daemon/Point.cpp
|
InfiernoGamesStudio/KnightScript
|
bb88f570b25850e6efbbde19d90d86a5e5d1e040
|
[
"MIT"
] | null | null | null |
sources/daemon/Point.cpp
|
InfiernoGamesStudio/KnightScript
|
bb88f570b25850e6efbbde19d90d86a5e5d1e040
|
[
"MIT"
] | null | null | null |
sources/daemon/Point.cpp
|
InfiernoGamesStudio/KnightScript
|
bb88f570b25850e6efbbde19d90d86a5e5d1e040
|
[
"MIT"
] | null | null | null |
#include <math.h>
#include "../../headers/Maths/Point.hpp"
void Points::Add( Point target, Point source, float scalar ) {
target[ 0 ] = source[ 0 ] + scalar;
target[ 1 ] = source[ 1 ] + scalar;
}
void Points::Add( Point target, Point one, Point two ) {
target[ 0 ] = one[ 0 ] + two[ 0 ];
target[ 1 ] = one[ 1 ] + two[ 1 ];
}
void Points::Subtract( Point target, Point source, float scalar ) {
target[ 0 ] = source[ 0 ] - scalar;
target[ 1 ] = source[ 1 ] - scalar;
}
void Points::Subtract( Point target, Point one, Point two ) {
target[ 0 ] = one[ 0 ] - two[ 0 ];
target[ 1 ] = one[ 1 ] - two[ 1 ];
}
void Points::Multiply( Point target, Point source, float scalar ) {
target[ 0 ] = source[ 0 ] * scalar;
target[ 1 ] = source[ 1 ] * scalar;
}
void Points::Multiply( Point target, Point one, Point two ) {
target[ 0 ] = one[ 0 ] * two[ 0 ];
target[ 1 ] = one[ 1 ] * two[ 1 ];
}
void Points::Negate( Point target ) {
target[ 0 ] = -target[ 0 ];
target[ 1 ] = -target[ 1 ];
}
float Points::Length( Point target ) {
return sqrtf(
target[ 0 ] * target[ 0 ] +
target[ 1 ] * target[ 1 ] +
1.0f
);
}
void Points::Normalize( Point target ) {
float length = 1.0f / Points::Length( target );
if ( length ) {
target[ 0 ] = target[ 0 ] * length;
target[ 1 ] = target[ 1 ] * length;
}
}
void Points::Lerp( Point target, Point one, Point two, float alpha ) {
float _alpha = 1.0f - alpha;
target[ 0 ] = one[ 0 ] * _alpha + alpha * two[ 0 ];
target[ 1 ] = one[ 1 ] * _alpha + alpha * two[ 1 ];
}
| 25.080645
| 70
| 0.568489
|
InfiernoGamesStudio
|
bbbb41e2aac11a6f8ec31e605efe85c826259bde
| 596
|
hpp
|
C++
|
falcon/mpl/min_element.hpp
|
jonathanpoelen/falcon
|
5b60a39787eedf15b801d83384193a05efd41a89
|
[
"MIT"
] | 2
|
2018-02-02T14:19:59.000Z
|
2018-05-13T02:48:24.000Z
|
falcon/mpl/min_element.hpp
|
jonathanpoelen/falcon
|
5b60a39787eedf15b801d83384193a05efd41a89
|
[
"MIT"
] | null | null | null |
falcon/mpl/min_element.hpp
|
jonathanpoelen/falcon
|
5b60a39787eedf15b801d83384193a05efd41a89
|
[
"MIT"
] | null | null | null |
#ifndef FALCON_MPL_MIN_ELEMENT_HPP
#define FALCON_MPL_MIN_ELEMENT_HPP
#include <falcon/mpl/arg.hpp>
#include <falcon/mpl/less.hpp>
#include <falcon/mpl/begin_end.hpp>
#include <falcon/mpl/aux_/min_element_impl.hpp>
namespace falcon {
namespace mpl {
template<typename Sequence, typename Pred = less<arg<1>,arg<2>>>
struct min_element
{
using type = typename aux::min_element_impl<
begin_t<Sequence>
, end_t<Sequence>
, Pred
>::type;
};
template<typename Sequence, typename Pred = less<arg<1>,arg<2>>>
using min_element_t = typename min_element<Sequence, Pred>::type;
}
}
#endif
| 20.551724
| 65
| 0.748322
|
jonathanpoelen
|
bbbf57f38682ed601e14d95f6124d0fb85d0306c
| 124
|
cc
|
C++
|
besch/reader/root_reader.cc
|
4ssfscker/node-sim
|
2bd3422fd645f415024907c9cf92697057cbc222
|
[
"Artistic-1.0",
"MIT"
] | null | null | null |
besch/reader/root_reader.cc
|
4ssfscker/node-sim
|
2bd3422fd645f415024907c9cf92697057cbc222
|
[
"Artistic-1.0",
"MIT"
] | null | null | null |
besch/reader/root_reader.cc
|
4ssfscker/node-sim
|
2bd3422fd645f415024907c9cf92697057cbc222
|
[
"Artistic-1.0",
"MIT"
] | null | null | null |
#include "root_reader.h"
void root_reader_t::register_obj(obj_besch_t *&data)
{
delete_node(data);
data = NULL;
}
| 13.777778
| 52
| 0.693548
|
4ssfscker
|
bbc52a59f4c8f617921babcc29a38c9cc782b673
| 1,541
|
cpp
|
C++
|
SematEngine/SourceCode/RMaterial.cpp
|
paupedra/SematEngine
|
bcc264bb996436645f0c84e2c81da8949e5745be
|
[
"MIT"
] | 2
|
2020-11-12T12:43:43.000Z
|
2020-12-05T17:57:12.000Z
|
SematEngine/SourceCode/RMaterial.cpp
|
paupedra/SematEngine
|
bcc264bb996436645f0c84e2c81da8949e5745be
|
[
"MIT"
] | null | null | null |
SematEngine/SourceCode/RMaterial.cpp
|
paupedra/SematEngine
|
bcc264bb996436645f0c84e2c81da8949e5745be
|
[
"MIT"
] | null | null | null |
//#include "Resource.h"
#include "Application.h"
#include "Random.h"
#include "Config.h"
#include "MFileSystem.h"
#include "MResourceManager.h"
#include "RMaterial.h"
#include "RTexture.h"
//#include "Dependecies/mmgr/mmgr.h"
RMaterial::RMaterial()
{
resourceData.type = ResourceType::material;
color = Color(1,1,1,1);
}
RMaterial::RMaterial(uint UID) : Resource(UID)
{
resourceData.type = ResourceType::material;
color = Color(1, 1, 1, 1);
}
RMaterial::~RMaterial()
{
}
void RMaterial::CleanUp()
{
if (texture != nullptr)
App->resourceManager->DereferenceResource(texture->GetUID());
}
UID RMaterial::GenerateCustomFile(UID textureUID)
{
//save mesh UID and color in Json
UID ret = resourceData.UID;
JsonNode root;
root.AddNumber("Texture UID", textureUID);
JsonArray colorJson = root.InitArray("Color");
colorJson.AddNumber(color.r);
colorJson.AddNumber(color.g);
colorJson.AddNumber(color.b);
colorJson.AddNumber(color.a);
std::string fileName = MATERIALS_PATH;
fileName += std::to_string(ret);
fileName += MATERIAL_EXTENTION;
char* buffer;
uint size = root.Serialize(&buffer);
App->fileSystem->Save(fileName.c_str(),buffer,size);
return ret;
}
Color RMaterial::GetColor()const
{
return color;
}
RTexture* RMaterial::GetTexture()const
{
return texture;
}
void RMaterial::SetTexture(RTexture* texture)
{
this->texture = texture;
}
void RMaterial::SetColor(Color color)
{
this->color.Set(color);
}
void RMaterial::SetColor(float r, float g, float b , float a)
{
this->color.Set(r, g, b, a);
}
| 18.129412
| 63
| 0.716418
|
paupedra
|
bbd4e132e184875840ec5497deb4155bcbaca885
| 441
|
cpp
|
C++
|
src/Externals/spire/es-render/util/Shader.cpp
|
Nahusa/SCIRun
|
c54e714d4c7e956d053597cf194e07616e28a498
|
[
"MIT"
] | 1
|
2019-05-30T06:00:15.000Z
|
2019-05-30T06:00:15.000Z
|
src/Externals/spire/es-render/util/Shader.cpp
|
manual123/SCIRun
|
3816b1dc4ebd0c5bd4539b7e50e08592acdac903
|
[
"MIT"
] | null | null | null |
src/Externals/spire/es-render/util/Shader.cpp
|
manual123/SCIRun
|
3816b1dc4ebd0c5bd4539b7e50e08592acdac903
|
[
"MIT"
] | null | null | null |
#include "Shader.hpp"
#include "es-render/comp/StaticShaderMan.hpp"
namespace ren {
void addShaderVSFS(spire::CerealCore& core, uint64_t entityID,
const std::string& shader)
{
std::weak_ptr<ren::ShaderMan> sm = core.getStaticComponent<ren::StaticShaderMan>()->instance_;
if (std::shared_ptr<ShaderMan> shaderMan = sm.lock())
shaderMan->loadVertexAndFragmentShader(core, entityID, shader);
}
} // namespace ren
| 27.5625
| 96
| 0.716553
|
Nahusa
|
bbda2eb4c3bc394d9b6441796529069304623d47
| 434
|
cpp
|
C++
|
src/reverse/WeakReference.cpp
|
rednek46/CyberEngineTweaks
|
961b1a573064770658d36831bc7534bd03ffeb44
|
[
"MIT"
] | null | null | null |
src/reverse/WeakReference.cpp
|
rednek46/CyberEngineTweaks
|
961b1a573064770658d36831bc7534bd03ffeb44
|
[
"MIT"
] | null | null | null |
src/reverse/WeakReference.cpp
|
rednek46/CyberEngineTweaks
|
961b1a573064770658d36831bc7534bd03ffeb44
|
[
"MIT"
] | null | null | null |
#include "WeakReference.h"
#include <RED4ext/REDreverse/Scripting/IScriptable.hpp>
WeakReference::WeakReference(sol::state_view aView, WeakHandle aWeakHandle)
: Type(aView, aWeakHandle.handle->GetClass())
, m_weakHandle(aWeakHandle)
{
}
WeakReference::~WeakReference()
{
// Someday maybe actually free memory
}
RED4ext::REDreverse::Scripting::IScriptable* WeakReference::GetHandle()
{
return m_weakHandle.handle;
}
| 22.842105
| 75
| 0.758065
|
rednek46
|
bbdcf2bd2e42ad798009a270b09dfcfcf0c203c2
| 774
|
cpp
|
C++
|
Lab-6/Coin_Change_Greedy.cpp
|
Hitesh1309/DAA-Lab-Submissions
|
acaa495628ea3755a7602cf9d8ee35874bddbe88
|
[
"MIT"
] | 1
|
2022-03-15T07:09:37.000Z
|
2022-03-15T07:09:37.000Z
|
Lab-6/Coin_Change_Greedy.cpp
|
Hitesh1309/DAA-Lab-Submissions
|
acaa495628ea3755a7602cf9d8ee35874bddbe88
|
[
"MIT"
] | null | null | null |
Lab-6/Coin_Change_Greedy.cpp
|
Hitesh1309/DAA-Lab-Submissions
|
acaa495628ea3755a7602cf9d8ee35874bddbe88
|
[
"MIT"
] | 1
|
2022-03-15T07:09:58.000Z
|
2022-03-15T07:09:58.000Z
|
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,t;
cout<<"\nEnter the number of denominations: ";
cin>>n;
vector<int> change;
map<int,int> result;
change.push_back(1); // default denominations
cout<<"\nEnter "<<n<<" denominations:\n";
for(int i=0;i<n;i++)
{
cin>>t;
change.push_back(t);
}
sort(change.begin(),change.end(), greater<int>());
cout<<endl<<"Enter the amount in hand: ";
int amount;
cin>>amount;
for(int X: change)
{
while(amount>=X)
{
amount -= X;
result[X]++;
}
}
cout<<"\nCoin change:\n";
for(int X:change)
{
cout<<"Change "<<X<<": "<<result[X]<<endl;
}
cout<<endl;
}
| 16.125
| 54
| 0.494832
|
Hitesh1309
|
bbe0aa9f6b22b951f63e21ce47715d608e8f84e9
| 684
|
cpp
|
C++
|
Sources/AGEngine/Render/Buffer/UniformBuffer.cpp
|
Another-Game-Engine/AGE
|
d5d9e98235198fe580a43007914f515437635830
|
[
"MIT"
] | 47
|
2015-03-29T09:44:25.000Z
|
2020-11-30T10:05:56.000Z
|
Sources/AGEngine/Render/Buffer/UniformBuffer.cpp
|
Another-Game-Engine/AGE
|
d5d9e98235198fe580a43007914f515437635830
|
[
"MIT"
] | 313
|
2015-01-01T18:16:30.000Z
|
2015-11-30T07:54:07.000Z
|
Sources/AGEngine/Render/Buffer/UniformBuffer.cpp
|
Another-Game-Engine/AGE
|
d5d9e98235198fe580a43007914f515437635830
|
[
"MIT"
] | 9
|
2015-06-07T13:21:54.000Z
|
2020-08-25T09:50:07.000Z
|
#include <Render/Buffer/UniformBuffer.hh>
namespace AGE
{
IBuffer const & UniformBuffer::bind() const
{
glBindBuffer(GL_UNIFORM_BUFFER, _id);
return (*this);
}
IBuffer const & UniformBuffer::unbind() const
{
glBindBuffer(GL_UNIFORM_BUFFER, 0);
return (*this);
}
GLenum UniformBuffer::mode() const
{
return (GL_UNIFORM_BUFFER);
}
IBuffer const & UniformBuffer::alloc(size_t size)
{
glBufferData(GL_UNIFORM_BUFFER, size, NULL, GL_STATIC_DRAW);
_size = size;
return (*this);
}
IBuffer const & UniformBuffer::sub(size_t offset, size_t size, void const *buffer) const
{
glBufferSubData(GL_UNIFORM_BUFFER, offset, size, buffer);
return (*this);
}
}
| 19
| 89
| 0.711988
|
Another-Game-Engine
|
bbe803dc4aebedb33cd48815632f2b5df5c208e7
| 4,670
|
cc
|
C++
|
docxbox/docx/docx_batch.cc
|
gyselroth/docxbox
|
ce7c4db5ef0d99f697b07cd086967c2bdb649f33
|
[
"MIT"
] | 5
|
2020-04-07T08:32:17.000Z
|
2020-07-01T18:24:59.000Z
|
docxbox/docx/docx_batch.cc
|
gyselroth/docxbox
|
ce7c4db5ef0d99f697b07cd086967c2bdb649f33
|
[
"MIT"
] | 56
|
2020-04-07T20:27:39.000Z
|
2020-07-09T15:38:30.000Z
|
docxbox/docx/docx_batch.cc
|
gyselroth/docxbox
|
ce7c4db5ef0d99f697b07cd086967c2bdb649f33
|
[
"MIT"
] | 2
|
2020-04-08T11:17:18.000Z
|
2020-07-01T18:25:04.000Z
|
// Copyright (c) 2020 gyselroth GmbH
// Licensed under the MIT License - https://opensource.org/licenses/MIT
#include <docxbox/app/app.h> // forward-declaration
#include <docxbox/docx/docx_batch.h>
class docx_archive_replace;
docx_batch::docx_batch(class docx_archive *archive, std::string json) {
archive_ = archive;
json_ = std::move(json);
is_json_valid_ = InitFromJson();
}
// Extract batch commands and rel. arguments
bool docx_batch::InitFromJson() {
try {
auto json_outer = nlohmann::json::parse(json_);
for (auto json_inner : json_outer) { // Sequence keys e.g "1", "2", ...
for (nlohmann::json::iterator it = json_inner.begin(); // Commands + JSON
it != json_inner.end();
++it) {
commands_.push_back(it.key());
// NOTE: Dumped JSON string has associations alphabetically sorted,
// not necessarily same order as originally given
const std::basic_string<char> &kArgsJson = it.value().dump();
arguments_json_.push_back(kArgsJson);
}
}
return !commands_.empty()
&& commands_.size() == arguments_json_.size();
} catch (nlohmann::detail::parse_error &e) {
return docxbox::AppLog::NotifyError("Parse error - Invalid JSON: " + json_);
}
}
bool docx_batch::ProcessSequence() {
if (!is_json_valid_)
return docxbox::AppLog::NotifyError(
"Cannot process: Detected invalid JSON");
int index = 0;
for (auto command : commands_) {
if (!ProcessStep(index)) return false;
++index;
}
return true;
}
bool docx_batch::ProcessStep(int index) {
if (index == 0) AddImagesIntoDocument(archive_->GetPathExtract());
docxbox::AppLog::NotifyInfo("Batch-process step " + std::to_string(index));
// Extract command of process step
std::vector<std::string> app_cli_arguments;
app_cli_arguments.emplace_back(archive_->GetArgValueAt(0));
app_cli_arguments.emplace_back(commands_[index]);
app_cli_arguments.emplace_back(archive_->GetArgValueAt(1));
if (arguments_json_[index] != "[]") {
// Extract arguments of process step into app_cli_arguments<>
auto json_outer = nlohmann::json::parse(arguments_json_[index]);
for (auto json_inner : json_outer) {
for (nlohmann::json::iterator it = json_inner.begin();
it != json_inner.end();
++it) {
nlohmann::json basic_json = it.value();
if (basic_json.is_object()) {
std::string object_json =
std::string("{\"")
.append(it.key()).append("\":")
.append(std::string(basic_json.dump()))
.append("}");
app_cli_arguments.emplace_back(object_json);
} else if (basic_json.is_string()) {
app_cli_arguments.emplace_back(it.value().dump().c_str());
}
// TODO(kay): test - needs handling of other types?
}
}
}
int argc = app_cli_arguments.size();
// Init process
// auto app = new docxbox::App(argc, argv, true);
auto app = new docxbox::App(argc, app_cli_arguments, true);
app->SetPathDocxIn(archive_->GetPathDocxIn());
app->SetPathExtract(archive_->GetPathExtract());
if (index == commands_.size() - 1) InitFinalStep(app);
app->Process();
delete app;
return true;
}
bool docx_batch::AddImagesIntoDocument(const std::string &path_extract) {
auto arguments = archive_->GetArgv();
rels *kRels = new rels(0, {}, getenv("PWD"), path_extract);
bool added_image = false;
for (auto &argument : arguments) {
if (helper::File::IsWordCompatibleImage(argument)
&& !kRels->AddImageFileAndRelation(&argument).empty()) {
docxbox::AppLog::NotifyInfo("Added image file and relation: " + argument);
added_image = true;
}
}
delete kRels;
return added_image;
}
// Prepare write resulting DOCX during final step of batch processing
void docx_batch::InitFinalStep(docxbox::App *app) {
app->SetIsFinalBatchStep(true);
auto last_argument = archive_->GetLastArgValue();
app->SetPathDocxOut(
helper::String::EndsWithCaseInsensitive(last_argument, ".docx")
// Set given destination path with/or filename for DOCX result file
? last_argument
// Overwrite source DOCX
: archive_->GetPathDocxIn());
}
std::string docx_batch::ExtractImageFilenameFromBatchStepJson(
const std::vector<std::string> &arguments) {
for (auto argument : arguments) {
helper::String::ReplaceAll(&argument, " ", "");
if (!helper::Json::IsJson(argument)
|| !helper::String::Contains(argument, "\"name\":")) continue;
return helper::String::GetSubStrBetween(argument, R"("name":")", "\",");
}
return "";
}
| 29.1875
| 80
| 0.655032
|
gyselroth
|
bbe808e0cd948e130d157b1da1fbf4e9093b652a
| 789
|
cpp
|
C++
|
thirdparty/allocator/allocator.cpp
|
m110h/protopuddlepp
|
1aeae3ca6188e0e6e934f4275f77304b062dd78a
|
[
"MIT"
] | 4
|
2020-05-27T01:46:39.000Z
|
2020-07-21T18:43:18.000Z
|
thirdparty/allocator/allocator.cpp
|
m110h/protopuddlepp
|
1aeae3ca6188e0e6e934f4275f77304b062dd78a
|
[
"MIT"
] | 7
|
2020-05-10T09:01:48.000Z
|
2020-07-23T00:17:09.000Z
|
thirdparty/allocator/allocator.cpp
|
m110h/protopuddlepp
|
1aeae3ca6188e0e6e934f4275f77304b062dd78a
|
[
"MIT"
] | null | null | null |
/////////////////////////////////////////////////////////////////////////////
// Name: Allocator.cpp
// Description: ...
// Author: Mariano Trebino (https://github.com/mtrebi)
// Modified by: Alexey Orlov (https://github.com/m110h)
// Modified: 08/08/2020
// Licence: MIT licence
/////////////////////////////////////////////////////////////////////////////
#include "allocator.h"
namespace mtrebi
{
Allocator::Allocator(const std::size_t totalSize): m_totalSize(totalSize), m_used(0), m_peak(0) {}
Allocator::~Allocator() {
m_totalSize = 0;
}
std::size_t Allocator::GetUsed()
{
return m_used;
}
std::size_t Allocator::GetPeak()
{
return m_peak;
}
std::size_t Allocator::GetTotal()
{
return m_totalSize;
}
}
| 22.542857
| 99
| 0.499366
|
m110h
|
bbecdcfe91eff3c6738539ebaea673a0934a79f2
| 1,037
|
cpp
|
C++
|
examples/xtd.core.examples/io/directory_info/src/directory_info.cpp
|
BaderEddineOuaich/xtd
|
6f28634c7949a541d183879d2de18d824ec3c8b1
|
[
"MIT"
] | 1
|
2022-02-25T16:53:06.000Z
|
2022-02-25T16:53:06.000Z
|
examples/xtd.core.examples/io/directory_info/src/directory_info.cpp
|
leanid/xtd
|
2e1ea6537218788ca08901faf8915d4100990b53
|
[
"MIT"
] | null | null | null |
examples/xtd.core.examples/io/directory_info/src/directory_info.cpp
|
leanid/xtd
|
2e1ea6537218788ca08901faf8915d4100990b53
|
[
"MIT"
] | null | null | null |
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::io;
int main() {
directory_info di(".");
console::write_line("full_name = {}", di.full_name());
console::write_line(" attributes = {}", di.attributes());
console::write_line(" creation_time = {}", di.creation_time());
console::write_line(" exists = {}", di.exists());
console::write_line(" extension = {}", di.extension());
console::write_line(" last_access_time = {}", di.last_access_time());
console::write_line(" last_write_time = {}", di.last_write_time());
console::write_line(" name = {}", di.name());
console::write_line(" to_string = {}", di.to_string());
}
// This code produces the following output :
//
// full_name = /|---OMITTED---|/xtd.examples/xtd.core.examples/io/directory_info/Debug
// attributes = directory
// creation_time = Fri Oct 22 19:21:52 2021
// exists = true
// extension =
// last_access_time = Fri Oct 22 19:22:14 2021
// last_write_time = Fri Oct 22 19:22:14 2021
// name = Debug
// to_string = .
| 34.566667
| 86
| 0.65188
|
BaderEddineOuaich
|
bbeff9b632796c1faed268a785eb5be8d9e65fb6
| 2,598
|
cpp
|
C++
|
Project Mania/Source/World/Projectile.cpp
|
larsolm/Archives
|
18968c18b80777e589bc8a704b4375be2fff8eea
|
[
"MIT"
] | null | null | null |
Project Mania/Source/World/Projectile.cpp
|
larsolm/Archives
|
18968c18b80777e589bc8a704b4375be2fff8eea
|
[
"MIT"
] | null | null | null |
Project Mania/Source/World/Projectile.cpp
|
larsolm/Archives
|
18968c18b80777e589bc8a704b4375be2fff8eea
|
[
"MIT"
] | null | null | null |
#include "Pch.h"
#include "Collision/DynamicCollision.h"
#include "Collision/LinearCollision.h"
#include "World/Projectile.h"
#include "Game/Game.h"
#include <PargonAnimation.h>
void Projectile::Initialize(Point2 position, Angle rotation)
{
ProjectedPosition = position;
Position = Game()->World.GetRealPosition(position, Node().Data);
PreviousPosition = Position;
Direction = rotation;
_model = Game()->Rendering.CreateDebugModel(Rectangle{ -0.25f, -0.125f, 0.5f, 0.25f }, Node().Data.IsSpindle, 0.0_radians, Node().Data.ZPosition, Blue);
}
void Projectile::Start()
{
}
void Projectile::Stop()
{
}
void Projectile::Update(float elapsed)
{
PreviousPosition = Position;
ProjectedPosition += Velocity * elapsed;
Velocity.Y += Weight * Node().Data.GravityStrength * elapsed;
Collision->Update(elapsed);
Position = Game()->World.GetRealPosition(ProjectedPosition, Node().Data);
}
void Projectile::Interpolate(float interpolation)
{
auto position = Pargon::Interpolate(PreviousPosition, Position, interpolation);
auto yaw = Node().Data.IsSpindle ? 90_degrees : 0.0_radians;
auto pitch = Node().Data.IsSpindle ? -Direction : 0.0_radians;
auto roll = Node().Data.IsSpindle ? Node().Data.WorldAngle : Direction + Node().Data.WorldAngle;
_model->Transform = Matrix4x4::CreateTransform({ position.X, position.Y, position.Z }, { 1.0f, 1.0f, 1.0f }, Quaternion::CreateFromEulerAngles(yaw, pitch, roll), {});
}
void Projectile::Animate(float elapsed)
{
}
void Projectile::ApplyAttributes(const WeaponAbilities& abilities, const WeaponAttributes& attributes, const WeaponAttributeModifiers& modifiers)
{
auto speed = attributes.GetAttribute(modifiers, WeaponAttribute::Speed);
auto weight = attributes.GetAttribute(modifiers, WeaponAttribute::Weight);
Weight = abilities.HasAbility(WeaponAbility::Ballistic) ? weight : 0.0f;
Damage = attributes.GetAttribute(modifiers, WeaponAttribute::Damage);
if (abilities.HasAbility(WeaponAbility::Dynamic))
Collision = std::make_unique<DynamicCollision>();
else
Collision = std::make_unique<LinearCollision>();
Collision->Projectile = this;
Velocity = Vector2::CreateFromDirection(Direction) * speed;
}
void Projectile::Collided(Character& character)
{
character.Processor->ProjectileHit(*this);
Game()->World.DestroyProjectile(*this);
}
void Projectile::Collided(CollisionLine& line)
{
Game()->World.DestroyProjectile(*this);
}
void Projectile::OnNodeChanged(const WorldNodeData& previous)
{
auto angleChange = previous.WorldAngle - Node().Data.WorldAngle;
Direction += angleChange;
Velocity.Rotate(angleChange);
}
| 28.866667
| 167
| 0.753657
|
larsolm
|
bbf97c861e57bd138250dc38b646985b187887f0
| 1,796
|
hpp
|
C++
|
test/myarray.hpp
|
ShadowTeolog/StaticJSON
|
a3da99eae7fe48212cf193632724705c148e952b
|
[
"MIT"
] | 158
|
2016-07-11T15:26:40.000Z
|
2022-01-01T14:12:32.000Z
|
test/myarray.hpp
|
ShadowTeolog/StaticJSON
|
a3da99eae7fe48212cf193632724705c148e952b
|
[
"MIT"
] | 32
|
2016-07-12T09:28:40.000Z
|
2021-06-03T12:12:15.000Z
|
test/myarray.hpp
|
ShadowTeolog/StaticJSON
|
a3da99eae7fe48212cf193632724705c148e952b
|
[
"MIT"
] | 31
|
2016-07-12T01:58:29.000Z
|
2021-12-08T10:12:02.000Z
|
#include <deque>
#include <staticjson/staticjson.hpp>
// This class is used to test custom conversion functions in StaticJSON.
template <class T>
class Array
{
private:
T* m_data;
size_t m_size;
public:
explicit Array() : m_data(nullptr), m_size(0) {}
explicit Array(size_t size) : m_size(size) { m_data = new T[size]; }
~Array() { clear(); }
Array(Array&& that) noexcept
{
m_data = that.m_data;
m_size = that.m_size;
that.m_data = nullptr;
that.m_size = 0;
}
Array& operator=(Array&& that) noexcept
{
std::swap(m_data, that.m_data);
std::swap(m_size, that.m_size);
return *this;
}
const T& operator[](size_t i) const { return m_data[i]; }
T& operator[](size_t i) { return m_data[i]; }
size_t size() const { return m_size; }
const T& back() const { return m_data[m_size - 1]; }
T& back() { return m_data[m_size - 1]; }
const T& front() const { return m_data[0]; }
T& front() { return m_data[0]; }
bool empty() const { return m_size == 0; }
void clear()
{
delete[] m_data;
m_data = nullptr;
m_size = 0;
}
};
namespace staticjson
{
template <class T>
struct Converter<Array<T>>
{
typedef std::deque<T> shadow_type;
static std::unique_ptr<ErrorBase> from_shadow(const shadow_type& shadow, Array<T>& value)
{
value = Array<T>(shadow.size());
for (size_t i = 0; i < shadow.size(); ++i)
{
value[i] = shadow[i];
}
return nullptr;
}
static void to_shadow(const Array<T>& value, shadow_type& shadow)
{
shadow.resize(value.size());
for (size_t i = 0; i < shadow.size(); ++i)
{
shadow[i] = value[i];
}
}
};
}
| 24.60274
| 93
| 0.565145
|
ShadowTeolog
|
bbfd2865dd2e103ed56881bd0b0541dcdb354ba6
| 2,921
|
cpp
|
C++
|
tests/src/NanoWinPrivateProfileTestTools.cpp
|
openlab-vn-ua/NanoWin32
|
5d9d2349ca551766213f5e2dcdbed4cc43c91052
|
[
"MIT"
] | 9
|
2017-09-28T11:37:36.000Z
|
2021-03-30T14:30:23.000Z
|
tests/src/NanoWinPrivateProfileTestTools.cpp
|
openlab-vn-ua/NanoWin32
|
5d9d2349ca551766213f5e2dcdbed4cc43c91052
|
[
"MIT"
] | 3
|
2019-11-22T12:09:40.000Z
|
2020-06-19T16:11:26.000Z
|
tests/src/NanoWinPrivateProfileTestTools.cpp
|
openlab-vn-ua/NanoWin32
|
5d9d2349ca551766213f5e2dcdbed4cc43c91052
|
[
"MIT"
] | 1
|
2020-04-25T10:13:01.000Z
|
2020-04-25T10:13:01.000Z
|
#include <stdio.h>
#ifdef __linux
#include <unistd.h>
#endif
#include "NanoWinPrivateProfileTestTools.h"
#include "NanoWinStrConvert.h"
#ifdef __linux
char TestINIFileName[] = "test.ini"; // foreward slash replace test as well
wchar_t TestINIFileNameW[] = L"тест.ini"; // foreward slash replace test as well
#else
char TestINIFileName[] = "d:\\test.ini";
wchar_t TestINIFileNameW[] = L"d:\\тест.ini";
#endif
bool TestINIFileCreateBinary(const char *src)
{
bool ok = false;
FILE *f = fopen(TestINIFileName,"wb");
if (f == NULL)
{
// int e = errno;
// printf("fopen(%s)=NULL,errno:%d\n", TestINIFileName, e);
ok = false;
}
else
{
ok = fputs(src,f) > 0;
if (!ok)
{
int e = errno;
fprintf(f, "%d\n", e);
}
fclose(f);
}
return ok;
}
bool TestINIFileCreateBinaryW(const wchar_t *src)
{
bool ok =false;
try
{
FILE *f = fopen(NanoWin::StrConverter::Convert(TestINIFileNameW).c_str(),"wb");
if (f != NULL)
{
ok = fputs(NanoWin::StrConverter::Convert(src).c_str(),f) > 0;
fclose(f);
}
}
catch (.../*NanoWin::StrConverter::ConversionError*/)
{
// conversion error is equal to file creation error
}
return ok;
}
std::string TestINIFileReadBinary (void)
{
std::string result;
char buffer[4096 + 1];
FILE *f = fopen(TestINIFileName,"rb");
if (f != NULL)
{
size_t read_size;
do
{
read_size = fread(buffer,1,sizeof(buffer) - 1,f);
if (read_size > 0)
{
buffer[read_size] = '\0';
result += buffer;
}
} while (read_size > 0);
fclose(f);
}
return result;
}
std::wstring TestINIFileReadBinaryW (void)
{
std::string result;
char buffer[4096 + 1];
try
{
FILE *f = fopen(NanoWin::StrConverter::Convert(TestINIFileNameW).c_str(),"rb");
if (f != NULL)
{
size_t read_size;
do
{
read_size = fread(buffer,1,sizeof(buffer) - 1,f);
if (read_size > 0)
{
buffer[read_size] = '\0';
result += buffer;
}
} while (read_size > 0);
fclose(f);
}
return NanoWin::StrConverter::Convert(result);
}
catch (.../*NanoWin::StrConverter::ConversionError*/)
{
// conversion error is similar to file open/read error
return std::wstring();
}
}
void TestINIFileRemove (void)
{
#ifdef __linux
unlink(TestINIFileName);
#else
_unlink(TestINIFileName);
#endif
}
void TestINIFileRemoveW (void)
{
try
{
#ifdef __linux
unlink(NanoWin::StrConverter::Convert(TestINIFileNameW).c_str());
#else
_unlink(NanoWin::StrConverter::Convert(TestINIFileNameW).c_str());
#endif
}
catch (.../*NanoWin::StrConverter::ConversionError*/)
{
// ignore conversion errors, inability to remove file is
// not critical in our tests
}
}
| 18.142857
| 84
| 0.588497
|
openlab-vn-ua
|
0101418ff9a619efb58190d40c9b3056354de9e6
| 2,120
|
hpp
|
C++
|
experimental/Pomdog.Experimental/UI/UIEventDispatcher.hpp
|
bis83/pomdog
|
133a9262958d539ae6d93664e6cb2207b5b6c7ff
|
[
"MIT"
] | null | null | null |
experimental/Pomdog.Experimental/UI/UIEventDispatcher.hpp
|
bis83/pomdog
|
133a9262958d539ae6d93664e6cb2207b5b6c7ff
|
[
"MIT"
] | null | null | null |
experimental/Pomdog.Experimental/UI/UIEventDispatcher.hpp
|
bis83/pomdog
|
133a9262958d539ae6d93664e6cb2207b5b6c7ff
|
[
"MIT"
] | null | null | null |
// Copyright (c) 2013-2015 mogemimi.
// Distributed under the MIT license. See LICENSE.md file for details.
#ifndef POMDOG_UIEVENTDISPATCHER_83873A91_HPP
#define POMDOG_UIEVENTDISPATCHER_83873A91_HPP
#include "UIView.hpp"
#include "PointerPoint.hpp"
#include "PointerEventType.hpp"
#include "detail/SubscribeRequestDispatcher.hpp"
#include <Pomdog/Pomdog.hpp>
#include <cstdint>
#include <memory>
#include <vector>
namespace Pomdog {
namespace UI {
namespace Detail {
class UIEventConnection;
}// namespace Detail
class UIEventDispatcher: public std::enable_shared_from_this<UIEventDispatcher> {
public:
explicit UIEventDispatcher(std::shared_ptr<GameWindow> const& window);
void UpdateChildren();
void Touch(MouseState const& mouseState);
void UpdateAnimation(Duration const& frameDuration);
Detail::UIEventConnection Connect(std::shared_ptr<UIView> const& child);
Detail::UIEventConnection Connect(std::shared_ptr<UIView> && child);
private:
std::shared_ptr<UIView> Find(Point2D const& position);
void PointerEntered(Point2D const& position, MouseState const& mouseState, std::shared_ptr<UIView> const& node);
void PointerExited(Point2D const& position);
void PointerPressed(Point2D const& position);
void PointerMoved(Point2D const& position);
void PointerReleased(Point2D const& position);
Optional<PointerMouseEvent> FindPointerMouseEvent(MouseState const& mouseState) const;
ButtonState CheckMouseButton(MouseState const& mouseState, PointerMouseEvent const& pointerMouseEvent) const;
void Sort();
private:
struct PointerState {
std::shared_ptr<UIView> focusedElement;
PointerPoint pointerPoint;
std::int32_t PrevScrollWheel;
};
typedef Detail::SubscribeRequestDispatcher<UIView> SubscribeRequestDispatcherType;
SubscribeRequestDispatcherType subscribeRequests;
std::vector<std::shared_ptr<UIView>> children;
std::unique_ptr<PointerState> pointerState;
std::shared_ptr<GameWindow> window;
};
}// namespace UI
}// namespace Pomdog
#endif // POMDOG_UIEVENTDISPATCHER_83873A91_HPP
| 28.266667
| 116
| 0.768396
|
bis83
|
01016d5372d5d6d26844a7c44e1e187ea8c9fec3
| 7,298
|
cpp
|
C++
|
src/Export/EConnection.cpp
|
ItsClemi/node-odbc2
|
d8616546b506cc41a64984c4f83cea990cd6564f
|
[
"Apache-2.0"
] | 8
|
2016-04-26T17:16:24.000Z
|
2020-01-20T15:45:54.000Z
|
src/Export/EConnection.cpp
|
ItsClemi/node-odbc2
|
d8616546b506cc41a64984c4f83cea990cd6564f
|
[
"Apache-2.0"
] | 2
|
2017-08-07T03:39:25.000Z
|
2017-11-07T18:37:49.000Z
|
src/Export/EConnection.cpp
|
ItsClemi/node-odbc2
|
d8616546b506cc41a64984c4f83cea990cd6564f
|
[
"Apache-2.0"
] | 1
|
2019-11-01T18:52:10.000Z
|
2019-11-01T18:52:10.000Z
|
// File: EConnection.cpp
//
// node-odbc (odbc interface for NodeJS)
//
// Copyright 2017 Clemens Susenbeth
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "stdafx.h"
#include "EConnection.h"
#include "EModuleHelper.h"
#include "EPreparedQuery.h"
#include "Odbc/Connection/ConnectionPool.h"
#include "Odbc/Query/Query.h"
using namespace v8;
Nan::Persistent< Function > EConnection::constructor;
NAN_MODULE_INIT( EConnection::InitializeModule )
{
const auto strClassName = Nan::New( "Connection" ).ToLocalChecked( );
const auto tpl = Nan::New< FunctionTemplate >( EConnection::New );
tpl->InstanceTemplate( )->SetInternalFieldCount( 1 );
tpl->SetClassName( strClassName );
{
Nan::SetPrototypeMethod( tpl, "connect", EConnection::Connect );
Nan::SetPrototypeMethod( tpl, "disconnect", EConnection::Disconnect );
//Nan::SetPrototypeMethod( tpl, "setResilienceStrategy", EConnection::SetResilienceStrategy );
Nan::SetPrototypeMethod( tpl, "prepareQuery", EConnection::PrepareQuery );
Nan::SetPrototypeMethod( tpl, "executeQuery", EConnection::ExecuteQuery );
Nan::SetPrototypeMethod( tpl, "getInfo", EConnection::GetInfo );
}
constructor.Reset( Nan::GetFunction( tpl ).ToLocalChecked( ) );
Nan::Set( target, strClassName, Nan::GetFunction( tpl ).ToLocalChecked( ) );
}
NAN_METHOD( EConnection::New )
{
auto isolate = info.GetIsolate( );
HandleScope scope( isolate );
const auto context = isolate->GetCurrentContext( );
if( info.IsConstructCall( ) )
{
V8_TYPE_VALIDATE( info[ 0 ]->IsUndefined( ) || info[ 0 ]->IsObject( ), "^advancedProps: is not undefined or an object" );
const auto pThis = new EConnection( );
{
pThis->Wrap( info.This( ) );
pThis->GetPool( )->SetSharedInstance( pThis->m_pPool );
}
if( info[ 0 ]->IsObject( ) )
{
if( !pThis->GetPool( )->ReadConnectionProps( info.GetIsolate( ), info[ 0 ].As< Object >( ) ) )
{
return;
}
}
info.GetReturnValue( ).Set( info.This( ) );
}
else
{
const int argc = 1;
Local< Value > argv[ argc ] = { info[ 0 ] };
const auto cons = Nan::New( constructor );
info.GetReturnValue( ).Set( cons->NewInstance( context, argc, argv ).ToLocalChecked( ) );
}
}
NAN_METHOD( EConnection::Connect )
{
HandleScope scope( info.GetIsolate( ) );
V8_TYPE_VALIDATE( info[ 0 ]->IsString( ), "^connectionString: is not a string" );
V8_TYPE_VALIDATE( info[ 1 ]->IsUndefined( ) || info[ 1 ]->Uint32Value( ), "^connectionTimeout: is not undefined or int32" );
const auto pThis = Nan::ObjectWrap::Unwrap< EConnection >( info.This( ) );
V8_RUNTIME_VALIDATE( pThis->GetPool( )->GetState( ) == EPoolState::eNone, "invalid pool state" );
const auto szConnectionString = FromV8String( info[ 0 ].As< String >( ) );
uint32_t nTimeout = 0;
if( info[ 0 ]->IsUint32( ) )
{
nTimeout = info[ 0 ]->Uint32Value( Nan::GetCurrentContext( ) ).FromJust( );
}
if( !pThis->GetPool( )->InitializePool( szConnectionString, nTimeout ) )
{
return;
}
info.GetReturnValue( ).Set( info.This( ) );
}
NAN_METHOD( EConnection::Disconnect )
{
auto isolate = info.GetIsolate( );
HandleScope scope( isolate );
V8_RUNTIME_VALIDATE( info[ 0 ]->IsFunction( ), "cb: not a function" );
const auto pThis = Nan::ObjectWrap::Unwrap< EConnection >( info.This( ) );
V8_RUNTIME_VALIDATE( pThis->GetPool( )->IsReady( ), "invalid pool state (connected to your datasource?)" );
pThis->GetPool( )->RequestDisconnect( isolate, info[ 0 ].As< Function >( ) );
}
NAN_METHOD( EConnection::SetResilienceStrategy )
{
auto isolate = info.GetIsolate( );
HandleScope scope( isolate );
V8_RUNTIME_VALIDATE( info[ 0 ]->IsObject( ), "strategy: not an object" );
const auto pThis = Nan::ObjectWrap::Unwrap< EConnection >( info.This( ) );
V8_RUNTIME_VALIDATE( pThis->GetPool( )->GetState( ) == EPoolState::eNone, "invalid pool state (connected to your datasource?)" );
if( !pThis->GetPool( )->ReadResilienceStrategy( isolate, info[ 0 ].As< Object >( ) ) )
{
return;
}
info.GetReturnValue( ).Set( info.This( ) );
}
NAN_METHOD( EConnection::PrepareQuery )
{
auto isolate = info.GetIsolate( );
HandleScope scope( isolate );
V8_RUNTIME_VALIDATE( info[ 0 ]->IsString( ), "query: invalid parameter type" );
const auto pThis = Nan::ObjectWrap::Unwrap< EConnection >( info.This( ) );
V8_RUNTIME_VALIDATE( pThis->GetPool( )->IsReady( ), "invalid pool state (connected to your datasource?)" );
const auto pQuery = pThis->GetPool( )->CreateQuery( );
pQuery->InitializeQuery( FromV8String( info[ 0 ].As< String >( ) ) );
{
if( !pQuery->GetQueryParam( )->BindParameters( isolate, info, 1 ) )
{
return;
}
}
info.GetReturnValue( ).Set(
EPreparedQuery::CreateInstance( isolate, pQuery )
);
}
NAN_METHOD( EConnection::ExecuteQuery )
{
auto isolate = info.GetIsolate( );
HandleScope scope( isolate );
const auto context = isolate->GetCurrentContext( );
V8_TYPE_VALIDATE( info[ 0 ]->IsFunction( ) || info[ 0 ]->IsUint32( ), "cb || eFetchMode: is not a callback or a number" );
const auto pThis = Nan::ObjectWrap::Unwrap< EConnection >( info.This( ) );
V8_RUNTIME_VALIDATE( pThis->GetPool( )->IsReady( ), "invalid pool state (connected to your datasource?)" );
const auto pQuery = pThis->GetPool( )->CreateQuery( );
if( info[ 0 ]->IsFunction( ) )
{
V8_TYPE_VALIDATE( info[ 1 ]->IsString( ), "query: is not a string" );
if( !pQuery->SetParameters(
isolate,
EFetchMode::eSingle,
info[ 0 ].As< Function >( ),
FromV8String( info[ 1 ].As< String >( ) ),
info,
2
) )
{
return;
}
}
else
{
uint32_t nFetchMode = info[ 0 ]->Uint32Value( context ).FromJust( );
V8_TYPE_VALIDATE( nFetchMode < ToUnderlyingType( EFetchMode::eMax ), "eMode: invalid number" );
V8_TYPE_VALIDATE( info[ 1 ]->IsFunction( ), "cb: is not a function" );
V8_TYPE_VALIDATE( info[ 2 ]->IsString( ), "query: is not a string" );
if( !pQuery->SetParameters(
isolate,
static_cast< EFetchMode >( nFetchMode ),
info[ 1 ].As< Function >( ),
FromV8String( info[ 2 ].As< String >( ) ),
info,
3
) )
{
return;
}
}
pThis->GetPool( )->ExecuteQuery( pQuery );
isolate->AdjustAmountOfExternalAllocatedMemory( sizeof( CQuery ) );
}
NAN_METHOD( EConnection::GetInfo )
{
HandleScope scope( info.GetIsolate( ) );
const auto pThis = Nan::ObjectWrap::Unwrap< EConnection >( info.This( ) );
V8_RUNTIME_VALIDATE( pThis->GetPool( )->IsReady( ), "invalid pool state (connected to your datasource?)" );
info.GetReturnValue( ).Set(
pThis->m_pPool->GetConnectionInfo( info.GetIsolate( ) )
);
}
#ifdef _DEBUG
extern std::atomic< size_t > g_nJsConnectionCount;
#endif
EConnection::EConnection( )
{
#ifdef _DEBUG
g_nJsConnectionCount++;
#endif
}
EConnection::~EConnection( )
{
#ifdef _DEBUG
g_nJsConnectionCount--;
#endif
}
| 27.231343
| 130
| 0.680323
|
ItsClemi
|
0108b97286aaa56cfa92540d3f03cfc6acb5024a
| 72,720
|
cpp
|
C++
|
Backend/BundleAdjustment/LocalBundleAdjustorGN.cpp
|
StevenCui/ICE-BA-Mono-Android
|
955e72bd548d2626b2c27115c34c0a4e7e3816d9
|
[
"Apache-2.0"
] | 24
|
2019-04-19T02:43:10.000Z
|
2022-03-21T11:58:37.000Z
|
Backend/BundleAdjustment/LocalBundleAdjustorGN.cpp
|
StevenCui/ICE-BA-Mono-Android
|
955e72bd548d2626b2c27115c34c0a4e7e3816d9
|
[
"Apache-2.0"
] | 1
|
2019-04-23T03:01:16.000Z
|
2019-04-23T03:01:16.000Z
|
Backend/BundleAdjustment/LocalBundleAdjustorGN.cpp
|
StevenCui/ICE-BA-Mono-Android
|
955e72bd548d2626b2c27115c34c0a4e7e3816d9
|
[
"Apache-2.0"
] | 8
|
2019-03-05T03:42:57.000Z
|
2021-11-20T01:52:51.000Z
|
/******************************************************************************
* Copyright 2017-2018 Baidu Robotic Vision Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include "stdafx.h"
#include "LocalBundleAdjustor.h"
#include "Vector12.h"
void LocalBundleAdjustor::UpdateFactors() {
const int nLFs = static_cast<int>(m_LFs.size());
for (int iLF = 0; iLF < nLFs; ++iLF) {
if (m_ucsLF[iLF] & LBA_FLAG_FRAME_UPDATE_CAMERA) {
m_SAcusLF[iLF].MakeZero();
}
if (m_ucmsLF[iLF]) {
m_SAcmsLF[iLF].MakeZero();
}
}
const ubyte ucFlag = LBA_FLAG_FRAME_PUSH_TRACK | LBA_FLAG_FRAME_UPDATE_DEPTH;
const ubyte udFlag = LBA_FLAG_TRACK_PUSH | LBA_FLAG_TRACK_UPDATE_DEPTH;
const float add = UT::Inverse(BA_VARIANCE_REGULARIZATION_DEPTH, BA_WEIGHT_FEATURE);
const int nKFs = static_cast<int>(m_KFs.size());
for (int iKF = 0; iKF < nKFs; ++iKF)
{
if (!(m_ucsKF[iKF] & ucFlag)) {
continue;
}
const ubyte *uds = m_uds.data() + m_iKF2d[iKF];
KeyFrame &KF = m_KFs[iKF];
//m_xs?
const int Nx = static_cast<int>(KF.m_xs.size());
for (int ix = 0; ix < Nx; ++ix)
{
if (!(uds[ix] & udFlag)) {
continue;
} else if (uds[ix] & LBA_FLAG_TRACK_UPDATE_DEPTH) {
KF.m_Axps[ix].MakeZero();
KF.m_AxpsST[ix].MakeZero();
KF.m_Axs[ix].MakeZero();
const int iST1 = KF.m_ix2ST[ix], iST2 = KF.m_ix2ST[ix + 1];
KF.m_AxsST.MakeZero(iST1, iST2 - iST1);
KF.m_Axs[ix].m_Sadd.m_a = add;
for (int iST = iST1; iST < iST2; ++iST) {
KF.m_AxsST[iST].m_Sadd.m_a = add;
}
} else {
const int iST1 = KF.m_ix2ST[ix], iST2 = KF.m_ix2ST[ix + 1];
for (int iST = iST2 - 1; iST >= iST1 && (KF.m_usST[iST] & LBA_FLAG_TRACK_PUSH); --iST) {
KF.m_AxsST[iST].m_Sadd.m_a = add;
}
}
}
}
UpdateFactorsFeaturePriorDepth();
UpdateFactorsPriorCameraMotion();
UpdateFactorsIMU();
UpdateFactorsFixPositionZ();
UpdateFactorsFixMotion();
}
void LocalBundleAdjustor::UpdateFactorsFeaturePriorDepth() {
UpdateFactorsFeatureLF();
UpdateFactorsFeatureKF();
UpdateFactorsPriorDepth();
}
void LocalBundleAdjustor::UpdateFactorsFeatureLF() {
Rigid3D Tr[2];
FTR::Factor::DD dadd, daddST;
Camera::Factor::Unitary::CC dAczz;
FTR::Factor::FixSource::U U;
const ubyte ucFlag = LBA_FLAG_FRAME_PUSH_TRACK | LBA_FLAG_FRAME_POP_TRACK |
LBA_FLAG_FRAME_UPDATE_DEPTH;
const ubyte udFlag = LBA_FLAG_TRACK_PUSH | LBA_FLAG_TRACK_POP |
LBA_FLAG_TRACK_UPDATE_DEPTH;
const int nLFs = static_cast<int>(m_LFs.size());
for (int iLF = 0; iLF < nLFs; ++iLF)
{
LocalFrame &LF = m_LFs[iLF];
const Rigid3D &C = m_CsLF[iLF].m_T;
const bool ucz = (m_ucsLF[iLF] & LBA_FLAG_FRAME_UPDATE_CAMERA) != 0;
//SAczz: 6x6f m_A, float m_r, 6x1f m_b
Camera::Factor::Unitary::CC &SAczz = m_SAcusLF[iLF];
// NZ is the number of source frame for current frame
const int NZ = static_cast<int>(LF.m_Zs.size());
for (int iZ = 0; iZ < NZ; ++iZ)
{
const FRM::Measurement &Z = LF.m_Zs[iZ];
//iKF is the source frame id
const int iKF = Z.m_iKF;
const bool ucx = (m_ucsKF[iKF] & LBA_FLAG_FRAME_UPDATE_CAMERA) != 0, ucr = ucx || ucz;
if (!ucr && !(m_ucsKF[iKF] & ucFlag)) {
continue;
}
const bool pushFrm = (m_ucsKF[iKF] & LBA_FLAG_FRAME_PUSH_TRACK) != 0;
*Tr = C / m_CsKF[iKF];
//id is the map point id for the source frame in all the points
const int id = m_iKF2d[iKF];
ubyte *uds = m_uds.data() + id;
const Depth::InverseGaussian *ds = m_ds.data() + id;
//KF is the source frame
KeyFrame &KF = m_KFs[iKF];
//iz is the feature id in the measurement frame
for (int iz = Z.m_iz1; iz < Z.m_iz2; ++iz)
{
//z is the measurement in source frame
const FTR::Measurement &z = LF.m_zs[iz];
//ix is the feature id in the source frame
const int ix = z.m_ix;
if (!ucr && !(uds[ix] & udFlag)) {
continue;
}
const LocalFrame::SlidingTrack &ST = LF.m_STs[iz];
const int iST0 = KF.m_ix2ST[ix], iST1 = iST0 + ST.m_ist1, iST2 = iST0 + ST.m_ist2;
const int Nst = iST2 - iST1;
FTR::Factor::FixSource::A2 &A = LF.m_Azs2[iz];
FTR::Factor::FixSource::A3 &AST = LF.m_AzsST[iz];
const bool ud = (uds[ix] & LBA_FLAG_TRACK_UPDATE_DEPTH) != 0;
const bool pushST = pushFrm && (KF.m_usST[iST2 - 1] & LBA_FLAG_TRACK_PUSH);
if (ucr || ud) {
if (!ud) {
dadd = A.m_add;
daddST = AST.m_add;
}
if (!ucz) {
dAczz = A.m_Aczz;
}
//dF = A.m_F;
FTR::GetFactor<LBA_ME_FUNCTION>(BA_WEIGHT_FEATURE, Tr, KF.m_xs[ix], ds[ix], C, z,
&LF.m_Lzs[iz], &LF.m_Azs1[iz], &A, &U);
AST.Set(A.m_add, LF.m_Azs1[iz].m_adczA);
if (Nst >= 1) {
AST *= 1.0f / Nst;
}
LF.m_Nsts[iz] = Nst;
if (ud) {
KF.m_Axs[ix].m_Sadd += A.m_add;
for (int iST = iST1; iST < iST2; ++iST) {
KF.m_AxsST[iST].m_Sadd += AST.m_add;
KF.m_usST[iST] |= LBA_FLAG_TRACK_UPDATE_INFORMATION;
}
} else {
FTR::Factor::DD::amb(A.m_add, dadd, dadd);
KF.m_Axs[ix].m_Sadd += dadd;
if (pushST) {
int iST;
for (iST = iST2 - 1; iST >= iST1 && (KF.m_usST[iST] & LBA_FLAG_TRACK_PUSH); --iST) {
KF.m_AxsST[iST].m_Sadd += AST.m_add;
KF.m_usST[iST] |= LBA_FLAG_TRACK_UPDATE_INFORMATION;
}
FTR::Factor::DD::amb(AST.m_add, daddST, daddST);
for (; iST >= iST1; --iST) {
KF.m_AxsST[iST].m_Sadd += daddST;
KF.m_usST[iST] |= LBA_FLAG_TRACK_UPDATE_INFORMATION;
}
}
else {
FTR::Factor::DD::amb(AST.m_add, daddST, daddST);
for (int iST = iST1; iST < iST2; ++iST) {
KF.m_AxsST[iST].m_Sadd += daddST;
KF.m_usST[iST] |= LBA_FLAG_TRACK_UPDATE_INFORMATION;
}
}
}
if (ucz) {
SAczz += A.m_Aczz;
} else {
Camera::Factor::Unitary::CC::AmB(A.m_Aczz, dAczz, dAczz);
SAczz += dAczz;
}
//dF = A.m_F - dF;
//m_F = dF + m_F;
m_ucsKF[iKF] |= LBA_FLAG_FRAME_UPDATE_TRACK_INFORMATION;
uds[ix] |= LBA_FLAG_TRACK_UPDATE_INFORMATION;
} else if (pushST || LF.m_Nsts[iz] != Nst) {
if (LF.m_Nsts[iz] == Nst) {
for (int iST = iST2 - 1; iST >= iST1 && (KF.m_usST[iST] & LBA_FLAG_TRACK_PUSH); --iST) {
KF.m_AxsST[iST].m_Sadd += AST.m_add;
KF.m_usST[iST] |= LBA_FLAG_TRACK_UPDATE_INFORMATION;
}
}
else {
daddST = AST.m_add;
AST.Set(A.m_add, LF.m_Azs1[iz].m_adczA);
if (Nst >= 1) {
AST *= 1.0f / Nst;
}
LF.m_Nsts[iz] = Nst;
if (pushST) {
int iST;
for (iST = iST2 - 1; iST >= iST1 && (KF.m_usST[iST] & LBA_FLAG_TRACK_PUSH); --iST) {
KF.m_AxsST[iST].m_Sadd += AST.m_add;
KF.m_usST[iST] |= LBA_FLAG_TRACK_UPDATE_INFORMATION;
}
FTR::Factor::DD::amb(AST.m_add, daddST, daddST);
for (; iST >= iST1; --iST) {
KF.m_AxsST[iST].m_Sadd += daddST;
KF.m_usST[iST] |= LBA_FLAG_TRACK_UPDATE_INFORMATION;
}
}
else {
FTR::Factor::DD::amb(AST.m_add, daddST, daddST);
for (int iST = iST1; iST < iST2; ++iST) {
KF.m_AxsST[iST].m_Sadd += daddST;
KF.m_usST[iST] |= LBA_FLAG_TRACK_UPDATE_INFORMATION;
}
}
}
m_ucsKF[iKF] |= LBA_FLAG_FRAME_UPDATE_TRACK_INFORMATION;
}
}
}
}
}
void LocalBundleAdjustor::UpdateFactorsFeatureKF() {
Rigid3D Tr[2];
FTR::Factor::DD dadd;
FTR::Factor::Depth::U U;
//float dF;
const ubyte ucFlag = LBA_FLAG_FRAME_UPDATE_TRACK_INFORMATION |
LBA_FLAG_FRAME_UPDATE_TRACK_INFORMATION_KF;
const ubyte udFlag = LBA_FLAG_TRACK_UPDATE_INFORMATION | LBA_FLAG_TRACK_UPDATE_INFORMATION_KF;
const int nKFs = static_cast<int>(m_KFs.size());
for (int iKF = 0; iKF < nKFs; ++iKF) {
KeyFrame &KF = m_KFs[iKF];
const Rigid3D &C = m_CsKF[iKF];
const bool ucz = (m_ucsKF[iKF] & LBA_FLAG_FRAME_UPDATE_CAMERA) != 0;
const int NZ = int(KF.m_Zs.size());
for (int iZ = 0; iZ < NZ; ++iZ) {
const FRM::Measurement &Z = KF.m_Zs[iZ];
const int _iKF = Z.m_iKF;
const bool ucx = (m_ucsKF[_iKF] & LBA_FLAG_FRAME_UPDATE_CAMERA) != 0, ucr = ucx || ucz;
if (!ucr && !(m_ucsKF[_iKF] & LBA_FLAG_FRAME_UPDATE_DEPTH)) {
continue;
}
*Tr = C / m_CsKF[_iKF];
const int id = m_iKF2d[_iKF];
ubyte *_uds = m_uds.data() + id;
const Depth::InverseGaussian *_ds = m_ds.data() + id;
KeyFrame &_KF = m_KFs[_iKF];
for (int iz = Z.m_iz1; iz < Z.m_iz2; ++iz) {
const FTR::Measurement &z = KF.m_zs[iz];
const int ix = z.m_ix;
const bool ud = (_uds[ix] & LBA_FLAG_TRACK_UPDATE_DEPTH) != 0;
if (!ucr && !ud) {
continue;
}
FTR::Factor::Depth &A = KF.m_Azs[iz];
if (!ud) {
dadd = A.m_add;
}
//dF = A.m_F;
FTR::GetFactor<LBA_ME_FUNCTION>(BA_WEIGHT_FEATURE_KEY_FRAME, Tr, _KF.m_xs[ix], _ds[ix],
C, z, &A, &U);
if (ud) {
_KF.m_Axps[ix].m_Sadd += A.m_add;
_KF.m_Axs[ix].m_Sadd += A.m_add;
} else {
FTR::Factor::DD::amb(A.m_add, dadd, dadd);
_KF.m_Axps[ix].m_Sadd += dadd;
_KF.m_Axs[ix].m_Sadd += dadd;
}
//dF = A.m_F - dF;
//m_F = dF + m_F;
m_ucsKF[_iKF] |= ucFlag;
_uds[ix] |= udFlag;
}
}
}
}
void LocalBundleAdjustor::UpdateFactorsPriorDepth() {
FTR::Factor::DD dadd, daddST;
const ubyte ucFlag1 = LBA_FLAG_FRAME_PUSH_TRACK | LBA_FLAG_FRAME_POP_TRACK |
LBA_FLAG_FRAME_UPDATE_TRACK_INFORMATION_KF;
const ubyte ucFlag2 = ucFlag1 | LBA_FLAG_FRAME_UPDATE_DEPTH;
const ubyte udFlag1 = LBA_FLAG_TRACK_PUSH | LBA_FLAG_TRACK_POP |
LBA_FLAG_TRACK_UPDATE_INFORMATION_KF;
const ubyte udFlag2 = udFlag1 | LBA_FLAG_TRACK_UPDATE_DEPTH;
const int nKFs = static_cast<int>(m_KFs.size());
for (int iKF = 0; iKF < nKFs; ++iKF) {
if (!(m_ucsKF[iKF] & ucFlag2)) {
continue;
}
const bool pushFrm = (m_ucsKF[iKF] & LBA_FLAG_FRAME_PUSH_TRACK) != 0;
m_ucsKF[iKF] &= ~ucFlag1;
const int id = m_iKF2d[iKF];
const Depth::InverseGaussian *ds = m_ds.data() + id;
ubyte *uds = m_uds.data() + id;
KeyFrame &KF = m_KFs[iKF];
const Depth::Prior zp(KF.m_d.u(), 1.0f / (BA_VARIANCE_PRIOR_FRAME_DEPTH + KF.m_d.s2()));
const int Nx = static_cast<int>(KF.m_xs.size());
for (int ix = 0; ix < Nx; ++ix) {
if (!(uds[ix] & udFlag2)) {
continue;
}
const ubyte ud = uds[ix];
uds[ix] &= ~udFlag1;
const int iST1 = KF.m_ix2ST[ix], iST2 = KF.m_ix2ST[ix + 1], Nst = iST2 - iST1;
const bool _ud = (ud & LBA_FLAG_TRACK_UPDATE_DEPTH) != 0;
if (_ud) {
{
Depth::Prior::Factor &A = KF.m_Apds[ix];
//dF = a.m_F;
zp.GetFactor<LBA_ME_FUNCTION>(BA_WEIGHT_PRIOR_DEPTH, ds[ix].u(), A);
dadd = A;
}
KF.m_Axps[ix].m_Sadd += dadd;
KF.m_Axs[ix].m_Sadd += dadd;
//dF = a.m_F - dF;
//m_F = dF + m_F;
m_ucsKF[iKF] |= LBA_FLAG_FRAME_UPDATE_TRACK_INFORMATION;
uds[ix] |= LBA_FLAG_TRACK_UPDATE_INFORMATION;
}
FTR::Factor::FixSource::Source::A &AST = KF.m_AxpsST[ix];
if (Nst == 0) {
AST = KF.m_Axps[ix];
KF.m_Nsts[ix] = Nst;
continue;
}
const bool pushST = pushFrm && (KF.m_usST[iST2 - 1] & LBA_FLAG_TRACK_PUSH);
if (_ud || (ud & LBA_FLAG_TRACK_UPDATE_INFORMATION_KF)) {
if (!_ud) {
daddST = AST.m_Sadd;
}
AST = KF.m_Axps[ix];
if (Nst > 1) {
AST *= 1.0f / Nst;
}
KF.m_Nsts[ix] = Nst;
if (_ud) {
for (int iST = iST1; iST < iST2; ++iST) {
KF.m_AxsST[iST].m_Sadd += AST.m_Sadd;
KF.m_usST[iST] |= LBA_FLAG_TRACK_UPDATE_INFORMATION;
}
if (pushST) {
for (int iST = iST2 - 1; iST >= iST1 && (KF.m_usST[iST] & LBA_FLAG_TRACK_PUSH); --iST) {
KF.m_usST[iST] &= ~LBA_FLAG_TRACK_PUSH;
}
}
} else {
if (pushST) {
int iST;
for (iST = iST2 - 1; iST >= iST1 && (KF.m_usST[iST] & LBA_FLAG_TRACK_PUSH); --iST) {
KF.m_AxsST[iST].m_Sadd += AST.m_Sadd;
KF.m_usST[iST] |= LBA_FLAG_TRACK_UPDATE_INFORMATION;
KF.m_usST[iST] &= ~LBA_FLAG_TRACK_PUSH;
}
FTR::Factor::DD::amb(AST.m_Sadd, daddST, daddST);
for (; iST >= iST1; --iST) {
KF.m_AxsST[iST].m_Sadd += daddST;
KF.m_usST[iST] |= LBA_FLAG_TRACK_UPDATE_INFORMATION;
}
} else {
FTR::Factor::DD::amb(AST.m_Sadd, daddST, daddST);
for (int iST = iST1; iST < iST2; ++iST) {
KF.m_AxsST[iST].m_Sadd += daddST;
KF.m_usST[iST] |= LBA_FLAG_TRACK_UPDATE_INFORMATION;
}
}
}
} else if (pushST || KF.m_Nsts[ix] != Nst) {
if (KF.m_Nsts[ix] == Nst) {
for (int iST = iST2 - 1; iST >= iST1 && (KF.m_usST[iST] & LBA_FLAG_TRACK_PUSH); --iST) {
KF.m_AxsST[iST].m_Sadd += AST.m_Sadd;
KF.m_usST[iST] |= LBA_FLAG_TRACK_UPDATE_INFORMATION;
KF.m_usST[iST] &= ~LBA_FLAG_TRACK_PUSH;
}
} else {
daddST = AST.m_Sadd;
AST = KF.m_Axps[ix];
if (Nst > 1) {
AST *= 1.0f / Nst;
}
KF.m_Nsts[ix] = Nst;
if (pushST) {
int iST;
for (iST = iST2 - 1; iST >= iST1 && (KF.m_usST[iST] & LBA_FLAG_TRACK_PUSH); --iST) {
KF.m_AxsST[iST].m_Sadd += AST.m_Sadd;
KF.m_usST[iST] |= LBA_FLAG_TRACK_UPDATE_INFORMATION;
KF.m_usST[iST] &= ~LBA_FLAG_TRACK_PUSH;
}
FTR::Factor::DD::amb(AST.m_Sadd, daddST, daddST);
for (; iST >= iST1; --iST) {
KF.m_AxsST[iST].m_Sadd += daddST;
KF.m_usST[iST] |= LBA_FLAG_TRACK_UPDATE_INFORMATION;
}
} else {
FTR::Factor::DD::amb(AST.m_Sadd, daddST, daddST);
for (int iST = iST1; iST < iST2; ++iST) {
KF.m_AxsST[iST].m_Sadd += daddST;
KF.m_usST[iST] |= LBA_FLAG_TRACK_UPDATE_INFORMATION;
}
}
}
m_ucsKF[iKF] |= LBA_FLAG_FRAME_UPDATE_TRACK_INFORMATION;
}
}
}
}
void LocalBundleAdjustor::UpdateFactorsPriorCameraMotion() {
const int iLF = m_ic2LF.front();
const ubyte ucm = m_ucmsLF[iLF];
if (!ucm) {
return;
}
const bool uc = (ucm & (LBA_FLAG_CAMERA_MOTION_UPDATE_ROTATION |
LBA_FLAG_CAMERA_MOTION_UPDATE_POSITION)) != 0;
CameraPrior::Motion::Factor::RR dArr;
CameraPrior::Motion::Factor::RM dArm;
CameraPrior::Motion::Factor::MM dAmm;
if (!uc) {
dArr = m_ApLF.m_Arr;
}
if (!ucm) {
dArm = m_ApLF.m_Arm;
dAmm = m_ApLF.m_Amm;
}
CameraPrior::Motion::Factor::Auxiliary U;
m_ZpLF.GetFactor(BA_WEIGHT_PRIOR_CAMERA_MOTION, m_CsLF[iLF], &m_ApLF, &U);
//m_ApLF.Print();
Camera::Factor::Unitary::CC &SAcc = m_SAcusLF[iLF];
Camera::Factor::Unitary &SAcm = m_SAcmsLF[iLF].m_Au;
if (uc) {
SAcc.Increase3(m_ApLF.m_Arr.m_A, m_ApLF.m_Arr.m_b);
} else {
CameraPrior::Motion::Factor::RR::AmB(m_ApLF.m_Arr, dArr, dArr);
SAcc.Increase3(dArr.m_A, dArr.m_b);
}
if (ucm) {
SAcm.m_Acm.Increase3(m_ApLF.m_Arm);
SAcm.m_Amm += m_ApLF.m_Amm;
} else {
CameraPrior::Motion::Factor::RM::AmB(m_ApLF.m_Arm, dArm, dArm);
CameraPrior::Motion::Factor::MM::AmB(m_ApLF.m_Amm, dAmm, dAmm);
SAcm.m_Acm.Increase3(dArm);
SAcm.m_Amm += dAmm;
}
}
void LocalBundleAdjustor::UpdateFactorsIMU() {
Camera::Factor::Unitary::CC dAcc1, dAcc2;
Camera::Factor::Unitary dAcm1, dAcm2;
IMU::Delta::Factor::Auxiliary::Global U;
//float dF;
const ubyte ucFlag = LBA_FLAG_CAMERA_MOTION_UPDATE_ROTATION |
LBA_FLAG_CAMERA_MOTION_UPDATE_POSITION;
const int nLFs = static_cast<int>(m_LFs.size());
for (int ic1 = 0, ic2 = 1; ic2 < nLFs; ic1 = ic2++) {
const int iLF1 = m_ic2LF[ic1], iLF2 = m_ic2LF[ic2];
const ubyte ucm1 = m_ucmsLF[iLF1], ucm2 = m_ucmsLF[iLF2];
if (!ucm1 && !ucm2) {
continue;
}
IMU::Delta::Factor &A = m_AdsLF[iLF2];
Camera::Factor &SAcm1 = m_SAcmsLF[iLF1], &SAcm2 = m_SAcmsLF[iLF2];
const bool uc1 = (ucm1 & ucFlag) != 0, uc2 = (ucm2 & ucFlag) != 0;
if (!uc1) {
dAcc1 = A.m_A11.m_Acc;
}
if (!ucm1) {
dAcm1.m_Acm = A.m_A11.m_Acm;
dAcm1.m_Amm = A.m_A11.m_Amm;
}
if (!uc2) {
dAcc2 = A.m_A22.m_Acc;
}
if (!ucm2) {
dAcm2.m_Acm = A.m_A22.m_Acm;
dAcm2.m_Amm = A.m_A22.m_Amm;
}
//dF = A.m_F;
m_DsLF[iLF2].GetFactor(BA_WEIGHT_IMU, m_CsLF[iLF1], m_CsLF[iLF2], m_K.m_pu,
&A, &SAcm2.m_Ab, &U, BA_ANGLE_EPSILON);
if (uc1) {
m_SAcusLF[iLF1] += A.m_A11.m_Acc;
} else {
Camera::Factor::Unitary::CC::AmB(A.m_A11.m_Acc, dAcc1, dAcc1);
m_SAcusLF[iLF1] += dAcc1;
}
if (ucm1) {
SAcm1.m_Au.m_Acm += A.m_A11.m_Acm;
SAcm1.m_Au.m_Amm += A.m_A11.m_Amm;
} else {
Camera::Factor::Unitary::CM::AmB(A.m_A11.m_Acm, dAcm1.m_Acm, dAcm1.m_Acm);
Camera::Factor::Unitary::MM::AmB(A.m_A11.m_Amm, dAcm1.m_Amm, dAcm1.m_Amm);
SAcm1.m_Au += dAcm1;
}
if (uc2) {
m_SAcusLF[iLF2] += A.m_A22.m_Acc;
} else {
Camera::Factor::Unitary::CC::AmB(A.m_A22.m_Acc, dAcc2, dAcc2);
m_SAcusLF[iLF2] += dAcc2;
}
if (ucm2) {
SAcm2.m_Au.m_Acm += A.m_A22.m_Acm;
SAcm2.m_Au.m_Amm += A.m_A22.m_Amm;
} else {
Camera::Factor::Unitary::CM::AmB(A.m_A22.m_Acm, dAcm2.m_Acm, dAcm2.m_Acm);
Camera::Factor::Unitary::MM::AmB(A.m_A22.m_Amm, dAcm2.m_Amm, dAcm2.m_Amm);
SAcm2.m_Au += dAcm2;
}
}
}
void LocalBundleAdjustor::UpdateFactorsFixOrigin() {
const int iLF = m_ic2LF[0];
if (m_LFs[iLF].m_T.m_iFrm != 0 || !(m_ucsLF[iLF] & LBA_FLAG_FRAME_UPDATE_CAMERA)) {
return;
}
m_Zo.GetFactor(m_CsLF[iLF].m_T, m_Ao, BA_ANGLE_EPSILON);
m_SAcusLF[iLF] += m_Ao.m_A;
}
void LocalBundleAdjustor::UpdateFactorsFixPositionZ() {
//float dF;
const Camera::Fix::PositionZ z(BA_WEIGHT_FIX_POSITION_Z, BA_VARIANCE_FIX_POSITION_Z);
const ubyte ucmFlag = LBA_FLAG_CAMERA_MOTION_UPDATE_ROTATION |
LBA_FLAG_CAMERA_MOTION_UPDATE_POSITION;
const int nLFs = static_cast<int>(m_LFs.size());
for (int iLF = 0; iLF < nLFs; ++iLF) {
const ubyte ucm = m_ucmsLF[iLF];
if (!(ucm & ucmFlag)) {
continue;
}
Camera::Fix::PositionZ::Factor &A = m_AfpsLF[iLF];
Camera::Factor::Unitary::CC &SA = m_SAcusLF[iLF];
if (ucm & LBA_FLAG_CAMERA_MOTION_UPDATE_POSITION) {
//dF = A.m_F;
z.GetFactor(m_CsLF[iLF].m_p.z(), A);
}
SA.m_A.m22() += z.m_w;
SA.m_b.v2() += A.m_b;
}
}
void LocalBundleAdjustor::UpdateFactorsFixMotion() {
//float dF;
const Camera::Fix::Zero zv[2] = {
Camera::Fix::Zero(BA_WEIGHT_FIX_MOTION, BA_VARIANCE_FIX_VELOCITY),
Camera::Fix::Zero(BA_WEIGHT_FIX_MOTION, BA_VARIANCE_FIX_VELOCITY_INITIAL)};
const Camera::Fix::Zero zba[2] = {
Camera::Fix::Zero(BA_WEIGHT_FIX_MOTION, BA_VARIANCE_FIX_BIAS_ACCELERATION),
Camera::Fix::Zero(BA_WEIGHT_FIX_MOTION, BA_VARIANCE_FIX_BIAS_ACCELERATION_INITIAL)};
const Camera::Fix::Zero zbw[2] = {
Camera::Fix::Zero(BA_WEIGHT_FIX_MOTION, BA_VARIANCE_FIX_BIAS_GYROSCOPE),
Camera::Fix::Zero(BA_WEIGHT_FIX_MOTION, BA_VARIANCE_FIX_BIAS_GYROSCOPE_INITIAL)};
const int nLFs = int(m_LFs.size());
for (int iLF = 0; iLF < nLFs; ++iLF) {
const ubyte ucm = m_ucmsLF[iLF];
if (!ucm) {
continue;
}
Camera::Fix::Motion::Factor &A = m_AfmsLF[iLF];
Camera::Factor::Unitary::MM &SA = m_SAcmsLF[iLF].m_Au.m_Amm;
const Camera &C = m_CsLF[iLF];
const int i = m_LFs[iLF].m_T.m_iFrm == 0 ? 1 : 0;
if (ucm & LBA_FLAG_CAMERA_MOTION_UPDATE_VELOCITY) {
//dF = A.m_Av.m_F;
zv[i].GetFactor(C.m_v, A.m_Av);
}
if (ucm & LBA_FLAG_CAMERA_MOTION_UPDATE_BIAS_ACCELERATION) {
//dF = A.m_Aba.m_F;
zba[i].GetFactor(C.m_ba, A.m_Aba);
}
if (ucm & LBA_FLAG_CAMERA_MOTION_UPDATE_BIAS_GYROSCOPE) {
zbw[i].GetFactor(C.m_bw, A.m_Abw);
}
SA.m_A.IncreaseDiagonal012(zv[i].w()); SA.m_b.Increase(0, A.m_Av.m_b);
SA.m_A.IncreaseDiagonal345(zba[i].w()); SA.m_b.Increase(3, A.m_Aba.m_b);
SA.m_A.IncreaseDiagonal678(zbw[i].w()); SA.m_b.Increase(6, A.m_Abw.m_b);
}
}
void LocalBundleAdjustor::UpdateSchurComplement() {
const int nLFs = static_cast<int>(m_LFs.size());
for (int iLF = 0; iLF < nLFs; ++iLF) {
LocalFrame &LF = m_LFs[iLF];
if (m_ucsLF[iLF] & LBA_FLAG_FRAME_UPDATE_CAMERA) {
m_SMcusLF[iLF].MakeZero();
LF.m_Zm.m_SMczms.MakeZero();
LF.m_SmddsST.MakeZero();
LF.m_Zm.m_SmddsST.MakeZero();
} else {
const int Nk = static_cast<int>(LF.m_iLFsMatch.size());
for (int ik = 0; ik < Nk; ++ik) {
if (!(m_ucsLF[LF.m_iLFsMatch[ik]] & LBA_FLAG_FRAME_UPDATE_CAMERA)) {
continue;
}
LF.m_Zm.m_SMczms[ik].MakeZero();
const int izm = LF.m_Zm.m_ik2zm[ik], Nzm = LF.m_Zm.m_ik2zm[ik + 1] - izm;
LF.m_Zm.m_SmddsST.MakeZero(izm, Nzm);
}
const int NZ = int(LF.m_Zs.size());
for (int iZ = 0; iZ < NZ; ++iZ) {
const FRM::Measurement &Z = LF.m_Zs[iZ];
if (!(m_ucsKF[Z.m_iKF] & LBA_FLAG_FRAME_UPDATE_DEPTH)) {
continue;
}
const ubyte *uds = m_uds.data() + m_iKF2d[Z.m_iKF];
for (int iz = Z.m_iz1; iz < Z.m_iz2; ++iz) {
if (uds[LF.m_zs[iz].m_ix] & LBA_FLAG_FRAME_UPDATE_DEPTH) {
LF.m_SmddsST[iz].MakeZero();
}
}
}
const int NI = int(LF.m_Zm.m_Is.size());
for (int iI = 0; iI < NI; ++iI) {
const MeasurementMatchLF::Index &I = LF.m_Zm.m_Is[iI];
if (!(m_ucsKF[I.m_iKF] & LBA_FLAG_FRAME_UPDATE_DEPTH) ||
(m_ucsLF[LF.m_iLFsMatch[I.m_ik]] & LBA_FLAG_FRAME_UPDATE_CAMERA)) {
continue;
}
const ubyte *uds = m_uds.data() + m_iKF2d[I.m_iKF];
const int i1 = LF.m_Zm.m_iI2zm[iI], i2 = LF.m_Zm.m_iI2zm[iI + 1];
for (int i = i1; i < i2; ++i) {
if (uds[LF.m_zs[LF.m_Zm.m_izms[i].m_iz1].m_ix] & LBA_FLAG_FRAME_UPDATE_DEPTH) {
LF.m_Zm.m_SmddsST[i] = 0.0f;
}
}
}
}
}
int Nd = 0, NdST = 0;
const int nKFs = int(m_KFs.size());
m_idxsTmp1.assign(nKFs + nKFs, -1);
int *iKF2X = m_idxsTmp1.data(), *iKF2XST = m_idxsTmp1.data() + nKFs;
std::vector<int> &iX2d = m_idxsTmp2, &iXST2dST = m_idxsTmp3;
iX2d.resize(0);
iXST2dST.resize(0);
const float eps = FLT_EPSILON;
const float epsd = UT::Inverse(BA_VARIANCE_MAX_DEPTH, BA_WEIGHT_FEATURE, eps);
const float epsdST = UT::Inverse(BA_VARIANCE_MAX_DEPTH_SLIDING_TRACK, BA_WEIGHT_FEATURE, eps);
for (int iKF = 0; iKF < nKFs; ++iKF) {
if (!(m_ucsKF[iKF] & LBA_FLAG_FRAME_UPDATE_TRACK_INFORMATION)) {
continue;
}
const ubyte *uds = m_uds.data() + m_iKF2d[iKF];
const int iX = static_cast<int>(iX2d.size()), iXST = static_cast<int>(iXST2dST.size());
KeyFrame &KF = m_KFs[iKF];
const int Nx = static_cast<int>(KF.m_xs.size());
iKF2X[iKF] = iX; iKF2XST[iKF] = iXST;
iX2d.resize(iX + Nx, -1); iXST2dST.resize(iXST + static_cast<int>(KF.m_STs.size()), -1);
int *ix2d = iX2d.data() + iX, *ixST2dST = iXST2dST.data() + iXST;
for (int ix = 0; ix < Nx; ++ix) {
if (uds[ix] & LBA_FLAG_TRACK_UPDATE_INFORMATION) {
if (KF.m_Axs[ix].m_Sadd.m_a > epsd) {
ix2d[ix] = Nd++;
} else if (!(uds[ix] & LBA_FLAG_TRACK_UPDATE_INFORMATION_ZERO)) {
ix2d[ix] = -2;
}
}
const int iST1 = KF.m_ix2ST[ix], iST2 = KF.m_ix2ST[ix + 1];
if (iST2 == iST1) {
continue;
}
ubyte update = LBA_FLAG_MARGINALIZATION_DEFAULT, nonZero = LBA_FLAG_MARGINALIZATION_DEFAULT;
for (int iST = iST1; iST < iST2; ++iST) {
if (KF.m_usST[iST] & LBA_FLAG_TRACK_UPDATE_INFORMATION) {
if (KF.m_AxsST[iST].m_Sadd.m_a > epsdST) {
ixST2dST[iST] = NdST++;
update = LBA_FLAG_MARGINALIZATION_UPDATE;
nonZero = LBA_FLAG_MARGINALIZATION_NON_ZERO;
} else if (!(KF.m_usST[iST] & LBA_FLAG_TRACK_UPDATE_INFORMATION_ZERO)) {
ixST2dST[iST] = -2;
update = LBA_FLAG_MARGINALIZATION_UPDATE;
}
} else {
if (!(KF.m_usST[iST] & LBA_FLAG_TRACK_UPDATE_INFORMATION_ZERO)) {
nonZero = LBA_FLAG_MARGINALIZATION_NON_ZERO;
}
}
}
KF.m_ms[ix] |= update;
if (nonZero) {
KF.m_ms[ix] |= LBA_FLAG_MARGINALIZATION_NON_ZERO;
} else {
KF.m_ms[ix] &= ~LBA_FLAG_MARGINALIZATION_NON_ZERO;
}
}
}
const int N = Nd + NdST, NC = SIMD_FLOAT_CEIL(N);
m_work.Resize(NC + NC + Nd * sizeof(xp128f) / sizeof(float));
float *mdds = m_work.Data(), *mddsST = mdds + Nd;
float *nds = m_work.Data() + NC, *ndsST = nds + Nd;
xp128f *_mdds = (xp128f *) (m_work.Data() + NC + NC);
for (int iKF = 0; iKF < nKFs; ++iKF) {
const int iX = iKF2X[iKF];
if (iX == -1) {
continue;
}
const KeyFrame &KF = m_KFs[iKF];
const int *ix2d = iX2d.data() + iX;
const int Nx = int(KF.m_xs.size());
for (int ix = 0; ix < Nx; ++ix) {
const int id = ix2d[ix];
if (id < 0) {
continue;
}
const FTR::Factor::DD &Sadd = KF.m_Axs[ix].m_Sadd;
mdds[id] = Sadd.m_a;
nds[id] = Sadd.m_b;
}
const int *ixST2dST = iXST2dST.data() + iKF2XST[iKF];
const int NST = int(KF.m_STs.size());
for (int iST = 0; iST < NST; ++iST) {
const int idST = ixST2dST[iST];
if (idST < 0) {
continue;
}
const FTR::Factor::DD &SaddST = KF.m_AxsST[iST].m_Sadd;
mddsST[idST] = SaddST.m_a;
ndsST[idST] = SaddST.m_b;
}
}
//SIMD::Add(N, UT::Inverse(BA_VARIANCE_REGULARIZATION_DEPTH, BA_WEIGHT_FEATURE), mdds);
SIMD::Inverse(N, mdds);
SIMD::Multiply(N, mdds, nds);
for (int id = 0; id < Nd; ++id) {
_mdds[id].vdup_all_lane(mdds[id]);
}
m_MxsTmp.Resize(NdST);
for (int iKF = 0; iKF < nKFs; ++iKF) {
const int iX = iKF2X[iKF];
if (iX == -1) {
continue;
}
const int iXST = iKF2XST[iKF];
const int *ix2d = iX2d.data() + iX, *ixST2dST = iXST2dST.data() + iXST;
const ubyte *uds = m_uds.data() + m_iKF2d[iKF];
KeyFrame &KF = m_KFs[iKF];
const int Nx = static_cast<int>(KF.m_xs.size());
for (int ix = 0; ix < Nx; ++ix) {
const int id = ix2d[ix];
FTR::Factor::FixSource::Source::M &Mx = KF.m_Mxs[ix];
if (id >= 0) {
Mx.m_mdd.Set(mdds[id], nds[id]);
}
if (KF.m_Nsts[ix] == 0 || !(KF.m_ms[ix] & LBA_FLAG_MARGINALIZATION_UPDATE)) {
continue;
}
const ubyte ud = uds[ix] & LBA_FLAG_TRACK_UPDATE_DEPTH;
const int iST1 = KF.m_ix2ST[ix], iST2 = KF.m_ix2ST[ix + 1];
for (int iST = iST1; iST < iST2; ++iST) {
const int idST = ixST2dST[iST];
if (idST == -1) {
continue;
}
FTR::Factor::FixSource::Source::M &MxST = KF.m_MxsST[iST];
if (idST >= 0) {
FTR::Factor::DD &dmddST = m_MxsTmp[idST].m_mdd;
if (ud || (KF.m_usST[iST] & LBA_FLAG_TRACK_UPDATE_INFORMATION_ZERO)) {
MxST.m_mdd.Set(mddsST[idST], ndsST[idST]);
dmddST = MxST.m_mdd;
} else {
dmddST = MxST.m_mdd;
MxST.m_mdd.Set(mddsST[idST], ndsST[idST]);
FTR::Factor::DD::amb(MxST.m_mdd, dmddST, dmddST);
}
} else {
if (!ud) {
MxST.m_mdd.MakeMinus();
}
}
}
}
}
LA::ProductVector6f SmdczST;
Camera::Factor::Unitary::CC dMczz;
Camera::Factor::Binary::CC dMczm;
for (int iLF = 0; iLF < nLFs; ++iLF) {
LocalFrame &LF = m_LFs[iLF];
Camera::Factor::Unitary::CC &SMczz = m_SMcusLF[iLF];
const bool ucz = (m_ucsLF[iLF] & LBA_FLAG_FRAME_UPDATE_CAMERA) != 0;
const int NZ = int(LF.m_Zs.size());
for (int iZ = 0; iZ < NZ; ++iZ) {
const FRM::Measurement &Z = LF.m_Zs[iZ];
const int iKF = Z.m_iKF, iX = iKF2X[iKF];
if (iX == -1) {
continue;
}
const int *ix2d = iX2d.data() + iKF2X[iKF];
const int *ixST2dST = iXST2dST.data() + iKF2XST[iKF];
const ubyte *uds = m_uds.data() + m_iKF2d[iKF];
//const bool ucx = (m_ucsKF[iKF] & LBA_FLAG_FRAME_UPDATE_CAMERA) != 0, ucr = ucx || ucz;
const KeyFrame &KF = m_KFs[iKF];
for (int iz = Z.m_iz1; iz < Z.m_iz2; ++iz) {
const int ix = LF.m_zs[iz].m_ix, id = ix2d[ix];
if (id >= 0) {
FTR::Factor::FixSource::Marginalize(_mdds[id], LF.m_Azs1[iz], &LF.m_Mzs1[iz]);
}
if (!(KF.m_ms[ix] & LBA_FLAG_MARGINALIZATION_UPDATE)) {
continue;
}
FTR::Factor::DD &SmddST = LF.m_SmddsST[iz];
const ubyte nonZero1 = (LF.m_ms[iz] & LBA_FLAG_MARGINALIZATION_NON_ZERO);
if (KF.m_ms[ix] & LBA_FLAG_MARGINALIZATION_NON_ZERO) {
const LocalFrame::SlidingTrack &ST = LF.m_STs[iz];
const int iST0 = KF.m_ix2ST[ix], iST1 = iST0 + ST.m_ist1, iST2 = iST0 + ST.m_ist2;
ubyte update = LBA_FLAG_MARGINALIZATION_DEFAULT;
ubyte nonZero2 = LBA_FLAG_MARGINALIZATION_DEFAULT;
for (int iST = iST1; iST < iST2; ++iST) {
const int idST = ixST2dST[iST];
if (idST >= 0) {
if (ucz) {
SmddST += KF.m_MxsST[iST].m_mdd;
} else {
SmddST += m_MxsTmp[idST].m_mdd;
}
update = LBA_FLAG_MARGINALIZATION_UPDATE;
nonZero2 = LBA_FLAG_MARGINALIZATION_NON_ZERO;
} else if (idST == -1) {
if (!(KF.m_usST[iST] & LBA_FLAG_TRACK_UPDATE_INFORMATION_ZERO)) {
if (ucz) {
SmddST += KF.m_MxsST[iST].m_mdd;
}
nonZero2 = LBA_FLAG_MARGINALIZATION_NON_ZERO;
}
} else {
if (!ucz && !(uds[ix] & LBA_FLAG_TRACK_UPDATE_DEPTH)) {
SmddST += KF.m_MxsST[iST].m_mdd;
}
update = LBA_FLAG_MARGINALIZATION_UPDATE;
}
}
LF.m_ms[iz] |= update;
if (LF.m_ms[iz] & LBA_FLAG_MARGINALIZATION_UPDATE) {
if (nonZero2) {
if (!nonZero1) {
LF.m_ms[iz] |= LBA_FLAG_MARGINALIZATION_NON_ZERO;
}
if (LF.m_Nsts[iz] == 1) {
SmddST = KF.m_MxsST[iST1].m_mdd;
}
} else {
if (nonZero1) {
LF.m_ms[iz] &= ~LBA_FLAG_MARGINALIZATION_NON_ZERO;
SmddST.MakeZero();
}
}
}
} else if (nonZero1) {
LF.m_ms[iz] |= LBA_FLAG_MARGINALIZATION_UPDATE;
LF.m_ms[iz] &= ~LBA_FLAG_MARGINALIZATION_NON_ZERO;
SmddST.MakeZero();
}
if (!(LF.m_ms[iz] & LBA_FLAG_MARGINALIZATION_UPDATE)) {
continue;
}
FTR::Factor::FixSource::M2 &M = LF.m_Mzs2[iz];
if (LF.m_ms[iz] & LBA_FLAG_MARGINALIZATION_NON_ZERO) {
if (!ucz && nonZero1) {
dMczz = M.m_Mczz;
FTR::Factor::FixSource::Marginalize(SmddST, LF.m_AzsST[iz].m_adcA, &SmdczST, &M);
Camera::Factor::Unitary::CC::AmB(M.m_Mczz, dMczz, dMczz);
SMczz += dMczz;
} else {
FTR::Factor::FixSource::Marginalize(SmddST, LF.m_AzsST[iz].m_adcA, &SmdczST, &M);
SMczz += M.m_Mczz;
}
} else {
if (!ucz && nonZero1) {
M.m_Mczz.GetMinus(dMczz);
SMczz += dMczz;
}
}
}
}
const int NI = int(LF.m_Zm.m_Is.size());
for (int iI = 0; iI < NI; ++iI) {
const MeasurementMatchLF::Index &I = LF.m_Zm.m_Is[iI];
const int iXST = iKF2XST[I.m_iKF];
if (iXST == -1) {
continue;
}
const int *ixST2dST = iXST2dST.data() + iXST;
const ubyte *uds = m_uds.data() + m_iKF2d[I.m_iKF];
Camera::Factor::Binary::CC &SMczm = LF.m_Zm.m_SMczms[I.m_ik];
const int _iLF = LF.m_iLFsMatch[I.m_ik];
const LocalFrame &_LF = m_LFs[_iLF];
const bool _ucz = (m_ucsLF[_iLF] & LBA_FLAG_FRAME_UPDATE_CAMERA) != 0, uczm = ucz || _ucz;
const KeyFrame &KF = m_KFs[I.m_iKF];
const int i1 = LF.m_Zm.m_iI2zm[iI], i2 = LF.m_Zm.m_iI2zm[iI + 1];
for (int i = i1; i < i2; ++i) {
const FTR::Measurement::Match &izm = LF.m_Zm.m_izms[i];
if (!(LF.m_ms[izm.m_iz1] & LBA_FLAG_MARGINALIZATION_UPDATE)) {
continue;
}
float &SmddST = LF.m_Zm.m_SmddsST[i];
const ubyte nonZero1 = (LF.m_Zm.m_ms[i] & LBA_FLAG_MARGINALIZATION_NON_ZERO);
if (LF.m_ms[izm.m_iz1] & LBA_FLAG_MARGINALIZATION_NON_ZERO) {
const int ix = LF.m_zs[izm.m_iz1].m_ix, iST0 = KF.m_ix2ST[ix];
const int iST1 = iST0 + _LF.m_STs[izm.m_iz2].m_ist1;
const int iST2 = iST0 + LF.m_STs[izm.m_iz1].m_ist2;
ubyte update = LBA_FLAG_MARGINALIZATION_DEFAULT;
ubyte nonZero2 = LBA_FLAG_MARGINALIZATION_DEFAULT;
for (int iST = iST1; iST < iST2; ++iST) {
const int idST = ixST2dST[iST];
if (idST >= 0) {
if (uczm) {
SmddST += KF.m_MxsST[iST].m_mdd.m_a;
} else {
SmddST += m_MxsTmp[idST].m_mdd.m_a;
}
update = LBA_FLAG_MARGINALIZATION_UPDATE;
nonZero2 = LBA_FLAG_MARGINALIZATION_NON_ZERO;
} else if (idST == -1) {
if (!(KF.m_usST[iST] & LBA_FLAG_TRACK_UPDATE_INFORMATION_ZERO)) {
if (uczm) {
SmddST += KF.m_MxsST[iST].m_mdd.m_a;
}
nonZero2 = LBA_FLAG_MARGINALIZATION_NON_ZERO;
}
} else {
if (!uczm && !(uds[ix] & LBA_FLAG_TRACK_UPDATE_DEPTH)) {
SmddST += KF.m_MxsST[iST].m_mdd.m_a;
}
update = LBA_FLAG_MARGINALIZATION_UPDATE;
}
}
LF.m_Zm.m_ms[i] |= update;
if (LF.m_Zm.m_ms[i] & LBA_FLAG_MARGINALIZATION_UPDATE) {
if (nonZero2) {
if (!nonZero1) {
LF.m_Zm.m_ms[i] |= LBA_FLAG_MARGINALIZATION_NON_ZERO;
}
if (iST2 - iST1 == 1) {
SmddST = KF.m_MxsST[iST1].m_mdd.m_a;
}
} else {
if (nonZero1) {
LF.m_Zm.m_ms[i] &= ~LBA_FLAG_MARGINALIZATION_NON_ZERO;
SmddST = 0.0f;
}
}
}
} else if (nonZero1) {
LF.m_Zm.m_ms[i] |= LBA_FLAG_MARGINALIZATION_UPDATE;
LF.m_Zm.m_ms[i] &= ~LBA_FLAG_MARGINALIZATION_NON_ZERO;
SmddST = 0.0f;
}
if (!(LF.m_Zm.m_ms[i] & LBA_FLAG_MARGINALIZATION_UPDATE)) {
continue;
}
Camera::Factor::Binary::CC &Mczm = LF.m_Zm.m_Mczms[i];
if (LF.m_Zm.m_ms[i] & LBA_FLAG_MARGINALIZATION_NON_ZERO) {
if (!uczm && nonZero1) {
dMczm = Mczm;
FTR::Factor::FixSource::Marginalize(SmddST, LF.m_AzsST[izm.m_iz1],
_LF.m_AzsST[izm.m_iz2], &SmdczST, &Mczm);
Camera::Factor::Binary::CC::AmB(Mczm, dMczm, dMczm);
SMczm += dMczm;
} else {
FTR::Factor::FixSource::Marginalize(SmddST, LF.m_AzsST[izm.m_iz1],
_LF.m_AzsST[izm.m_iz2], &SmdczST, &Mczm);
SMczm += Mczm;
}
} else {
if (!uczm && nonZero1) {
Mczm.GetMinus(dMczm);
SMczm += dMczm;
}
}
}
}
}
for (int iKF = 0; iKF < nKFs; ++iKF) {
const int iX = iKF2X[iKF];
if (iX == -1) {
continue;
}
ubyte *uds = m_uds.data() + m_iKF2d[iKF];
const int *ix2d = iX2d.data() + iX;
KeyFrame &KF = m_KFs[iKF];
const int Nx = static_cast<int>(KF.m_xs.size());
for (int ix = 0; ix < Nx; ++ix) {
if (ix2d[ix] >= 0) {
uds[ix] &= ~LBA_FLAG_TRACK_UPDATE_INFORMATION_ZERO;
} else if (ix2d[ix] == -2) {
uds[ix] |= LBA_FLAG_TRACK_UPDATE_INFORMATION_ZERO;
}
KF.m_ms[ix] &= ~LBA_FLAG_MARGINALIZATION_UPDATE;
}
const int *ixST2dST = iXST2dST.data() + iKF2XST[iKF];
const int NST = static_cast<int>(KF.m_STs.size());
for (int iST = 0; iST < NST; ++iST) {
if (ixST2dST[iST] >= 0) {
KF.m_usST[iST] &= ~LBA_FLAG_TRACK_UPDATE_INFORMATION_ZERO;
} else if (ixST2dST[iST] == -2) {
KF.m_usST[iST] |= LBA_FLAG_TRACK_UPDATE_INFORMATION_ZERO;
}
}
}
for (int iLF = 0; iLF < nLFs; ++iLF) {
LocalFrame &LF = m_LFs[iLF];
const int NZ = int(LF.m_Zs.size());
for (int iZ = 0; iZ < NZ; ++iZ) {
const FRM::Measurement &Z = LF.m_Zs[iZ];
if (iKF2X[Z.m_iKF] == -1) {
continue;
}
for (int iz = Z.m_iz1; iz < Z.m_iz2; ++iz) {
LF.m_ms[iz] &= ~LBA_FLAG_MARGINALIZATION_UPDATE;
}
}
const int Nzm = int(LF.m_Zm.m_ms.size());
for (int i = 0; i < Nzm; ++i) {
LF.m_Zm.m_ms[i] &= ~LBA_FLAG_MARGINALIZATION_UPDATE;
}
}
}
bool LocalBundleAdjustor::SolveSchurComplement() {
if (LBA_PROPAGATE_CAMERA >= 2 && m_iIter == 0 && SolveSchurComplementLast()) {
return true;
}
bool scc = SolveSchurComplementPCG();
if (LBA_EMBEDDED_MOTION_ITERATION) {
EmbeddedMotionIteration();
}
if (!scc) {
return false;
}
return true;
}
bool LocalBundleAdjustor::SolveSchurComplementPCG() {
Camera::Factor::Unitary::CC Acc;
const int pc = 6, pm = 9;
const int pcm = pc + pm;
const int Nc = int(m_LFs.size()), Ncp = Nc * pc, Nmp = Nc * pm, N = Ncp + Nmp;
m_Acus.Resize(Nc);
m_Amus.Resize(Nc);
m_bs.Resize(N);
float *bc = m_bs.Data(), *bm = bc + Ncp;
const int Nb = CountSchurComplementsOffDiagonal();
m_Acbs.Resize(Nb);
m_ic2b.resize(Nc);
const float ar = UT::Inverse(BA_VARIANCE_REGULARIZATION_ROTATION, BA_WEIGHT_FEATURE);
const float ap = UT::Inverse(BA_VARIANCE_REGULARIZATION_POSITION, BA_WEIGHT_FEATURE);
const float av = UT::Inverse(BA_VARIANCE_REGULARIZATION_VELOCITY, BA_WEIGHT_FEATURE);
const float aba = UT::Inverse(BA_VARIANCE_REGULARIZATION_BIAS_ACCELERATION, BA_WEIGHT_FEATURE);
const float abw = UT::Inverse(BA_VARIANCE_REGULARIZATION_BIAS_GYROSCOPE, BA_WEIGHT_FEATURE);
for (int ic = 0, ib = 0; ic < Nc; ++ic, bc += pc, bm += pm) {
m_ic2b[ic] = ib;
const int iLF = m_ic2LF[ic];
const LocalFrame &LF = m_LFs[iLF];
Camera::Factor::Unitary::CC::AmB(m_SAcusLF[iLF], m_SMcusLF[iLF], Acc);
Acc.m_A.IncreaseDiagonal(ap, ar);
Acc.m_A.GetAlignedMatrix6x6f(m_Acus[ic]);
Acc.m_b.Get(bc);
const Camera::Factor::Unitary::MM &Amm = m_SAcmsLF[iLF].m_Au.m_Amm;
m_Amus[ic].Set(Amm.m_A);
m_Amus[ic].IncreaseDiagonal(av, aba, abw);
Amm.m_b.Get(bm);
const int _ic = ic + 1;
if (_ic == Nc) {
continue;
}
LA::AlignedMatrix6x6f *Acbs = m_Acbs.Data() + ib;
const int _iLF = m_ic2LF[_ic];
const Camera::Factor::Binary &SAcmb = m_SAcmsLF[_iLF].m_Ab;
LA::AlignedMatrix6x6f::AmB(SAcmb.m_Acc, LF.m_Zm.m_SMczms[0], Acbs[0]);
const int Nk = static_cast<int>(LF.m_iLFsMatch.size());
for (int ik = 1; ik < Nk; ++ik) {
LF.m_Zm.m_SMczms[ik].GetMinus(Acbs[ik]);
}
ib += Nk;
}
m_AcbTs.Resize(Nb);
for (int ib = 0; ib < Nb; ++ib) {
m_Acbs[ib].GetTranspose(m_AcbTs[ib]);
}
PrepareConditioner();
m_xs.Resize(N);
m_rs.Resize(N);
m_ps.Resize(N);
m_zs.Resize(N);
m_drs.Resize(N);
m_dxs.Resize(N);
bool scc = true;
float Se2, Se2Pre, Se2Min, e2Max, e2MaxMin, alpha, beta;
m_rs = m_bs;
#ifdef CFG_INCREMENTAL_PCG
LA::Vector6f *xcs = (LA::Vector6f *) m_xs.Data();
LA::Vector9f *xms = (LA::Vector9f *) (xcs + Nc);
for (int ic = 0; ic < Nc; ++ic) {
const int iLF = m_ic2LF[ic];
xcs[ic] = m_xcsLF[iLF];
xms[ic] = m_xmsLF[iLF];
}
m_xs.MakeMinus();
m_xsGN = m_xs;
ApplyA(m_xs, &m_drs);
m_rs -= m_drs;
#else
m_xsGN.Resize(N);
m_xsGN.MakeZero();
#endif
ApplyM(m_rs, &m_ps);
ConvertCameraMotionResiduals(m_rs, m_ps, &Se2, &e2Max);
ApplyA(m_ps, &m_drs);
alpha = Se2 / m_ps.Dot(m_drs);
#ifdef _MSC_VER
if (_finite(alpha)) {
#else
if (std::isfinite(alpha)) {
#endif // _MSC_VER
const float e2MaxConv[2] = {ME::ChiSquareDistance<3>(BA_PCG_MIN_CONVERGE_PROBABILITY,
BA_WEIGHT_FEATURE),
ME::ChiSquareDistance<3>(BA_PCG_MAX_CONVERGE_PROBABILITY,
BA_WEIGHT_FEATURE)};
Se2Min = Se2;
e2MaxMin = e2Max;
m_drs *= alpha;
m_rs -= m_drs;
#ifdef CFG_INCREMENTAL_PCG
m_ps.GetScaled(alpha, m_dxs);
m_xs += m_dxs;
#else
m_ps.GetScaled(alpha, m_xs);
#endif
#ifdef CFG_INCREMENTAL_PCG
ApplyM(m_bs, &m_drs);
Se2Pre = m_bs.Dot(m_drs);
const float Se2ConvMin = Se2Pre * BA_PCG_MIN_CONVERGE_RESIDUAL_RATIO;
const float Se2ConvMax = Se2Pre * BA_PCG_MAX_CONVERGE_RESIDUAL_RATIO;
#else
const float Se2ConvMin = Se2 * BA_PCG_MIN_CONVERGE_RESIDUAL_RATIO;
const float Se2ConvMax = Se2 * BA_PCG_MAX_CONVERGE_RESIDUAL_RATIO;
#endif
int cnt = 0;
const int nIters = std::min(N, BA_PCG_MAX_ITERATIONS);
for (m_iIterPCG = 0; m_iIterPCG < nIters; ++m_iIterPCG) {
ApplyM(m_rs, &m_zs);
Se2Pre = Se2;
ConvertCameraMotionResiduals(m_rs, m_zs, &Se2, &e2Max);
if (Se2 < Se2Min) {
Se2Min = Se2;
e2MaxMin = e2Max;
m_xsGN = m_xs;
//cnt = 0;
} else {
++cnt;
}
const int i = (Se2Min <= Se2ConvMin && m_iIterPCG >= BA_PCG_MIN_ITERATIONS) ? 0 : 1;
if (Se2 == 0.0f || e2MaxMin < e2MaxConv[i]) {
scc = true;
break;
} else if (Se2Min > Se2ConvMax) {
scc = false;
break;
}
beta = Se2 / Se2Pre;
m_ps *= beta;
m_ps += m_zs;
ApplyA(m_ps, &m_drs);
alpha = Se2 / m_ps.Dot(m_drs);
#ifdef _MSC_VER
if (!_finite(alpha)) {
#else
if (!std::isfinite(alpha)) {
#endif // _MSC_VER
scc = false;
break;
}
m_drs *= alpha;
m_rs -= m_drs;
m_ps.GetScaled(alpha, m_dxs);
m_xs += m_dxs;
}
} else {
m_iIterPCG = 0;
}
m_xsGN.MakeMinus();
ConvertCameraUpdates(m_xsGN.Data(), &m_xp2s, &m_xr2s);
ConvertMotionUpdates(m_xsGN.Data() + Ncp, &m_xv2s, &m_xba2s, &m_xbw2s);
return scc;
}
bool LocalBundleAdjustor::SolveSchurComplementLast() {
const int Nc = static_cast<int>(m_LFs.size());
if (Nc < 3) {
return false;
}
const int pc = 6, pm = 9;
const int pcm = pc + pm/*, pmcm = pm + pcm*/;
const float eps = FLT_EPSILON;
const float epsr = UT::Inverse(BA_VARIANCE_MAX_ROTATION, BA_WEIGHT_FEATURE, eps);
const float epsp = UT::Inverse(BA_VARIANCE_MAX_POSITION, BA_WEIGHT_FEATURE, eps);
const float epsv = UT::Inverse(BA_VARIANCE_MAX_VELOCITY, BA_WEIGHT_FEATURE, eps);
const float epsba = UT::Inverse(BA_VARIANCE_MAX_BIAS_ACCELERATION, BA_WEIGHT_FEATURE, eps);
const float epsbw = UT::Inverse(BA_VARIANCE_MAX_BIAS_GYROSCOPE, BA_WEIGHT_FEATURE, eps);
const float _eps[pcm] = {epsp, epsp, epsp, epsr, epsr, epsr,
epsv, epsv, epsv, epsba, epsba, epsba, epsbw, epsbw, epsbw};
const float ar = UT::Inverse(BA_VARIANCE_REGULARIZATION_ROTATION, BA_WEIGHT_FEATURE);
const float ap = UT::Inverse(BA_VARIANCE_REGULARIZATION_POSITION, BA_WEIGHT_FEATURE);
const float av = UT::Inverse(BA_VARIANCE_REGULARIZATION_VELOCITY, BA_WEIGHT_FEATURE);
const float aba = UT::Inverse(BA_VARIANCE_REGULARIZATION_BIAS_ACCELERATION, BA_WEIGHT_FEATURE);
const float abw = UT::Inverse(BA_VARIANCE_REGULARIZATION_BIAS_GYROSCOPE, BA_WEIGHT_FEATURE);
LA::AlignedMatrixXf A;
LA::AlignedVectorXf b;
m_work.Resize(A.BindSize(pcm, pcm) + b.BindSize(pcm));
A.Bind(m_work.Data(), pcm, pcm);
b.Bind(A.BindNext(), pcm);
Camera::Factor::Unitary::CC Acc;
LA::AlignedMatrix9x9f Amm;
const int ic2 = Nc - 1, iLF2 = m_ic2LF[ic2];
Camera::Factor::Unitary::CC::AmB(m_SAcusLF[iLF2], m_SMcusLF[iLF2], Acc);
Acc.m_A.IncreaseDiagonal(ap, ar);
A.SetBlockDiagonal(0, Acc.m_A);
const Camera::Factor &Acm2 = m_SAcmsLF[iLF2];
A.SetBlock(0, pc, Acm2.m_Au.m_Acm);
b.SetBlock(0, Acc.m_b);
Amm.Set(Acm2.m_Au.m_Amm.m_A);
Amm.IncreaseDiagonal(av, aba, abw);
A.SetBlock(pc, pc, Amm);
b.SetBlock(pc, Acm2.m_Au.m_Amm.m_b);
A.SetLowerFromUpper();
if (!A.SolveLDL(b, _eps)) {
return false;
}
b.MakeMinus();
LA::AlignedVector3f x;
const int N = Nc * pcm;
m_xsGN.Resize(N); m_xsGN.MakeZero();
m_xp2s.Resize(Nc); m_xp2s.MakeZero();
m_xr2s.Resize(Nc); m_xr2s.MakeZero();
m_xv2s.Resize(Nc); m_xv2s.MakeZero();
m_xba2s.Resize(Nc); m_xba2s.MakeZero();
m_xbw2s.Resize(Nc); m_xbw2s.MakeZero();
float *xc2 = m_xsGN.Data() + ic2 * pc;
float *xm2 = m_xsGN.End() - pm;
b.GetBlock(0, x); x.Get(xc2); m_xp2s[ic2] = x.SquaredLength();
b.GetBlock(3, x); x.Get(xc2 + 3); m_xr2s[ic2] = x.SquaredLength();
b.GetBlock(6, x); x.Get(xm2); m_xv2s[ic2] = x.SquaredLength();
b.GetBlock(9, x); x.Get(xm2 + 3); m_xba2s[ic2] = x.SquaredLength();
b.GetBlock(12, x); x.Get(xm2 + 6); m_xbw2s[ic2] = x.SquaredLength();
return true;
}
void LocalBundleAdjustor::PrepareConditioner() {
const int pc = 6, pm = 9;
//const float eps = 0.0f;
const float eps = FLT_EPSILON;
const float epsr = UT::Inverse(BA_VARIANCE_MAX_ROTATION, BA_WEIGHT_FEATURE, eps);
const float epsp = UT::Inverse(BA_VARIANCE_MAX_POSITION, BA_WEIGHT_FEATURE, eps);
const float epsv = UT::Inverse(BA_VARIANCE_MAX_VELOCITY, BA_WEIGHT_FEATURE, eps);
const float epsba = UT::Inverse(BA_VARIANCE_MAX_BIAS_ACCELERATION, BA_WEIGHT_FEATURE, eps);
const float epsbw = UT::Inverse(BA_VARIANCE_MAX_BIAS_GYROSCOPE, BA_WEIGHT_FEATURE, eps);
const float epsc[pc] = {epsp, epsp, epsp, epsr, epsr, epsr};
const float epsm[pm] = {epsv, epsv, epsv, epsba, epsba, epsba, epsbw, epsbw, epsbw};
const int Nb = std::min(LBA_PCG_CONDITIONER_BAND, LBA_MAX_SLIDING_TRACK_LENGTH);
const int Nc = static_cast<int>(m_LFs.size());
if (Nb <= 1) {
m_Mcs.Resize(Nc);
m_Mms.Resize(Nc);
for (int ic = 0; ic < Nc; ++ic) {
const int iLF = m_ic2LF[ic];
m_Mcs[ic].Set(m_SAcusLF[iLF], BA_PCG_CONDITIONER_MAX, BA_PCG_CONDITIONER_EPSILON, epsc);
//m_Mcs[ic].Set(m_Acus[ic], BA_PCG_CONDITIONER_MAX, BA_PCG_CONDITIONER_EPSILON, epsc);
m_Mms[ic].Set(m_Amus[ic], BA_PCG_CONDITIONER_MAX, BA_PCG_CONDITIONER_EPSILON, epsm);
}
return;
}
m_Mcc.Resize(Nc, Nb); m_MccT.Resize(Nc, Nb);
m_Mcm.Resize(Nc, 2); m_McmT.Resize(Nc, 2);
m_Mmc.Resize(Nc, Nb - 1); m_MmcT.Resize(Nc, Nb - 1);
m_Mmm.Resize(Nc, 2); m_MmmT.Resize(Nc, 2);
for (int ic = 0; ic < Nc; ++ic) {
LA::AlignedMatrix6x6f *Accs = m_Mcc[ic];
Accs[0] = m_Acus[ic];
const LA::AlignedMatrix6x6f *Acbs = m_Acbs.Data() + m_ic2b[ic] - 1;
const int Nbc = ic + Nb > Nc ? Nc - ic : Nb;
for (int ib = 1; ib < Nbc; ++ib) {
Accs[ib] = Acbs[ib];
}
m_Mcm[ic][0] = m_SAcmsLF[m_ic2LF[ic]].m_Au.m_Acm;
m_Mmm[ic][0] = m_Amus[ic];
const int _ic = ic + 1;
if (_ic == Nc) {
continue;
}
const Camera::Factor::Binary &Ab = m_SAcmsLF[m_ic2LF[_ic]].m_Ab;
m_Mcm[ic][1] = Ab.m_Acm;
m_Mmm[ic][1] = Ab.m_Amm;
LA::AlignedMatrix9x6f *Amcs = m_Mmc[ic];
Amcs[0] = Ab.m_Amc;
const int Nbm = Nbc - 1;
for (int ib = 1; ib < Nbm; ++ib) {
Amcs[ib].MakeZero();
}
}
AlignedVector<LA::AlignedMatrix6x6f> AccsT;
AlignedVector<LA::AlignedMatrix9x6f> AcmsT;
AlignedVector<LA::AlignedMatrix6x9f> AmcsT;
AlignedVector<LA::AlignedMatrix9x9f> AmmsT;
m_work.Resize((AccsT.BindSize(Nb) + AcmsT.BindSize(2) +
AmcsT.BindSize(Nb) + AmmsT.BindSize(2)) / sizeof(float));
AccsT.Bind(m_work.Data(), Nb);
AcmsT.Bind(AccsT.BindNext(), 2);
AmcsT.Bind(AcmsT.BindNext(), Nb);
AmmsT.Bind(AmcsT.BindNext(), Nb);
for (int ic = 0; ic < Nc; ++ic) {
LA::AlignedMatrix6x6f *Mccs = m_Mcc[ic], *MccsT = m_MccT[ic];
LA::AlignedMatrix6x9f *Mcms = m_Mcm[ic], *MmcsT = m_MmcT[ic];
LA::AlignedMatrix9x6f *McmsT = m_McmT[ic], *Mmcs = m_Mmc[ic];
LA::AlignedMatrix9x9f *Mmms = m_Mmm[ic], *MmmsT = m_MmmT[ic];
const int Nbcc = ic + Nb > Nc ? Nc - ic : Nb;
const int Nbcm = ic + 1 == Nc ? 1 : 2;
const int Nbmc = Nbcc - 1;
const int Nbmm = Nbcm;
LA::AlignedMatrix6x6f &Mcc = Mccs[0];
if (Mcc.InverseLDL(epsc)) {
MccsT[0] = Mcc;
Mcc.MakeMinus();
for (int ib = 1; ib < Nbcc; ++ib) {
Mccs[ib].GetTranspose(AccsT[ib]);
LA::AlignedMatrix6x6f::ABT(Mcc, AccsT[ib], Mccs[ib]);
Mccs[ib].GetTranspose(MccsT[ib]);
}
for (int ib = 0; ib < Nbcm; ++ib) {
Mcms[ib].GetTranspose(AcmsT[ib]);
LA::AlignedMatrix9x6f::ABT(Mcc, AcmsT[ib], Mcms[ib]);
Mcms[ib].GetTranspose(McmsT[ib]);
}
for (int ib = 1; ib < Nbcc; ++ib) {
const LA::AlignedMatrix6x6f &MccT = MccsT[ib];
const int _ic = ic + ib;
LA::AlignedMatrix6x6f *_Mccs = m_Mcc[_ic] - ib;
LA::AlignedMatrix6x6f::AddABTToUpper(MccT, AccsT[ib], _Mccs[ib]);
for (int jb = ib + 1; jb < Nbcc; ++jb) {
LA::AlignedMatrix6x6f::AddABTTo(MccT, AccsT[jb], _Mccs[jb]);
}
if (ib == 1) {
LA::AlignedMatrix9x6f::AddABTTo(MccT, AcmsT[ib], m_Mcm[_ic][0]);
}
}
for (int ib = 0; ib < Nbcm; ++ib) {
const LA::AlignedMatrix9x6f &McmT = McmsT[ib];
const int _ic = ic + ib;
const LA::AlignedMatrix6x6f *_AccsT = AccsT.Data() + 1;
LA::AlignedMatrix9x6f *_Mmcs = m_Mmc[_ic] - ib;
for (int jb = ib; jb < Nbmc; ++jb) {
LA::AlignedMatrix9x6f::AddABTTo(McmT, _AccsT[jb], _Mmcs[jb]);
}
LA::AlignedMatrix9x9f *_Mmms = m_Mmm[_ic];
LA::AlignedMatrix9x9f::AddABTToUpper(McmT, AcmsT[ib], _Mmms[0]);
if (ib == 0 && Nbcm == 2) {
LA::AlignedMatrix9x9f::AddABTTo(McmT, AcmsT[1], _Mmms[1]);
}
}
} else {
for (int ib = 0; ib < Nbcc; ++ib) {
Mccs[ib].MakeZero();
MccsT[ib].MakeZero();
}
for (int ib = 0; ib < Nbcm; ++ib) {
Mcms[ib].MakeZero();
McmsT[ib].MakeZero();
}
}
LA::AlignedMatrix9x9f &Mmm = Mmms[0];
if (Mmm.InverseLDL(epsm)) {
MmmsT[0] = Mmm;
Mmm.MakeMinus();
for (int ib = 0; ib < Nbmc; ++ib) {
Mmcs[ib].GetTranspose(AmcsT[ib]);
LA::AlignedMatrix9x9f::ABT(Mmm, AmcsT[ib], Mmcs[ib]);
Mmcs[ib].GetTranspose(MmcsT[ib]);
}
if (Nbmm == 2) {
Mmms[1].GetTranspose(AmmsT[1]);
LA::AlignedMatrix9x9f::ABT(Mmm, AmmsT[1], Mmms[1]);
Mmms[1].GetTranspose(MmmsT[1]);
}
for (int ib = 0; ib < Nbmc; ++ib) {
const LA::AlignedMatrix6x9f &MmcT = MmcsT[ib];
const int _ic = ic + ib + 1;
LA::AlignedMatrix6x6f *_Mccs = m_Mcc[_ic] - ib;
LA::AlignedMatrix6x9f::AddABTToUpper(MmcT, AmcsT[ib], _Mccs[ib]);
for (int jb = ib + 1; jb < Nbmc; ++jb) {
LA::AlignedMatrix6x9f::AddABTTo(MmcT, AmcsT[jb], _Mccs[jb]);
}
if (ib == 0 && Nbmm == 2) {
LA::AlignedMatrix9x9f::AddABTTo(MmcT, AmmsT[1], m_Mcm[_ic][0]);
}
}
if (Nbmm == 2) {
const LA::AlignedMatrix9x9f &MmmT = MmmsT[1];
const int _ic = ic + 1;
LA::AlignedMatrix9x6f *_Mmcs = m_Mmc[_ic] - 1;
for (int jb = 1; jb < Nbmc; ++jb) {
LA::AlignedMatrix9x9f::AddABTTo(MmmT, AmcsT[jb], _Mmcs[jb]);
}
LA::AlignedMatrix9x9f::AddABTToUpper(MmmT, AmmsT[1], m_Mmm[_ic][0]);
}
} else {
for (int ib = 0; ib < Nbmc; ++ib) {
Mmcs[ib].MakeZero();
MmcsT[ib].MakeZero();
}
for (int ib = 0; ib < Nbmm; ++ib) {
Mmms[ib].MakeZero();
MmmsT[ib].MakeZero();
}
}
}
}
void LocalBundleAdjustor::ApplyM(const LA::AlignedVectorXf &xs, LA::AlignedVectorXf *Mxs) {
const int Nb = std::min(LBA_PCG_CONDITIONER_BAND, LBA_MAX_SLIDING_TRACK_LENGTH);
const int Nc = int(m_LFs.size());
if (Nb <= 1) {
#ifdef CFG_PCG_FULL_BLOCK
LA::ProductVector6f xc;
LA::AlignedVector9f xm;
#else
LA::AlignedVector3f xp, xr, xv, xba, xbw;
#endif
Mxs->Resize(xs.Size());
const LA::Vector6f *xcs = (LA::Vector6f *) xs.Data();
LA::Vector6f *Mxcs = (LA::Vector6f *) Mxs->Data();
for (int ic = 0; ic < Nc; ++ic) {
#ifdef CFG_PCG_FULL_BLOCK
xc.Set(xcs[ic]);
m_Mcs[ic].Apply(xc, (PCG_TYPE *) &Mxcs[ic]);
#else
xcs[ic].Get(xp, xr);
m_Mcs[ic].Apply(xp, xr, (float *) Mxcs[ic]);
#endif
}
const LA::Vector9f *xms = (LA::Vector9f *) (xcs + Nc);
LA::Vector9f *Mxms = (LA::Vector9f *) (Mxcs + Nc);
for (int ic = 0; ic < Nc; ++ic) {
#ifdef CFG_PCG_FULL_BLOCK
xm.Set(xms[ic]);
m_Mms[ic].Apply(xm, (PCG_TYPE *) &Mxms[ic]);
#else
xms[ic].Get(xv, xba, xbw);
m_Mms[ic].Apply(xv, xba, xbw, (float *) Mxms[ic]);
#endif
}
return;
}
LA::ProductVector6f bc;
LA::AlignedVector9f bm;
Mxs->Set(xs);
LA::Vector6f *bcs = (LA::Vector6f *) Mxs->Data();
LA::Vector9f *bms = (LA::Vector9f *) (bcs + Nc);
for (int ic = 0; ic < Nc; ++ic) {
const int Nbcc = ic + Nb > Nc ? Nc - ic : Nb;
const int Nbcm = ic + 1 == Nc ? 1 : 2;
const int Nbmc = Nbcc - 1;
const int Nbmm = Nbcm;
bc.Set(bcs[ic]);
const LA::AlignedMatrix6x6f *MccsT = m_MccT[ic];
for (int ib = 1; ib < Nbcc; ++ib) {
LA::AlignedMatrix6x6f::AddAbTo<float>(MccsT[ib], bc, bcs[ic + ib]);
}
const LA::AlignedMatrix9x6f *McmsT = m_McmT[ic];
for (int ib = 0; ib < Nbcm; ++ib) {
LA::AlignedMatrix9x6f::AddAbTo<float>(McmsT[ib], bc, bms[ic + ib]);
}
LA::AlignedMatrix6x6f::Ab<float>(MccsT[0], bc, bcs[ic]);
bm.Set(bms[ic]);
const LA::AlignedMatrix6x9f *MmcsT = m_MmcT[ic];
for (int ib = 0; ib < Nbmc; ++ib) {
LA::AlignedMatrix6x9f::AddAbTo<float>(MmcsT[ib], bm, bcs[ic + ib + 1]);
}
const LA::AlignedMatrix9x9f *MmmsT = m_MmmT[ic];
if (Nbmm == 2) {
LA::AlignedMatrix9x9f::AddAbTo<float>(MmmsT[1], bm, bms[ic + 1]);
}
LA::AlignedMatrix9x9f::Ab<float>(MmmsT[0], bm, bms[ic]);
}
m_bcs.Resize(Nc);
m_bms.Resize(Nc);
for (int ic = Nc - 1; ic >= 0; --ic) {
const int Nbcc = ic + Nb > Nc ? Nc - ic : Nb;
const int Nbcm = ic + 1 == Nc ? 1 : 2;
const int Nbmc = Nbcc - 1;
const int Nbmm = Nbcm;
float *_bm = bms[ic];
const LA::AlignedMatrix9x6f *Mmcs = m_Mmc[ic];
for (int ib = 0; ib < Nbmc; ++ib) {
LA::AlignedMatrix9x6f::AddAbTo(Mmcs[ib], m_bcs[ic + ib + 1], _bm);
}
if (Nbmm == 2) {
LA::AlignedMatrix9x9f::AddAbTo(m_Mmm[ic][1], m_bms[ic + 1], _bm);
}
m_bms[ic].Set(_bm);
float *_bc = bcs[ic];
const LA::AlignedMatrix6x6f *Mccs = m_Mcc[ic];
for (int ib = 1; ib < Nbcc; ++ib) {
LA::AlignedMatrix6x6f::AddAbTo(Mccs[ib], m_bcs[ic + ib], _bc);
}
const LA::AlignedMatrix6x9f *Mcms = m_Mcm[ic];
for (int ib = 0; ib < Nbcm; ++ib) {
LA::AlignedMatrix6x9f::AddAbTo(Mcms[ib], m_bms[ic + ib], _bc);
}
m_bcs[ic].Set(_bc);
}
}
void LocalBundleAdjustor::ApplyA(const LA::AlignedVectorXf &xs, LA::AlignedVectorXf *Axs) {
//LA::AlignedVector6f v6;
const LA::Vector6f *xcs = (LA::Vector6f *) xs.Data();
ConvertCameraUpdates(xcs, &m_xcsP);
Axs->Resize(xs.Size());
LA::Vector6f *Axcs = (LA::Vector6f *) Axs->Data();
const int Nc = int(m_LFs.size());
if (m_Acus.Size() < Nc) {
Axs->MakeZero();
return;
}
//m_Axcs.Resize(Nc);
for (int ic = 0; ic < Nc; ++ic) {
LA::AlignedMatrix6x6f::Ab(m_Acus[ic], m_xcsP[ic], (float *) &Axcs[ic]);
}
for (int ic = 0; ic < Nc; ++ic) {
const int ib = m_ic2b[ic];
const LA::AlignedMatrix6x6f *Acbs = m_Acbs.Data() + ib;
const LA::AlignedMatrix6x6f *AcbTs = m_AcbTs.Data() + ib;
const LA::ProductVector6f &xc = m_xcsP[ic];
float *Axc = Axcs[ic];
const LocalFrame &LF = m_LFs[m_ic2LF[ic]];
const int Nk = int(LF.m_iLFsMatch.size());
for (int ik = 0; ik < Nk; ++ik) {
const int _ic = ic + ik + 1;
LA::AlignedMatrix6x6f::AddAbTo(Acbs[ik], m_xcsP[_ic], Axc);
LA::AlignedMatrix6x6f::AddAbTo(AcbTs[ik], xc, (float *) &Axcs[_ic]);
}
}
//ConvertCameraUpdates(m_Axcs, Axcs);
ApplyAcm(m_xcsP.Data(), (LA::Vector9f *) (xcs + Nc), Axcs, (LA::Vector9f *) (Axcs + Nc), false,
m_Amus.Size() == Nc ? m_Amus.Data() : NULL);
}
void LocalBundleAdjustor::ApplyAcm(const LA::ProductVector6f *xcs, const LA::Vector9f *xms,
LA::Vector6f *Axcs, LA::Vector9f *Axms, const bool Acc,
const LA::AlignedMatrix9x9f *Amus) {
LA::AlignedMatrix6x6f A66;
LA::AlignedMatrix6x9f A69;
LA::AlignedMatrix9x6f A96;
LA::AlignedMatrix9x9f A99;
LA::AlignedVector9f v9[2];
LA::AlignedMatrix3x3f A33;
LA::AlignedMatrix3x9f A39;
LA::AlignedVector3f v3;
const int Nc = int(m_LFs.size());
for (int ic = 0, r = 0; ic < Nc; ++ic, r = 1 - r) {
const LA::ProductVector6f &xc = xcs[ic];
LA::AlignedVector9f &xm = v9[r];
xm.Set(xms[ic]);
float *Axc = Axcs[ic], *Axm = Axms[ic];
const Camera::Factor &SAcm = m_SAcmsLF[m_ic2LF[ic]];
if (Amus) {
LA::AlignedMatrix9x9f::Ab(Amus[ic], xm, Axm);
} else {
A99.Set(SAcm.m_Au.m_Amm.m_A);
LA::AlignedMatrix9x9f::Ab(A99, xm, Axm);
}
LA::AlignedMatrix6x9f::AddAbTo(SAcm.m_Au.m_Acm, xm, Axc);
SAcm.m_Au.m_Acm.GetTranspose(A96);
LA::AlignedMatrix9x6f::AddAbTo(A96, xc, Axm);
if (ic == 0) {
continue;
}
const int _ic = ic - 1;
const LA::ProductVector6f &_xc = xcs[_ic];
const LA::AlignedVector9f &_xm = v9[1 - r];
float *_Axc = Axcs[_ic], *_Axm = Axms[_ic];
if (Acc) {
LA::AlignedMatrix6x6f::AddAbTo(SAcm.m_Ab.m_Acc, xc, _Axc);
SAcm.m_Ab.m_Acc.GetTranspose(A66);
LA::AlignedMatrix6x6f::AddAbTo(A66, _xc, Axc);
}
LA::AlignedMatrix6x9f::AddAbTo(SAcm.m_Ab.m_Acm, xm, _Axc);
SAcm.m_Ab.m_Acm.GetTranspose(A96);
LA::AlignedMatrix9x6f::AddAbTo(A96, _xc, Axm);
LA::AlignedMatrix9x6f::AddAbTo(SAcm.m_Ab.m_Amc, xc, _Axm);
SAcm.m_Ab.m_Amc.GetTranspose(A69);
LA::AlignedMatrix6x9f::AddAbTo(A69, _xm, Axc);
LA::AlignedMatrix9x9f::AddAbTo(SAcm.m_Ab.m_Amm, xm, _Axm);
SAcm.m_Ab.m_Amm.GetTranspose(A99);
LA::AlignedMatrix9x9f::AddAbTo(A99, _xm, Axm);
}
}
LocalBundleAdjustor::Residual LocalBundleAdjustor::ComputeResidual(const LA::AlignedVectorXf &xs,
const bool minus) {
Residual R;
ApplyA(xs, &m_rs);
if (minus) {
R.m_F = xs.Dot(m_rs) / 2 - xs.Dot(m_bs);
m_rs -= m_bs;
} else {
R.m_F = xs.Dot(m_rs) / 2 + xs.Dot(m_bs);
m_rs += m_bs;
}
R.m_r2 = m_rs.SquaredLength();
return R;
}
void LocalBundleAdjustor::SolveBackSubstitution() {
const int nKFs = static_cast<int>(m_KFs.size());
for (int iKF = 0; iKF < nKFs; ++iKF) {
if (!(m_ucsKF[iKF] & LBA_FLAG_FRAME_UPDATE_TRACK_INFORMATION)) {
continue;
}
const KeyFrame &KF = m_KFs[iKF];
const int Nx = static_cast<int>(KF.m_xs.size());
if (Nx == 0) {
continue;
}
ubyte *uds = m_uds.data() + m_iKF2d[iKF];
for (int ix = 0; ix < Nx; ++ix) {
if (!(uds[ix] & LBA_FLAG_TRACK_UPDATE_INFORMATION)) {
continue;
}
uds[ix] |= LBA_FLAG_TRACK_UPDATE_BACK_SUBSTITUTION;
m_ucsKF[iKF] |= LBA_FLAG_FRAME_UPDATE_BACK_SUBSTITUTION;
}
}
const int Nc = static_cast<int>(m_LFs.size());
for (int ic = 0; ic < Nc; ++ic) {
const int iLF = m_ic2LF[ic];
if (m_xr2s[ic] <= BA_BACK_SUBSTITUTE_ROTATION &&
m_xp2s[ic] <= BA_BACK_SUBSTITUTE_POSITION) {
m_ucsLF[iLF] &= ~LBA_FLAG_FRAME_UPDATE_DELTA;
continue;
}
m_ucsLF[iLF] |= LBA_FLAG_FRAME_UPDATE_DELTA;
const LocalFrame &LF = m_LFs[iLF];
const int NZ = int(LF.m_Zs.size());
for (int iZ = 0; iZ < NZ; ++iZ) {
const FRM::Measurement &Z = LF.m_Zs[iZ];
if (Z.m_iz1 == Z.m_iz2) {
continue;
}
m_ucsKF[Z.m_iKF] |= LBA_FLAG_FRAME_UPDATE_BACK_SUBSTITUTION;
ubyte *uds = m_uds.data() + m_iKF2d[Z.m_iKF];
for (int iz = Z.m_iz1; iz < Z.m_iz2; ++iz) {
uds[LF.m_zs[iz].m_ix] |= LBA_FLAG_TRACK_UPDATE_BACK_SUBSTITUTION;
}
}
}
int iX = 0;
m_iKF2X.assign(nKFs, -1);
for (int iKF = 0; iKF < nKFs; ++iKF) {
if (!(m_ucsKF[iKF] & LBA_FLAG_FRAME_UPDATE_BACK_SUBSTITUTION)) {
continue;
}
m_iKF2X[iKF] = iX;
iX += static_cast<int>(m_KFs[iKF].m_xs.size());
}
m_xds.Resize(iX);
for (int iKF = 0; iKF < nKFs; ++iKF) {
if (!(m_ucsKF[iKF] & LBA_FLAG_FRAME_UPDATE_BACK_SUBSTITUTION)) {
continue;
}
const ubyte *uds = m_uds.data() + m_iKF2d[iKF];
float *xds = m_xds.Data() + m_iKF2X[iKF];
KeyFrame &KF = m_KFs[iKF];
const int Nx = static_cast<int>(KF.m_xs.size());
for (int ix = 0; ix < Nx; ++ix) {
if (!(uds[ix] & LBA_FLAG_TRACK_UPDATE_BACK_SUBSTITUTION)) {
continue;
} else if (uds[ix] & LBA_FLAG_TRACK_UPDATE_INFORMATION_ZERO) {
xds[ix] = 0.0f;
} else {
xds[ix] = KF.m_Mxs[ix].BackSubstitute();
}
}
}
LA::AlignedVector6f xc;
const LA::Vector6f *xcs = (LA::Vector6f *) m_xsGN.Data();
for (int ic = 0; ic < Nc; ++ic) {
const int iLF = m_ic2LF[ic];
if (!(m_ucsLF[iLF] & LBA_FLAG_FRAME_UPDATE_DELTA)) {
continue;
}
xc.Set(xcs[ic]);
const LocalFrame &LF = m_LFs[iLF];
const int NZ = int(LF.m_Zs.size());
for (int iZ = 0; iZ < NZ; ++iZ) {
const FRM::Measurement &Z = LF.m_Zs[iZ];
const ubyte *uds = m_uds.data() + m_iKF2d[Z.m_iKF];
float *xds = m_xds.Data() + m_iKF2X[Z.m_iKF];
for (int iz = Z.m_iz1; iz < Z.m_iz2; ++iz) {
const int ix = LF.m_zs[iz].m_ix;
if (!(uds[ix] & LBA_FLAG_TRACK_UPDATE_INFORMATION_ZERO)) {
xds[ix] = LF.m_Mzs1[iz].BackSubstitute(xc) + xds[ix];
}
}
}
}
for (int iKF = 0; iKF < nKFs; ++iKF) {
const int iX = m_iKF2X[iKF];
if (iX == -1) {
continue;
}
const int id = m_iKF2d[iKF];
const Depth::InverseGaussian *ds = m_ds.data() + id;
ubyte *uds = m_uds.data() + id;
float *xds = m_xds.Data() + iX;
const int Nx = static_cast<int>(m_KFs[iKF].m_xs.size());
for (int ix = 0; ix < Nx; ++ix) {
if (!(uds[ix] & LBA_FLAG_TRACK_UPDATE_BACK_SUBSTITUTION)) {
continue;
}
xds[ix] = -xds[ix];
}
}
for (int iKF = 0; iKF < nKFs; ++iKF) {
if (!(m_ucsKF[iKF] & LBA_FLAG_FRAME_UPDATE_TRACK_INFORMATION)) {
continue;
}
m_ucsKF[iKF] &= ~LBA_FLAG_FRAME_UPDATE_TRACK_INFORMATION;
ubyte *uds = m_uds.data() + m_iKF2d[iKF];
KeyFrame &KF = m_KFs[iKF];
const int Nx = static_cast<int>(KF.m_xs.size());
for (int ix = 0; ix < Nx; ++ix) {
uds[ix] &= ~LBA_FLAG_TRACK_UPDATE_INFORMATION;
}
const int NST = static_cast<int>(KF.m_STs.size());
for (int iST = 0; iST < NST; ++iST) {
KF.m_usST[iST] &= ~LBA_FLAG_TRACK_UPDATE_INFORMATION;
}
}
PushDepthUpdates(m_xds, &m_xsGN);
m_x2GN = m_xsGN.SquaredLength();
}
bool LocalBundleAdjustor::EmbeddedMotionIteration() {
const int pc = 6, pm = 9;
const int Nc = m_CsLF.Size();
const LA::Vector6f *xcs = (LA::Vector6f *) m_xsGN.Data();
LA::Vector9f *xms = (LA::Vector9f *) (xcs + Nc);
//const float eps = 0.0f;
const float eps = FLT_EPSILON;
const int Nmr = Nc * pm, Nmc = pm + pm;
LA::AlignedMatrixXf A;
LA::AlignedVectorXf b, ai;
AlignedVector<LA::AlignedVector18f> x;
m_work.Resize(A.BindSize(Nmr, Nmc) + b.BindSize(Nmr) + x.BindSize(Nc) + ai.BindSize(Nmc));
A.Bind(m_work.Data(), Nmr, Nmc);
b.Bind(A.BindNext(), Nmr);
x.Bind(b.BindNext(), Nc);
ai.Bind(x.BindNext(), Nmc);
LA::AlignedVector6f xc[2];
LA::AlignedMatrix9x9f Amm;
LA::AlignedMatrix9x6f Amc;
for (int ic1 = -1, ic2 = 0, imp1 = -pm, imp2 = 0, r = 0; ic2 < Nc;
ic1 = ic2++, imp1 = imp2, imp2 += pm, r = 1 - r) {
const Camera::Factor &_A = m_SAcmsLF[m_ic2LF[ic2]];
Amm.Set(_A.m_Au.m_Amm.m_A);
A.SetBlock(imp2, 0, Amm);
float *_b = b.Data() + imp2;
_A.m_Au.m_Amm.m_b.Get(_b);
xc[r].Set(xcs[ic2]);
_A.m_Au.m_Acm.GetTranspose(Amc);
LA::AlignedMatrix9x6f::AddAbTo(Amc, xc[r], _b);
if (ic2 == 0) {
continue;
}
A.SetBlock(imp1, pm, _A.m_Ab.m_Amm);
_A.m_Ab.m_Acm.GetTranspose(Amc);
LA::AlignedMatrix9x6f::AddAbTo(Amc, xc[1 - r], _b);
LA::AlignedMatrix9x6f::AddAbTo(_A.m_Ab.m_Amc, xc[r], b.Data() + imp1);
}
LA::AlignedVector9f _mi;
const float epsv = UT::Inverse(BA_VARIANCE_MAX_VELOCITY, BA_WEIGHT_FEATURE, eps);
const float epsba = UT::Inverse(BA_VARIANCE_MAX_BIAS_ACCELERATION, BA_WEIGHT_FEATURE, eps);
const float epsbw = UT::Inverse(BA_VARIANCE_MAX_BIAS_GYROSCOPE, BA_WEIGHT_FEATURE, eps);
const float _eps[] = {epsv, epsv, epsv, epsba, epsba, epsba, epsbw, epsbw, epsbw};
for (int ic = 0, imp = 0; ic < Nc; ++ic) {
for (int ip = 0; ip < pm; ++ip, ++imp) {
float *mi = A[imp];
float &ni = b[imp];
const float aii = mi[ip];
if (aii <= _eps[ip]) {
memset(mi, 0, sizeof(float) * Nmc);
ni = 0.0f;
continue;
}
const float mii = 1.0f / aii;
mi[ip] = mii;
ai.Set(mi, Nmc);
ai.MakeMinus(ip + 1);
SIMD::Multiply(ip + 1, Nmc, mii, mi);
ni *= mii;
int jmp = imp + 1;
for (int jp = ip + 1; jp < pm; ++jp, ++jmp) {
const float aij = ai[jp];
SIMD::MultiplyAddTo(jp, Nmc, aij, mi, A[jmp]);
b[jmp] += aij * ni;
}
if (ic == Nc - 1) {
continue;
}
const float *_ai = ai.Data() + pm;
_mi.Set(mi + pm);
for (int jp = 0; jp < pm; ++jp, ++jmp) {
const float aij = _ai[jp];
SIMD::MultiplyAddTo(jp, pm, aij, _mi, A[jmp]);
b[jmp] += aij * ni;
}
}
}
for (int ic = 0, imp = 0; ic < Nc; ++ic, imp += pm) {
memcpy(x[ic], b.Data() + imp, 36);
}
for (int ic = Nc - 1, imp = Nmr - 1, r = ic & 1; ic >= 0; --ic, r = 1 - r) {
const int _ic = ic + 1;
const int _Nmc = _ic == Nc ? pm : Nmc;
float *xi = x[ic];
if (_ic < Nc) {
memcpy(xi + pm, x[_ic], 36);
}
for (int ip = pm - 1; ip >= 0; --ip, --imp) {
xi[ip] -= SIMD::Dot(ip + 1, _Nmc, A[imp], xi);
}
}
for (int ic = 0; ic < Nc; ++ic) {
xms[ic].Set(x[ic]);
}
m_xsGN.MakeMinus(pc * Nc);
ConvertMotionUpdates((float *) xms, &m_xv2s, &m_xba2s, &m_xbw2s);
return true;
}
void LocalBundleAdjustor::EmbeddedPointIteration(const AlignedVector<Camera> &CsLF,
const AlignedVector<Rigid3D> &CsKF,
const std::vector<ubyte> &ucsKF,
const std::vector<ubyte> &uds,
std::vector<Depth::InverseGaussian> *ds) {
std::vector<int> &iKF2X = m_idxsTmp1, &iX2d = m_idxsTmp2;
const int nKFs = static_cast<int>(m_KFs.size());
iKF2X.assign(nKFs, -1);
iX2d.resize(0);
int Nd = 0;
for (int iKF = 0; iKF < nKFs; ++iKF) {
if (!(ucsKF[iKF] & LBA_FLAG_FRAME_UPDATE_DEPTH)) {
continue;
}
const ubyte *_uds = uds.data() + m_iKF2d[iKF];
const int iX = static_cast<int>(iX2d.size()), Nx = static_cast<int>(m_KFs[iKF].m_xs.size());
iKF2X[iKF] = iX;
iX2d.resize(iX + Nx, -1);
int *ix2d = iX2d.data() + iX;
for (int ix = 0; ix < Nx; ++ix) {
if (_uds[ix] & LBA_FLAG_TRACK_UPDATE_DEPTH) {
ix2d[ix] = Nd++;
}
}
}
int Nt = 0;
m_idxsTmp3.resize(Nd + Nd + 1);
int *Nzs = m_idxsTmp3.data(), *id2z = Nzs + Nd;
memset(Nzs, 0, sizeof(int) * Nd);
const int Nc = nKFs + static_cast<int>(m_LFs.size());
for (int ic = 0; ic < Nc; ++ic) {
const FRM::Frame *F = ic < nKFs ? (FRM::Frame *) &m_KFs[ic] : &m_LFs[ic - nKFs];
const int NZ = static_cast<int>(F->m_Zs.size());
for (int iZ = 0; iZ < NZ; ++iZ) {
const FRM::Measurement &Z = F->m_Zs[iZ];
const int iX = iKF2X[Z.m_iKF];
if (iX == -1) {
continue;
}
bool t = false;
const int *ix2d = iX2d.data() + iX;
for (int iz = Z.m_iz1; iz < Z.m_iz2; ++iz) {
const FTR::Measurement &z = F->m_zs[iz];
const int id = ix2d[z.m_ix];
if (id == -1) {
continue;
}
++Nzs[id];
t = true;
}
if (t) {
++Nt;
}
}
}
m_t12s.Resize(Nt);
id2z[0] = 0;
for (int id = 0; id < Nd; ++id) {
id2z[id + 1] = id2z[id] + Nzs[id];
}
m_zds.resize(id2z[Nd]);
LA::Vector3f Rx;
//LA::SymmetricMatrix2x2f W;
Nt = 0;
memset(Nzs, 0, sizeof(int) * Nd);
for (int ic = 0; ic < Nc; ++ic) {
const FRM::Frame *F = ic < nKFs ? (FRM::Frame *) &m_KFs[ic] : &m_LFs[ic - nKFs];
const KeyFrame *KF = ic < nKFs ? (KeyFrame *) F : NULL;
const LocalFrame *LF = KF ? NULL : (LocalFrame *) F;
const Rigid3D &C = KF ? CsKF[ic] : CsLF[ic - nKFs].m_T;
const int NZ = static_cast<int>(F->m_Zs.size());
for (int iZ = 0; iZ < NZ; ++iZ) {
const FRM::Measurement &Z = F->m_Zs[iZ];
const int iX = iKF2X[Z.m_iKF];
if (iX == -1) {
continue;
}
const int *ix2d = iX2d.data() + iX;
bool found = false;
for (int iz = Z.m_iz1; iz < Z.m_iz2 && !found; ++iz) {
found = ix2d[F->m_zs[iz].m_ix] != -1;
}
if (!found) {
continue;
}
const Rigid3D T = C / CsKF[Z.m_iKF];
LA::AlignedVector3f *t = m_t12s.Data() + Nt++;
T.GetTranslation(*t);
const KeyFrame &_KF = m_KFs[Z.m_iKF];
for (int iz = Z.m_iz1; iz < Z.m_iz2; ++iz) {
const FTR::Measurement &z = F->m_zs[iz];
const int id = ix2d[z.m_ix];
if (id == -1) {
continue;
}
T.ApplyRotation(_KF.m_xs[z.m_ix].m_x, Rx);
//z.m_W.GetScaled(KF ? KF->m_Azs[iz].m_wx : LF->m_Lzs[iz].m_wx, W);
const LA::SymmetricMatrix2x2f &W = z.m_W;
const int i = ++Nzs[id];
m_zds[i].Set(*t, Rx, z.m_z, W);
}
}
}
for (int iKF = 0; iKF < nKFs; ++iKF) {
const int iX = iKF2X[iKF];
if (iX == -1) {
continue;
}
Depth::InverseGaussian *_ds = ds->data() + m_iKF2d[iKF];
const int *ix2d = iX2d.data() + iX;
const KeyFrame &KF = m_KFs[iKF];
const int Nx = static_cast<int>(KF.m_xs.size());
for (int ix = 0; ix < Nx; ++ix) {
const int id = ix2d[ix];
if (id == -1) {
continue;
}
Depth::InverseGaussian &d = _ds[ix];
const Depth::InverseGaussian dBkp = d;
if (!Depth::Triangulate(BA_WEIGHT_FEATURE, Nzs[id], m_zds.data() + id2z[id], &d, &m_work, true)) {
d = dBkp;
}
}
}
}
| 35.490483
| 104
| 0.566928
|
StevenCui
|
01092b68de09ab803cd9dfbf671e508042cf1231
| 2,292
|
cpp
|
C++
|
src/config.cpp
|
ivan-volnov/keybr
|
42a3ccff0f0aa918b78d971522d36c60eefc80f2
|
[
"MIT"
] | 14
|
2020-04-06T17:02:35.000Z
|
2022-01-30T14:30:43.000Z
|
src/config.cpp
|
Involkers/keybr
|
42a3ccff0f0aa918b78d971522d36c60eefc80f2
|
[
"MIT"
] | 1
|
2021-07-19T01:05:54.000Z
|
2021-07-23T08:47:27.000Z
|
src/config.cpp
|
Involkers/keybr
|
42a3ccff0f0aa918b78d971522d36c60eefc80f2
|
[
"MIT"
] | 4
|
2021-03-12T05:40:57.000Z
|
2022-01-19T11:06:31.000Z
|
#include "config.h"
#include <unistd.h>
#include <pwd.h>
#include <ctime>
#include <fstream>
#include <iostream>
#include "utility/tools.h"
Config::Config() :
json({})
{
const char *homedir = getenv("HOME");
if (homedir == nullptr) {
homedir = getpwuid(getuid())->pw_dir;
}
app_path.assign(homedir).append(".keybr");
if (!std::filesystem::exists(app_path)) {
std::filesystem::create_directory(app_path);
}
const auto backup_path = get_backup_path();
if (!std::filesystem::exists(backup_path)) {
std::filesystem::create_directory(backup_path);
}
if (auto conf = get_config_filepath(); std::filesystem::exists(conf)) {
std::ifstream(conf) >> json;
}
else {
json["total_phrases"] = 15;
json["last_n_delay_revisions"] = 10;
json["uppercase_delay_multiplier"] = 0.4;
json["starting_symbol_delay_multiplier"] = 0.9;
json["anki_query"] = "\"deck:Vocabulary Profile\" -is:new -is:learn -is:suspended";
json["anki_clear_query"] = "\"deck:Vocabulary Profile\"";
json["max_current_errors"] = 5;
json["daily_goal"] = 25;
}
}
bool Config::is_sound_enabled() const
{
return sound_enabled;
}
void Config::set_sound_enabled(bool value)
{
sound_enabled = value;
}
Config::~Config()
{
try {
std::ofstream(get_config_filepath()) << std::setw(4) << json;
}
catch (const std::exception &e) {
std::cerr << "Error: " << e.what() << std::endl;
}
}
Config &Config::instance()
{
static Config _instance;
return _instance;
}
std::filesystem::path Config::get_app_path() const
{
return app_path;
}
std::filesystem::path Config::get_backup_path() const
{
return get_app_path().append("backup");
}
std::string Config::get_db_filepath() const
{
return get_app_path().append("keybr.db");
}
std::string Config::get_backup_db_filepath() const
{
const auto now = std::time(nullptr);
auto weekday = tools::weekday_to_string(std::localtime(&now)->tm_wday);
weekday.resize(3);
weekday[0] = std::tolower(weekday[0]);
return get_backup_path().append("keybr_backup_" + weekday + ".db");
}
std::string Config::get_config_filepath() const
{
return get_app_path().append("config.json");
}
| 24.382979
| 91
| 0.637871
|
ivan-volnov
|
010dcb62912e2d87aed24182eccd818691a739b2
| 1,989
|
cpp
|
C++
|
ev/external/lightstep-tracer-cpp/test/in_memory_async_transporter.cpp
|
sergiorr/yastack
|
17cdc12a52ea5869f429aa8ec421c3d1d25b32e7
|
[
"Apache-2.0"
] | 91
|
2018-11-24T05:33:58.000Z
|
2022-03-16T05:58:05.000Z
|
ev/external/lightstep-tracer-cpp/test/in_memory_async_transporter.cpp
|
sergiorr/yastack
|
17cdc12a52ea5869f429aa8ec421c3d1d25b32e7
|
[
"Apache-2.0"
] | 11
|
2019-06-02T23:50:17.000Z
|
2022-02-04T23:58:56.000Z
|
ev/external/lightstep-tracer-cpp/test/in_memory_async_transporter.cpp
|
sergiorr/yastack
|
17cdc12a52ea5869f429aa8ec421c3d1d25b32e7
|
[
"Apache-2.0"
] | 18
|
2018-11-24T10:35:29.000Z
|
2021-04-22T07:22:10.000Z
|
#include "in_memory_async_transporter.h"
namespace lightstep {
//------------------------------------------------------------------------------
// Send
//------------------------------------------------------------------------------
void InMemoryAsyncTransporter::Send(const google::protobuf::Message& request,
google::protobuf::Message& response,
AsyncTransporter::Callback& callback) {
active_request_ = &request;
active_response_ = &response;
active_callback_ = &callback;
}
//------------------------------------------------------------------------------
// Write
//------------------------------------------------------------------------------
void InMemoryAsyncTransporter::Write() {
if (active_request_ == nullptr || active_response_ == nullptr ||
active_callback_ == nullptr) {
std::cerr << "No context, success callback, or request\n";
std::terminate();
}
const collector::ReportRequest& report =
dynamic_cast<const collector::ReportRequest&>(*active_request_);
reports_.push_back(report);
spans_.reserve(spans_.size() + report.spans_size());
for (auto& span : report.spans()) {
spans_.push_back(span);
}
active_response_->CopyFrom(*Transporter::MakeCollectorResponse());
if (should_disable_) {
collector::Command command;
command.set_disable(true);
auto& report_response =
dynamic_cast<collector::ReportResponse&>(*active_response_);
*report_response.add_commands() = command;
}
active_callback_->OnSuccess();
}
//------------------------------------------------------------------------------
// Fail
//------------------------------------------------------------------------------
void InMemoryAsyncTransporter::Fail(std::error_code error) {
if (active_callback_ == nullptr) {
std::cerr << "No context or failure callback\n";
std::terminate();
}
active_callback_->OnFailure(error);
}
} // namespace lightstep
| 35.517857
| 80
| 0.514832
|
sergiorr
|
010e765543cdfbb0e7fc14b5f748cb9308f07665
| 1,256
|
cpp
|
C++
|
free_gait_core/src/step/CustomCommand.cpp
|
HeroWithL/free_gaitc
|
ac4bc0ced56d0619d2fde105d2712fdf2507e245
|
[
"BSD-3-Clause"
] | 330
|
2016-10-25T14:04:02.000Z
|
2022-03-30T12:31:41.000Z
|
free_gait_core/src/step/CustomCommand.cpp
|
HeroWithL/free_gaitc
|
ac4bc0ced56d0619d2fde105d2712fdf2507e245
|
[
"BSD-3-Clause"
] | 47
|
2016-08-25T14:10:23.000Z
|
2020-09-21T17:25:05.000Z
|
free_gait_core/src/step/CustomCommand.cpp
|
HeroWithL/free_gaitc
|
ac4bc0ced56d0619d2fde105d2712fdf2507e245
|
[
"BSD-3-Clause"
] | 122
|
2016-10-25T14:04:16.000Z
|
2022-03-26T21:32:51.000Z
|
/*
* CustomCommand.cpp
*
* Created on: Feb 15, 2017
* Author: Péter Fankhauser
* Institute: ETH Zurich, Robotic Systems Lab
*/
#include "free_gait_core/step/CustomCommand.hpp"
// STD
#include <iostream>
namespace free_gait {
CustomCommand::CustomCommand()
: duration_(0.0)
{
}
CustomCommand::~CustomCommand()
{
}
std::unique_ptr<CustomCommand> CustomCommand::clone() const
{
std::unique_ptr<CustomCommand> pointer(new CustomCommand(*this));
return pointer;
}
void CustomCommand::setType(const std::string& type)
{
type_ = type;
}
void CustomCommand::setDuration(const double duration)
{
duration_ = duration;
}
void CustomCommand::setCommand(const std::string& command)
{
command_ = command;
}
const std::string& CustomCommand::getType() const
{
return type_;
}
const std::string& CustomCommand::getCommand() const
{
return command_;
}
double CustomCommand::getDuration() const
{
return duration_;
}
std::ostream& operator<<(std::ostream& out, const CustomCommand& customCommand)
{
out << "Type: " << customCommand.type_ << std::endl;
out << "Duration: " << customCommand.duration_ << std::endl;
out << "Command: " << std::endl << customCommand.command_ << std::endl;
return out;
}
} /* namespace */
| 17.942857
| 79
| 0.697452
|
HeroWithL
|
010f9318031968f7d41a3755185a2eda99baf92c
| 479
|
cpp
|
C++
|
tools/packchk/src/PackChkMain.cpp
|
tarek-bochkati/devtools
|
88b60b70d494e00577f432a01076380689cd3efb
|
[
"Apache-2.0",
"MIT",
"ECL-2.0",
"BSL-1.0",
"BSD-3-Clause"
] | 17
|
2021-09-01T16:30:45.000Z
|
2022-03-23T12:33:54.000Z
|
tools/packchk/src/PackChkMain.cpp
|
tarek-bochkati/devtools
|
88b60b70d494e00577f432a01076380689cd3efb
|
[
"Apache-2.0",
"MIT",
"ECL-2.0",
"BSL-1.0",
"BSD-3-Clause"
] | 158
|
2021-09-14T09:13:11.000Z
|
2022-03-31T10:45:46.000Z
|
tools/packchk/src/PackChkMain.cpp
|
spcaipers-arm/devtools
|
973cba2110e373a584ef6faf14ba3cd38f927696
|
[
"Apache-2.0",
"MIT",
"ECL-2.0",
"BSL-1.0",
"BSD-3-Clause"
] | 32
|
2021-09-03T08:50:30.000Z
|
2022-03-14T13:14:39.000Z
|
/*
* Copyright (c) 2020-2021 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "PackChk.h"
#include "CrossPlatform.h"
/**
* @brief PackChk main entry point
* @param argc command line argument
* @param argv command line argument
* @param envp command line argument (not used)
* @return 0: ok, 1: error
*/
int main(int argc, const char* argv [], const char* envp [])
{
PackChk packChk;
return packChk.Check(argc, argv, envp);
}
| 19.958333
| 60
| 0.680585
|
tarek-bochkati
|
01108146c191eeeee41ad9c471d1b55074e5cfb3
| 1,236
|
cpp
|
C++
|
src/0128_longest_consecutive_sequence.cpp
|
hariharanragothaman/cpprevise-leetcode
|
736d497961f5493a82c3f9355abbc2daa8219643
|
[
"Apache-2.0"
] | 1
|
2021-04-21T07:59:30.000Z
|
2021-04-21T07:59:30.000Z
|
src/0128_longest_consecutive_sequence.cpp
|
hariharanragothaman/cpprevise-leetcode
|
736d497961f5493a82c3f9355abbc2daa8219643
|
[
"Apache-2.0"
] | null | null | null |
src/0128_longest_consecutive_sequence.cpp
|
hariharanragothaman/cpprevise-leetcode
|
736d497961f5493a82c3f9355abbc2daa8219643
|
[
"Apache-2.0"
] | null | null | null |
/*
* Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence.
Example 1:
Input: nums = [100,4,200,1,3,2]
Output: 4
Explanation: The longest consecutive elements sequence is [1, 2, 3, 4]. Therefore its length is 4.
Example 2:
Input: nums = [0,3,7,2,5,8,4,6,0,1]
Output: 9
Constraints:
0 <= nums.length <= 104
-109 <= nums[i] <= 109
*/
#include "headers.h"
int longestConsecutive(vector<int>& nums)
{
if (nums.size() == 0)
{
return 0;
}
int max_length = 0;
int window_length = 0;
sort(nums.begin(), nums.end());
nums.erase(unique(nums.begin(), nums.end()), nums.end());
for(int i = 1; i < nums.size(); i++)
{
if (nums[i] - nums[i-1] == 1)
{
window_length += 1;
if (window_length > max_length)
max_length = window_length;
}
else
{
window_length = 0;
}
}
return max_length + 1;
}
int main()
{
vector<int> nums = {100,4,200,1,3,2};
int result = longestConsecutive(nums);
cout << "The length of the longest consecutive sequence is: " << result << endl;
}
| 20.949153
| 110
| 0.541262
|
hariharanragothaman
|
01143c2a451db0b9d533573d60d3b9e50dce2ea2
| 2,162
|
cpp
|
C++
|
c++/leetcode/0759-Employee_Free_Time-H.cpp
|
levendlee/leetcode
|
35e274cb4046f6ec7112cd56babd8fb7d437b844
|
[
"Apache-2.0"
] | 1
|
2020-03-02T10:56:22.000Z
|
2020-03-02T10:56:22.000Z
|
c++/leetcode/0759-Employee_Free_Time-H.cpp
|
levendlee/leetcode
|
35e274cb4046f6ec7112cd56babd8fb7d437b844
|
[
"Apache-2.0"
] | null | null | null |
c++/leetcode/0759-Employee_Free_Time-H.cpp
|
levendlee/leetcode
|
35e274cb4046f6ec7112cd56babd8fb7d437b844
|
[
"Apache-2.0"
] | null | null | null |
// 759 Employee Free Time
// https://leetcode.com/problems/employee-free-time
// version: 1; create time: 2020-01-04 18:33:46;
/*
// Definition for an Interval.
class Interval {
public:
int start;
int end;
Interval() {}
Interval(int _start, int _end) {
start = _start;
end = _end;
}
};
*/
class Solution {
private:
map<int, int> bst_;
public:
vector<Interval> employeeFreeTime(vector<vector<Interval>> schedule) {
bst_[INT_MIN] = INT_MAX;
const auto cut_interval = [&](const Interval& free, const Interval& busy) {
if (free.start < free.end) {
int new_end = std::min(free.end, busy.start);
if (free.start < new_end) {
bst_[free.start] = new_end;
} else {
bst_.erase(free.start);
}
int new_start = std::max(free.start, busy.end);
if (free.end > new_start) {
bst_[new_start] = free.end;
}
}
};
for (const auto& individual : schedule) {
for (const auto& busy : individual) {
Interval free0(INT_MAX, INT_MIN);
Interval free1(INT_MAX, INT_MIN);
const auto iter1 = bst_.upper_bound(busy.start);
if (iter1 != bst_.begin()) {
auto tmp = iter1;
--tmp;
free0 = Interval(tmp->first, tmp->second);
}
const auto iter2 = bst_.lower_bound(busy.end);
if (iter2 != iter1 && iter2 != bst_.begin()) {
auto tmp = iter2;
--tmp;
free1 = Interval(tmp->first, tmp->second);
}
bst_.erase(iter1, iter2);
cut_interval(free0, busy);
cut_interval(free1, busy);
}
}
vector<Interval> res;
for (const auto& p : bst_) {
if (p.first != INT_MIN && p.second != INT_MAX)
res.emplace_back(p.first, p.second);
}
return res;
}
};
| 29.216216
| 83
| 0.474561
|
levendlee
|
0115b68cddb2a2bf16245d977fec16f5b6afcb4b
| 776
|
hpp
|
C++
|
exercise_6/writer.hpp
|
azurite/numCSE18-code
|
f7104305375954a0528d366f8460bf8033d20f0a
|
[
"MIT"
] | 1
|
2019-01-13T19:08:32.000Z
|
2019-01-13T19:08:32.000Z
|
exercise_6/writer.hpp
|
azurite/numCSE18-code
|
f7104305375954a0528d366f8460bf8033d20f0a
|
[
"MIT"
] | null | null | null |
exercise_6/writer.hpp
|
azurite/numCSE18-code
|
f7104305375954a0528d366f8460bf8033d20f0a
|
[
"MIT"
] | null | null | null |
#pragma once
#include <vector>
#include <string>
#include <fstream>
#include <limits>
#include <iomanip>
///
/// Writes the contents of the vector 'data' to the textfile filename
/// The output format should be load-able in MATLAB and Numpy using the
/// load-command.
///
template<typename T>
void writeToFile(const std::string& filename,
const std::vector<T>& data) {
std::ofstream file(filename.c_str());
// Set highest possible precision, this way we are sure we are
file << std::setprecision(std::numeric_limits<long double>::digits10 + 1);
// Loop over vector and write output to file
for(int i = 0; i < data.size(); ++i) {
file << data[i] << " ";
}
file << std::endl;
// File closes automatically at end of scope!
}
| 26.758621
| 78
| 0.653351
|
azurite
|
0119bf1a401aacbc00c9902f21ebec01e607970e
| 21
|
hpp
|
C++
|
include/minimiser.hpp
|
madagiurgiu25/seqan3_test
|
0b596a0a606e08b761acb1fdd9af3effbe4b37d9
|
[
"BSD-3-Clause"
] | null | null | null |
include/minimiser.hpp
|
madagiurgiu25/seqan3_test
|
0b596a0a606e08b761acb1fdd9af3effbe4b37d9
|
[
"BSD-3-Clause"
] | 7
|
2021-12-05T13:41:46.000Z
|
2021-12-13T10:36:43.000Z
|
include/minimiser.hpp
|
madagiurgiu25/seqan3_test
|
0b596a0a606e08b761acb1fdd9af3effbe4b37d9
|
[
"BSD-3-Clause"
] | null | null | null |
void testMinimizer();
| 21
| 21
| 0.809524
|
madagiurgiu25
|
011efa67eaeed44d76e15eb00a357331ab77da86
| 155
|
cpp
|
C++
|
container/src/container.cpp
|
ponta027/cpp_study
|
61c112b9034bf883f17fc49439992f3a4230f038
|
[
"Apache-2.0"
] | null | null | null |
container/src/container.cpp
|
ponta027/cpp_study
|
61c112b9034bf883f17fc49439992f3a4230f038
|
[
"Apache-2.0"
] | null | null | null |
container/src/container.cpp
|
ponta027/cpp_study
|
61c112b9034bf883f17fc49439992f3a4230f038
|
[
"Apache-2.0"
] | null | null | null |
#include <iostream>
void vectorSample();
void mapSample();
int main(int argc, char** argv)
{
vectorSample();
mapSample();
return 0;
}
| 12.916667
| 31
| 0.606452
|
ponta027
|
012147dffc314dfe4683e13904661492fa563ee9
| 632
|
cpp
|
C++
|
src/effect/PostEffectFactory.cpp
|
agruzdev/OgrePosteffects
|
5991183d0bd7bf711ae58182f4185db35714f368
|
[
"MIT"
] | null | null | null |
src/effect/PostEffectFactory.cpp
|
agruzdev/OgrePosteffects
|
5991183d0bd7bf711ae58182f4185db35714f368
|
[
"MIT"
] | null | null | null |
src/effect/PostEffectFactory.cpp
|
agruzdev/OgrePosteffects
|
5991183d0bd7bf711ae58182f4185db35714f368
|
[
"MIT"
] | null | null | null |
/**
* @file PostEffectFactory.cpp
*
* Copyright (c) 2015 by Gruzdev Alexey
*
* Code covered by the MIT License
* The authors make no representations about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
*/
#include "PostEffectFactory.h"
namespace OgreEffect
{
PostEffectFactory::PostEffectFactory(const Ogre::String& name) :
mName(name)
{
}
//-------------------------------------------------------
PostEffectFactory::~PostEffectFactory()
{
}
//-------------------------------------------------------
}//namespace OgreEffect
| 24.307692
| 78
| 0.572785
|
agruzdev
|
01244adbd40aeeb930f191ec80214a36cd463207
| 1,569
|
cpp
|
C++
|
camera-cmd/issyscam.cpp
|
idrilsilverfoot/windows-camera-tools
|
eef4b1df25b9b91f2170bc20c35a957be768990e
|
[
"MIT"
] | 20
|
2016-09-07T10:32:05.000Z
|
2021-06-04T17:12:17.000Z
|
camera-cmd/issyscam.cpp
|
idrilsilverfoot/windows-camera-tools
|
eef4b1df25b9b91f2170bc20c35a957be768990e
|
[
"MIT"
] | 1
|
2020-01-16T02:51:21.000Z
|
2020-02-19T02:34:29.000Z
|
camera-cmd/issyscam.cpp
|
idrilsilverfoot/windows-camera-tools
|
eef4b1df25b9b91f2170bc20c35a957be768990e
|
[
"MIT"
] | 5
|
2019-04-03T14:27:55.000Z
|
2021-01-18T13:24:52.000Z
|
/*
* Copyright(c) 2016 Chew Esmero
* All rights reserved.
*/
#include "stdafx.h"
#include "issyscam.h"
#include <atlbase.h>
#include "..\include\libcamera.h"
#include "common.h"
#include "appcontext.h"
int IsSystemCamera(wchar_t *pszFname, BOOL *pIsSysCam)
{
CComPtr<ICameraMf> spCameraMf = nullptr;
int retcode = DEFAULT_ERROR;
HRESULT hr = S_OK;
_tprintf(L"Checking if input is system camera.\n");
hr = CreateCameraMfInstance(&spCameraMf);
if (SUCCEEDED(hr) && spCameraMf)
{
hr = spCameraMf->IsSystemCamera(pszFname, pIsSysCam, (LONG*)&retcode);
if (SUCCEEDED(hr))
{
*pIsSysCam
? _tprintf(L"\n%s is installed in the system (index = %d).\n", pszFname, retcode)
: _tprintf(L"\n%s is not installed in the system.\n", pszFname);
}
else
{
ErrorCom(hr, L"IsSystemCamera");
retcode = DEFAULT_ERROR;
}
}
return retcode;
}
int DispatchIsSystemCamera(wchar_t *pszParam, wchar_t *pszSubParam, PVOID pContext)
{
CContext *pCt = (CContext*)pContext;
wchar_t szFname[MAX_PATH] = { 0 };
int retcode = DEFAULT_ERROR;
wstring wstrparam(pszSubParam);
size_t fname = wstrparam.find(L"-fname:");
BOOL bIsSysCam = FALSE;
if (fname != wstring::npos)
{
CopyMemory(szFname, &pszSubParam[fname + 7], ((pCt->m_cchlen - 1) - (fname + 7)) * sizeof(wchar_t));
retcode = IsSystemCamera(szFname, &bIsSysCam);
*pCt->m_pCmdSupported = TRUE;
}
return retcode;
}
| 24.904762
| 108
| 0.614404
|
idrilsilverfoot
|
0125796f3d116fc70bb74c4fa7c370dd168b3e7b
| 3,921
|
cpp
|
C++
|
InterView-obj-isa-class/libmalloc-166.220.1/tests/MallocBench/fragment.cpp
|
miniLV/MNAlertView
|
262275f6ba6be2537ac362dab4e9f532044c160c
|
[
"Apache-2.0"
] | 146
|
2019-01-20T15:42:47.000Z
|
2022-03-14T07:53:53.000Z
|
InterView-obj-isa-class/libmalloc-166.220.1/tests/MallocBench/fragment.cpp
|
geniusZhangXu/Interview-series
|
3222a15a1710f5cd4fc9e6e04d30b337e8eebe46
|
[
"Apache-2.0"
] | 3
|
2019-07-19T04:46:20.000Z
|
2022-03-24T01:53:07.000Z
|
InterView-obj-isa-class/libmalloc-166.220.1/tests/MallocBench/fragment.cpp
|
geniusZhangXu/Interview-series
|
3222a15a1710f5cd4fc9e6e04d30b337e8eebe46
|
[
"Apache-2.0"
] | 29
|
2019-06-23T06:14:00.000Z
|
2022-01-04T06:38:40.000Z
|
/*
* Copyright (C) 2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "CPUCount.h"
#include "fragment.h"
#include <stdlib.h>
#include <strings.h>
#include "mbmalloc.h"
namespace {
class Node {
public:
void* operator new(size_t size)
{
return mbmalloc(size);
}
void operator delete(void* p, size_t size)
{
mbfree(p, size);
}
Node()
: m_next(0)
, m_payload()
{
}
Node(Node* next)
: m_next(next)
, m_payload()
{
}
Node* next() { return m_next; }
void validate()
{
for (size_t i = 0; i < sizeof(m_payload); ++i) {
if (m_payload[i])
abort();
}
}
private:
Node* m_next;
char m_payload[32 - sizeof(Node*)];
};
} // namespace
void validate(Node* head)
{
for (Node* node = head; node; node = node->next())
node->validate();
}
void benchmark_fragment(bool isParallel)
{
size_t nodeCount = 128 * 1024;
if (isParallel)
nodeCount /= cpuCount();
size_t replaceCount = nodeCount / 4;
size_t times = 25;
srandom(0); // For consistency between runs.
for (size_t i = 0; i < times; ++i) {
Node** nodes = static_cast<Node**>(mbmalloc(nodeCount * sizeof(Node*)));
for (size_t i = 0; i < nodeCount; ++i)
nodes[i] = new Node;
for (size_t i = 0; i < replaceCount; ++i) {
size_t node = random() % nodeCount;
delete nodes[node];
nodes[node] = new Node;
}
for (size_t node = 0; node < nodeCount; ++node)
delete nodes[node];
mbfree(nodes, nodeCount * sizeof(Node*));
}
}
void benchmark_fragment_iterate(bool isParallel)
{
size_t nodeCount = 512 * 1024;
size_t times = 20;
if (isParallel)
nodeCount /= cpuCount();
size_t replaceCount = nodeCount / 4;
srandom(0); // For consistency between runs.
Node** nodes = static_cast<Node**>(mbmalloc(nodeCount * sizeof(Node*)));
for (size_t i = 0; i < nodeCount; ++i)
nodes[i] = new Node;
Node* head = 0;
for (size_t i = 0; i < replaceCount; ++i) {
size_t node = random() % nodeCount;
delete nodes[node];
nodes[node] = 0;
head = new Node(head);
}
for (size_t i = 0; i < times; ++i)
validate(head);
for (Node* next ; head; head = next) {
next = head->next();
delete head;
}
for (size_t node = 0; node < nodeCount; ++node) {
if (!nodes[node])
continue;
delete nodes[node];
}
mbfree(nodes, nodeCount * sizeof(Node*));
}
| 26.493243
| 80
| 0.609793
|
miniLV
|
012a577a28a67e7814a1e4dfba848ef51d09f13a
| 3,170
|
hpp
|
C++
|
lib/trading_db/include/offcenter/trading/db/SOCIMySQLConnectionOptions.hpp
|
CodeRancher/offcenter_trading
|
68526fdc0f27d611f748b2fa20f49e743d3ee5eb
|
[
"Apache-2.0"
] | null | null | null |
lib/trading_db/include/offcenter/trading/db/SOCIMySQLConnectionOptions.hpp
|
CodeRancher/offcenter_trading
|
68526fdc0f27d611f748b2fa20f49e743d3ee5eb
|
[
"Apache-2.0"
] | 4
|
2021-12-27T17:56:21.000Z
|
2022-01-05T00:05:01.000Z
|
lib/trading_db/include/offcenter/trading/db/SOCIMySQLConnectionOptions.hpp
|
CodeRancher/offcenter_trading
|
68526fdc0f27d611f748b2fa20f49e743d3ee5eb
|
[
"Apache-2.0"
] | null | null | null |
/**
* Copyright 2021 Scott Brauer
*
* Licensed under the Apache License, Version 2.0 (the );
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file SOCIMySQLConnectionOptions.hpp
* @author Scott Brauer
* @date 03-20-2021
*/
#ifndef OFFCENTER_TRADING_DB_SOCIMYSQLCONNECTIONOPTIONS_HPP_
#define OFFCENTER_TRADING_DB_SOCIMYSQLCONNECTIONOPTIONS_HPP_
#include <string>
#include <climits>
#include <stdexcept>
namespace offcenter {
namespace trading {
namespace db {
class SOCIMySQLConnectionOptions
{
class Option {
private:
bool m_isDirty;
const std::string m_name;
std::string m_value;
public:
explicit Option(const std::string& name):
m_isDirty(false),
m_name(name),
m_value("") {}
bool isDirty() const { return m_isDirty; }
const std::string operator()() const { return m_value; }
void operator()(const std::string value) { m_value = value; m_isDirty = true; }
const std::string optionString() const {
if (m_isDirty) {
return m_name + "=" + m_value;
} else {
return "";
}
}
};
template <int MIN, int MAX>
class IntOption: public Option {
public:
explicit IntOption(const std::string& name):
Option(name) {}
int operator()() const {
if (isDirty()) {
return std::stoi(Option::operator()());
} else {
return -1;
}
}
void operator()(int value) {
if ((value < MIN) || (value > MAX)) {
throw std::runtime_error("Setting option is out of range: " + std::to_string(MIN) + "<=" + std::to_string(value) + "<=" + std::to_string(MAX));
}
Option::operator()(std::to_string(value));
}
};
public:
explicit SOCIMySQLConnectionOptions();
explicit SOCIMySQLConnectionOptions(const std::string& host, const std::string& dbname, const std::string& user, const std::string& password);
virtual ~SOCIMySQLConnectionOptions();
const std::string getConnectionString() const;
Option dbname;
Option user;
Option password;
Option host;
Option port;
Option unix_socket;
Option sslca;
Option sslcert;
// local_infile - should be 0 or 1, 1 means MYSQL_OPT_LOCAL_INFILE will be set.
IntOption<0,1> local_infile;
Option charset;
// connect_timeout - should be positive integer value that means seconds corresponding to MYSQL_OPT_CONNECT_TIMEOUT.
IntOption<1,INT_MAX> connect_timeout;
// read_timeout - should be positive integer value that means seconds corresponding to MYSQL_OPT_READ_TIMEOUT.
IntOption<1,INT_MAX> read_timeout;
// write_timeout - should be positive integer value that means seconds corresponding to MYSQL_OPT_WRITE_TIMEOUT.
IntOption<1,INT_MAX> write_timeout;
};
} /* namespace db */
} /* namespace trading */
} /* namespace offcenter */
#endif /* OFFCENTER_TRADING_DB_SOCIMYSQLCONNECTIONOPTIONS_HPP_ */
| 29.082569
| 147
| 0.718927
|
CodeRancher
|
012ccb8289bdc9798bd4483f925a951eb03bf742
| 1,166
|
cpp
|
C++
|
ConsoleWriter.cpp
|
nwehr/eloquent-ext-consolewriter
|
35ce11895fb092120689359a0b80d4e47632a029
|
[
"BSD-2-Clause-FreeBSD"
] | null | null | null |
ConsoleWriter.cpp
|
nwehr/eloquent-ext-consolewriter
|
35ce11895fb092120689359a0b80d4e47632a029
|
[
"BSD-2-Clause-FreeBSD"
] | null | null | null |
ConsoleWriter.cpp
|
nwehr/eloquent-ext-consolewriter
|
35ce11895fb092120689359a0b80d4e47632a029
|
[
"BSD-2-Clause-FreeBSD"
] | null | null | null |
//
// Copyright 2013-2014 EvriChart, Inc. All Rights Reserved.
// See LICENSE.txt
//
// C++
#include <string>
#include <mutex>
#include <iostream>
// Internal
#include "ConsoleWriter.h"
///////////////////////////////////////////////////////////////////////////////
// ConsoleWriter : Extension
///////////////////////////////////////////////////////////////////////////////
Eloquent::ConsoleWriter::ConsoleWriter( const boost::property_tree::ptree::value_type& i_Config
, std::mutex& i_QueueMutex
, std::condition_variable& i_QueueCV
, std::queue<QueueItem>& i_Queue
, unsigned int& i_NumWriters )
: IO( i_Config, i_QueueMutex, i_QueueCV, i_Queue, i_NumWriters )
{}
Eloquent::ConsoleWriter::~ConsoleWriter() {}
void Eloquent::ConsoleWriter::operator()() {
while( true ) {
try {
QueueItem& Item = NextQueueItem();
std::cout << Item.Data() << std::endl;
} catch( const std::exception& e ) {
syslog( LOG_ERR, "%s #Error #Writer #ConsoleWriter", e.what() );
} catch( ... ) {
syslog( LOG_ERR, "unknown exception #Error #Attention #Writer #ConsoleWriter" );
delete this;
}
}
}
| 26.5
| 95
| 0.555746
|
nwehr
|
012d1231af47e0b07d3a5f2b318dec47eac0278a
| 733
|
cpp
|
C++
|
src/commands/sd_mount_status_command.cpp
|
JoeGilkey/vi-firmware
|
fb8392bbc60f161607625e51e07c03bce2ec3d9e
|
[
"BSD-3-Clause"
] | 148
|
2015-01-01T18:32:25.000Z
|
2022-03-05T12:02:24.000Z
|
src/commands/sd_mount_status_command.cpp
|
ankhntaijitu/vi-firmware
|
fb8392bbc60f161607625e51e07c03bce2ec3d9e
|
[
"BSD-3-Clause"
] | 109
|
2015-02-11T16:33:49.000Z
|
2021-01-04T16:14:00.000Z
|
src/commands/sd_mount_status_command.cpp
|
ankhntaijitu/vi-firmware
|
fb8392bbc60f161607625e51e07c03bce2ec3d9e
|
[
"BSD-3-Clause"
] | 89
|
2015-02-04T00:39:29.000Z
|
2021-10-03T00:01:17.000Z
|
#include "version_command.h"
#include "config.h"
#include "diagnostics.h"
#include "interface/usb.h"
#include "util/log.h"
#include "config.h"
#include "pb_decode.h"
#include <payload/payload.h>
#include "signals.h"
#include <can/canutil.h>
#include <bitfield/bitfield.h>
#include <limits.h>
#include "sd_mount_status_command.h"
#include "interface/fs.h"
using openxc::util::log::debug;
bool openxc::commands::handleSDMountStatusCommand() {
bool status = false;
#ifdef FS_SUPPORT
status = openxc::interface::fs::getSDStatus(); //returns true if SD card was initialized correctly
#endif
sendCommandResponse(openxc_ControlCommand_Type_SD_MOUNT_STATUS, status,
NULL, 0);
return status;
}
| 22.212121
| 100
| 0.718963
|
JoeGilkey
|
012ee0669647e78ada910b8e5bf3aed68c3cceab
| 1,339
|
cpp
|
C++
|
modules/task_1/popp_m_max_value_of_matrix/max_value_of_matrix.cpp
|
Oskg/pp_2021_autumn
|
c05d35f4d4b324cc13e58188b4a0c0174f891976
|
[
"BSD-3-Clause"
] | 1
|
2021-12-09T17:20:25.000Z
|
2021-12-09T17:20:25.000Z
|
modules/task_1/popp_m_max_value_of_matrix/max_value_of_matrix.cpp
|
Oskg/pp_2021_autumn
|
c05d35f4d4b324cc13e58188b4a0c0174f891976
|
[
"BSD-3-Clause"
] | null | null | null |
modules/task_1/popp_m_max_value_of_matrix/max_value_of_matrix.cpp
|
Oskg/pp_2021_autumn
|
c05d35f4d4b324cc13e58188b4a0c0174f891976
|
[
"BSD-3-Clause"
] | 3
|
2022-02-23T14:20:50.000Z
|
2022-03-30T09:00:02.000Z
|
// Copyright 2021 Popp Maksim
#include <mpi.h>
#include <random>
#include "../../../modules/task_1/popp_m_max_value_of_matrix/max_value_of_matrix.h"
int searchMaxSequentially(int* arr, int k, int l) {
int max = arr[0];
for (int i = 1; i < k * l; i++)
if (max < arr[i]) {
max = arr[i];
}
return max;
}
int* generateMatrixRandom(int k, int l) {
std::random_device dev;
std::mt19937 gen(dev());
int* matrix = new int[k * l];
for (int i = 0; i < k * l; i++) { matrix[i] = gen() % 100; }
return matrix;
}
int findingMaxInParallel(int* arr, int k, int l) {
int size, rank;
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
const int counterOfElem = k * l / size;
const int difference = k * l % size;
int* matrix = new int[counterOfElem];
MPI_Scatter(arr + difference, counterOfElem, MPI_INT,
matrix, counterOfElem, MPI_INT, 0, MPI_COMM_WORLD);
int simpleMax = searchMaxSequentially(matrix, 1, counterOfElem);
int hardMax = matrix[0];
MPI_Reduce(&simpleMax, &hardMax, 1, MPI_INT, MPI_MAX, 0, MPI_COMM_WORLD);
if (rank == 0) {
for (int i = 0; i < difference; i++) {
if (hardMax < arr[i]) {
hardMax = arr[i];
}
}
}
return hardMax;
}
| 24.796296
| 83
| 0.584018
|
Oskg
|
01345605bc1f3c62fa5724499e3b42363548a2e7
| 6,853
|
hpp
|
C++
|
src/src_c/MultiGrid/Pimpact_CoarsenStrategyGlobal.hpp
|
huppd/PINTimpact
|
766b2ef4d2fa9e6727965e48a3fba7b752074850
|
[
"MIT"
] | null | null | null |
src/src_c/MultiGrid/Pimpact_CoarsenStrategyGlobal.hpp
|
huppd/PINTimpact
|
766b2ef4d2fa9e6727965e48a3fba7b752074850
|
[
"MIT"
] | null | null | null |
src/src_c/MultiGrid/Pimpact_CoarsenStrategyGlobal.hpp
|
huppd/PINTimpact
|
766b2ef4d2fa9e6727965e48a3fba7b752074850
|
[
"MIT"
] | null | null | null |
/// Pimpact
/// \author huppd
/// \date 2018
#pragma once
#ifndef PIMPACT_COARSENSTRATEGYGLOBAL_HPP
#define PIMPACT_COARSENSTRATEGYGLOBAL_HPP
#include "Teuchos_Array.hpp"
#include "Teuchos_RCP.hpp"
#include "Pimpact_Grid.hpp"
namespace Pimpact {
/// \brief first model implementation, where one coarsens until every processor has 3 dofs.
///
/// \tparam FGridT grid on finest level not necessary the same for the coarse grids(difference in \c dim_nc).
/// it should be that the coardinates are taken from the fine grid and are halved.
/// \note compute coordinates correctly (grid stretching only on finest grid, afterwards simple coarsening),
/// cleanest version would be to use same grid stretching on every level, makes
/// interpolation and restriction slightly more complicated.
///\note the \c CGridT parameter allows even smaller Grids nLoc=1 but therefore
///the exception in GridSilzeLocal has to be adapted on StencilWidths
/// \ingroup MG
/// \note add template parameter for coarses gridSize, and some procGrid stuff
template<class FGridT, class CGT, int cgsize=9>
class CoarsenStrategyGlobal {
public:
using GridT = FGridT;
using CGridT = CGT;
protected:
using Scalar = typename FGridT::Scalar;
using Ordinal = typename FGridT::Ordinal;
/// should be same for finest grid and coarse grids
static const int sdim = FGridT::sdim;
static const int dimension = FGridT::dimension;
using TO = typename Teuchos::Tuple<Ordinal, dimension>;
/// can be different for finest and coarse grids
static const int dimNCF = FGridT::dimNC;
static const int dimNCC = CGridT::dimNC;
public:
/// \todo make interface if spectral refinment is desired or not
static std::vector<Teuchos::RCP<const CGridT> > getMultiGrid(
const Teuchos::RCP<const FGridT> grid,
int maxGrids=10) {
Teuchos::RCP<const CGridT> tempGrid = createGrid<CGridT, FGridT>(grid);
std::vector<Teuchos::RCP<const CGridT> > multiGrid(1, tempGrid);
GridSizeGlobal<Ordinal, sdim> nGlo = *grid->getGridSizeGlobal();
bool spectralT = grid->getStencilWidths()->spectralT();
Teuchos::Tuple<bool, 4> coarsen_dir;
TO npWorld = grid->getProcGrid()->getNP();
TO np = npWorld;
TO npNew = np;
TO ibWorld = grid->getProcGrid()->getIB();
TO stride;
for(Ordinal i=0; i<dimension; ++i)
stride[i] = 1;
// just to figure out amount of grids
for(int i=1; i<maxGrids; ++i) {
bool coarsen_yes = false;
bool procGridChanged=false;
for(int dir=0; dir<dimension; ++dir) {
if(dir<3) {
// figure out if global problem can be coarsened
if(((nGlo[dir]-1)%2)==0 && nGlo[dir]>=cgsize) {
nGlo[dir] = (nGlo[dir]-1)/2 + 1;
coarsen_yes = true;
}
// figure out if processor grid has to be coarsened
npNew[dir] = 1;
for(int p=2; p<=np[dir]; ++p) {
if(((nGlo[dir]-1)%p)==0 && (np[dir]%p)==0)
if(((nGlo[dir]-1)/p)%2==0 && (nGlo[dir]-1)/p>=2)
npNew[dir] = p;
}
//--- enforce gathering of coarsest grid to one processor ---
//if(((nGlo[dir]-1)%2!=0 || nGlo[dir]<cgsize || i==maxGrids-1))
if(((nGlo[dir]-1)%2!=0 || nGlo[dir]<cgsize))
npNew[dir] = 1;
//multiGrid.push_back(createCoarseGrid(multiGrid.back(), coarsen_dir, nGlo, stride, NB, IB, i==maxGrids-1));
//}
//}
//std::ofstream file;
//std::string fname = "mgs.txt";
//fname.insert(3, std::to_string((long long)grid->rankST()));
//file.open(fname, std::ofstream::out | std::ofstream::app);
//file << "\n\ngrid: " << -1 << "\n\n";
//multiGrid.back()->print(file);
//file.close();
//}
//// not working on brutus
////multiGrid.shrink_to_fit();
//return multiGrid;
//}
//protected:
//template<class GridT>
//static Teuchos::RCP<const GridT > createCoarseGrid(
//const Teuchos::RCP<const GridT>& grid,
//const Teuchos::Tuple<bool, dimension>& coarsen_dir,
//const Teuchos::Tuple<Ordinal, 4>& gridSizeGlobalTup,
//TO& stride,
//const TO& NB,
//const TO& IB,
//bool maxGrid_yes=false) {
//auto stencilWidths = grid->getStencilWidths();
//auto domain = grid->getDomain();
//auto boundaryConditionsGlobal = domain->getBCGlobal();
//auto boundaryConditionsLocal = domain->getBCLocal();
//// coarsen gridSizeGlobal
//// std::cout << "rank: " << grid->rankST()<< "\t gridSizGLobal: " << gridSizeGlobalTup << "\n";
//auto gridSizeGlobal = createGridSizeGlobal<Ordinal, dimension>(gridSizeGlobalTup);
//auto procGridSize = grid->getProcGridSize();
//auto procGrid = grid->getProcGrid();
//TO np = grid->getProcGridSize()->getTuple();
//TO npNew = np;
//// std::cout << "rank: " << grid->rankST()<< "\t procGridSizOld: " << npNew << "\n";
//// for(int i=0; i<dimension; ++i) {
//for(int i=0; i<3; ++i) {
//if(i<3) {
//if(coarsen_dir[i]) {
//npNew[i] = 1;
//for(int j=2; j<np[i]; ++j) {
//if(((gridSizeGlobalTup[i]-1)%j)==0 && (np[i]%j)==0)
//if(((gridSizeGlobalTup[i]-1)/j)%2==0 && (gridSizeGlobalTup[i]-1)/j>=2)
//npNew[i] = j;
//}
//// --- enforce gathering of coarsest grid to one processor ---
//if(((gridSizeGlobalTup[i]-1)%2!=0 || gridSizeGlobalTup[i]<cgsize || maxGrid_yes) && npNew[i]>1)
//npNew[i] = 1;
} else
// figure out if global problem can be coarsened
if((!spectralT) && (nGlo[dir]%2)==0 && nGlo[dir]>1 && nGlo[dir]/2>=grid->getProcGrid()->getNP(dir)) {
nGlo[dir] = nGlo[dir]/2;
coarsen_yes = true;
}
if(np[dir]!=npNew[dir])
procGridChanged=true;
}
// std::cout << "grid: " << i << "\n";
// std::cout << "corasen_yes: " << coarsen_yes << "\n";
// std::cout << "procGridChanged: " << procGridChanged << "\n";
// std::cout << "nGlo: " << nGlo << "\n";
// std::cout << "npWorld: " << npWorld << "\n";
// std::cout << "np: " << np << "\n";
// std::cout << "npNew: " << npNew << "\n";
if(coarsen_yes) {
if(procGridChanged)
multiGrid.push_back(createGrid(multiGrid.back(), nGlo, npNew, stride, npWorld, ibWorld));
else
multiGrid.push_back(createGrid(multiGrid.back(), nGlo));
}
np = npNew;
}
// not working on brutus
//multiGrid.shrink_to_fit();
return multiGrid;
}
}; // end of class CoarsenStrategyGlobal
} // end of namespace Pimpact
#endif // end of #ifndef PIMPACT_COARSENSTRATEGYGLOBAL_HPP
| 32.173709
| 118
| 0.584707
|
huppd
|
013887115651ceb1f34d8832e853b25b0dbea7fe
| 7,272
|
cpp
|
C++
|
src/dlib/test/lspi.cpp
|
prathyusha12924/eye-gaze
|
a80ad54b46e9cef4e743b53aaff035de83f27154
|
[
"MIT"
] | 11,719
|
2015-01-03T22:38:57.000Z
|
2022-03-30T21:45:04.000Z
|
dlib/test/lspi.cpp
|
KiLJ4EdeN/dlib
|
eb1f08ce6ab3ca6f9d10425d899103de3c0df56c
|
[
"BSL-1.0"
] | 2,518
|
2015-01-04T04:38:06.000Z
|
2022-03-31T11:55:43.000Z
|
dlib/test/lspi.cpp
|
KiLJ4EdeN/dlib
|
eb1f08ce6ab3ca6f9d10425d899103de3c0df56c
|
[
"BSL-1.0"
] | 3,308
|
2015-01-01T14:34:16.000Z
|
2022-03-31T07:20:07.000Z
|
// Copyright (C) 2015 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#include "tester.h"
#include <dlib/control.h>
#include <vector>
#include <sstream>
#include <ctime>
namespace
{
using namespace test;
using namespace dlib;
using namespace std;
dlib::logger dlog("test.lspi");
template <bool have_prior>
struct chain_model
{
typedef int state_type;
typedef int action_type; // 0 is move left, 1 is move right
const static bool force_last_weight_to_1 = have_prior;
const static int num_states = 4; // not required in the model interface
matrix<double,8,1> offset;
chain_model()
{
offset =
2.048 ,
2.56 ,
2.048 ,
3.2 ,
2.56 ,
4 ,
3.2,
5 ;
if (!have_prior)
offset = 0;
}
unsigned long num_features(
) const
{
if (have_prior)
return num_states*2 + 1;
else
return num_states*2;
}
action_type find_best_action (
const state_type& state,
const matrix<double,0,1>& w
) const
{
if (w(state*2)+offset(state*2) >= w(state*2+1)+offset(state*2+1))
//if (w(state*2) >= w(state*2+1))
return 0;
else
return 1;
}
void get_features (
const state_type& state,
const action_type& action,
matrix<double,0,1>& feats
) const
{
feats.set_size(num_features());
feats = 0;
feats(state*2 + action) = 1;
if (have_prior)
feats(num_features()-1) = offset(state*2+action);
}
};
void test_lspi_prior1()
{
print_spinner();
typedef process_sample<chain_model<true> > sample_type;
std::vector<sample_type> samples;
samples.push_back(sample_type(0,0,0,0));
samples.push_back(sample_type(0,1,1,0));
samples.push_back(sample_type(1,0,0,0));
samples.push_back(sample_type(1,1,2,0));
samples.push_back(sample_type(2,0,1,0));
samples.push_back(sample_type(2,1,3,0));
samples.push_back(sample_type(3,0,2,0));
samples.push_back(sample_type(3,1,3,1));
lspi<chain_model<true> > trainer;
//trainer.be_verbose();
trainer.set_lambda(0);
policy<chain_model<true> > pol = trainer.train(samples);
dlog << LINFO << pol.get_weights();
matrix<double,0,1> w = pol.get_weights();
DLIB_TEST(pol.get_weights().size() == 9);
DLIB_TEST(w(w.size()-1) == 1);
w(w.size()-1) = 0;
DLIB_TEST_MSG(length(w) < 1e-12, length(w));
dlog << LINFO << "action: " << pol(0);
dlog << LINFO << "action: " << pol(1);
dlog << LINFO << "action: " << pol(2);
dlog << LINFO << "action: " << pol(3);
DLIB_TEST(pol(0) == 1);
DLIB_TEST(pol(1) == 1);
DLIB_TEST(pol(2) == 1);
DLIB_TEST(pol(3) == 1);
}
void test_lspi_prior2()
{
print_spinner();
typedef process_sample<chain_model<true> > sample_type;
std::vector<sample_type> samples;
samples.push_back(sample_type(0,0,0,0));
samples.push_back(sample_type(0,1,1,0));
samples.push_back(sample_type(1,0,0,0));
samples.push_back(sample_type(1,1,2,0));
samples.push_back(sample_type(2,0,1,0));
samples.push_back(sample_type(2,1,3,1));
samples.push_back(sample_type(3,0,2,0));
samples.push_back(sample_type(3,1,3,0));
lspi<chain_model<true> > trainer;
//trainer.be_verbose();
trainer.set_lambda(0);
policy<chain_model<true> > pol = trainer.train(samples);
dlog << LINFO << "action: " << pol(0);
dlog << LINFO << "action: " << pol(1);
dlog << LINFO << "action: " << pol(2);
dlog << LINFO << "action: " << pol(3);
DLIB_TEST(pol(0) == 1);
DLIB_TEST(pol(1) == 1);
DLIB_TEST(pol(2) == 1);
DLIB_TEST(pol(3) == 0);
}
void test_lspi_noprior1()
{
print_spinner();
typedef process_sample<chain_model<false> > sample_type;
std::vector<sample_type> samples;
samples.push_back(sample_type(0,0,0,0));
samples.push_back(sample_type(0,1,1,0));
samples.push_back(sample_type(1,0,0,0));
samples.push_back(sample_type(1,1,2,0));
samples.push_back(sample_type(2,0,1,0));
samples.push_back(sample_type(2,1,3,0));
samples.push_back(sample_type(3,0,2,0));
samples.push_back(sample_type(3,1,3,1));
lspi<chain_model<false> > trainer;
//trainer.be_verbose();
trainer.set_lambda(0.01);
policy<chain_model<false> > pol = trainer.train(samples);
dlog << LINFO << pol.get_weights();
DLIB_TEST(pol.get_weights().size() == 8);
dlog << LINFO << "action: " << pol(0);
dlog << LINFO << "action: " << pol(1);
dlog << LINFO << "action: " << pol(2);
dlog << LINFO << "action: " << pol(3);
DLIB_TEST(pol(0) == 1);
DLIB_TEST(pol(1) == 1);
DLIB_TEST(pol(2) == 1);
DLIB_TEST(pol(3) == 1);
}
void test_lspi_noprior2()
{
print_spinner();
typedef process_sample<chain_model<false> > sample_type;
std::vector<sample_type> samples;
samples.push_back(sample_type(0,0,0,0));
samples.push_back(sample_type(0,1,1,0));
samples.push_back(sample_type(1,0,0,0));
samples.push_back(sample_type(1,1,2,1));
samples.push_back(sample_type(2,0,1,0));
samples.push_back(sample_type(2,1,3,0));
samples.push_back(sample_type(3,0,2,0));
samples.push_back(sample_type(3,1,3,0));
lspi<chain_model<false> > trainer;
//trainer.be_verbose();
trainer.set_lambda(0.01);
policy<chain_model<false> > pol = trainer.train(samples);
dlog << LINFO << pol.get_weights();
DLIB_TEST(pol.get_weights().size() == 8);
dlog << LINFO << "action: " << pol(0);
dlog << LINFO << "action: " << pol(1);
dlog << LINFO << "action: " << pol(2);
dlog << LINFO << "action: " << pol(3);
DLIB_TEST(pol(0) == 1);
DLIB_TEST(pol(1) == 1);
DLIB_TEST(pol(2) == 0);
DLIB_TEST(pol(3) == 0);
}
class lspi_tester : public tester
{
public:
lspi_tester (
) :
tester (
"test_lspi", // the command line argument name for this test
"Run tests on the lspi object.", // the command line argument description
0 // the number of command line arguments for this test
)
{
}
void perform_test (
)
{
test_lspi_prior1();
test_lspi_prior2();
test_lspi_noprior1();
test_lspi_noprior2();
}
};
lspi_tester a;
}
| 28.07722
| 91
| 0.528878
|
prathyusha12924
|
013913dbfd0f4bd1dda1186a04d272d5319904a4
| 1,438
|
cc
|
C++
|
src/q_351_400/q0387.cc
|
vNaonLu/daily-leetcode
|
2830c2cd413d950abe7c6d9b833c771f784443b0
|
[
"MIT"
] | 2
|
2021-09-28T18:41:03.000Z
|
2021-09-28T18:42:57.000Z
|
src/q_351_400/q0387.cc
|
vNaonLu/Daily_LeetCode
|
30024b561611d390931cef1b22afd6a5060cf586
|
[
"MIT"
] | 16
|
2021-09-26T11:44:20.000Z
|
2021-11-28T06:44:02.000Z
|
src/q_351_400/q0387.cc
|
vNaonLu/daily-leetcode
|
2830c2cd413d950abe7c6d9b833c771f784443b0
|
[
"MIT"
] | 1
|
2021-11-22T09:11:36.000Z
|
2021-11-22T09:11:36.000Z
|
#include <gtest/gtest.h>
#include <iostream>
#include <string>
using namespace std;
/**
* This file is generated by leetcode_add.py v1.0
*
* 387.
* First Unique Character in a String
*
* ––––––––––––––––––––––––––––– Description –––––––––––––––––––––––––––––
*
* Given a string ‘s’ , “find the first non-repeating character in it and
* return its index” . If it does not exist, return ‘-1’ .
*
* ––––––––––––––––––––––––––––– Constraints –––––––––––––––––––––––––––––
*
* • ‘1 ≤ s.length ≤ 10⁵’
* • ‘s’ consists of only lowercase English letters.
*
*/
struct q387 : public ::testing::Test {
// Leetcode answer here
class Solution {
public:
int firstUniqChar(string s) {
vector<int> cnt(26, 0);
for (const auto &c : s) ++cnt[c - 'a'];
for (int i = 0; i < s.size(); ++i)
if (cnt[s[i] - 'a'] == 1) return i;
return -1;
}
};
class Solution *solution;
};
TEST_F(q387, sample_input01) {
solution = new Solution();
string s = "leetcode";
int exp = 0;
EXPECT_EQ(solution->firstUniqChar(s), exp);
delete solution;
}
TEST_F(q387, sample_input02) {
solution = new Solution();
string s = "loveleetcode";
int exp = 2;
EXPECT_EQ(solution->firstUniqChar(s), exp);
delete solution;
}
TEST_F(q387, sample_input03) {
solution = new Solution();
string s = "aabb";
int exp = -1;
EXPECT_EQ(solution->firstUniqChar(s), exp);
delete solution;
}
| 22.825397
| 75
| 0.565369
|
vNaonLu
|
0141138cb2b754fd7d615561bc75ae582f0b4094
| 38
|
hpp
|
C++
|
src/boost_fusion_mpl_erase.hpp
|
miathedev/BoostForArduino
|
919621dcd0c157094bed4df752b583ba6ea6409e
|
[
"BSL-1.0"
] | 10
|
2018-03-17T00:58:42.000Z
|
2021-07-06T02:48:49.000Z
|
src/boost_fusion_mpl_erase.hpp
|
miathedev/BoostForArduino
|
919621dcd0c157094bed4df752b583ba6ea6409e
|
[
"BSL-1.0"
] | 2
|
2021-03-26T15:17:35.000Z
|
2021-05-20T23:55:08.000Z
|
src/boost_fusion_mpl_erase.hpp
|
miathedev/BoostForArduino
|
919621dcd0c157094bed4df752b583ba6ea6409e
|
[
"BSL-1.0"
] | 4
|
2019-05-28T21:06:37.000Z
|
2021-07-06T03:06:52.000Z
|
#include <boost/fusion/mpl/erase.hpp>
| 19
| 37
| 0.763158
|
miathedev
|
01432332f7fec156396e1962d9855c23c8c049d2
| 15,143
|
hpp
|
C++
|
external/openglcts/modules/common/subgroups/glcSubgroupsTestsUtils.hpp
|
tarceri/VK-GL-CTS
|
22389a0e44f458492f594ca0553a5a67cf6c7ada
|
[
"Apache-2.0"
] | 1
|
2021-07-15T23:37:39.000Z
|
2021-07-15T23:37:39.000Z
|
external/openglcts/modules/common/subgroups/glcSubgroupsTestsUtils.hpp
|
tarceri/VK-GL-CTS
|
22389a0e44f458492f594ca0553a5a67cf6c7ada
|
[
"Apache-2.0"
] | 1
|
2021-03-22T09:53:25.000Z
|
2021-03-22T09:53:25.000Z
|
external/openglcts/modules/common/subgroups/glcSubgroupsTestsUtils.hpp
|
tarceri/VK-GL-CTS
|
22389a0e44f458492f594ca0553a5a67cf6c7ada
|
[
"Apache-2.0"
] | null | null | null |
#ifndef _GLCSUBGROUPSTESTSUTILS_HPP
#define _GLCSUBGROUPSTESTSUTILS_HPP
/*------------------------------------------------------------------------
* OpenGL Conformance Tests
* ------------------------
*
* Copyright (c) 2017-2019 The Khronos Group Inc.
* Copyright (c) 2017 Codeplay Software Ltd.
* Copyright (c) 2019 NVIDIA Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/ /*!
* \file
* \brief Subgroups tests utility classes
*/ /*--------------------------------------------------------------------*/
#include "deDefs.hpp"
#include "deSTLUtil.hpp"
#include "deStringUtil.hpp"
#include "glwEnums.hpp"
#include "glwFunctions.hpp"
#include "glwDefs.hpp"
#include "tcuDefs.hpp"
#include "tcuTestCase.hpp"
#include "glcTestCase.hpp"
#include "glcSpirvUtils.hpp"
#include "tcuFormatUtil.hpp"
#include "tcuTestLog.hpp"
#include "tcuVectorUtil.hpp"
#include "gluShaderUtil.hpp"
#include "gluContextInfo.hpp"
#include "deSharedPtr.hpp"
#include "deUniquePtr.hpp"
#include <string>
namespace glc
{
enum ShaderType
{
SHADER_TYPE_GLSL = 0,
SHADER_TYPE_SPIRV,
SHADER_TYPE_LAST
};
template<typename Program>
class ProgramCollection
{
public:
ProgramCollection (void);
~ProgramCollection (void);
void clear (void);
Program& add (const std::string& name);
void add (const std::string& name, de::MovePtr<Program>& program);
bool contains (const std::string& name) const;
const Program& get (const std::string& name) const;
class Iterator
{
private:
typedef typename std::map<std::string, Program*>::const_iterator IteratorImpl;
public:
explicit Iterator (const IteratorImpl& i) : m_impl(i) {}
Iterator& operator++ (void) { ++m_impl; return *this; }
const Program& operator* (void) const { return getProgram(); }
const std::string& getName (void) const { return m_impl->first; }
const Program& getProgram (void) const { return *m_impl->second; }
bool operator== (const Iterator& other) const { return m_impl == other.m_impl; }
bool operator!= (const Iterator& other) const { return m_impl != other.m_impl; }
private:
IteratorImpl m_impl;
};
Iterator begin (void) const { return Iterator(m_programs.begin()); }
Iterator end (void) const { return Iterator(m_programs.end()); }
bool empty (void) const { return m_programs.empty(); }
private:
typedef std::map<std::string, Program*> ProgramMap;
ProgramMap m_programs;
};
template<typename Program>
ProgramCollection<Program>::ProgramCollection (void)
{
}
template<typename Program>
ProgramCollection<Program>::~ProgramCollection (void)
{
clear();
}
template<typename Program>
void ProgramCollection<Program>::clear (void)
{
for (typename ProgramMap::const_iterator i = m_programs.begin(); i != m_programs.end(); ++i)
delete i->second;
m_programs.clear();
}
template<typename Program>
Program& ProgramCollection<Program>::add (const std::string& name)
{
DE_ASSERT(!contains(name));
de::MovePtr<Program> prog = de::newMovePtr<Program>();
m_programs[name] = prog.get();
prog.release();
return *m_programs[name];
}
template<typename Program>
void ProgramCollection<Program>::add (const std::string& name, de::MovePtr<Program>& program)
{
DE_ASSERT(!contains(name));
m_programs[name] = program.get();
program.release();
}
template<typename Program>
bool ProgramCollection<Program>::contains (const std::string& name) const
{
return de::contains(m_programs, name);
}
template<typename Program>
const Program& ProgramCollection<Program>::get (const std::string& name) const
{
DE_ASSERT(contains(name));
return *m_programs.find(name)->second;
}
struct GlslSource
{
std::vector<std::string> sources[glu::SHADERTYPE_LAST];
GlslSource& operator<< (const glu::ShaderSource& shaderSource)
{
sources[shaderSource.shaderType].push_back(shaderSource.source);
return *this;
}
};
typedef ProgramCollection<GlslSource> SourceCollections;
class Context
{
public:
Context (deqp::Context& deqpCtx)
: m_deqpCtx(deqpCtx)
, m_sourceCollection()
, m_glslVersion(glu::getContextTypeGLSLVersion(m_deqpCtx.getRenderContext().getType()))
, m_shaderType(SHADER_TYPE_GLSL)
{}
~Context (void) {}
deqp::Context& getDeqpContext (void) const { return m_deqpCtx; }
SourceCollections& getSourceCollection (void) { return m_sourceCollection; }
glu::GLSLVersion getGLSLVersion (void) { return m_glslVersion; }
ShaderType getShaderType (void) { return m_shaderType; }
void setShaderType (ShaderType type) { m_shaderType = type; }
protected:
deqp::Context& m_deqpCtx;
SourceCollections m_sourceCollection;
glu::GLSLVersion m_glslVersion;
ShaderType m_shaderType;
};
namespace subgroups
{
template<typename Arg0>
class SubgroupFactory : public deqp::TestCase
{
public:
//void initPrograms(SourceCollections& programCollection, CaseDefinition caseDef)
typedef void (*InitFunction)(SourceCollections& programCollection, Arg0 arg0);
//void supportedCheck (Context& context, CaseDefinition caseDef)
typedef void (*SupportFunction)(Context& context, Arg0 arg0);
//tcu::TestStatus test(Context& context, const CaseDefinition caseDef)
typedef tcu::TestStatus (*TestFunction)(Context& context, const Arg0 arg0);
/* Public methods */
SubgroupFactory(deqp::Context& context, tcu::TestNodeType type, const std::string& name, const std::string& desc,
SupportFunction suppFunc, InitFunction initFunc, TestFunction testFunc, Arg0 arg0)
: TestCase(context, type, name.c_str(), desc.c_str())
, m_supportedFunc(suppFunc)
, m_initFunc(initFunc)
, m_testFunc(testFunc)
, m_arg0(arg0)
, m_glcContext(m_context)
{}
void init()
{
m_supportedFunc(m_glcContext, m_arg0);
m_initFunc(m_glcContext.getSourceCollection(), m_arg0);
}
void deinit()
{
// nothing to do
}
tcu::TestNode::IterateResult iterate()
{
DE_ASSERT(m_testFunc);
tcu::TestLog& log = m_testCtx.getLog();
try {
// do SPIRV version of tests if supported
log << tcu::TestLog::Message << "SPIRV pass beginning..." << tcu::TestLog::EndMessage;
spirvUtils::checkGlSpirvSupported(m_glcContext.getDeqpContext());
m_glcContext.setShaderType(SHADER_TYPE_SPIRV);
const tcu::TestStatus result = m_testFunc(m_glcContext, m_arg0);
if (result.isComplete())
{
DE_ASSERT(m_testCtx.getTestResult() == QP_TEST_RESULT_LAST);
if (result.getCode() == QP_TEST_RESULT_PASS)
{
log << tcu::TestLog::Message << "SPIRV pass completed successfully ("
<< result.getDescription() << ")." << tcu::TestLog::EndMessage;
} else {
// test failed - log result and stop
m_testCtx.setTestResult(result.getCode(), result.getDescription().c_str());
return tcu::TestNode::STOP;
}
}
} catch(tcu::NotSupportedError& e)
{
log << tcu::TestLog::Message << "SPIRV pass skipped ("
<< e.getMessage() << ")." << tcu::TestLog::EndMessage;
}
// do GLSL version of the tests
log << tcu::TestLog::Message << "GLSL pass beginning..." << tcu::TestLog::EndMessage;
m_glcContext.setShaderType(SHADER_TYPE_GLSL);
const tcu::TestStatus result = m_testFunc(m_glcContext, m_arg0);
if (result.isComplete())
{
DE_ASSERT(m_testCtx.getTestResult() == QP_TEST_RESULT_LAST);
log << tcu::TestLog::Message << "GLSL pass completed successfully ("
<< result.getDescription() << ")." << tcu::TestLog::EndMessage;
m_testCtx.setTestResult(result.getCode(), result.getDescription().c_str());
return tcu::TestNode::STOP;
}
return tcu::TestNode::CONTINUE;
}
static void addFunctionCaseWithPrograms (deqp::TestCaseGroup* group,
const std::string& name,
const std::string& desc,
SupportFunction suppFunc,
InitFunction initFunc,
TestFunction testFunc,
Arg0 arg0)
{
group->addChild(new SubgroupFactory(group->getContext(), tcu::NODETYPE_SELF_VALIDATE, name, desc, suppFunc, initFunc, testFunc, arg0));
}
private:
SupportFunction m_supportedFunc;
InitFunction m_initFunc;
TestFunction m_testFunc;
Arg0 m_arg0;
Context m_glcContext;
};
typedef enum ShaderStageFlags
{
SHADER_STAGE_VERTEX_BIT = GL_VERTEX_SHADER_BIT,
SHADER_STAGE_FRAGMENT_BIT = GL_FRAGMENT_SHADER_BIT,
SHADER_STAGE_GEOMETRY_BIT = GL_GEOMETRY_SHADER_BIT,
SHADER_STAGE_TESS_CONTROL_BIT = GL_TESS_CONTROL_SHADER_BIT,
SHADER_STAGE_TESS_EVALUATION_BIT = GL_TESS_EVALUATION_SHADER_BIT,
SHADER_STAGE_COMPUTE_BIT = GL_COMPUTE_SHADER_BIT,
SHADER_STAGE_ALL_GRAPHICS = (SHADER_STAGE_VERTEX_BIT | SHADER_STAGE_FRAGMENT_BIT | SHADER_STAGE_GEOMETRY_BIT |
SHADER_STAGE_TESS_CONTROL_BIT | SHADER_STAGE_TESS_EVALUATION_BIT ),
SHADER_STAGE_ALL_VALID = (SHADER_STAGE_ALL_GRAPHICS | SHADER_STAGE_COMPUTE_BIT),
} ShaderStageFlags;
typedef enum SubgroupFeatureFlags
{
SUBGROUP_FEATURE_BASIC_BIT = GL_SUBGROUP_FEATURE_BASIC_BIT_KHR,
SUBGROUP_FEATURE_VOTE_BIT = GL_SUBGROUP_FEATURE_VOTE_BIT_KHR,
SUBGROUP_FEATURE_ARITHMETIC_BIT = GL_SUBGROUP_FEATURE_ARITHMETIC_BIT_KHR,
SUBGROUP_FEATURE_BALLOT_BIT = GL_SUBGROUP_FEATURE_BALLOT_BIT_KHR,
SUBGROUP_FEATURE_SHUFFLE_BIT = GL_SUBGROUP_FEATURE_SHUFFLE_BIT_KHR,
SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT = GL_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT_KHR,
SUBGROUP_FEATURE_CLUSTERED_BIT = GL_SUBGROUP_FEATURE_CLUSTERED_BIT_KHR,
SUBGROUP_FEATURE_QUAD_BIT = GL_SUBGROUP_FEATURE_QUAD_BIT_KHR,
SUBGROUP_FEATURE_PARTITIONED_BIT_NV = GL_SUBGROUP_FEATURE_PARTITIONED_BIT_NV,
SUBGROUP_FEATURE_ALL_VALID = (SUBGROUP_FEATURE_BASIC_BIT | SUBGROUP_FEATURE_VOTE_BIT | SUBGROUP_FEATURE_ARITHMETIC_BIT |
SUBGROUP_FEATURE_BALLOT_BIT | SUBGROUP_FEATURE_SHUFFLE_BIT | SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT |
SUBGROUP_FEATURE_CLUSTERED_BIT | SUBGROUP_FEATURE_QUAD_BIT | SUBGROUP_FEATURE_QUAD_BIT |
SUBGROUP_FEATURE_PARTITIONED_BIT_NV),
} SubgroupFeatureFlags;
typedef enum Format
{
FORMAT_UNDEFINED = 0,
FORMAT_R32_SINT = GL_R32I,
FORMAT_R32_UINT = GL_R32UI,
FORMAT_R32G32_SINT = GL_RG32I,
FORMAT_R32G32_UINT = GL_RG32UI,
FORMAT_R32G32B32_SINT = GL_RGB32I,
FORMAT_R32G32B32_UINT = GL_RGB32UI,
FORMAT_R32G32B32A32_SINT = GL_RGBA32I,
FORMAT_R32G32B32A32_UINT = GL_RGBA32UI,
FORMAT_R32_SFLOAT = GL_R32F,
FORMAT_R32G32_SFLOAT = GL_RG32F,
FORMAT_R32G32B32_SFLOAT = GL_RGB32F,
FORMAT_R32G32B32A32_SFLOAT = GL_RGBA32F,
FORMAT_R64_SFLOAT = 0x6000,
FORMAT_R64G64_SFLOAT,
FORMAT_R64G64B64_SFLOAT,
FORMAT_R64G64B64A64_SFLOAT,
FORMAT_R32_BOOL = 0x6100,
FORMAT_R32G32_BOOL,
FORMAT_R32G32B32_BOOL,
FORMAT_R32G32B32A32_BOOL,
} Format;
typedef enum DescriptorType
{
DESCRIPTOR_TYPE_UNIFORM_BUFFER = GL_UNIFORM_BUFFER,
DESCRIPTOR_TYPE_STORAGE_BUFFER = GL_SHADER_STORAGE_BUFFER,
DESCRIPTOR_TYPE_STORAGE_IMAGE = GL_TEXTURE_2D,
} DescriptorType;
// A struct to represent input data to a shader
struct SSBOData
{
SSBOData() :
initializeType (InitializeNone),
layout (LayoutStd140),
format (FORMAT_UNDEFINED),
numElements (0),
isImage (false),
binding (0u),
stages ((ShaderStageFlags)0u)
{}
enum InputDataInitializeType
{
InitializeNone = 0,
InitializeNonZero,
InitializeZero,
} initializeType;
enum InputDataLayoutType
{
LayoutStd140 = 0,
LayoutStd430,
LayoutPacked,
} layout;
Format format;
deUint64 numElements;
bool isImage;
deUint32 binding;
ShaderStageFlags stages;
};
std::string getSharedMemoryBallotHelper();
deUint32 getSubgroupSize(Context& context);
deUint32 maxSupportedSubgroupSize();
std::string getShaderStageName(ShaderStageFlags stage);
std::string getSubgroupFeatureName(SubgroupFeatureFlags bit);
void addNoSubgroupShader (SourceCollections& programCollection);
std::string getVertShaderForStage(ShaderStageFlags stage);
bool isSubgroupSupported(Context& context);
bool areSubgroupOperationsSupportedForStage(
Context& context, ShaderStageFlags stage);
bool areSubgroupOperationsRequiredForStage(ShaderStageFlags stage);
bool isSubgroupFeatureSupportedForDevice(Context& context, SubgroupFeatureFlags bit);
bool isFragmentSSBOSupportedForDevice(Context& context);
bool isVertexSSBOSupportedForDevice(Context& context);
bool isImageSupportedForStageOnDevice(Context& context, const ShaderStageFlags stage);
bool isDoubleSupportedForDevice(Context& context);
bool isDoubleFormat(Format format);
std::string getFormatNameForGLSL(Format format);
void addGeometryShadersFromTemplate (const std::string& glslTemplate, SourceCollections& collection);
void setVertexShaderFrameBuffer (SourceCollections& programCollection);
void setFragmentShaderFrameBuffer (SourceCollections& programCollection);
void setFragmentShaderFrameBuffer (SourceCollections& programCollection);
void setTesCtrlShaderFrameBuffer (SourceCollections& programCollection);
void setTesEvalShaderFrameBuffer (SourceCollections& programCollection);
bool check(std::vector<const void*> datas,
deUint32 width, deUint32 ref);
bool checkCompute(std::vector<const void*> datas,
const deUint32 numWorkgroups[3], const deUint32 localSize[3],
deUint32 ref);
tcu::TestStatus makeTessellationEvaluationFrameBufferTest(Context& context, Format format,
SSBOData* extraData, deUint32 extraDataCount,
bool (*checkResult)(std::vector<const void*> datas, deUint32 width, deUint32 subgroupSize),
const ShaderStageFlags shaderStage = SHADER_STAGE_ALL_GRAPHICS);
tcu::TestStatus makeGeometryFrameBufferTest(Context& context, Format format, SSBOData* extraData,
deUint32 extraDataCount,
bool (*checkResult)(std::vector<const void*> datas, deUint32 width, deUint32 subgroupSize));
tcu::TestStatus allStages(Context& context, Format format,
SSBOData* extraData, deUint32 extraDataCount,
bool (*checkResult)(std::vector<const void*> datas, deUint32 width, deUint32 subgroupSize),
const ShaderStageFlags shaderStage);
tcu::TestStatus makeVertexFrameBufferTest(Context& context, Format format,
SSBOData* extraData, deUint32 extraDataCount,
bool (*checkResult)(std::vector<const void*> datas, deUint32 width, deUint32 subgroupSize));
tcu::TestStatus makeFragmentFrameBufferTest(Context& context, Format format,
SSBOData* extraData, deUint32 extraDataCount,
bool (*checkResult)(std::vector<const void*> datas, deUint32 width,
deUint32 height, deUint32 subgroupSize));
tcu::TestStatus makeComputeTest(
Context& context, Format format, SSBOData* inputs,
deUint32 inputsCount,
bool (*checkResult)(std::vector<const void*> datas,
const deUint32 numWorkgroups[3], const deUint32 localSize[3],
deUint32 subgroupSize));
} // subgroups
} // glc
#endif // _GLCSUBGROUPSTESTSUTILS_HPP
| 31.094456
| 137
| 0.750248
|
tarceri
|
01432c3a4b4f0b32881b5c472a6cb8c130c765e8
| 1,854
|
cpp
|
C++
|
sorter.cpp
|
lorenzhs/BuRR
|
1c62832ad7d6eab5b337f386955868c3ce9a54ea
|
[
"Apache-2.0"
] | 11
|
2021-09-12T11:33:44.000Z
|
2022-02-21T11:55:14.000Z
|
sorter.cpp
|
lorenzhs/BuRR
|
1c62832ad7d6eab5b337f386955868c3ce9a54ea
|
[
"Apache-2.0"
] | null | null | null |
sorter.cpp
|
lorenzhs/BuRR
|
1c62832ad7d6eab5b337f386955868c3ce9a54ea
|
[
"Apache-2.0"
] | 1
|
2021-12-02T01:55:03.000Z
|
2021-12-02T01:55:03.000Z
|
// Copyright (c) Lorenz Hübschle-Schneider
// All Rights Reserved. This source code is licensed under the Apache 2.0
// License (found in the LICENSE file in the root directory).
#include "sorter.hpp"
#ifndef RIBBON_USE_STD_SORT
// Use in-place super-scalar radix sorter ips2ra, which is around 3x faster for
// the inputs used here
#include <ips2ra.hpp>
#endif
#include <bits/stdint-uintn.h>
#include <algorithm>
#include <functional>
template <typename Index, bool IsFilter, bool sparse, typename ResultRow>
void ribbon::Sorter<Index, IsFilter, sparse, ResultRow>::do_sort(
ribbon::Sorter<Index, IsFilter, sparse, ResultRow>::data_t *begin,
ribbon::Sorter<Index, IsFilter, sparse, ResultRow>::data_t *end,
const ribbon::MinimalHasher<Index, sparse> &mh, Index num_starts) {
using data_t = ribbon::Sorter<Index, IsFilter, sparse, ResultRow>::data_t;
auto KeyEx = [&mh, num_starts](const data_t &mhc) -> Index {
const auto hash = mh.GetHash(mhc);
const auto start = mh.GetStart(hash, num_starts);
return mh.StartToSort(start);
};
#ifdef RIBBON_USE_STD_SORT
// Use std::sort as a slow fallback
std::sort(begin, end, [&KeyEx](const auto &a, const auto &b) {
return KeyEx(a) < KeyEx(b);
});
#else
// prioritise speed over compile time
ips2ra::sort(begin, end, KeyEx);
#endif
}
// Explicit ips2ra instantiations
template class ribbon::Sorter<uint32_t, true, false, ribbon::SorterDummyData>;
template class ribbon::Sorter<uint32_t, false, false, uint8_t>;
template class ribbon::Sorter<uint32_t, false, false, uint16_t>;
// sparse configs - filter only for now
template class ribbon::Sorter<uint32_t, true, true, ribbon::SorterDummyData>;
/*
template class ribbon::Sorter<uint32_t, false, true, uint8_t>;
template class ribbon::Sorter<uint32_t, false, true, uint16_t>;
*/
| 36.352941
| 79
| 0.717907
|
lorenzhs
|
01474fef0977153e48b818d2d2218fa7237b4ee2
| 2,841
|
cpp
|
C++
|
src/plugins/liznoo/platform/winapi/fakeqwidgetwinapi.cpp
|
Maledictus/leechcraft
|
79ec64824de11780b8e8bdfd5d8a2f3514158b12
|
[
"BSL-1.0"
] | 120
|
2015-01-22T14:10:39.000Z
|
2021-11-25T12:57:16.000Z
|
src/plugins/liznoo/platform/winapi/fakeqwidgetwinapi.cpp
|
Maledictus/leechcraft
|
79ec64824de11780b8e8bdfd5d8a2f3514158b12
|
[
"BSL-1.0"
] | 8
|
2015-02-07T19:38:19.000Z
|
2017-11-30T20:18:28.000Z
|
src/plugins/liznoo/platform/winapi/fakeqwidgetwinapi.cpp
|
Maledictus/leechcraft
|
79ec64824de11780b8e8bdfd5d8a2f3514158b12
|
[
"BSL-1.0"
] | 33
|
2015-02-07T16:59:55.000Z
|
2021-10-12T00:36:40.000Z
|
/**********************************************************************
* LeechCraft - modular cross-platform feature rich internet client.
* Copyright (C) 2012 Eugene Mamin
* Copyright (C) 2006-2014 Georg Rudoy
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
**********************************************************************/
#include "fakeqwidgetwinapi.h"
#include <QDebug>
#include <objbase.h>
namespace LC
{
namespace Liznoo
{
namespace WinAPI
{
FakeQWidgetWinAPI::FakeQWidgetWinAPI (QWidget *parent)
: QWidget (parent)
{
hide ();
}
void FakeQWidgetWinAPI::prepareSchemeChange (PPOWERBROADCAST_SETTING setting)
{
const GUID newScheme =
*reinterpret_cast<GUID*> (reinterpret_cast<DWORD_PTR> (setting->Data));
QString scheme;
if (GUID_MAX_POWER_SAVINGS == newScheme)
scheme = tr ("Power saver");
else if (GUID_MIN_POWER_SAVINGS == newScheme)
scheme = tr ("High performance");
else
scheme = tr ("Balanced");
emit schemeChanged (scheme);
}
void FakeQWidgetWinAPI::preparePowerSourceChange (PPOWERBROADCAST_SETTING setting)
{
const int nPowerSrc =
*reinterpret_cast<int*> (reinterpret_cast<DWORD_PTR> (setting->Data));
const QString& powerSource = nPowerSrc ? tr ("Battery") : tr ("AC");
emit powerSourceChanged (powerSource);
}
void FakeQWidgetWinAPI::prepareBatteryStateChange (PPOWERBROADCAST_SETTING setting)
{
const int nPercentLeft =
*reinterpret_cast<int*> (reinterpret_cast<DWORD_PTR> (setting->Data));
emit batteryStateChanged (nPercentLeft);
}
void FakeQWidgetWinAPI::powerSettingsChanged (PPOWERBROADCAST_SETTING setting)
{
if (!setting)
{
qWarning()
<< Q_FUNC_INFO
<< "Null setting received";
return;
}
if (sizeof (GUID) == setting->DataLength &&
IsEqualGUID (setting->PowerSetting, GUID_POWERSCHEME_PERSONALITY))
prepareSchemeChange (setting);
else if (sizeof (int) == setting->DataLength &&
IsEqualGUID (setting->PowerSetting, GUID_ACDC_POWER_SOURCE))
preparePowerSourceChange (setting);
else if (sizeof (int) == setting->DataLength &&
IsEqualGUID (setting->PowerSetting, GUID_BATTERY_PERCENTAGE_REMAINING))
prepareBatteryStateChange (setting);
}
bool FakeQWidgetWinAPI::nativeEvent (const QByteArray &eventType, void *msg, long *result)
{
static const QByteArray kGenericMSG { "windows_generic_MSG" };
if (eventType != kGenericMSG)
return QWidget::nativeEvent (eventType, msg, result);
MSG *const message = reinterpret_cast<MSG *> (msg);
if (message->message == WM_POWERBROADCAST && message->wParam == PBT_POWERSETTINGCHANGE)
powerSettingsChanged (reinterpret_cast<PPOWERBROADCAST_SETTING> (message->lParam));
return QWidget::nativeEvent (eventType, msg, result);
}
}
}
}
| 29.59375
| 91
| 0.69905
|
Maledictus
|
0149a87c19d5119489ac1aa2f18579d41b9266b2
| 1,631
|
cpp
|
C++
|
src/parser.cpp
|
crsnplusplus/last
|
5739efcd74664787cb74c5db971808d0361e2aba
|
[
"MIT"
] | null | null | null |
src/parser.cpp
|
crsnplusplus/last
|
5739efcd74664787cb74c5db971808d0361e2aba
|
[
"MIT"
] | null | null | null |
src/parser.cpp
|
crsnplusplus/last
|
5739efcd74664787cb74c5db971808d0361e2aba
|
[
"MIT"
] | null | null | null |
#include "parser.h"
#include "lexer.h"
#include "node_ast.h"
#include "node_bop.h"
#include "node_number.h"
#include "last_exceptions.h"
#include <assert.h>
Parser::Parser(Lexer* lex) :
m_lex(lex),
m_current(m_lex->getNext())
{
}
NodeAST* Parser::parse()
{
return expression();
}
void Parser::consume(char c)
{
if (m_current == c)
m_current = m_lex->getNext();
else
throw ParseException();
}
NodeAST* Parser::factor()
{
assert(m_lex != nullptr);
char current = m_current;
if (isdigit(current)) {
if (isdigit(m_lex->peekNext())) {
// next is digit too, throwing exception
// (only single digit is supported)
throw ParseExceptionLiteralTooLong();
}
consume(current);
return new NodeNumber(current);
}
else if (current == '(') {
consume(current);
NodeAST* node = expression();
consume(')');
return node;
}
else if (current == '-') {
// unary operator not supported
throw ParseExceptionUnaryMinusNotPermitted();
}
return nullptr;
}
NodeAST* Parser::term()
{
assert(m_lex != nullptr);
NodeAST* node = factor();
while (m_current == '*' || m_current == '/') {
char current = m_current;
consume(current);
NodeAST* newNode = new NodeBinaryOperator(node, current, term());
node = newNode;
}
return node;
}
NodeAST* Parser::expression()
{
assert(m_lex != nullptr);
NodeAST* node = term();
while (m_current == '+' || m_current == '-') {
char current = m_current;
consume(current);
NodeAST* newNode = new NodeBinaryOperator(node, current, term());
node = newNode;
}
return node;
}
| 18.325843
| 69
| 0.626609
|
crsnplusplus
|
014e002d891f8c4b5e10b65137f5a9691adb0844
| 43,313
|
cpp
|
C++
|
Tools/KFModTool/games/kf2.cpp
|
IvanDSM/KingsFieldRE
|
b22549a7e93e3c0e77433d7bea8bbde6a5b9f6a3
|
[
"MIT"
] | 16
|
2020-07-09T15:38:41.000Z
|
2022-03-03T19:05:24.000Z
|
Tools/KFModTool/games/kf2.cpp
|
IvanDSM/KingsFieldRE
|
b22549a7e93e3c0e77433d7bea8bbde6a5b9f6a3
|
[
"MIT"
] | 7
|
2020-07-03T22:38:24.000Z
|
2022-01-09T18:25:22.000Z
|
Tools/KFModTool/games/kf2.cpp
|
IvanDSM/KingsFieldRE
|
b22549a7e93e3c0e77433d7bea8bbde6a5b9f6a3
|
[
"MIT"
] | 2
|
2021-08-23T08:25:44.000Z
|
2022-01-09T16:05:46.000Z
|
#include "kf2.h"
#include <QLineEdit>
QString KingsFieldII::KF2UTextCodec::convertToUnicode(const char* in,
int length,
QTextCodec::ConverterState* state) const
{
QString result;
result.resize(length);
int remaining = 0;
int invalid = 0;
for (int i = 0; i < length; i++)
{
switch (in[i])
{
case 0x0: result[i] = 'A'; break;
case 0x1: result[i] = 'B'; break;
case 0x2: result[i] = 'C'; break;
case 0x3: result[i] = 'D'; break;
case 0x4: result[i] = 'E'; break;
case 0x5: result[i] = 'F'; break;
case 0x6: result[i] = 'G'; break;
case 0x7: result[i] = 'H'; break;
case 0x8: result[i] = 'I'; break;
case 0x9: result[i] = 'J'; break;
case 0xa: result[i] = 'K'; break;
case 0xb: result[i] = 'L'; break;
case 0xc: result[i] = 'M'; break;
case 0xd: result[i] = 'N'; break;
case 0xe: result[i] = 'O'; break;
case 0xf: result[i] = 'P'; break;
case 0x10: result[i] = 'Q'; break;
case 0x11: result[i] = 'R'; break;
case 0x12: result[i] = 'S'; break;
case 0x13: result[i] = 'T'; break;
case 0x14: result[i] = 'U'; break;
case 0x15: result[i] = 'V'; break;
case 0x16: result[i] = 'W'; break;
case 0x17: result[i] = 'X'; break;
case 0x18: result[i] = 'Y'; break;
case 0x19: result[i] = 'Z'; break;
case 0x20: result[i] = '0'; break;
case 0x21: result[i] = '1'; break;
case 0x22: result[i] = '2'; break;
case 0x23: result[i] = '3'; break;
case 0x24: result[i] = '4'; break;
case 0x25: result[i] = '5'; break;
case 0x26: result[i] = '6'; break;
case 0x27: result[i] = '7'; break;
case 0x28: result[i] = '8'; break;
case 0x29: result[i] = '9'; break;
case 0x30: result[i] = '.'; break;
case 0x31: result[i] = ','; break;
case 0x32: result[i] = '\''; break;
case 0x33: result[i] = '-'; break;
case 0x34: result[i] = '='; break;
case 0x35: result[i] = '/'; break;
case 0x36: result[i] = '*'; break;
case 0x37: result[i] = '#'; break;
case 0x38: result[i] = '!'; break;
case 0x39: result[i] = L'•'; break;
case 0x3a: result[i] = '?'; break;
case 0x7f: result[i] = ' '; break;
case static_cast<char>(0xffu):
result[i] = '\0';
remaining = length - i;
result.resize(i);
i = length;
break;
default: invalid++;
}
}
if (state != nullptr)
{
state->invalidChars = invalid;
state->remainingChars = remaining;
}
return result;
}
QByteArray KingsFieldII::KF2UTextCodec::convertFromUnicode(const QChar* in,
int length,
QTextCodec::ConverterState* state) const
{
QByteArray result;
result.resize(length);
int remaining = 0;
int invalid = 0;
for (int i = 0; i < length; i++)
{
switch (in[i].unicode())
{
case 'A': result[i] = 0x0; break;
case 'B': result[i] = 0x1; break;
case 'C': result[i] = 0x2; break;
case 'D': result[i] = 0x3; break;
case 'E': result[i] = 0x4; break;
case 'F': result[i] = 0x5; break;
case 'G': result[i] = 0x6; break;
case 'H': result[i] = 0x7; break;
case 'I': result[i] = 0x8; break;
case 'J': result[i] = 0x9; break;
case 'K': result[i] = 0xa; break;
case 'L': result[i] = 0xb; break;
case 'M': result[i] = 0xc; break;
case 'N': result[i] = 0xd; break;
case 'O': result[i] = 0xe; break;
case 'P': result[i] = 0xf; break;
case 'Q': result[i] = 0x10; break;
case 'R': result[i] = 0x11; break;
case 'S': result[i] = 0x12; break;
case 'T': result[i] = 0x13; break;
case 'U': result[i] = 0x14; break;
case 'V': result[i] = 0x15; break;
case 'W': result[i] = 0x16; break;
case 'X': result[i] = 0x17; break;
case 'Y': result[i] = 0x18; break;
case 'Z': result[i] = 0x19; break;
case '0': result[i] = 0x20; break;
case '1': result[i] = 0x21; break;
case '2': result[i] = 0x22; break;
case '3': result[i] = 0x23; break;
case '4': result[i] = 0x24; break;
case '5': result[i] = 0x25; break;
case '6': result[i] = 0x26; break;
case '7': result[i] = 0x27; break;
case '8': result[i] = 0x28; break;
case '9': result[i] = 0x29; break;
case '.': result[i] = 0x30; break;
case ',': result[i] = 0x31; break;
case '\'': result[i] = 0x32; break;
case '-': result[i] = 0x33; break;
case '=': result[i] = 0x34; break;
case '/': result[i] = 0x35; break;
case '*': result[i] = 0x36; break;
case '#': result[i] = 0x37; break;
case '!': result[i] = 0x38; break;
case L'•': result[i] = 0x39; break;
case '?': result[i] = 0x3a; break;
case ' ': result[i] = 0x7f; break;
case '\0':
result[i] = static_cast<char>(0xffu);
remaining = length - i;
result.resize(i);
i = length;
break;
default: invalid++;
}
}
if (state != nullptr)
{
state->invalidChars = invalid;
state->remainingChars = remaining;
}
return result;
}
void KingsFieldII::KF2UTextCodec::kf2UConvert(const char* in,
const int length,
QTextCodec::ConverterState* state,
Direction direction) const
{}
QWidget* KingsFieldII::KF2UTextDelegate::createEditor(QWidget* parent,
const QStyleOptionViewItem&,
const QModelIndex& index) const
{
auto* editor = new QLineEdit(parent);
// Actual pattern: [A-Z0-9\.,\\\-/\*!•\? ]+?
// I have to double the \ because of C++ rules
// See https://doc.qt.io/qt-5/qregularexpression.html#introduction
editor->setValidator(
new QRegularExpressionValidator(QRegularExpression("[A-Z0-9\\.,\\\\\\-/\\*!•\\? ]+?"),
editor));
return editor;
}
void KingsFieldII::KF2UTextDelegate::setEditorData(QWidget* editor, const QModelIndex& index) const
{
auto* lineEdit = reinterpret_cast<QLineEdit*>(editor);
lineEdit->setText(index.model()->data(index, Qt::EditRole).toString());
}
void KingsFieldII::KF2UTextDelegate::setModelData(QWidget* editor,
QAbstractItemModel* model,
const QModelIndex& index) const
{
auto* lineEdit = reinterpret_cast<QLineEdit*>(editor);
model->setData(index, lineEdit->text());
}
void KingsFieldII::KF2UTextDelegate::updateEditorGeometry(QWidget* editor,
const QStyleOptionViewItem& option,
const QModelIndex&) const
{
editor->setGeometry(option.rect);
}
QString KingsFieldII::getEntityMeshName(const KingsFieldII::EntityMeshID entityMeshId)
{
switch (entityMeshId)
{
case EntityMeshID::AlHunt: return QStringLiteral("AlHunt");
case EntityMeshID::Archer: return QStringLiteral("Archer");
case EntityMeshID::Baltail: return QStringLiteral("Baltail");
case EntityMeshID::BaltailTail: return QStringLiteral("BaltailTail");
case EntityMeshID::Billent: return QStringLiteral("Billent");
case EntityMeshID::Bitt: return QStringLiteral("Bitt");
case EntityMeshID::Cable: return QStringLiteral("Cable");
case EntityMeshID::CellfyFoss: return QStringLiteral("CellfyFoss");
case EntityMeshID::CellfyFoss2: return QStringLiteral("CellfyFoss2");
case EntityMeshID::CliffLore: return QStringLiteral("CliffLore");
case EntityMeshID::CopperKnight: return QStringLiteral("CopperKnight");
case EntityMeshID::DalfVice: return QStringLiteral("DalfVice");
case EntityMeshID::DavidTabler: return QStringLiteral("DavidTabler");
case EntityMeshID::DemonLord: return QStringLiteral("DemonLord");
case EntityMeshID::DiasBagil: return QStringLiteral("DiasBagil");
case EntityMeshID::DragonGrass: return QStringLiteral("DragonGrass");
case EntityMeshID::EarnestClyde: return QStringLiteral("EarnestClyde");
case EntityMeshID::EarnestClydeSitting: return QStringLiteral("EarnestClydeSitting");
case EntityMeshID::EarthElemental: return QStringLiteral("EarthElemental");
case EntityMeshID::FaiFadlin: return QStringLiteral("FaiFadlin");
case EntityMeshID::FireElemental: return QStringLiteral("FireElemental");
case EntityMeshID::Ghost: return QStringLiteral("Ghost");
case EntityMeshID::GiantTermite: return QStringLiteral("GiantTermite");
case EntityMeshID::GigiBudwell: return QStringLiteral("GigiBudwell");
case EntityMeshID::GigiBudwellWatering: return QStringLiteral("GigiBudwellWatering");
case EntityMeshID::GreenSlime: return QStringLiteral("GreenSlime");
case EntityMeshID::GreenSlime2: return QStringLiteral("GreenSlime2");
case EntityMeshID::GreenSlime3: return QStringLiteral("GreenSlime3");
case EntityMeshID::GreenSlime4: return QStringLiteral("GreenSlime4");
case EntityMeshID::GreenSlimeDeath: return QStringLiteral("GreenSlimeDeath");
case EntityMeshID::GreenSlimeDeath2: return QStringLiteral("GreenSlimeDeath2");
case EntityMeshID::GreenSlimeDeath3: return QStringLiteral("GreenSlimeDeath3");
case EntityMeshID::GreenSlimeDeath4: return QStringLiteral("GreenSlimeDeath4");
case EntityMeshID::Guyra: return QStringLiteral("Guyra");
case EntityMeshID::HarrisCarvitto: return QStringLiteral("HarrisCarvitto");
case EntityMeshID::HeadEater: return QStringLiteral("HeadEater");
case EntityMeshID::JoseHarven: return QStringLiteral("JoseHarven");
case EntityMeshID::JoseHavenDeath: return QStringLiteral("JoseHavenDeath");
case EntityMeshID::JoseHavenDeath2: return QStringLiteral("JoseHavenDeath2");
case EntityMeshID::Kald: return QStringLiteral("Kald");
case EntityMeshID::KarenShore: return QStringLiteral("KarenShore");
case EntityMeshID::KarenShoreChair: return QStringLiteral("KarenShoreChair");
case EntityMeshID::KehlHunt: return QStringLiteral("KehlHunt");
case EntityMeshID::KehlHunt2: return QStringLiteral("KehlHunt2");
case EntityMeshID::KrakenBody: return QStringLiteral("KrakenBody");
case EntityMeshID::KrakenHead: return QStringLiteral("KrakenHead");
case EntityMeshID::KrolaAmgun: return QStringLiteral("KrolaAmgun");
case EntityMeshID::KrolaAmgunCooking: return QStringLiteral("KrolaAmgunCooking");
case EntityMeshID::LeonShore: return QStringLiteral("LeonShore");
case EntityMeshID::LeonShoreWatering: return QStringLiteral("LeonShoreWatering");
case EntityMeshID::LogStalker: return QStringLiteral("LogStalker");
case EntityMeshID::MagesCandlesticks: return QStringLiteral("MagesCandlesticks");
case EntityMeshID::MarkWozz: return QStringLiteral("MarkWozz");
case EntityMeshID::MechaDemonLord: return QStringLiteral("MechaDemonLord");
case EntityMeshID::MechaReik: return QStringLiteral("MechaReik");
case EntityMeshID::MechaTermite: return QStringLiteral("MechaTermite");
case EntityMeshID::Meryl: return QStringLiteral("Meryl");
case EntityMeshID::Miria: return QStringLiteral("Miria");
case EntityMeshID::Mogle: return QStringLiteral("Mogle");
case EntityMeshID::NolaBagil: return QStringLiteral("NolaBagil");
case EntityMeshID::None: return QStringLiteral("None");
case EntityMeshID::PoisonSlime: return QStringLiteral("PoisonSlime");
case EntityMeshID::Psythe: return QStringLiteral("Psythe");
case EntityMeshID::RaddBilheim: return QStringLiteral("RaddBilheim");
case EntityMeshID::RaffyFoss: return QStringLiteral("RaffyFoss");
case EntityMeshID::RandFerrer: return QStringLiteral("RandFerrer");
case EntityMeshID::RedSpikeBall: return QStringLiteral("RedSpikeBall");
case EntityMeshID::Refma: return QStringLiteral("Refma");
case EntityMeshID::Refma2: return QStringLiteral("Refma2");
case EntityMeshID::Reik: return QStringLiteral("Reik");
case EntityMeshID::SKnight: return QStringLiteral("SKnight");
case EntityMeshID::SaintGrave: return QStringLiteral("SaintGrave");
case EntityMeshID::Salamander: return QStringLiteral("Salamander");
case EntityMeshID::SandlerAmgun: return QStringLiteral("SandlerAmgun");
case EntityMeshID::SandlerAmgun2: return QStringLiteral("SandlerAmgun2");
case EntityMeshID::Sigill: return QStringLiteral("Sigill");
case EntityMeshID::Skeleton: return QStringLiteral("Skeleton");
case EntityMeshID::SkeletonOfOneEyedGiant: return QStringLiteral("SkeletonOfOneEyedGiant");
case EntityMeshID::Soldier: return QStringLiteral("Soldier");
case EntityMeshID::StingFly: return QStringLiteral("StingFly");
case EntityMeshID::StingFlyTail: return QStringLiteral("StingFlyTail");
case EntityMeshID::Tarn: return QStringLiteral("Tarn");
case EntityMeshID::TeoBudwell: return QStringLiteral("TeoBudwell");
case EntityMeshID::TeoBudwellMowing: return QStringLiteral("TeoBudwellMowing");
case EntityMeshID::TeoBudwellWithGigi: return QStringLiteral("TeoBudwellWithGigi");
case EntityMeshID::Termite: return QStringLiteral("Termite");
case EntityMeshID::ThePictureOfAKing: return QStringLiteral("ThePictureOfAKing");
case EntityMeshID::Transparent: return QStringLiteral("Transparent");
case EntityMeshID::Unused: return QStringLiteral("Unused");
case EntityMeshID::Unused10: return QStringLiteral("Unused10");
case EntityMeshID::Unused11: return QStringLiteral("Unused11");
case EntityMeshID::Unused12: return QStringLiteral("Unused12");
case EntityMeshID::Unused13: return QStringLiteral("Unused13");
case EntityMeshID::Unused14: return QStringLiteral("Unused14");
case EntityMeshID::Unused15: return QStringLiteral("Unused15");
case EntityMeshID::Unused16: return QStringLiteral("Unused16");
case EntityMeshID::Unused17: return QStringLiteral("Unused17");
case EntityMeshID::Unused18: return QStringLiteral("Unused18");
case EntityMeshID::Unused19: return QStringLiteral("Unused19");
case EntityMeshID::Unused2: return QStringLiteral("Unused2");
case EntityMeshID::Unused20: return QStringLiteral("Unused20");
case EntityMeshID::Unused21: return QStringLiteral("Unused21");
case EntityMeshID::Unused22: return QStringLiteral("Unused22");
case EntityMeshID::Unused23: return QStringLiteral("Unused23");
case EntityMeshID::Unused24: return QStringLiteral("Unused24");
case EntityMeshID::Unused3: return QStringLiteral("Unused3");
case EntityMeshID::Unused4: return QStringLiteral("Unused4");
case EntityMeshID::Unused5: return QStringLiteral("Unused5");
case EntityMeshID::Unused6: return QStringLiteral("Unused6");
case EntityMeshID::Unused7: return QStringLiteral("Unused7");
case EntityMeshID::Unused8: return QStringLiteral("Unused8");
case EntityMeshID::Unused9: return QStringLiteral("Unused9");
default: return unknownString;
}
}
QString KingsFieldII::getEntityStateIDName(const KingsFieldII::EntityStateID entityStateId)
{
switch (entityStateId)
{
case EntityStateID::FlyingAttackMaybe: return QStringLiteral("Flying Attack?");
case EntityStateID::FlyingWander: return QStringLiteral("Flying Wander");
case EntityStateID::MagicAttack: return QStringLiteral("Magic Attack");
case EntityStateID::ApproachingPlayer: return QStringLiteral("Approaching Player");
case EntityStateID::Wander: return QStringLiteral("Wander");
case EntityStateID::MeleeAttack: return QStringLiteral("Melee Attack");
case EntityStateID::TakingDamage: return QStringLiteral("Taking Damage");
case EntityStateID::None: return QStringLiteral("None");
case EntityStateID::MeleeAttack3: return QStringLiteral("Melee Attack 3");
case EntityStateID::MeleeAttack2: return QStringLiteral("Melee Attack 2");
case EntityStateID::Idle: return QStringLiteral("Idle");
case EntityStateID::Dialogue: return QStringLiteral("Dialogue");
case EntityStateID::Dying: return QStringLiteral("Dying");
default: return unknownString;
}
}
QString KingsFieldII::getMagicIDName(const KingsFieldII::MagicID magicId)
{
switch (magicId)
{
case MagicID::ArcherArrow: return QStringLiteral("ArcherArrow");
case MagicID::ArcherParalyzeArrow: return QStringLiteral("ArcherParalyzeArrow");
case MagicID::Breath: return QStringLiteral("Breath");
case MagicID::DarkSlayerMagicA: return QStringLiteral("DarkSlayerMagicA");
case MagicID::DarkSlayerMagicB: return QStringLiteral("DarkSlayerMagicB");
case MagicID::Dispoison: return QStringLiteral("Dispoison");
case MagicID::DoubleFireball: return QStringLiteral("DoubleFireball");
case MagicID::EarthHeal: return QStringLiteral("EarthHeal");
case MagicID::EarthWave: return QStringLiteral("EarthWave");
case MagicID::EnemyEarthMagic: return QStringLiteral("EnemyEarthMagic");
case MagicID::EnemyHomingEarthMagic: return QStringLiteral("EnemyHomingEarthMagic");
case MagicID::EnemyLightningVolt: return QStringLiteral("EnemyLightningVolt");
case MagicID::FireBall: return QStringLiteral("FireBall");
case MagicID::FireStorm: return QStringLiteral("FireStorm");
case MagicID::FireWall: return QStringLiteral("FireWall");
case MagicID::Flame: return QStringLiteral("Flame");
case MagicID::FlameSwordMagicA: return QStringLiteral("FlameSwordMagicA");
case MagicID::FlameSwordMagicB: return QStringLiteral("FlameSwordMagicB");
case MagicID::Flash: return QStringLiteral("Flash");
case MagicID::Freeze: return QStringLiteral("Freeze");
case MagicID::IceBladeMagicA: return QStringLiteral("IceBladeMagicA");
case MagicID::IceBladeMagicB: return QStringLiteral("IceBladeMagicB");
case MagicID::IceStorm: return QStringLiteral("IceStorm");
case MagicID::Light: return QStringLiteral("Light");
case MagicID::LightningVolt: return QStringLiteral("LightningVolt");
case MagicID::Meteor: return QStringLiteral("Meteor");
case MagicID::MissileShield: return QStringLiteral("MissileShield");
case MagicID::MoonlightSwordMagicA: return QStringLiteral("MoonlightSwordMagicA");
case MagicID::MoonlightSwordMagicB: return QStringLiteral("MoonlightSwordMagicB");
case MagicID::None: return QStringLiteral("None");
case MagicID::PsytheCurseOrb: return QStringLiteral("PsytheCurseOrb");
case MagicID::ResistFire: return QStringLiteral("ResistFire");
case MagicID::SKnightPoisonBreath: return QStringLiteral("SKnightPoisonBreath");
case MagicID::Seath: return QStringLiteral("Seath");
case MagicID::SeathsSwordMagicA: return QStringLiteral("SeathsSwordMagicA");
case MagicID::ShidenMagicA: return QStringLiteral("ShidenMagicA");
case MagicID::ShidenMagicB: return QStringLiteral("ShidenMagicB");
case MagicID::SpiderSwordMagicA: return QStringLiteral("SpiderSwordMagicA");
case MagicID::SpiderSwordMagicB: return QStringLiteral("SpiderSwordMagicB");
case MagicID::Stone: return QStringLiteral("Stone");
case MagicID::TarnWindMagic: return QStringLiteral("TarnWindMagic");
case MagicID::WaterFall: return QStringLiteral("WaterFall");
case MagicID::WindCutter: return QStringLiteral("WindCutter");
default: return unknownString;
}
}
QString KingsFieldII::getObjectClassTypeName(const KingsFieldII::ObjectClassType classType)
{
switch (classType)
{
case ObjectClassType::DragonGrass: return QStringLiteral("Dragon Grass");
case ObjectClassType::DragonStoneSlot: return QStringLiteral("Dragon Stone Slot");
case ObjectClassType::FloorTrap: return QStringLiteral("Floor Trap");
case ObjectClassType::GuidePost: return QStringLiteral("Guide Post");
case ObjectClassType::GuyraWarp: return QStringLiteral("Guyra Warp");
case ObjectClassType::Hider: return QStringLiteral("Hider");
case ObjectClassType::LoadTrigger: return QStringLiteral("LoadTrigger");
case ObjectClassType::Minecart: return QStringLiteral("Minecart");
case ObjectClassType::None: return QStringLiteral("None");
case ObjectClassType::PickableItem: return QStringLiteral("Pickable Item");
case ObjectClassType::RhombusKeySlot: return QStringLiteral("Rhombus Key Slot");
case ObjectClassType::RotatesToOpen: return QStringLiteral("Rotates to Open");
case ObjectClassType::SavePoint: return QStringLiteral("Save Point");
case ObjectClassType::SecretCompartment: return QStringLiteral("Secret Compartment");
case ObjectClassType::ShrineKeySlot: return QStringLiteral("Shrine Key Slot");
case ObjectClassType::Sign: return QStringLiteral("Sign");
case ObjectClassType::SkullKeySlot: return QStringLiteral("Skull Key Slot");
case ObjectClassType::Skybox: return QStringLiteral("Skybox");
case ObjectClassType::SlidesToOpen: return QStringLiteral("Slides to Open");
case ObjectClassType::Switch: return QStringLiteral("Switch");
case ObjectClassType::Trap: return QStringLiteral("Trap");
case ObjectClassType::VerticalDoor: return QStringLiteral("Vertical Door");
case ObjectClassType::VerticalDoor2: return QStringLiteral("Vertical Door 2");
case ObjectClassType::WaterWell: return QStringLiteral("Water Well");
}
return unknownString;
}
QString KingsFieldII::getObjectName(const KingsFieldII::ObjectID itemId)
{
switch (itemId)
{
case ObjectID::ABrokenSword: return QStringLiteral("ABrokenSword");
case ObjectID::ASoldierOfVerdite: return QStringLiteral("ASoldierOfVerdite");
case ObjectID::ArmsA: return QStringLiteral("ArmsA");
case ObjectID::ArmsDemonsHands: return QStringLiteral("ArmsDemonsHands");
case ObjectID::ArmsIronGloves: return QStringLiteral("ArmsIronGloves");
case ObjectID::ArmsRuinousGloves: return QStringLiteral("ArmsRuinousGloves");
case ObjectID::ArmsSilverArms: return QStringLiteral("ArmsSilverArms");
case ObjectID::ArmsStoneHands: return QStringLiteral("ArmsStoneHands");
case ObjectID::Barrel: return QStringLiteral("Barrel");
case ObjectID::Bed: return QStringLiteral("Bed");
case ObjectID::BigGreyDoorLeft: return QStringLiteral("BigGreyDoorLeft");
case ObjectID::BigGreyDoorRight: return QStringLiteral("BigGreyDoorRight");
case ObjectID::BigRoughStoneDoor: return QStringLiteral("BigRoughStoneDoor");
case ObjectID::BigStoneDoor: return QStringLiteral("BigStoneDoor");
case ObjectID::BodyA: return QStringLiteral("BodyA");
case ObjectID::BodyBreastPlate: return QStringLiteral("BodyBreastPlate");
case ObjectID::BodyDarkArmor: return QStringLiteral("BodyDarkArmor");
case ObjectID::BodyIceArmor: return QStringLiteral("BodyIceArmor");
case ObjectID::BodyKnightPlate: return QStringLiteral("BodyKnightPlate");
case ObjectID::BodySeathsArmor: return QStringLiteral("BodySeathsArmor");
case ObjectID::Bones: return QStringLiteral("Bones");
case ObjectID::Bones2: return QStringLiteral("Bones2");
case ObjectID::Bucket: return QStringLiteral("Bucket");
case ObjectID::CeilingTorch: return QStringLiteral("CeilingTorch");
case ObjectID::Chair: return QStringLiteral("Chair");
case ObjectID::ColosseumDoor: return QStringLiteral("ColosseumDoor");
case ObjectID::CopperKnightStatue: return QStringLiteral("CopperKnightStatue");
case ObjectID::CrossFeetTable: return QStringLiteral("CrossFeetTable");
case ObjectID::DaytimeSkybox: return QStringLiteral("DaytimeSkybox");
case ObjectID::DeadCrystalMiner: return QStringLiteral("DeadCrystalMiner");
case ObjectID::DeadDudeRENAME_ME: return QStringLiteral("DeadDudeRENAME_ME");
case ObjectID::DemonLordFromMadScientistTube:
return QStringLiteral("DemonLordFromMadScientistTube");
case ObjectID::DemonLordStatue: return QStringLiteral("DemonLordStatue");
case ObjectID::DragonGrass: return QStringLiteral("DragonGrass");
case ObjectID::DragonStoneSlot: return QStringLiteral("DragonStoneSlot");
case ObjectID::DrawbridgeSwitch: return QStringLiteral("DrawbridgeSwitch");
case ObjectID::DummyItem1: return QStringLiteral("DummyItem1");
case ObjectID::DummyItem2: return QStringLiteral("DummyItem2");
case ObjectID::DummyItem3: return QStringLiteral("DummyItem3");
case ObjectID::DummyItem4: return QStringLiteral("DummyItem4");
case ObjectID::DummyItem5: return QStringLiteral("DummyItem5");
case ObjectID::DummyItem6: return QStringLiteral("DummyItem6");
case ObjectID::DummyItem7: return QStringLiteral("DummyItem7");
case ObjectID::EarthElementalStatue: return QStringLiteral("EarthElementalStatue");
case ObjectID::ElfsGrave: return QStringLiteral("ElfsGrave");
case ObjectID::EquipItemAmuletOfMist: return QStringLiteral("EquipItemAmuletOfMist");
case ObjectID::EquipItemEarthRing: return QStringLiteral("EquipItemEarthRing");
case ObjectID::EquipItemLightwaveRing: return QStringLiteral("EquipItemLightwaveRing");
case ObjectID::EquipItemPsycprosCollar: return QStringLiteral("EquipItemPsycprosCollar");
case ObjectID::EquipItemScorpionsBracelet:
return QStringLiteral("EquipItemScorpionsBracelet");
case ObjectID::EquipItemSeathsBracelet: return QStringLiteral("EquipItemSeathsBracelet");
case ObjectID::EquipItemSeathsTear: return QStringLiteral("EquipItemSeathsTear");
case ObjectID::FeetA: return QStringLiteral("FeetA");
case ObjectID::FeetDeathWalkers: return QStringLiteral("FeetDeathWalkers");
case ObjectID::FeetIronBoots: return QStringLiteral("FeetIronBoots");
case ObjectID::FeetLegGuarders: return QStringLiteral("FeetLegGuarders");
case ObjectID::FeetRuinousBoots: return QStringLiteral("FeetRuinousBoots");
case ObjectID::FeetSilverBoots: return QStringLiteral("FeetSilverBoots");
case ObjectID::GoldenThingRENAME_ME: return QStringLiteral("GoldenThingRENAME_ME");
case ObjectID::GreenWallFloorTrap: return QStringLiteral("GreenWallFloorTrap");
case ObjectID::GreenWallSecretDoor: return QStringLiteral("GreenWallSecretDoor");
case ObjectID::GreenWallWithSecret1: return QStringLiteral("GreenWallWithSecret1");
case ObjectID::GreenWallWithSecret2: return QStringLiteral("GreenWallWithSecret2");
case ObjectID::GreenWallWithSpikeTrap: return QStringLiteral("GreenWallWithSpikeTrap");
case ObjectID::Guidepost: return QStringLiteral("Guidepost");
case ObjectID::GuyraTeleportCube: return QStringLiteral("GuyraTeleportCube");
case ObjectID::HarvineCastleSign: return QStringLiteral("HarvineCastleSign");
case ObjectID::HarvinesCastleDoor: return QStringLiteral("HarvinesCastleDoor");
case ObjectID::HarvinesThrone: return QStringLiteral("HarvinesThrone");
case ObjectID::HeadA: return QStringLiteral("HeadA");
case ObjectID::HeadBloodCrown: return QStringLiteral("HeadBloodCrown");
case ObjectID::HeadGreatHelm: return QStringLiteral("HeadGreatHelm");
case ObjectID::HeadIronMask: return QStringLiteral("HeadIronMask");
case ObjectID::HeadKnightHelm: return QStringLiteral("HeadKnightHelm");
case ObjectID::HeadLightningHelm: return QStringLiteral("HeadLightningHelm");
case ObjectID::HeadSeathsHelm: return QStringLiteral("HeadSeathsHelm");
case ObjectID::InvisibleObject: return QStringLiteral("InvisibleObject");
case ObjectID::ItemAHerb: return QStringLiteral("ItemAHerb");
case ObjectID::ItemAHerb2: return QStringLiteral("ItemAHerb2");
case ObjectID::ItemAPotion: return QStringLiteral("ItemAPotion");
case ObjectID::ItemARing: return QStringLiteral("ItemARing");
case ObjectID::ItemAntidote: return QStringLiteral("ItemAntidote");
case ObjectID::ItemArrowForTheBow: return QStringLiteral("ItemArrowForTheBow");
case ObjectID::ItemBloodStone: return QStringLiteral("ItemBloodStone");
case ObjectID::ItemBluePotion: return QStringLiteral("ItemBluePotion");
case ObjectID::ItemCrystal: return QStringLiteral("ItemCrystal");
case ObjectID::ItemCrystalFlask: return QStringLiteral("ItemCrystalFlask");
case ObjectID::ItemCrystalShard: return QStringLiteral("ItemCrystalShard");
case ObjectID::ItemDarkCrystal: return QStringLiteral("ItemDarkCrystal");
case ObjectID::ItemDemonsPick: return QStringLiteral("ItemDemonsPick");
case ObjectID::ItemDragonCrystal: return QStringLiteral("ItemDragonCrystal");
case ObjectID::ItemDragonStone: return QStringLiteral("ItemDragonStone");
case ObjectID::ItemEarthCrystal: return QStringLiteral("ItemEarthCrystal");
case ObjectID::ItemEarthHerb: return QStringLiteral("ItemEarthHerb");
case ObjectID::ItemElfsBolt: return QStringLiteral("ItemElfsBolt");
case ObjectID::ItemElfsKey: return QStringLiteral("ItemElfsKey");
case ObjectID::ItemFigureOfSeath: return QStringLiteral("ItemFigureOfSeath");
case ObjectID::ItemFireCrystal: return QStringLiteral("ItemFireCrystal");
case ObjectID::ItemGoldCoin: return QStringLiteral("ItemGoldCoin");
case ObjectID::ItemGoldKey: return QStringLiteral("ItemGoldKey");
case ObjectID::ItemGoldPotion: return QStringLiteral("ItemGoldPotion");
case ObjectID::ItemGreenPotion: return QStringLiteral("ItemGreenPotion");
case ObjectID::ItemGroundBell: return QStringLiteral("ItemGroundBell");
case ObjectID::ItemHarvinesFlute: return QStringLiteral("ItemHarvinesFlute");
case ObjectID::ItemHarvinesKey: return QStringLiteral("ItemHarvinesKey");
case ObjectID::ItemJailKey: return QStringLiteral("ItemJailKey");
case ObjectID::ItemLightCrystal: return QStringLiteral("ItemLightCrystal");
case ObjectID::ItemMagiciansKey: return QStringLiteral("ItemMagiciansKey");
case ObjectID::ItemMinersMap: return QStringLiteral("ItemMinersMap");
case ObjectID::ItemMoonGate: return QStringLiteral("ItemMoonGate");
case ObjectID::ItemMoonKey: return QStringLiteral("ItemMoonKey");
case ObjectID::ItemMoonStone: return QStringLiteral("ItemMoonStone");
case ObjectID::ItemNecronsMap: return QStringLiteral("ItemNecronsMap");
case ObjectID::ItemPhantomRod: return QStringLiteral("ItemPhantomRod");
case ObjectID::ItemPiratesKey: return QStringLiteral("ItemPiratesKey");
case ObjectID::ItemPiratesMap: return QStringLiteral("ItemPiratesMap");
case ObjectID::ItemRedPotion: return QStringLiteral("ItemRedPotion");
case ObjectID::ItemRhombusKey: return QStringLiteral("ItemRhombusKey");
case ObjectID::ItemSeathsPlume: return QStringLiteral("ItemSeathsPlume");
case ObjectID::ItemShrineKey: return QStringLiteral("ItemShrineKey");
case ObjectID::ItemSilverKey: return QStringLiteral("ItemSilverKey");
case ObjectID::ItemSkullKey: return QStringLiteral("ItemSkullKey");
case ObjectID::ItemStarGate: return QStringLiteral("ItemStarGate");
case ObjectID::ItemStarKey: return QStringLiteral("ItemStarKey");
case ObjectID::ItemSunGate: return QStringLiteral("ItemSunGate");
case ObjectID::ItemSunKey: return QStringLiteral("ItemSunKey");
case ObjectID::ItemTruthGlass: return QStringLiteral("ItemTruthGlass");
case ObjectID::ItemVerdite: return QStringLiteral("ItemVerdite");
case ObjectID::ItemWaterCrystal: return QStringLiteral("ItemWaterCrystal");
case ObjectID::ItemWindCrystal: return QStringLiteral("ItemWindCrystal");
case ObjectID::JailDoor: return QStringLiteral("JailDoor");
case ObjectID::KnockerDoorLeft: return QStringLiteral("KnockerDoorLeft");
case ObjectID::KnockerDoorRight: return QStringLiteral("KnockerDoorRight");
case ObjectID::Lantern: return QStringLiteral("Lantern");
case ObjectID::LoadArea: return QStringLiteral("LoadArea");
case ObjectID::MadScientistBox: return QStringLiteral("MadScientistBox");
case ObjectID::MadScientistLightCrystalMachine:
return QStringLiteral("MadScientistLightCrystalMachine");
case ObjectID::MadScientistTube: return QStringLiteral("MadScientistTube");
case ObjectID::MarbleWallFloorTrap: return QStringLiteral("MarbleWallFloorTrap");
case ObjectID::MineSign: return QStringLiteral("MineSign");
case ObjectID::Minecart: return QStringLiteral("Minecart");
case ObjectID::MinersGraveMaybe: return QStringLiteral("MinersGraveMaybe");
case ObjectID::Moon: return QStringLiteral("Moon");
case ObjectID::MountainSkybox: return QStringLiteral("MountainSkybox");
case ObjectID::NighttimeSkybox: return QStringLiteral("NighttimeSkybox");
case ObjectID::NighttimeSkybox2: return QStringLiteral("NighttimeSkybox2");
case ObjectID::None: return QStringLiteral("None");
case ObjectID::PillarOfWind: return QStringLiteral("PillarOfWind");
case ObjectID::RedFlower: return QStringLiteral("RedFlower");
case ObjectID::RhombusKeyDoor: return QStringLiteral("RhombusKeyDoor");
case ObjectID::RhombusKeySlot: return QStringLiteral("RhombusKeySlot");
case ObjectID::SamuraisGrave: return QStringLiteral("SamuraisGrave");
case ObjectID::Savepoint: return QStringLiteral("Savepoint");
case ObjectID::SeathsFountainDoorLeft: return QStringLiteral("SeathsFountainDoorLeft");
case ObjectID::SeathsFountainDoorRight: return QStringLiteral("SeathsFountainDoorRight");
case ObjectID::SeathsFountainPillar: return QStringLiteral("SeathsFountainPillar");
case ObjectID::SecretDoor: return QStringLiteral("SecretDoor");
case ObjectID::Shelf: return QStringLiteral("Shelf");
case ObjectID::ShieldA: return QStringLiteral("ShieldA");
case ObjectID::ShieldCrystalGuard: return QStringLiteral("ShieldCrystalGuard");
case ObjectID::ShieldLargeShield: return QStringLiteral("ShieldLargeShield");
case ObjectID::ShieldLeatherShield: return QStringLiteral("ShieldLeatherShield");
case ObjectID::ShieldMoonGuard: return QStringLiteral("ShieldMoonGuard");
case ObjectID::ShieldSeathsShield: return QStringLiteral("ShieldSeathsShield");
case ObjectID::ShieldSkullShield: return QStringLiteral("ShieldSkullShield");
case ObjectID::ShovelAndHammer: return QStringLiteral("ShovelAndHammer");
case ObjectID::ShrineKeySlot: return QStringLiteral("ShrineKeySlot");
case ObjectID::Sign: return QStringLiteral("Sign");
case ObjectID::SimpleStoolMaybeRENAME_ME:
return QStringLiteral("SimpleStoolMaybeRENAME_ME");
case ObjectID::SkullKeySlot: return QStringLiteral("SkullKeySlot");
case ObjectID::SkullKeyWaterObstacle: return QStringLiteral("SkullKeyWaterObstacle");
case ObjectID::SlotForSomethingRENAME_ME:
return QStringLiteral("SlotForSomethingRENAME_ME");
case ObjectID::SmallBed: return QStringLiteral("SmallBed");
case ObjectID::SmallStackOfLogs: return QStringLiteral("SmallStackOfLogs");
case ObjectID::SmallTable: return QStringLiteral("SmallTable");
case ObjectID::SmallWeirdPillarRENAME_ME:
return QStringLiteral("SmallWeirdPillarRENAME_ME");
case ObjectID::SomeBrokenGrave: return QStringLiteral("SomeBrokenGrave");
case ObjectID::SomeBrokenGrave2: return QStringLiteral("SomeBrokenGrave2");
case ObjectID::SomeDoorHandleRENAME_ME: return QStringLiteral("SomeDoorHandleRENAME_ME");
case ObjectID::SomeGrave: return QStringLiteral("SomeGrave");
case ObjectID::SquareWell: return QStringLiteral("SquareWell");
case ObjectID::StoneChestBody: return QStringLiteral("StoneChestBody");
case ObjectID::StoneChestLid: return QStringLiteral("StoneChestLid");
case ObjectID::StoneGobletWithLavaRENAME_ME:
return QStringLiteral("StoneGobletWithLavaRENAME_ME");
case ObjectID::StonePillar: return QStringLiteral("StonePillar");
case ObjectID::StoneThing2RENAME_ME: return QStringLiteral("StoneThing2RENAME_ME");
case ObjectID::StoneThing3RENAME_ME: return QStringLiteral("StoneThing3RENAME_ME");
case ObjectID::StoneThingRENAME_ME: return QStringLiteral("StoneThingRENAME_ME");
case ObjectID::Stool: return QStringLiteral("Stool");
case ObjectID::SwingingScythe: return QStringLiteral("SwingingScythe");
case ObjectID::SwingingSpikeBall: return QStringLiteral("SwingingSpikeBall");
case ObjectID::TableWithThingie: return QStringLiteral("TableWithThingie");
case ObjectID::TarnStatue: return QStringLiteral("TarnStatue");
case ObjectID::TheMagiciansLamp: return QStringLiteral("TheMagiciansLamp");
case ObjectID::TheSoldiersGrave: return QStringLiteral("TheSoldiersGrave");
case ObjectID::ThreeStones: return QStringLiteral("ThreeStones");
case ObjectID::TinyXFeetTable: return QStringLiteral("TinyXFeetTable");
case ObjectID::Tree: return QStringLiteral("Tree");
case ObjectID::WHATTHEFUCKStatue: return QStringLiteral("WHATTHEFUCKStatue");
case ObjectID::WTF: return QStringLiteral("WTF");
case ObjectID::WallTorch: return QStringLiteral("WallTorch");
case ObjectID::WallWithSecret: return QStringLiteral("WallWithSecret");
case ObjectID::WallWithSecret2: return QStringLiteral("WallWithSecret2");
case ObjectID::WallWithSpikeTrap: return QStringLiteral("WallWithSpikeTrap");
case ObjectID::WallWriting: return QStringLiteral("WallWriting");
case ObjectID::WallWriting2: return QStringLiteral("WallWriting2");
case ObjectID::WallWriting3: return QStringLiteral("WallWriting3");
case ObjectID::WaterWell: return QStringLiteral("WaterWell");
case ObjectID::WeaponA1: return QStringLiteral("WeaponA1");
case ObjectID::WeaponA2: return QStringLiteral("WeaponA2");
case ObjectID::WeaponA3: return QStringLiteral("WeaponA3");
case ObjectID::WeaponA4: return QStringLiteral("WeaponA4");
case ObjectID::WeaponA5: return QStringLiteral("WeaponA5");
case ObjectID::WeaponArbalest: return QStringLiteral("WeaponArbalest");
case ObjectID::WeaponBastardSword: return QStringLiteral("WeaponBastardSword");
case ObjectID::WeaponBattleHammer: return QStringLiteral("WeaponBattleHammer");
case ObjectID::WeaponBow: return QStringLiteral("WeaponBow");
case ObjectID::WeaponCrescentAxe: return QStringLiteral("WeaponCrescentAxe");
case ObjectID::WeaponDagger: return QStringLiteral("WeaponDagger");
case ObjectID::WeaponDarkSlayer: return QStringLiteral("WeaponDarkSlayer");
case ObjectID::WeaponFlameSword: return QStringLiteral("WeaponFlameSword");
case ObjectID::WeaponIceBlade: return QStringLiteral("WeaponIceBlade");
case ObjectID::WeaponKnightSword: return QStringLiteral("WeaponKnightSword");
case ObjectID::WeaponMoonlightSword: return QStringLiteral("WeaponMoonlightSword");
case ObjectID::WeaponMorningStar: return QStringLiteral("WeaponMorningStar");
case ObjectID::WeaponSeathsSword: return QStringLiteral("WeaponSeathsSword");
case ObjectID::WeaponShiden: return QStringLiteral("WeaponShiden");
case ObjectID::WeaponShortSword: return QStringLiteral("WeaponShortSword");
case ObjectID::WeaponSpider: return QStringLiteral("WeaponSpider");
case ObjectID::WeirdPillarRENAME_ME: return QStringLiteral("WeirdPillarRENAME_ME");
case ObjectID::WhitePinkFlower: return QStringLiteral("WhitePinkFlower");
case ObjectID::WoodenChestBody: return QStringLiteral("WoodenChestBody");
case ObjectID::WoodenChestLid: return QStringLiteral("WoodenChestLid");
case ObjectID::WoodenThingRENAME_ME: return QStringLiteral("WoodenThingRENAME_ME");
case ObjectID::XFeetTable: return QStringLiteral("XFeetTable");
default: return unknownString;
}
}
QString KingsFieldII::getWeaponStatsName(const byte weaponStatsIndex)
{
switch (weaponStatsIndex)
{
case 0: return QStringLiteral("Dagger");
case 1: return QStringLiteral("Short Sword");
case 2: return QStringLiteral("Knight Sword");
case 3: return QStringLiteral("Morning Star");
case 4: return QStringLiteral("Battle Hammer");
case 5: return QStringLiteral("Bastard Sword");
case 6: return QStringLiteral("Crescent Axe");
case 7: return QStringLiteral("A");
case 8: return QStringLiteral("A");
case 9: return QStringLiteral("Flame Sword");
case 10: return QStringLiteral("Shiden");
case 11: return QStringLiteral("Spider");
case 12: return QStringLiteral("Ice Blade");
case 13: return QStringLiteral("Seath's Sword");
case 14: return QStringLiteral("Moonlight Sword");
case 15: return QStringLiteral("Dark Slayer");
case 16: return QStringLiteral("Bow");
case 17: return QStringLiteral("Arbalest");
default: return unknownString;
}
}
| 61.090268
| 99
| 0.686491
|
IvanDSM
|
015334043bd7d171106ed59a60c5e3a303d100bf
| 2,340
|
cpp
|
C++
|
source/log.cpp
|
Quaker762/Mazer
|
8dbafbdda13be3c6890f1c5fad69ed50738565f2
|
[
"MIT"
] | 1
|
2018-07-26T14:03:11.000Z
|
2018-07-26T14:03:11.000Z
|
source/log.cpp
|
Quaker762/Mazer
|
8dbafbdda13be3c6890f1c5fad69ed50738565f2
|
[
"MIT"
] | null | null | null |
source/log.cpp
|
Quaker762/Mazer
|
8dbafbdda13be3c6890f1c5fad69ed50738565f2
|
[
"MIT"
] | 1
|
2019-02-04T05:55:47.000Z
|
2019-02-04T05:55:47.000Z
|
/**
* Copyright (c) 2018 Jesse Buhagiar
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
**/
#include "log.hpp"
#include <string>
#include <fstream>
#include <cstdarg>
#include <cstdio>
static constexpr bool LOG_FILE = false; // Should all of this be logged to a log.txt??
void Mazer::Log(LogLevel logType, const std::string& str, ...)
{
std::string msg;
std::va_list args;
switch(logType)
{
case LogLevel::INFO:
msg += "[INFO] ";
break;
case LogLevel::WARNING:
msg += "[WARN] ";
break;
case LogLevel::ERROR:
msg += "[ERROR] ";
break;
case LogLevel::FATAL:
msg += "[FATAL] ";
break;
case LogLevel::DEBUG:
msg += "[DEBUG] ";
break;
default:
case LogLevel::NONE:
break;
}
std::string tmp;
tmp.resize(512); // Allocate 512-bytes for storing the message
va_start(args, str);
vsprintf(const_cast<char*>(tmp.c_str()), str.c_str(), args);
msg += tmp;
std::fprintf(stderr, msg.c_str()); // Don't buffer this, print it straight to the console.
if(LOG_FILE)
{
std::ofstream logFile;
logFile.open("log.txt", std::ofstream::out | std::ofstream::app);
logFile << msg;
logFile.close();
}
}
| 31.2
| 94
| 0.652564
|
Quaker762
|
01537efe0f5db6f18c1ba065f65126aac69562f5
| 6,736
|
hpp
|
C++
|
Day 08 Part 2/puzzle_input.hpp
|
Miroslav-Cetojevic/aoc-2015
|
2807fcd3fc684843ae4222b25af6fd086fac77f5
|
[
"Unlicense"
] | 1
|
2019-11-19T20:19:18.000Z
|
2019-11-19T20:19:18.000Z
|
Day 08 Part 2/puzzle_input.hpp
|
Miroslav-Cetojevic/aoc-2015
|
2807fcd3fc684843ae4222b25af6fd086fac77f5
|
[
"Unlicense"
] | null | null | null |
Day 08 Part 2/puzzle_input.hpp
|
Miroslav-Cetojevic/aoc-2015
|
2807fcd3fc684843ae4222b25af6fd086fac77f5
|
[
"Unlicense"
] | null | null | null |
#ifndef INPUT_HPP_
#define INPUT_HPP_
#include <string_view>
std::string_view puzzle_input = R"("sjdivfriyaaqa\xd2v\"k\"mpcu\"yyu\"en"
"vcqc"
"zbcwgmbpijcxu\"yins\"sfxn"
"yumngprx"
"bbdj"
"czbggabkzo\"wsnw\"voklp\"s"
"acwt"
"aqttwnsohbzian\"evtllfxwkog\"cunzw"
"ugvsgfv"
"xlnillibxg"
"kexh\"pmi"
"syvugow"
"m\"ktqnw"
"yrbajyndte\\rm"
"f\"kak\x70sn\xc4kjri"
"yxthr"
"alvumfsjni\"kohg"
"trajs\x5brom\xf1yoijaumkem\"\"tahlzs"
"\"oedr\"pwdbnnrc"
"qsmzhnx\""
"\"msoytqimx\\tbklqz"
"mjdfcgwdshrehgs"
"\"rivyxahf\""
"ciagc\x04bp"
"xkfc"
"xrgcripdu\x4c\xc4gszjhrvumvz\"mngbirb"
"gvmae\"yiiujoqvr\"mkxmgbbut\"u"
"ih"
"ncrqlejehs"
"mkno\x43pcfdukmemycp"
"uanzoqxkpsksbvdnkji\"feamp"
"axoufpnbx\\ao\x61pfj\"b"
"dz\\ztawzdjy"
"ihne\"enumvswypgf"
"\"dgazthrphbshdo\\vuqoiy\""
"dlnmptzt\\zahwpylc\\b\"gmslrqysk"
"mhxznyzcp"
"rebr\"amvxw\x5fmbnfpkkeghlntavj"
"lades\x47ncgdof\"\"jmbbk"
"dwxuis\xa5wdkx\\z\"admgnoddpgkt\\zs"
"g\\k\x27qsl\x34hwfglcdxqbeclt\xca\\"
"lhyjky\\m\"pvnm\\xmynpxnlhndmahjl"
"c\"uxabbgorrpprw\"xas\\vefkxioqpt"
"rfrvjxpevcmma\x71gtfipo"
"fgh\"kcwoqwfnjgdlzfclprg\"q"
"onxnwykrba"
"hkkg\x60f\"tjzsanpvarzgkfipl"
"\"aintes\"ofq\"juiaqlqxmvpe\\a"
"wiyczzs\"ciwk"
"mfqeu"
"v\xe1z\x7ftzalmvdmncfivrax\\rjwq"
"k\"vtg"
"exhrtdugeml\xf0"
"behnchkpld"
"mhgxy\"mfcrg\xc5gnp\"\"osqhj"
"rlvjy"
"awe"
"ctwy"
"vt"
"\x54t"
"zugfmmfomz"
"cv\"cvcvfaada\x04fsuqjinbfh\xa9cq\xd2c\"d"
"oj"
"xazanf\"wbmcrn"
"\\\\zkisyjpbzandqikqjqvee"
"dpsnbzdwnxk\\v"
"sj\"tuupr\\oyoh"
"myvkgnw\x81q\xaaokt\\emgejbsyvxcl\\\xee"
"ejeuqvunjcirdkkpt\"nlns"
"twmlvwxyvfyqqzu"
"\"xwtzdp\x98qkcis\"dm\\\"ep\"xyykq"
"vvcq\\expok"
"wgukjfanjgpdjb"
"\"mjcjajnxy\\dcpc"
"wdvgnecw\\ab\x44klceduzgsvu"
"dqtqkukr\"iacngufbqkdpxlwjjt"
"\"xj\"\x66qofsqzkoah"
"nptiwwsqdep"
"gsnlxql\x30mjl"
"yeezwokjwrhelny\""
"bjauamn\\izpmzqqasid"
"tvjdbkn\"tiziw\x82r"
"w"
"xwoakbbnjnypnaa\xa9wft\"slrmoqkl"
"vwxtnlvaaasyruykgygrvpiopzygf\"vq"
"qdancvnvmhlmpj\\isdxs"
"xzc\\elw"
"b\"wxeqvy\"qf\"g\xcaoklsucwicyw\"dovr"
"yomlvvjdbngz\"rly\"afr"
"bfb\"x\"aweuwbwmoa\x13\"t\"zhr"
"\"dmfoxb\"qvpjzzhykt\xd2\"\"ryhxi"
"psqef\"yu\\qiflie\"\x79w"
"arzewkej\"lqmh\\sayyusxxo\\"
"vuvvp"
"hc\"lg\x6bcpupsewzklai\"l"
"cjdfygc\"auorqybnuqghsh\x10"
"j"
"wqjexk\"eyq\\lbroqhk\\dqzsqk"
"dws\"ru\"dvxfiwapif\"oqwzmle"
"agcykg\\jt\\vzklqjvknoe"
"kksd\"jmslja\\z\"y\\b\xaagpyojct"
"nnpipxufvbfpoz\"jno"
"dtw"
"xlolvtahvgqkx\\dgnhj\\spsclpcxv\\"
"mxea\\mbjpi"
"lgbotkk\"zmxh\\\\qji\"jszulnjsxkqf"
"lwckmhwhx\"gmftlb\x91am"
"xxdxqyxth"
"\"lmqhwkjxmvayxy"
"tf"
"qy"
"wdqmwxdztax\"m\"\x09\x11xdxmfwxmtqgwvf"
"\xcbnazlf\"ghziknszmsrahaf"
"e\x6aupmzhxlvwympgjjpdvo\"kylfa"
"\x81vhtlillb\xactgoatva"
"dvnlgr"
"f"
"xg\xfacwizsadgeclm"
"vnnrzbtw\"\\prod\\djbyppngwayy\""
"lrt\xf4jahwvfz"
"aqpnjtom\"ymkak\\dadfybqrso\\fwv"
"gz\"aac\"mrbk\"ktommrojraqh"
"wycamwoecsftepfnlcdkm"
"nrhddblbuzlqsl\x9cben"
"vckxhyqkmqmdseazcykrbysm"
"sil\xbbtevmt\"gvrvybui\"faw\"j"
"cjex\\tp\x45pzf"
"asjobvtxszfodgf\"ibftg"
"gkyjyjdrxdcllnh\"sjcibenrdnxv"
"oswsdpjyxpbwnqbcpl\"yrdvs\\zq"
"\"\"tyowzc\\fycbp\"jbwrbvgui"
"cbpcabqkdgzmpgcwjtrchxp"
"iyrzfh\x45gw\"fdlfpiaap\x31xqq"
"evgksznidz"
"b\\w\\"
"loufizbiy\x57aim\"bgk"
"qjfyk"
"g\"anmloghvgr\x07zwqougqhdz"
"usbbmwcxd\\bdgg"
"htitqcpczml"
"eke\\cqvpexqqk\"to\"tqmljrpn\xe6lji\""
"g\xd2ifdsej"
"h\"sk\"haajajpagtcqnzrfqn\xe6btzo"
"wfkuffdxlvm\\cvlyzlbyunclhmpp"
"myaavh\"spue"
"hqvez\x68d\"eo\"eaioh"
"s\"qd\"oyxxcglcdnuhk"
"ilqvar"
"srh"
"puuifxrfmpc\"bvalwi\x2blu\\"
"yywlbutufzysbncw\\nqsfbhpz\"mngjq"
"zbl\\jfcuop"
"hjdouiragzvxsqkreup\\"
"qi"
"ckx\\funlj\xa7ahi"
"k"
"ufrcnh\"ajteit"
"cqv\"bgjozjj\x60x\xa8yhvmdvutchjotyuz"
"hkuiet\"oku\x8cfhumfpasl"
"\"\\sbe\x4d"
"vhknazqt"
"eyyizvzcahgflvmoowvs\\jhvygci"
"kki\x3ewcefkgtjap\"xtpxh\"lzepoqj"
"wvtk"
"\"ynet"
"zh\\obk\"otagx\x59txfzf"
"ocowhxlx\xe6zqg\x63wx\\tclkhq\\vmaze"
"w\"cf"
"qpniprnrzrnvykghqnalr"
"jctcqra\"\x05dhlydpqamorqjsijt\\xjdgt"
"sig"
"qhlbidbflwxe\"xljbwls\x20vht"
"irmrebfla\xefsg\"j"
"nep"
"hjuvsqlizeqobepf"
"guzbcdp\"obyh"
"\"mjagins\xf9tqykaxy\""
"knvsdnmtr\"zervsb"
"hzuy"
"zza\"k\"buapb\\elm\xfeya"
"lrqar\"dfqwkaaqifig\"uixjsz"
"\"azuo\x40rmnlhhluwsbbdb\x32pk\\yu\"pbcf"
"dplkdyty"
"rfoyciebwlwphcycmguc"
"ivnmmiemhgytmlprq\\eh"
"lhkyzaaothfdhmbpsqd\\yyw"
"tnlzifupcjcaj"
"\\qiyirsdrfpmu\\\x15xusifaag"
"\\lcomf\\s"
"uramjivcirjhqcqcg"
"kkbaklbxfxikffnuhtu\xc6t\"d"
"n\xefai"
"\"toy\"bnbpevuzoc\"muywq\"gz\"grbm"
"\"muu\\wt"
"\\srby\"ee"
"erf\"gvw\"swfppf"
"pbqcgtn\"iuianhcdazfvmidn\\nslhxdf"
"uxbp"
"up\\mgrcyaegiwmjufn"
"nulscgcewj\\dvoyvhetdegzhs\""
"masv\"k\\rzrb"
"qtx\x79d\"xdxmbxrvhj"
"fid\\otpkgjlh\"qgsvexrckqtn\xf4"
"tagzu"
"bvl\\\"noseec"
"\\xgicuuh"
"w\"a\"npemf"
"sxp"
"nsmpktic\x8awxftscdcvijjobnq\"gjd"
"uks\"\"jxvyvfezz\"aynxoev\"cuoav"
"m"
"lkvokj"
"vkfam\"yllr\"q\x92o\x4ebecnvhshhqe\\"
"efdxcjkjverw"
"lmqzadwhfdgmep\x02tzfcbgrbfekhat"
"cpbk\x9azqegbpluczssouop\x36ztpuoxsw"
"cqwoczxdd\"erdjka"
"cwvqnjgbw\\fxdlby"
"mvtm"
"lt\"bbqzpumplkg"
"ntd\xeeuwweucnuuslqfzfq"
"y\xabl\"dbebxjrlbmuoo\\\x1au"
"qjoqx\\a"
"pu\"ekdnfpmly\xbago\""
"fjhhdy"
"arl"
"xcywisim\"bwuwf\"\"raepeawwjub"
"pbe"
"dbnqfpzyaumxtqnd\xc5dcqrkwyop"
"ojv\x40vtkwgkqepm\x8bzft\\vedrry"
"wggqkfbwqumsgajqwphjec\"mstxpwz"
"zjkbem"
"icpfqxbelxazlls"
"pvpqs\\abcmtyielugfgcv\"tjxapxqxnx"
"oqddwlvmtv\"\x39lyybylfb\"jmngnpjrdw"
"gisgbve"
"\"aglg"
"y\"\"ss\xafvhxlrjv"
"qbgqjsra"
"ihshbjgqpdcljpmdwdprwloy"
"djja\\wcdn\"svkrgpqn\"uz\"hc\x43hj"
"cbjm"
"pnn"
"pqvh\"noh"
"\"\\fdktlp"
"ncea"
"pqgzphiyy"
"\xbedovhxuipaohlcvkwtxwmpz\"ckaif\"r"
"arjuzbjowqciunfwgxtph\"vlhy\"n"
"c"
"nrpdxunulgudqzlhtae"
"iefheu\"uru\""
"aqijysxuijud\"np\\opbichhudil\xbesum"
"pfpevmtstl\"lde\"bzr\"vspdxs"
"vparfbdjwvzsocpnzhp"
"g\x4ffxaarafrsjthq\\\xc1rw"
"ng\\rqx\\gwpzucbh\xafl"
"rw\"nf\\dna"
"jkkeahxurxla\\g\xb3czrlsyimmwcwthr"
"twaailoypu\"oas\"kpuuyedlaw\\\xb0vzt"
"hznex\\gdiqvtugi"
"imdibsunjeswhk"
"ta\\icileuzpxro\"cfmv\"mzp"
"coykr\x57luiysucfaflmilhlehmvzeiepo"
"u\x3dfh\xd4yt"
"piw\x1bz\"eowy\"vfk\"wqiekw"
"gan\"y"
"p\"bevidoazcznr\"hddxuuq\""
"bwzucczznutbxe"
"z\"viqgyqjisior\\iecosmjbknol"
"dmlpcglcfkfsctxydjvayhymv\x3c\\gp"
"bfvkqrintbbvgfv"
"xlzntrgdck\"cprc\xadczyarbznqmuhxyuh"
"uqdxnuwioc\"kdytxq\\ig"
"xrafmucpmfi"
"vr\"hltmfrge"
"eonf\"nt\\wtcnsocs"
"j\xb7xoslyjeyjksplkqixncgkylkw"
"njw\"pefgfbez\x9axshdmplxzquqe"
"di\x58bvptfsafirpc"
"l\x1fkco"
"x"
"mprndo\"n"
"psegit"
"svbdnkkuuqs\"sqxu\"oqcyz\"aizashk"
"cwkljukxer\\\"\\nff\"esjwiyaoy"
"ilxrkgbjjxpvhdtq\"cpiuoofdnkpp"
"hlngi\"ulxep\\qohtmqnqjb\"rkgerho"
"gxws\"bcgm\"p"
"bv\"mds\\zhfusiepgrz\\b\x32fscdzz"
"l\xfampwtme\x69qvxnx\"\"\xc4jruuymjxrpsv"
"qqmxhrn"
"xziq\\\x18ybyv\x9am\"neacoqjzytertisysza"
"aqcbvlvcrzceeyx\\j\"\"x"
"yjuhhb"
"\x5em\"squulpy"
"dpbntplgmwb"
"utsgfkm\\vbftjknlktpthoeo"
"ccxjgiocmuhf\"ycnh"
"lltj\"kbbxi")";
#endif /* INPUT_HPP_ */
| 21.87013
| 73
| 0.735748
|
Miroslav-Cetojevic
|
0154687ea02a7da87ac0a0d0c70192c7785c63ab
| 4,074
|
hpp
|
C++
|
DT3Core/Components/ComponentGUIButton.hpp
|
9heart/DT3
|
4ba8fd2af3aebb5c0d77036ac3941e83cd4d1c7e
|
[
"MIT"
] | 3
|
2018-10-05T15:03:27.000Z
|
2019-03-19T11:01:56.000Z
|
DT3Core/Components/ComponentGUIButton.hpp
|
pakoito/DT3
|
4ba8fd2af3aebb5c0d77036ac3941e83cd4d1c7e
|
[
"MIT"
] | null | null | null |
DT3Core/Components/ComponentGUIButton.hpp
|
pakoito/DT3
|
4ba8fd2af3aebb5c0d77036ac3941e83cd4d1c7e
|
[
"MIT"
] | 3
|
2016-01-14T07:51:52.000Z
|
2021-08-21T08:02:51.000Z
|
#ifndef DT3_COMPONENTGUICLICKBUTTON
#define DT3_COMPONENTGUICLICKBUTTON
//==============================================================================
///
/// File: ComponentGUIButton.hpp
///
/// Copyright (C) 2000-2014 by Smells Like Donkey Software Inc. All rights reserved.
///
/// This file is subject to the terms and conditions defined in
/// file 'LICENSE.txt', which is part of this source code package.
///
//==============================================================================
#include "DT3Core/Components/ComponentBase.hpp"
#include "DT3Core/Types/Node/Plug.hpp"
#include "DT3Core/Types/Node/Event.hpp"
#include "DT3Core/Types/Utility/LatentCall.hpp"
namespace DT3 {
//==============================================================================
/// Forward declarations
//==============================================================================
class GUITouchEvent;
class SoundResource;
//==============================================================================
/// GUI behaviour for a button.
//==============================================================================
class ComponentGUIButton: public ComponentBase {
public:
DEFINE_TYPE(ComponentGUIButton,ComponentBase)
DEFINE_CREATE_AND_CLONE
DEFINE_PLUG_NODE
ComponentGUIButton (void);
ComponentGUIButton (const ComponentGUIButton &rhs);
ComponentGUIButton & operator = (const ComponentGUIButton &rhs);
virtual ~ComponentGUIButton (void);
virtual void archive (const std::shared_ptr<Archive> &archive);
public:
/// Called to initialize the object
virtual void initialize (void);
/// Returns the component type. This defines which slot the component is
/// put into on the object.
/// \return Component type
virtual ComponentType component_type (void) { return COMPONENT_TOUCH; }
/// Called when this component is added to the owner. Note that this will
/// only be called if the owner is added to a world already. If not it
/// will be called when it is added to the World.
/// \param owner Pointer to the owner
virtual void add_to_owner (ObjectBase *owner);
/// Called when this component is removed from its owner.
virtual void remove_from_owner (void);
/// Callback called when the component is getting a touch begin event
/// \param event Touch events
void touches_began (GUITouchEvent *event);
/// Callback called when the component is getting a touch move event
/// \param event Touch events
void touches_moved (GUITouchEvent *event);
/// Callback called when the component is getting a touch end event
/// \param event Touch events
void touches_ended (GUITouchEvent *event);
/// Callback called when the component is getting a touch cancelled event
/// \param event Touch events
void touches_cancelled (GUITouchEvent *event);
/// Defines standard accessors for the sound that is played when this button is clicked
DEFINE_ACCESSORS (sound, set_sound, std::shared_ptr<SoundResource>, _sound);
/// Defines standard accessors for the optional callback when this button is clicked
DEFINE_ACCESSORS (button_pressed_latent_call,set_button_pressed_latent_call,std::shared_ptr<LatentCall>, _button_pressed_latent_call)
private:
std::shared_ptr<LatentCall> _button_pressed_latent_call;
Plug<std::shared_ptr<SoundResource> > _sound;
Event _clicked;
};
//==============================================================================
//==============================================================================
} // DT3
#endif
| 40.336634
| 141
| 0.536819
|
9heart
|
01559cd75ae6b716ec080ec879644c2faee00819
| 587
|
cpp
|
C++
|
c++/leetcode/0560-Subarray_Sum_Equals_K-M.cpp
|
levendlee/leetcode
|
35e274cb4046f6ec7112cd56babd8fb7d437b844
|
[
"Apache-2.0"
] | 1
|
2020-03-02T10:56:22.000Z
|
2020-03-02T10:56:22.000Z
|
c++/leetcode/0560-Subarray_Sum_Equals_K-M.cpp
|
levendlee/leetcode
|
35e274cb4046f6ec7112cd56babd8fb7d437b844
|
[
"Apache-2.0"
] | null | null | null |
c++/leetcode/0560-Subarray_Sum_Equals_K-M.cpp
|
levendlee/leetcode
|
35e274cb4046f6ec7112cd56babd8fb7d437b844
|
[
"Apache-2.0"
] | null | null | null |
// 560 Subarray Sum Equals K
// https://leetcode.com/problems/subarray-sum-equals-k
// version: 1; create time: 2020-01-12 11:49:39;
class Solution {
public:
int subarraySum(vector<int>& nums, int k) {
unordered_map<int, int> sums;
sums[0] = 1;
int acc = 0;
long total_cnts = 0;
for (const auto& num : nums) {
acc += num;
const auto target = acc - k;
if (sums.count(target)) {
total_cnts += sums[target];
}
++sums[acc];
}
return total_cnts;
}
};
| 25.521739
| 54
| 0.511073
|
levendlee
|
015922c6d8f595caddd7e38825a324f2e88f6ac1
| 385
|
hpp
|
C++
|
n2o/object.hpp
|
agnat/n2o
|
d556de47783b528d0f98b85b02433286312eacc8
|
[
"MIT"
] | 6
|
2016-07-28T14:04:02.000Z
|
2019-06-06T04:03:32.000Z
|
n2o/object.hpp
|
agnat/n2o
|
d556de47783b528d0f98b85b02433286312eacc8
|
[
"MIT"
] | null | null | null |
n2o/object.hpp
|
agnat/n2o
|
d556de47783b528d0f98b85b02433286312eacc8
|
[
"MIT"
] | 1
|
2018-06-07T05:18:06.000Z
|
2018-06-07T05:18:06.000Z
|
#ifndef N2O_OBJECT_INCLUDED
#define N2O_OBJECT_INCLUDED
#include <n2o/detail/property_value.hpp>
namespace n2o {
class object {
public:
explicit object(v8::Handle<v8::Object> o) : obj_(o) {}
detail::property_value operator[](const char * name) {
return detail::property_value(obj_, name);
}
v8::Local<v8::Object> obj_;
};
}
#endif // N2O_OBJECT_INCLUDED
| 17.5
| 58
| 0.690909
|
agnat
|
015b79d88d8241b4ab3a35cbf2dce57b1f634984
| 25,353
|
hpp
|
C++
|
include/linalg/col_matrix.hpp
|
YuanL12/BATS
|
35a32facc87e17649b7fc32225c8ffaf0301bbfa
|
[
"MIT"
] | null | null | null |
include/linalg/col_matrix.hpp
|
YuanL12/BATS
|
35a32facc87e17649b7fc32225c8ffaf0301bbfa
|
[
"MIT"
] | null | null | null |
include/linalg/col_matrix.hpp
|
YuanL12/BATS
|
35a32facc87e17649b7fc32225c8ffaf0301bbfa
|
[
"MIT"
] | null | null | null |
#pragma once
#include <vector>
#include <map>
#include <cstddef>
#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <random>
#include <chrono>
#include "abstract_matrix.hpp"
#include "csc_matrix.hpp"
#include "abstract_vector.hpp"
// standard list of list implementation for sparse matrix
// forward declarations
template <class TC>
class ColumnMatrix;
template <class TC>
TC l_solve(const ColumnMatrix<TC> &L, const TC &y);
template <class TC>
TC u_solve(const ColumnMatrix<TC> &U, const TC &y);
// template over column type
template <class TC>
class ColumnMatrix : public AbstractMatrix
{
private:
size_t m = 0; // number of rows
size_t n = 0; // number of columns
std::vector<TC> col;
public:
using val_type = typename TC::val_type;
using col_type = TC;
// default constructor
ColumnMatrix() {}
// construct empty matrix. same as zero matrix
ColumnMatrix(size_t m, size_t n) : m(m), n(n) {
col.resize(n, TC());
}
/**
construct column matrix filled with entry a
*/
ColumnMatrix(size_t _m, size_t _n, val_type a) : m(_m), n(_n) {
col.resize(n, TC(a, m));
}
ColumnMatrix(const std::vector<TC> &_col) : col(_col) {
n = col.size();
}
ColumnMatrix(size_t _m, size_t _n, const std::vector<TC>& _col) : m(_m), n(_n), col(_col) {}
// constructor from ColumnMatrix with integer type
template <typename TC2>
ColumnMatrix(const ColumnMatrix<TC2> &other) : m(other.nrow()), n(other.ncol()) {
col.resize(n);
for (size_t j = 0; j < n; j++) {
col[j] = TC(other[j]);
}
}
// constructor from CSCMatrix over the integers
ColumnMatrix(const CSCMatrix<int, size_t> &A) : m(A.nrow()), n(A.ncol()) {
col.reserve(n);
auto colptr = A.get_colptr();
auto rowind = A.get_rowind();
auto val = A.get_val();
auto rptr = rowind.cbegin();
auto vptr = val.cbegin();
for (size_t j = 0; j < n; j++) {
// use iterator constructor
col.emplace_back(TC(
rptr + colptr[j],
vptr + colptr[j],
colptr[j+1] - colptr[j]
));
}
}
void read(std::istream &io) {
std::string line, token;
getline(io, line); // TODO: should be "Sparse Matrix"
getline(io, line); // get first line
// get dimensions from first line
std::istringstream iss(line);
getline(iss, token, ',');
m = std::stoi(token);
getline(iss, token);
n = std::stoi(token);
col.resize(n);
for (size_t j = 0; j < n; j++) {
getline(io, line);
col[j] = TC(line);
}
}
ColumnMatrix(std::istream& io) {
read(io);
}
ColumnMatrix(std::string &fname) {
std::ifstream file (fname, std::ios::in);
if (file.is_open()) {
read(file);
file.close();
} else {
std::cerr << "unable to read ColumnMatrix from " << fname << std::endl;
}
}
inline size_t nrow() const { return m; }
inline size_t ncol() const { return n; }
inline std::vector<TC>& cols() { return col; }
inline const std::vector<TC>& cols() const { return col; }
inline void set_nrow(size_t mnew) { m = mnew; }
auto getval(const size_t i, const size_t j) const {
return col[j].getval(i);
}
// inline size_t width() {
// return col.size();
// }
/**
append a column to the end of the matrix
calls a column vector constructor on arguments passed in.
*/
template <class ...Ts>
void append_column(Ts (&...args)) { col.emplace_back(TC(args...)); n++; }
template <class ...Ts>
void append_column(Ts (&&...args)) { col.emplace_back(TC(args...)); n++; }
/**
append an empty row to the end of the matrix
*/
inline void append_row() { m++; }
/**
Do not recommend,
because if we want to insert multiple columns,
the index will change after the first insertion.
Thus the important thing we need to assume is
the index list are in ascending order!
*/
template <class ...Ts>
void insert_column(const size_t& index, Ts (&&...args)){
// first append a row to the end
append_column(args...);
// second permute it
std::vector<size_t> colperm;
colperm.reserve(n);
for (size_t i = 0; i < n ; i++){
size_t j = i ;
if (i == index) j = n-1;
if (i > index) j = i-1;
colperm.emplace_back(j);
}
ipermute_cols(colperm);
}
// append a zero column at the end
void append_column(){ col.emplace_back(TC()); n++; }
// insert a zero column at position index
void insert_column(const size_t& index){
// first append a row to the end
append_column();
// second permute it
std::vector<size_t> colperm;
colperm.reserve(n);
for (size_t i = 0; i < n ; i++){
size_t j = i ;
if (i == index) j = n-1;
if (i > index) j = i-1;
colperm.emplace_back(j);
}
permute_cols(colperm);
}
/**
insert list of columns at list of specified indices
mutates input inserted columns
*/
void insert_columns(
const std::vector<size_t>& c_inds,
std::vector<TC>& insert_col
) {
n = n + c_inds.size();
std::vector<TC> newcol(n);
size_t i = 0;
auto newi = 0;
auto oldi = 0;
while (oldi < col.size() && newi < insert_col.size()) {
if (i == c_inds[newi]) {
// insert next new column
std::swap(newcol[i], insert_col[newi]);
++i;
++newi;
} else {
std::swap(newcol[i], col[oldi]);
++i;
++oldi;
}
}
// at most one of the next two while-loops will execute
// this one just puts the rest of the old columns in
while (oldi < col.size()) {
std::swap(newcol[i], col[oldi]);
++i;
++oldi;
}
// else, we just add rest of new columns to end
while (newi < insert_col.size()) {
std::swap(newcol[i], insert_col[newi]);
++i;
++newi;
}
// finally, swap these
std::swap(col, newcol);
}
// append a row a specified value
void append_row(const std::vector<val_type> & row) {
if (row.size() == ncol()){
for (size_t j = 0; j < ncol(); j++) {
if (row[j]!= val_type(0))
col[j].emplace_back(m , row[j]);
}
++m;
}else{
std::cout << "\nUnable to add row, since the dimension does not match" << std::endl;
}
}
void insert_row(const size_t& index, const std::vector<val_type> & row){
// first append a row to the end
append_row(row);
// second permute it
std::vector<size_t> rowperm;
rowperm.reserve(m);
for (size_t i = 0; i < m ; i++){
size_t j = i;
if (i == index) j = m-1;
if (i > index) j = i-1;
rowperm.emplace_back(j);
}
permute_rows(rowperm);
}
// insert a zero row
void insert_row(const size_t& index){
// first append a row to the end
append_row();
// second permute it
std::vector<size_t> rowperm;
rowperm.reserve(m);
for (size_t i = 0; i < m ; i++){
size_t j = i;
if (i == index) j = m-1;
if (i > index) j = i-1;
rowperm.emplace_back(j);
}
permute_rows(rowperm);
}
/**
insert zero rows at specified locations
*/
void insert_rows(const std::vector<size_t>& r_inds) {
for (size_t j = 0; j < n; ++j) {
col[j].insert_rows(r_inds);
}
m = m + r_inds.size();
}
void erase_column(const size_t& index){
col.erase(col.begin()+index);
--n;
}
void erase_column(){
col.erase(--col.end());
--n;
}
/**
erase specified row
*/
void erase_row(const size_t& index){
for (size_t j = 0; j < ncol(); j++) {
col[j].erase_for_matrix(index);
}
--m;
}
/**
erase last row
*/
void erase_row(){
for (size_t j = 0; j < ncol(); j++) {
col[j].erase_last_row_of_matrix(m-1);
}
--m;
}
/**
assumes that last row is zero
so we only need to decrement number of rows
*/
void erase_row_unsafe(){
--m;
}
inline TC& operator[](size_t index) { return col[index];}
inline const TC& operator[](size_t index) const { return col[index];}
inline auto operator()(size_t i, size_t j) const {
return col[j][i];
}
bool operator==(const ColumnMatrix &other) const {
if (m != other.m || n != other.n) {return false;}
for (size_t j = 0; j < n; j++) {
if (col[j] != other.col[j]) {return false;}
}
return true;
}
std::vector<std::vector<val_type>> to_row_array() const {
std::vector<std::vector<val_type>> A(m);
for (size_t i = 0; i < m; i++) {
for (size_t j = 0; j < n; j++) {
A[i].emplace_back(getval(i,j));
}
}
return A;
}
// dump matrix into a dense array in column-major format
// WARNING: allocates memory, which must be deleted
val_type* dump_dense() const {
val_type* arr = new val_type[m*n];
for (size_t j = 0; j < n; j++) {
for (size_t i = 0; i < m; i++) {
arr[i + j*m] = col[j][i];
}
}
return arr;
}
//
// TC& constcol const (size_t index) {
// return col[index];
// }
ColumnMatrix submatrix(
const std::vector<size_t> &rind,
const std::vector<size_t> &cind
) const {
std::vector<TC> newcol;
newcol.reserve(cind.size());
auto prow = bats::util::partial_perm(rind, nrow());
// loop in column permutation order
for ( size_t j : cind) {
newcol.emplace_back(col[j].subvector(prow));
}
return ColumnMatrix(rind.size(), cind.size(), newcol);
}
// get block A[i0:i1, j0:j1]
// i1,j1 are not inclusive
ColumnMatrix block(
const size_t i0,
const size_t i1,
const size_t j0,
const size_t j1
) const {
std::vector<TC> newcol;
newcol.reserve(j1 - j0);
for (size_t j = j0; j < j1; j++) {
newcol.emplace_back(col[j].block(i0, i1));
}
return ColumnMatrix(i1 - i0, j1 - j0, newcol);
}
void set_block(
const size_t i0,
const size_t i1,
const size_t j0,
const size_t j1,
const ColumnMatrix& B
) {
for (size_t j = j0, k=0; j < j1; j++, k++) {
col[j].set_block(i0, i1, B[k]);
}
}
/**
clear rows i for which c[i] is true
use vector of bools for quick lookup - vector of inds would require search
*/
void clear_rows(const std::vector<bool> &c) {
if (c.size() != nrow()) {throw std::runtime_error("input vector does not match number of rows.");}
for (size_t j = 0; j < ncol(); ++j) {
col[j].clear_inds(c);
}
}
/**
clear columns j for which c[j] is true
frees memory as well
*/
void clear_cols(const std::vector<bool> &c) {
if (c.size() != ncol()) {throw std::runtime_error("input vector does not match number of columns.");}
for (size_t j = 0; j < ncol(); ++j) {
if (c[j]) {
col[j].clear_dealloc();
}
}
}
// swap rows i, i2
void swap_rows(const size_t i, const size_t i2) {
for (size_t j = 0; j < ncol(); j++) {
col[j].swap_rows(i,i2);
}
}
void mix_rows(const size_t i, const size_t i2, const val_type& a, const val_type& b, const val_type& c, const val_type& d) {
for (size_t j = 0; j < ncol(); j++) {
col[j].mix_rows(i, i2, a, b, c, d);
}
}
void add_rows(const size_t i, const val_type& c, const size_t i2) {
for (size_t j = 0; j < ncol(); j++) {
col[j].add_rows(i, c, i2);
}
}
// addition, substraction, scalar multiplication
// gemv
TC gemv(const TC &x) const {
TC y; // zero initializer
typename TC::tmp_type tmp; // for use with axpy
// loop over nonzero indices of x
for (auto xit = x.nzbegin(); xit != x.nzend(); ++xit) {
y.axpy((*xit).val, col[(*xit).ind], tmp); // y <- x[j]*A[j]
}
return y;
}
// scalar multiplication
ColumnMatrix operator*(const val_type a) const {
std::vector<TC> newcol;
newcol.reserve(n);
for (size_t j = 0; j < n; j++) {
newcol.emplace_back(col[j] * a);
}
return ColumnMatrix(m, n, newcol);
}
inline TC operator*(const TC &x) const { return gemv(x); }
// gemm C = self * B
ColumnMatrix operator*(const ColumnMatrix &B) const {
std::vector<TC> colC;
colC.reserve(n);
//ColumnMatrix C(m, B.n);
for (size_t j = 0; j < B.n; j++) {
colC.emplace_back(
gemv(B.col[j])
);
}
return ColumnMatrix(m, B.n, colC);
}
/**
multiplication x^T A
*/
friend TC operator*(const TC& x, const ColumnMatrix& A) {
std::vector<size_t> ind;
std::vector<typename TC::val_type> val;
for (size_t j = 0; j < A.ncol(); ++j) {
auto a = x * A[j];
if (a != 0) {
ind.emplace_back(j);
val.emplace_back(a);
}
}
return TC(ind, val);
}
ColumnMatrix operator+(const ColumnMatrix &B) const {
ColumnMatrix C(B); // copy constructor
for (size_t j = 0; j < n; j++) {
C.col[j].axpy(1, col[j]);
}
return C;
}
ColumnMatrix& operator+=(const ColumnMatrix &B) {
for (size_t j = 0; j < n; j++) {
col[j].axpy(1, B.col[j]);
}
return *this;
}
ColumnMatrix operator-(const ColumnMatrix &B) const {
ColumnMatrix C(B); // copy constructor
for (size_t j = 0; j < n; j++) {
C.col[j].axpy(-1, col[j]);
}
return C;
}
ColumnMatrix transpose() const {
std::vector<TC> tcol(m);
// loop over columns
for (size_t j = 0; j < n; j++) {
for (auto it = col[j].nzbegin(); it != col[j].nzend(); ++it) {
tcol[it->ind].emplace_back(j, it->val);
}
}
return ColumnMatrix(n, m, tcol);
}
inline ColumnMatrix T() const { return transpose(); }
// permutations: permute, permute_rows, permute_cols
// permute columns in-place
// TODO: evaluate if this is best method.
inline void permute_cols(const std::vector<size_t> &colperm) {
bats::util::apply_perm_swap(col, colperm);
}
inline void ipermute_cols(const std::vector<size_t> &colperm) {
bats::util::apply_iperm_swap(col, colperm);
}
// vj <- a * vj + c * vk
// vk <- b * vj + d * vk
void mix_cols(const size_t j, const size_t k, const val_type& a, const val_type& b, const val_type& c, const val_type& d) {
TC cj(col[j]);
TC ck(col[k]);
col[j].scale_inplace(a);
col[j].axpy(c, ck);
col[k].scale_inplace(d);
col[k].axpy(b, cj);
}
// permute rows in-place
void permute_rows(const std::vector<size_t> &rowperm) {
// // TODO: this is trivially parallelizable
for (size_t i = 0; i < col.size(); i++) {
col[i].permute(rowperm);
}
}
// permute rows in-place
void ipermute_rows(const std::vector<size_t> &rowperm) {
// // TODO: this is trivially parallelizable
for (size_t i = 0; i < col.size(); i++) {
col[i].ipermute(rowperm);
}
}
// permute both rows and columns
void permute(const std::vector<size_t> &rowperm,
const std::vector<size_t> &colperm) {
permute_cols(colperm);
permute_rows(rowperm);
}
// apply J matrix from the right
ColumnMatrix& J_right_inplace() {
for (size_t j =0; j < n/2; j++) {
std::swap(col[j], col[n-1-j]);
}
return *this;
}
inline ColumnMatrix J_right() const {
ColumnMatrix other(*this);
other.J_right_inplace();
return other;
}
// apply J matrix from the left
ColumnMatrix& J_left_inplace() {
for (size_t j=0; j < n; j++) {
col[j].J(m);
}
return *this;
}
inline ColumnMatrix J_left() const {
ColumnMatrix other(*this);
other.J_left_inplace();
return other;
}
ColumnMatrix& J_conjugation_inplace() {
J_left_inplace();
J_right_inplace();
return *this;
}
inline ColumnMatrix J_conjugation() const {
ColumnMatrix other(*this);
other.J_conjugation_inplace();
return other;
}
// swap columns j1 and j2
inline void swap_cols(size_t j1, size_t j2) {
std::swap(col[j1], col[j2]);
}
// schur complement of i,j entry
inline void schur_complement(size_t i, size_t j) {
auto a11 = col[j][i];
for (size_t j1 = j+1; j1 < n; j1++) {
auto c = col[j1][i];
if (c != 0) {
col[j1].axpy(-c / a11, col[j], i+1, m);
}
}
}
// apply diagonal matrix with coeff vector along diagonal on the left
ColumnMatrix& row_scale(const std::vector<val_type> &coeff) {
for (size_t j = 0; j < n; j++) {
col[j].scale_inplace(coeff);
}
return *this;
}
// apply inverse of diagonal matrix with coeff vector along diagonal on the left
ColumnMatrix& col_inv_scale(const std::vector<val_type> &coeff) {
for (size_t j = 0; j < n; j++) {
col[j].scale_inplace(coeff[j].inv());
}
return *this;
}
// number of nonzeros
size_t nnz() const {
size_t ct = 0;
for (size_t j = 0; j < n; j++) {
ct += col[j].nnz();
}
return ct;
}
// tests to see if matrix is zero
bool is_zero() const {
for (size_t j = 0; j < n; j++) {
if( col[j].nnz() > 0) {
return false;
}
}
return true;
}
// tests to see if matrix has structure
bool is_upper() const {
for (size_t j = 0; j < n; ++j) {
auto iv = col[j].nzend();
if (iv != col[j].nzbegin()) {
--iv;
if (iv->ind > j) {
return false;
}
}
}
return true;
}
// tests to see if matrix is invertible and upper-triangular
bool is_upper_invert() const {
for (size_t j = 0; j < n; ++j) {
auto iv = col[j].nzend();
if (iv != col[j].nzbegin()) {
--iv;
if (iv->ind != j) {
return false;
}
}
}
return true;
}
bool is_lower() const {
for (size_t j = 0; j < n; j++) {
auto iv = col[j].nzbegin();
if (iv != col[j].nzend()) {
if (iv->ind < j) {
return false;
}
}
}
return true;
}
bool is_reduced() const {
// check whether columns have unique lower index (if it exists)
std::map<size_t, size_t> p2c;
for (size_t j = 0; j < n; j++) {
auto st = col[j].nzbegin();
auto end = col[j].nzend();
if (st != end) {
end--;
if (p2c.count(end->ind) > 0) {
// pivot already exists - return false
return false;
} else {
p2c[end->ind] = j;
}
}
}
return true;
}
bool is_pivot_matrix() const {
for (size_t j = 0; j < n; j++) {
if (col[j].nnz() > 1) {
return false;
}
}
// check that rows also have at most 1 nonzero
ColumnMatrix row = transpose();
for (size_t i = 0; i < m; i++) {
if (row[i].nnz() > 1) {
return false;
}
}
return true;
}
bool is_EL() const {
size_t j = 0;
ssize_t i = -1;
while (j < n) {
auto st = col[j].nzbegin();
auto end = col[j].nzend();
// check if no pivots
if (std::distance(st, end) == 0) { j++; break; }
// check that pivot is strictly increasing
if (std::distance(st, end) > 1 || ssize_t(st->ind) <= i) { return false; }
i = st->ind;
j++;
}
// enter this loop after we encounter a column with no zeros
while (j < n) {
if (col[j].nnz() == 0) {
j++;
} else {
return false;
}
}
return true;
}
inline bool is_EU() const { return transpose().is_EL(); }
inline bool is_ELhat() const { return J_conjugation().is_EU(); }
inline bool is_EUhat() const {return J_conjugation().is_EL(); }
void print_size() const {
std::cout << "[" << this << "] : " << m << " x " << n <<\
" ColumnMatrix" << std::endl;
}
void print() const {
print_size();
// loop over rows
for (size_t i = 0; i < m; i++) {
for (size_t j = 0; j < n; j++) {
std::cout << std::setw(3) << getval(i, j) << " ";
}
std::cout << std::endl;
}
return;
}
// template <typename IO>
void write(std::ostream &io) const {
io << "ColumnMatrix\n";
io << nrow() << ',' << ncol() << '\n';
for (size_t j = 0; j < ncol(); j++) {
// write column as row
col[j].write(io);
}
}
std::string str() {
std::ostringstream oss;
write(oss);
return oss.str();
}
void save(std::string &fname) const {
std::ofstream file (fname, std::ios::out);
if (file.is_open()) {
write(file);
file.close();
} else {
std::cerr << "unable to write ColumnMatrix to " << fname << std::endl;
}
}
// static methods
static ColumnMatrix identity(size_t n) {
std::vector<TC> col(n);
for (size_t j = 0; j < n; j++) {
col[j] = TC(j);
}
return ColumnMatrix(n, n, col);
}
static ColumnMatrix random(size_t m, size_t n, double p, int maxval, std::default_random_engine &generator) {
std::vector<TC> col(n);
for (size_t j = 0; j < n; j++) {
col[j] = TC::random(m, p, maxval, generator);
}
return ColumnMatrix(m, n, col);
}
static ColumnMatrix random(size_t m, size_t n, double p, int maxval) {
// obtain a seed from the system clock:
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
std::default_random_engine generator(seed);
return random(m, n, p, maxval, generator);
}
// tensor product A \otimes B
// use Kronecker product ordering
friend ColumnMatrix tensor_product(const ColumnMatrix& A, const ColumnMatrix& B) {
size_t Am = A.nrow();
size_t An = A.ncol();
size_t Bm = B.nrow();
size_t Bn = B.ncol();
std::vector<TC> newcol;
for (size_t i = 0; i < An; i++) {
for (size_t j = 0; j < Bn; j++) {
newcol.emplace_back(A[j].tensor(B[j]));
}
}
return ColumnMatrix(Am * Bm, An * Bn, newcol);
}
// direct sum A \oplus B
friend ColumnMatrix direct_sum(const ColumnMatrix& A, const ColumnMatrix& B) {
size_t Am = A.nrow();
size_t An = A.ncol();
size_t Bm = B.nrow();
size_t Bn = B.ncol();
std::vector<TC> newcol;
for (size_t j = 0; j < An; j++) {
newcol.emplace_back(A[j]);
}
for (size_t j = 0; j < Bn; j++) {
newcol.emplace_back(B[j].shift_inds(Am));
}
return ColumnMatrix(Am + Bm, An + Bn, newcol);
}
};
// matvec
// matmul
// return y = A*x
template <class TC>
TC gemv(ColumnMatrix<TC> &A, const TC &x) {
return A.gemv(x);
}
// return y = U \ x
// solves x = U * y
// Assumes U is upper triangular, with unit diagonal
// pseudo-code
// for i = n:-1:1
// y[i] = y[i] - U[i,j]x[j]
// this is not generic over TC!
// template <class TC>
// TC ut_solve(ColumnMatrix<TC> &U, const TC &x) {
// //std::cout << "entering solve" << std::endl;
// TC y(x);
// auto yi = y.nzend() - 1;
// //std::cout << yi->first << " : " << yi->second << std::endl;
// while (yi >= y.nzbegin() && yi < y.nzend()) {
// size_t i = yi - y.nzbegin();
// size_t iind = y.nzind(i);
// if (iind == 0) {
// break;
// }
// y.axpy(-y.nzval(i), U[iind], 1); //y.axpy(-yp.second, U[i][:i-1])
// // find next nonzero index
// yi = y.find_last_nz(iind - 1);
// }
// return y;
// }
template <class TC>
TC u_solve(const ColumnMatrix<TC> &U, const TC &y) {
TC x(y);
if (x.nnz() == 0) { return x; }
typename TC::tmp_type tmp; // for use with axpy
size_t n = U.ncol();
//size_t m = U.nrow();
size_t j = n;
auto xit = x.upper_bound(j);
while (xit != x.nzbegin()) {
// exract j
--xit;
j = xit->ind;
// x[j] = x[j] / U[j,j]
auto Uj_it = U[j].lower_bound(j); // assume entry j exists and is invertible
if (Uj_it == U[j].nzend()) {throw std::logic_error("diagonal doesn't exist");}
auto a = (xit->val) / (Uj_it->val);
x.replace(xit, a);
if (j == 0) { break; } // we're done
// x[0:j-1] -= x[j] * U[0:j-1, j]
x.axpy(-a, U[j], 0, j, tmp);
// get next nonzero
xit = x.upper_bound(j-1);
}
return x;
}
template <class TC>
TC l_solve(const ColumnMatrix<TC> &L, const TC &y) {
TC x = y;
if (x.nnz() == 0) { return x; }
typename TC::tmp_type tmp; // for use with axpy
//size_t n = L.ncol();
size_t m = L.nrow();
size_t j = 0;
auto xit = x.lower_bound(j);
while (xit != x.nzend()) {
j = (*xit).ind;
// x[j] = x[j] / L[j,j]
auto Lj_it = L[j].lower_bound(j); // assume entry j exists and is invertible
auto a = (*xit).val / (*Lj_it).val;
x.replace(xit, a);
//*xit = nzpair((*xit).ind, a);
// x[j+1:] -= x[j] * L[j+1:m, j]
x.axpy(-a, L[j], j+1, m, tmp);
// get next nonzero
xit = x.lower_bound(j+1);
}
return x;
}
// solve U \ A
template <class TC>
ColumnMatrix<TC> u_solve(const ColumnMatrix<TC> &U, const ColumnMatrix<TC> &A) {
//std::cout << "entering solve" << std::endl;
size_t m = A.nrow();
size_t n = A.ncol();
std::vector<TC> col;
col.reserve(n);
for (size_t j = 0; j < n; j++) {
col.emplace_back(
u_solve(U, A[j])
);
}
return ColumnMatrix<TC>(m, n, col);
}
// solve L \ A
template <class TC>
ColumnMatrix<TC> l_solve(const ColumnMatrix<TC> &L, const ColumnMatrix<TC> &A) {
//std::cout << "entering solve" << std::endl;
size_t m = A.nrow();
size_t n = A.ncol();
std::vector<TC> col;
col.reserve(n);
for (size_t j = 0; j < n; j++) {
col.emplace_back(
l_solve(L, A[j])
);
}
return ColumnMatrix<TC>(m, n, col);
}
// form inverse U^{-1}
template <class TC>
ColumnMatrix<TC> u_inv(const ColumnMatrix<TC> &U) {
//std::cout << "entering solve" << std::endl;
size_t m = U.nrow();
// size_t n = U.ncol();
return u_solve(U, ColumnMatrix<TC>::identity(m));
}
// form inverse L^{-1}
template <class TC>
ColumnMatrix<TC> l_inv(const ColumnMatrix<TC> &L) {
//std::cout << "entering solve" << std::endl;
size_t m = L.nrow();
// size_t n = U.ncol();
return l_solve(L, ColumnMatrix<TC>::identity(m));
}
| 24.354467
| 125
| 0.566324
|
YuanL12
|
0165a33bb6ce3fef59e6120f5f1728863b03f9f1
| 7,200
|
cpp
|
C++
|
shaderapivulkan/src/TF2Vulkan/shaders/VulkanShaderManager.cpp
|
melvyn2/TF2Vulkan
|
a8cd1c49ecfe9d4dc31af0a50ba7690c61c255c4
|
[
"MIT"
] | null | null | null |
shaderapivulkan/src/TF2Vulkan/shaders/VulkanShaderManager.cpp
|
melvyn2/TF2Vulkan
|
a8cd1c49ecfe9d4dc31af0a50ba7690c61c255c4
|
[
"MIT"
] | null | null | null |
shaderapivulkan/src/TF2Vulkan/shaders/VulkanShaderManager.cpp
|
melvyn2/TF2Vulkan
|
a8cd1c49ecfe9d4dc31af0a50ba7690c61c255c4
|
[
"MIT"
] | null | null | null |
#include "interface/internal/IShaderDeviceInternal.h"
#include "VulkanShaderManager.h"
#include <TF2Vulkan/Util/Buffer.h>
#include <TF2Vulkan/Util/std_utility.h>
#include <stdshader_vulkan/ShaderBlobs.h>
#include <materialsystem/shader_vcs_version.h>
#include <spirv_cross.hpp>
#include <mutex>
#include <unordered_map>
using namespace TF2Vulkan;
using namespace TF2Vulkan::ShaderReflection;
namespace
{
struct ShaderInfo
{
constexpr ShaderInfo(ShaderBlobType blob) :
m_Blob(blob)
{
}
ShaderBlobType m_Blob;
};
class VulkanShaderManager final : public IVulkanShaderManager
{
public:
const TF2Vulkan::IVulkanShader& FindOrCreateShader(const CUtlSymbolDbg& name) override;
private:
struct CompiledShader final : TF2Vulkan::IVulkanShader
{
CompiledShader(const CUtlSymbolDbg& name);
vk::ShaderModule GetModule() const override { return m_Shader.get(); }
const CUtlSymbolDbg& GetName() const override { return m_Name; }
const ReflectionData& GetReflectionData() const override { return m_ReflectionData; }
CUtlSymbolDbg m_Name;
vk::UniqueShaderModule m_Shader;
ReflectionData m_ReflectionData;
const ShaderInfo* m_Info;
};
std::mutex m_Mutex;
std::unordered_map<CUtlSymbolDbg, CompiledShader> m_Shaders;
};
}
static VulkanShaderManager s_ShaderManager;
IVulkanShaderManager& TF2Vulkan::g_ShaderManager = s_ShaderManager;
static const std::unordered_map<std::string_view, ShaderInfo> s_ShaderBlobMapping =
{
{ "bik_vs20", { ShaderBlobType::Bik_VS } },
{ "bik_ps20b", { ShaderBlobType::Bik_PS } },
{ "bufferclearobeystencil_vs", { ShaderBlobType::BufferClearObeyStencil_VS } },
{ "bufferclearobeystencil_ps", { ShaderBlobType::BufferClearObeyStencil_PS } },
{ "fillrate_vs", { ShaderBlobType::Fillrate_VS } },
{ "fillrate_ps", { ShaderBlobType::Fillrate_PS } },
{ "xlitgeneric_vs", { ShaderBlobType::XLitGeneric_VS } },
{ "xlitgeneric_ps", { ShaderBlobType::XLitGeneric_PS } },
};
auto VulkanShaderManager::FindOrCreateShader(const CUtlSymbolDbg& id) -> const TF2Vulkan::IVulkanShader&
{
std::lock_guard lock(m_Mutex);
if (auto found = m_Shaders.find(id); found != m_Shaders.end())
return found->second;
// Couldn't find an existing one, we need to create it here
return m_Shaders.emplace(id, id).first->second;
}
static VariableType ConvertVariableType(const spirv_cross::SPIRType::BaseType& type)
{
#pragma push_macro("CASE")
#undef CASE
#define CASE(typeName) case spirv_cross::SPIRType::BaseType:: ## typeName : return VariableType:: ## typeName
switch (type)
{
default:
throw VulkanException("Unknown SPIRType", EXCEPTION_DATA());
CASE(Void);
CASE(Boolean);
CASE(SByte);
CASE(UByte);
CASE(Short);
CASE(Int);
CASE(UInt);
CASE(Int64);
CASE(UInt64);
CASE(Half);
CASE(Float);
CASE(Double);
CASE(Struct);
CASE(Image);
CASE(SampledImage);
CASE(Sampler);
}
#pragma pop_macro("CASE")
}
ShaderVariable::ShaderVariable(const spirv_cross::Compiler& comp, uint32_t id) :
m_Name(comp.get_name(id))
{
const auto& type = comp.expression_type(id);
//assert(!type.pointer);
m_Type = ConvertVariableType(type.basetype);
m_ComponentCount = type.vecsize;
}
ShaderVariable::ShaderVariable(std::string&& name) :
m_Name(std::move(name))
{
}
SpecializationConstant::SpecializationConstant(const spirv_cross::Compiler& comp, uint32_t id, uint32_t constID) :
ShaderVariable(comp, id),
m_ConstantID(constID)
{
}
VertexAttribute::VertexAttribute(const spirv_cross::Compiler& comp, uint32_t id) :
ShaderVariable(comp, id),
m_Semantic(comp.get_decoration_string(id, spv::Decoration::DecorationHlslSemanticGOOGLE)),
m_Location(comp.get_decoration(id, spv::Decoration::DecorationLocation))
{
}
StructMember::StructMember(const spirv_cross::Compiler& comp, uint32_t parent, uint32_t index) :
ShaderVariable(std::string(comp.get_member_name(parent, index))),
m_Parent(parent)
{
const auto& parentType = comp.get_type(parent);
m_Offset = comp.type_struct_member_offset(parentType, index);
}
Struct::Struct(const spirv_cross::Compiler& comp, const spirv_cross::Resource& resource) :
m_TypeName(comp.get_name(resource.base_type_id))
{
const auto& type = comp.get_type(resource.base_type_id);
m_Size = comp.get_declared_struct_size(type);
for (size_t i = 0; i < type.member_types.size(); i++)
m_Members.emplace_back(comp, resource.base_type_id, i);
}
ShaderResource::ShaderResource(const spirv_cross::Compiler& comp, uint32_t id) :
m_Binding(comp.get_decoration(id, spv::Decoration::DecorationBinding))
{
}
UniformBuffer::UniformBuffer(const spirv_cross::Compiler& comp, const spirv_cross::Resource& resource) :
Struct(comp, resource),
ShaderResource(comp, resource.id),
m_Name(comp.get_name(resource.id))
{
if (const auto & name = comp.get_name(resource.id); !name.empty())
m_Name = name;
else
m_Name = m_TypeName;
assert(!m_Name.empty());
}
Sampler::Sampler(const spirv_cross::Compiler& comp, uint32_t id) :
ShaderVariable(comp, id),
ShaderResource(comp, id)
{
}
Texture::Texture(const spirv_cross::Compiler& comp, uint32_t id) :
ShaderVariable(comp, id),
ShaderResource(comp, id)
{
}
static ReflectionData CreateReflectionData(const void* data, size_t byteSize)
{
ReflectionData retVal;
const spirv_cross::Compiler comp(reinterpret_cast<const uint32_t*>(data), byteSize / sizeof(uint32_t));
switch (comp.get_execution_model())
{
case spv::ExecutionModel::ExecutionModelFragment:
retVal.m_ShaderStage = vk::ShaderStageFlagBits::eFragment;
break;
case spv::ExecutionModel::ExecutionModelVertex:
retVal.m_ShaderStage = vk::ShaderStageFlagBits::eVertex;
break;
default:
throw VulkanException("Unknown shader type", EXCEPTION_DATA());
}
// Specialization constants
for (const auto& specConstIn : comp.get_specialization_constants())
retVal.m_SpecConstants.emplace_back(comp, specConstIn.id, specConstIn.constant_id);
const auto resources = comp.get_shader_resources();
for (const auto& input : resources.stage_inputs)
retVal.m_VertexInputs.emplace_back(comp, input.id);
for (const auto& output : resources.stage_outputs)
retVal.m_VertexOutputs.emplace_back(comp, output.id);
for (const auto& uniformBuf : resources.uniform_buffers)
retVal.m_UniformBuffers.emplace_back(comp, uniformBuf);
for (const auto& sampler : resources.separate_samplers)
retVal.m_Samplers.emplace_back(comp, sampler.id);
for (const auto& texture : resources.separate_images)
retVal.m_Textures.emplace_back(comp, texture.id);
return retVal;
}
VulkanShaderManager::CompiledShader::CompiledShader(const CUtlSymbolDbg& name) :
m_Name(name)
{
const ShaderInfo& shaderInfo = s_ShaderBlobMapping.at(m_Name.String());
m_Info = &shaderInfo;
vk::ShaderModuleCreateInfo ci;
const void* blobData;
if (!g_ShaderBlobs->GetShaderBlob(shaderInfo.m_Blob, blobData, ci.codeSize))
throw VulkanException("Failed to get shader blob", EXCEPTION_DATA());
ci.pCode = reinterpret_cast<const uint32_t*>(blobData);
m_ReflectionData = CreateReflectionData(blobData, ci.codeSize);
auto [device, lock] = g_ShaderDevice.GetVulkanDevice().locked();
m_Shader = device.createShaderModuleUnique(ci);
g_ShaderDevice.SetDebugName(m_Shader, m_Name.String());
}
| 28.8
| 114
| 0.762083
|
melvyn2
|
016626346ec27e6f398e35e662d07cc308d05cc7
| 4,393
|
cxx
|
C++
|
dune/xt/data/quadratures/gausslobatto/data/gausslobatto58.cxx
|
dune-community/dune-xt-data
|
32593bbcd52ed69b0a11963400a9173740089a75
|
[
"BSD-2-Clause"
] | 1
|
2020-02-08T04:09:11.000Z
|
2020-02-08T04:09:11.000Z
|
dune/xt/data/quadratures/gausslobatto/data/gausslobatto58.cxx
|
dune-community/dune-xt-data
|
32593bbcd52ed69b0a11963400a9173740089a75
|
[
"BSD-2-Clause"
] | 40
|
2018-08-26T08:34:34.000Z
|
2021-09-28T13:01:55.000Z
|
dune/xt/data/quadratures/gausslobatto/data/gausslobatto58.cxx
|
dune-community/dune-xt-data
|
32593bbcd52ed69b0a11963400a9173740089a75
|
[
"BSD-2-Clause"
] | 1
|
2020-02-08T04:10:14.000Z
|
2020-02-08T04:10:14.000Z
|
// This file is part of the dune-xt-data project:
// https://github.com/dune-community/dune-xt-data
// Copyright 2009-2018 dune-xt-data developers and contributors. All rights reserved.
// License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
// or GPL-2.0+ (http://opensource.org/licenses/gpl-license)
// with "runtime exception" (http://www.dune-project.org/license.html)
// Authors:
// René Fritze (2018)
// Tobias Leibner (2018 - 2019)
//
// This file is part of the dune-gdt project:
#include "../gausslobatto_data.hh"
namespace Dune::XT::Data {
template <>
std::vector<std::vector<double>> GaussLobattoData<58>::get()
{
return {{-1, 6.049606775559588626739E-4},
{-0.997780317874588336424, 0.0037266131000573870302},
{-0.992565422234548810956, 0.0066999489276936574588},
{-0.984387517507017675477, 0.00965172237269915739},
{-0.973271645364740615716, 0.01257447619481814556},
{-0.959251092319855536892, 0.015459649328833407858},
{-0.942367733315503702104, 0.01829866659352221684275},
{-0.9226719668637435608822, 0.0210830659133029174528},
{-0.9002225781287486322699, 0.02380454150915248482034},
{-0.8750865675183580272144, 0.026454973129381841511},
{-0.847338952182446563143, 0.029026451657207376073},
{-0.817062542733214836331, 0.0315113032120333366665},
{-0.7843476963811119634767, 0.0339021122542464586953},
{-0.7492920474102048908088, 0.0361917438070070283361},
{-0.7120002158716741859385, 0.0383733647937434593123},
{-0.672583495397108703541, 0.0404404644533213672869},
{-0.63115952107839627281, 0.0423868737829497441325},
{-0.5878519184129020477636, 0.0442067839558421461428},
{-0.5427899343655568861829, 0.045894763661120301683},
{-0.4961080516510681264535, 0.047445775315465169912},
{-0.447945587388614525964, 0.04885519009880307602051},
{-0.3984462773275214095084, 0.050118801769525812301},
{-0.3477578468851899047844, 0.0512328392182275383208},
{-0.2960315702777464515238, 0.052193977722618907953},
{-0.2434218190593160791455, 0.05299934887010552527545},
{-0.1900856014173713266502, 0.053646549118465073828},
{-0.1361820935991583887424, 0.054133646969104491636},
{-0.081872164867662033184, 0.0544591887315084040148},
{-0.0273178974048658787596, 0.054622202861687607623},
{0.0273178974048658787596, 0.054622202861687607623},
{0.08187216486766203318391, 0.0544591887315084040148},
{0.1361820935991583887424, 0.0541336469691044916362},
{0.1900856014173713266502, 0.053646549118465073828},
{0.2434218190593160791455, 0.05299934887010552527545},
{0.2960315702777464515238, 0.052193977722618907953},
{0.3477578468851899047844, 0.0512328392182275383208},
{0.398446277327521409508, 0.05011880176952581230098},
{0.4479455873886145259637, 0.0488551900988030760205},
{0.4961080516510681264535, 0.0474457753154651699118},
{0.5427899343655568861829, 0.045894763661120301683},
{0.5878519184129020477636, 0.0442067839558421461428},
{0.6311595210783962728101, 0.0423868737829497441325},
{0.672583495397108703541, 0.04044046445332136728687},
{0.7120002158716741859385, 0.0383733647937434593123},
{0.7492920474102048908088, 0.0361917438070070283361},
{0.7843476963811119634767, 0.033902112254246458695},
{0.8170625427332148363307, 0.031511303212033336666},
{0.8473389521824465631425, 0.02902645165720737607297},
{0.8750865675183580272144, 0.0264549731293818415113},
{0.9002225781287486322699, 0.0238045415091524848203},
{0.9226719668637435608822, 0.021083065913302917453},
{0.9423677333155037021038, 0.018298666593522216843},
{0.9592510923198555368917, 0.0154596493288334078584},
{0.9732716453647406157156, 0.01257447619481814556},
{0.984387517507017675477, 0.00965172237269915739029},
{0.992565422234548810956, 0.0066999489276936574588},
{0.997780317874588336424, 0.00372661310005738703},
{1, 6.049606775559588626739E-4}};
}
} // namespace Dune::XT::Data
| 52.927711
| 95
| 0.70544
|
dune-community
|
6c6499c52a63c6d23c927a18b0b9658fd89478c0
| 1,477
|
cpp
|
C++
|
dynamic/wrappers/core/ReplicatableVector.cppwg.cpp
|
jmsgrogan/PyChaste
|
48a9863d2c941c71e47ecb72e917b477ba5c1413
|
[
"FTL"
] | 6
|
2017-02-04T16:10:53.000Z
|
2021-07-01T08:03:16.000Z
|
dynamic/wrappers/core/ReplicatableVector.cppwg.cpp
|
jmsgrogan/PyChaste
|
48a9863d2c941c71e47ecb72e917b477ba5c1413
|
[
"FTL"
] | 6
|
2017-06-22T08:50:41.000Z
|
2019-12-15T20:17:29.000Z
|
dynamic/wrappers/core/ReplicatableVector.cppwg.cpp
|
jmsgrogan/PyChaste
|
48a9863d2c941c71e47ecb72e917b477ba5c1413
|
[
"FTL"
] | 3
|
2017-05-15T21:33:58.000Z
|
2019-10-27T21:43:07.000Z
|
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <petsc/private/vecimpl.h>
#include <petsc/private/matimpl.h>
#include <set>
#include <vector>
#include <string>
#include <map>
#include "SmartPointers.hpp"
#include "UblasIncludes.hpp"
#include "ReplicatableVector.hpp"
#include "ReplicatableVector.cppwg.hpp"
namespace py = pybind11;
typedef ReplicatableVector ReplicatableVector;
PYBIND11_DECLARE_HOLDER_TYPE(T, boost::shared_ptr<T>);
PYBIND11_MAKE_OPAQUE(Vec);
PYBIND11_MAKE_OPAQUE(Mat);
void register_ReplicatableVector_class(py::module &m){
py::class_<ReplicatableVector , boost::shared_ptr<ReplicatableVector > >(m, "ReplicatableVector")
.def(py::init< >())
.def(py::init<::Vec >(), py::arg("vec"))
.def(py::init<unsigned int >(), py::arg("size"))
.def(
"GetSize",
(unsigned int(ReplicatableVector::*)()) &ReplicatableVector::GetSize,
" " )
.def(
"Resize",
(void(ReplicatableVector::*)(unsigned int)) &ReplicatableVector::Resize,
" " , py::arg("size") )
.def(
"Replicate",
(void(ReplicatableVector::*)(unsigned int, unsigned int)) &ReplicatableVector::Replicate,
" " , py::arg("lo"), py::arg("hi") )
.def(
"ReplicatePetscVector",
(void(ReplicatableVector::*)(::Vec)) &ReplicatableVector::ReplicatePetscVector,
" " , py::arg("vec") )
;
}
| 33.568182
| 102
| 0.619499
|
jmsgrogan
|
6c650b65add649ca9625ae4a3e199882263c4859
| 6,485
|
cpp
|
C++
|
Renderer/Core/Renderer.cpp
|
guoxx/Renderer
|
52de224354d6f783e0c4f3430865d76a4561e0e7
|
[
"MIT"
] | null | null | null |
Renderer/Core/Renderer.cpp
|
guoxx/Renderer
|
52de224354d6f783e0c4f3430865d76a4561e0e7
|
[
"MIT"
] | null | null | null |
Renderer/Core/Renderer.cpp
|
guoxx/Renderer
|
52de224354d6f783e0c4f3430865d76a4561e0e7
|
[
"MIT"
] | null | null | null |
#include "Renderer.h"
#include "Vertex.h"
#include "Fragment.h"
#include "VertexProcessor.h"
#include "FragmentProcessor.h"
#include "Rasterizer.h"
#include "FrameBuffer.h"
#include "Texture.h"
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <stdarg.h>
#include <algorithm>
static uint32_t _color3ToUInt(const Vec3f& color)
{
uint32_t c;
uint8_t* p = (uint8_t*)&c;
*p = uint8_t(std::fmin(color.x, 1.0f) * 255);
*(p + 1) = uint8_t(std::fmin(color.y, 1.0f) * 255);
*(p + 2) = uint8_t(std::fmin(color.z, 1.0f) * 255);
*(p + 3) = 255;
return c;
}
static Vec3f _nonParallelVector(Vec3f v)
{
v.normalize();
std::initializer_list<float> list{v.x, v.y, v.z};
const float* it = std::min_element(list.begin(), list.end());
float* ptr = const_cast<float*>(it);
*ptr = 1;
return Vec3f{*list.begin(), *(list.begin() + 1), *(list.begin() + 2)};
}
void Renderer::orbit(Vec2f delta)
{
// printf("delta = %f, %f\n", delta.x, delta.y);
Vec3f u, v, w;
w = _up;
w.normalize();
Vec3f up = _nonParallelVector(w);
u = up.cross(w);
u.normalize();
v = w.cross(u);
Matrix4f basis;
basis.identity();
basis.c[0][0] = u.x;
basis.c[0][1] = u.y;
basis.c[0][2] = u.z;
basis.c[1][0] = v.x;
basis.c[1][1] = v.y;
basis.c[1][2] = v.z;
basis.c[2][0] = w.x;
basis.c[2][1] = w.y;
basis.c[2][2] = w.z;
Matrix4f basisInv = basis.inverted();
Vec3f newEye = basisInv * _eye;
float r = newEye.length();
float phi = atan2f(newEye.y, newEye.x);
float theta = asinf(newEye.z / r);
// increment phi and theta by mouse motion
//printf("delta phi = %f\n", M_PI_2 * delta.x);
//printf("delta theta = %f\n", M_PI_2 * delta.y);
phi = phi - M_PI_2 * delta.x;
theta = theta - M_PI_2 * delta.y;
float thetaLimit = (float) (89 * M_PI / 180);
if (theta > thetaLimit)
theta = thetaLimit;
if (theta < -thetaLimit)
theta = -thetaLimit;
newEye.x = r * cosf(theta) * cosf(phi);
newEye.y = r * cosf(theta) * sinf(phi);
newEye.z = r * sinf(theta);
newEye = basis * newEye;
printf("old eye = %f, %f, %f\n", _eye.x, _eye.y, _eye.z);
printf("new eye = %f, %f, %f\n", newEye.x, newEye.y, newEye.z);
lookat(newEye, _target, _up);
}
void Renderer::dolly(float delta) {
}
void Renderer::lookat(Vec3f& eye, Vec3f& target, Vec3f& up){
_eye = eye;
_target = target;
_up = up;
Vec3f u, v, w;
w = eye - target;
w.normalize();
u = up.cross(w);
u.normalize();
v = w.cross(u);
v.normalize();
Matrix4f rotate;
_modelviewMat.identity();
rotate.c[0][0] = u.x;
rotate.c[1][0] = u.y;
rotate.c[2][0] = u.z;
rotate.c[0][1] = v.x;
rotate.c[1][1] = v.y;
rotate.c[2][1] = v.z;
rotate.c[0][2] = w.x;
rotate.c[1][2] = w.y;
rotate.c[2][2] = w.z;
Matrix4f translate;
translate.c[3][0] = -eye.x;
translate.c[3][1] = -eye.y;
translate.c[3][2] = -eye.z;
_modelviewMat = rotate * translate;
}
void Renderer::setupViewParams(float fov, float aspect, float zNear, float zFar){
float t = zNear * (float)tanf(fov / 180.0f);
float b = -t;
float r = t / aspect;
float l = -r;
float n = zNear;
float f = zFar;
_projectionMat.identity();
_projectionMat.c[0][0] = (2 * n) / (r - l);
_projectionMat.c[2][0] = (r + l) / (r - l);
_projectionMat.c[1][1] = (2 * n) / (t - b);
_projectionMat.c[3][1] = (t + b) / (t - b);
_projectionMat.c[2][2] = (n + f) / (n - f);
_projectionMat.c[3][2] = (2 * f * n) / (n - f);
_projectionMat.c[2][3] = -1;
_projectionMat.c[3][3] = 0;
}
void Renderer::viewport(int x, int y, int w, int h){
int cx = x + w / 2;
int cy = y + h / 2;
_viewportMat.identity();
_viewportMat.c[0][0] = w/2;
_viewportMat.c[3][0] = cx;
_viewportMat.c[1][1] = h/2;
_viewportMat.c[3][1] = cy;
}
void Renderer::clearDepthBuffer(float val) {
for (int x = 0; x < _width; x = x + 1) {
for (int y = 0; y < _height; y = y + 1) {
_frameBuffer->setDepthBuffer(x, y, val);
}
}
}
void Renderer::clearColorBuffer(const Vec3f &color) {
for (int x = 0; x < _width; x = x + 1) {
for (int y = 0; y < _height; y = y + 1) {
_frameBuffer->setColorBuffer(x, y, color);
}
}
}
void Renderer::renderLine(int verticesCnt,
Vec3f *vertices,
Vec3f *colors) {
Vertex *vertCache = new Vertex[verticesCnt];
Rasterizer rasterizer;
_vp->updateTransforms(*this);
int lineCnt = verticesCnt / 2;
for (int i = 0; i < lineCnt; i = i + 1) {
_vp->line(vertices + i * 2, colors + i * 2, vertCache + i * 2);
}
for (int i = 0; i < lineCnt; i = i + 1) {
rasterizer.line(vertCache + i * 2, *_fp, *_frameBuffer);
}
delete [] vertCache;
}
void Renderer::renderTriangle(int verticesCnt,
Vec3f *vertices,
Vec3f *colors,
Vec3f *normals,
Vec3f *textures,
std::shared_ptr<Texture> tex) {
// TODO: face culling
Vertex *vertCache = new Vertex[verticesCnt];
Rasterizer rasterizer;
_vp->updateTransforms(*this);
int triangleCnt = verticesCnt / 3;
for (int i = 0; i < triangleCnt; i = i + 1) {
_vp->triangle(vertices + i * 3,
normals + i * 3,
colors + i * 3,
textures + i * 3,
vertCache + i * 3);
}
rasterizer.setupTexture(tex);
for (int i = 0; i < triangleCnt; i = i + 1) {
rasterizer.triangle(vertCache + i * 3, *_fp, *_frameBuffer);
}
delete [] vertCache;
}
void Renderer::dumpRaw(uint8_t **data, int *sz) {
assert(data != NULL);
*data = (uint8_t*)malloc(_width * _height * 3);
for (int x = 0; x < _width; x = x + 1) {
for (int y = 0; y < _height; y = y + 1) {
uint32_t clr = _color3ToUInt(_frameBuffer->getColorBuffer(x, y));
uint8_t* p = (uint8_t*)&clr;
int idx = y * _width + x;
uint8_t* tmp = (*data) + idx * 3;
// write BGR
*(tmp + 0) = *(p + 2);
*(tmp + 1) = *(p + 1);
*(tmp + 2) = *(p + 0);
}
}
if (sz != NULL) {
*sz = _width * _height * 3;
}
}
| 27.133891
| 81
| 0.522128
|
guoxx
|
6c695dbc387a03fdd6d15c0b7c0282c1194cf329
| 1,578
|
cpp
|
C++
|
GFG 100 Days C++/restrictedpacman.cpp
|
Achyut-Saxena/100-Days-of-Code
|
3bf4481ac9656278cdafce83a9b0f0a9f691b67e
|
[
"MIT"
] | null | null | null |
GFG 100 Days C++/restrictedpacman.cpp
|
Achyut-Saxena/100-Days-of-Code
|
3bf4481ac9656278cdafce83a9b0f0a9f691b67e
|
[
"MIT"
] | null | null | null |
GFG 100 Days C++/restrictedpacman.cpp
|
Achyut-Saxena/100-Days-of-Code
|
3bf4481ac9656278cdafce83a9b0f0a9f691b67e
|
[
"MIT"
] | null | null | null |
/*
In the game of Restricted Pacman, an infinite linear path is given. Pacman has to start at position 0 and eat as many candies as possible. In one move he can only jump a distance of either M or N. If M and N are coprime numbers, find how many candies will be left on the board after the game is over.
Note: The result is always finite as after a point X every index in the infinite path can be visited.
Example 1:
Input: M = 2, N = 5
Output: 2
Explanation: From index 0, the indices that
can be visited are
0 + 2 = 2
0 + 2 + 2 = 4
0 + 5 = 5
0 + 2 + 2 + 2 = 6
0 + 2 + 5 = 7
0 + 2 + 2 + 2 + 2 = 8
0 + 2 + 2 + 5 = 9
0 + 5 + 5 = 10
and so on.
1 and 3 are the only indices that cannot be
visited. Therefore the candies at these two
positions will be left on the board.
*/
//Initial Template for C++
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution{
public:
int candies(int m, int n)
{
// Your code goes here
vector<bool> dp(m * n + 1, false);
dp[0] = true;
int ans = 0;
for (int i = 1; i <= m * n; i++)
{
if (i >= m)
dp[i] = dp[i] | dp[i - m];
if (i >= n)
dp[i] = dp[i] | dp[i - n];
if (!dp[i])
ans++;
}
return ans;
}
};
// { Driver Code Starts.
int main()
{
int t;
cin>>t;
while(t--)
{
int m,n;
cin>>m>>n;
Solution obj;
cout << obj.candies(m,n)<<endl;
}
return 0;
}
// } Driver Code Ends
| 21.324324
| 301
| 0.558302
|
Achyut-Saxena
|
6c6af10c95ef055c15bb95ca9bbc8a416af65083
| 2,855
|
cpp
|
C++
|
Data Structures/DoubleLinkedList.cpp
|
YortA/School_Programs
|
ad6dadeb16de40b1f8ce4d733fd7aa746c6a9f1a
|
[
"MIT"
] | null | null | null |
Data Structures/DoubleLinkedList.cpp
|
YortA/School_Programs
|
ad6dadeb16de40b1f8ce4d733fd7aa746c6a9f1a
|
[
"MIT"
] | null | null | null |
Data Structures/DoubleLinkedList.cpp
|
YortA/School_Programs
|
ad6dadeb16de40b1f8ce4d733fd7aa746c6a9f1a
|
[
"MIT"
] | null | null | null |
// Troy Andrews
// SDEV-345-81
// 2/13/2021
// Info: Week 5 Assignment (Linked List)
#include <iostream>
#include<windows.h>
class DoubleLinkedList
{
protected:
struct ListNode
{
double val;
ListNode* next;
ListNode* prev;
ListNode(double val, ListNode* next = nullptr, ListNode* prev = nullptr)
{
this->val = val;
this->next = next;
this->prev = prev;
}
};
ListNode* head;
ListNode* tail;
public:
DoubleLinkedList() : head(nullptr), tail(nullptr) {};
void addFront(double x);
void addBack(double x);
void insertNode(double x, int pos);
void deleteNode(double x);
double search(double x);
void printList()
{
ListNode* temp;
temp = head;
while (temp != nullptr)
{
std::cout << temp->val << ' ';
temp = temp->next;
}
std::cout << std::endl;
}
};
void DoubleLinkedList::addFront(double x)
{
ListNode* node = new ListNode(x);
if (head == nullptr)
{
// there must be a head and tail, if the list is empty we will make one.
head = node;
tail = node;
}
else
{
node->next = head;
head = node;
node->next->prev = node;
}
}
void DoubleLinkedList::addBack(double x)
{
ListNode* node = new ListNode(x);
if (tail->next == nullptr)
{
tail->next = node;
tail = node;
}
}
// Insert between two nodes (we insert 1 to the right of our position
void DoubleLinkedList::insertNode(double x, int pos)
{
ListNode* temp = head;
for (int i = 0; i < pos; ++i)
{
temp = temp->next; // we've found our pos.
}
// Insert our node with the input value in front of our current position and assign
ListNode* newnode = new ListNode(x, temp->next, temp->prev);
temp->next = newnode;
}
void DoubleLinkedList::deleteNode(double x)
{
ListNode* temp = head;
for (int i = 0; i < x - 1; ++i)
{
temp = temp->next; // we've found our pos.
}
// re-link our node and then delete
ListNode* ptr = temp->next; // ptr to node to be deleted from our linked list
temp->next = temp->next->next;
temp->prev = temp->prev->prev;
delete ptr;
}
double DoubleLinkedList::search(double x)
{
int element = 0;
if (head == nullptr)
{
return -1;
}
else
{
ListNode* nodePtr = head;
while (nodePtr != nullptr)
{
// We found a matching value.
if (nodePtr->val == x)
{
return element; // return element number
}
nodePtr = nodePtr->next;
element++;
}
return -1; // we found nothing, exit the function
}
}
int main()
{
DoubleLinkedList* elevator = new DoubleLinkedList;
for (int i = 0; i < 10; ++i)
{
elevator->addFront(i);
}
std::cout << "Original: ";
elevator->printList();
elevator->insertNode(666, 3);
std::cout << "Insert: ";
elevator->printList();
double val{};
std::cout << "Input a value to search and delete: ";
std::cin >> val;
std::cout << "Search & Delete: ";
elevator->deleteNode(elevator->search(val));
elevator->printList();
}
| 18.419355
| 84
| 0.633625
|
YortA
|
6c6b7075ac8d7a83ce48bc1a13d99a92cefccca7
| 6,588
|
cpp
|
C++
|
src/registry/interface.cpp
|
wilkie/apsis
|
9e6a37ad9dfc8931b25b9429d7e4a770b4e760bf
|
[
"WTFPL"
] | 2
|
2015-11-05T03:47:29.000Z
|
2020-01-24T18:48:09.000Z
|
src/registry/interface.cpp
|
wilkie/apsis
|
9e6a37ad9dfc8931b25b9429d7e4a770b4e760bf
|
[
"WTFPL"
] | null | null | null |
src/registry/interface.cpp
|
wilkie/apsis
|
9e6a37ad9dfc8931b25b9429d7e4a770b4e760bf
|
[
"WTFPL"
] | null | null | null |
#include "apsis/registry/interface.h"
#include <algorithm>
#include <fstream>
using namespace Apsis;
std::vector<std::string> Registry::Interface::_ids;
std::vector<Registry::Interface*> Registry::Interface::_interfaces;
const Registry::Interface&
Registry::Interface::load(const char* path,
const Engine::Object& loader) {
std::string str = std::string(path);
std::vector<std::string>::iterator it = std::find(_ids.begin(), _ids.end(), str);
if (it != _ids.end()) {
// already exists
return *_interfaces[std::distance(_ids.begin(), it)];
}
_interfaces.push_back(new Registry::Interface(path, loader));
_ids.push_back(str);
return *_interfaces[_ids.size() - 1];
}
Registry::Interface::Interface(const char* path,
const Engine::Object& loader)
: _loader(loader) {
_id = _ids.size();
Json::Reader reader;
Json::Value value;
std::ifstream file(path);
reader.parse(file, value);
file.close();
if (value.isMember("type") &&
value["type"].compare(Json::Value("interface")) == 0) {
}
else {
throw "Interface file given is not of type 'interface'.";
}
if (value.isMember("inherit")) {
// TODO: inherit interfaces
}
_spans.push_back(0);
if (value.isMember("widgets")) {
// Load widgets
_parseWidgets(value, loader);
}
}
void Registry::Interface::_parseWidgets(Json::Value& value,
const Engine::Object& loader) {
unsigned int index = _spans.size() - 1;
for (Json::Value::iterator it = value["widgets"].begin();
it != value["widgets"].end();
++it) {
if ((*it).isObject()) {
if ((*it).isMember("widget")) {
_spans[index]++;
const char* widget_name = (*it)["widget"].asCString();
const Registry::Widget& widget = loader.loadWidget(widget_name);
Apsis::World::Object& object = *(new Apsis::World::Object);
if ((*it).isMember("properties")) {
Json::Value::Members members = (*it)["properties"].getMemberNames();
for (Json::Value::Members::iterator property_it = members.begin();
property_it != members.end();
++property_it) {
const char* name = (*property_it).c_str();
unsigned int property_id = Apsis::Registry::Property::id(name);
if ((*it)["properties"][name].isDouble()) {
object.set(property_id, (*it)["properties"][name].asDouble());
}
else if ((*it)["properties"][name].isString()) {
object.set(property_id, (*it)["properties"][name].asCString());
}
else if ((*it)["properties"][name].isIntegral()) {
object.set(property_id, (long)(*it)["properties"][name].asInt());
}
}
}
// Defaults
for (unsigned int i = 0; i < widget.propertyCount(); i++) {
const char* name = widget.propertyName(i);
const char* def = widget.propertyDefault(i);
if (!object.has(name)) {
object.set(name, def);
}
}
// Push to tree
_widgets.push_back(&widget);
_objects.push_back(&object);
// Child windows
_spans.push_back(0);
if ((*it).isMember("widgets")) {
_parseWidgets(*it, loader);
}
}
}
else {
throw "Interface file's 'widgets' section is malformed.";
}
}
}
void Registry::Interface::_buildWidgets(Apsis::Interface::Window* parent,
unsigned int span_index,
unsigned int node_index,
unsigned int& number_spans,
unsigned int& number_nodes) const {
// traverse tree
unsigned int children = _spans[span_index];
span_index++;
number_spans = 1;
number_nodes = children;
for (unsigned int i = 0; i < children; i++) {
const Apsis::Registry::Widget& widget = *_widgets[node_index];
const Apsis::World::Object& object = *_objects[node_index];
node_index++;
float x = 0.0f;
float y = 0.0f;
float w = 10.0f;
float h = 10.0f;
if (object.has("x")) {
x = (float)object.get("x").asDouble();
}
if (object.has("y")) {
y = (float)object.get("y").asDouble();
}
if (object.has("width")) {
w = (float)object.get("width").asDouble();
}
if (object.has("height")) {
h = (float)object.get("height").asDouble();
}
// Create the window
Apsis::Interface::Window* window = new Apsis::Interface::Window(widget,
object,
_loader,
x,
y,
w,
h);
parent->add(*window);
unsigned int n_spans = 0;
unsigned int n_nodes = 0;
_buildWidgets(window,
span_index,
node_index,
n_spans,
n_nodes);
number_spans += n_spans;
number_nodes += n_nodes;
node_index += n_nodes;
span_index += n_spans;
}
}
Apsis::Interface::Window* Registry::Interface::instance(float width,
float height) const {
Apsis::Interface::Window* ret
= new Apsis::Interface::Window(_loader,
width / 2.0f,
height / 2.0f,
width,
height,
Apsis::Interface::Event::defaultInit,
Apsis::Interface::Event::defaultDraw,
Apsis::Interface::Event::defaultInput,
Apsis::Interface::Event::defaultMotion,
Apsis::Interface::Event::defaultUpdate,
Apsis::Interface::Event::defaultEnter,
Apsis::Interface::Event::defaultLeave);
Apsis::Interface::Window& current = *ret;
unsigned int n_nodes, n_spans;
_buildWidgets(ret, 0, 0, n_spans, n_nodes);
return ret;
}
unsigned int Registry::Interface::id() const {
return _id;
}
| 31.222749
| 83
| 0.501821
|
wilkie
|
6c74c8e74f723d505151ad890b5a0189a430d84c
| 3,024
|
cpp
|
C++
|
luaScript/luac.cpp
|
soymuchacho/libshared
|
238bf7e5055e6811aeb5ebcdde9601f919c48395
|
[
"BSD-3-Clause"
] | 3
|
2016-08-04T08:47:13.000Z
|
2022-03-22T08:57:44.000Z
|
luaScript/luac.cpp
|
soymuchacho/libshared
|
238bf7e5055e6811aeb5ebcdde9601f919c48395
|
[
"BSD-3-Clause"
] | null | null | null |
luaScript/luac.cpp
|
soymuchacho/libshared
|
238bf7e5055e6811aeb5ebcdde9601f919c48395
|
[
"BSD-3-Clause"
] | null | null | null |
//////////////////////////////////////////////////////////////////////
// created: 2018/02/22
// filename: CommonShare/luac.cpp
// author: vesper
//
/// purpose:
//////////////////////////////////////////////////////////////////////
#include <luac.h>
#include "Log.h"
namespace LuaC
{
CLuaInt64::CLuaInt64(const std::string& a_data)
: m_data(0)
{
setData(a_data);
}
CLuaInt64 CLuaInt64::operator /(const CLuaInt64& a_data) const
{
if (a_data.m_data == 0){
return 0;
}
return CLuaInt64(m_data / a_data.m_data);
}
CLuaInt64 CLuaInt64::operator /(int a_data) const
{
if (a_data == 0){
return 0;
}
return CLuaInt64(m_data / a_data);
}
CLuaInt64 CLuaInt64::operator /(long long a_data) const
{
if (a_data == 0){
return 0;
}
return CLuaInt64(m_data / a_data);
}
CLuaInt64 CLuaInt64::operator /(float a_data) const
{
if (a_data == 0){
return 0;
}
return CLuaInt64(m_data / (long long)a_data);
}
CLuaInt64& CLuaInt64::operator /=(const CLuaInt64& a_data)
{
if (a_data.m_data == 0){
return *this;
}
m_data /= a_data.m_data;
return *this;
}
CLuaInt64& CLuaInt64::operator /=(int a_data)
{
if (a_data == 0){
return *this;
}
m_data /= a_data;
return *this;
}
CLuaInt64& CLuaInt64::operator /=(long long a_data)
{
if (a_data == 0){
return *this;
}
m_data /= a_data;
return *this;
}
CLuaInt64& CLuaInt64::operator /=(float a_data)
{
if (a_data == 0){
return *this;
}
m_data /= (long long)a_data;
return *this;
}
void CLuaInt64::setData(int a_data)
{
m_data = (long long)a_data;
}
void CLuaInt64::setData(float a_data)
{
m_data = (long long)a_data;
}
void CLuaInt64::setData(long long a_data)
{
m_data = (long long)a_data;
}
void CLuaInt64::setData(const CLuaInt64& a_data)
{
m_data = a_data.m_data;
}
void CLuaInt64::setData(const std::string& a_data)
{
#ifdef _WIN32
m_data = (long long)_strtoi64(a_data.c_str(), NULL, 10);
#else
m_data = atoll(a_data.c_str());
#endif
}
std::string CLuaInt64::toString(char a_type) const
{
std::string temp;
char buf[256] = {0};
switch (a_type)
{
case 'h':
sprintf(buf,"%llx", m_data);
temp = buf;
//temp.format("%llx", m_data);
break;
case 'H':
sprintf(buf,"%llX", m_data);
temp = buf;
//temp.format("%llX", m_data);
break;
case 'o':
case 'O':
sprintf(buf,"%llu", m_data);
temp = buf;
//temp.format("%llu", m_data);
break;
case 'd':
case 'D':
default:
sprintf(buf,"%lld", m_data);
temp = buf;
//temp.format("%lld", m_data);
}
return temp;
}
const std::string& CLuaInt64::getLuaUserType()
{
static std::string temp = "LuaC::CLuaInt64";
return temp;
}
long long CLuaInt64::getData() const
{
return m_data;
}
void luaLogDebug(std::string strText)
{
LOGDEBUG("debug",strText.c_str());
}
void luaLogError(std::string strText)
{
LOGDEBUG("debug",strText.c_str());
}
}//LuaC
| 16.8
| 71
| 0.580357
|
soymuchacho
|
6c7851147dfd020645b1a7d103c5471cd796f3ed
| 495
|
hpp
|
C++
|
Code/2_Arrange_Domain/bothEndsMappedFragInfo_withCuttingSite.hpp
|
Lan-lab/Chrom-Lasso-
|
3b1c7797bfdf0f7d3330339ace0929e8e2225a40
|
[
"MIT"
] | null | null | null |
Code/2_Arrange_Domain/bothEndsMappedFragInfo_withCuttingSite.hpp
|
Lan-lab/Chrom-Lasso-
|
3b1c7797bfdf0f7d3330339ace0929e8e2225a40
|
[
"MIT"
] | null | null | null |
Code/2_Arrange_Domain/bothEndsMappedFragInfo_withCuttingSite.hpp
|
Lan-lab/Chrom-Lasso-
|
3b1c7797bfdf0f7d3330339ace0929e8e2225a40
|
[
"MIT"
] | 3
|
2020-10-15T09:15:46.000Z
|
2021-05-07T02:16:27.000Z
|
#ifndef BOTHENDSMAPPEDFRAGINFO
#define BOTHENDSMAPPEDFRAGINFO
class fragInfo_bothEndsMapped_withCuttingSite
{
public:
int end1_chr;
int end2_chr;
int end1_pos;
int end1_cuttingSite;
int end2_pos;
int end2_cuttingSite;
bool end1_strand;
bool end2_strand;
int fragType;
fragInfo_bothEndsMapped_withCuttingSite():end1_chr(0),end1_pos(0),end1_strand(false),end1_cuttingSite(0),end2_chr(0),end2_pos(0),end2_strand(false),end2_cuttingSite(0),fragType(0){}
};
#endif
| 22.5
| 183
| 0.775758
|
Lan-lab
|
6c82c4f141d67d1ab246bb3960d9f1a72e7dc97d
| 5,128
|
hpp
|
C++
|
include/experimental/fundamental/v3/monad_error/monad_error.hpp
|
jwakely/std-make
|
f09d052983ace70cf371bb8ddf78d4f00330bccd
|
[
"BSL-1.0"
] | 105
|
2015-01-24T13:26:41.000Z
|
2022-02-18T15:36:53.000Z
|
include/experimental/fundamental/v3/monad_error/monad_error.hpp
|
jwakely/std-make
|
f09d052983ace70cf371bb8ddf78d4f00330bccd
|
[
"BSL-1.0"
] | 37
|
2015-09-04T06:57:10.000Z
|
2021-09-09T18:01:44.000Z
|
include/experimental/fundamental/v3/monad_error/monad_error.hpp
|
jwakely/std-make
|
f09d052983ace70cf371bb8ddf78d4f00330bccd
|
[
"BSL-1.0"
] | 23
|
2015-01-27T11:09:18.000Z
|
2021-10-04T02:23:30.000Z
|
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Vicente J. Botet Escriba 2017.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
//////////////////////////////////////////////////////////////////////////////
#ifndef JASEL_FUNDAMENTAL_V3_MONAD_ERROR_MONAD_ERROR_HPP
#define JASEL_FUNDAMENTAL_V3_MONAD_ERROR_MONAD_ERROR_HPP
///////////////////////////////////////////////////////////////////////////////////////
///
///////////////////////////////////////////////////////////////////////////////////////
#include <utility>
#include <type_traits>
#include <experimental/meta.hpp>
#include <experimental/type_traits.hpp>
#include <experimental/type_constructible.hpp>
#include <experimental/fundamental/v2/config.hpp>
#include <experimental/monad.hpp>
//! Usage
//! Intended usage
//! <code>
//! E e;
//! auto x = monad_error::make_error<expected>(e);
//! //decltype(x) is unexpected<E>
//!
//! <end_code>
//! <code>
//!
//! A1 a1;
//! A2 a2;
//! auto x = monad_error::make_error<expected, E>(a1, a2);
//! //decltype(x) is unexpected<E>
//!
// The problem is that type_constructor<expected<T,E>> is expected<_t,E>
// And we are unable to deduce from expected that it has 2 parameters
// Currently we have that
// type_constructor<expected> is expected<_t>
// We are lucky as we have that Error has a default parameter
//!
//! Other usage
//! <code>
//! E e;
//! auto x = monad_error::make_error<expected<_t>>(e);
//! //decltype(x) is unexpected<E>
//!
//! <end_code>
//! <code>
//!
//! A1 a1;
//! A2 a2;
//! auto x = monad_error::make_error<expected<_t, E>>(a1, a2);
//! //decltype(x) is unexpected<E>
//!
//! <end_code>
// Should we name this MonadError or MonadException
namespace std
{
namespace experimental
{
inline namespace fundamental_v3
{
template <class T>
struct is_monad_error;
#if __cplusplus >= 201402L || defined JASEL_DOXYGEN_INVOKED
template <class T>
constexpr bool is_monad_error_v = is_monad_error<T>::value;
#endif
namespace monad_error
{
using namespace monad; // NOLINT google-build-using-namespace
namespace detail
{
struct not_a_monad_error_tag{};
}
template <class M, class Enabler=void>
struct traits
#if ! defined JASEL_DOXYGEN_INVOKED
: traits<M, meta::when<true>> {}
#endif
;
// Default failing specialization
template <typename MM, bool condition>
struct traits<MM, meta::when<condition>> : detail::not_a_monad_error_tag
{
#if __cplusplus >= 201402L || defined JASEL_DOXYGEN_INVOKED
// make_error<M>: E -> M
template <class M, class ...Xs>
constexpr
auto make_error(Xs&& ...xs) = delete;
// catch_error: [T]:E x (E->T) -> [T]:E
// catch_error: [T]:E x (E->[T]:E) -> [T]:E
template <class M, class F>
static auto catch_error(M&& x, F&& y) = delete;
// adapt_error: [T]:E x (E->G) -> [T]:G
template <class M, class F>
static auto adapt_error(M&& x, F&& y) = delete;
#endif
};
template <class M>
struct error_type
{
using type = typename traits<M>::template error_type<M>;
};
template <class M>
using error_type_t = typename error_type<M>::type;
template <class M, class F>
auto
catch_error(M&& x, F&& f)
JASEL_DECLTYPE_RETURN_NOEXCEPT(
traits<type_constructor_t<remove_cvref_t<M>>>::catch_error(forward<M>(x), forward<F>(f))
)
template <class M, class F>
auto
adapt_error(M&& x, F&& f)
JASEL_DECLTYPE_RETURN_NOEXCEPT(
traits<type_constructor_t<remove_cvref_t<M>>>::adapt_error(forward<M>(x), forward<F>(f))
)
// make_error overload: requires a type constructor, , deduce the error type associated to the type constructor
//template <class TC, int = 0, int..., class ...Xs>
template <class TC, class ...Xs>
constexpr auto
make_error(Xs&& ...xs)
JASEL_DECLTYPE_RETURN_NOEXCEPT(
traits<type_constructor_t<TC>>::template make_error<type_constructor_t<TC>>(std::forward<Xs>(xs)...)
)
// make_error overload: requires a template class, deduce the error type associated to the template
//template <template <class ...> class TC, int = 0, int..., class ...Xs>
template <template <class ...> class TC, class ...Xs>
constexpr auto
make_error(Xs&& ...xs)
JASEL_DECLTYPE_RETURN_NOEXCEPT(
traits<type_constructor_t<meta::quote<TC>>>::template make_error<type_constructor_t<meta::quote<TC>>>(std::forward<Xs>(xs)...)
)
}
template <class T>
struct is_monad_error
#if ! defined JASEL_DOXYGEN_INVOKED
: integral_constant<bool,
! is_base_of<monad_error::detail::not_a_monad_error_tag, monad_error::traits<T>>::value
&& is_monad<T>::value
> {}
#endif
;
template <class T>
struct is_monad_error<const T> : is_monad_error<T> {};
template <class T>
struct is_monad_error<volatile T> : is_monad_error<T> {};
template <class T>
struct is_monad_error<const volatile T> : is_monad_error<T> {};
}
}
}
#endif // header
| 28.175824
| 132
| 0.624805
|
jwakely
|
6c82d3a2de139531551ddda6c648980436b7bbca
| 740
|
cc
|
C++
|
unitest/format_test.cc
|
defined1007/autumn
|
6a624fa83390a3cce1e45f0092abcd710e2cf4bf
|
[
"BSD-2-Clause"
] | 101
|
2019-11-09T17:46:09.000Z
|
2022-03-18T09:27:16.000Z
|
unitest/format_test.cc
|
defined1007/autumn
|
6a624fa83390a3cce1e45f0092abcd710e2cf4bf
|
[
"BSD-2-Clause"
] | 30
|
2019-11-21T06:10:25.000Z
|
2020-01-14T13:28:00.000Z
|
unitest/format_test.cc
|
defined1007/autumn
|
6a624fa83390a3cce1e45f0092abcd710e2cf4bf
|
[
"BSD-2-Clause"
] | 6
|
2019-11-18T04:24:11.000Z
|
2021-05-01T13:47:09.000Z
|
#include <gtest/gtest.h>
#include "format.h"
using namespace autumn;
namespace {
struct Foo {
Foo(int a, const std::string& b) : a(a), b(b) {}
int a;
std::string b;
};
std::ostream& operator<<(std::ostream& out, const Foo& foo) {
return out << '{' << foo.a << ',' << foo.b << '}';
}
TEST(Format, TestFormat) {
EXPECT_EQ("my name is autumn", format("my name is {}", "autumn"));
EXPECT_EQ("3 + 4 = 7", format("{} + {} = {}", 3, 4, 3 + 4));
EXPECT_EQ("3 + 4 = 7", format("{:a} + {:b} = {:c}", 3, 4, 3 + 4));
EXPECT_EQ("3 4", format("{} {}", 3, 4, 3 + 4));
EXPECT_EQ("{1,2,3}", format("{{},{},{}}", 1, 2, 3));
EXPECT_EQ("this is foo:{10,autumn}", format("this is foo:{}", Foo(10, "autumn")));
}
}
| 25.517241
| 86
| 0.504054
|
defined1007
|
6c85a1d99e95ee040d6696df13e9e97c22068440
| 3,465
|
hpp
|
C++
|
src/SubProcess.hpp
|
nutbread/robot
|
d4491cf4449f657c1b165fc1969bff8294967d9d
|
[
"MIT"
] | null | null | null |
src/SubProcess.hpp
|
nutbread/robot
|
d4491cf4449f657c1b165fc1969bff8294967d9d
|
[
"MIT"
] | null | null | null |
src/SubProcess.hpp
|
nutbread/robot
|
d4491cf4449f657c1b165fc1969bff8294967d9d
|
[
"MIT"
] | null | null | null |
#ifndef ___H_SUB_PROCESS
#define ___H_SUB_PROCESS
#define VC_EXTRALEAN
#define WIN32_LEAN_AND_MEAN
#define UNICODE
#define _UNICODE
#include <windows.h>
#include <sstream>
#include <cstdint>
#include <list>
#include <unordered_map>
#include <streambuf>
#include <ostream>
class SubProcess final {
public: // Public static members
enum class PrimaryPipe {
None,
Auto,
Stdout,
Stderr,
Stdin
};
class NullOStream final : public std::basic_ostream<char> {
private:
class NullBuffer final : public std::basic_streambuf<char> {
public:
NullBuffer() :
std::basic_streambuf<char>()
{}
int overflow(int c) { return c; }
};
NullBuffer buf;
public:
NullOStream() :
std::basic_ostream<char>(&this->buf),
buf()
{}
~NullOStream() {}
};
class NullIStream final : public std::basic_istream<char> {
private:
class NullBuffer final : public std::basic_streambuf<char> {
public:
NullBuffer() :
std::basic_streambuf<char>()
{}
int underflow() {
return std::char_traits<char>::eof();
}
};
NullBuffer buf;
public:
NullIStream() :
std::basic_istream<char>(&this->buf),
buf()
{}
~NullIStream() {}
};
private: // Private static members
enum : uint32_t {
Started = 0x2,
WaitedForInput = 0x4,
Ended = 0x8,
RedirectStdout = 0x10,
RedirectStderr = 0x20,
RedirectStdin = 0x40,
RedirectStderrCloneStdout = 0x80,
Communicated = 0x100,
};
enum {
BufferStdout = 0,
BufferStderr = 1,
BufferStdin = 2,
};
struct ThreadInitData {
SubProcess* self;
HANDLE pipe;
void* stream;
};
static const size_t pipeReadBufferSize;
public: // Public static methods
static void
argumentsToCommandLine(
std::basic_stringstream<wchar_t>& out,
const std::list<std::wstring>& arguments
);
private: // Private static methods
static DWORD WINAPI
threadReadPipe(
void* data
);
static DWORD WINAPI
threadWritePipe(
void* data
);
private: // Private instance members
wchar_t* commandLineString;
wchar_t* environment;
uint32_t flags;
union {
struct {
void* stdoutBuffer;
void* stderrBuffer;
void* stdinBuffer;
};
void* buffers[3];
};
int returnCode;
int threadHandleCount;
HANDLE threadHandles[3];
HANDLE stdoutRead;
HANDLE stdoutWrite;
HANDLE stderrRead;
HANDLE stderrWrite;
HANDLE stdinRead;
HANDLE stdinWrite;
PROCESS_INFORMATION processInfo;
private: // Private instance methods
SubProcess();
bool
pipeGeneric(
void* redirect,
int targetBufferId,
uint32_t flag,
HANDLE* read,
HANDLE* write,
HANDLE* usedInThis
);
void
closeHandles();
void
updateInternalState();
void
updateInternalStateComplete();
public: // Public instance methods
explicit SubProcess(
const std::list<std::wstring>& arguments
);
~SubProcess();
bool
pipeStdout(
std::basic_ostream<char>* redirect=nullptr,
bool cloneToStderr=false
);
bool
pipeStderr(
std::basic_ostream<char>* redirect=nullptr
);
bool
pipeStdin(
std::basic_istream<char>* redirect=nullptr
);
bool
start();
bool
communicate(
bool synchronous=true,
PrimaryPipe primaryPipe=PrimaryPipe::Auto
);
bool
finishCommunicating();
bool
waitUntilReady();
bool
join();
bool
isStarted() const;
bool
isDone() const;
int
getReturnCode() const;
bool
terminate();
void
set_environment(const std::unordered_map<std::wstring, std::wstring>& map);
void
clear_environment();
};
#endif // ___H_SUB_PROCESS
| 14.497908
| 76
| 0.695815
|
nutbread
|
6c86be5300e1520e6891ecff458239f11178eb37
| 388
|
cpp
|
C++
|
GaeaEngine/MaterialComponent.cpp
|
ruochenhua/GaeaEngine
|
bef7dd8ca178333fe0fa1da316444f5cdea25ef5
|
[
"MIT"
] | null | null | null |
GaeaEngine/MaterialComponent.cpp
|
ruochenhua/GaeaEngine
|
bef7dd8ca178333fe0fa1da316444f5cdea25ef5
|
[
"MIT"
] | 1
|
2018-07-13T03:30:03.000Z
|
2018-07-13T03:30:11.000Z
|
GaeaEngine/MaterialComponent.cpp
|
ruochenhua/GaeaEngine
|
bef7dd8ca178333fe0fa1da316444f5cdea25ef5
|
[
"MIT"
] | null | null | null |
#include "stdafx.h"
#include "MaterialComponent.h"
#include "Script.h"
#include "Resource.h"
CMaterialComponent::CMaterialComponent(const std::string& file_path)
{
}
void CMaterialComponent::InitLuaAPI(lua_State *L)
{
luabridge::getGlobalNamespace(L)
.deriveClass<CMaterialComponent, CComponent>("MaterialComponent")
.addConstructor<void(*)(const std::string&)>()
.endClass();
}
| 22.823529
| 68
| 0.757732
|
ruochenhua
|
6c8d4d923e9ca2d75c003b1ec519a6e5bae8793d
| 1,980
|
cpp
|
C++
|
src/core/joypad/digital.cpp
|
KieronJ/btpsx
|
d2b968750bcbe1a2fe700783186c5eacd54fd93a
|
[
"MIT"
] | 2
|
2022-03-14T11:04:40.000Z
|
2022-03-19T23:02:32.000Z
|
src/core/joypad/digital.cpp
|
KieronJ/btpsx
|
d2b968750bcbe1a2fe700783186c5eacd54fd93a
|
[
"MIT"
] | null | null | null |
src/core/joypad/digital.cpp
|
KieronJ/btpsx
|
d2b968750bcbe1a2fe700783186c5eacd54fd93a
|
[
"MIT"
] | null | null | null |
#include <cstdint>
#include "../error.hpp"
#include "digital.hpp"
#include "joypad.hpp"
namespace Core
{
Digital::Digital() : m_state(State::Idle)
{
m_keystate.raw = 0xffff;
}
void Digital::SetKeystate(const Key& key, bool state)
{
state = !state;
switch (key) {
case Key::Select: m_keystate.select = state; break;
case Key::Start: m_keystate.start = state; break;
case Key::Up: m_keystate.up = state; break;
case Key::Down: m_keystate.down = state; break;
case Key::Left: m_keystate.left = state; break;
case Key::Right: m_keystate.right = state; break;
case Key::Cross: m_keystate.cross = state; break;
case Key::Circle: m_keystate.circle = state; break;
case Key::Triangle: m_keystate.triangle = state; break;
case Key::Square: m_keystate.square = state; break;
case Key::L1: m_keystate.l1 = state; break;
case Key::R1: m_keystate.r1 = state; break;
case Key::L2: m_keystate.l2 = state; break;
case Key::R2: m_keystate.r2 = state; break;
}
}
uint8_t Digital::Transmit(uint8_t value, bool& ack)
{
switch (m_state) {
case State::Idle:
if (value == 0x1) {
m_state = State::IdLow;
ack = false;
}
return 0xff;
case State::IdLow:
m_command = value;
m_state = State::IdHigh;
ack = false;
return ControllerId;
case State::IdHigh:
switch (m_command) {
case 0x42:
m_state = State::ReadLow;
ack = false;
break;
case 0x43:
m_state = State::Idle;
break;
default: Error("unknown digital pad command 0x{:02x}", m_command);
}
return 0x5a;
case State::ReadLow:
m_state = State::ReadHigh;
ack = false;
return m_keystate.low;
case State::ReadHigh:
m_state = State::Idle;
return m_keystate.high;
default: Error("unimplemented digital pad state");
}
}
}
| 24.75
| 74
| 0.59596
|
KieronJ
|
6c92e24408fccc812bbfa8740806f23f59c722da
| 2,297
|
hpp
|
C++
|
libs/core/algorithms/include/hpx/algorithms/traits/segmented_iterator_traits.hpp
|
bhumitattarde/hpx
|
5b34d8d77b1664fa552445d44cd98e51dc69a74a
|
[
"BSL-1.0"
] | 1
|
2022-02-08T05:55:09.000Z
|
2022-02-08T05:55:09.000Z
|
libs/core/algorithms/include/hpx/algorithms/traits/segmented_iterator_traits.hpp
|
deepaksuresh1411/hpx
|
aa18024d35fe9884a977d4b6076c764dbb8b26d1
|
[
"BSL-1.0"
] | null | null | null |
libs/core/algorithms/include/hpx/algorithms/traits/segmented_iterator_traits.hpp
|
deepaksuresh1411/hpx
|
aa18024d35fe9884a977d4b6076c764dbb8b26d1
|
[
"BSL-1.0"
] | null | null | null |
// Copyright (c) 2007-2022 Hartmut Kaiser
//
// SPDX-License-Identifier: BSL-1.0
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#pragma once
#include <hpx/config.hpp>
#include <hpx/iterator_support/traits/is_iterator.hpp>
#include <type_traits>
#include <utility>
namespace hpx { namespace traits {
///////////////////////////////////////////////////////////////////////////
template <typename Iterator, typename Enable = void>
struct segmented_iterator_traits
{
using is_segmented_iterator = std::false_type;
};
template <typename Iterator, typename Enable>
struct is_segmented_iterator
: segmented_iterator_traits<Iterator>::is_segmented_iterator
{
};
///////////////////////////////////////////////////////////////////////////
// traits allowing to distinguish iterators which have a purely local
// representation
template <typename Iterator, typename Enable = void>
struct segmented_local_iterator_traits
{
using is_segmented_local_iterator = std::false_type;
using iterator = Iterator;
using local_iterator = Iterator;
using local_raw_iterator = Iterator;
static local_raw_iterator const& local(
local_iterator const& it) noexcept
{
return it;
}
static local_iterator const& remote(
local_raw_iterator const& it) noexcept
{
return it;
}
static local_raw_iterator local(local_iterator&& it) noexcept
{
return HPX_MOVE(it);
}
static local_iterator remote(local_raw_iterator&& it) noexcept
{
return HPX_MOVE(it);
}
};
// MSVC needs this for whatever reason
template <>
struct segmented_local_iterator_traits<void>
{
using is_segmented_local_iterator = std::false_type;
};
///////////////////////////////////////////////////////////////////////////
template <typename Iterator, typename Enable>
struct is_segmented_local_iterator
: segmented_local_iterator_traits<Iterator>::is_segmented_local_iterator
{
};
}} // namespace hpx::traits
| 29.075949
| 80
| 0.598607
|
bhumitattarde
|
6c96c6737cd96939ebf501cb7c5dd4fc8d4f62b8
| 61,270
|
cc
|
C++
|
NavMeshOpengl/NavMeshOpengl/Poly2tri/predicates.cc
|
WarZhan/NavMeshOpenGL
|
31c2949701b497060063221aa8eba9993363b285
|
[
"MIT"
] | 4
|
2020-09-27T10:51:03.000Z
|
2021-10-22T01:14:03.000Z
|
NavMeshOpengl/NavMeshOpengl/Poly2tri/predicates.cc
|
WarZhan/NavMeshOpenGL
|
31c2949701b497060063221aa8eba9993363b285
|
[
"MIT"
] | 1
|
2021-11-05T04:17:53.000Z
|
2021-11-05T08:19:28.000Z
|
NavMeshOpengl/NavMeshOpengl/Poly2tri/predicates.cc
|
WarZhan/NavMeshOpenGL
|
31c2949701b497060063221aa8eba9993363b285
|
[
"MIT"
] | 1
|
2021-06-24T02:34:01.000Z
|
2021-06-24T02:34:01.000Z
|
/*****************************************************************************/
/* */
/* Routines for Arbitrary Precision Floating-point Arithmetic */
/* and Fast Robust Geometric Predicates */
/* (predicates.cc) */
/* */
/* May 18, 1996 */
/* */
/* Placed in the public domain by */
/* Jonathan Richard Shewchuk */
/* School of Computer Science */
/* Carnegie Mellon University */
/* 5000 Forbes Avenue */
/* Pittsburgh, Pennsylvania 15213-3891 */
/* jrs@cs.cmu.edu */
/* */
/* This file contains C implementation of algorithms for exact addition */
/* and multiplication of floating-point numbers, and predicates for */
/* robustly performing the orientation and incircle tests used in */
/* computational geometry. The algorithms and underlying theory are */
/* described in Jonathan Richard Shewchuk. "Adaptive Precision Floating- */
/* Point Arithmetic and Fast Robust Geometric Predicates." Technical */
/* Report CMU-CS-96-140, School of Computer Science, Carnegie Mellon */
/* University, Pittsburgh, Pennsylvania, May 1996. (Submitted to */
/* Discrete & Computational Geometry.) */
/* */
/* This file, the paper listed above, and other information are available */
/* from the Web page http://www.cs.cmu.edu/~quake/robust.html . */
/* */
/*****************************************************************************/
/*****************************************************************************/
/* */
/* Using this code: */
/* */
/* First, read the short or long version of the paper (from the Web page */
/* above). */
/* */
/* Be sure to call exactinit() once, before calling any of the arithmetic */
/* functions or geometric predicates. Also be sure to turn on the */
/* optimizer when compiling this file. */
/* */
/* */
/* Several geometric predicates are defined. Their parameters are all */
/* points. Each point is an array of two or three floating-point */
/* numbers. The geometric predicates, described in the papers, are */
/* */
/* orient2d(pa, pb, pc) */
/* orient2dfast(pa, pb, pc) */
/* orient3d(pa, pb, pc, pd) */
/* orient3dfast(pa, pb, pc, pd) */
/* incircle(pa, pb, pc, pd) */
/* incirclefast(pa, pb, pc, pd) */
/* insphere(pa, pb, pc, pd, pe) */
/* inspherefast(pa, pb, pc, pd, pe) */
/* */
/* Those with suffix "fast" are approximate, non-robust versions. Those */
/* without the suffix are adaptive precision, robust versions. There */
/* are also versions with the suffices "exact" and "slow", which are */
/* non-adaptive, exact arithmetic versions, which I use only for timings */
/* in my arithmetic papers. */
/* */
/* */
/* An expansion is represented by an array of floating-point numbers, */
/* sorted from smallest to largest magnitude (possibly with interspersed */
/* zeros). The length of each expansion is stored as a separate integer, */
/* and each arithmetic function returns an integer which is the length */
/* of the expansion it created. */
/* */
/* Several arithmetic functions are defined. Their parameters are */
/* */
/* e, f Input expansions */
/* elen, flen Lengths of input expansions (must be >= 1) */
/* h Output expansion */
/* b Input scalar */
/* */
/* The arithmetic functions are */
/* */
/* grow_expansion(elen, e, b, h) */
/* grow_expansion_zeroelim(elen, e, b, h) */
/* expansion_sum(elen, e, flen, f, h) */
/* expansion_sum_zeroelim1(elen, e, flen, f, h) */
/* expansion_sum_zeroelim2(elen, e, flen, f, h) */
/* fast_expansion_sum(elen, e, flen, f, h) */
/* fast_expansion_sum_zeroelim(elen, e, flen, f, h) */
/* linear_expansion_sum(elen, e, flen, f, h) */
/* linear_expansion_sum_zeroelim(elen, e, flen, f, h) */
/* scale_expansion(elen, e, b, h) */
/* scale_expansion_zeroelim(elen, e, b, h) */
/* compress(elen, e, h) */
/* */
/* All of these are described in the long version of the paper; some are */
/* described in the short version. All return an integer that is the */
/* length of h. Those with suffix _zeroelim perform zero elimination, */
/* and are recommended over their counterparts. The procedure */
/* fast_expansion_sum_zeroelim() (or linear_expansion_sum_zeroelim() on */
/* processors that do not use the round-to-even tiebreaking rule) is */
/* recommended over expansion_sum_zeroelim(). Each procedure has a */
/* little note next to it (in the code below) that tells you whether or */
/* not the output expansion may be the same array as one of the input */
/* expansions. */
/* */
/* */
/* If you look around below, you'll also find macros for a bunch of */
/* simple unrolled arithmetic operations, and procedures for printing */
/* expansions (commented out because they don't work with all C */
/* compilers) and for generating rand floating-point numbers whose */
/* significand bits are all rand. Most of the macros have undocumented */
/* requirements that certain of their parameters should not be the same */
/* variable; for safety, better to make sure all the parameters are */
/* distinct variables. Feel free to send email to jrs@cs.cmu.edu if you */
/* have questions. */
/* */
/*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/* On some machines, the exact arithmetic routines might be defeated by the */
/* use of internal extended precision floating-point registers. Sometimes */
/* this problem can be fixed by defining certain values to be volatile, */
/* thus forcing them to be stored to memory and rounded off. This isn't */
/* a great solution, though, as it slows the arithmetic down. */
/* */
/* To try this out, write "#define INEXACT volatile" below. Normally, */
/* however, INEXACT should be defined to be nothing. ("#define INEXACT".) */
#define INEXACT /* Nothing */
/* #define INEXACT volatile */
#define REAL double /* float or double */
#define REALPRINT doubleprint
#define REALRAND doublerand
#define NARROWRAND narrowdoublerand
#define UNIFORMRAND uniformdoublerand
/* Which of the following two methods of finding the absolute values is */
/* fastest is compiler-dependent. A few compilers can inline and optimize */
/* the fabs() call; but most will incur the overhead of a function call, */
/* which is disastrously slow. A faster way on IEEE machines might be to */
/* mask the appropriate bit, but that's difficult to do in C. */
#define Absolute(a) ((a) >= 0.0 ? (a) : -(a))
/* #define Absolute(a) fabs(a) */
/* Many of the operations are broken up into two pieces, a main part that */
/* performs an approximate operation, and a "tail" that computes the */
/* roundoff error of that operation. */
/* */
/* The operations Fast_Two_Sum(), Fast_Two_Diff(), Two_Sum(), Two_Diff(), */
/* Split(), and Two_Product() are all implemented as described in the */
/* reference. Each of these macros requires certain variables to be */
/* defined in the calling routine. The variables `bvirt', `c', `abig', */
/* `_i', `_j', `_k', `_l', `_m', and `_n' are declared `INEXACT' because */
/* they store the result of an operation that may incur roundoff error. */
/* The input parameter `x' (or the highest numbered `x_' parameter) must */
/* also be declared `INEXACT'. */
#define Fast_Two_Sum_Tail(a, b, x, y) \
bvirt = x - a; \
y = b - bvirt
#define Fast_Two_Sum(a, b, x, y) \
x = (REAL) (a + b); \
Fast_Two_Sum_Tail(a, b, x, y)
#define Fast_Two_Diff_Tail(a, b, x, y) \
bvirt = a - x; \
y = bvirt - b
#define Fast_Two_Diff(a, b, x, y) \
x = (REAL) (a - b); \
Fast_Two_Diff_Tail(a, b, x, y)
#define Two_Sum_Tail(a, b, x, y) \
bvirt = (REAL) (x - a); \
avirt = x - bvirt; \
bround = b - bvirt; \
around = a - avirt; \
y = around + bround
#define Two_Sum(a, b, x, y) \
x = (REAL) (a + b); \
Two_Sum_Tail(a, b, x, y)
#define Two_Diff_Tail(a, b, x, y) \
bvirt = (REAL) (a - x); \
avirt = x + bvirt; \
bround = bvirt - b; \
around = a - avirt; \
y = around + bround
#define Two_Diff(a, b, x, y) \
x = (REAL) (a - b); \
Two_Diff_Tail(a, b, x, y)
#define Split(a, ahi, alo) \
c = (REAL) (splitter * a); \
abig = (REAL) (c - a); \
ahi = c - abig; \
alo = a - ahi
#define Two_Product_Tail(a, b, x, y) \
Split(a, ahi, alo); \
Split(b, bhi, blo); \
err1 = x - (ahi * bhi); \
err2 = err1 - (alo * bhi); \
err3 = err2 - (ahi * blo); \
y = (alo * blo) - err3
#define Two_Product(a, b, x, y) \
x = (REAL) (a * b); \
Two_Product_Tail(a, b, x, y)
/* Two_Product_Presplit() is Two_Product() where one of the inputs has */
/* already been split. Avoids redundant splitting. */
#define Two_Product_Presplit(a, b, bhi, blo, x, y) \
x = (REAL) (a * b); \
Split(a, ahi, alo); \
err1 = x - (ahi * bhi); \
err2 = err1 - (alo * bhi); \
err3 = err2 - (ahi * blo); \
y = (alo * blo) - err3
/* Two_Product_2Presplit() is Two_Product() where both of the inputs have */
/* already been split. Avoids redundant splitting. */
#define Two_Product_2Presplit(a, ahi, alo, b, bhi, blo, x, y) \
x = (REAL) (a * b); \
err1 = x - (ahi * bhi); \
err2 = err1 - (alo * bhi); \
err3 = err2 - (ahi * blo); \
y = (alo * blo) - err3
/* Square() can be done more quickly than Two_Product(). */
#define Square_Tail(a, x, y) \
Split(a, ahi, alo); \
err1 = x - (ahi * ahi); \
err3 = err1 - ((ahi + ahi) * alo); \
y = (alo * alo) - err3
#define Square(a, x, y) \
x = (REAL) (a * a); \
Square_Tail(a, x, y)
/* Macros for summing expansions of various fixed lengths. These are all */
/* unrolled versions of Expansion_Sum(). */
#define Two_One_Sum(a1, a0, b, x2, x1, x0) \
Two_Sum(a0, b , _i, x0); \
Two_Sum(a1, _i, x2, x1)
#define Two_One_Diff(a1, a0, b, x2, x1, x0) \
Two_Diff(a0, b , _i, x0); \
Two_Sum( a1, _i, x2, x1)
#define Two_Two_Sum(a1, a0, b1, b0, x3, x2, x1, x0) \
Two_One_Sum(a1, a0, b0, _j, _0, x0); \
Two_One_Sum(_j, _0, b1, x3, x2, x1)
#define Two_Two_Diff(a1, a0, b1, b0, x3, x2, x1, x0) \
Two_One_Diff(a1, a0, b0, _j, _0, x0); \
Two_One_Diff(_j, _0, b1, x3, x2, x1)
#define Four_One_Sum(a3, a2, a1, a0, b, x4, x3, x2, x1, x0) \
Two_One_Sum(a1, a0, b , _j, x1, x0); \
Two_One_Sum(a3, a2, _j, x4, x3, x2)
#define Four_Two_Sum(a3, a2, a1, a0, b1, b0, x5, x4, x3, x2, x1, x0) \
Four_One_Sum(a3, a2, a1, a0, b0, _k, _2, _1, _0, x0); \
Four_One_Sum(_k, _2, _1, _0, b1, x5, x4, x3, x2, x1)
#define Four_Four_Sum(a3, a2, a1, a0, b4, b3, b1, b0, x7, x6, x5, x4, x3, x2, \
x1, x0) \
Four_Two_Sum(a3, a2, a1, a0, b1, b0, _l, _2, _1, _0, x1, x0); \
Four_Two_Sum(_l, _2, _1, _0, b4, b3, x7, x6, x5, x4, x3, x2)
#define Eight_One_Sum(a7, a6, a5, a4, a3, a2, a1, a0, b, x8, x7, x6, x5, x4, \
x3, x2, x1, x0) \
Four_One_Sum(a3, a2, a1, a0, b , _j, x3, x2, x1, x0); \
Four_One_Sum(a7, a6, a5, a4, _j, x8, x7, x6, x5, x4)
#define Eight_Two_Sum(a7, a6, a5, a4, a3, a2, a1, a0, b1, b0, x9, x8, x7, \
x6, x5, x4, x3, x2, x1, x0) \
Eight_One_Sum(a7, a6, a5, a4, a3, a2, a1, a0, b0, _k, _6, _5, _4, _3, _2, \
_1, _0, x0); \
Eight_One_Sum(_k, _6, _5, _4, _3, _2, _1, _0, b1, x9, x8, x7, x6, x5, x4, \
x3, x2, x1)
#define Eight_Four_Sum(a7, a6, a5, a4, a3, a2, a1, a0, b4, b3, b1, b0, x11, \
x10, x9, x8, x7, x6, x5, x4, x3, x2, x1, x0) \
Eight_Two_Sum(a7, a6, a5, a4, a3, a2, a1, a0, b1, b0, _l, _6, _5, _4, _3, \
_2, _1, _0, x1, x0); \
Eight_Two_Sum(_l, _6, _5, _4, _3, _2, _1, _0, b4, b3, x11, x10, x9, x8, \
x7, x6, x5, x4, x3, x2)
/* Macros for multiplying expansions of various fixed lengths. */
#define Two_One_Product(a1, a0, b, x3, x2, x1, x0) \
Split(b, bhi, blo); \
Two_Product_Presplit(a0, b, bhi, blo, _i, x0); \
Two_Product_Presplit(a1, b, bhi, blo, _j, _0); \
Two_Sum(_i, _0, _k, x1); \
Fast_Two_Sum(_j, _k, x3, x2)
#define Four_One_Product(a3, a2, a1, a0, b, x7, x6, x5, x4, x3, x2, x1, x0) \
Split(b, bhi, blo); \
Two_Product_Presplit(a0, b, bhi, blo, _i, x0); \
Two_Product_Presplit(a1, b, bhi, blo, _j, _0); \
Two_Sum(_i, _0, _k, x1); \
Fast_Two_Sum(_j, _k, _i, x2); \
Two_Product_Presplit(a2, b, bhi, blo, _j, _0); \
Two_Sum(_i, _0, _k, x3); \
Fast_Two_Sum(_j, _k, _i, x4); \
Two_Product_Presplit(a3, b, bhi, blo, _j, _0); \
Two_Sum(_i, _0, _k, x5); \
Fast_Two_Sum(_j, _k, x7, x6)
#define Two_Two_Product(a1, a0, b1, b0, x7, x6, x5, x4, x3, x2, x1, x0) \
Split(a0, a0hi, a0lo); \
Split(b0, bhi, blo); \
Two_Product_2Presplit(a0, a0hi, a0lo, b0, bhi, blo, _i, x0); \
Split(a1, a1hi, a1lo); \
Two_Product_2Presplit(a1, a1hi, a1lo, b0, bhi, blo, _j, _0); \
Two_Sum(_i, _0, _k, _1); \
Fast_Two_Sum(_j, _k, _l, _2); \
Split(b1, bhi, blo); \
Two_Product_2Presplit(a0, a0hi, a0lo, b1, bhi, blo, _i, _0); \
Two_Sum(_1, _0, _k, x1); \
Two_Sum(_2, _k, _j, _1); \
Two_Sum(_l, _j, _m, _2); \
Two_Product_2Presplit(a1, a1hi, a1lo, b1, bhi, blo, _j, _0); \
Two_Sum(_i, _0, _n, _0); \
Two_Sum(_1, _0, _i, x2); \
Two_Sum(_2, _i, _k, _1); \
Two_Sum(_m, _k, _l, _2); \
Two_Sum(_j, _n, _k, _0); \
Two_Sum(_1, _0, _j, x3); \
Two_Sum(_2, _j, _i, _1); \
Two_Sum(_l, _i, _m, _2); \
Two_Sum(_1, _k, _i, x4); \
Two_Sum(_2, _i, _k, x5); \
Two_Sum(_m, _k, x7, x6)
/* An expansion of length two can be squared more quickly than finding the */
/* product of two different expansions of length two, and the result is */
/* guaranteed to have no more than six (rather than eight) components. */
#define Two_Square(a1, a0, x5, x4, x3, x2, x1, x0) \
Square(a0, _j, x0); \
_0 = a0 + a0; \
Two_Product(a1, _0, _k, _1); \
Two_One_Sum(_k, _1, _j, _l, _2, x1); \
Square(a1, _j, _1); \
Two_Two_Sum(_j, _1, _l, _2, x5, x4, x3, x2)
REAL splitter; /* = 2^ceiling(p / 2) + 1. Used to split floats in half. */
REAL epsilon; /* = 2^(-p). Used to estimate roundoff errors. */
/* A set of coefficients used to calculate maximum roundoff errors. */
REAL resulterrbound;
REAL ccwerrboundA, ccwerrboundB, ccwerrboundC;
REAL o3derrboundA, o3derrboundB, o3derrboundC;
REAL iccerrboundA, iccerrboundB, iccerrboundC;
REAL isperrboundA, isperrboundB, isperrboundC;
/*****************************************************************************/
/* */
/* doubleprint() Print the bit representation of a double. */
/* */
/* Useful for debugging exact arithmetic routines. */
/* */
/*****************************************************************************/
/*
void doubleprint(number)
double number;
{
unsigned long long no;
unsigned long long sign, expo;
int exponent;
int i, bottomi;
no = *(unsigned long long *) &number;
sign = no & 0x8000000000000000ll;
expo = (no >> 52) & 0x7ffll;
exponent = (int) expo;
exponent = exponent - 1023;
if (sign) {
printf("-");
} else {
printf(" ");
}
if (exponent == -1023) {
printf(
"0.0000000000000000000000000000000000000000000000000000_ ( )");
} else {
printf("1.");
bottomi = -1;
for (i = 0; i < 52; i++) {
if (no & 0x0008000000000000ll) {
printf("1");
bottomi = i;
} else {
printf("0");
}
no <<= 1;
}
printf("_%d (%d)", exponent, exponent - 1 - bottomi);
}
}
*/
/*****************************************************************************/
/* */
/* floatprint() Print the bit representation of a float. */
/* */
/* Useful for debugging exact arithmetic routines. */
/* */
/*****************************************************************************/
/*
void floatprint(number)
float number;
{
unsigned no;
unsigned sign, expo;
int exponent;
int i, bottomi;
no = *(unsigned *) &number;
sign = no & 0x80000000;
expo = (no >> 23) & 0xff;
exponent = (int) expo;
exponent = exponent - 127;
if (sign) {
printf("-");
} else {
printf(" ");
}
if (exponent == -127) {
printf("0.00000000000000000000000_ ( )");
} else {
printf("1.");
bottomi = -1;
for (i = 0; i < 23; i++) {
if (no & 0x00400000) {
printf("1");
bottomi = i;
} else {
printf("0");
}
no <<= 1;
}
printf("_%3d (%3d)", exponent, exponent - 1 - bottomi);
}
}
*/
/*****************************************************************************/
/* */
/* expansion_print() Print the bit representation of an expansion. */
/* */
/* Useful for debugging exact arithmetic routines. */
/* */
/*****************************************************************************/
/*
void expansion_print(elen, e)
int elen;
REAL *e;
{
int i;
for (i = elen - 1; i >= 0; i--) {
REALPRINT(e[i]);
if (i > 0) {
printf(" +\n");
} else {
printf("\n");
}
}
}
*/
/*****************************************************************************/
/* */
/* doublerand() Generate a double with rand 53-bit significand and a */
/* rand exponent in [0, 511]. */
/* */
/*****************************************************************************/
double doublerand()
{
double result;
double expo;
long a, b, c;
long i;
a = rand();
b = rand();
c = rand();
result = (double) (a - 1073741824) * 8388608.0 + (double) (b >> 8);
for (i = 512, expo = 2; i <= 131072; i *= 2, expo = expo * expo) {
if (c & i) {
result *= expo;
}
}
return result;
}
/*****************************************************************************/
/* */
/* narrowdoublerand() Generate a double with rand 53-bit significand */
/* and a rand exponent in [0, 7]. */
/* */
/*****************************************************************************/
double narrowdoublerand()
{
double result;
double expo;
long a, b, c;
long i;
a = rand();
b = rand();
c = rand();
result = (double) (a - 1073741824) * 8388608.0 + (double) (b >> 8);
for (i = 512, expo = 2; i <= 2048; i *= 2, expo = expo * expo) {
if (c & i) {
result *= expo;
}
}
return result;
}
/*****************************************************************************/
/* */
/* uniformdoublerand() Generate a double with rand 53-bit significand. */
/* */
/*****************************************************************************/
double uniformdoublerand()
{
double result;
long a, b;
a = rand();
b = rand();
result = (double) (a - 1073741824) * 8388608.0 + (double) (b >> 8);
return result;
}
/*****************************************************************************/
/* */
/* floatrand() Generate a float with rand 24-bit significand and a */
/* rand exponent in [0, 63]. */
/* */
/*****************************************************************************/
float floatrand()
{
float result;
float expo;
long a, c;
long i;
a = rand();
c = rand();
result = (float) ((a - 1073741824) >> 6);
for (i = 512, expo = 2; i <= 16384; i *= 2, expo = expo * expo) {
if (c & i) {
result *= expo;
}
}
return result;
}
/*****************************************************************************/
/* */
/* narrowfloatrand() Generate a float with rand 24-bit significand and */
/* a rand exponent in [0, 7]. */
/* */
/*****************************************************************************/
float narrowfloatrand()
{
float result;
float expo;
long a, c;
long i;
a = rand();
c = rand();
result = (float) ((a - 1073741824) >> 6);
for (i = 512, expo = 2; i <= 2048; i *= 2, expo = expo * expo) {
if (c & i) {
result *= expo;
}
}
return result;
}
/*****************************************************************************/
/* */
/* uniformfloatrand() Generate a float with rand 24-bit significand. */
/* */
/*****************************************************************************/
float uniformfloatrand()
{
float result;
long a;
a = rand();
result = (float) ((a - 1073741824) >> 6);
return result;
}
/*****************************************************************************/
/* */
/* exactinit() Initialize the variables used for exact arithmetic. */
/* */
/* `epsilon' is the largest power of two such that 1.0 + epsilon = 1.0 in */
/* floating-point arithmetic. `epsilon' bounds the relative roundoff */
/* error. It is used for floating-point error analysis. */
/* */
/* `splitter' is used to split floating-point numbers into two half- */
/* length significands for exact multiplication. */
/* */
/* I imagine that a highly optimizing compiler might be too smart for its */
/* own good, and somehow cause this routine to fail, if it pretends that */
/* floating-point arithmetic is too much like real arithmetic. */
/* */
/* Don't change this routine unless you fully understand it. */
/* */
/*****************************************************************************/
void exactinit()
{
REAL half;
REAL check, lastcheck;
int every_other;
every_other = 1;
half = 0.5;
epsilon = 1.0;
splitter = 1.0;
check = 1.0;
/* Repeatedly divide `epsilon' by two until it is too small to add to */
/* one without causing roundoff. (Also check if the sum is equal to */
/* the previous sum, for machines that round up instead of using exact */
/* rounding. Not that this library will work on such machines anyway. */
do {
lastcheck = check;
epsilon *= half;
if (every_other) {
splitter *= 2.0;
}
every_other = !every_other;
check = 1.0 + epsilon;
} while ((check != 1.0) && (check != lastcheck));
splitter += 1.0;
/* Error bounds for orientation and incircle tests. */
resulterrbound = (3.0 + 8.0 * epsilon) * epsilon;
ccwerrboundA = (3.0 + 16.0 * epsilon) * epsilon;
ccwerrboundB = (2.0 + 12.0 * epsilon) * epsilon;
ccwerrboundC = (9.0 + 64.0 * epsilon) * epsilon * epsilon;
o3derrboundA = (7.0 + 56.0 * epsilon) * epsilon;
o3derrboundB = (3.0 + 28.0 * epsilon) * epsilon;
o3derrboundC = (26.0 + 288.0 * epsilon) * epsilon * epsilon;
iccerrboundA = (10.0 + 96.0 * epsilon) * epsilon;
iccerrboundB = (4.0 + 48.0 * epsilon) * epsilon;
iccerrboundC = (44.0 + 576.0 * epsilon) * epsilon * epsilon;
isperrboundA = (16.0 + 224.0 * epsilon) * epsilon;
isperrboundB = (5.0 + 72.0 * epsilon) * epsilon;
isperrboundC = (71.0 + 1408.0 * epsilon) * epsilon * epsilon;
}
/*****************************************************************************/
/* */
/* grow_expansion() Add a scalar to an expansion. */
/* */
/* Sets h = e + b. See the long version of my paper for details. */
/* */
/* Maintains the nonoverlapping property. If round-to-even is used (as */
/* with IEEE 754), maintains the strongly nonoverlapping and nonadjacent */
/* properties as well. (That is, if e has one of these properties, so */
/* will h.) */
/* */
/*****************************************************************************/
int grow_expansion(int elen, REAL* e, REAL b, REAL* h)
/* e and h can be the same. */
{
REAL Q;
INEXACT REAL Qnew;
int eindex;
REAL enow;
INEXACT REAL bvirt;
REAL avirt, bround, around;
Q = b;
for (eindex = 0; eindex < elen; eindex++) {
enow = e[eindex];
Two_Sum(Q, enow, Qnew, h[eindex]);
Q = Qnew;
}
h[eindex] = Q;
return eindex + 1;
}
/*****************************************************************************/
/* */
/* grow_expansion_zeroelim() Add a scalar to an expansion, eliminating */
/* zero components from the output expansion. */
/* */
/* Sets h = e + b. See the long version of my paper for details. */
/* */
/* Maintains the nonoverlapping property. If round-to-even is used (as */
/* with IEEE 754), maintains the strongly nonoverlapping and nonadjacent */
/* properties as well. (That is, if e has one of these properties, so */
/* will h.) */
/* */
/*****************************************************************************/
int grow_expansion_zeroelim(int elen, REAL* e, REAL b, REAL* h)
/* e and h can be the same. */
{
REAL Q, hh;
INEXACT REAL Qnew;
int eindex, hindex;
REAL enow;
INEXACT REAL bvirt;
REAL avirt, bround, around;
hindex = 0;
Q = b;
for (eindex = 0; eindex < elen; eindex++) {
enow = e[eindex];
Two_Sum(Q, enow, Qnew, hh);
Q = Qnew;
if (hh != 0.0) {
h[hindex++] = hh;
}
}
if ((Q != 0.0) || (hindex == 0)) {
h[hindex++] = Q;
}
return hindex;
}
/*****************************************************************************/
/* */
/* expansion_sum() Sum two expansions. */
/* */
/* Sets h = e + f. See the long version of my paper for details. */
/* */
/* Maintains the nonoverlapping property. If round-to-even is used (as */
/* with IEEE 754), maintains the nonadjacent property as well. (That is, */
/* if e has one of these properties, so will h.) Does NOT maintain the */
/* strongly nonoverlapping property. */
/* */
/*****************************************************************************/
int expansion_sum(int elen, REAL* e, int flen, REAL* f, REAL* h)
/* e and h can be the same, but f and h cannot. */
{
REAL Q;
INEXACT REAL Qnew;
int findex, hindex, hlast;
REAL hnow;
INEXACT REAL bvirt;
REAL avirt, bround, around;
Q = f[0];
for (hindex = 0; hindex < elen; hindex++) {
hnow = e[hindex];
Two_Sum(Q, hnow, Qnew, h[hindex]);
Q = Qnew;
}
h[hindex] = Q;
hlast = hindex;
for (findex = 1; findex < flen; findex++) {
Q = f[findex];
for (hindex = findex; hindex <= hlast; hindex++) {
hnow = h[hindex];
Two_Sum(Q, hnow, Qnew, h[hindex]);
Q = Qnew;
}
h[++hlast] = Q;
}
return hlast + 1;
}
/*****************************************************************************/
/* */
/* expansion_sum_zeroelim1() Sum two expansions, eliminating zero */
/* components from the output expansion. */
/* */
/* Sets h = e + f. See the long version of my paper for details. */
/* */
/* Maintains the nonoverlapping property. If round-to-even is used (as */
/* with IEEE 754), maintains the nonadjacent property as well. (That is, */
/* if e has one of these properties, so will h.) Does NOT maintain the */
/* strongly nonoverlapping property. */
/* */
/*****************************************************************************/
int expansion_sum_zeroelim1(int elen, REAL* e, int flen, REAL* f, REAL* h)
/* e and h can be the same, but f and h cannot. */
{
REAL Q;
INEXACT REAL Qnew;
int index, findex, hindex, hlast;
REAL hnow;
INEXACT REAL bvirt;
REAL avirt, bround, around;
Q = f[0];
for (hindex = 0; hindex < elen; hindex++) {
hnow = e[hindex];
Two_Sum(Q, hnow, Qnew, h[hindex]);
Q = Qnew;
}
h[hindex] = Q;
hlast = hindex;
for (findex = 1; findex < flen; findex++) {
Q = f[findex];
for (hindex = findex; hindex <= hlast; hindex++) {
hnow = h[hindex];
Two_Sum(Q, hnow, Qnew, h[hindex]);
Q = Qnew;
}
h[++hlast] = Q;
}
hindex = -1;
for (index = 0; index <= hlast; index++) {
hnow = h[index];
if (hnow != 0.0) {
h[++hindex] = hnow;
}
}
if (hindex == -1) {
return 1;
} else {
return hindex + 1;
}
}
/*****************************************************************************/
/* */
/* expansion_sum_zeroelim2() Sum two expansions, eliminating zero */
/* components from the output expansion. */
/* */
/* Sets h = e + f. See the long version of my paper for details. */
/* */
/* Maintains the nonoverlapping property. If round-to-even is used (as */
/* with IEEE 754), maintains the nonadjacent property as well. (That is, */
/* if e has one of these properties, so will h.) Does NOT maintain the */
/* strongly nonoverlapping property. */
/* */
/*****************************************************************************/
int expansion_sum_zeroelim2(int elen, REAL* e, int flen, REAL* f, REAL* h)
/* e and h can be the same, but f and h cannot. */
{
REAL Q, hh;
INEXACT REAL Qnew;
int eindex, findex, hindex, hlast;
REAL enow;
INEXACT REAL bvirt;
REAL avirt, bround, around;
hindex = 0;
Q = f[0];
for (eindex = 0; eindex < elen; eindex++) {
enow = e[eindex];
Two_Sum(Q, enow, Qnew, hh);
Q = Qnew;
if (hh != 0.0) {
h[hindex++] = hh;
}
}
h[hindex] = Q;
hlast = hindex;
for (findex = 1; findex < flen; findex++) {
hindex = 0;
Q = f[findex];
for (eindex = 0; eindex <= hlast; eindex++) {
enow = h[eindex];
Two_Sum(Q, enow, Qnew, hh);
Q = Qnew;
if (hh != 0) {
h[hindex++] = hh;
}
}
h[hindex] = Q;
hlast = hindex;
}
return hlast + 1;
}
/*****************************************************************************/
/* */
/* fast_expansion_sum() Sum two expansions. */
/* */
/* Sets h = e + f. See the long version of my paper for details. */
/* */
/* If round-to-even is used (as with IEEE 754), maintains the strongly */
/* nonoverlapping property. (That is, if e is strongly nonoverlapping, h */
/* will be also.) Does NOT maintain the nonoverlapping or nonadjacent */
/* properties. */
/* */
/*****************************************************************************/
int fast_expansion_sum(int elen, REAL* e, int flen, REAL* f, REAL* h)
/* h cannot be e or f. */
{
REAL Q;
INEXACT REAL Qnew;
INEXACT REAL bvirt;
REAL avirt, bround, around;
int eindex, findex, hindex;
REAL enow, fnow;
enow = e[0];
fnow = f[0];
eindex = findex = 0;
if ((fnow > enow) == (fnow > -enow)) {
Q = enow;
enow = e[++eindex];
} else {
Q = fnow;
fnow = f[++findex];
}
hindex = 0;
if ((eindex < elen) && (findex < flen)) {
if ((fnow > enow) == (fnow > -enow)) {
Fast_Two_Sum(enow, Q, Qnew, h[0]);
enow = e[++eindex];
} else {
Fast_Two_Sum(fnow, Q, Qnew, h[0]);
fnow = f[++findex];
}
Q = Qnew;
hindex = 1;
while ((eindex < elen) && (findex < flen)) {
if ((fnow > enow) == (fnow > -enow)) {
Two_Sum(Q, enow, Qnew, h[hindex]);
enow = e[++eindex];
} else {
Two_Sum(Q, fnow, Qnew, h[hindex]);
fnow = f[++findex];
}
Q = Qnew;
hindex++;
}
}
while (eindex < elen) {
Two_Sum(Q, enow, Qnew, h[hindex]);
enow = e[++eindex];
Q = Qnew;
hindex++;
}
while (findex < flen) {
Two_Sum(Q, fnow, Qnew, h[hindex]);
fnow = f[++findex];
Q = Qnew;
hindex++;
}
h[hindex] = Q;
return hindex + 1;
}
/*****************************************************************************/
/* */
/* fast_expansion_sum_zeroelim() Sum two expansions, eliminating zero */
/* components from the output expansion. */
/* */
/* Sets h = e + f. See the long version of my paper for details. */
/* */
/* If round-to-even is used (as with IEEE 754), maintains the strongly */
/* nonoverlapping property. (That is, if e is strongly nonoverlapping, h */
/* will be also.) Does NOT maintain the nonoverlapping or nonadjacent */
/* properties. */
/* */
/*****************************************************************************/
int fast_expansion_sum_zeroelim(int elen, REAL* e, int flen, REAL* f, REAL* h)
/* h cannot be e or f. */
{
REAL Q;
INEXACT REAL Qnew;
INEXACT REAL hh;
INEXACT REAL bvirt;
REAL avirt, bround, around;
int eindex, findex, hindex;
REAL enow, fnow;
enow = e[0];
fnow = f[0];
eindex = findex = 0;
if ((fnow > enow) == (fnow > -enow)) {
Q = enow;
enow = e[++eindex];
} else {
Q = fnow;
fnow = f[++findex];
}
hindex = 0;
if ((eindex < elen) && (findex < flen)) {
if ((fnow > enow) == (fnow > -enow)) {
Fast_Two_Sum(enow, Q, Qnew, hh);
enow = e[++eindex];
} else {
Fast_Two_Sum(fnow, Q, Qnew, hh);
fnow = f[++findex];
}
Q = Qnew;
if (hh != 0.0) {
h[hindex++] = hh;
}
while ((eindex < elen) && (findex < flen)) {
if ((fnow > enow) == (fnow > -enow)) {
Two_Sum(Q, enow, Qnew, hh);
enow = e[++eindex];
} else {
Two_Sum(Q, fnow, Qnew, hh);
fnow = f[++findex];
}
Q = Qnew;
if (hh != 0.0) {
h[hindex++] = hh;
}
}
}
while (eindex < elen) {
Two_Sum(Q, enow, Qnew, hh);
enow = e[++eindex];
Q = Qnew;
if (hh != 0.0) {
h[hindex++] = hh;
}
}
while (findex < flen) {
Two_Sum(Q, fnow, Qnew, hh);
fnow = f[++findex];
Q = Qnew;
if (hh != 0.0) {
h[hindex++] = hh;
}
}
if ((Q != 0.0) || (hindex == 0)) {
h[hindex++] = Q;
}
return hindex;
}
/*****************************************************************************/
/* */
/* linear_expansion_sum() Sum two expansions. */
/* */
/* Sets h = e + f. See either version of my paper for details. */
/* */
/* Maintains the nonoverlapping property. (That is, if e is */
/* nonoverlapping, h will be also.) */
/* */
/*****************************************************************************/
int linear_expansion_sum(int elen, REAL* e, int flen, REAL* f, REAL* h)
/* h cannot be e or f. */
{
REAL Q, q;
INEXACT REAL Qnew;
INEXACT REAL R;
INEXACT REAL bvirt;
REAL avirt, bround, around;
int eindex, findex, hindex;
REAL enow, fnow;
REAL g0;
enow = e[0];
fnow = f[0];
eindex = findex = 0;
if ((fnow > enow) == (fnow > -enow)) {
g0 = enow;
enow = e[++eindex];
} else {
g0 = fnow;
fnow = f[++findex];
}
if ((eindex < elen) && ((findex >= flen)
|| ((fnow > enow) == (fnow > -enow)))) {
Fast_Two_Sum(enow, g0, Qnew, q);
enow = e[++eindex];
} else {
Fast_Two_Sum(fnow, g0, Qnew, q);
fnow = f[++findex];
}
Q = Qnew;
for (hindex = 0; hindex < elen + flen - 2; hindex++) {
if ((eindex < elen) && ((findex >= flen)
|| ((fnow > enow) == (fnow > -enow)))) {
Fast_Two_Sum(enow, q, R, h[hindex]);
enow = e[++eindex];
} else {
Fast_Two_Sum(fnow, q, R, h[hindex]);
fnow = f[++findex];
}
Two_Sum(Q, R, Qnew, q);
Q = Qnew;
}
h[hindex] = q;
h[hindex + 1] = Q;
return hindex + 2;
}
/*****************************************************************************/
/* */
/* linear_expansion_sum_zeroelim() Sum two expansions, eliminating zero */
/* components from the output expansion. */
/* */
/* Sets h = e + f. See either version of my paper for details. */
/* */
/* Maintains the nonoverlapping property. (That is, if e is */
/* nonoverlapping, h will be also.) */
/* */
/*****************************************************************************/
int linear_expansion_sum_zeroelim(int elen, REAL* e, int flen, REAL* f, REAL* h)
/* h cannot be e or f. */
{
REAL Q, q, hh;
INEXACT REAL Qnew;
INEXACT REAL R;
INEXACT REAL bvirt;
REAL avirt, bround, around;
int eindex, findex, hindex;
int count;
REAL enow, fnow;
REAL g0;
enow = e[0];
fnow = f[0];
eindex = findex = 0;
hindex = 0;
if ((fnow > enow) == (fnow > -enow)) {
g0 = enow;
enow = e[++eindex];
} else {
g0 = fnow;
fnow = f[++findex];
}
if ((eindex < elen) && ((findex >= flen)
|| ((fnow > enow) == (fnow > -enow)))) {
Fast_Two_Sum(enow, g0, Qnew, q);
enow = e[++eindex];
} else {
Fast_Two_Sum(fnow, g0, Qnew, q);
fnow = f[++findex];
}
Q = Qnew;
for (count = 2; count < elen + flen; count++) {
if ((eindex < elen) && ((findex >= flen)
|| ((fnow > enow) == (fnow > -enow)))) {
Fast_Two_Sum(enow, q, R, hh);
enow = e[++eindex];
} else {
Fast_Two_Sum(fnow, q, R, hh);
fnow = f[++findex];
}
Two_Sum(Q, R, Qnew, q);
Q = Qnew;
if (hh != 0) {
h[hindex++] = hh;
}
}
if (q != 0) {
h[hindex++] = q;
}
if ((Q != 0.0) || (hindex == 0)) {
h[hindex++] = Q;
}
return hindex;
}
/*****************************************************************************/
/* */
/* scale_expansion() Multiply an expansion by a scalar. */
/* */
/* Sets h = be. See either version of my paper for details. */
/* */
/* Maintains the nonoverlapping property. If round-to-even is used (as */
/* with IEEE 754), maintains the strongly nonoverlapping and nonadjacent */
/* properties as well. (That is, if e has one of these properties, so */
/* will h.) */
/* */
/*****************************************************************************/
int scale_expansion(int elen, REAL* e, REAL b, REAL* h)
/* e and h cannot be the same. */
{
INEXACT REAL Q;
INEXACT REAL sum;
INEXACT REAL product1;
REAL product0;
int eindex, hindex;
REAL enow;
INEXACT REAL bvirt;
REAL avirt, bround, around;
INEXACT REAL c;
INEXACT REAL abig;
REAL ahi, alo, bhi, blo;
REAL err1, err2, err3;
Split(b, bhi, blo);
Two_Product_Presplit(e[0], b, bhi, blo, Q, h[0]);
hindex = 1;
for (eindex = 1; eindex < elen; eindex++) {
enow = e[eindex];
Two_Product_Presplit(enow, b, bhi, blo, product1, product0);
Two_Sum(Q, product0, sum, h[hindex]);
hindex++;
Two_Sum(product1, sum, Q, h[hindex]);
hindex++;
}
h[hindex] = Q;
return elen + elen;
}
/*****************************************************************************/
/* */
/* scale_expansion_zeroelim() Multiply an expansion by a scalar, */
/* eliminating zero components from the */
/* output expansion. */
/* */
/* Sets h = be. See either version of my paper for details. */
/* */
/* Maintains the nonoverlapping property. If round-to-even is used (as */
/* with IEEE 754), maintains the strongly nonoverlapping and nonadjacent */
/* properties as well. (That is, if e has one of these properties, so */
/* will h.) */
/* */
/*****************************************************************************/
int scale_expansion_zeroelim(int elen, REAL* e, REAL b, REAL* h)
/* e and h cannot be the same. */
{
INEXACT REAL Q, sum;
REAL hh;
INEXACT REAL product1;
REAL product0;
int eindex, hindex;
REAL enow;
INEXACT REAL bvirt;
REAL avirt, bround, around;
INEXACT REAL c;
INEXACT REAL abig;
REAL ahi, alo, bhi, blo;
REAL err1, err2, err3;
Split(b, bhi, blo);
Two_Product_Presplit(e[0], b, bhi, blo, Q, hh);
hindex = 0;
if (hh != 0) {
h[hindex++] = hh;
}
for (eindex = 1; eindex < elen; eindex++) {
enow = e[eindex];
Two_Product_Presplit(enow, b, bhi, blo, product1, product0);
Two_Sum(Q, product0, sum, hh);
if (hh != 0) {
h[hindex++] = hh;
}
Fast_Two_Sum(product1, sum, Q, hh);
if (hh != 0) {
h[hindex++] = hh;
}
}
if ((Q != 0.0) || (hindex == 0)) {
h[hindex++] = Q;
}
return hindex;
}
/*****************************************************************************/
/* */
/* compress() Compress an expansion. */
/* */
/* See the long version of my paper for details. */
/* */
/* Maintains the nonoverlapping property. If round-to-even is used (as */
/* with IEEE 754), then any nonoverlapping expansion is converted to a */
/* nonadjacent expansion. */
/* */
/*****************************************************************************/
int compress(int elen, REAL* e, REAL* h)
/* e and h may be the same. */
{
REAL Q, q;
INEXACT REAL Qnew;
int eindex, hindex;
INEXACT REAL bvirt;
REAL enow, hnow;
int top, bottom;
bottom = elen - 1;
Q = e[bottom];
for (eindex = elen - 2; eindex >= 0; eindex--) {
enow = e[eindex];
Fast_Two_Sum(Q, enow, Qnew, q);
if (q != 0) {
h[bottom--] = Qnew;
Q = q;
} else {
Q = Qnew;
}
}
top = 0;
for (hindex = bottom + 1; hindex < elen; hindex++) {
hnow = h[hindex];
Fast_Two_Sum(hnow, Q, Qnew, q);
if (q != 0) {
h[top++] = q;
}
Q = Qnew;
}
h[top] = Q;
return top + 1;
}
/*****************************************************************************/
/* */
/* estimate() Produce a one-word estimate of an expansion's value. */
/* */
/* See either version of my paper for details. */
/* */
/*****************************************************************************/
REAL estimate(int elen, REAL* e)
{
REAL Q;
int eindex;
Q = e[0];
for (eindex = 1; eindex < elen; eindex++) {
Q += e[eindex];
}
return Q;
}
/*****************************************************************************/
/* */
/* orient2dfast() Approximate 2D orientation test. Nonrobust. */
/* orient2dexact() Exact 2D orientation test. Robust. */
/* orient2dslow() Another exact 2D orientation test. Robust. */
/* orient2d() Adaptive exact 2D orientation test. Robust. */
/* */
/* Return a positive value if the points pa, pb, and pc occur */
/* in counterclockwise order; a negative value if they occur */
/* in clockwise order; and zero if they are collinear. The */
/* result is also a rough approximation of twice the signed */
/* area of the triangle defined by the three points. */
/* */
/* Only the first and last routine should be used; the middle two are for */
/* timings. */
/* */
/* The last three use exact arithmetic to ensure a correct answer. The */
/* result returned is the determinant of a matrix. In orient2d() only, */
/* this determinant is computed adaptively, in the sense that exact */
/* arithmetic is used only to the degree it is needed to ensure that the */
/* returned value has the correct sign. Hence, orient2d() is usually quite */
/* fast, but will run more slowly when the input points are collinear or */
/* nearly so. */
/* */
/*****************************************************************************/
REAL orient2dfast(REAL* pa, REAL* pb, REAL* pc)
{
REAL acx, bcx, acy, bcy;
acx = pa[0] - pc[0];
bcx = pb[0] - pc[0];
acy = pa[1] - pc[1];
bcy = pb[1] - pc[1];
return acx * bcy - acy * bcx;
}
REAL orient2dexact(REAL* pa, REAL* pb, REAL* pc)
{
INEXACT REAL axby1, axcy1, bxcy1, bxay1, cxay1, cxby1;
REAL axby0, axcy0, bxcy0, bxay0, cxay0, cxby0;
REAL aterms[4], bterms[4], cterms[4];
INEXACT REAL aterms3, bterms3, cterms3;
REAL v[8], w[12];
int vlength, wlength;
INEXACT REAL bvirt;
REAL avirt, bround, around;
INEXACT REAL c;
INEXACT REAL abig;
REAL ahi, alo, bhi, blo;
REAL err1, err2, err3;
INEXACT REAL _i, _j;
REAL _0;
Two_Product(pa[0], pb[1], axby1, axby0);
Two_Product(pa[0], pc[1], axcy1, axcy0);
Two_Two_Diff(axby1, axby0, axcy1, axcy0,
aterms3, aterms[2], aterms[1], aterms[0]);
aterms[3] = aterms3;
Two_Product(pb[0], pc[1], bxcy1, bxcy0);
Two_Product(pb[0], pa[1], bxay1, bxay0);
Two_Two_Diff(bxcy1, bxcy0, bxay1, bxay0,
bterms3, bterms[2], bterms[1], bterms[0]);
bterms[3] = bterms3;
Two_Product(pc[0], pa[1], cxay1, cxay0);
Two_Product(pc[0], pb[1], cxby1, cxby0);
Two_Two_Diff(cxay1, cxay0, cxby1, cxby0,
cterms3, cterms[2], cterms[1], cterms[0]);
cterms[3] = cterms3;
vlength = fast_expansion_sum_zeroelim(4, aterms, 4, bterms, v);
wlength = fast_expansion_sum_zeroelim(vlength, v, 4, cterms, w);
return w[wlength - 1];
}
REAL orient2dslow(REAL* pa, REAL* pb, REAL* pc)
{
INEXACT REAL acx, acy, bcx, bcy;
REAL acxtail, acytail;
REAL bcxtail, bcytail;
REAL negate, negatetail;
REAL axby[8], bxay[8];
INEXACT REAL axby7, bxay7;
REAL deter[16];
int deterlen;
INEXACT REAL bvirt;
REAL avirt, bround, around;
INEXACT REAL c;
INEXACT REAL abig;
REAL a0hi, a0lo, a1hi, a1lo, bhi, blo;
REAL err1, err2, err3;
INEXACT REAL _i, _j, _k, _l, _m, _n;
REAL _0, _1, _2;
Two_Diff(pa[0], pc[0], acx, acxtail);
Two_Diff(pa[1], pc[1], acy, acytail);
Two_Diff(pb[0], pc[0], bcx, bcxtail);
Two_Diff(pb[1], pc[1], bcy, bcytail);
Two_Two_Product(acx, acxtail, bcy, bcytail,
axby7, axby[6], axby[5], axby[4],
axby[3], axby[2], axby[1], axby[0]);
axby[7] = axby7;
negate = -acy;
negatetail = -acytail;
Two_Two_Product(bcx, bcxtail, negate, negatetail,
bxay7, bxay[6], bxay[5], bxay[4],
bxay[3], bxay[2], bxay[1], bxay[0]);
bxay[7] = bxay7;
deterlen = fast_expansion_sum_zeroelim(8, axby, 8, bxay, deter);
return deter[deterlen - 1];
}
REAL orient2dadapt(REAL* pa, REAL* pb, REAL* pc, REAL detsum)
{
INEXACT REAL acx, acy, bcx, bcy;
REAL acxtail, acytail, bcxtail, bcytail;
INEXACT REAL detleft, detright;
REAL detlefttail, detrighttail;
REAL det, errbound;
REAL B[4], C1[8], C2[12], D[16];
INEXACT REAL B3;
int C1length, C2length, Dlength;
REAL u[4];
INEXACT REAL u3;
INEXACT REAL s1, t1;
REAL s0, t0;
INEXACT REAL bvirt;
REAL avirt, bround, around;
INEXACT REAL c;
INEXACT REAL abig;
REAL ahi, alo, bhi, blo;
REAL err1, err2, err3;
INEXACT REAL _i, _j;
REAL _0;
acx = (REAL) (pa[0] - pc[0]);
bcx = (REAL) (pb[0] - pc[0]);
acy = (REAL) (pa[1] - pc[1]);
bcy = (REAL) (pb[1] - pc[1]);
Two_Product(acx, bcy, detleft, detlefttail);
Two_Product(acy, bcx, detright, detrighttail);
Two_Two_Diff(detleft, detlefttail, detright, detrighttail,
B3, B[2], B[1], B[0]);
B[3] = B3;
det = estimate(4, B);
errbound = ccwerrboundB * detsum;
if ((det >= errbound) || (-det >= errbound)) {
return det;
}
Two_Diff_Tail(pa[0], pc[0], acx, acxtail);
Two_Diff_Tail(pb[0], pc[0], bcx, bcxtail);
Two_Diff_Tail(pa[1], pc[1], acy, acytail);
Two_Diff_Tail(pb[1], pc[1], bcy, bcytail);
if ((acxtail == 0.0) && (acytail == 0.0)
&& (bcxtail == 0.0) && (bcytail == 0.0)) {
return det;
}
errbound = ccwerrboundC * detsum + resulterrbound * Absolute(det);
det += (acx * bcytail + bcy * acxtail)
- (acy * bcxtail + bcx * acytail);
if ((det >= errbound) || (-det >= errbound)) {
return det;
}
Two_Product(acxtail, bcy, s1, s0);
Two_Product(acytail, bcx, t1, t0);
Two_Two_Diff(s1, s0, t1, t0, u3, u[2], u[1], u[0]);
u[3] = u3;
C1length = fast_expansion_sum_zeroelim(4, B, 4, u, C1);
Two_Product(acx, bcytail, s1, s0);
Two_Product(acy, bcxtail, t1, t0);
Two_Two_Diff(s1, s0, t1, t0, u3, u[2], u[1], u[0]);
u[3] = u3;
C2length = fast_expansion_sum_zeroelim(C1length, C1, 4, u, C2);
Two_Product(acxtail, bcytail, s1, s0);
Two_Product(acytail, bcxtail, t1, t0);
Two_Two_Diff(s1, s0, t1, t0, u3, u[2], u[1], u[0]);
u[3] = u3;
Dlength = fast_expansion_sum_zeroelim(C2length, C2, 4, u, D);
return(D[Dlength - 1]);
}
REAL orient2d(REAL* pa, REAL* pb, REAL* pc)
{
REAL detleft, detright, det;
REAL detsum, errbound;
detleft = (pa[0] - pc[0]) * (pb[1] - pc[1]);
detright = (pa[1] - pc[1]) * (pb[0] - pc[0]);
det = detleft - detright;
if (detleft > 0.0) {
if (detright <= 0.0) {
return det;
} else {
detsum = detleft + detright;
}
} else if (detleft < 0.0) {
if (detright >= 0.0) {
return det;
} else {
detsum = -detleft - detright;
}
} else {
return det;
}
errbound = ccwerrboundA * detsum;
if ((det >= errbound) || (-det >= errbound)) {
return det;
}
return orient2dadapt(pa, pb, pc, detsum);
}
| 38.486181
| 81
| 0.411376
|
WarZhan
|
6c973a59bc2c13206a115d373f3666db5a369882
| 1,834
|
hpp
|
C++
|
CBench/utils/timer.hpp
|
jinsian/VizAly-Foresight
|
687b869424be4706e85bd23708ba319f4c371115
|
[
"Unlicense",
"BSD-3-Clause"
] | 14
|
2019-12-07T18:17:17.000Z
|
2021-11-17T11:41:21.000Z
|
CBench/utils/timer.hpp
|
jinsian/VizAly-Foresight
|
687b869424be4706e85bd23708ba319f4c371115
|
[
"Unlicense",
"BSD-3-Clause"
] | 9
|
2019-06-28T19:23:44.000Z
|
2019-10-03T15:32:07.000Z
|
CBench/utils/timer.hpp
|
jinsian/VizAly-Foresight
|
687b869424be4706e85bd23708ba319f4c371115
|
[
"Unlicense",
"BSD-3-Clause"
] | 5
|
2020-01-05T04:40:20.000Z
|
2020-11-17T21:56:01.000Z
|
/*================================================================================
This software is open source software available under the BSD-3 license.
Copyright (c) 2017, Los Alamos National Security, LLC.
All rights reserved.
Authors:
- Pascal Grosset
================================================================================*/
#ifndef _TIMER_H_
#define _TIMER_H_
#include <chrono>
#include <string>
#include <ctime>
#include <sstream>
class Timer
{
std::chrono::time_point<std::chrono::system_clock> startTime, endTime;
std::chrono::duration<double> elapsed_seconds;
public:
Timer();
Timer(int x);
~Timer();
void start();
void stop();
double stop(int x);
double getCurrentDuration(); // time in seconds since timer started
double getDuration(); // time in seconds
static std::string getCurrentTime(); // get the current time
};
inline Timer::Timer() {}
inline Timer::Timer(int x){ start(); }
inline Timer::~Timer() {}
inline void Timer::start() { startTime = std::chrono::system_clock::now(); }
inline void Timer::stop() { endTime = std::chrono::system_clock::now(); elapsed_seconds = endTime - startTime; }
inline double Timer::stop(int x) { endTime = std::chrono::system_clock::now(); elapsed_seconds = endTime - startTime; }
inline double Timer::getDuration() { return elapsed_seconds.count(); }
inline double Timer::getCurrentDuration()
{
std::chrono::time_point<std::chrono::system_clock> timeNow;
timeNow = std::chrono::system_clock::now();
return (timeNow - startTime).count();
}
inline std::string Timer::getCurrentTime()
{
time_t now = time(0);
tm *ltm = localtime(&now);
std::stringstream ss;
ss << "_" << 1 + ltm->tm_mon << "_" << ltm->tm_mday << "__" << ltm->tm_hour << "_" << ltm->tm_min << "_" << ltm->tm_sec << "_" << std::endl;
return ss.str();
}
#endif
| 27.787879
| 141
| 0.624318
|
jinsian
|
6c982663f70c2a74a85ce1280b4f2fb9ce35db30
| 7,517
|
cc
|
C++
|
contrib/wcthdat.cc
|
BLumia/thtk-1
|
58729e2d44e7b6365f2d6f484abe651781efc115
|
[
"Libpng",
"BSD-2-Clause"
] | 220
|
2015-05-03T02:22:20.000Z
|
2022-03-30T11:43:14.000Z
|
contrib/wcthdat.cc
|
BLumia/thtk-1
|
58729e2d44e7b6365f2d6f484abe651781efc115
|
[
"Libpng",
"BSD-2-Clause"
] | 73
|
2015-05-04T17:18:27.000Z
|
2022-03-27T17:53:29.000Z
|
contrib/wcthdat.cc
|
BLumia/thtk-1
|
58729e2d44e7b6365f2d6f484abe651781efc115
|
[
"Libpng",
"BSD-2-Clause"
] | 60
|
2015-04-22T01:08:25.000Z
|
2022-03-30T11:43:15.000Z
|
/*
* Redistribution and use in source and binary forms, with
* or without modification, are permitted provided that the
* following conditions are met:
*
* 1. Redistributions of source code must retain this list
* of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce this
* list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
#include <config.h>
#include "thtkpp.hh"
#include "wcxhead.h"
#include <wchar.h>
#include <string.h>
#include <memory>
#include <stdexcept>
template<typename CTYPE> struct Helper {};
template<>
struct Helper<char> {
constexpr static char*rb = "rb";
constexpr static char*wb = "wb";
static void cpy_s(char *dest, size_t destsz, const char *src) {
strcpy_s(dest,destsz,src);
}
static void cpy_widen_s(char *dest, size_t destsz, const char *src) {
strcpy_s(dest,destsz,src);
}
};
template<>
struct Helper<wchar_t> {
constexpr static wchar_t*rb = L"rb";
constexpr static wchar_t*wb = L"wb";
static void cpy_s(wchar_t *dest, size_t destsz, const wchar_t *src) {
wcscpy_s(dest,destsz,src);
}
static void cpy_widen_s(wchar_t *dest, size_t destsz, const char *src) {
for (int i = 0; i < destsz && *src; i++, src++) {
dest[i] = (wchar_t)(unsigned char)*src; // treat name as Latin1
}
}
};
template<typename CTYPE>
Thtk::Dat* open_and_detect(const CTYPE* filename, Thtk::Io& io) {
int version = Thtk::Dat::detect(filename, io);
if (-1 == version) {
throw std::runtime_error("couldn't detect version");
}
return new Thtk::Dat(version, io);
}
struct DeletableBase {
virtual ~DeletableBase() {}
};
template<typename CTYPE>
struct ThdatContext : DeletableBase {
CTYPE arcname[MAX_PATH];
int openmode;
std::unique_ptr<Thtk::Io> io;
std::unique_ptr<Thtk::Dat> dat;
int cur_entry;
int entries;
int size;
};
template<typename CTYPE, typename ADATA>
HANDLE OpenArchiveTemplate(ADATA* ArchiveData) {
std::unique_ptr<Thtk::Io> io;
try {
io.reset(new Thtk::Io(ArchiveData->ArcName, Helper<CTYPE>::rb));
}
catch (...) {
ArchiveData->OpenResult = E_EOPEN;
return nullptr;
}
std::unique_ptr<Thtk::Dat> dat;
try {
dat.reset(open_and_detect(ArchiveData->ArcName, *io));
}
catch (...) {
ArchiveData->OpenResult = E_BAD_ARCHIVE;
return nullptr;
}
ThdatContext<CTYPE>* ctx = new ThdatContext<CTYPE>;
Helper<CTYPE>::cpy_s(ctx->arcname, MAX_PATH, ArchiveData->ArcName);
ctx->openmode = ArchiveData->OpenMode;
ctx->io.reset(io.release());
ctx->dat.reset(dat.release());
ctx->cur_entry = -1;
ctx->entries = ctx->dat->entry_count();
return ctx;
}
template<typename CTYPE, typename HDATA>
int ReadHeaderTemplate(HANDLE hArcData, HDATA *HeaderData) {
ThdatContext<CTYPE>* ctx = (ThdatContext<CTYPE>*)hArcData;
memset(HeaderData, 0, sizeof(*HeaderData));
++ctx->cur_entry;
if (ctx->cur_entry == ctx->entries) return E_END_ARCHIVE;
thtk_error_t* err = nullptr;
Helper<CTYPE>::cpy_s(HeaderData->ArcName, MAX_PATH, ctx->arcname);
try {
Thtk::Entry e = ctx->dat->entry(ctx->cur_entry);
const char* name = e.name();
Helper<CTYPE>::cpy_widen_s(HeaderData->FileName, sizeof(HeaderData->FileName) / sizeof(CTYPE), name);
HeaderData->PackSize = e.zsize();
HeaderData->UnpSize = e.size();;
}
catch (...) {
return E_BAD_ARCHIVE;
}
return 0;
}
template<typename CTYPE>
int ProcessFileTemplate(HANDLE hArcData, int Operation, CTYPE *DestPath, CTYPE *DestName) {
ThdatContext<CTYPE>* ctx = (ThdatContext<CTYPE>*)hArcData;
if (Operation != PK_EXTRACT) return 0;
if (DestPath == nullptr) DestPath = DestName;
try {
Thtk::Io out(DestPath, Helper<CTYPE>::wb);
ctx->dat->entry(ctx->cur_entry).read(out);
}
catch (...) {
return E_BAD_ARCHIVE;
}
return 0;
}
template<typename CTYPE>
BOOL CanYouHandleThisFileTemplate(CTYPE* filename) {
try {
Thtk::Io io(filename, Helper<CTYPE>::rb);
return -1 != Thtk::Dat::detect(filename, io);
}
catch (...)
{
return FALSE;
}
}
void thtk_wrapper_preinit(HMODULE mod);
extern "C" {
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
if (fdwReason == DLL_PROCESS_ATTACH) {
thtk_wrapper_preinit((HMODULE)hinstDLL);
}
return TRUE;
}
// ANSI functions
HANDLE API_SYMBOL __stdcall OpenArchive(tOpenArchiveData *ArchiveData) {
return OpenArchiveTemplate<char, tOpenArchiveData>(ArchiveData);
}
int API_SYMBOL __stdcall ReadHeader(HANDLE hArcData, tHeaderData *HeaderData) {
return ReadHeaderTemplate<char, tHeaderData>(hArcData, HeaderData);
}
int API_SYMBOL __stdcall ProcessFile(HANDLE hArcData, int Operation, char *DestPath, char *DestName) {
return ProcessFileTemplate<char>(hArcData, Operation, DestPath, DestName);
}
void API_SYMBOL __stdcall SetChangeVolProc(HANDLE hArcData, tChangeVolProc pChangeVolProc1) {
}
void API_SYMBOL __stdcall SetProcessDataProc(HANDLE hArcData, tProcessDataProc pProcessDataProc) {
}
BOOL API_SYMBOL __stdcall CanYouHandleThisFile(char* filename) {
return CanYouHandleThisFileTemplate<char>(filename);
}
// Unicode functions
HANDLE API_SYMBOL __stdcall OpenArchiveW(tOpenArchiveDataW *ArchiveData) {
return OpenArchiveTemplate<wchar_t, tOpenArchiveDataW>(ArchiveData);
}
int API_SYMBOL __stdcall ReadHeaderExW(HANDLE hArcData, tHeaderDataExW *HeaderData) {
return ReadHeaderTemplate<wchar_t, tHeaderDataExW>(hArcData, HeaderData);
}
int API_SYMBOL __stdcall ProcessFileW(HANDLE hArcData, int Operation, wchar_t *DestPath, wchar_t *DestName) {
return ProcessFileTemplate<wchar_t>(hArcData, Operation, DestPath, DestName);
}
void API_SYMBOL __stdcall SetChangeVolProcW(HANDLE hArcData, tChangeVolProcW pChangeVolProc1) {
}
void API_SYMBOL __stdcall SetProcessDataProcW(HANDLE hArcData, tProcessDataProcW pProcessDataProc) {
}
BOOL API_SYMBOL __stdcall CanYouHandleThisFileW(wchar_t* filename) {
return CanYouHandleThisFileTemplate<wchar_t>(filename);
}
// Misc
int API_SYMBOL __stdcall GetPackerCaps() {
return PK_CAPS_BY_CONTENT;
}
int API_SYMBOL __stdcall CloseArchive(HANDLE hArcData) {
DeletableBase* ctx = (DeletableBase*)hArcData;
delete ctx;
return 0;
}
}
| 33.86036
| 113
| 0.685247
|
BLumia
|
6c9a74f68a3d19d01140687f3ab09b77207b8072
| 3,373
|
cc
|
C++
|
dcmdata/apps/dcmodify.cc
|
chrisvana/dcmtk_copy
|
f929ab8590aca5b7a319c95af4fe2ee31be52f46
|
[
"Apache-2.0"
] | 24
|
2015-07-22T05:07:51.000Z
|
2019-02-28T04:52:33.000Z
|
dcmdata/apps/dcmodify.cc
|
chrisvana/dcmtk_copy
|
f929ab8590aca5b7a319c95af4fe2ee31be52f46
|
[
"Apache-2.0"
] | 13
|
2015-07-23T05:43:02.000Z
|
2021-07-17T17:14:45.000Z
|
dcmdata/apps/dcmodify.cc
|
chrisvana/dcmtk_copy
|
f929ab8590aca5b7a319c95af4fe2ee31be52f46
|
[
"Apache-2.0"
] | 13
|
2015-07-23T01:07:30.000Z
|
2021-01-05T09:49:30.000Z
|
/*
*
* Copyright (C) 2003-2010, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
*
* OFFIS e.V.
* R&D Division Health
* Escherweg 2
* D-26121 Oldenburg, Germany
*
*
* Module: dcmdata
*
* Author: Michael Onken
*
* Purpose: Commandline-Application to modify tags in DICOM-Files
*
* Last Update: $Author: joergr $
* Update Date: $Date: 2010-10-14 13:13:30 $
* CVS/RCS Revision: $Revision: 1.12 $
* Status: $State: Exp $
*
* CVS/RCS Log at end of file
*
*/
#include "dcmtk/config/osconfig.h" // make sure OS specific configuration is included first
#include "mdfconen.h"
#include "dcmtk/dcmdata/dcpath.h"
#define OFFIS_CONSOLE_APPLICATION "dcmodify"
static OFLogger dcmodifyLogger = OFLog::getLogger("dcmtk.apps." OFFIS_CONSOLE_APPLICATION);
int main(int argc, char *argv[])
{
int error_count = 0;
MdfConsoleEngine engine(argc, argv, OFFIS_CONSOLE_APPLICATION);
error_count = engine.startProvidingService();
if (error_count == 1)
OFLOG_ERROR(dcmodifyLogger, "There was 1 error");
else if (error_count > 1)
OFLOG_ERROR(dcmodifyLogger, "There were " << error_count << " errors");
return(error_count);
}
/*
** CVS/RCS Log:
** $Log: dcmodify.cc,v $
** Revision 1.12 2010-10-14 13:13:30 joergr
** Updated copyright header. Added reference to COPYRIGHT file.
**
** Revision 1.11 2009-11-04 09:58:06 uli
** Switched to logging mechanism provided by the "new" oflog module
**
** Revision 1.10 2009-01-15 16:11:55 onken
** Reworked dcmodify to work with the new DcmPath classes for supporting
** wildcard paths and automatic insertion of missing attributes and items.
** Added options for private tag handling and modification of UN values and
** for ignoring errors resulting from missing tags during modify and erase
** operations. Further cleanups.
**
** Revision 1.9 2008-09-25 11:19:48 joergr
** Added support for printing the expanded command line arguments.
** Always output the resource identifier of the command line tool in debug mode.
**
** Revision 1.8 2006/08/15 15:50:56 meichel
** Updated all code in module dcmdata to correctly compile when
** all standard C++ classes remain in namespace std.
**
** Revision 1.7 2006/07/27 13:34:35 joergr
** Updated copyright date.
**
** Revision 1.6 2005/12/08 15:40:49 meichel
** Changed include path schema for all DCMTK header files
**
** Revision 1.5 2004/10/22 16:53:26 onken
** - fixed ignore-errors-option
** - major enhancements for supporting private tags
** - removed '0 Errors' output
** - modifications to groups 0000,0001,0002,0003,0005 and 0007 are blocked,
** removing tags with group 0001,0003,0005 and 0007 is still possible
** - UID options:
** - generate new study, series and instance UIDs
** - When changing UIDs in dataset, related metaheader tags are updated
** automatically
** - minor code improvements
**
** Revision 1.4 2003/10/13 14:52:59 onken
** error-message adapted to mdfconen.cc
**
** Revision 1.3 2003/09/19 12:47:21 onken
** return-value is now only zero, if no error occurred
**
** Revision 1.2 2003/07/09 12:13:13 meichel
** Included dcmodify in MSVC build system, updated headers
**
** Revision 1.1 2003/06/26 09:17:18 onken
** Added commandline-application dcmodify.
**
**
*/
| 31.820755
| 93
| 0.706196
|
chrisvana
|
6c9cb9b771a0ba63060376876988637c25c800c7
| 247
|
cpp
|
C++
|
src/render/ManipulatorDevice.cpp
|
0of/WebOS-Magna
|
a0fe2c9708fd4dd07928c11fcb03fb29fdd2d511
|
[
"Apache-2.0"
] | 1
|
2016-03-26T13:25:08.000Z
|
2016-03-26T13:25:08.000Z
|
src/render/ManipulatorDevice.cpp
|
0of/WebOS-Magna
|
a0fe2c9708fd4dd07928c11fcb03fb29fdd2d511
|
[
"Apache-2.0"
] | null | null | null |
src/render/ManipulatorDevice.cpp
|
0of/WebOS-Magna
|
a0fe2c9708fd4dd07928c11fcb03fb29fdd2d511
|
[
"Apache-2.0"
] | null | null | null |
#include "ManipulateDevice.h"
namespace Magna{
namespace Render{
ManipulateDevice::ManipulateDevice()
:m_engine(){
}
ManipulateDevice::~ManipulateDevice(){
}
}//namespace Render
}//namespace Magna
| 15.4375
| 43
| 0.623482
|
0of
|
6c9e78be176b4e788fa7f5047ca9c9b6d04db8e8
| 346
|
cpp
|
C++
|
functions_main.cpp
|
ronyadin/msse-cpp-lessons
|
af60944d2a8f28b65f52dea1531b45112ae36d15
|
[
"MIT"
] | null | null | null |
functions_main.cpp
|
ronyadin/msse-cpp-lessons
|
af60944d2a8f28b65f52dea1531b45112ae36d15
|
[
"MIT"
] | null | null | null |
functions_main.cpp
|
ronyadin/msse-cpp-lessons
|
af60944d2a8f28b65f52dea1531b45112ae36d15
|
[
"MIT"
] | null | null | null |
#include <iostream>
#include <stdexcept>
#include "functions.hpp"
int main(void)
{
try {
std::cout << convert_ftoc(-600.0) << std::endl;
}
catch(std::exception & ex)
{
std::cout << "Program encountered an error!" << std::endl;
std::cout << ex.what() << std::endl;
return 1;
}
return 0;
}
| 18.210526
| 66
| 0.537572
|
ronyadin
|
6ca6da066712cb7e886adec3390bc52e95ed02b2
| 2,658
|
cpp
|
C++
|
service/sys_prctl.cpp
|
zukisoft/vm
|
8da577329a295449ed1517bbf27cb489531b18ac
|
[
"MIT"
] | 2
|
2017-02-02T13:32:14.000Z
|
2017-08-20T07:58:49.000Z
|
service/sys_prctl.cpp
|
zukisoft/vm
|
8da577329a295449ed1517bbf27cb489531b18ac
|
[
"MIT"
] | null | null | null |
service/sys_prctl.cpp
|
zukisoft/vm
|
8da577329a295449ed1517bbf27cb489531b18ac
|
[
"MIT"
] | 2
|
2017-03-09T02:41:25.000Z
|
2019-07-10T03:22:23.000Z
|
//-----------------------------------------------------------------------------
// Copyright (c) 2016 Michael G. Brehm
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//-----------------------------------------------------------------------------
#include "stdafx.h"
#include "SystemCall.h"
#pragma warning(push, 4)
//-----------------------------------------------------------------------------
// sys_prctl
//
// Perform process-specific operations
//
// Arguments:
//
// context - System call context object
// option - Operation to be performed
// arg2 - Optional operation-specific argument
// arg3 - Optional operation-specific argument
// arg4 - Optional operation-specific argument
// arg5 - Optional operation-specific argument
uapi::long_t sys_prctl(const Context* context, int option, uapi::ulong_t arg2, uapi::ulong_t arg3, uapi::ulong_t arg4, uapi::ulong_t arg5)
{
(context);
(option);
(arg2);
(arg3);
(arg4);
(arg5);
return -LINUX_ENOSYS;
}
// sys32_prctl
//
sys32_long_t sys32_prctl(sys32_context_t context, sys32_int_t option, sys32_ulong_t arg2, sys32_ulong_t arg3, sys32_ulong_t arg4, sys32_ulong_t arg5)
{
return static_cast<sys32_long_t>(SystemCall::Invoke(sys_prctl, context, option, arg2, arg3, arg4, arg5));
}
#ifdef _M_X64
// sys64_prctl
//
sys64_long_t sys64_prctl(sys64_context_t context, sys64_int_t option, sys64_ulong_t arg2, sys64_ulong_t arg3, sys64_ulong_t arg4, sys64_ulong_t arg5)
{
return SystemCall::Invoke(sys_prctl, context, option, arg2, arg3, arg4, arg5);
}
#endif
//---------------------------------------------------------------------------
#pragma warning(pop)
| 36.410959
| 149
| 0.665914
|
zukisoft
|
6ca9e53761b4fe41122100b9ba2913ab4e1bd6b0
| 19,619
|
cpp
|
C++
|
vban/node/bootstrap/bootstrap_lazy.cpp
|
EduardAl/vban-node
|
0a46c8025a20fea13c53a7d05ea5bb0e188e69fd
|
[
"BSD-3-Clause"
] | null | null | null |
vban/node/bootstrap/bootstrap_lazy.cpp
|
EduardAl/vban-node
|
0a46c8025a20fea13c53a7d05ea5bb0e188e69fd
|
[
"BSD-3-Clause"
] | null | null | null |
vban/node/bootstrap/bootstrap_lazy.cpp
|
EduardAl/vban-node
|
0a46c8025a20fea13c53a7d05ea5bb0e188e69fd
|
[
"BSD-3-Clause"
] | null | null | null |
#include <vban/node/bootstrap/bootstrap.hpp>
#include <vban/node/bootstrap/bootstrap_lazy.hpp>
#include <vban/node/common.hpp>
#include <vban/node/node.hpp>
#include <vban/node/transport/tcp.hpp>
#include <boost/format.hpp>
#include <algorithm>
constexpr std::chrono::seconds vban::bootstrap_limits::lazy_flush_delay_sec;
constexpr uint64_t vban::bootstrap_limits::lazy_batch_pull_count_resize_blocks_limit;
constexpr double vban::bootstrap_limits::lazy_batch_pull_count_resize_ratio;
constexpr size_t vban::bootstrap_limits::lazy_blocks_restart_limit;
vban::bootstrap_attempt_lazy::bootstrap_attempt_lazy (std::shared_ptr<vban::node> const & node_a, uint64_t incremental_id_a, std::string const & id_a) :
vban::bootstrap_attempt (node_a, vban::bootstrap_mode::lazy, incremental_id_a, id_a)
{
node->bootstrap_initiator.notify_listeners (true);
}
vban::bootstrap_attempt_lazy::~bootstrap_attempt_lazy ()
{
debug_assert (lazy_blocks.size () == lazy_blocks_count);
node->bootstrap_initiator.notify_listeners (false);
}
bool vban::bootstrap_attempt_lazy::lazy_start (vban::hash_or_account const & hash_or_account_a, bool confirmed)
{
vban::unique_lock<vban::mutex> lock (mutex);
bool inserted (false);
// Add start blocks, limit 1024 (4k with disabled legacy bootstrap)
size_t max_keys (node->flags.disable_legacy_bootstrap ? 4 * 1024 : 1024);
if (lazy_keys.size () < max_keys && lazy_keys.find (hash_or_account_a.as_block_hash ()) == lazy_keys.end () && !lazy_blocks_processed (hash_or_account_a.as_block_hash ()))
{
lazy_keys.insert (hash_or_account_a.as_block_hash ());
lazy_pulls.emplace_back (hash_or_account_a, confirmed ? lazy_retry_limit_confirmed () : node->network_params.bootstrap.lazy_retry_limit);
lock.unlock ();
condition.notify_all ();
inserted = true;
}
return inserted;
}
void vban::bootstrap_attempt_lazy::lazy_add (vban::hash_or_account const & hash_or_account_a, unsigned retry_limit)
{
// Add only unknown blocks
debug_assert (!mutex.try_lock ());
if (!lazy_blocks_processed (hash_or_account_a.as_block_hash ()))
{
lazy_pulls.emplace_back (hash_or_account_a, retry_limit);
}
}
void vban::bootstrap_attempt_lazy::lazy_add (vban::pull_info const & pull_a)
{
debug_assert (pull_a.account_or_head == pull_a.head);
vban::lock_guard<vban::mutex> lock (mutex);
lazy_add (pull_a.account_or_head, pull_a.retry_limit);
}
void vban::bootstrap_attempt_lazy::lazy_requeue (vban::block_hash const & hash_a, vban::block_hash const & previous_a, bool confirmed_a)
{
vban::unique_lock<vban::mutex> lock (mutex);
// Add only known blocks
if (lazy_blocks_processed (hash_a))
{
lazy_blocks_erase (hash_a);
lock.unlock ();
node->bootstrap_initiator.connections->requeue_pull (vban::pull_info (hash_a, hash_a, previous_a, incremental_id, static_cast<vban::pull_info::count_t> (1), confirmed_a ? lazy_retry_limit_confirmed () : node->network_params.bootstrap.lazy_destinations_retry_limit));
}
}
uint32_t vban::bootstrap_attempt_lazy::lazy_batch_size ()
{
auto result (node->network_params.bootstrap.lazy_max_pull_blocks);
if (total_blocks > vban::bootstrap_limits::lazy_batch_pull_count_resize_blocks_limit && lazy_blocks_count != 0)
{
auto lazy_blocks_ratio (static_cast<double> (total_blocks / lazy_blocks_count));
if (lazy_blocks_ratio > vban::bootstrap_limits::lazy_batch_pull_count_resize_ratio)
{
// Increasing blocks ratio weight as more important (^3). Small batch count should lower blocks ratio below target
double lazy_blocks_factor (std::pow (lazy_blocks_ratio / vban::bootstrap_limits::lazy_batch_pull_count_resize_ratio, 3.0));
// Decreasing total block count weight as less important (sqrt)
double total_blocks_factor (std::sqrt (total_blocks / vban::bootstrap_limits::lazy_batch_pull_count_resize_blocks_limit));
uint32_t batch_count_min (node->network_params.bootstrap.lazy_max_pull_blocks / static_cast<uint32_t> (lazy_blocks_factor * total_blocks_factor));
result = std::max (node->network_params.bootstrap.lazy_min_pull_blocks, batch_count_min);
}
}
return result;
}
void vban::bootstrap_attempt_lazy::lazy_pull_flush (vban::unique_lock<vban::mutex> & lock_a)
{
static size_t const max_pulls (static_cast<size_t> (vban::bootstrap_limits::bootstrap_connection_scale_target_blocks) * 3);
if (pulling < max_pulls)
{
debug_assert (node->network_params.bootstrap.lazy_max_pull_blocks <= std::numeric_limits<vban::pull_info::count_t>::max ());
vban::pull_info::count_t batch_count (lazy_batch_size ());
uint64_t read_count (0);
size_t count (0);
auto transaction (node->store.tx_begin_read ());
while (!lazy_pulls.empty () && count < max_pulls)
{
auto pull_start (lazy_pulls.front ());
lazy_pulls.pop_front ();
// Recheck if block was already processed
if (!lazy_blocks_processed (pull_start.first.as_block_hash ()) && !node->ledger.block_or_pruned_exists (transaction, pull_start.first.as_block_hash ()))
{
lock_a.unlock ();
node->bootstrap_initiator.connections->add_pull (vban::pull_info (pull_start.first, pull_start.first.as_block_hash (), vban::block_hash (0), incremental_id, batch_count, pull_start.second));
++pulling;
++count;
lock_a.lock ();
}
// We don't want to open read transactions for too long
++read_count;
if (read_count % batch_read_size == 0)
{
lock_a.unlock ();
transaction.refresh ();
lock_a.lock ();
}
}
}
}
bool vban::bootstrap_attempt_lazy::lazy_finished ()
{
debug_assert (!mutex.try_lock ());
if (stopped)
{
return true;
}
bool result (true);
uint64_t read_count (0);
auto transaction (node->store.tx_begin_read ());
for (auto it (lazy_keys.begin ()), end (lazy_keys.end ()); it != end && !stopped;)
{
if (node->ledger.block_or_pruned_exists (transaction, *it))
{
it = lazy_keys.erase (it);
}
else
{
result = false;
break;
// No need to increment `it` as we break above.
}
// We don't want to open read transactions for too long
++read_count;
if (read_count % batch_read_size == 0)
{
transaction.refresh ();
}
}
// Finish lazy bootstrap without lazy pulls (in combination with still_pulling ())
if (!result && lazy_pulls.empty () && lazy_state_backlog.empty ())
{
result = true;
}
return result;
}
bool vban::bootstrap_attempt_lazy::lazy_has_expired () const
{
bool result (false);
// Max 30 minutes run with enabled legacy bootstrap
static std::chrono::minutes const max_lazy_time (node->flags.disable_legacy_bootstrap ? 7 * 24 * 60 : 30);
if (std::chrono::steady_clock::now () - lazy_start_time >= max_lazy_time)
{
result = true;
}
else if (!node->flags.disable_legacy_bootstrap && lazy_blocks_count > vban::bootstrap_limits::lazy_blocks_restart_limit)
{
result = true;
}
return result;
}
void vban::bootstrap_attempt_lazy::run ()
{
debug_assert (started);
debug_assert (!node->flags.disable_lazy_bootstrap);
node->bootstrap_initiator.connections->populate_connections (false);
lazy_start_time = std::chrono::steady_clock::now ();
vban::unique_lock<vban::mutex> lock (mutex);
while ((still_pulling () || !lazy_finished ()) && !lazy_has_expired ())
{
unsigned iterations (0);
auto this_l (shared_from_this ());
while (still_pulling () && !lazy_has_expired ())
{
condition.wait (lock, [&stopped = stopped, &pulling = pulling, &lazy_pulls = lazy_pulls, this_l] { return stopped || pulling == 0 || (pulling < vban::bootstrap_limits::bootstrap_connection_scale_target_blocks && !lazy_pulls.empty ()) || this_l->lazy_has_expired (); });
++iterations;
// Flushing lazy pulls
lazy_pull_flush (lock);
// Start backlog cleanup
if (iterations % 100 == 0)
{
lazy_backlog_cleanup ();
}
}
// Flushing lazy pulls
lazy_pull_flush (lock);
// Check if some blocks required for backlog were processed. Start destinations check
if (pulling == 0)
{
lazy_backlog_cleanup ();
lazy_pull_flush (lock);
}
}
if (!stopped)
{
node->logger.try_log ("Completed lazy pulls");
}
if (lazy_has_expired ())
{
node->logger.try_log (boost::str (boost::format ("Lazy bootstrap attempt ID %1% expired") % id));
}
lock.unlock ();
stop ();
condition.notify_all ();
}
bool vban::bootstrap_attempt_lazy::process_block (std::shared_ptr<vban::block> const & block_a, vban::account const & known_account_a, uint64_t pull_blocks_processed, vban::bulk_pull::count_t max_blocks, bool block_expected, unsigned retry_limit)
{
bool stop_pull (false);
if (block_expected)
{
stop_pull = process_block_lazy (block_a, known_account_a, pull_blocks_processed, max_blocks, retry_limit);
}
else
{
// Drop connection with unexpected block for lazy bootstrap
stop_pull = true;
}
return stop_pull;
}
bool vban::bootstrap_attempt_lazy::process_block_lazy (std::shared_ptr<vban::block> const & block_a, vban::account const & known_account_a, uint64_t pull_blocks_processed, vban::bulk_pull::count_t max_blocks, unsigned retry_limit)
{
bool stop_pull (false);
auto hash (block_a->hash ());
vban::unique_lock<vban::mutex> lock (mutex);
// Processing new blocks
if (!lazy_blocks_processed (hash))
{
// Search for new dependencies
if (!block_a->source ().is_zero () && !node->ledger.block_or_pruned_exists (block_a->source ()) && block_a->source () != node->network_params.ledger.genesis_account)
{
lazy_add (block_a->source (), retry_limit);
}
else if (block_a->type () == vban::block_type::state)
{
lazy_block_state (block_a, retry_limit);
}
lazy_blocks_insert (hash);
// Adding lazy balances for first processed block in pull
if (pull_blocks_processed == 1 && (block_a->type () == vban::block_type::state || block_a->type () == vban::block_type::send))
{
lazy_balances.emplace (hash, block_a->balance ().number ());
}
// Clearing lazy balances for previous block
if (!block_a->previous ().is_zero () && lazy_balances.find (block_a->previous ()) != lazy_balances.end ())
{
lazy_balances.erase (block_a->previous ());
}
lazy_block_state_backlog_check (block_a, hash);
lock.unlock ();
vban::unchecked_info info (block_a, known_account_a, 0, vban::signature_verification::unknown, retry_limit > node->network_params.bootstrap.lazy_retry_limit);
node->block_processor.add (info);
}
// Force drop lazy bootstrap connection for long bulk_pull
if (pull_blocks_processed > max_blocks)
{
stop_pull = true;
}
return stop_pull;
}
void vban::bootstrap_attempt_lazy::lazy_block_state (std::shared_ptr<vban::block> const & block_a, unsigned retry_limit)
{
std::shared_ptr<vban::state_block> block_l (std::static_pointer_cast<vban::state_block> (block_a));
if (block_l != nullptr)
{
auto transaction (node->store.tx_begin_read ());
vban::uint256_t balance (block_l->hashables.balance.number ());
auto const & link (block_l->hashables.link);
// If link is not epoch link or 0. And if block from link is unknown
if (!link.is_zero () && !node->ledger.is_epoch_link (link) && !lazy_blocks_processed (link.as_block_hash ()) && !node->ledger.block_or_pruned_exists (transaction, link.as_block_hash ()))
{
auto const & previous (block_l->hashables.previous);
// If state block previous is 0 then source block required
if (previous.is_zero ())
{
lazy_add (link, retry_limit);
}
// In other cases previous block balance required to find out subtype of state block
else if (node->ledger.block_or_pruned_exists (transaction, previous))
{
bool error_or_pruned (false);
auto previous_balance (node->ledger.balance_safe (transaction, previous, error_or_pruned));
if (!error_or_pruned)
{
if (previous_balance <= balance)
{
lazy_add (link, retry_limit);
}
}
// Else ignore pruned blocks
}
// Search balance of already processed previous blocks
else if (lazy_blocks_processed (previous))
{
auto previous_balance (lazy_balances.find (previous));
if (previous_balance != lazy_balances.end ())
{
if (previous_balance->second <= balance)
{
lazy_add (link, retry_limit);
}
lazy_balances.erase (previous_balance);
}
}
// Insert in backlog state blocks if previous wasn't already processed
else
{
lazy_state_backlog.emplace (previous, vban::lazy_state_backlog_item{ link, balance, retry_limit });
}
}
}
}
void vban::bootstrap_attempt_lazy::lazy_block_state_backlog_check (std::shared_ptr<vban::block> const & block_a, vban::block_hash const & hash_a)
{
// Search unknown state blocks balances
auto find_state (lazy_state_backlog.find (hash_a));
if (find_state != lazy_state_backlog.end ())
{
auto next_block (find_state->second);
// Retrieve balance for previous state & send blocks
if (block_a->type () == vban::block_type::state || block_a->type () == vban::block_type::send)
{
if (block_a->balance ().number () <= next_block.balance) // balance
{
lazy_add (next_block.link, next_block.retry_limit); // link
}
}
// Assumption for other legacy block types
else if (lazy_undefined_links.find (next_block.link.as_block_hash ()) == lazy_undefined_links.end ())
{
lazy_add (next_block.link, node->network_params.bootstrap.lazy_retry_limit); // Head is not confirmed. It can be account or hash or non-existing
lazy_undefined_links.insert (next_block.link.as_block_hash ());
}
lazy_state_backlog.erase (find_state);
}
}
void vban::bootstrap_attempt_lazy::lazy_backlog_cleanup ()
{
uint64_t read_count (0);
auto transaction (node->store.tx_begin_read ());
for (auto it (lazy_state_backlog.begin ()), end (lazy_state_backlog.end ()); it != end && !stopped;)
{
if (node->ledger.block_or_pruned_exists (transaction, it->first))
{
auto next_block (it->second);
bool error_or_pruned (false);
auto balance (node->ledger.balance_safe (transaction, it->first, error_or_pruned));
if (!error_or_pruned)
{
if (balance <= next_block.balance) // balance
{
lazy_add (next_block.link, next_block.retry_limit); // link
}
}
else
{
lazy_add (next_block.link, node->network_params.bootstrap.lazy_retry_limit); // Not confirmed
}
it = lazy_state_backlog.erase (it);
}
else
{
lazy_add (it->first, it->second.retry_limit);
++it;
}
// We don't want to open read transactions for too long
++read_count;
if (read_count % batch_read_size == 0)
{
transaction.refresh ();
}
}
}
void vban::bootstrap_attempt_lazy::lazy_blocks_insert (vban::block_hash const & hash_a)
{
debug_assert (!mutex.try_lock ());
auto inserted (lazy_blocks.insert (std::hash<::vban::block_hash> () (hash_a)));
if (inserted.second)
{
++lazy_blocks_count;
debug_assert (lazy_blocks_count > 0);
}
}
void vban::bootstrap_attempt_lazy::lazy_blocks_erase (vban::block_hash const & hash_a)
{
debug_assert (!mutex.try_lock ());
auto erased (lazy_blocks.erase (std::hash<::vban::block_hash> () (hash_a)));
if (erased)
{
--lazy_blocks_count;
debug_assert (lazy_blocks_count != std::numeric_limits<size_t>::max ());
}
}
bool vban::bootstrap_attempt_lazy::lazy_blocks_processed (vban::block_hash const & hash_a)
{
return lazy_blocks.find (std::hash<::vban::block_hash> () (hash_a)) != lazy_blocks.end ();
}
bool vban::bootstrap_attempt_lazy::lazy_processed_or_exists (vban::block_hash const & hash_a)
{
bool result (false);
vban::unique_lock<vban::mutex> lock (mutex);
if (lazy_blocks_processed (hash_a))
{
result = true;
}
else
{
lock.unlock ();
if (node->ledger.block_or_pruned_exists (hash_a))
{
result = true;
}
}
return result;
}
unsigned vban::bootstrap_attempt_lazy::lazy_retry_limit_confirmed ()
{
debug_assert (!mutex.try_lock ());
if (total_blocks % 1024 == 512 || peer_count == 0)
{
// Prevent too frequent network locks
peer_count = node->network.size ();
}
auto multiplier (node->flags.disable_legacy_bootstrap ? 2 : 1.25);
return multiplier * std::max (node->network_params.bootstrap.lazy_retry_limit, 2 * vban::narrow_cast<unsigned> (peer_count));
}
void vban::bootstrap_attempt_lazy::get_information (boost::property_tree::ptree & tree_a)
{
vban::lock_guard<vban::mutex> lock (mutex);
tree_a.put ("lazy_blocks", std::to_string (lazy_blocks.size ()));
tree_a.put ("lazy_state_backlog", std::to_string (lazy_state_backlog.size ()));
tree_a.put ("lazy_balances", std::to_string (lazy_balances.size ()));
tree_a.put ("lazy_undefined_links", std::to_string (lazy_undefined_links.size ()));
tree_a.put ("lazy_pulls", std::to_string (lazy_pulls.size ()));
tree_a.put ("lazy_keys", std::to_string (lazy_keys.size ()));
if (!lazy_keys.empty ())
{
tree_a.put ("lazy_key_1", (*(lazy_keys.begin ())).to_string ());
}
}
vban::bootstrap_attempt_wallet::bootstrap_attempt_wallet (std::shared_ptr<vban::node> const & node_a, uint64_t incremental_id_a, std::string id_a) :
vban::bootstrap_attempt (node_a, vban::bootstrap_mode::wallet_lazy, incremental_id_a, id_a)
{
node->bootstrap_initiator.notify_listeners (true);
}
vban::bootstrap_attempt_wallet::~bootstrap_attempt_wallet ()
{
node->bootstrap_initiator.notify_listeners (false);
}
void vban::bootstrap_attempt_wallet::request_pending (vban::unique_lock<vban::mutex> & lock_a)
{
lock_a.unlock ();
auto connection_l (node->bootstrap_initiator.connections->connection (shared_from_this ()));
lock_a.lock ();
if (connection_l && !stopped)
{
auto account (wallet_accounts.front ());
wallet_accounts.pop_front ();
++pulling;
auto this_l (shared_from_this ());
// The bulk_pull_account_client destructor attempt to requeue_pull which can cause a deadlock if this is the last reference
// Dispatch request in an external thread in case it needs to be destroyed
node->background ([connection_l, this_l, account] () {
auto client (std::make_shared<vban::bulk_pull_account_client> (connection_l, this_l, account));
client->request ();
});
}
}
void vban::bootstrap_attempt_wallet::requeue_pending (vban::account const & account_a)
{
auto account (account_a);
{
vban::lock_guard<vban::mutex> lock (mutex);
wallet_accounts.push_front (account);
}
condition.notify_all ();
}
void vban::bootstrap_attempt_wallet::wallet_start (std::deque<vban::account> & accounts_a)
{
{
vban::lock_guard<vban::mutex> lock (mutex);
wallet_accounts.swap (accounts_a);
}
condition.notify_all ();
}
bool vban::bootstrap_attempt_wallet::wallet_finished ()
{
debug_assert (!mutex.try_lock ());
auto running (!stopped);
auto more_accounts (!wallet_accounts.empty ());
auto still_pulling (pulling > 0);
return running && (more_accounts || still_pulling);
}
void vban::bootstrap_attempt_wallet::run ()
{
debug_assert (started);
debug_assert (!node->flags.disable_wallet_bootstrap);
node->bootstrap_initiator.connections->populate_connections (false);
auto start_time (std::chrono::steady_clock::now ());
auto max_time (std::chrono::minutes (10));
vban::unique_lock<vban::mutex> lock (mutex);
while (wallet_finished () && std::chrono::steady_clock::now () - start_time < max_time)
{
if (!wallet_accounts.empty ())
{
request_pending (lock);
}
else
{
condition.wait_for (lock, std::chrono::seconds (1));
}
}
if (!stopped)
{
node->logger.try_log ("Completed wallet lazy pulls");
}
lock.unlock ();
stop ();
condition.notify_all ();
}
size_t vban::bootstrap_attempt_wallet::wallet_size ()
{
vban::lock_guard<vban::mutex> lock (mutex);
return wallet_accounts.size ();
}
void vban::bootstrap_attempt_wallet::get_information (boost::property_tree::ptree & tree_a)
{
vban::lock_guard<vban::mutex> lock (mutex);
tree_a.put ("wallet_accounts", std::to_string (wallet_accounts.size ()));
}
| 34.479789
| 272
| 0.726694
|
EduardAl
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.