Compare commits
794 Commits
release/20
...
release/20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ecf6db2e0 | ||
|
|
0a3557a727 | ||
|
|
bf823a4fd4 | ||
|
|
74b4287b6e | ||
|
|
b99dc9b5ec | ||
|
|
fbfeba9b2e | ||
|
|
3448c9c4ec | ||
|
|
4bb23ecf5a | ||
|
|
2ba39f875c | ||
|
|
705930a5ca | ||
|
|
465a3447c7 | ||
|
|
a1080f8361 | ||
|
|
6e82f3cb7a | ||
|
|
7f8578ea96 | ||
|
|
21d44c09e0 | ||
|
|
e3959c5fa1 | ||
|
|
2d036144cc | ||
|
|
2ebc15e8d4 | ||
|
|
dd34f2d831 | ||
|
|
e1698f7be8 | ||
|
|
47c4f5c2e0 | ||
|
|
d0416d963d | ||
|
|
53fe0f2d11 | ||
|
|
ead5a19209 | ||
|
|
94c697ccd0 | ||
|
|
60c406397b | ||
|
|
6f20858d73 | ||
|
|
5852270035 | ||
|
|
810a93ba87 | ||
|
|
b0b8523b2a | ||
|
|
6708273616 | ||
|
|
206243c78d | ||
|
|
8f90bf9387 | ||
|
|
db052055b2 | ||
|
|
32ac90cb5e | ||
|
|
36e03cf6b9 | ||
|
|
fa65ce92d8 | ||
|
|
79ad189d65 | ||
|
|
d3a44ca543 | ||
|
|
b273ef389a | ||
|
|
c6068f4e17 | ||
|
|
a8b510334e | ||
|
|
70ef0858f7 | ||
|
|
f384269133 | ||
|
|
a077847f69 | ||
|
|
fa7d8bc28c | ||
|
|
de5e3d90cd | ||
|
|
36e3a25782 | ||
|
|
cc22c3bcf3 | ||
|
|
732f19d2a2 | ||
|
|
7b19d9a20a | ||
|
|
bb7941b754 | ||
|
|
0dcb31cae5 | ||
|
|
fa24394f69 | ||
|
|
cc4f8faa4c | ||
|
|
a5a18fea9e | ||
|
|
e2da49d028 | ||
|
|
f02ecb472f | ||
|
|
956dce6be6 | ||
|
|
00d5421153 | ||
|
|
a33fd2483f | ||
|
|
23faea7b81 | ||
|
|
efbfbaa90c | ||
|
|
de5e91c80c | ||
|
|
a56eb48b85 | ||
|
|
20e253a27a | ||
|
|
7823045b02 | ||
|
|
1ec834dd71 | ||
|
|
90d980a4f6 | ||
|
|
b1abbe831a | ||
|
|
62c067f462 | ||
|
|
d65b83c28b | ||
|
|
4956e880a4 | ||
|
|
e92d6138f8 | ||
|
|
33d09936c3 | ||
|
|
5c33c39495 | ||
|
|
be898b5534 | ||
|
|
f9a52791a4 | ||
|
|
96fdb150b1 | ||
|
|
001b399d42 | ||
|
|
acfd917aab | ||
|
|
08f41d4fa2 | ||
|
|
91e863e674 | ||
|
|
7aba0cd976 | ||
|
|
fcdc57d92b | ||
|
|
bd3242fe05 | ||
|
|
f610ce28a2 | ||
|
|
c43600337b | ||
|
|
b9b55bb9b0 | ||
|
|
ce463e6020 | ||
|
|
296538c724 | ||
|
|
d0c5fa042c | ||
|
|
7a8347f1ab | ||
|
|
aa639869be | ||
|
|
690fa8259c | ||
|
|
fca1764d7a | ||
|
|
0f21752a7e | ||
|
|
3af6fac35d | ||
|
|
65f45b60a8 | ||
|
|
0f8dec9ac3 | ||
|
|
31e5c494a8 | ||
|
|
995316e97c | ||
|
|
47715ae7ae | ||
|
|
f8d988d1dd | ||
|
|
aa54bc67de | ||
|
|
5b3a76172b | ||
|
|
c2522fd5ce | ||
|
|
007ef0e94f | ||
|
|
528548ebce | ||
|
|
00cb2c195d | ||
|
|
2dee1070ef | ||
|
|
e86e8796ec | ||
|
|
2c0456da8a | ||
|
|
b9b6033854 | ||
|
|
26bc6cb2ea | ||
|
|
574547a824 | ||
|
|
99b2920e5e | ||
|
|
447efffdfa | ||
|
|
8210bcde34 | ||
|
|
6093a80dff | ||
|
|
fd773423b0 | ||
|
|
1529509efb | ||
|
|
1206570da5 | ||
|
|
4c016660d8 | ||
|
|
b3050cfbf5 | ||
|
|
0ab50fbc95 | ||
|
|
2f96b9404f | ||
|
|
c0336d5eb7 | ||
|
|
963ab6515a | ||
|
|
54088db22f | ||
|
|
3d0ff98865 | ||
|
|
5fe9b6476e | ||
|
|
ad993fb82c | ||
|
|
27687ecc9e | ||
|
|
2d2d25fbec | ||
|
|
ac39fa099b | ||
|
|
96ce078dfd | ||
|
|
fbf88e8ce1 | ||
|
|
6dc84b67df | ||
|
|
0475ccdb77 | ||
|
|
5f45f20be6 | ||
|
|
d99aa0d497 | ||
|
|
8c351440e8 | ||
|
|
26f91f0ce0 | ||
|
|
f2d80014ab | ||
|
|
27dc014244 | ||
|
|
42f1278db3 | ||
|
|
1ae7026a4b | ||
|
|
7db5d2fd5c | ||
|
|
8e247ca6e8 | ||
|
|
2a812ab7ce | ||
|
|
a44b174b6b | ||
|
|
a86cfd21d8 | ||
|
|
0512ab88b4 | ||
|
|
ce4f2a157b | ||
|
|
56ab32035a | ||
|
|
7a4c5cd1c1 | ||
|
|
124097abdc | ||
|
|
ae6ea4699e | ||
|
|
10a9a5707c | ||
|
|
6d2f8cca5c | ||
|
|
e01400fa18 | ||
|
|
94b4c509b1 | ||
|
|
e8423d3b25 | ||
|
|
751e25ff97 | ||
|
|
a8e3ecef7d | ||
|
|
d55d05e552 | ||
|
|
8848fde48e | ||
|
|
fc7ccd1603 | ||
|
|
de61bdefff | ||
|
|
8e8ba14397 | ||
|
|
f331add35b | ||
|
|
5fbf725ea8 | ||
|
|
f5a3ab2cee | ||
|
|
76a04c8e48 | ||
|
|
b7418b419e | ||
|
|
74c3bf82fb | ||
|
|
8d89d277cd | ||
|
|
4b8b35e0f0 | ||
|
|
f76a71cbee | ||
|
|
e23e229fda | ||
|
|
4e3f5cd0ca | ||
|
|
5032d28a0f | ||
|
|
af1043612a | ||
|
|
72efad2a8f | ||
|
|
dd4de4130a | ||
|
|
4a721cffbb | ||
|
|
805300dd49 | ||
|
|
9a66acbb5d | ||
|
|
742c90cabc | ||
|
|
7cb15bd64d | ||
|
|
2900da4489 | ||
|
|
05c3d997ac | ||
|
|
3036441c8c | ||
|
|
a4038b3d9e | ||
|
|
5b6e9f7c92 | ||
|
|
1168e616cd | ||
|
|
c1ea966548 | ||
|
|
8c2ed38cf4 | ||
|
|
8e55f3138b | ||
|
|
d57d9ea18f | ||
|
|
6de1067c45 | ||
|
|
b95fbc4919 | ||
|
|
42c711210e | ||
|
|
6ee4e5ce9a | ||
|
|
66a9138006 | ||
|
|
ac4157a66c | ||
|
|
83cfe4b50c | ||
|
|
6a8f3e16c0 | ||
|
|
2e8e613722 | ||
|
|
e8595a6076 | ||
|
|
24296bf7ee | ||
|
|
e0344b828d | ||
|
|
29bfdd00bf | ||
|
|
cd93de5e12 | ||
|
|
ad03a50536 | ||
|
|
c19221eab8 | ||
|
|
fab78873f2 | ||
|
|
461d8815a0 | ||
|
|
1de3a84a53 | ||
|
|
56e8750d9e | ||
|
|
51a8d35788 | ||
|
|
d5cd8cf78e | ||
|
|
6d6b10a9fa | ||
|
|
c17824cead | ||
|
|
0d962fc585 | ||
|
|
fbe723a874 | ||
|
|
ab68722eca | ||
|
|
629b561f75 | ||
|
|
86eb1bf94e | ||
|
|
5c49832cd1 | ||
|
|
003537ea77 | ||
|
|
dfdb844d69 | ||
|
|
617440485f | ||
|
|
99a6fc30a1 | ||
|
|
50de318947 | ||
|
|
b6f192b7f2 | ||
|
|
2985072083 | ||
|
|
3db68b0731 | ||
|
|
1b488037e1 | ||
|
|
b9f95089b9 | ||
|
|
c7d8d17bf0 | ||
|
|
1dd1b71095 | ||
|
|
db07a19c68 | ||
|
|
1311afb261 | ||
|
|
b5b1588a17 | ||
|
|
4114302055 | ||
|
|
2e20dc5d43 | ||
|
|
7d226bf600 | ||
|
|
70d13b7427 | ||
|
|
341d14519b | ||
|
|
ef412cd759 | ||
|
|
dc97e71350 | ||
|
|
2efa272f6e | ||
|
|
e8803220ca | ||
|
|
772cc7b265 | ||
|
|
9a2410ddb2 | ||
|
|
6eb9eb8414 | ||
|
|
9887cc01af | ||
|
|
aefa3cd9d2 | ||
|
|
59b59ce3ee | ||
|
|
7875aedd7f | ||
|
|
e57c98d475 | ||
|
|
d60a91c3dd | ||
|
|
b184b0e9e5 | ||
|
|
f3e209b740 | ||
|
|
0bbcee1cc8 | ||
|
|
d300e54700 | ||
|
|
719af02142 | ||
|
|
f604f94e89 | ||
|
|
2d3432a9e0 | ||
|
|
d46628e8a1 | ||
|
|
4aab3ca7d0 | ||
|
|
11d5128cbf | ||
|
|
fe2f5ee185 | ||
|
|
0530b9b1a3 | ||
|
|
57dde8051d | ||
|
|
7a7920f3e7 | ||
|
|
396bfbbcd2 | ||
|
|
ee4ac770af | ||
|
|
045f527c5d | ||
|
|
79ae4c7935 | ||
|
|
dbfd013cf4 | ||
|
|
6ea0e73512 | ||
|
|
9343165bee | ||
|
|
ac40c65f64 | ||
|
|
b8c4a2ed83 | ||
|
|
b09db0325d | ||
|
|
4e5aed45d7 | ||
|
|
3004e14e9a | ||
|
|
f9d43e738a | ||
|
|
86d166756a | ||
|
|
f51533907f | ||
|
|
50e4f9439b | ||
|
|
951bd69522 | ||
|
|
98f0b36b21 | ||
|
|
629da97d61 | ||
|
|
d3d91c2a08 | ||
|
|
e6893caa89 | ||
|
|
7bdf49f15e | ||
|
|
5ea65651ac | ||
|
|
403fd09e69 | ||
|
|
9e7c808524 | ||
|
|
bafdbc35cc | ||
|
|
6a81e4bb63 | ||
|
|
d83790164d | ||
|
|
3a6cd37db1 | ||
|
|
e9be39d666 | ||
|
|
967f63479d | ||
|
|
1bb4c937a2 | ||
|
|
16b946b199 | ||
|
|
519e65d32c | ||
|
|
8499c9d1cd | ||
|
|
4bd9b7212f | ||
|
|
ecee4a7d36 | ||
|
|
0935aae02c | ||
|
|
df1f03e4a8 | ||
|
|
07780a793f | ||
|
|
7a2350bc3c | ||
|
|
fb93e08ef0 | ||
|
|
60f6c26456 | ||
|
|
9765ba9d3f | ||
|
|
672eb6e689 | ||
|
|
c334245d08 | ||
|
|
0d85293fcc | ||
|
|
b61f87ddaa | ||
|
|
08df29c991 | ||
|
|
d283f1858f | ||
|
|
bef5a4c27b | ||
|
|
a023d4b437 | ||
|
|
e03a97b539 | ||
|
|
891fda8e79 | ||
|
|
ae8dc1a770 | ||
|
|
37fcfe4379 | ||
|
|
ca2dfc6136 | ||
|
|
867fed3288 | ||
|
|
245a3aa09e | ||
|
|
8a87914740 | ||
|
|
7649df53a2 | ||
|
|
3080b9c7f6 | ||
|
|
a4d07b5c57 | ||
|
|
03f9a73f43 | ||
|
|
98ec42f472 | ||
|
|
764149182d | ||
|
|
518c219838 | ||
|
|
80b98934c3 | ||
|
|
2c2f848c54 | ||
|
|
5557debd9c | ||
|
|
791726398e | ||
|
|
db64c858d1 | ||
|
|
02031a00e6 | ||
|
|
32a47bf79a | ||
|
|
20a6a522dc | ||
|
|
c3f94834c3 | ||
|
|
dad067835c | ||
|
|
d5a21427b4 | ||
|
|
3587c0c6b7 | ||
|
|
5976efa953 | ||
|
|
53ce21cf9e | ||
|
|
d4ae7e706d | ||
|
|
03d387c12d | ||
|
|
5a060910a3 | ||
|
|
49460edf39 | ||
|
|
fc1e245ea4 | ||
|
|
5553b36c7d | ||
|
|
a4d8379687 | ||
|
|
943e3a656d | ||
|
|
8c2d74f348 | ||
|
|
eb5787fd54 | ||
|
|
2f3ba50ca6 | ||
|
|
660d5ae3a7 | ||
|
|
c82be02ef8 | ||
|
|
fa70d457f3 | ||
|
|
4a9ec1403e | ||
|
|
aeb55ec72e | ||
|
|
8d11a04033 | ||
|
|
859182f7f0 | ||
|
|
b22304b7ba | ||
|
|
05dde86f55 | ||
|
|
7969dfd721 | ||
|
|
42fcb4507f | ||
|
|
0a9babfa9a | ||
|
|
109a87e4ee | ||
|
|
1bb96ffed2 | ||
|
|
c7308381d0 | ||
|
|
4d29b2921a | ||
|
|
1989eac79d | ||
|
|
a765cd26ea | ||
|
|
1b7fab4bd1 | ||
|
|
ae049a927f | ||
|
|
a5bb313394 | ||
|
|
da1c2d3c8b | ||
|
|
c54a57d593 | ||
|
|
1cdebaef30 | ||
|
|
873ad61e23 | ||
|
|
f8f5987aff | ||
|
|
40c2c00d58 | ||
|
|
ae91ede665 | ||
|
|
084aa69641 | ||
|
|
746bb15681 | ||
|
|
11e70ca779 | ||
|
|
a74855f74b | ||
|
|
e99e2c5e82 | ||
|
|
015d8ff923 | ||
|
|
efedbffe63 | ||
|
|
39db643dd3 | ||
|
|
44f29eb4f7 | ||
|
|
acad356e2d | ||
|
|
076bc3107b | ||
|
|
8b23b572cd | ||
|
|
3b0e795e0b | ||
|
|
4b3304730c | ||
|
|
432f666768 | ||
|
|
53f78a02fe | ||
|
|
71ba9ae6fd | ||
|
|
24b66d8bb4 | ||
|
|
bb8c1f192f | ||
|
|
1927e305ed | ||
|
|
0161f50255 | ||
|
|
8b2363b940 | ||
|
|
7894a21749 | ||
|
|
8b718ef0e1 | ||
|
|
168aa5602d | ||
|
|
718e00ca1f | ||
|
|
1cf069c837 | ||
|
|
76e8805d92 | ||
|
|
dee69e78c3 | ||
|
|
e00516842c | ||
|
|
b9ca9c3d47 | ||
|
|
98c9ce7abd | ||
|
|
9ccc9a72e4 | ||
|
|
6c2563c5a5 | ||
|
|
f608487772 | ||
|
|
af362fa4cf | ||
|
|
a92c8ca6e0 | ||
|
|
501db1003d | ||
|
|
b624facaf2 | ||
|
|
156c934993 | ||
|
|
c525546489 | ||
|
|
106c0881ee | ||
|
|
effe70876f | ||
|
|
8e1f8099b2 | ||
|
|
b1b04d3dec | ||
|
|
ab047eca6a | ||
|
|
c84b95ed85 | ||
|
|
d358d94f58 | ||
|
|
f8c53e0f9b | ||
|
|
748c3975fb | ||
|
|
66ddbd7842 | ||
|
|
1b851f03cb | ||
|
|
c438c58af3 | ||
|
|
7c30586fde | ||
|
|
d5388ba653 | ||
|
|
a0e20e8d3e | ||
|
|
747fd8f897 | ||
|
|
3b352a5d3b | ||
|
|
3e1411bf87 | ||
|
|
ffe86d361b | ||
|
|
f55d0fa57c | ||
|
|
bdd74b33b2 | ||
|
|
52d69dfd0d | ||
|
|
349e964586 | ||
|
|
32fa286f8e | ||
|
|
52801f1e57 | ||
|
|
4f7d41ee10 | ||
|
|
dc3dd89e09 | ||
|
|
f500adba24 | ||
|
|
f4f993586a | ||
|
|
17c61e1853 | ||
|
|
3eab28f9b0 | ||
|
|
d096a5fda6 | ||
|
|
643ff6e777 | ||
|
|
1c92fb3fea | ||
|
|
305b2a166a | ||
|
|
1019187a4e | ||
|
|
0321c003eb | ||
|
|
4e223eae4a | ||
|
|
012c1a2b40 | ||
|
|
68b4f38464 | ||
|
|
c7b93797b6 | ||
|
|
34bc004171 | ||
|
|
adf90e3410 | ||
|
|
d6a3cdb986 | ||
|
|
ab821b90a5 | ||
|
|
29a946eb9a | ||
|
|
f7b080b7b6 | ||
|
|
0ad97351c6 | ||
|
|
c24d7f7798 | ||
|
|
42e55ec342 | ||
|
|
9fd29db2de | ||
|
|
f09b534e1d | ||
|
|
fc4511d365 | ||
|
|
89cbb9ae24 | ||
|
|
962b6f8150 | ||
|
|
c663805694 | ||
|
|
d30b63508d | ||
|
|
8ad0c99c1d | ||
|
|
7fce7a2c9c | ||
|
|
0c35431a2f | ||
|
|
64ae1a8dea | ||
|
|
3e828e8578 | ||
|
|
eb48fb709a | ||
|
|
8c14eac213 | ||
|
|
a067352ce0 | ||
|
|
1704a35a92 | ||
|
|
3acc26558b | ||
|
|
a624d6c690 | ||
|
|
27fdb0654d | ||
|
|
efc2e7aa92 | ||
|
|
e65880aafb | ||
|
|
13f07fdfef | ||
|
|
2876751fe2 | ||
|
|
1a0b3b418c | ||
|
|
c07aec9c68 | ||
|
|
cbe9bf2470 | ||
|
|
f6d160db32 | ||
|
|
feaadb4f6f | ||
|
|
633bbb6007 | ||
|
|
c06708ebd0 | ||
|
|
ae5c6fe53e | ||
|
|
9ed3f223ea | ||
|
|
ad023d224b | ||
|
|
27e6e0735f | ||
|
|
e719812e9b | ||
|
|
8e9e0b0977 | ||
|
|
474d4a90dc | ||
|
|
3cda13c7a2 | ||
|
|
29bb9f05be | ||
|
|
784abc7069 | ||
|
|
ae28999d5b | ||
|
|
4bc00663ea | ||
|
|
970d6339dd | ||
|
|
d7bdb448f5 | ||
|
|
841124a47d | ||
|
|
146e5930e2 | ||
|
|
216a220ee8 | ||
|
|
29010dd7e3 | ||
|
|
dd1591f1a2 | ||
|
|
f54245f1ca | ||
|
|
7d856b4933 | ||
|
|
16505b421a | ||
|
|
5515422d02 | ||
|
|
2123884655 | ||
|
|
6ab09afb0c | ||
|
|
35100cc8bb | ||
|
|
8d3680c7b5 | ||
|
|
986f0acad7 | ||
|
|
0edc9acc48 | ||
|
|
643b8b179d | ||
|
|
3478263de9 | ||
|
|
cbd23e71ef | ||
|
|
9ed75f030b | ||
|
|
e3bb9a3151 | ||
|
|
85f8c7b37d | ||
|
|
6db3ccf36f | ||
|
|
f67bce1dd8 | ||
|
|
8c6cd2f10f | ||
|
|
0679d2b233 | ||
|
|
7d3df69416 | ||
|
|
1751120b79 | ||
|
|
c846716044 | ||
|
|
fea794ee17 | ||
|
|
862b7b7591 | ||
|
|
ec976db684 | ||
|
|
985cb279ff | ||
|
|
88414fd1fc | ||
|
|
1dc3a67cf1 | ||
|
|
84aa2f77f3 | ||
|
|
0841e4f398 | ||
|
|
10b2b2ac48 | ||
|
|
082820380d | ||
|
|
213c6fb6ad | ||
|
|
90d1d992e5 | ||
|
|
172c0b1aa6 | ||
|
|
669918547a | ||
|
|
b07bd377cd | ||
|
|
e08a3666e3 | ||
|
|
be57558804 | ||
|
|
a4a04ebf51 | ||
|
|
4fcd85526a | ||
|
|
224911bd10 | ||
|
|
73a244ceda | ||
|
|
4c100d0bd5 | ||
|
|
0f032d6fca | ||
|
|
6090470045 | ||
|
|
0c6d1c31d7 | ||
|
|
9396d44379 | ||
|
|
dae980ddd5 | ||
|
|
f61882ce69 | ||
|
|
abec96a387 | ||
|
|
bcdc8bb119 | ||
|
|
83429bf908 | ||
|
|
83af852efe | ||
|
|
f0f3764b89 | ||
|
|
d3b4f41acf | ||
|
|
a2d52dcc0b | ||
|
|
2f6d4a8f84 | ||
|
|
80f6a5d1ed | ||
|
|
6a742a20fd | ||
|
|
8320b89d90 | ||
|
|
405e3e1add | ||
|
|
afd5c3153a | ||
|
|
b1250c2f7a | ||
|
|
64cbbdde65 | ||
|
|
b73f4aa5dc | ||
|
|
9faa824258 | ||
|
|
630a4a85ec | ||
|
|
adcb9c54b8 | ||
|
|
e129f74304 | ||
|
|
947d3fec99 | ||
|
|
27e310d436 | ||
|
|
229a619a85 | ||
|
|
1d3843cef1 | ||
|
|
7a88808ccb | ||
|
|
31b6baa676 | ||
|
|
0daac0b9e3 | ||
|
|
5b51c57a5e | ||
|
|
bf3f8e1b08 | ||
|
|
23dd41ba38 | ||
|
|
6b468787c8 | ||
|
|
5b0045d4a5 | ||
|
|
6e60ebfc74 | ||
|
|
c620d392d2 | ||
|
|
628afd7abe | ||
|
|
1b2fc9a7fa | ||
|
|
dcec08767d | ||
|
|
7b33ab4519 | ||
|
|
f7d2631a57 | ||
|
|
c6d49a4b44 | ||
|
|
475dde4bb1 | ||
|
|
998b555662 | ||
|
|
80bd81c892 | ||
|
|
f7b2bb4a07 | ||
|
|
937747323d | ||
|
|
1a1bb29a13 | ||
|
|
ccf3f150f2 | ||
|
|
4fbfe3b8ec | ||
|
|
f783282f49 | ||
|
|
4e7ac10320 | ||
|
|
7db2cc0c2e | ||
|
|
2c04ada035 | ||
|
|
e3d39a8b64 | ||
|
|
0352258f22 | ||
|
|
7df0577a58 | ||
|
|
49e2099436 | ||
|
|
9452796c57 | ||
|
|
c71ffd1415 | ||
|
|
88f8313568 | ||
|
|
7194463033 | ||
|
|
283da4d2b6 | ||
|
|
54f08156ad | ||
|
|
0d9eda9b76 | ||
|
|
317d1ba14e | ||
|
|
598f0e9056 | ||
|
|
6f45df5e93 | ||
|
|
0aa5fd9f09 | ||
|
|
5560f43a8c | ||
|
|
66acfb5249 | ||
|
|
d1babffa8b | ||
|
|
47df32ef1a | ||
|
|
fd5a42801f | ||
|
|
7cff27c801 | ||
|
|
28f3df5259 | ||
|
|
162e0b53cd | ||
|
|
1593df2a32 | ||
|
|
3a8ea856bc | ||
|
|
c430eeb374 | ||
|
|
9766e0ebb3 | ||
|
|
0756cd93ad | ||
|
|
355fb2aabb | ||
|
|
ebdffa2abb | ||
|
|
ce368bb850 | ||
|
|
9065bf2390 | ||
|
|
ded8ef1a66 | ||
|
|
55620ac254 | ||
|
|
64fb589ec6 | ||
|
|
310bd82b8b | ||
|
|
e05e6f83ea | ||
|
|
18cd60cd86 | ||
|
|
7fe89422e2 | ||
|
|
8346941b92 | ||
|
|
b311cef875 | ||
|
|
3065218e6d | ||
|
|
ea14bf2298 | ||
|
|
3c879dd5dc | ||
|
|
dc9ba1dc56 | ||
|
|
c073ad2d8b | ||
|
|
352cc5797b | ||
|
|
26cdff10fc | ||
|
|
c73c83d317 | ||
|
|
5e985cfaf3 | ||
|
|
94ab966c1b | ||
|
|
3cb39f8bd4 | ||
|
|
f8e7c4eee0 | ||
|
|
5e981cc74b | ||
|
|
54ced2e368 | ||
|
|
8af0d505cf | ||
|
|
c22a7e5b46 | ||
|
|
44af497f8a | ||
|
|
c8e81f32fb | ||
|
|
afc7f5d2f2 | ||
|
|
9b370dcad1 | ||
|
|
35dc429aa4 | ||
|
|
5c2a8b9fc4 | ||
|
|
9a4c8f754e | ||
|
|
f6318ee271 | ||
|
|
ef77be1508 | ||
|
|
4fa0c93ff7 | ||
|
|
021d946a96 | ||
|
|
8b70e42e0f | ||
|
|
94defc8a08 | ||
|
|
29dd594d48 | ||
|
|
b8ab03b22b | ||
|
|
b9cdaafed3 | ||
|
|
87ca9077ea | ||
|
|
57cfeeb854 | ||
|
|
e4c6cc3de0 | ||
|
|
4663e49e23 | ||
|
|
58269dd675 | ||
|
|
fc69eb7b72 | ||
|
|
c7008d329a | ||
|
|
27b348b013 | ||
|
|
79bb8386d3 | ||
|
|
146be0aa21 | ||
|
|
137ef7a17b | ||
|
|
c8048021d1 | ||
|
|
58764a6ec6 | ||
|
|
b17b4c1375 | ||
|
|
3817524f52 | ||
|
|
f6cfadd62f | ||
|
|
af34e083c2 | ||
|
|
2984cca164 | ||
|
|
6615030fab | ||
|
|
a4fc7ab05d | ||
|
|
8f64405ace | ||
|
|
eeb63d8694 | ||
|
|
cb8ddfd8aa | ||
|
|
8201728973 | ||
|
|
77a0ee13ac | ||
|
|
512c2e4c1e | ||
|
|
a4111fa672 | ||
|
|
78c19a3aba | ||
|
|
fbe9d0dec2 | ||
|
|
305b4b21a7 | ||
|
|
5e5aadb4ea | ||
|
|
84ff359b64 | ||
|
|
40a8651d68 | ||
|
|
e365ca3f7d | ||
|
|
a62fdad192 | ||
|
|
6be2217935 | ||
|
|
9956492730 | ||
|
|
ad536b718b | ||
|
|
a87e6f281d | ||
|
|
bb185a23ce | ||
|
|
f7bbf92e3a | ||
|
|
a89d053cae | ||
|
|
1758439c03 | ||
|
|
b6dd398c32 | ||
|
|
0ebe62a1d5 | ||
|
|
96a2350bf3 | ||
|
|
41803f5291 | ||
|
|
7468499855 | ||
|
|
0eeb3243fb | ||
|
|
8a0e0c823c | ||
|
|
fa70f4dce1 | ||
|
|
a92894f4d4 | ||
|
|
800d98c038 | ||
|
|
297f90a88a | ||
|
|
67b2d5c185 | ||
|
|
43f1739dfa | ||
|
|
a78aa78248 | ||
|
|
751a1c28fa | ||
|
|
380f85ed7e | ||
|
|
7a2539b1f2 | ||
|
|
c6b367e51e | ||
|
|
24ab7e5ff4 | ||
|
|
775bce0b2f | ||
|
|
3d9a12efcb | ||
|
|
7d2262e022 | ||
|
|
e0df1cd470 | ||
|
|
162fcfc73b | ||
|
|
6264bab6b0 | ||
|
|
2189a7efcd | ||
|
|
8dff4ecef1 | ||
|
|
5781350bd4 | ||
|
|
4f0fa5c21a | ||
|
|
06f32f3d37 | ||
|
|
b6c1e8a27e | ||
|
|
1e77c1510d | ||
|
|
e57d11fe38 | ||
|
|
f3d2b95896 | ||
|
|
cd8b32acac | ||
|
|
b26b4c2c77 | ||
|
|
e7f750da83 |
@@ -73,8 +73,12 @@ macro (config_hook)
|
||||
if(NOT cjson_FOUND)
|
||||
list(APPEND EXTRA_INCLUDES ${PROJECT_SOURCE_DIR}/external/cjson)
|
||||
endif()
|
||||
|
||||
# For this project
|
||||
add_definitions(-DFMT_HEADER_ONLY)
|
||||
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/external/fmtlib/include)
|
||||
include_directories(${EXTRA_INCLUDES} ${PROJECT_BINARY_DIR}/include)
|
||||
list(APPEND EXTRA_INCLUDES ${PROJECT_SOURCE_DIR}/external/fmtlib/include)
|
||||
|
||||
# For downstreams
|
||||
list(APPEND EXTRA_INCLUDES ${PROJECT_BINARY_DIR}/include)
|
||||
@@ -193,11 +197,7 @@ if(ENABLE_ECL_INPUT)
|
||||
test_util/summary.cpp
|
||||
)
|
||||
|
||||
add_executable(test_esmry_lod
|
||||
test_util/test_esmry_lod.cpp
|
||||
)
|
||||
|
||||
foreach(target compareECL convertECL summary test_esmry_lod)
|
||||
foreach(target compareECL convertECL summary)
|
||||
target_link_libraries(${target} opmcommon)
|
||||
install(TARGETS ${target} DESTINATION bin)
|
||||
endforeach()
|
||||
@@ -247,7 +247,11 @@ install(FILES etc/opm_bash_completion.sh.in DESTINATION share/opm/etc)
|
||||
if (OPM_ENABLE_PYTHON)
|
||||
# -------------------------------------------------------------------------
|
||||
# 1: Wrap C++ functionality in Python
|
||||
set(PYTHON_PACKAGE_PATH "site-packages")
|
||||
if (EXISTS "/etc/debian_version")
|
||||
set(PYTHON_PACKAGE_PATH "dist-packages")
|
||||
else()
|
||||
set(PYTHON_PACKAGE_PATH "site-packages")
|
||||
endif()
|
||||
set(PYTHON_INSTALL_PREFIX "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/${PYTHON_PACKAGE_PATH}" CACHE STRING "Subdirectory to install Python modules in")
|
||||
|
||||
make_directory(${PROJECT_BINARY_DIR}/python)
|
||||
@@ -255,10 +259,11 @@ if (OPM_ENABLE_PYTHON)
|
||||
list(APPEND _opmcommon_include_dirs ${_ecl_include_dirs})
|
||||
string(REPLACE ";" ":" _setup_include_dirs "${_opmcommon_include_dirs}")
|
||||
|
||||
get_target_property(_opmcommon_lib_dirs opmcommon LINK_DIRECTORIES)
|
||||
if (CMAKE_PREFIX_PATH)
|
||||
set(_opmcommon_lib_dirs ${PROJECT_BINARY_DIR}/lib ${CMAKE_PREFIX_PATH}/${CMAKE_INSTALL_LIBDIR})
|
||||
list(APPEND _opmcommon_lib_dirs ${PROJECT_BINARY_DIR}/lib ${CMAKE_PREFIX_PATH}/${CMAKE_INSTALL_LIBDIR})
|
||||
else()
|
||||
set(_opmcommon_lib_dirs ${PROJECT_BINARY_DIR}/lib)
|
||||
list(APPEND _opmcommon_lib_dirs ${PROJECT_BINARY_DIR}/lib)
|
||||
endif()
|
||||
string(REPLACE ";" ":" _setup_lib_dirs "${_opmcommon_lib_dirs}")
|
||||
|
||||
@@ -284,6 +289,11 @@ if (OPM_ENABLE_PYTHON)
|
||||
set( _rpath_arg "")
|
||||
endif()
|
||||
|
||||
set(opm-common_PYTHON_PACKAGE_VERSION ${OPM_PYTHON_PACKAGE_VERSION_TAG})
|
||||
|
||||
# Generate versioned setup.py
|
||||
configure_file (${PROJECT_SOURCE_DIR}/python/setup.py.in ${PROJECT_BINARY_DIR}/python/setup.py)
|
||||
file(COPY ${PROJECT_SOURCE_DIR}/python/README.md DESTINATION ${PROJECT_BINARY_DIR}/python)
|
||||
execute_process(COMMAND ${PYTHON_EXECUTABLE} target_name.py
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/python
|
||||
OUTPUT_VARIABLE python_lib_target)
|
||||
@@ -291,19 +301,19 @@ if (OPM_ENABLE_PYTHON)
|
||||
add_custom_target(copy_python ALL
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/python/install.py ${PROJECT_SOURCE_DIR}/python ${PROJECT_BINARY_DIR} 0)
|
||||
|
||||
add_custom_command(OUTPUT python/python/opm/${python_lib_target}
|
||||
add_custom_command(OUTPUT python/opm/${python_lib_target}
|
||||
DEPENDS ${PYTHON_CXX_DEPENDS}
|
||||
DEPENDS copy_python
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/python/setup.py
|
||||
build
|
||||
build_ext
|
||||
--build-lib=${PROJECT_BINARY_DIR}/python/python/opm
|
||||
--build-lib=${PROJECT_BINARY_DIR}/python
|
||||
--library-dirs=${_setup_lib_dirs}
|
||||
${_rpath_arg}
|
||||
--include-dirs=${_setup_include_dirs}
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/python
|
||||
COMMENT "Building python bindings")
|
||||
add_custom_target(opmcommon_python ALL DEPENDS python/python/opm/${python_lib_target})
|
||||
COMMENT "Building python bindings at python/opm/${python_lib_target}")
|
||||
add_custom_target(opmcommon_python ALL DEPENDS python/opm/${python_lib_target})
|
||||
add_dependencies(opmcommon_python opmcommon)
|
||||
|
||||
# The install target is based on manually copying the python file tree to the
|
||||
@@ -318,7 +328,7 @@ if (OPM_ENABLE_PYTHON)
|
||||
# setup.py install manually - optionally with the generated script
|
||||
# setup-install.sh - and completely bypass cmake in the installation phase.
|
||||
if (OPM_INSTALL_PYTHON)
|
||||
install( CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/python/install.py ${PROJECT_BINARY_DIR}/python/python/opm ${DEST_PREFIX}${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PREFIX} 1)")
|
||||
install( CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/python/install.py ${PROJECT_BINARY_DIR}/python/opm ${DEST_PREFIX}${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PREFIX} 1)")
|
||||
endif()
|
||||
|
||||
# Observe that if the opmcommon library has been built as a shared library the
|
||||
@@ -326,11 +336,11 @@ if (OPM_ENABLE_PYTHON)
|
||||
# testing.
|
||||
add_test(NAME python_tests
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/python
|
||||
COMMAND ${CMAKE_COMMAND} -E env LD_LIBRARY_PATH=${PROJECT_BINARY_DIR}/lib ${PYTHON_EXECUTABLE} setup.py build_ext --dry-run --build-lib ${PROJECT_BINARY_DIR}/python/python/opm test
|
||||
COMMAND ${CMAKE_COMMAND} -E env LD_LIBRARY_PATH=${PROJECT_BINARY_DIR}/lib ${PYTHON_EXECUTABLE} setup.py build_ext --dry-run --build-lib ${PROJECT_BINARY_DIR}/python test
|
||||
)
|
||||
|
||||
set_target_properties(opmcommon PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${PROJECT_BINARY_DIR}/python/python)
|
||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${PROJECT_BINARY_DIR}/python)
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Let cmake configure some small shell scripts which can be used to simplify
|
||||
@@ -340,6 +350,11 @@ if (OPM_ENABLE_PYTHON)
|
||||
DESTINATION ${PROJECT_BINARY_DIR}
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE )
|
||||
|
||||
configure_file(python/setup-package.sh.in tmp/setup-package.sh)
|
||||
file( COPY ${PROJECT_BINARY_DIR}/tmp/setup-package.sh
|
||||
DESTINATION ${PROJECT_BINARY_DIR}
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE )
|
||||
|
||||
configure_file(python/setup-test.sh.in tmp/setup-test.sh)
|
||||
file( COPY ${PROJECT_BINARY_DIR}/tmp/setup-test.sh
|
||||
DESTINATION ${PROJECT_BINARY_DIR}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
# the library needs it.
|
||||
|
||||
list (APPEND MAIN_SOURCE_FILES
|
||||
src/opm/common/data/SimulationDataContainer.cpp
|
||||
src/opm/common/OpmLog/CounterLog.cpp
|
||||
src/opm/common/OpmLog/EclipsePRTLog.cpp
|
||||
src/opm/common/OpmLog/LogBackend.cpp
|
||||
@@ -33,6 +32,7 @@ list (APPEND MAIN_SOURCE_FILES
|
||||
src/opm/common/utility/ActiveGridCells.cpp
|
||||
src/opm/common/utility/FileSystem.cpp
|
||||
src/opm/common/utility/numeric/MonotCubicInterpolator.cpp
|
||||
src/opm/common/utility/OpmInputError.cpp
|
||||
src/opm/common/utility/parameters/Parameter.cpp
|
||||
src/opm/common/utility/parameters/ParameterGroup.cpp
|
||||
src/opm/common/utility/parameters/ParameterTools.cpp
|
||||
@@ -96,8 +96,12 @@ if(ENABLE_ECL_INPUT)
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/ActionValue.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/ASTNode.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/Condition.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Action/State.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/eval_uda.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Events.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/GasLiftOpt.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Group/GPMaint.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Group/Group.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRate.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Group/GuideRateConfig.cpp
|
||||
@@ -105,15 +109,18 @@ if(ENABLE_ECL_INPUT)
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Group/GConSale.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Group/GConSump.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Group/GTNode.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/injection.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/MessageLimits.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/MSW/icd.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/MSW/Compsegs.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/MSW/updatingConnectionsWithSegments.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/MSW/AICD.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/MSW/SICD.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Network/Branch.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Network/ExtNetwork.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Network/Node.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/RFTConfig.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/RPTConfig.cpp
|
||||
@@ -122,7 +129,7 @@ if(ENABLE_ECL_INPUT)
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/SummaryState.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/TimeMap.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/Connection.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/eval_uda.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/injection.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/Well/WList.cpp
|
||||
@@ -151,6 +158,7 @@ if(ENABLE_ECL_INPUT)
|
||||
src/opm/parser/eclipse/EclipseState/Tables/TableColumn.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/TableContainer.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/TableIndex.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/TLMixpar.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/TableManager.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/TableSchema.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/Tables.cpp
|
||||
@@ -158,6 +166,7 @@ if(ENABLE_ECL_INPUT)
|
||||
src/opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/PvtwsaltTable.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/BrineDensityTable.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/RwgsaltTable.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Tables/SolventDensityTable.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQASTNode.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.cpp
|
||||
@@ -167,11 +176,13 @@ if(ENABLE_ECL_INPUT)
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQAssign.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQToken.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQContext.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunction.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQFunctionTable.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQInput.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQState.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.cpp
|
||||
src/opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.cpp
|
||||
src/opm/parser/eclipse/Parser/ErrorGuard.cpp
|
||||
@@ -187,7 +198,6 @@ if(ENABLE_ECL_INPUT)
|
||||
src/opm/parser/eclipse/Units/Dimension.cpp
|
||||
src/opm/parser/eclipse/Units/UnitSystem.cpp
|
||||
src/opm/parser/eclipse/Utility/Functional.cpp
|
||||
src/opm/parser/eclipse/Utility/Stringview.cpp
|
||||
)
|
||||
|
||||
|
||||
@@ -292,10 +302,10 @@ list (APPEND TEST_SOURCE_FILES
|
||||
tests/test_cubic.cpp
|
||||
tests/test_messagelimiter.cpp
|
||||
tests/test_nonuniformtablelinear.cpp
|
||||
tests/test_OpmInputError_format.cpp
|
||||
tests/test_OpmLog.cpp
|
||||
tests/test_param.cpp
|
||||
tests/test_RootFinders.cpp
|
||||
tests/test_SimulationDataContainer.cpp
|
||||
tests/test_sparsevector.cpp
|
||||
tests/test_uniformtablelinear.cpp
|
||||
)
|
||||
@@ -303,6 +313,7 @@ if(ENABLE_ECL_INPUT)
|
||||
list(APPEND TEST_SOURCE_FILES
|
||||
tests/rst_test.cpp
|
||||
tests/test_ERsm.cpp
|
||||
tests/test_GuideRate.cpp
|
||||
tests/parser/ACTIONX.cpp
|
||||
tests/parser/ADDREGTests.cpp
|
||||
tests/parser/AquiferTests.cpp
|
||||
@@ -332,6 +343,7 @@ if(ENABLE_ECL_INPUT)
|
||||
tests/parser/MultiRegTests.cpp
|
||||
tests/parser/MultisegmentWellTests.cpp
|
||||
tests/parser/MULTREGTScannerTests.cpp
|
||||
tests/parser/NetworkTests.cpp
|
||||
tests/parser/OrderedMapTests.cpp
|
||||
tests/parser/ParseContextTests.cpp
|
||||
tests/parser/ParseContext_EXIT1.cpp
|
||||
@@ -365,7 +377,6 @@ if(ENABLE_ECL_INPUT)
|
||||
tests/parser/TuningTests.cpp
|
||||
tests/parser/UDQTests.cpp
|
||||
tests/parser/UnitTests.cpp
|
||||
tests/parser/ValueTests.cpp
|
||||
tests/parser/WellSolventTests.cpp
|
||||
tests/parser/WellTracerTests.cpp
|
||||
tests/parser/WellTests.cpp
|
||||
@@ -381,6 +392,7 @@ if(ENABLE_ECL_OUTPUT)
|
||||
tests/test_AggregateConnectionData.cpp
|
||||
tests/test_AggregateUDQData.cpp
|
||||
tests/test_ArrayDimChecker.cpp
|
||||
tests/test_data_GuideRateValue.cpp
|
||||
tests/test_EclipseIO.cpp
|
||||
tests/test_DoubHEAD.cpp
|
||||
tests/test_InteHEAD.cpp
|
||||
@@ -393,6 +405,7 @@ if(ENABLE_ECL_OUTPUT)
|
||||
tests/test_RFT.cpp
|
||||
tests/test_rst.cpp
|
||||
tests/test_Solution.cpp
|
||||
tests/test_Serializer.cpp
|
||||
tests/test_Summary.cpp
|
||||
tests/test_Summary_Group.cpp
|
||||
tests/test_Tables.cpp
|
||||
@@ -407,8 +420,6 @@ list (APPEND TEST_DATA_FILES
|
||||
)
|
||||
if(ENABLE_ECL_OUTPUT)
|
||||
list (APPEND TEST_DATA_FILES
|
||||
tests/expect-wdims.chldg.err.out
|
||||
tests/expect-wdims.err.out
|
||||
tests/BASE_SIM.DATA
|
||||
tests/BASE_SIM_THPRES.DATA
|
||||
tests/RESTART_SIM.DATA
|
||||
@@ -424,6 +435,8 @@ if(ENABLE_ECL_OUTPUT)
|
||||
tests/SPE1CASE1A.SMSPEC
|
||||
tests/SPE9_CP_PACKED.DATA
|
||||
tests/SOFR_TEST.DATA
|
||||
tests/UDQ_BASE.DATA
|
||||
tests/UDQ_RESTART.DATA
|
||||
tests/UDQ_TEST_WCONPROD_IUAD-2.DATA
|
||||
tests/UDQ_ACTIONX_TEST1.DATA
|
||||
tests/UDQ_ACTIONX_TEST1_U.DATA
|
||||
@@ -436,6 +449,7 @@ if(ENABLE_ECL_OUTPUT)
|
||||
tests/SPE1CASE2_RESTART.DATA
|
||||
tests/SPE1CASE2.X0060
|
||||
tests/PYACTION.DATA
|
||||
tests/0A4_GRCTRL_LRAT_LRAT_GGR_BASE_MODEL2_MSW_ALL.DATA
|
||||
tests/act1.py
|
||||
tests/MSW.DATA
|
||||
tests/EXIT_TEST.DATA
|
||||
@@ -472,6 +486,8 @@ if(ENABLE_ECL_INPUT)
|
||||
examples/opmi.cpp
|
||||
examples/opmpack.cpp
|
||||
examples/opmhash.cpp
|
||||
examples/wellgraph.cpp
|
||||
examples/make_lodsmry.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -484,13 +500,13 @@ if(ENABLE_ECL_INPUT)
|
||||
examples/opmi.cpp
|
||||
examples/opmpack.cpp
|
||||
examples/opmhash.cpp
|
||||
examples/make_lodsmry.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
list( APPEND PUBLIC_HEADER_FILES
|
||||
opm/common/ErrorMacros.hpp
|
||||
opm/common/Exceptions.hpp
|
||||
opm/common/data/SimulationDataContainer.hpp
|
||||
opm/common/OpmLog/CounterLog.hpp
|
||||
opm/common/OpmLog/EclipsePRTLog.hpp
|
||||
opm/common/OpmLog/LogBackend.hpp
|
||||
@@ -498,12 +514,14 @@ list( APPEND PUBLIC_HEADER_FILES
|
||||
opm/common/OpmLog/LogUtil.hpp
|
||||
opm/common/OpmLog/MessageFormatter.hpp
|
||||
opm/common/OpmLog/MessageLimiter.hpp
|
||||
opm/common/OpmLog/Location.hpp
|
||||
opm/common/OpmLog/KeywordLocation.hpp
|
||||
opm/common/OpmLog/OpmLog.hpp
|
||||
opm/common/OpmLog/StreamLog.hpp
|
||||
opm/common/OpmLog/TimerLog.hpp
|
||||
opm/common/utility/Serializer.hpp
|
||||
opm/common/utility/ActiveGridCells.hpp
|
||||
opm/common/utility/FileSystem.hpp
|
||||
opm/common/utility/OpmInputError.hpp
|
||||
opm/common/utility/numeric/cmp.hpp
|
||||
opm/common/utility/platform_dependent/disable_warnings.h
|
||||
opm/common/utility/platform_dependent/reenable_warnings.h
|
||||
@@ -530,7 +548,6 @@ if(ENABLE_ECL_INPUT)
|
||||
list(APPEND PUBLIC_HEADER_FILES
|
||||
opm/io/eclipse/SummaryNode.hpp
|
||||
opm/json/JsonObject.hpp
|
||||
opm/parser/eclipse/Utility/Stringview.hpp
|
||||
opm/parser/eclipse/Utility/Functional.hpp
|
||||
opm/parser/eclipse/Utility/Typetools.hpp
|
||||
opm/parser/eclipse/Generator/KeywordGenerator.hpp
|
||||
@@ -550,12 +567,14 @@ if(ENABLE_ECL_INPUT)
|
||||
opm/parser/eclipse/EclipseState/InitConfig/InitConfig.hpp
|
||||
opm/parser/eclipse/EclipseState/InitConfig/Equil.hpp
|
||||
opm/parser/eclipse/EclipseState/InitConfig/FoamConfig.hpp
|
||||
opm/parser/eclipse/EclipseState/Util/Value.hpp
|
||||
opm/parser/eclipse/EclipseState/Util/IOrderSet.hpp
|
||||
opm/parser/eclipse/EclipseState/Util/OrderedMap.hpp
|
||||
opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp
|
||||
opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/FieldData.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/Keywords.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/GridDims.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/TranCalculator.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/TransMult.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/PinchMode.hpp
|
||||
opm/parser/eclipse/EclipseState/Grid/MULTREGTScanner.hpp
|
||||
@@ -586,8 +605,11 @@ if(ENABLE_ECL_INPUT)
|
||||
opm/parser/eclipse/EclipseState/Tables/SpecrockTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PvtwsaltTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/BrineDensityTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/SolventDensityTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PermfactTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/RwgsaltTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/SaltvdTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/SaltpvdTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/SolventDensityTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PlydhflfTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PlyshlogTable.hpp
|
||||
@@ -597,6 +619,7 @@ if(ENABLE_ECL_INPUT)
|
||||
opm/parser/eclipse/EclipseState/Tables/SpecheatTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/SgcwmisTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/Sof2Table.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/TLMixpar.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/TableManager.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/SwfnTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/EnptvdTable.hpp
|
||||
@@ -606,6 +629,8 @@ if(ENABLE_ECL_INPUT)
|
||||
opm/parser/eclipse/EclipseState/Tables/JFunc.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/TableIndex.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PvtgTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PvtgwTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/PvtgwoTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/Tabdims.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/TableSchema.hpp
|
||||
opm/parser/eclipse/EclipseState/Tables/RocktabTable.hpp
|
||||
@@ -662,7 +687,12 @@ if(ENABLE_ECL_INPUT)
|
||||
opm/parser/eclipse/EclipseState/Schedule/Action/Condition.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Action/ASTNode.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Action/PyAction.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Action/State.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/GasLiftOpt.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Network/Branch.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Network/ExtNetwork.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Network/Node.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp
|
||||
@@ -689,6 +719,7 @@ if(ENABLE_ECL_INPUT)
|
||||
opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/ScheduleTypes.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Group/GPMaint.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Group/GTNode.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/Group/GuideRate.hpp
|
||||
@@ -704,8 +735,8 @@ if(ENABLE_ECL_INPUT)
|
||||
opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/MSW/updatingConnectionsWithSegments.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/MSW/AICD.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/MSW/SICD.hpp
|
||||
opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp
|
||||
opm/parser/eclipse/EclipseState/SimulationConfig/BCConfig.hpp
|
||||
opm/parser/eclipse/EclipseState/SimulationConfig/RockConfig.hpp
|
||||
@@ -719,6 +750,7 @@ if(ENABLE_ECL_INPUT)
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQASTNode.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQContext.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQState.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQEnums.hpp
|
||||
opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.hpp
|
||||
@@ -760,9 +792,10 @@ if(ENABLE_ECL_OUTPUT)
|
||||
opm/io/eclipse/rst/well.hpp
|
||||
opm/output/data/Aquifer.hpp
|
||||
opm/output/data/Cells.hpp
|
||||
opm/output/data/GuideRateValue.hpp
|
||||
opm/output/data/Groups.hpp
|
||||
opm/output/data/Solution.hpp
|
||||
opm/output/data/Wells.hpp
|
||||
opm/output/data/Groups.hpp
|
||||
opm/output/eclipse/VectorItems/aquifer.hpp
|
||||
opm/output/eclipse/VectorItems/connection.hpp
|
||||
opm/output/eclipse/VectorItems/group.hpp
|
||||
|
||||
@@ -20,7 +20,7 @@ set(genkw_SOURCES src/opm/json/JsonObject.cpp
|
||||
src/opm/parser/eclipse/Parser/raw/StarToken.cpp
|
||||
src/opm/parser/eclipse/Units/Dimension.cpp
|
||||
src/opm/parser/eclipse/Units/UnitSystem.cpp
|
||||
src/opm/parser/eclipse/Utility/Stringview.cpp
|
||||
src/opm/common/utility/OpmInputError.cpp
|
||||
src/opm/common/OpmLog/OpmLog.cpp
|
||||
src/opm/common/OpmLog/Logger.cpp
|
||||
src/opm/common/OpmLog/StreamLog.cpp
|
||||
|
||||
@@ -60,6 +60,19 @@ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${MPI_C_COMPILE_FLAGS}")
|
||||
|
||||
include(CheckIncludeFile)
|
||||
check_include_file(parmetis.h PARMETIS_FOUND)
|
||||
|
||||
if(NOT PARMETIS_FOUND)
|
||||
# If we are using the ParMETIS bindings of PTScotch, we need
|
||||
# to use the scotch include path as partmetis.h includes scotch.h
|
||||
find_package(PTScotch)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${PTSCOTCH_INCLUDE_DIR})
|
||||
unset(PARMETIS_FOUND CACHE) # force recheck of include file
|
||||
check_include_file(parmetis.h PARMETIS_FOUND)
|
||||
if(PARMETIS_FOUND)
|
||||
set(PARMETIS_SCOTCH_INCLUDE_DIRS ${PTSCOTCH_INCLUDE_DIRS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
_search_parmetis_lib(PARMETIS_LIBRARY parmetis "The main ParMETIS library.")
|
||||
|
||||
# behave like a CMake module is supposed to behave
|
||||
@@ -77,7 +90,7 @@ find_package_handle_standard_args(
|
||||
cmake_pop_check_state()
|
||||
|
||||
if(PARMETIS_FOUND)
|
||||
set(PARMETIS_INCLUDE_DIRS ${PARMETIS_INCLUDE_DIR})
|
||||
set(PARMETIS_INCLUDE_DIRS ${PARMETIS_INCLUDE_DIR} ${PARMETIS_SCOTCH_INCLUDE_DIRS})
|
||||
set(PARMETIS_LIBRARIES ${PARMETIS_LIBRARY} ${METIS_LIBRARIES} ${MPI_C_LIBRARIES}
|
||||
CACHE FILEPATH "All libraries needed to link programs using ParMETIS")
|
||||
set(PARMETIS_LINK_FLAGS "${DUNE_C_LINK_FLAGS}"
|
||||
|
||||
@@ -16,6 +16,9 @@ if(ZOLTAN_ROOT)
|
||||
set(ZOLTAN_NO_DEFAULT_PATH "NO_DEFAULT_PATH")
|
||||
endif()
|
||||
|
||||
# We only need zoltan with MPI. Otherwise usage of alugrid is broken.
|
||||
find_package(MPI)
|
||||
|
||||
# Make sure we have checked for the underlying partitioners.
|
||||
find_package(PTScotch)
|
||||
#find_package(ParMETIS)
|
||||
@@ -39,20 +42,23 @@ find_library(ZOLTAN_LIBRARIES
|
||||
${ZOLTAN_NO_DEFAULT_PATH})
|
||||
|
||||
set (ZOLTAN_FOUND FALSE)
|
||||
if (ZOLTAN_INCLUDE_DIRS OR ZOLTAN_LIBRARIES)
|
||||
set(ZOLTAN_FOUND TRUE)
|
||||
|
||||
set (ZOLTAN_CONFIG_VAR HAVE_ZOLTAN)
|
||||
|
||||
# print a message to indicate status of this package
|
||||
include (FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(ZOLTAN
|
||||
DEFAULT_MSG
|
||||
ZOLTAN_LIBRARIES
|
||||
ZOLTAN_INCLUDE_DIRS
|
||||
MPI_FOUND
|
||||
)
|
||||
|
||||
if (ZOLTAN_FOUND)
|
||||
set(HAVE_ZOLTAN 1)
|
||||
set(ZOLTAN_LIBRARIES ${ZOLTAN_LIBRARIES} ${PARMETIS_LIBRARIES} ${PTSCOTCH_LIBRARIES})
|
||||
set(ZOLTAN_INCLUDE_DIRS ${ZOLTAN_INCLUDE_DIRS} ${PARMETIS_INCLUDE_DIRS}
|
||||
${PTSCOTCH_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
set (ZOLTAN_CONFIG_VAR HAVE_ZOLTAN)
|
||||
|
||||
# print a message to indicate status of this package
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(ZOLTAN
|
||||
DEFAULT_MSG
|
||||
ZOLTAN_LIBRARIES
|
||||
ZOLTAN_INCLUDE_DIRS
|
||||
)
|
||||
|
||||
@@ -33,8 +33,7 @@ find_opm_package (
|
||||
# test program
|
||||
"#include <dune/geometry/quadraturerules.hh>
|
||||
int main (void) {
|
||||
Dune::GeometryType gt;
|
||||
gt.makeQuadrilateral();
|
||||
Dune::GeometryType gt = Dune::GeometryTypes::quadrilateral;
|
||||
Dune::QuadratureRules<double, 2>::rule(gt, 2).size();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ is_compiler_gcc_compatible ()
|
||||
include(TestCXXAcceptsFlag)
|
||||
|
||||
macro (opm_defaults opm)
|
||||
|
||||
message("Processing opm_defaults ${opm}")
|
||||
# if we are installing a development version (default when checking out of
|
||||
# VCS), then remember which directories were used when configuring. package
|
||||
# distribution should disable this option.
|
||||
|
||||
@@ -106,8 +106,13 @@ macro (find_and_append_package_to prefix name)
|
||||
|
||||
# if we're told not to look for the package, pretend it was never found
|
||||
if (CMAKE_DISABLE_FIND_PACKAGE_${name})
|
||||
set (${name}_FOUND FALSE)
|
||||
set (${NAME}_FOUND FALSE)
|
||||
# If required send an error
|
||||
cmake_parse_arguments(FIND "REQUIRED" "" "" ${ARGN} )
|
||||
set (${name}_FOUND FALSE)
|
||||
set (${NAME}_FOUND FALSE)
|
||||
if (FIND_REQUIRED)
|
||||
message(SEND_ERROR "package ${name} but disable with CMAKE_DISABLE_FIND_PACKAGE_${name}")
|
||||
endif ()
|
||||
else ()
|
||||
# List of components might differ for every module. Therefore we will
|
||||
# need to research for a library multiple times. _search_components
|
||||
|
||||
@@ -62,7 +62,10 @@ include (UseOptimization)
|
||||
|
||||
# turn on all warnings; this must be done before adding any
|
||||
# dependencies, in case they alter the list of warnings
|
||||
include (UseWarnings)
|
||||
option(OPM_DISABLE_WARNINGS "Disable warning flags" OFF)
|
||||
if(NOT OPM_DISABLE_WARNINGS)
|
||||
include (UseWarnings)
|
||||
endif()
|
||||
|
||||
# parallel programming
|
||||
include (UseOpenMP)
|
||||
|
||||
@@ -115,26 +115,34 @@ macro (find_opm_package module deps header lib defs prog conf)
|
||||
# without config.h
|
||||
config_cmd_line (${module}_CMD_CONFIG ${module}_CONFIG_VARS)
|
||||
|
||||
# check that we can compile a small test-program
|
||||
include (CMakePushCheckState)
|
||||
cmake_push_check_state ()
|
||||
include (CheckCXXSourceCompiles)
|
||||
# only add these if they are actually found; otherwise it won't
|
||||
# compile and the variable won't be set
|
||||
append_found (${module}_INCLUDE_DIRS CMAKE_REQUIRED_INCLUDES)
|
||||
append_found (${module}_LIBRARIES CMAKE_REQUIRED_LIBRARIES)
|
||||
# since we don't have any config.h yet
|
||||
list (APPEND CMAKE_REQUIRED_DEFINITIONS ${${module}_DEFINITIONS})
|
||||
list (APPEND CMAKE_REQUIRED_DEFINITIONS ${${module}_CMD_CONFIG})
|
||||
check_cxx_source_compiles ("${prog}" HAVE_${MODULE})
|
||||
cmake_pop_check_state ()
|
||||
if(prog)
|
||||
# check that we can compile a small test-program
|
||||
include (CMakePushCheckState)
|
||||
cmake_push_check_state ()
|
||||
include (CheckCXXSourceCompiles)
|
||||
# only add these if they are actually found; otherwise it won't
|
||||
# compile and the variable won't be set
|
||||
append_found (${module}_INCLUDE_DIRS CMAKE_REQUIRED_INCLUDES)
|
||||
append_found (${module}_LIBRARIES CMAKE_REQUIRED_LIBRARIES)
|
||||
# since we don't have any config.h yet
|
||||
list (APPEND CMAKE_REQUIRED_DEFINITIONS ${${module}_DEFINITIONS})
|
||||
list (APPEND CMAKE_REQUIRED_DEFINITIONS ${${module}_CMD_CONFIG})
|
||||
check_cxx_source_compiles ("${prog}" HAVE_${MODULE})
|
||||
cmake_pop_check_state ()
|
||||
else(prog)
|
||||
if(${module}_FOUND)
|
||||
# No test code provided, mark compilation as successful
|
||||
# if module was founf
|
||||
set(HAVE_${MODULE} 1)
|
||||
endif(${module}_FOUND)
|
||||
endif(prog)
|
||||
|
||||
# write status message in the same manner as everyone else
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (
|
||||
${module}
|
||||
DEFAULT_MSG
|
||||
${module}_INCLUDE_DIRS ${module}_LIBRARIES ${module}_FOUND ${module}_ALL_PREREQS
|
||||
${module}_INCLUDE_DIRS ${module}_LIBRARIES ${module}_FOUND ${module}_ALL_PREREQS HAVE_${MODULE}
|
||||
)
|
||||
|
||||
# some genius that coded the FindPackageHandleStandardArgs figured out
|
||||
|
||||
@@ -42,7 +42,13 @@ macro (find_openmp opm)
|
||||
# enabling OpenMP is supposedly enough to make the compiler link with
|
||||
# the appropriate libraries
|
||||
find_package (OpenMP ${${opm}_QUIET})
|
||||
list (APPEND ${opm}_LIBRARIES ${OpenMP_LIBRARIES})
|
||||
|
||||
if(OpenMP_CXX_FOUND)
|
||||
list (APPEND ${opm}_LIBRARIES OpenMP::OpenMP_CXX)
|
||||
else()
|
||||
list (APPEND ${opm}_LIBRARIES ${OpenMP_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if (OPENMP_FOUND)
|
||||
add_options (C ALL_BUILDS "${OpenMP_C_FLAGS}")
|
||||
add_options (CXX ALL_BUILDS "${OpenMP_CXX_FLAGS}")
|
||||
|
||||
@@ -24,9 +24,16 @@ if (cmake_build_type_upper_ MATCHES DEBUG)
|
||||
"#define PROJECT_VERSION_NAME \"${${project}_LABEL}\"\n"
|
||||
"#define PROJECT_VERSION_HASH \"debug\"\n"
|
||||
"#define PROJECT_VERSION \"${${project}_LABEL} (debug)\"\n"
|
||||
"#define BUILD_TIMESTAMP \"${build_timestamp}\"\n"
|
||||
"#endif // OPM_GENERATED_OPM_VERSION_HEADER_INCLUDED\n"
|
||||
)
|
||||
|
||||
# Write header file with build timestamp
|
||||
file (WRITE "${PROJECT_BINARY_DIR}/project-timestamp.h"
|
||||
"#ifndef OPM_GENERATED_OPM_TIMESTAMP_HEADER_INCLUDED\n"
|
||||
"#define OPM_GENERATED_OPM_TIMESTAMP_HEADER_INCLUDED\n"
|
||||
"#define BUILD_TIMESTAMP \"${build_timestamp}\"\n"
|
||||
"#endif // OPM_GENERATED_OPM_TIMESTAMP_HEADER_INCLUDED\n"
|
||||
)
|
||||
else ()
|
||||
if (NOT GIT_FOUND)
|
||||
find_package (Git)
|
||||
@@ -43,9 +50,15 @@ else ()
|
||||
"#define PROJECT_VERSION_NAME \"${${project}_LABEL}\"\n"
|
||||
"#define PROJECT_VERSION_HASH \"unknown git version\"\n"
|
||||
"#define PROJECT_VERSION \"${${project}_LABEL} (unknown git version)\"\n"
|
||||
"#define BUILD_TIMESTAMP \"${build_timestamp}\"\n"
|
||||
"#endif // OPM_GENERATED_OPM_VERSION_HEADER_INCLUDED\n"
|
||||
)
|
||||
# Write header file with build timestamp
|
||||
file (WRITE "${PROJECT_BINARY_DIR}/project-timestamp.h"
|
||||
"#ifndef OPM_GENERATED_OPM_TIMESTAMP_HEADER_INCLUDED\n"
|
||||
"#define OPM_GENERATED_OPM_TIMESTAMP_HEADER_INCLUDED\n"
|
||||
"#define BUILD_TIMESTAMP \"${build_timestamp}\"\n"
|
||||
"#endif // OPM_GENERATED_OPM_TIMESTAMP_HEADER_INCLUDED\n"
|
||||
)
|
||||
else ()
|
||||
add_custom_target (update-version ALL
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
|
||||
@@ -56,7 +56,6 @@ file (WRITE "${PROJECT_BINARY_DIR}/project-version.tmp"
|
||||
"#define PROJECT_VERSION_NAME \"${PROJECT_LABEL}\"\n"
|
||||
"#define PROJECT_VERSION_HASH \"${sha1}\"\n"
|
||||
"#define PROJECT_VERSION \"${PROJECT_LABEL} (${sha1})\"\n"
|
||||
"#define BUILD_TIMESTAMP \"${build_timestamp}\"\n"
|
||||
"#endif // OPM_GENERATED_OPM_VERSION_HEADER_INCLUDED\n"
|
||||
)
|
||||
|
||||
@@ -66,3 +65,11 @@ file (WRITE "${PROJECT_BINARY_DIR}/project-version.tmp"
|
||||
execute_process (COMMAND
|
||||
${CMAKE_COMMAND} -E copy_if_different "${PROJECT_BINARY_DIR}/project-version.tmp" "${PROJECT_BINARY_DIR}/project-version.h"
|
||||
)
|
||||
|
||||
# Write header file with build timestamp
|
||||
file (WRITE "${PROJECT_BINARY_DIR}/project-timestamp.h"
|
||||
"#ifndef OPM_GENERATED_OPM_TIMESTAMP_HEADER_INCLUDED\n"
|
||||
"#define OPM_GENERATED_OPM_TIMESTAMP_HEADER_INCLUDED\n"
|
||||
"#define BUILD_TIMESTAMP \"${build_timestamp}\"\n"
|
||||
"#endif // OPM_GENERATED_OPM_TIMESTAMP_HEADER_INCLUDED\n"
|
||||
)
|
||||
|
||||
4
debian/control
vendored
4
debian/control
vendored
@@ -16,7 +16,7 @@ Vcs-Browser: https://github.com/OPM/opm-common
|
||||
|
||||
Package: libopm-common1
|
||||
Section: libs
|
||||
Pre-Depends: ${misc:Pre-Depends}, multiarch-support
|
||||
Pre-Depends: ${misc:Pre-Depends}
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
@@ -56,7 +56,7 @@ Description: OPM common library -- documentation
|
||||
|
||||
Package: python3-opm-common
|
||||
Section: libs
|
||||
Pre-Depends: ${misc:Pre-Depends}, multiarch-support
|
||||
Pre-Depends: ${misc:Pre-Depends}
|
||||
Architecture: any
|
||||
Multi-Arch: same
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, libopm-common1, python3-numpy, python3-decorator
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
Module: opm-common
|
||||
Description: Open Porous Media Initiative shared infrastructure
|
||||
Version: 2020.04-pre
|
||||
Label: 2020.04-pre
|
||||
Version: 2020.10
|
||||
Label: 2020.10
|
||||
Maintainer: opm@opm-project.org
|
||||
MaintainerName: OPM community
|
||||
Url: http://opm-project.org
|
||||
|
||||
109
examples/make_lodsmry.cpp
Normal file
109
examples/make_lodsmry.cpp
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if HAVE_OPENMP
|
||||
#include <omp.h>
|
||||
#endif
|
||||
|
||||
#include <opm/io/eclipse/ESmry.hpp>
|
||||
#include <opm/io/eclipse/EclUtil.hpp>
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
|
||||
static void printHelp() {
|
||||
|
||||
std::cout << "\nThis program create one or more lodsmry files, designed for effective load on the demand. \n"
|
||||
<< "These files are created with input from the smspec and unsmry file. \n"
|
||||
<< "\nIn addition, the program takes these options (which must be given before the arguments):\n\n"
|
||||
<< "-f if LODSMRY file exist, this will be replaced. Default behaviour is that existing file is kept.\n"
|
||||
<< "-n Maximum number of threads to be used if mulitple files should be created.\n"
|
||||
<< "-h Print help and exit.\n\n";
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
int c = 0;
|
||||
int max_threads [[maybe_unused]] = -1;
|
||||
bool force = false;
|
||||
|
||||
while ((c = getopt(argc, argv, "fn:h")) != -1) {
|
||||
switch (c) {
|
||||
case 'f':
|
||||
force = true;
|
||||
break;
|
||||
case 'h':
|
||||
printHelp();
|
||||
return 0;
|
||||
case 'n':
|
||||
max_threads = atoi(optarg);
|
||||
break;
|
||||
default:
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
int argOffset = optind;
|
||||
|
||||
#if HAVE_OPENMP
|
||||
int available_threads = omp_get_max_threads();
|
||||
|
||||
if (max_threads < 0)
|
||||
max_threads = available_threads-2;
|
||||
else if (max_threads > (available_threads - 1))
|
||||
max_threads = available_threads-1;
|
||||
|
||||
if (max_threads > (argc-argOffset))
|
||||
max_threads = argc-argOffset;
|
||||
|
||||
omp_set_num_threads(max_threads);
|
||||
#endif
|
||||
|
||||
auto lap0 = std::chrono::system_clock::now();
|
||||
|
||||
#pragma omp parallel for
|
||||
for (int f = argOffset; f < argc; f ++){
|
||||
Opm::filesystem::path inputFileName = argv[f];
|
||||
|
||||
Opm::filesystem::path lodFileName = inputFileName.parent_path() / inputFileName.stem();
|
||||
lodFileName = lodFileName += ".LODSMRY";
|
||||
|
||||
if (Opm::EclIO::fileExists(lodFileName) && (force))
|
||||
remove (lodFileName);
|
||||
|
||||
Opm::EclIO::ESmry smryFile(argv[f]);
|
||||
if (!smryFile.make_lodsmry_file()){
|
||||
std::cout << "\n! Warning, smspec already have one lod file, existing kept use option -f to replace this" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
auto lap1 = std::chrono::system_clock::now();
|
||||
std::chrono::duration<double> elapsed_seconds1 = lap1-lap0;
|
||||
std::cout << "\nruntime for creating " << (argc-argOffset) << " LODSMRY files: " << elapsed_seconds1.count() << " seconds\n" << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
|
||||
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||
|
||||
#include <opm/msim/msim.hpp>
|
||||
|
||||
@@ -38,10 +39,12 @@ int main(int /* argc */, char** argv) {
|
||||
Opm::ErrorGuard error_guard;
|
||||
auto python = std::make_shared<Opm::Python>();
|
||||
|
||||
Opm::OpmLog::setupSimpleDefaultLogging();
|
||||
Opm::Deck deck = parser.parseFile(deck_file, parse_context, error_guard);
|
||||
Opm::EclipseState state(deck);
|
||||
Opm::Schedule schedule(deck, state, parse_context, error_guard, python);
|
||||
Opm::SummaryConfig summary_config(deck, schedule, state.getTableManager(), parse_context, error_guard);
|
||||
Opm::SummaryConfig summary_config(deck, schedule, state.getTableManager(), state.aquifer(),
|
||||
parse_context, error_guard);
|
||||
|
||||
if (error_guard) {
|
||||
error_guard.dump();
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
*/
|
||||
#include <getopt.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <vector>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
|
||||
@@ -85,12 +85,11 @@ std::size_t deck_hash(const std::vector<keyword>& keywords) {
|
||||
void print_keywords(const std::vector<keyword>& keywords, bool location_info) {
|
||||
for (const auto& kw : keywords) {
|
||||
if (location_info)
|
||||
std::cout << std::setw(8) << std::left << kw.name << " : " << kw.filename << ":" << kw.line_number << " " << kw.content_hash << std::endl;
|
||||
fmt::print("{:8s} : {}:{} {} \n", kw.name, kw.filename, kw.line_number, kw.content_hash);
|
||||
else
|
||||
std::cout << std::setw(8) << std::left << kw.name << " : " << kw.content_hash << std::endl;
|
||||
fmt::print("{:8s} : {} \n", kw.name, kw.content_hash);
|
||||
}
|
||||
std::cout << std::endl;
|
||||
std::cout << std::setw(8) << std::left << "Total" << " : " << deck_hash(keywords) << std::endl;
|
||||
fmt::print("\n{:8s} : {}\n", "Total", deck_hash(keywords));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -70,7 +70,8 @@ inline void loadDeck( const char * deck_file) {
|
||||
std::cout << "creating SummaryConfig .... "; std::cout.flush();
|
||||
|
||||
start = std::chrono::system_clock::now();
|
||||
Opm::SummaryConfig summary( deck, schedule, state.getTableManager( ), parseContext, errors );
|
||||
Opm::SummaryConfig summary( deck, schedule, state.getTableManager( ), state.aquifer(),
|
||||
parseContext, errors );
|
||||
auto summary_time = std::chrono::system_clock::now() - start;
|
||||
|
||||
std::cout << "complete." << std::endl << std::endl;
|
||||
|
||||
135
examples/wellgraph.cpp
Normal file
135
examples/wellgraph.cpp
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
Copyright 2013, 2020 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <chrono>
|
||||
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
||||
#include <opm/parser/eclipse/Python/Python.hpp>
|
||||
|
||||
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||
#include <opm/common/OpmLog/StreamLog.hpp>
|
||||
#include <opm/common/OpmLog/LogUtil.hpp>
|
||||
#include <opm/common/utility/FileSystem.hpp>
|
||||
|
||||
|
||||
inline void createDot(const Opm::Schedule& schedule, const std::string& casename)
|
||||
{
|
||||
std::cout << "Writing " << casename << ".gv .... "; std::cout.flush();
|
||||
std::ofstream os(casename + ".gv");
|
||||
os << "// This file was written by the 'wellgraph' utility from OPM.\n";
|
||||
os << "// Find the source code at github.com/OPM.\n";
|
||||
os << "// Convert output to PDF with 'dot -Tpdf " << casename << ".gv > " << casename << ".pdf'\n";
|
||||
os << "strict digraph \"" << casename << "\"\n{\n";
|
||||
const auto groupnames = schedule.groupNames();
|
||||
const std::size_t last = schedule.getTimeMap().last();
|
||||
// Group -> Group relations.
|
||||
for (const auto& gn : groupnames) {
|
||||
const auto& g = schedule.getGroup(gn, last);
|
||||
const auto& children = g.groups();
|
||||
if (!children.empty()) {
|
||||
os << " \"" << gn << "\" -> {";
|
||||
for (const auto& child : children) {
|
||||
os << " \"" << child << '"';
|
||||
}
|
||||
os << " }\n";
|
||||
}
|
||||
}
|
||||
// Group -> Well relations.
|
||||
os << " node [shape=box]\n";
|
||||
for (const auto& gn : groupnames) {
|
||||
const auto& g = schedule.getGroup(gn, last);
|
||||
const auto& children = g.wells();
|
||||
if (!children.empty()) {
|
||||
os << " \"" << gn << "\" -> {";
|
||||
for (const auto& child : children) {
|
||||
os << " \"" << child << '"';
|
||||
}
|
||||
os << " }\n";
|
||||
}
|
||||
}
|
||||
// Color wells by injector or producer.
|
||||
for (const auto& w : schedule.getWellsatEnd()) {
|
||||
os << " \"" << w.name() << '"';
|
||||
if (w.isProducer() && w.isInjector()) {
|
||||
os << " [color=purple]\n";
|
||||
} else if (w.isProducer()) {
|
||||
os << " [color=red]\n";
|
||||
} else {
|
||||
os << " [color=blue]\n";
|
||||
}
|
||||
}
|
||||
os << "}\n";
|
||||
std::cout << "complete." << std::endl;
|
||||
}
|
||||
|
||||
|
||||
inline Opm::Schedule loadSchedule(const std::string& deck_file)
|
||||
{
|
||||
Opm::ParseContext parseContext({{Opm::ParseContext::PARSE_RANDOM_SLASH, Opm::InputError::IGNORE},
|
||||
{Opm::ParseContext::PARSE_MISSING_DIMS_KEYWORD, Opm::InputError::WARN},
|
||||
{Opm::ParseContext::SUMMARY_UNKNOWN_WELL, Opm::InputError::WARN},
|
||||
{Opm::ParseContext::SUMMARY_UNKNOWN_GROUP, Opm::InputError::WARN}});
|
||||
Opm::ErrorGuard errors;
|
||||
Opm::Parser parser;
|
||||
auto python = std::make_shared<Opm::Python>();
|
||||
|
||||
std::cout << "Loading and parsing deck: " << deck_file << " ..... "; std::cout.flush();
|
||||
auto deck = parser.parseFile(deck_file, parseContext, errors);
|
||||
std::cout << "complete.\n";
|
||||
|
||||
std::cout << "Creating EclipseState .... "; std::cout.flush();
|
||||
Opm::EclipseState state( deck );
|
||||
std::cout << "complete.\n";
|
||||
|
||||
std::cout << "Creating Schedule .... "; std::cout.flush();
|
||||
Opm::Schedule schedule( deck, state, python);
|
||||
std::cout << "complete." << std::endl;
|
||||
|
||||
return schedule;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::ostringstream os;
|
||||
std::shared_ptr<Opm::StreamLog> string_log = std::make_shared<Opm::StreamLog>(os, Opm::Log::DefaultMessageTypes);
|
||||
Opm::OpmLog::addBackend( "STRING" , string_log);
|
||||
try {
|
||||
for (int iarg = 1; iarg < argc; iarg++) {
|
||||
const std::string filename = argv[iarg];
|
||||
const auto sched = loadSchedule(filename);
|
||||
const auto casename = Opm::filesystem::path(filename).stem();
|
||||
createDot(sched, casename);
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
std::cout << "\n\n***** Caught an exception: " << e.what() << std::endl;
|
||||
std::cout << "\n\n***** Printing log: "<< std::endl;
|
||||
std::cout << os.str();
|
||||
std::cout << "\n\n***** Exiting due to errors." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
27
external/fmtlib/LICENSE.rst
vendored
Normal file
27
external/fmtlib/LICENSE.rst
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
Copyright (c) 2012 - present, Victor Zverovich
|
||||
|
||||
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.
|
||||
|
||||
--- Optional exception to the license ---
|
||||
|
||||
As an exception, if, as a result of your compiling your source code, portions
|
||||
of this Software are embedded into a machine-executable object form of such
|
||||
source code, you may redistribute such embedded portions in such object form
|
||||
without including the above copyright and permission notices.
|
||||
12
external/fmtlib/README.opm
vendored
Normal file
12
external/fmtlib/README.opm
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
The include/ directory is a copy of the include directory from version 7.0.3 of
|
||||
the fmtlib distribution. The fmtlib can be found at https://github.com/fmtlib/fmt
|
||||
|
||||
The fmtlib code embedded here should be compiled in header only mode, to ensure
|
||||
that the symbol FMT_HEADER_ONLY must be defined before the the fmt/format.h
|
||||
header is included:
|
||||
|
||||
#define FMT_HEADER_ONLY
|
||||
#include <fmt/format.h>
|
||||
|
||||
....
|
||||
auto msg = fmt::format("Hello {}", "world");
|
||||
1123
external/fmtlib/include/fmt/chrono.h
vendored
Normal file
1123
external/fmtlib/include/fmt/chrono.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
566
external/fmtlib/include/fmt/color.h
vendored
Normal file
566
external/fmtlib/include/fmt/color.h
vendored
Normal file
@@ -0,0 +1,566 @@
|
||||
// Formatting library for C++ - color support
|
||||
//
|
||||
// Copyright (c) 2018 - present, Victor Zverovich and fmt contributors
|
||||
// All rights reserved.
|
||||
//
|
||||
// For the license information refer to format.h.
|
||||
|
||||
#ifndef FMT_COLOR_H_
|
||||
#define FMT_COLOR_H_
|
||||
|
||||
#include "format.h"
|
||||
|
||||
FMT_BEGIN_NAMESPACE
|
||||
|
||||
enum class color : uint32_t {
|
||||
alice_blue = 0xF0F8FF, // rgb(240,248,255)
|
||||
antique_white = 0xFAEBD7, // rgb(250,235,215)
|
||||
aqua = 0x00FFFF, // rgb(0,255,255)
|
||||
aquamarine = 0x7FFFD4, // rgb(127,255,212)
|
||||
azure = 0xF0FFFF, // rgb(240,255,255)
|
||||
beige = 0xF5F5DC, // rgb(245,245,220)
|
||||
bisque = 0xFFE4C4, // rgb(255,228,196)
|
||||
black = 0x000000, // rgb(0,0,0)
|
||||
blanched_almond = 0xFFEBCD, // rgb(255,235,205)
|
||||
blue = 0x0000FF, // rgb(0,0,255)
|
||||
blue_violet = 0x8A2BE2, // rgb(138,43,226)
|
||||
brown = 0xA52A2A, // rgb(165,42,42)
|
||||
burly_wood = 0xDEB887, // rgb(222,184,135)
|
||||
cadet_blue = 0x5F9EA0, // rgb(95,158,160)
|
||||
chartreuse = 0x7FFF00, // rgb(127,255,0)
|
||||
chocolate = 0xD2691E, // rgb(210,105,30)
|
||||
coral = 0xFF7F50, // rgb(255,127,80)
|
||||
cornflower_blue = 0x6495ED, // rgb(100,149,237)
|
||||
cornsilk = 0xFFF8DC, // rgb(255,248,220)
|
||||
crimson = 0xDC143C, // rgb(220,20,60)
|
||||
cyan = 0x00FFFF, // rgb(0,255,255)
|
||||
dark_blue = 0x00008B, // rgb(0,0,139)
|
||||
dark_cyan = 0x008B8B, // rgb(0,139,139)
|
||||
dark_golden_rod = 0xB8860B, // rgb(184,134,11)
|
||||
dark_gray = 0xA9A9A9, // rgb(169,169,169)
|
||||
dark_green = 0x006400, // rgb(0,100,0)
|
||||
dark_khaki = 0xBDB76B, // rgb(189,183,107)
|
||||
dark_magenta = 0x8B008B, // rgb(139,0,139)
|
||||
dark_olive_green = 0x556B2F, // rgb(85,107,47)
|
||||
dark_orange = 0xFF8C00, // rgb(255,140,0)
|
||||
dark_orchid = 0x9932CC, // rgb(153,50,204)
|
||||
dark_red = 0x8B0000, // rgb(139,0,0)
|
||||
dark_salmon = 0xE9967A, // rgb(233,150,122)
|
||||
dark_sea_green = 0x8FBC8F, // rgb(143,188,143)
|
||||
dark_slate_blue = 0x483D8B, // rgb(72,61,139)
|
||||
dark_slate_gray = 0x2F4F4F, // rgb(47,79,79)
|
||||
dark_turquoise = 0x00CED1, // rgb(0,206,209)
|
||||
dark_violet = 0x9400D3, // rgb(148,0,211)
|
||||
deep_pink = 0xFF1493, // rgb(255,20,147)
|
||||
deep_sky_blue = 0x00BFFF, // rgb(0,191,255)
|
||||
dim_gray = 0x696969, // rgb(105,105,105)
|
||||
dodger_blue = 0x1E90FF, // rgb(30,144,255)
|
||||
fire_brick = 0xB22222, // rgb(178,34,34)
|
||||
floral_white = 0xFFFAF0, // rgb(255,250,240)
|
||||
forest_green = 0x228B22, // rgb(34,139,34)
|
||||
fuchsia = 0xFF00FF, // rgb(255,0,255)
|
||||
gainsboro = 0xDCDCDC, // rgb(220,220,220)
|
||||
ghost_white = 0xF8F8FF, // rgb(248,248,255)
|
||||
gold = 0xFFD700, // rgb(255,215,0)
|
||||
golden_rod = 0xDAA520, // rgb(218,165,32)
|
||||
gray = 0x808080, // rgb(128,128,128)
|
||||
green = 0x008000, // rgb(0,128,0)
|
||||
green_yellow = 0xADFF2F, // rgb(173,255,47)
|
||||
honey_dew = 0xF0FFF0, // rgb(240,255,240)
|
||||
hot_pink = 0xFF69B4, // rgb(255,105,180)
|
||||
indian_red = 0xCD5C5C, // rgb(205,92,92)
|
||||
indigo = 0x4B0082, // rgb(75,0,130)
|
||||
ivory = 0xFFFFF0, // rgb(255,255,240)
|
||||
khaki = 0xF0E68C, // rgb(240,230,140)
|
||||
lavender = 0xE6E6FA, // rgb(230,230,250)
|
||||
lavender_blush = 0xFFF0F5, // rgb(255,240,245)
|
||||
lawn_green = 0x7CFC00, // rgb(124,252,0)
|
||||
lemon_chiffon = 0xFFFACD, // rgb(255,250,205)
|
||||
light_blue = 0xADD8E6, // rgb(173,216,230)
|
||||
light_coral = 0xF08080, // rgb(240,128,128)
|
||||
light_cyan = 0xE0FFFF, // rgb(224,255,255)
|
||||
light_golden_rod_yellow = 0xFAFAD2, // rgb(250,250,210)
|
||||
light_gray = 0xD3D3D3, // rgb(211,211,211)
|
||||
light_green = 0x90EE90, // rgb(144,238,144)
|
||||
light_pink = 0xFFB6C1, // rgb(255,182,193)
|
||||
light_salmon = 0xFFA07A, // rgb(255,160,122)
|
||||
light_sea_green = 0x20B2AA, // rgb(32,178,170)
|
||||
light_sky_blue = 0x87CEFA, // rgb(135,206,250)
|
||||
light_slate_gray = 0x778899, // rgb(119,136,153)
|
||||
light_steel_blue = 0xB0C4DE, // rgb(176,196,222)
|
||||
light_yellow = 0xFFFFE0, // rgb(255,255,224)
|
||||
lime = 0x00FF00, // rgb(0,255,0)
|
||||
lime_green = 0x32CD32, // rgb(50,205,50)
|
||||
linen = 0xFAF0E6, // rgb(250,240,230)
|
||||
magenta = 0xFF00FF, // rgb(255,0,255)
|
||||
maroon = 0x800000, // rgb(128,0,0)
|
||||
medium_aquamarine = 0x66CDAA, // rgb(102,205,170)
|
||||
medium_blue = 0x0000CD, // rgb(0,0,205)
|
||||
medium_orchid = 0xBA55D3, // rgb(186,85,211)
|
||||
medium_purple = 0x9370DB, // rgb(147,112,219)
|
||||
medium_sea_green = 0x3CB371, // rgb(60,179,113)
|
||||
medium_slate_blue = 0x7B68EE, // rgb(123,104,238)
|
||||
medium_spring_green = 0x00FA9A, // rgb(0,250,154)
|
||||
medium_turquoise = 0x48D1CC, // rgb(72,209,204)
|
||||
medium_violet_red = 0xC71585, // rgb(199,21,133)
|
||||
midnight_blue = 0x191970, // rgb(25,25,112)
|
||||
mint_cream = 0xF5FFFA, // rgb(245,255,250)
|
||||
misty_rose = 0xFFE4E1, // rgb(255,228,225)
|
||||
moccasin = 0xFFE4B5, // rgb(255,228,181)
|
||||
navajo_white = 0xFFDEAD, // rgb(255,222,173)
|
||||
navy = 0x000080, // rgb(0,0,128)
|
||||
old_lace = 0xFDF5E6, // rgb(253,245,230)
|
||||
olive = 0x808000, // rgb(128,128,0)
|
||||
olive_drab = 0x6B8E23, // rgb(107,142,35)
|
||||
orange = 0xFFA500, // rgb(255,165,0)
|
||||
orange_red = 0xFF4500, // rgb(255,69,0)
|
||||
orchid = 0xDA70D6, // rgb(218,112,214)
|
||||
pale_golden_rod = 0xEEE8AA, // rgb(238,232,170)
|
||||
pale_green = 0x98FB98, // rgb(152,251,152)
|
||||
pale_turquoise = 0xAFEEEE, // rgb(175,238,238)
|
||||
pale_violet_red = 0xDB7093, // rgb(219,112,147)
|
||||
papaya_whip = 0xFFEFD5, // rgb(255,239,213)
|
||||
peach_puff = 0xFFDAB9, // rgb(255,218,185)
|
||||
peru = 0xCD853F, // rgb(205,133,63)
|
||||
pink = 0xFFC0CB, // rgb(255,192,203)
|
||||
plum = 0xDDA0DD, // rgb(221,160,221)
|
||||
powder_blue = 0xB0E0E6, // rgb(176,224,230)
|
||||
purple = 0x800080, // rgb(128,0,128)
|
||||
rebecca_purple = 0x663399, // rgb(102,51,153)
|
||||
red = 0xFF0000, // rgb(255,0,0)
|
||||
rosy_brown = 0xBC8F8F, // rgb(188,143,143)
|
||||
royal_blue = 0x4169E1, // rgb(65,105,225)
|
||||
saddle_brown = 0x8B4513, // rgb(139,69,19)
|
||||
salmon = 0xFA8072, // rgb(250,128,114)
|
||||
sandy_brown = 0xF4A460, // rgb(244,164,96)
|
||||
sea_green = 0x2E8B57, // rgb(46,139,87)
|
||||
sea_shell = 0xFFF5EE, // rgb(255,245,238)
|
||||
sienna = 0xA0522D, // rgb(160,82,45)
|
||||
silver = 0xC0C0C0, // rgb(192,192,192)
|
||||
sky_blue = 0x87CEEB, // rgb(135,206,235)
|
||||
slate_blue = 0x6A5ACD, // rgb(106,90,205)
|
||||
slate_gray = 0x708090, // rgb(112,128,144)
|
||||
snow = 0xFFFAFA, // rgb(255,250,250)
|
||||
spring_green = 0x00FF7F, // rgb(0,255,127)
|
||||
steel_blue = 0x4682B4, // rgb(70,130,180)
|
||||
tan = 0xD2B48C, // rgb(210,180,140)
|
||||
teal = 0x008080, // rgb(0,128,128)
|
||||
thistle = 0xD8BFD8, // rgb(216,191,216)
|
||||
tomato = 0xFF6347, // rgb(255,99,71)
|
||||
turquoise = 0x40E0D0, // rgb(64,224,208)
|
||||
violet = 0xEE82EE, // rgb(238,130,238)
|
||||
wheat = 0xF5DEB3, // rgb(245,222,179)
|
||||
white = 0xFFFFFF, // rgb(255,255,255)
|
||||
white_smoke = 0xF5F5F5, // rgb(245,245,245)
|
||||
yellow = 0xFFFF00, // rgb(255,255,0)
|
||||
yellow_green = 0x9ACD32 // rgb(154,205,50)
|
||||
}; // enum class color
|
||||
|
||||
enum class terminal_color : uint8_t {
|
||||
black = 30,
|
||||
red,
|
||||
green,
|
||||
yellow,
|
||||
blue,
|
||||
magenta,
|
||||
cyan,
|
||||
white,
|
||||
bright_black = 90,
|
||||
bright_red,
|
||||
bright_green,
|
||||
bright_yellow,
|
||||
bright_blue,
|
||||
bright_magenta,
|
||||
bright_cyan,
|
||||
bright_white
|
||||
};
|
||||
|
||||
enum class emphasis : uint8_t {
|
||||
bold = 1,
|
||||
italic = 1 << 1,
|
||||
underline = 1 << 2,
|
||||
strikethrough = 1 << 3
|
||||
};
|
||||
|
||||
// rgb is a struct for red, green and blue colors.
|
||||
// Using the name "rgb" makes some editors show the color in a tooltip.
|
||||
struct rgb {
|
||||
FMT_CONSTEXPR rgb() : r(0), g(0), b(0) {}
|
||||
FMT_CONSTEXPR rgb(uint8_t r_, uint8_t g_, uint8_t b_) : r(r_), g(g_), b(b_) {}
|
||||
FMT_CONSTEXPR rgb(uint32_t hex)
|
||||
: r((hex >> 16) & 0xFF), g((hex >> 8) & 0xFF), b(hex & 0xFF) {}
|
||||
FMT_CONSTEXPR rgb(color hex)
|
||||
: r((uint32_t(hex) >> 16) & 0xFF),
|
||||
g((uint32_t(hex) >> 8) & 0xFF),
|
||||
b(uint32_t(hex) & 0xFF) {}
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
// color is a struct of either a rgb color or a terminal color.
|
||||
struct color_type {
|
||||
FMT_CONSTEXPR color_type() FMT_NOEXCEPT : is_rgb(), value{} {}
|
||||
FMT_CONSTEXPR color_type(color rgb_color) FMT_NOEXCEPT : is_rgb(true),
|
||||
value{} {
|
||||
value.rgb_color = static_cast<uint32_t>(rgb_color);
|
||||
}
|
||||
FMT_CONSTEXPR color_type(rgb rgb_color) FMT_NOEXCEPT : is_rgb(true), value{} {
|
||||
value.rgb_color = (static_cast<uint32_t>(rgb_color.r) << 16) |
|
||||
(static_cast<uint32_t>(rgb_color.g) << 8) | rgb_color.b;
|
||||
}
|
||||
FMT_CONSTEXPR color_type(terminal_color term_color) FMT_NOEXCEPT : is_rgb(),
|
||||
value{} {
|
||||
value.term_color = static_cast<uint8_t>(term_color);
|
||||
}
|
||||
bool is_rgb;
|
||||
union color_union {
|
||||
uint8_t term_color;
|
||||
uint32_t rgb_color;
|
||||
} value;
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
// Experimental text formatting support.
|
||||
class text_style {
|
||||
public:
|
||||
FMT_CONSTEXPR text_style(emphasis em = emphasis()) FMT_NOEXCEPT
|
||||
: set_foreground_color(),
|
||||
set_background_color(),
|
||||
ems(em) {}
|
||||
|
||||
FMT_CONSTEXPR text_style& operator|=(const text_style& rhs) {
|
||||
if (!set_foreground_color) {
|
||||
set_foreground_color = rhs.set_foreground_color;
|
||||
foreground_color = rhs.foreground_color;
|
||||
} else if (rhs.set_foreground_color) {
|
||||
if (!foreground_color.is_rgb || !rhs.foreground_color.is_rgb)
|
||||
FMT_THROW(format_error("can't OR a terminal color"));
|
||||
foreground_color.value.rgb_color |= rhs.foreground_color.value.rgb_color;
|
||||
}
|
||||
|
||||
if (!set_background_color) {
|
||||
set_background_color = rhs.set_background_color;
|
||||
background_color = rhs.background_color;
|
||||
} else if (rhs.set_background_color) {
|
||||
if (!background_color.is_rgb || !rhs.background_color.is_rgb)
|
||||
FMT_THROW(format_error("can't OR a terminal color"));
|
||||
background_color.value.rgb_color |= rhs.background_color.value.rgb_color;
|
||||
}
|
||||
|
||||
ems = static_cast<emphasis>(static_cast<uint8_t>(ems) |
|
||||
static_cast<uint8_t>(rhs.ems));
|
||||
return *this;
|
||||
}
|
||||
|
||||
friend FMT_CONSTEXPR text_style operator|(text_style lhs,
|
||||
const text_style& rhs) {
|
||||
return lhs |= rhs;
|
||||
}
|
||||
|
||||
FMT_CONSTEXPR text_style& operator&=(const text_style& rhs) {
|
||||
if (!set_foreground_color) {
|
||||
set_foreground_color = rhs.set_foreground_color;
|
||||
foreground_color = rhs.foreground_color;
|
||||
} else if (rhs.set_foreground_color) {
|
||||
if (!foreground_color.is_rgb || !rhs.foreground_color.is_rgb)
|
||||
FMT_THROW(format_error("can't AND a terminal color"));
|
||||
foreground_color.value.rgb_color &= rhs.foreground_color.value.rgb_color;
|
||||
}
|
||||
|
||||
if (!set_background_color) {
|
||||
set_background_color = rhs.set_background_color;
|
||||
background_color = rhs.background_color;
|
||||
} else if (rhs.set_background_color) {
|
||||
if (!background_color.is_rgb || !rhs.background_color.is_rgb)
|
||||
FMT_THROW(format_error("can't AND a terminal color"));
|
||||
background_color.value.rgb_color &= rhs.background_color.value.rgb_color;
|
||||
}
|
||||
|
||||
ems = static_cast<emphasis>(static_cast<uint8_t>(ems) &
|
||||
static_cast<uint8_t>(rhs.ems));
|
||||
return *this;
|
||||
}
|
||||
|
||||
friend FMT_CONSTEXPR text_style operator&(text_style lhs,
|
||||
const text_style& rhs) {
|
||||
return lhs &= rhs;
|
||||
}
|
||||
|
||||
FMT_CONSTEXPR bool has_foreground() const FMT_NOEXCEPT {
|
||||
return set_foreground_color;
|
||||
}
|
||||
FMT_CONSTEXPR bool has_background() const FMT_NOEXCEPT {
|
||||
return set_background_color;
|
||||
}
|
||||
FMT_CONSTEXPR bool has_emphasis() const FMT_NOEXCEPT {
|
||||
return static_cast<uint8_t>(ems) != 0;
|
||||
}
|
||||
FMT_CONSTEXPR detail::color_type get_foreground() const FMT_NOEXCEPT {
|
||||
FMT_ASSERT(has_foreground(), "no foreground specified for this style");
|
||||
return foreground_color;
|
||||
}
|
||||
FMT_CONSTEXPR detail::color_type get_background() const FMT_NOEXCEPT {
|
||||
FMT_ASSERT(has_background(), "no background specified for this style");
|
||||
return background_color;
|
||||
}
|
||||
FMT_CONSTEXPR emphasis get_emphasis() const FMT_NOEXCEPT {
|
||||
FMT_ASSERT(has_emphasis(), "no emphasis specified for this style");
|
||||
return ems;
|
||||
}
|
||||
|
||||
private:
|
||||
FMT_CONSTEXPR text_style(bool is_foreground,
|
||||
detail::color_type text_color) FMT_NOEXCEPT
|
||||
: set_foreground_color(),
|
||||
set_background_color(),
|
||||
ems() {
|
||||
if (is_foreground) {
|
||||
foreground_color = text_color;
|
||||
set_foreground_color = true;
|
||||
} else {
|
||||
background_color = text_color;
|
||||
set_background_color = true;
|
||||
}
|
||||
}
|
||||
|
||||
friend FMT_CONSTEXPR_DECL text_style fg(detail::color_type foreground)
|
||||
FMT_NOEXCEPT;
|
||||
friend FMT_CONSTEXPR_DECL text_style bg(detail::color_type background)
|
||||
FMT_NOEXCEPT;
|
||||
|
||||
detail::color_type foreground_color;
|
||||
detail::color_type background_color;
|
||||
bool set_foreground_color;
|
||||
bool set_background_color;
|
||||
emphasis ems;
|
||||
};
|
||||
|
||||
FMT_CONSTEXPR text_style fg(detail::color_type foreground) FMT_NOEXCEPT {
|
||||
return text_style(/*is_foreground=*/true, foreground);
|
||||
}
|
||||
|
||||
FMT_CONSTEXPR text_style bg(detail::color_type background) FMT_NOEXCEPT {
|
||||
return text_style(/*is_foreground=*/false, background);
|
||||
}
|
||||
|
||||
FMT_CONSTEXPR text_style operator|(emphasis lhs, emphasis rhs) FMT_NOEXCEPT {
|
||||
return text_style(lhs) | rhs;
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename Char> struct ansi_color_escape {
|
||||
FMT_CONSTEXPR ansi_color_escape(detail::color_type text_color,
|
||||
const char* esc) FMT_NOEXCEPT {
|
||||
// If we have a terminal color, we need to output another escape code
|
||||
// sequence.
|
||||
if (!text_color.is_rgb) {
|
||||
bool is_background = esc == detail::data::background_color;
|
||||
uint32_t value = text_color.value.term_color;
|
||||
// Background ASCII codes are the same as the foreground ones but with
|
||||
// 10 more.
|
||||
if (is_background) value += 10u;
|
||||
|
||||
size_t index = 0;
|
||||
buffer[index++] = static_cast<Char>('\x1b');
|
||||
buffer[index++] = static_cast<Char>('[');
|
||||
|
||||
if (value >= 100u) {
|
||||
buffer[index++] = static_cast<Char>('1');
|
||||
value %= 100u;
|
||||
}
|
||||
buffer[index++] = static_cast<Char>('0' + value / 10u);
|
||||
buffer[index++] = static_cast<Char>('0' + value % 10u);
|
||||
|
||||
buffer[index++] = static_cast<Char>('m');
|
||||
buffer[index++] = static_cast<Char>('\0');
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 7; i++) {
|
||||
buffer[i] = static_cast<Char>(esc[i]);
|
||||
}
|
||||
rgb color(text_color.value.rgb_color);
|
||||
to_esc(color.r, buffer + 7, ';');
|
||||
to_esc(color.g, buffer + 11, ';');
|
||||
to_esc(color.b, buffer + 15, 'm');
|
||||
buffer[19] = static_cast<Char>(0);
|
||||
}
|
||||
FMT_CONSTEXPR ansi_color_escape(emphasis em) FMT_NOEXCEPT {
|
||||
uint8_t em_codes[4] = {};
|
||||
uint8_t em_bits = static_cast<uint8_t>(em);
|
||||
if (em_bits & static_cast<uint8_t>(emphasis::bold)) em_codes[0] = 1;
|
||||
if (em_bits & static_cast<uint8_t>(emphasis::italic)) em_codes[1] = 3;
|
||||
if (em_bits & static_cast<uint8_t>(emphasis::underline)) em_codes[2] = 4;
|
||||
if (em_bits & static_cast<uint8_t>(emphasis::strikethrough))
|
||||
em_codes[3] = 9;
|
||||
|
||||
size_t index = 0;
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (!em_codes[i]) continue;
|
||||
buffer[index++] = static_cast<Char>('\x1b');
|
||||
buffer[index++] = static_cast<Char>('[');
|
||||
buffer[index++] = static_cast<Char>('0' + em_codes[i]);
|
||||
buffer[index++] = static_cast<Char>('m');
|
||||
}
|
||||
buffer[index++] = static_cast<Char>(0);
|
||||
}
|
||||
FMT_CONSTEXPR operator const Char*() const FMT_NOEXCEPT { return buffer; }
|
||||
|
||||
FMT_CONSTEXPR const Char* begin() const FMT_NOEXCEPT { return buffer; }
|
||||
FMT_CONSTEXPR const Char* end() const FMT_NOEXCEPT {
|
||||
return buffer + std::char_traits<Char>::length(buffer);
|
||||
}
|
||||
|
||||
private:
|
||||
Char buffer[7u + 3u * 4u + 1u];
|
||||
|
||||
static FMT_CONSTEXPR void to_esc(uint8_t c, Char* out,
|
||||
char delimiter) FMT_NOEXCEPT {
|
||||
out[0] = static_cast<Char>('0' + c / 100);
|
||||
out[1] = static_cast<Char>('0' + c / 10 % 10);
|
||||
out[2] = static_cast<Char>('0' + c % 10);
|
||||
out[3] = static_cast<Char>(delimiter);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Char>
|
||||
FMT_CONSTEXPR ansi_color_escape<Char> make_foreground_color(
|
||||
detail::color_type foreground) FMT_NOEXCEPT {
|
||||
return ansi_color_escape<Char>(foreground, detail::data::foreground_color);
|
||||
}
|
||||
|
||||
template <typename Char>
|
||||
FMT_CONSTEXPR ansi_color_escape<Char> make_background_color(
|
||||
detail::color_type background) FMT_NOEXCEPT {
|
||||
return ansi_color_escape<Char>(background, detail::data::background_color);
|
||||
}
|
||||
|
||||
template <typename Char>
|
||||
FMT_CONSTEXPR ansi_color_escape<Char> make_emphasis(emphasis em) FMT_NOEXCEPT {
|
||||
return ansi_color_escape<Char>(em);
|
||||
}
|
||||
|
||||
template <typename Char>
|
||||
inline void fputs(const Char* chars, FILE* stream) FMT_NOEXCEPT {
|
||||
std::fputs(chars, stream);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline void fputs<wchar_t>(const wchar_t* chars, FILE* stream) FMT_NOEXCEPT {
|
||||
std::fputws(chars, stream);
|
||||
}
|
||||
|
||||
template <typename Char> inline void reset_color(FILE* stream) FMT_NOEXCEPT {
|
||||
fputs(detail::data::reset_color, stream);
|
||||
}
|
||||
|
||||
template <> inline void reset_color<wchar_t>(FILE* stream) FMT_NOEXCEPT {
|
||||
fputs(detail::data::wreset_color, stream);
|
||||
}
|
||||
|
||||
template <typename Char>
|
||||
inline void reset_color(basic_memory_buffer<Char>& buffer) FMT_NOEXCEPT {
|
||||
const char* begin = data::reset_color;
|
||||
const char* end = begin + sizeof(data::reset_color) - 1;
|
||||
buffer.append(begin, end);
|
||||
}
|
||||
|
||||
template <typename Char>
|
||||
void vformat_to(basic_memory_buffer<Char>& buf, const text_style& ts,
|
||||
basic_string_view<Char> format_str,
|
||||
basic_format_args<buffer_context<Char>> args) {
|
||||
bool has_style = false;
|
||||
if (ts.has_emphasis()) {
|
||||
has_style = true;
|
||||
auto emphasis = detail::make_emphasis<Char>(ts.get_emphasis());
|
||||
buf.append(emphasis.begin(), emphasis.end());
|
||||
}
|
||||
if (ts.has_foreground()) {
|
||||
has_style = true;
|
||||
auto foreground = detail::make_foreground_color<Char>(ts.get_foreground());
|
||||
buf.append(foreground.begin(), foreground.end());
|
||||
}
|
||||
if (ts.has_background()) {
|
||||
has_style = true;
|
||||
auto background = detail::make_background_color<Char>(ts.get_background());
|
||||
buf.append(background.begin(), background.end());
|
||||
}
|
||||
detail::vformat_to(buf, format_str, args);
|
||||
if (has_style) detail::reset_color<Char>(buf);
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
template <typename S, typename Char = char_t<S>>
|
||||
void vprint(std::FILE* f, const text_style& ts, const S& format,
|
||||
basic_format_args<buffer_context<Char>> args) {
|
||||
basic_memory_buffer<Char> buf;
|
||||
detail::vformat_to(buf, ts, to_string_view(format), args);
|
||||
buf.push_back(Char(0));
|
||||
detail::fputs(buf.data(), f);
|
||||
}
|
||||
|
||||
/**
|
||||
Formats a string and prints it to the specified file stream using ANSI
|
||||
escape sequences to specify text formatting.
|
||||
Example:
|
||||
fmt::print(fmt::emphasis::bold | fg(fmt::color::red),
|
||||
"Elapsed time: {0:.2f} seconds", 1.23);
|
||||
*/
|
||||
template <typename S, typename... Args,
|
||||
FMT_ENABLE_IF(detail::is_string<S>::value)>
|
||||
void print(std::FILE* f, const text_style& ts, const S& format_str,
|
||||
const Args&... args) {
|
||||
detail::check_format_string<Args...>(format_str);
|
||||
using context = buffer_context<char_t<S>>;
|
||||
format_arg_store<context, Args...> as{args...};
|
||||
vprint(f, ts, format_str, basic_format_args<context>(as));
|
||||
}
|
||||
|
||||
/**
|
||||
Formats a string and prints it to stdout using ANSI escape sequences to
|
||||
specify text formatting.
|
||||
Example:
|
||||
fmt::print(fmt::emphasis::bold | fg(fmt::color::red),
|
||||
"Elapsed time: {0:.2f} seconds", 1.23);
|
||||
*/
|
||||
template <typename S, typename... Args,
|
||||
FMT_ENABLE_IF(detail::is_string<S>::value)>
|
||||
void print(const text_style& ts, const S& format_str, const Args&... args) {
|
||||
return print(stdout, ts, format_str, args...);
|
||||
}
|
||||
|
||||
template <typename S, typename Char = char_t<S>>
|
||||
inline std::basic_string<Char> vformat(
|
||||
const text_style& ts, const S& format_str,
|
||||
basic_format_args<buffer_context<type_identity_t<Char>>> args) {
|
||||
basic_memory_buffer<Char> buf;
|
||||
detail::vformat_to(buf, ts, to_string_view(format_str), args);
|
||||
return fmt::to_string(buf);
|
||||
}
|
||||
|
||||
/**
|
||||
\rst
|
||||
Formats arguments and returns the result as a string using ANSI
|
||||
escape sequences to specify text formatting.
|
||||
|
||||
**Example**::
|
||||
|
||||
#include <fmt/color.h>
|
||||
std::string message = fmt::format(fmt::emphasis::bold | fg(fmt::color::red),
|
||||
"The answer is {}", 42);
|
||||
\endrst
|
||||
*/
|
||||
template <typename S, typename... Args, typename Char = char_t<S>>
|
||||
inline std::basic_string<Char> format(const text_style& ts, const S& format_str,
|
||||
const Args&... args) {
|
||||
return vformat(ts, to_string_view(format_str),
|
||||
detail::make_args_checked<Args...>(format_str, args...));
|
||||
}
|
||||
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
#endif // FMT_COLOR_H_
|
||||
665
external/fmtlib/include/fmt/compile.h
vendored
Normal file
665
external/fmtlib/include/fmt/compile.h
vendored
Normal file
@@ -0,0 +1,665 @@
|
||||
// Formatting library for C++ - experimental format string compilation
|
||||
//
|
||||
// Copyright (c) 2012 - present, Victor Zverovich and fmt contributors
|
||||
// All rights reserved.
|
||||
//
|
||||
// For the license information refer to format.h.
|
||||
|
||||
#ifndef FMT_COMPILE_H_
|
||||
#define FMT_COMPILE_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "format.h"
|
||||
|
||||
FMT_BEGIN_NAMESPACE
|
||||
namespace detail {
|
||||
|
||||
// A compile-time string which is compiled into fast formatting code.
|
||||
class compiled_string {};
|
||||
|
||||
template <typename S>
|
||||
struct is_compiled_string : std::is_base_of<compiled_string, S> {};
|
||||
|
||||
/**
|
||||
\rst
|
||||
Converts a string literal *s* into a format string that will be parsed at
|
||||
compile time and converted into efficient formatting code. Requires C++17
|
||||
``constexpr if`` compiler support.
|
||||
|
||||
**Example**::
|
||||
|
||||
// Converts 42 into std::string using the most efficient method and no
|
||||
// runtime format string processing.
|
||||
std::string s = fmt::format(FMT_COMPILE("{}"), 42);
|
||||
\endrst
|
||||
*/
|
||||
#define FMT_COMPILE(s) FMT_STRING_IMPL(s, fmt::detail::compiled_string)
|
||||
|
||||
template <typename T, typename... Tail>
|
||||
const T& first(const T& value, const Tail&...) {
|
||||
return value;
|
||||
}
|
||||
|
||||
// Part of a compiled format string. It can be either literal text or a
|
||||
// replacement field.
|
||||
template <typename Char> struct format_part {
|
||||
enum class kind { arg_index, arg_name, text, replacement };
|
||||
|
||||
struct replacement {
|
||||
arg_ref<Char> arg_id;
|
||||
dynamic_format_specs<Char> specs;
|
||||
};
|
||||
|
||||
kind part_kind;
|
||||
union value {
|
||||
int arg_index;
|
||||
basic_string_view<Char> str;
|
||||
replacement repl;
|
||||
|
||||
FMT_CONSTEXPR value(int index = 0) : arg_index(index) {}
|
||||
FMT_CONSTEXPR value(basic_string_view<Char> s) : str(s) {}
|
||||
FMT_CONSTEXPR value(replacement r) : repl(r) {}
|
||||
} val;
|
||||
// Position past the end of the argument id.
|
||||
const Char* arg_id_end = nullptr;
|
||||
|
||||
FMT_CONSTEXPR format_part(kind k = kind::arg_index, value v = {})
|
||||
: part_kind(k), val(v) {}
|
||||
|
||||
static FMT_CONSTEXPR format_part make_arg_index(int index) {
|
||||
return format_part(kind::arg_index, index);
|
||||
}
|
||||
static FMT_CONSTEXPR format_part make_arg_name(basic_string_view<Char> name) {
|
||||
return format_part(kind::arg_name, name);
|
||||
}
|
||||
static FMT_CONSTEXPR format_part make_text(basic_string_view<Char> text) {
|
||||
return format_part(kind::text, text);
|
||||
}
|
||||
static FMT_CONSTEXPR format_part make_replacement(replacement repl) {
|
||||
return format_part(kind::replacement, repl);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Char> struct part_counter {
|
||||
unsigned num_parts = 0;
|
||||
|
||||
FMT_CONSTEXPR void on_text(const Char* begin, const Char* end) {
|
||||
if (begin != end) ++num_parts;
|
||||
}
|
||||
|
||||
FMT_CONSTEXPR int on_arg_id() { return ++num_parts, 0; }
|
||||
FMT_CONSTEXPR int on_arg_id(int) { return ++num_parts, 0; }
|
||||
FMT_CONSTEXPR int on_arg_id(basic_string_view<Char>) {
|
||||
return ++num_parts, 0;
|
||||
}
|
||||
|
||||
FMT_CONSTEXPR void on_replacement_field(int, const Char*) {}
|
||||
|
||||
FMT_CONSTEXPR const Char* on_format_specs(int, const Char* begin,
|
||||
const Char* end) {
|
||||
// Find the matching brace.
|
||||
unsigned brace_counter = 0;
|
||||
for (; begin != end; ++begin) {
|
||||
if (*begin == '{') {
|
||||
++brace_counter;
|
||||
} else if (*begin == '}') {
|
||||
if (brace_counter == 0u) break;
|
||||
--brace_counter;
|
||||
}
|
||||
}
|
||||
return begin;
|
||||
}
|
||||
|
||||
FMT_CONSTEXPR void on_error(const char*) {}
|
||||
};
|
||||
|
||||
// Counts the number of parts in a format string.
|
||||
template <typename Char>
|
||||
FMT_CONSTEXPR unsigned count_parts(basic_string_view<Char> format_str) {
|
||||
part_counter<Char> counter;
|
||||
parse_format_string<true>(format_str, counter);
|
||||
return counter.num_parts;
|
||||
}
|
||||
|
||||
template <typename Char, typename PartHandler>
|
||||
class format_string_compiler : public error_handler {
|
||||
private:
|
||||
using part = format_part<Char>;
|
||||
|
||||
PartHandler handler_;
|
||||
part part_;
|
||||
basic_string_view<Char> format_str_;
|
||||
basic_format_parse_context<Char> parse_context_;
|
||||
|
||||
public:
|
||||
FMT_CONSTEXPR format_string_compiler(basic_string_view<Char> format_str,
|
||||
PartHandler handler)
|
||||
: handler_(handler),
|
||||
format_str_(format_str),
|
||||
parse_context_(format_str) {}
|
||||
|
||||
FMT_CONSTEXPR void on_text(const Char* begin, const Char* end) {
|
||||
if (begin != end)
|
||||
handler_(part::make_text({begin, to_unsigned(end - begin)}));
|
||||
}
|
||||
|
||||
FMT_CONSTEXPR int on_arg_id() {
|
||||
part_ = part::make_arg_index(parse_context_.next_arg_id());
|
||||
return 0;
|
||||
}
|
||||
|
||||
FMT_CONSTEXPR int on_arg_id(int id) {
|
||||
parse_context_.check_arg_id(id);
|
||||
part_ = part::make_arg_index(id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
FMT_CONSTEXPR int on_arg_id(basic_string_view<Char> id) {
|
||||
part_ = part::make_arg_name(id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
FMT_CONSTEXPR void on_replacement_field(int, const Char* ptr) {
|
||||
part_.arg_id_end = ptr;
|
||||
handler_(part_);
|
||||
}
|
||||
|
||||
FMT_CONSTEXPR const Char* on_format_specs(int, const Char* begin,
|
||||
const Char* end) {
|
||||
auto repl = typename part::replacement();
|
||||
dynamic_specs_handler<basic_format_parse_context<Char>> handler(
|
||||
repl.specs, parse_context_);
|
||||
auto it = parse_format_specs(begin, end, handler);
|
||||
if (*it != '}') on_error("missing '}' in format string");
|
||||
repl.arg_id = part_.part_kind == part::kind::arg_index
|
||||
? arg_ref<Char>(part_.val.arg_index)
|
||||
: arg_ref<Char>(part_.val.str);
|
||||
auto part = part::make_replacement(repl);
|
||||
part.arg_id_end = begin;
|
||||
handler_(part);
|
||||
return it;
|
||||
}
|
||||
};
|
||||
|
||||
// Compiles a format string and invokes handler(part) for each parsed part.
|
||||
template <bool IS_CONSTEXPR, typename Char, typename PartHandler>
|
||||
FMT_CONSTEXPR void compile_format_string(basic_string_view<Char> format_str,
|
||||
PartHandler handler) {
|
||||
parse_format_string<IS_CONSTEXPR>(
|
||||
format_str,
|
||||
format_string_compiler<Char, PartHandler>(format_str, handler));
|
||||
}
|
||||
|
||||
template <typename OutputIt, typename Context, typename Id>
|
||||
void format_arg(
|
||||
basic_format_parse_context<typename Context::char_type>& parse_ctx,
|
||||
Context& ctx, Id arg_id) {
|
||||
ctx.advance_to(visit_format_arg(
|
||||
arg_formatter<OutputIt, typename Context::char_type>(ctx, &parse_ctx),
|
||||
ctx.arg(arg_id)));
|
||||
}
|
||||
|
||||
// vformat_to is defined in a subnamespace to prevent ADL.
|
||||
namespace cf {
|
||||
template <typename Context, typename OutputIt, typename CompiledFormat>
|
||||
auto vformat_to(OutputIt out, CompiledFormat& cf,
|
||||
basic_format_args<Context> args) -> typename Context::iterator {
|
||||
using char_type = typename Context::char_type;
|
||||
basic_format_parse_context<char_type> parse_ctx(
|
||||
to_string_view(cf.format_str_));
|
||||
Context ctx(out, args);
|
||||
|
||||
const auto& parts = cf.parts();
|
||||
for (auto part_it = std::begin(parts); part_it != std::end(parts);
|
||||
++part_it) {
|
||||
const auto& part = *part_it;
|
||||
const auto& value = part.val;
|
||||
|
||||
using format_part_t = format_part<char_type>;
|
||||
switch (part.part_kind) {
|
||||
case format_part_t::kind::text: {
|
||||
const auto text = value.str;
|
||||
auto output = ctx.out();
|
||||
auto&& it = reserve(output, text.size());
|
||||
it = std::copy_n(text.begin(), text.size(), it);
|
||||
ctx.advance_to(output);
|
||||
break;
|
||||
}
|
||||
|
||||
case format_part_t::kind::arg_index:
|
||||
advance_to(parse_ctx, part.arg_id_end);
|
||||
detail::format_arg<OutputIt>(parse_ctx, ctx, value.arg_index);
|
||||
break;
|
||||
|
||||
case format_part_t::kind::arg_name:
|
||||
advance_to(parse_ctx, part.arg_id_end);
|
||||
detail::format_arg<OutputIt>(parse_ctx, ctx, value.str);
|
||||
break;
|
||||
|
||||
case format_part_t::kind::replacement: {
|
||||
const auto& arg_id_value = value.repl.arg_id.val;
|
||||
const auto arg = value.repl.arg_id.kind == arg_id_kind::index
|
||||
? ctx.arg(arg_id_value.index)
|
||||
: ctx.arg(arg_id_value.name);
|
||||
|
||||
auto specs = value.repl.specs;
|
||||
|
||||
handle_dynamic_spec<width_checker>(specs.width, specs.width_ref, ctx);
|
||||
handle_dynamic_spec<precision_checker>(specs.precision,
|
||||
specs.precision_ref, ctx);
|
||||
|
||||
error_handler h;
|
||||
numeric_specs_checker<error_handler> checker(h, arg.type());
|
||||
if (specs.align == align::numeric) checker.require_numeric_argument();
|
||||
if (specs.sign != sign::none) checker.check_sign();
|
||||
if (specs.alt) checker.require_numeric_argument();
|
||||
if (specs.precision >= 0) checker.check_precision();
|
||||
|
||||
advance_to(parse_ctx, part.arg_id_end);
|
||||
ctx.advance_to(
|
||||
visit_format_arg(arg_formatter<OutputIt, typename Context::char_type>(
|
||||
ctx, nullptr, &specs),
|
||||
arg));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ctx.out();
|
||||
}
|
||||
} // namespace cf
|
||||
|
||||
struct basic_compiled_format {};
|
||||
|
||||
template <typename S, typename = void>
|
||||
struct compiled_format_base : basic_compiled_format {
|
||||
using char_type = char_t<S>;
|
||||
using parts_container = std::vector<detail::format_part<char_type>>;
|
||||
|
||||
parts_container compiled_parts;
|
||||
|
||||
explicit compiled_format_base(basic_string_view<char_type> format_str) {
|
||||
compile_format_string<false>(format_str,
|
||||
[this](const format_part<char_type>& part) {
|
||||
compiled_parts.push_back(part);
|
||||
});
|
||||
}
|
||||
|
||||
const parts_container& parts() const { return compiled_parts; }
|
||||
};
|
||||
|
||||
template <typename Char, unsigned N> struct format_part_array {
|
||||
format_part<Char> data[N] = {};
|
||||
FMT_CONSTEXPR format_part_array() = default;
|
||||
};
|
||||
|
||||
template <typename Char, unsigned N>
|
||||
FMT_CONSTEXPR format_part_array<Char, N> compile_to_parts(
|
||||
basic_string_view<Char> format_str) {
|
||||
format_part_array<Char, N> parts;
|
||||
unsigned counter = 0;
|
||||
// This is not a lambda for compatibility with older compilers.
|
||||
struct {
|
||||
format_part<Char>* parts;
|
||||
unsigned* counter;
|
||||
FMT_CONSTEXPR void operator()(const format_part<Char>& part) {
|
||||
parts[(*counter)++] = part;
|
||||
}
|
||||
} collector{parts.data, &counter};
|
||||
compile_format_string<true>(format_str, collector);
|
||||
if (counter < N) {
|
||||
parts.data[counter] =
|
||||
format_part<Char>::make_text(basic_string_view<Char>());
|
||||
}
|
||||
return parts;
|
||||
}
|
||||
|
||||
template <typename T> constexpr const T& constexpr_max(const T& a, const T& b) {
|
||||
return (a < b) ? b : a;
|
||||
}
|
||||
|
||||
template <typename S>
|
||||
struct compiled_format_base<S, enable_if_t<is_compile_string<S>::value>>
|
||||
: basic_compiled_format {
|
||||
using char_type = char_t<S>;
|
||||
|
||||
FMT_CONSTEXPR explicit compiled_format_base(basic_string_view<char_type>) {}
|
||||
|
||||
// Workaround for old compilers. Format string compilation will not be
|
||||
// performed there anyway.
|
||||
#if FMT_USE_CONSTEXPR
|
||||
static FMT_CONSTEXPR_DECL const unsigned num_format_parts =
|
||||
constexpr_max(count_parts(to_string_view(S())), 1u);
|
||||
#else
|
||||
static const unsigned num_format_parts = 1;
|
||||
#endif
|
||||
|
||||
using parts_container = format_part<char_type>[num_format_parts];
|
||||
|
||||
const parts_container& parts() const {
|
||||
static FMT_CONSTEXPR_DECL const auto compiled_parts =
|
||||
compile_to_parts<char_type, num_format_parts>(
|
||||
detail::to_string_view(S()));
|
||||
return compiled_parts.data;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename S, typename... Args>
|
||||
class compiled_format : private compiled_format_base<S> {
|
||||
public:
|
||||
using typename compiled_format_base<S>::char_type;
|
||||
|
||||
private:
|
||||
basic_string_view<char_type> format_str_;
|
||||
|
||||
template <typename Context, typename OutputIt, typename CompiledFormat>
|
||||
friend auto cf::vformat_to(OutputIt out, CompiledFormat& cf,
|
||||
basic_format_args<Context> args) ->
|
||||
typename Context::iterator;
|
||||
|
||||
public:
|
||||
compiled_format() = delete;
|
||||
explicit constexpr compiled_format(basic_string_view<char_type> format_str)
|
||||
: compiled_format_base<S>(format_str), format_str_(format_str) {}
|
||||
};
|
||||
|
||||
#ifdef __cpp_if_constexpr
|
||||
template <typename... Args> struct type_list {};
|
||||
|
||||
// Returns a reference to the argument at index N from [first, rest...].
|
||||
template <int N, typename T, typename... Args>
|
||||
constexpr const auto& get(const T& first, const Args&... rest) {
|
||||
static_assert(N < 1 + sizeof...(Args), "index is out of bounds");
|
||||
if constexpr (N == 0)
|
||||
return first;
|
||||
else
|
||||
return get<N - 1>(rest...);
|
||||
}
|
||||
|
||||
template <int N, typename> struct get_type_impl;
|
||||
|
||||
template <int N, typename... Args> struct get_type_impl<N, type_list<Args...>> {
|
||||
using type = remove_cvref_t<decltype(get<N>(std::declval<Args>()...))>;
|
||||
};
|
||||
|
||||
template <int N, typename T>
|
||||
using get_type = typename get_type_impl<N, T>::type;
|
||||
|
||||
template <typename T> struct is_compiled_format : std::false_type {};
|
||||
|
||||
template <typename Char> struct text {
|
||||
basic_string_view<Char> data;
|
||||
using char_type = Char;
|
||||
|
||||
template <typename OutputIt, typename... Args>
|
||||
OutputIt format(OutputIt out, const Args&...) const {
|
||||
return write<Char>(out, data);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Char>
|
||||
struct is_compiled_format<text<Char>> : std::true_type {};
|
||||
|
||||
template <typename Char>
|
||||
constexpr text<Char> make_text(basic_string_view<Char> s, size_t pos,
|
||||
size_t size) {
|
||||
return {{&s[pos], size}};
|
||||
}
|
||||
|
||||
// A replacement field that refers to argument N.
|
||||
template <typename Char, typename T, int N> struct field {
|
||||
using char_type = Char;
|
||||
|
||||
template <typename OutputIt, typename... Args>
|
||||
OutputIt format(OutputIt out, const Args&... args) const {
|
||||
// This ensures that the argument type is convertile to `const T&`.
|
||||
const T& arg = get<N>(args...);
|
||||
return write<Char>(out, arg);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Char, typename T, int N>
|
||||
struct is_compiled_format<field<Char, T, N>> : std::true_type {};
|
||||
|
||||
// A replacement field that refers to argument N and has format specifiers.
|
||||
template <typename Char, typename T, int N> struct spec_field {
|
||||
using char_type = Char;
|
||||
mutable formatter<T, Char> fmt;
|
||||
|
||||
template <typename OutputIt, typename... Args>
|
||||
OutputIt format(OutputIt out, const Args&... args) const {
|
||||
// This ensures that the argument type is convertile to `const T&`.
|
||||
const T& arg = get<N>(args...);
|
||||
basic_format_context<OutputIt, Char> ctx(out, {});
|
||||
return fmt.format(arg, ctx);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Char, typename T, int N>
|
||||
struct is_compiled_format<spec_field<Char, T, N>> : std::true_type {};
|
||||
|
||||
template <typename L, typename R> struct concat {
|
||||
L lhs;
|
||||
R rhs;
|
||||
using char_type = typename L::char_type;
|
||||
|
||||
template <typename OutputIt, typename... Args>
|
||||
OutputIt format(OutputIt out, const Args&... args) const {
|
||||
out = lhs.format(out, args...);
|
||||
return rhs.format(out, args...);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename L, typename R>
|
||||
struct is_compiled_format<concat<L, R>> : std::true_type {};
|
||||
|
||||
template <typename L, typename R>
|
||||
constexpr concat<L, R> make_concat(L lhs, R rhs) {
|
||||
return {lhs, rhs};
|
||||
}
|
||||
|
||||
struct unknown_format {};
|
||||
|
||||
template <typename Char>
|
||||
constexpr size_t parse_text(basic_string_view<Char> str, size_t pos) {
|
||||
for (size_t size = str.size(); pos != size; ++pos) {
|
||||
if (str[pos] == '{' || str[pos] == '}') break;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
template <typename Args, size_t POS, int ID, typename S>
|
||||
constexpr auto compile_format_string(S format_str);
|
||||
|
||||
template <typename Args, size_t POS, int ID, typename T, typename S>
|
||||
constexpr auto parse_tail(T head, S format_str) {
|
||||
if constexpr (POS !=
|
||||
basic_string_view<typename S::char_type>(format_str).size()) {
|
||||
constexpr auto tail = compile_format_string<Args, POS, ID>(format_str);
|
||||
if constexpr (std::is_same<remove_cvref_t<decltype(tail)>,
|
||||
unknown_format>())
|
||||
return tail;
|
||||
else
|
||||
return make_concat(head, tail);
|
||||
} else {
|
||||
return head;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, typename Char> struct parse_specs_result {
|
||||
formatter<T, Char> fmt;
|
||||
size_t end;
|
||||
};
|
||||
|
||||
template <typename T, typename Char>
|
||||
constexpr parse_specs_result<T, Char> parse_specs(basic_string_view<Char> str,
|
||||
size_t pos) {
|
||||
str.remove_prefix(pos);
|
||||
auto ctx = basic_format_parse_context<Char>(str);
|
||||
auto f = formatter<T, Char>();
|
||||
auto end = f.parse(ctx);
|
||||
return {f, pos + (end - str.data()) + 1};
|
||||
}
|
||||
|
||||
// Compiles a non-empty format string and returns the compiled representation
|
||||
// or unknown_format() on unrecognized input.
|
||||
template <typename Args, size_t POS, int ID, typename S>
|
||||
constexpr auto compile_format_string(S format_str) {
|
||||
using char_type = typename S::char_type;
|
||||
constexpr basic_string_view<char_type> str = format_str;
|
||||
if constexpr (str[POS] == '{') {
|
||||
if (POS + 1 == str.size())
|
||||
throw format_error("unmatched '{' in format string");
|
||||
if constexpr (str[POS + 1] == '{') {
|
||||
return parse_tail<Args, POS + 2, ID>(make_text(str, POS, 1), format_str);
|
||||
} else if constexpr (str[POS + 1] == '}') {
|
||||
using type = get_type<ID, Args>;
|
||||
return parse_tail<Args, POS + 2, ID + 1>(field<char_type, type, ID>(),
|
||||
format_str);
|
||||
} else if constexpr (str[POS + 1] == ':') {
|
||||
using type = get_type<ID, Args>;
|
||||
constexpr auto result = parse_specs<type>(str, POS + 2);
|
||||
return parse_tail<Args, result.end, ID + 1>(
|
||||
spec_field<char_type, type, ID>{result.fmt}, format_str);
|
||||
} else {
|
||||
return unknown_format();
|
||||
}
|
||||
} else if constexpr (str[POS] == '}') {
|
||||
if (POS + 1 == str.size())
|
||||
throw format_error("unmatched '}' in format string");
|
||||
return parse_tail<Args, POS + 2, ID>(make_text(str, POS, 1), format_str);
|
||||
} else {
|
||||
constexpr auto end = parse_text(str, POS + 1);
|
||||
return parse_tail<Args, end, ID>(make_text(str, POS, end - POS),
|
||||
format_str);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename... Args, typename S,
|
||||
FMT_ENABLE_IF(is_compile_string<S>::value ||
|
||||
detail::is_compiled_string<S>::value)>
|
||||
constexpr auto compile(S format_str) {
|
||||
constexpr basic_string_view<typename S::char_type> str = format_str;
|
||||
if constexpr (str.size() == 0) {
|
||||
return detail::make_text(str, 0, 0);
|
||||
} else {
|
||||
constexpr auto result =
|
||||
detail::compile_format_string<detail::type_list<Args...>, 0, 0>(
|
||||
format_str);
|
||||
if constexpr (std::is_same<remove_cvref_t<decltype(result)>,
|
||||
detail::unknown_format>()) {
|
||||
return detail::compiled_format<S, Args...>(to_string_view(format_str));
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
template <typename... Args, typename S,
|
||||
FMT_ENABLE_IF(is_compile_string<S>::value)>
|
||||
constexpr auto compile(S format_str) -> detail::compiled_format<S, Args...> {
|
||||
return detail::compiled_format<S, Args...>(to_string_view(format_str));
|
||||
}
|
||||
#endif // __cpp_if_constexpr
|
||||
|
||||
// Compiles the format string which must be a string literal.
|
||||
template <typename... Args, typename Char, size_t N>
|
||||
auto compile(const Char (&format_str)[N])
|
||||
-> detail::compiled_format<const Char*, Args...> {
|
||||
return detail::compiled_format<const Char*, Args...>(
|
||||
basic_string_view<Char>(format_str, N - 1));
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
// DEPRECATED! use FMT_COMPILE instead.
|
||||
template <typename... Args>
|
||||
FMT_DEPRECATED auto compile(const Args&... args)
|
||||
-> decltype(detail::compile(args...)) {
|
||||
return detail::compile(args...);
|
||||
}
|
||||
|
||||
#if FMT_USE_CONSTEXPR
|
||||
# ifdef __cpp_if_constexpr
|
||||
|
||||
template <typename CompiledFormat, typename... Args,
|
||||
typename Char = typename CompiledFormat::char_type,
|
||||
FMT_ENABLE_IF(detail::is_compiled_format<CompiledFormat>::value)>
|
||||
FMT_INLINE std::basic_string<Char> format(const CompiledFormat& cf,
|
||||
const Args&... args) {
|
||||
basic_memory_buffer<Char> buffer;
|
||||
detail::buffer<Char>& base = buffer;
|
||||
cf.format(std::back_inserter(base), args...);
|
||||
return to_string(buffer);
|
||||
}
|
||||
|
||||
template <typename OutputIt, typename CompiledFormat, typename... Args,
|
||||
FMT_ENABLE_IF(detail::is_compiled_format<CompiledFormat>::value)>
|
||||
OutputIt format_to(OutputIt out, const CompiledFormat& cf,
|
||||
const Args&... args) {
|
||||
return cf.format(out, args...);
|
||||
}
|
||||
# endif // __cpp_if_constexpr
|
||||
#endif // FMT_USE_CONSTEXPR
|
||||
|
||||
template <typename CompiledFormat, typename... Args,
|
||||
typename Char = typename CompiledFormat::char_type,
|
||||
FMT_ENABLE_IF(std::is_base_of<detail::basic_compiled_format,
|
||||
CompiledFormat>::value)>
|
||||
std::basic_string<Char> format(const CompiledFormat& cf, const Args&... args) {
|
||||
basic_memory_buffer<Char> buffer;
|
||||
using context = buffer_context<Char>;
|
||||
detail::buffer<Char>& base = buffer;
|
||||
detail::cf::vformat_to<context>(std::back_inserter(base), cf,
|
||||
make_format_args<context>(args...));
|
||||
return to_string(buffer);
|
||||
}
|
||||
|
||||
template <typename S, typename... Args,
|
||||
FMT_ENABLE_IF(detail::is_compiled_string<S>::value)>
|
||||
FMT_INLINE std::basic_string<typename S::char_type> format(const S&,
|
||||
Args&&... args) {
|
||||
constexpr basic_string_view<typename S::char_type> str = S();
|
||||
if (str.size() == 2 && str[0] == '{' && str[1] == '}')
|
||||
return fmt::to_string(detail::first(args...));
|
||||
constexpr auto compiled = detail::compile<Args...>(S());
|
||||
return format(compiled, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename OutputIt, typename CompiledFormat, typename... Args,
|
||||
FMT_ENABLE_IF(std::is_base_of<detail::basic_compiled_format,
|
||||
CompiledFormat>::value)>
|
||||
OutputIt format_to(OutputIt out, const CompiledFormat& cf,
|
||||
const Args&... args) {
|
||||
using char_type = typename CompiledFormat::char_type;
|
||||
using context = format_context_t<OutputIt, char_type>;
|
||||
return detail::cf::vformat_to<context>(out, cf,
|
||||
make_format_args<context>(args...));
|
||||
}
|
||||
|
||||
template <typename OutputIt, typename S, typename... Args,
|
||||
FMT_ENABLE_IF(detail::is_compiled_string<S>::value)>
|
||||
OutputIt format_to(OutputIt out, const S&, const Args&... args) {
|
||||
constexpr auto compiled = detail::compile<Args...>(S());
|
||||
return format_to(out, compiled, args...);
|
||||
}
|
||||
|
||||
template <
|
||||
typename OutputIt, typename CompiledFormat, typename... Args,
|
||||
FMT_ENABLE_IF(detail::is_output_iterator<OutputIt>::value&& std::is_base_of<
|
||||
detail::basic_compiled_format, CompiledFormat>::value)>
|
||||
format_to_n_result<OutputIt> format_to_n(OutputIt out, size_t n,
|
||||
const CompiledFormat& cf,
|
||||
const Args&... args) {
|
||||
auto it =
|
||||
format_to(detail::truncating_iterator<OutputIt>(out, n), cf, args...);
|
||||
return {it.base(), it.count()};
|
||||
}
|
||||
|
||||
template <typename CompiledFormat, typename... Args>
|
||||
size_t formatted_size(const CompiledFormat& cf, const Args&... args) {
|
||||
return format_to(detail::counting_iterator(), cf, args...).count();
|
||||
}
|
||||
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
#endif // FMT_COMPILE_H_
|
||||
1882
external/fmtlib/include/fmt/core.h
vendored
Normal file
1882
external/fmtlib/include/fmt/core.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1453
external/fmtlib/include/fmt/format-inl.h
vendored
Normal file
1453
external/fmtlib/include/fmt/format-inl.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3729
external/fmtlib/include/fmt/format.h
vendored
Normal file
3729
external/fmtlib/include/fmt/format.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
78
external/fmtlib/include/fmt/locale.h
vendored
Normal file
78
external/fmtlib/include/fmt/locale.h
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
// Formatting library for C++ - std::locale support
|
||||
//
|
||||
// Copyright (c) 2012 - present, Victor Zverovich
|
||||
// All rights reserved.
|
||||
//
|
||||
// For the license information refer to format.h.
|
||||
|
||||
#ifndef FMT_LOCALE_H_
|
||||
#define FMT_LOCALE_H_
|
||||
|
||||
#include <locale>
|
||||
|
||||
#include "format.h"
|
||||
|
||||
FMT_BEGIN_NAMESPACE
|
||||
|
||||
namespace detail {
|
||||
template <typename Char>
|
||||
typename buffer_context<Char>::iterator vformat_to(
|
||||
const std::locale& loc, buffer<Char>& buf,
|
||||
basic_string_view<Char> format_str,
|
||||
basic_format_args<buffer_context<type_identity_t<Char>>> args) {
|
||||
using af = arg_formatter<typename buffer_context<Char>::iterator, Char>;
|
||||
return vformat_to<af>(std::back_inserter(buf), to_string_view(format_str),
|
||||
args, detail::locale_ref(loc));
|
||||
}
|
||||
|
||||
template <typename Char>
|
||||
std::basic_string<Char> vformat(
|
||||
const std::locale& loc, basic_string_view<Char> format_str,
|
||||
basic_format_args<buffer_context<type_identity_t<Char>>> args) {
|
||||
basic_memory_buffer<Char> buffer;
|
||||
detail::vformat_to(loc, buffer, format_str, args);
|
||||
return fmt::to_string(buffer);
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
template <typename S, typename Char = char_t<S>>
|
||||
inline std::basic_string<Char> vformat(
|
||||
const std::locale& loc, const S& format_str,
|
||||
basic_format_args<buffer_context<type_identity_t<Char>>> args) {
|
||||
return detail::vformat(loc, to_string_view(format_str), args);
|
||||
}
|
||||
|
||||
template <typename S, typename... Args, typename Char = char_t<S>>
|
||||
inline std::basic_string<Char> format(const std::locale& loc,
|
||||
const S& format_str, Args&&... args) {
|
||||
return detail::vformat(
|
||||
loc, to_string_view(format_str),
|
||||
detail::make_args_checked<Args...>(format_str, args...));
|
||||
}
|
||||
|
||||
template <typename S, typename OutputIt, typename... Args,
|
||||
typename Char = enable_if_t<
|
||||
detail::is_output_iterator<OutputIt>::value, char_t<S>>>
|
||||
inline OutputIt vformat_to(
|
||||
OutputIt out, const std::locale& loc, const S& format_str,
|
||||
format_args_t<type_identity_t<OutputIt>, Char> args) {
|
||||
using af = detail::arg_formatter<OutputIt, Char>;
|
||||
return vformat_to<af>(out, to_string_view(format_str), args,
|
||||
detail::locale_ref(loc));
|
||||
}
|
||||
|
||||
template <typename OutputIt, typename S, typename... Args,
|
||||
FMT_ENABLE_IF(detail::is_output_iterator<OutputIt>::value&&
|
||||
detail::is_string<S>::value)>
|
||||
inline OutputIt format_to(OutputIt out, const std::locale& loc,
|
||||
const S& format_str, Args&&... args) {
|
||||
detail::check_format_string<Args...>(format_str);
|
||||
using context = format_context_t<OutputIt, char_t<S>>;
|
||||
format_arg_store<context, Args...> as{args...};
|
||||
return vformat_to(out, loc, to_string_view(format_str),
|
||||
basic_format_args<context>(as));
|
||||
}
|
||||
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
#endif // FMT_LOCALE_H_
|
||||
450
external/fmtlib/include/fmt/os.h
vendored
Normal file
450
external/fmtlib/include/fmt/os.h
vendored
Normal file
@@ -0,0 +1,450 @@
|
||||
// Formatting library for C++ - optional OS-specific functionality
|
||||
//
|
||||
// Copyright (c) 2012 - present, Victor Zverovich
|
||||
// All rights reserved.
|
||||
//
|
||||
// For the license information refer to format.h.
|
||||
|
||||
#ifndef FMT_OS_H_
|
||||
#define FMT_OS_H_
|
||||
|
||||
#if defined(__MINGW32__) || defined(__CYGWIN__)
|
||||
// Workaround MinGW bug https://sourceforge.net/p/mingw/bugs/2024/.
|
||||
# undef __STRICT_ANSI__
|
||||
#endif
|
||||
|
||||
#include <cerrno>
|
||||
#include <clocale> // for locale_t
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <cstdlib> // for strtod_l
|
||||
|
||||
#if defined __APPLE__ || defined(__FreeBSD__)
|
||||
# include <xlocale.h> // for LC_NUMERIC_MASK on OS X
|
||||
#endif
|
||||
|
||||
#include "format.h"
|
||||
|
||||
// UWP doesn't provide _pipe.
|
||||
#if FMT_HAS_INCLUDE("winapifamily.h")
|
||||
# include <winapifamily.h>
|
||||
#endif
|
||||
#if FMT_HAS_INCLUDE("fcntl.h") && \
|
||||
(!defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP))
|
||||
# include <fcntl.h> // for O_RDONLY
|
||||
# define FMT_USE_FCNTL 1
|
||||
#else
|
||||
# define FMT_USE_FCNTL 0
|
||||
#endif
|
||||
|
||||
#ifndef FMT_POSIX
|
||||
# if defined(_WIN32) && !defined(__MINGW32__)
|
||||
// Fix warnings about deprecated symbols.
|
||||
# define FMT_POSIX(call) _##call
|
||||
# else
|
||||
# define FMT_POSIX(call) call
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Calls to system functions are wrapped in FMT_SYSTEM for testability.
|
||||
#ifdef FMT_SYSTEM
|
||||
# define FMT_POSIX_CALL(call) FMT_SYSTEM(call)
|
||||
#else
|
||||
# define FMT_SYSTEM(call) ::call
|
||||
# ifdef _WIN32
|
||||
// Fix warnings about deprecated symbols.
|
||||
# define FMT_POSIX_CALL(call) ::_##call
|
||||
# else
|
||||
# define FMT_POSIX_CALL(call) ::call
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Retries the expression while it evaluates to error_result and errno
|
||||
// equals to EINTR.
|
||||
#ifndef _WIN32
|
||||
# define FMT_RETRY_VAL(result, expression, error_result) \
|
||||
do { \
|
||||
(result) = (expression); \
|
||||
} while ((result) == (error_result) && errno == EINTR)
|
||||
#else
|
||||
# define FMT_RETRY_VAL(result, expression, error_result) result = (expression)
|
||||
#endif
|
||||
|
||||
#define FMT_RETRY(result, expression) FMT_RETRY_VAL(result, expression, -1)
|
||||
|
||||
FMT_BEGIN_NAMESPACE
|
||||
|
||||
/**
|
||||
\rst
|
||||
A reference to a null-terminated string. It can be constructed from a C
|
||||
string or ``std::string``.
|
||||
|
||||
You can use one of the following type aliases for common character types:
|
||||
|
||||
+---------------+-----------------------------+
|
||||
| Type | Definition |
|
||||
+===============+=============================+
|
||||
| cstring_view | basic_cstring_view<char> |
|
||||
+---------------+-----------------------------+
|
||||
| wcstring_view | basic_cstring_view<wchar_t> |
|
||||
+---------------+-----------------------------+
|
||||
|
||||
This class is most useful as a parameter type to allow passing
|
||||
different types of strings to a function, for example::
|
||||
|
||||
template <typename... Args>
|
||||
std::string format(cstring_view format_str, const Args & ... args);
|
||||
|
||||
format("{}", 42);
|
||||
format(std::string("{}"), 42);
|
||||
\endrst
|
||||
*/
|
||||
template <typename Char> class basic_cstring_view {
|
||||
private:
|
||||
const Char* data_;
|
||||
|
||||
public:
|
||||
/** Constructs a string reference object from a C string. */
|
||||
basic_cstring_view(const Char* s) : data_(s) {}
|
||||
|
||||
/**
|
||||
\rst
|
||||
Constructs a string reference from an ``std::string`` object.
|
||||
\endrst
|
||||
*/
|
||||
basic_cstring_view(const std::basic_string<Char>& s) : data_(s.c_str()) {}
|
||||
|
||||
/** Returns the pointer to a C string. */
|
||||
const Char* c_str() const { return data_; }
|
||||
};
|
||||
|
||||
using cstring_view = basic_cstring_view<char>;
|
||||
using wcstring_view = basic_cstring_view<wchar_t>;
|
||||
|
||||
// An error code.
|
||||
class error_code {
|
||||
private:
|
||||
int value_;
|
||||
|
||||
public:
|
||||
explicit error_code(int value = 0) FMT_NOEXCEPT : value_(value) {}
|
||||
|
||||
int get() const FMT_NOEXCEPT { return value_; }
|
||||
};
|
||||
|
||||
#ifdef _WIN32
|
||||
namespace detail {
|
||||
// A converter from UTF-16 to UTF-8.
|
||||
// It is only provided for Windows since other systems support UTF-8 natively.
|
||||
class utf16_to_utf8 {
|
||||
private:
|
||||
memory_buffer buffer_;
|
||||
|
||||
public:
|
||||
utf16_to_utf8() {}
|
||||
FMT_API explicit utf16_to_utf8(wstring_view s);
|
||||
operator string_view() const { return string_view(&buffer_[0], size()); }
|
||||
size_t size() const { return buffer_.size() - 1; }
|
||||
const char* c_str() const { return &buffer_[0]; }
|
||||
std::string str() const { return std::string(&buffer_[0], size()); }
|
||||
|
||||
// Performs conversion returning a system error code instead of
|
||||
// throwing exception on conversion error. This method may still throw
|
||||
// in case of memory allocation error.
|
||||
FMT_API int convert(wstring_view s);
|
||||
};
|
||||
|
||||
FMT_API void format_windows_error(buffer<char>& out, int error_code,
|
||||
string_view message) FMT_NOEXCEPT;
|
||||
} // namespace detail
|
||||
|
||||
/** A Windows error. */
|
||||
class windows_error : public system_error {
|
||||
private:
|
||||
FMT_API void init(int error_code, string_view format_str, format_args args);
|
||||
|
||||
public:
|
||||
/**
|
||||
\rst
|
||||
Constructs a :class:`fmt::windows_error` object with the description
|
||||
of the form
|
||||
|
||||
.. parsed-literal::
|
||||
*<message>*: *<system-message>*
|
||||
|
||||
where *<message>* is the formatted message and *<system-message>* is the
|
||||
system message corresponding to the error code.
|
||||
*error_code* is a Windows error code as given by ``GetLastError``.
|
||||
If *error_code* is not a valid error code such as -1, the system message
|
||||
will look like "error -1".
|
||||
|
||||
**Example**::
|
||||
|
||||
// This throws a windows_error with the description
|
||||
// cannot open file 'madeup': The system cannot find the file specified.
|
||||
// or similar (system message may vary).
|
||||
const char *filename = "madeup";
|
||||
LPOFSTRUCT of = LPOFSTRUCT();
|
||||
HFILE file = OpenFile(filename, &of, OF_READ);
|
||||
if (file == HFILE_ERROR) {
|
||||
throw fmt::windows_error(GetLastError(),
|
||||
"cannot open file '{}'", filename);
|
||||
}
|
||||
\endrst
|
||||
*/
|
||||
template <typename... Args>
|
||||
windows_error(int error_code, string_view message, const Args&... args) {
|
||||
init(error_code, message, make_format_args(args...));
|
||||
}
|
||||
};
|
||||
|
||||
// Reports a Windows error without throwing an exception.
|
||||
// Can be used to report errors from destructors.
|
||||
FMT_API void report_windows_error(int error_code,
|
||||
string_view message) FMT_NOEXCEPT;
|
||||
#endif // _WIN32
|
||||
|
||||
// A buffered file.
|
||||
class buffered_file {
|
||||
private:
|
||||
FILE* file_;
|
||||
|
||||
friend class file;
|
||||
|
||||
explicit buffered_file(FILE* f) : file_(f) {}
|
||||
|
||||
public:
|
||||
buffered_file(const buffered_file&) = delete;
|
||||
void operator=(const buffered_file&) = delete;
|
||||
|
||||
// Constructs a buffered_file object which doesn't represent any file.
|
||||
buffered_file() FMT_NOEXCEPT : file_(nullptr) {}
|
||||
|
||||
// Destroys the object closing the file it represents if any.
|
||||
FMT_API ~buffered_file() FMT_NOEXCEPT;
|
||||
|
||||
public:
|
||||
buffered_file(buffered_file&& other) FMT_NOEXCEPT : file_(other.file_) {
|
||||
other.file_ = nullptr;
|
||||
}
|
||||
|
||||
buffered_file& operator=(buffered_file&& other) {
|
||||
close();
|
||||
file_ = other.file_;
|
||||
other.file_ = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Opens a file.
|
||||
FMT_API buffered_file(cstring_view filename, cstring_view mode);
|
||||
|
||||
// Closes the file.
|
||||
FMT_API void close();
|
||||
|
||||
// Returns the pointer to a FILE object representing this file.
|
||||
FILE* get() const FMT_NOEXCEPT { return file_; }
|
||||
|
||||
// We place parentheses around fileno to workaround a bug in some versions
|
||||
// of MinGW that define fileno as a macro.
|
||||
FMT_API int(fileno)() const;
|
||||
|
||||
void vprint(string_view format_str, format_args args) {
|
||||
fmt::vprint(file_, format_str, args);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
inline void print(string_view format_str, const Args&... args) {
|
||||
vprint(format_str, make_format_args(args...));
|
||||
}
|
||||
};
|
||||
|
||||
#if FMT_USE_FCNTL
|
||||
// A file. Closed file is represented by a file object with descriptor -1.
|
||||
// Methods that are not declared with FMT_NOEXCEPT may throw
|
||||
// fmt::system_error in case of failure. Note that some errors such as
|
||||
// closing the file multiple times will cause a crash on Windows rather
|
||||
// than an exception. You can get standard behavior by overriding the
|
||||
// invalid parameter handler with _set_invalid_parameter_handler.
|
||||
class file {
|
||||
private:
|
||||
int fd_; // File descriptor.
|
||||
|
||||
// Constructs a file object with a given descriptor.
|
||||
explicit file(int fd) : fd_(fd) {}
|
||||
|
||||
public:
|
||||
// Possible values for the oflag argument to the constructor.
|
||||
enum {
|
||||
RDONLY = FMT_POSIX(O_RDONLY), // Open for reading only.
|
||||
WRONLY = FMT_POSIX(O_WRONLY), // Open for writing only.
|
||||
RDWR = FMT_POSIX(O_RDWR), // Open for reading and writing.
|
||||
CREATE = FMT_POSIX(O_CREAT) // Create if the file doesn't exist.
|
||||
};
|
||||
|
||||
// Constructs a file object which doesn't represent any file.
|
||||
file() FMT_NOEXCEPT : fd_(-1) {}
|
||||
|
||||
// Opens a file and constructs a file object representing this file.
|
||||
FMT_API file(cstring_view path, int oflag);
|
||||
|
||||
public:
|
||||
file(const file&) = delete;
|
||||
void operator=(const file&) = delete;
|
||||
|
||||
file(file&& other) FMT_NOEXCEPT : fd_(other.fd_) { other.fd_ = -1; }
|
||||
|
||||
file& operator=(file&& other) FMT_NOEXCEPT {
|
||||
close();
|
||||
fd_ = other.fd_;
|
||||
other.fd_ = -1;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Destroys the object closing the file it represents if any.
|
||||
FMT_API ~file() FMT_NOEXCEPT;
|
||||
|
||||
// Returns the file descriptor.
|
||||
int descriptor() const FMT_NOEXCEPT { return fd_; }
|
||||
|
||||
// Closes the file.
|
||||
FMT_API void close();
|
||||
|
||||
// Returns the file size. The size has signed type for consistency with
|
||||
// stat::st_size.
|
||||
FMT_API long long size() const;
|
||||
|
||||
// Attempts to read count bytes from the file into the specified buffer.
|
||||
FMT_API size_t read(void* buffer, size_t count);
|
||||
|
||||
// Attempts to write count bytes from the specified buffer to the file.
|
||||
FMT_API size_t write(const void* buffer, size_t count);
|
||||
|
||||
// Duplicates a file descriptor with the dup function and returns
|
||||
// the duplicate as a file object.
|
||||
FMT_API static file dup(int fd);
|
||||
|
||||
// Makes fd be the copy of this file descriptor, closing fd first if
|
||||
// necessary.
|
||||
FMT_API void dup2(int fd);
|
||||
|
||||
// Makes fd be the copy of this file descriptor, closing fd first if
|
||||
// necessary.
|
||||
FMT_API void dup2(int fd, error_code& ec) FMT_NOEXCEPT;
|
||||
|
||||
// Creates a pipe setting up read_end and write_end file objects for reading
|
||||
// and writing respectively.
|
||||
FMT_API static void pipe(file& read_end, file& write_end);
|
||||
|
||||
// Creates a buffered_file object associated with this file and detaches
|
||||
// this file object from the file.
|
||||
FMT_API buffered_file fdopen(const char* mode);
|
||||
};
|
||||
|
||||
// Returns the memory page size.
|
||||
long getpagesize();
|
||||
|
||||
class direct_buffered_file;
|
||||
|
||||
template <typename S, typename... Args>
|
||||
void print(direct_buffered_file& f, const S& format_str,
|
||||
const Args&... args);
|
||||
|
||||
// A buffered file with a direct buffer access and no synchronization.
|
||||
class direct_buffered_file {
|
||||
private:
|
||||
file file_;
|
||||
|
||||
enum { buffer_size = 4096 };
|
||||
char buffer_[buffer_size];
|
||||
int pos_;
|
||||
|
||||
void flush() {
|
||||
if (pos_ == 0) return;
|
||||
file_.write(buffer_, pos_);
|
||||
pos_ = 0;
|
||||
}
|
||||
|
||||
int free_capacity() const { return buffer_size - pos_; }
|
||||
|
||||
public:
|
||||
direct_buffered_file(cstring_view path, int oflag)
|
||||
: file_(path, oflag), pos_(0) {}
|
||||
|
||||
~direct_buffered_file() {
|
||||
flush();
|
||||
}
|
||||
|
||||
void close() {
|
||||
flush();
|
||||
file_.close();
|
||||
}
|
||||
|
||||
template <typename S, typename... Args>
|
||||
friend void print(direct_buffered_file& f, const S& format_str,
|
||||
const Args&... args) {
|
||||
// We could avoid double buffering.
|
||||
auto buf = fmt::memory_buffer();
|
||||
fmt::format_to(std::back_inserter(buf), format_str, args...);
|
||||
auto remaining_pos = 0;
|
||||
auto remaining_size = buf.size();
|
||||
while (remaining_size > detail::to_unsigned(f.free_capacity())) {
|
||||
auto size = f.free_capacity();
|
||||
memcpy(f.buffer_ + f.pos_, buf.data() + remaining_pos, size);
|
||||
f.pos_ += size;
|
||||
f.flush();
|
||||
remaining_pos += size;
|
||||
remaining_size -= size;
|
||||
}
|
||||
memcpy(f.buffer_ + f.pos_, buf.data() + remaining_pos, remaining_size);
|
||||
f.pos_ += static_cast<int>(remaining_size);
|
||||
}
|
||||
};
|
||||
#endif // FMT_USE_FCNTL
|
||||
|
||||
#ifdef FMT_LOCALE
|
||||
// A "C" numeric locale.
|
||||
class locale {
|
||||
private:
|
||||
# ifdef _WIN32
|
||||
using locale_t = _locale_t;
|
||||
|
||||
static void freelocale(locale_t loc) { _free_locale(loc); }
|
||||
|
||||
static double strtod_l(const char* nptr, char** endptr, _locale_t loc) {
|
||||
return _strtod_l(nptr, endptr, loc);
|
||||
}
|
||||
# endif
|
||||
|
||||
locale_t locale_;
|
||||
|
||||
public:
|
||||
using type = locale_t;
|
||||
locale(const locale&) = delete;
|
||||
void operator=(const locale&) = delete;
|
||||
|
||||
locale() {
|
||||
# ifndef _WIN32
|
||||
locale_ = FMT_SYSTEM(newlocale(LC_NUMERIC_MASK, "C", nullptr));
|
||||
# else
|
||||
locale_ = _create_locale(LC_NUMERIC, "C");
|
||||
# endif
|
||||
if (!locale_) FMT_THROW(system_error(errno, "cannot create locale"));
|
||||
}
|
||||
~locale() { freelocale(locale_); }
|
||||
|
||||
type get() const { return locale_; }
|
||||
|
||||
// Converts string to floating-point number and advances str past the end
|
||||
// of the parsed input.
|
||||
double strtod(const char*& str) const {
|
||||
char* end = nullptr;
|
||||
double result = strtod_l(str, &end, locale_);
|
||||
str = end;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
using Locale FMT_DEPRECATED_ALIAS = locale;
|
||||
#endif // FMT_LOCALE
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
#endif // FMT_OS_H_
|
||||
167
external/fmtlib/include/fmt/ostream.h
vendored
Normal file
167
external/fmtlib/include/fmt/ostream.h
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
// Formatting library for C++ - std::ostream support
|
||||
//
|
||||
// Copyright (c) 2012 - present, Victor Zverovich
|
||||
// All rights reserved.
|
||||
//
|
||||
// For the license information refer to format.h.
|
||||
|
||||
#ifndef FMT_OSTREAM_H_
|
||||
#define FMT_OSTREAM_H_
|
||||
|
||||
#include <ostream>
|
||||
|
||||
#include "format.h"
|
||||
|
||||
FMT_BEGIN_NAMESPACE
|
||||
|
||||
template <typename Char> class basic_printf_parse_context;
|
||||
template <typename OutputIt, typename Char> class basic_printf_context;
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <class Char> class formatbuf : public std::basic_streambuf<Char> {
|
||||
private:
|
||||
using int_type = typename std::basic_streambuf<Char>::int_type;
|
||||
using traits_type = typename std::basic_streambuf<Char>::traits_type;
|
||||
|
||||
buffer<Char>& buffer_;
|
||||
|
||||
public:
|
||||
formatbuf(buffer<Char>& buf) : buffer_(buf) {}
|
||||
|
||||
protected:
|
||||
// The put-area is actually always empty. This makes the implementation
|
||||
// simpler and has the advantage that the streambuf and the buffer are always
|
||||
// in sync and sputc never writes into uninitialized memory. The obvious
|
||||
// disadvantage is that each call to sputc always results in a (virtual) call
|
||||
// to overflow. There is no disadvantage here for sputn since this always
|
||||
// results in a call to xsputn.
|
||||
|
||||
int_type overflow(int_type ch = traits_type::eof()) FMT_OVERRIDE {
|
||||
if (!traits_type::eq_int_type(ch, traits_type::eof()))
|
||||
buffer_.push_back(static_cast<Char>(ch));
|
||||
return ch;
|
||||
}
|
||||
|
||||
std::streamsize xsputn(const Char* s, std::streamsize count) FMT_OVERRIDE {
|
||||
buffer_.append(s, s + count);
|
||||
return count;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Char> struct test_stream : std::basic_ostream<Char> {
|
||||
private:
|
||||
// Hide all operator<< from std::basic_ostream<Char>.
|
||||
void_t<> operator<<(null<>);
|
||||
void_t<> operator<<(const Char*);
|
||||
|
||||
template <typename T, FMT_ENABLE_IF(std::is_convertible<T, int>::value &&
|
||||
!std::is_enum<T>::value)>
|
||||
void_t<> operator<<(T);
|
||||
};
|
||||
|
||||
// Checks if T has a user-defined operator<< (e.g. not a member of
|
||||
// std::ostream).
|
||||
template <typename T, typename Char> class is_streamable {
|
||||
private:
|
||||
template <typename U>
|
||||
static bool_constant<!std::is_same<decltype(std::declval<test_stream<Char>&>()
|
||||
<< std::declval<U>()),
|
||||
void_t<>>::value>
|
||||
test(int);
|
||||
|
||||
template <typename> static std::false_type test(...);
|
||||
|
||||
using result = decltype(test<T>(0));
|
||||
|
||||
public:
|
||||
static const bool value = result::value;
|
||||
};
|
||||
|
||||
// Write the content of buf to os.
|
||||
template <typename Char>
|
||||
void write_buffer(std::basic_ostream<Char>& os, buffer<Char>& buf) {
|
||||
const Char* buf_data = buf.data();
|
||||
using unsigned_streamsize = std::make_unsigned<std::streamsize>::type;
|
||||
unsigned_streamsize size = buf.size();
|
||||
unsigned_streamsize max_size = to_unsigned(max_value<std::streamsize>());
|
||||
do {
|
||||
unsigned_streamsize n = size <= max_size ? size : max_size;
|
||||
os.write(buf_data, static_cast<std::streamsize>(n));
|
||||
buf_data += n;
|
||||
size -= n;
|
||||
} while (size != 0);
|
||||
}
|
||||
|
||||
template <typename Char, typename T>
|
||||
void format_value(buffer<Char>& buf, const T& value,
|
||||
locale_ref loc = locale_ref()) {
|
||||
formatbuf<Char> format_buf(buf);
|
||||
std::basic_ostream<Char> output(&format_buf);
|
||||
#if !defined(FMT_STATIC_THOUSANDS_SEPARATOR)
|
||||
if (loc) output.imbue(loc.get<std::locale>());
|
||||
#endif
|
||||
output << value;
|
||||
output.exceptions(std::ios_base::failbit | std::ios_base::badbit);
|
||||
buf.resize(buf.size());
|
||||
}
|
||||
|
||||
// Formats an object of type T that has an overloaded ostream operator<<.
|
||||
template <typename T, typename Char>
|
||||
struct fallback_formatter<T, Char, enable_if_t<is_streamable<T, Char>::value>>
|
||||
: private formatter<basic_string_view<Char>, Char> {
|
||||
FMT_CONSTEXPR auto parse(basic_format_parse_context<Char>& ctx)
|
||||
-> decltype(ctx.begin()) {
|
||||
return formatter<basic_string_view<Char>, Char>::parse(ctx);
|
||||
}
|
||||
template <typename ParseCtx,
|
||||
FMT_ENABLE_IF(std::is_same<
|
||||
ParseCtx, basic_printf_parse_context<Char>>::value)>
|
||||
auto parse(ParseCtx& ctx) -> decltype(ctx.begin()) {
|
||||
return ctx.begin();
|
||||
}
|
||||
|
||||
template <typename OutputIt>
|
||||
auto format(const T& value, basic_format_context<OutputIt, Char>& ctx)
|
||||
-> OutputIt {
|
||||
basic_memory_buffer<Char> buffer;
|
||||
format_value(buffer, value, ctx.locale());
|
||||
basic_string_view<Char> str(buffer.data(), buffer.size());
|
||||
return formatter<basic_string_view<Char>, Char>::format(str, ctx);
|
||||
}
|
||||
template <typename OutputIt>
|
||||
auto format(const T& value, basic_printf_context<OutputIt, Char>& ctx)
|
||||
-> OutputIt {
|
||||
basic_memory_buffer<Char> buffer;
|
||||
format_value(buffer, value, ctx.locale());
|
||||
return std::copy(buffer.begin(), buffer.end(), ctx.out());
|
||||
}
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
template <typename Char>
|
||||
void vprint(std::basic_ostream<Char>& os, basic_string_view<Char> format_str,
|
||||
basic_format_args<buffer_context<type_identity_t<Char>>> args) {
|
||||
basic_memory_buffer<Char> buffer;
|
||||
detail::vformat_to(buffer, format_str, args);
|
||||
detail::write_buffer(os, buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
\rst
|
||||
Prints formatted data to the stream *os*.
|
||||
|
||||
**Example**::
|
||||
|
||||
fmt::print(cerr, "Don't {}!", "panic");
|
||||
\endrst
|
||||
*/
|
||||
template <typename S, typename... Args,
|
||||
typename Char = enable_if_t<detail::is_string<S>::value, char_t<S>>>
|
||||
void print(std::basic_ostream<Char>& os, const S& format_str, Args&&... args) {
|
||||
vprint(os, to_string_view(format_str),
|
||||
detail::make_args_checked<Args...>(format_str, args...));
|
||||
}
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
#endif // FMT_OSTREAM_H_
|
||||
2
external/fmtlib/include/fmt/posix.h
vendored
Normal file
2
external/fmtlib/include/fmt/posix.h
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "os.h"
|
||||
#warning "fmt/posix.h is deprecated; use fmt/os.h instead"
|
||||
751
external/fmtlib/include/fmt/printf.h
vendored
Normal file
751
external/fmtlib/include/fmt/printf.h
vendored
Normal file
@@ -0,0 +1,751 @@
|
||||
// Formatting library for C++ - legacy printf implementation
|
||||
//
|
||||
// Copyright (c) 2012 - 2016, Victor Zverovich
|
||||
// All rights reserved.
|
||||
//
|
||||
// For the license information refer to format.h.
|
||||
|
||||
#ifndef FMT_PRINTF_H_
|
||||
#define FMT_PRINTF_H_
|
||||
|
||||
#include <algorithm> // std::max
|
||||
#include <limits> // std::numeric_limits
|
||||
|
||||
#include "ostream.h"
|
||||
|
||||
FMT_BEGIN_NAMESPACE
|
||||
namespace detail {
|
||||
|
||||
// Checks if a value fits in int - used to avoid warnings about comparing
|
||||
// signed and unsigned integers.
|
||||
template <bool IsSigned> struct int_checker {
|
||||
template <typename T> static bool fits_in_int(T value) {
|
||||
unsigned max = max_value<int>();
|
||||
return value <= max;
|
||||
}
|
||||
static bool fits_in_int(bool) { return true; }
|
||||
};
|
||||
|
||||
template <> struct int_checker<true> {
|
||||
template <typename T> static bool fits_in_int(T value) {
|
||||
return value >= (std::numeric_limits<int>::min)() &&
|
||||
value <= max_value<int>();
|
||||
}
|
||||
static bool fits_in_int(int) { return true; }
|
||||
};
|
||||
|
||||
class printf_precision_handler {
|
||||
public:
|
||||
template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
|
||||
int operator()(T value) {
|
||||
if (!int_checker<std::numeric_limits<T>::is_signed>::fits_in_int(value))
|
||||
FMT_THROW(format_error("number is too big"));
|
||||
return (std::max)(static_cast<int>(value), 0);
|
||||
}
|
||||
|
||||
template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
|
||||
int operator()(T) {
|
||||
FMT_THROW(format_error("precision is not integer"));
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
// An argument visitor that returns true iff arg is a zero integer.
|
||||
class is_zero_int {
|
||||
public:
|
||||
template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
|
||||
bool operator()(T value) {
|
||||
return value == 0;
|
||||
}
|
||||
|
||||
template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
|
||||
bool operator()(T) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T> struct make_unsigned_or_bool : std::make_unsigned<T> {};
|
||||
|
||||
template <> struct make_unsigned_or_bool<bool> { using type = bool; };
|
||||
|
||||
template <typename T, typename Context> class arg_converter {
|
||||
private:
|
||||
using char_type = typename Context::char_type;
|
||||
|
||||
basic_format_arg<Context>& arg_;
|
||||
char_type type_;
|
||||
|
||||
public:
|
||||
arg_converter(basic_format_arg<Context>& arg, char_type type)
|
||||
: arg_(arg), type_(type) {}
|
||||
|
||||
void operator()(bool value) {
|
||||
if (type_ != 's') operator()<bool>(value);
|
||||
}
|
||||
|
||||
template <typename U, FMT_ENABLE_IF(std::is_integral<U>::value)>
|
||||
void operator()(U value) {
|
||||
bool is_signed = type_ == 'd' || type_ == 'i';
|
||||
using target_type = conditional_t<std::is_same<T, void>::value, U, T>;
|
||||
if (const_check(sizeof(target_type) <= sizeof(int))) {
|
||||
// Extra casts are used to silence warnings.
|
||||
if (is_signed) {
|
||||
arg_ = detail::make_arg<Context>(
|
||||
static_cast<int>(static_cast<target_type>(value)));
|
||||
} else {
|
||||
using unsigned_type = typename make_unsigned_or_bool<target_type>::type;
|
||||
arg_ = detail::make_arg<Context>(
|
||||
static_cast<unsigned>(static_cast<unsigned_type>(value)));
|
||||
}
|
||||
} else {
|
||||
if (is_signed) {
|
||||
// glibc's printf doesn't sign extend arguments of smaller types:
|
||||
// std::printf("%lld", -42); // prints "4294967254"
|
||||
// but we don't have to do the same because it's a UB.
|
||||
arg_ = detail::make_arg<Context>(static_cast<long long>(value));
|
||||
} else {
|
||||
arg_ = detail::make_arg<Context>(
|
||||
static_cast<typename make_unsigned_or_bool<U>::type>(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename U, FMT_ENABLE_IF(!std::is_integral<U>::value)>
|
||||
void operator()(U) {} // No conversion needed for non-integral types.
|
||||
};
|
||||
|
||||
// Converts an integer argument to T for printf, if T is an integral type.
|
||||
// If T is void, the argument is converted to corresponding signed or unsigned
|
||||
// type depending on the type specifier: 'd' and 'i' - signed, other -
|
||||
// unsigned).
|
||||
template <typename T, typename Context, typename Char>
|
||||
void convert_arg(basic_format_arg<Context>& arg, Char type) {
|
||||
visit_format_arg(arg_converter<T, Context>(arg, type), arg);
|
||||
}
|
||||
|
||||
// Converts an integer argument to char for printf.
|
||||
template <typename Context> class char_converter {
|
||||
private:
|
||||
basic_format_arg<Context>& arg_;
|
||||
|
||||
public:
|
||||
explicit char_converter(basic_format_arg<Context>& arg) : arg_(arg) {}
|
||||
|
||||
template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
|
||||
void operator()(T value) {
|
||||
arg_ = detail::make_arg<Context>(
|
||||
static_cast<typename Context::char_type>(value));
|
||||
}
|
||||
|
||||
template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
|
||||
void operator()(T) {} // No conversion needed for non-integral types.
|
||||
};
|
||||
|
||||
// An argument visitor that return a pointer to a C string if argument is a
|
||||
// string or null otherwise.
|
||||
template <typename Char> struct get_cstring {
|
||||
template <typename T> const Char* operator()(T) { return nullptr; }
|
||||
const Char* operator()(const Char* s) { return s; }
|
||||
};
|
||||
|
||||
// Checks if an argument is a valid printf width specifier and sets
|
||||
// left alignment if it is negative.
|
||||
template <typename Char> class printf_width_handler {
|
||||
private:
|
||||
using format_specs = basic_format_specs<Char>;
|
||||
|
||||
format_specs& specs_;
|
||||
|
||||
public:
|
||||
explicit printf_width_handler(format_specs& specs) : specs_(specs) {}
|
||||
|
||||
template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
|
||||
unsigned operator()(T value) {
|
||||
auto width = static_cast<uint32_or_64_or_128_t<T>>(value);
|
||||
if (detail::is_negative(value)) {
|
||||
specs_.align = align::left;
|
||||
width = 0 - width;
|
||||
}
|
||||
unsigned int_max = max_value<int>();
|
||||
if (width > int_max) FMT_THROW(format_error("number is too big"));
|
||||
return static_cast<unsigned>(width);
|
||||
}
|
||||
|
||||
template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
|
||||
unsigned operator()(T) {
|
||||
FMT_THROW(format_error("width is not integer"));
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Char, typename Context>
|
||||
void vprintf(buffer<Char>& buf, basic_string_view<Char> format,
|
||||
basic_format_args<Context> args) {
|
||||
Context(std::back_inserter(buf), format, args).format();
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
// For printing into memory_buffer.
|
||||
template <typename Char, typename Context>
|
||||
FMT_DEPRECATED void printf(detail::buffer<Char>& buf,
|
||||
basic_string_view<Char> format,
|
||||
basic_format_args<Context> args) {
|
||||
return detail::vprintf(buf, format, args);
|
||||
}
|
||||
using detail::vprintf;
|
||||
|
||||
template <typename Char>
|
||||
class basic_printf_parse_context : public basic_format_parse_context<Char> {
|
||||
using basic_format_parse_context<Char>::basic_format_parse_context;
|
||||
};
|
||||
template <typename OutputIt, typename Char> class basic_printf_context;
|
||||
|
||||
/**
|
||||
\rst
|
||||
The ``printf`` argument formatter.
|
||||
\endrst
|
||||
*/
|
||||
template <typename OutputIt, typename Char>
|
||||
class printf_arg_formatter : public detail::arg_formatter_base<OutputIt, Char> {
|
||||
public:
|
||||
using iterator = OutputIt;
|
||||
|
||||
private:
|
||||
using char_type = Char;
|
||||
using base = detail::arg_formatter_base<OutputIt, Char>;
|
||||
using context_type = basic_printf_context<OutputIt, Char>;
|
||||
|
||||
context_type& context_;
|
||||
|
||||
void write_null_pointer(char) {
|
||||
this->specs()->type = 0;
|
||||
this->write("(nil)");
|
||||
}
|
||||
|
||||
void write_null_pointer(wchar_t) {
|
||||
this->specs()->type = 0;
|
||||
this->write(L"(nil)");
|
||||
}
|
||||
|
||||
public:
|
||||
using format_specs = typename base::format_specs;
|
||||
|
||||
/**
|
||||
\rst
|
||||
Constructs an argument formatter object.
|
||||
*buffer* is a reference to the output buffer and *specs* contains format
|
||||
specifier information for standard argument types.
|
||||
\endrst
|
||||
*/
|
||||
printf_arg_formatter(iterator iter, format_specs& specs, context_type& ctx)
|
||||
: base(iter, &specs, detail::locale_ref()), context_(ctx) {}
|
||||
|
||||
template <typename T, FMT_ENABLE_IF(fmt::detail::is_integral<T>::value)>
|
||||
iterator operator()(T value) {
|
||||
// MSVC2013 fails to compile separate overloads for bool and char_type so
|
||||
// use std::is_same instead.
|
||||
if (std::is_same<T, bool>::value) {
|
||||
format_specs& fmt_specs = *this->specs();
|
||||
if (fmt_specs.type != 's') return base::operator()(value ? 1 : 0);
|
||||
fmt_specs.type = 0;
|
||||
this->write(value != 0);
|
||||
} else if (std::is_same<T, char_type>::value) {
|
||||
format_specs& fmt_specs = *this->specs();
|
||||
if (fmt_specs.type && fmt_specs.type != 'c')
|
||||
return (*this)(static_cast<int>(value));
|
||||
fmt_specs.sign = sign::none;
|
||||
fmt_specs.alt = false;
|
||||
fmt_specs.fill[0] = ' '; // Ignore '0' flag for char types.
|
||||
// align::numeric needs to be overwritten here since the '0' flag is
|
||||
// ignored for non-numeric types
|
||||
if (fmt_specs.align == align::none || fmt_specs.align == align::numeric)
|
||||
fmt_specs.align = align::right;
|
||||
return base::operator()(value);
|
||||
} else {
|
||||
return base::operator()(value);
|
||||
}
|
||||
return this->out();
|
||||
}
|
||||
|
||||
template <typename T, FMT_ENABLE_IF(std::is_floating_point<T>::value)>
|
||||
iterator operator()(T value) {
|
||||
return base::operator()(value);
|
||||
}
|
||||
|
||||
/** Formats a null-terminated C string. */
|
||||
iterator operator()(const char* value) {
|
||||
if (value)
|
||||
base::operator()(value);
|
||||
else if (this->specs()->type == 'p')
|
||||
write_null_pointer(char_type());
|
||||
else
|
||||
this->write("(null)");
|
||||
return this->out();
|
||||
}
|
||||
|
||||
/** Formats a null-terminated wide C string. */
|
||||
iterator operator()(const wchar_t* value) {
|
||||
if (value)
|
||||
base::operator()(value);
|
||||
else if (this->specs()->type == 'p')
|
||||
write_null_pointer(char_type());
|
||||
else
|
||||
this->write(L"(null)");
|
||||
return this->out();
|
||||
}
|
||||
|
||||
iterator operator()(basic_string_view<char_type> value) {
|
||||
return base::operator()(value);
|
||||
}
|
||||
|
||||
iterator operator()(monostate value) { return base::operator()(value); }
|
||||
|
||||
/** Formats a pointer. */
|
||||
iterator operator()(const void* value) {
|
||||
if (value) return base::operator()(value);
|
||||
this->specs()->type = 0;
|
||||
write_null_pointer(char_type());
|
||||
return this->out();
|
||||
}
|
||||
|
||||
/** Formats an argument of a custom (user-defined) type. */
|
||||
iterator operator()(typename basic_format_arg<context_type>::handle handle) {
|
||||
handle.format(context_.parse_context(), context_);
|
||||
return this->out();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T> struct printf_formatter {
|
||||
printf_formatter() = delete;
|
||||
|
||||
template <typename ParseContext>
|
||||
auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
|
||||
return ctx.begin();
|
||||
}
|
||||
|
||||
template <typename FormatContext>
|
||||
auto format(const T& value, FormatContext& ctx) -> decltype(ctx.out()) {
|
||||
detail::format_value(detail::get_container(ctx.out()), value);
|
||||
return ctx.out();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
This template formats data and writes the output through an output iterator.
|
||||
*/
|
||||
template <typename OutputIt, typename Char> class basic_printf_context {
|
||||
public:
|
||||
/** The character type for the output. */
|
||||
using char_type = Char;
|
||||
using iterator = OutputIt;
|
||||
using format_arg = basic_format_arg<basic_printf_context>;
|
||||
using parse_context_type = basic_printf_parse_context<Char>;
|
||||
template <typename T> using formatter_type = printf_formatter<T>;
|
||||
|
||||
private:
|
||||
using format_specs = basic_format_specs<char_type>;
|
||||
|
||||
OutputIt out_;
|
||||
basic_format_args<basic_printf_context> args_;
|
||||
parse_context_type parse_ctx_;
|
||||
|
||||
static void parse_flags(format_specs& specs, const Char*& it,
|
||||
const Char* end);
|
||||
|
||||
// Returns the argument with specified index or, if arg_index is -1, the next
|
||||
// argument.
|
||||
format_arg get_arg(int arg_index = -1);
|
||||
|
||||
// Parses argument index, flags and width and returns the argument index.
|
||||
int parse_header(const Char*& it, const Char* end, format_specs& specs);
|
||||
|
||||
public:
|
||||
/**
|
||||
\rst
|
||||
Constructs a ``printf_context`` object. References to the arguments are
|
||||
stored in the context object so make sure they have appropriate lifetimes.
|
||||
\endrst
|
||||
*/
|
||||
basic_printf_context(OutputIt out, basic_string_view<char_type> format_str,
|
||||
basic_format_args<basic_printf_context> args)
|
||||
: out_(out), args_(args), parse_ctx_(format_str) {}
|
||||
|
||||
OutputIt out() { return out_; }
|
||||
void advance_to(OutputIt it) { out_ = it; }
|
||||
|
||||
detail::locale_ref locale() { return {}; }
|
||||
|
||||
format_arg arg(int id) const { return args_.get(id); }
|
||||
|
||||
parse_context_type& parse_context() { return parse_ctx_; }
|
||||
|
||||
FMT_CONSTEXPR void on_error(const char* message) {
|
||||
parse_ctx_.on_error(message);
|
||||
}
|
||||
|
||||
/** Formats stored arguments and writes the output to the range. */
|
||||
template <typename ArgFormatter = printf_arg_formatter<OutputIt, Char>>
|
||||
OutputIt format();
|
||||
};
|
||||
|
||||
template <typename OutputIt, typename Char>
|
||||
void basic_printf_context<OutputIt, Char>::parse_flags(format_specs& specs,
|
||||
const Char*& it,
|
||||
const Char* end) {
|
||||
for (; it != end; ++it) {
|
||||
switch (*it) {
|
||||
case '-':
|
||||
specs.align = align::left;
|
||||
break;
|
||||
case '+':
|
||||
specs.sign = sign::plus;
|
||||
break;
|
||||
case '0':
|
||||
specs.fill[0] = '0';
|
||||
break;
|
||||
case ' ':
|
||||
if (specs.sign != sign::plus) {
|
||||
specs.sign = sign::space;
|
||||
}
|
||||
break;
|
||||
case '#':
|
||||
specs.alt = true;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename OutputIt, typename Char>
|
||||
typename basic_printf_context<OutputIt, Char>::format_arg
|
||||
basic_printf_context<OutputIt, Char>::get_arg(int arg_index) {
|
||||
if (arg_index < 0)
|
||||
arg_index = parse_ctx_.next_arg_id();
|
||||
else
|
||||
parse_ctx_.check_arg_id(--arg_index);
|
||||
return detail::get_arg(*this, arg_index);
|
||||
}
|
||||
|
||||
template <typename OutputIt, typename Char>
|
||||
int basic_printf_context<OutputIt, Char>::parse_header(const Char*& it,
|
||||
const Char* end,
|
||||
format_specs& specs) {
|
||||
int arg_index = -1;
|
||||
char_type c = *it;
|
||||
if (c >= '0' && c <= '9') {
|
||||
// Parse an argument index (if followed by '$') or a width possibly
|
||||
// preceded with '0' flag(s).
|
||||
detail::error_handler eh;
|
||||
int value = parse_nonnegative_int(it, end, eh);
|
||||
if (it != end && *it == '$') { // value is an argument index
|
||||
++it;
|
||||
arg_index = value;
|
||||
} else {
|
||||
if (c == '0') specs.fill[0] = '0';
|
||||
if (value != 0) {
|
||||
// Nonzero value means that we parsed width and don't need to
|
||||
// parse it or flags again, so return now.
|
||||
specs.width = value;
|
||||
return arg_index;
|
||||
}
|
||||
}
|
||||
}
|
||||
parse_flags(specs, it, end);
|
||||
// Parse width.
|
||||
if (it != end) {
|
||||
if (*it >= '0' && *it <= '9') {
|
||||
detail::error_handler eh;
|
||||
specs.width = parse_nonnegative_int(it, end, eh);
|
||||
} else if (*it == '*') {
|
||||
++it;
|
||||
specs.width = static_cast<int>(visit_format_arg(
|
||||
detail::printf_width_handler<char_type>(specs), get_arg()));
|
||||
}
|
||||
}
|
||||
return arg_index;
|
||||
}
|
||||
|
||||
template <typename OutputIt, typename Char>
|
||||
template <typename ArgFormatter>
|
||||
OutputIt basic_printf_context<OutputIt, Char>::format() {
|
||||
auto out = this->out();
|
||||
const Char* start = parse_ctx_.begin();
|
||||
const Char* end = parse_ctx_.end();
|
||||
auto it = start;
|
||||
while (it != end) {
|
||||
char_type c = *it++;
|
||||
if (c != '%') continue;
|
||||
if (it != end && *it == c) {
|
||||
out = std::copy(start, it, out);
|
||||
start = ++it;
|
||||
continue;
|
||||
}
|
||||
out = std::copy(start, it - 1, out);
|
||||
|
||||
format_specs specs;
|
||||
specs.align = align::right;
|
||||
|
||||
// Parse argument index, flags and width.
|
||||
int arg_index = parse_header(it, end, specs);
|
||||
if (arg_index == 0) on_error("argument not found");
|
||||
|
||||
// Parse precision.
|
||||
if (it != end && *it == '.') {
|
||||
++it;
|
||||
c = it != end ? *it : 0;
|
||||
if ('0' <= c && c <= '9') {
|
||||
detail::error_handler eh;
|
||||
specs.precision = parse_nonnegative_int(it, end, eh);
|
||||
} else if (c == '*') {
|
||||
++it;
|
||||
specs.precision = static_cast<int>(
|
||||
visit_format_arg(detail::printf_precision_handler(), get_arg()));
|
||||
} else {
|
||||
specs.precision = 0;
|
||||
}
|
||||
}
|
||||
|
||||
format_arg arg = get_arg(arg_index);
|
||||
// For d, i, o, u, x, and X conversion specifiers, if a precision is
|
||||
// specified, the '0' flag is ignored
|
||||
if (specs.precision >= 0 && arg.is_integral())
|
||||
specs.fill[0] =
|
||||
' '; // Ignore '0' flag for non-numeric types or if '-' present.
|
||||
if (specs.precision >= 0 && arg.type() == detail::type::cstring_type) {
|
||||
auto str = visit_format_arg(detail::get_cstring<Char>(), arg);
|
||||
auto str_end = str + specs.precision;
|
||||
auto nul = std::find(str, str_end, Char());
|
||||
arg = detail::make_arg<basic_printf_context>(basic_string_view<Char>(
|
||||
str,
|
||||
detail::to_unsigned(nul != str_end ? nul - str : specs.precision)));
|
||||
}
|
||||
if (specs.alt && visit_format_arg(detail::is_zero_int(), arg))
|
||||
specs.alt = false;
|
||||
if (specs.fill[0] == '0') {
|
||||
if (arg.is_arithmetic() && specs.align != align::left)
|
||||
specs.align = align::numeric;
|
||||
else
|
||||
specs.fill[0] = ' '; // Ignore '0' flag for non-numeric types or if '-'
|
||||
// flag is also present.
|
||||
}
|
||||
|
||||
// Parse length and convert the argument to the required type.
|
||||
c = it != end ? *it++ : 0;
|
||||
char_type t = it != end ? *it : 0;
|
||||
using detail::convert_arg;
|
||||
switch (c) {
|
||||
case 'h':
|
||||
if (t == 'h') {
|
||||
++it;
|
||||
t = it != end ? *it : 0;
|
||||
convert_arg<signed char>(arg, t);
|
||||
} else {
|
||||
convert_arg<short>(arg, t);
|
||||
}
|
||||
break;
|
||||
case 'l':
|
||||
if (t == 'l') {
|
||||
++it;
|
||||
t = it != end ? *it : 0;
|
||||
convert_arg<long long>(arg, t);
|
||||
} else {
|
||||
convert_arg<long>(arg, t);
|
||||
}
|
||||
break;
|
||||
case 'j':
|
||||
convert_arg<intmax_t>(arg, t);
|
||||
break;
|
||||
case 'z':
|
||||
convert_arg<size_t>(arg, t);
|
||||
break;
|
||||
case 't':
|
||||
convert_arg<std::ptrdiff_t>(arg, t);
|
||||
break;
|
||||
case 'L':
|
||||
// printf produces garbage when 'L' is omitted for long double, no
|
||||
// need to do the same.
|
||||
break;
|
||||
default:
|
||||
--it;
|
||||
convert_arg<void>(arg, c);
|
||||
}
|
||||
|
||||
// Parse type.
|
||||
if (it == end) FMT_THROW(format_error("invalid format string"));
|
||||
specs.type = static_cast<char>(*it++);
|
||||
if (arg.is_integral()) {
|
||||
// Normalize type.
|
||||
switch (specs.type) {
|
||||
case 'i':
|
||||
case 'u':
|
||||
specs.type = 'd';
|
||||
break;
|
||||
case 'c':
|
||||
visit_format_arg(detail::char_converter<basic_printf_context>(arg),
|
||||
arg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
start = it;
|
||||
|
||||
// Format argument.
|
||||
out = visit_format_arg(ArgFormatter(out, specs, *this), arg);
|
||||
}
|
||||
return std::copy(start, it, out);
|
||||
}
|
||||
|
||||
template <typename Char>
|
||||
using basic_printf_context_t =
|
||||
basic_printf_context<std::back_insert_iterator<detail::buffer<Char>>, Char>;
|
||||
|
||||
using printf_context = basic_printf_context_t<char>;
|
||||
using wprintf_context = basic_printf_context_t<wchar_t>;
|
||||
|
||||
using printf_args = basic_format_args<printf_context>;
|
||||
using wprintf_args = basic_format_args<wprintf_context>;
|
||||
|
||||
/**
|
||||
\rst
|
||||
Constructs an `~fmt::format_arg_store` object that contains references to
|
||||
arguments and can be implicitly converted to `~fmt::printf_args`.
|
||||
\endrst
|
||||
*/
|
||||
template <typename... Args>
|
||||
inline format_arg_store<printf_context, Args...> make_printf_args(
|
||||
const Args&... args) {
|
||||
return {args...};
|
||||
}
|
||||
|
||||
/**
|
||||
\rst
|
||||
Constructs an `~fmt::format_arg_store` object that contains references to
|
||||
arguments and can be implicitly converted to `~fmt::wprintf_args`.
|
||||
\endrst
|
||||
*/
|
||||
template <typename... Args>
|
||||
inline format_arg_store<wprintf_context, Args...> make_wprintf_args(
|
||||
const Args&... args) {
|
||||
return {args...};
|
||||
}
|
||||
|
||||
template <typename S, typename Char = char_t<S>>
|
||||
inline std::basic_string<Char> vsprintf(
|
||||
const S& format,
|
||||
basic_format_args<basic_printf_context_t<type_identity_t<Char>>> args) {
|
||||
basic_memory_buffer<Char> buffer;
|
||||
vprintf(buffer, to_string_view(format), args);
|
||||
return to_string(buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
\rst
|
||||
Formats arguments and returns the result as a string.
|
||||
|
||||
**Example**::
|
||||
|
||||
std::string message = fmt::sprintf("The answer is %d", 42);
|
||||
\endrst
|
||||
*/
|
||||
template <typename S, typename... Args,
|
||||
typename Char = enable_if_t<detail::is_string<S>::value, char_t<S>>>
|
||||
inline std::basic_string<Char> sprintf(const S& format, const Args&... args) {
|
||||
using context = basic_printf_context_t<Char>;
|
||||
return vsprintf(to_string_view(format), make_format_args<context>(args...));
|
||||
}
|
||||
|
||||
template <typename S, typename Char = char_t<S>>
|
||||
inline int vfprintf(
|
||||
std::FILE* f, const S& format,
|
||||
basic_format_args<basic_printf_context_t<type_identity_t<Char>>> args) {
|
||||
basic_memory_buffer<Char> buffer;
|
||||
vprintf(buffer, to_string_view(format), args);
|
||||
size_t size = buffer.size();
|
||||
return std::fwrite(buffer.data(), sizeof(Char), size, f) < size
|
||||
? -1
|
||||
: static_cast<int>(size);
|
||||
}
|
||||
|
||||
/**
|
||||
\rst
|
||||
Prints formatted data to the file *f*.
|
||||
|
||||
**Example**::
|
||||
|
||||
fmt::fprintf(stderr, "Don't %s!", "panic");
|
||||
\endrst
|
||||
*/
|
||||
template <typename S, typename... Args,
|
||||
typename Char = enable_if_t<detail::is_string<S>::value, char_t<S>>>
|
||||
inline int fprintf(std::FILE* f, const S& format, const Args&... args) {
|
||||
using context = basic_printf_context_t<Char>;
|
||||
return vfprintf(f, to_string_view(format),
|
||||
make_format_args<context>(args...));
|
||||
}
|
||||
|
||||
template <typename S, typename Char = char_t<S>>
|
||||
inline int vprintf(
|
||||
const S& format,
|
||||
basic_format_args<basic_printf_context_t<type_identity_t<Char>>> args) {
|
||||
return vfprintf(stdout, to_string_view(format), args);
|
||||
}
|
||||
|
||||
/**
|
||||
\rst
|
||||
Prints formatted data to ``stdout``.
|
||||
|
||||
**Example**::
|
||||
|
||||
fmt::printf("Elapsed time: %.2f seconds", 1.23);
|
||||
\endrst
|
||||
*/
|
||||
template <typename S, typename... Args,
|
||||
FMT_ENABLE_IF(detail::is_string<S>::value)>
|
||||
inline int printf(const S& format_str, const Args&... args) {
|
||||
using context = basic_printf_context_t<char_t<S>>;
|
||||
return vprintf(to_string_view(format_str),
|
||||
make_format_args<context>(args...));
|
||||
}
|
||||
|
||||
template <typename S, typename Char = char_t<S>>
|
||||
inline int vfprintf(
|
||||
std::basic_ostream<Char>& os, const S& format,
|
||||
basic_format_args<basic_printf_context_t<type_identity_t<Char>>> args) {
|
||||
basic_memory_buffer<Char> buffer;
|
||||
vprintf(buffer, to_string_view(format), args);
|
||||
detail::write_buffer(os, buffer);
|
||||
return static_cast<int>(buffer.size());
|
||||
}
|
||||
|
||||
/** Formats arguments and writes the output to the range. */
|
||||
template <typename ArgFormatter, typename Char,
|
||||
typename Context =
|
||||
basic_printf_context<typename ArgFormatter::iterator, Char>>
|
||||
typename ArgFormatter::iterator vprintf(
|
||||
detail::buffer<Char>& out, basic_string_view<Char> format_str,
|
||||
basic_format_args<type_identity_t<Context>> args) {
|
||||
typename ArgFormatter::iterator iter(out);
|
||||
Context(iter, format_str, args).template format<ArgFormatter>();
|
||||
return iter;
|
||||
}
|
||||
|
||||
/**
|
||||
\rst
|
||||
Prints formatted data to the stream *os*.
|
||||
|
||||
**Example**::
|
||||
|
||||
fmt::fprintf(cerr, "Don't %s!", "panic");
|
||||
\endrst
|
||||
*/
|
||||
template <typename S, typename... Args, typename Char = char_t<S>>
|
||||
inline int fprintf(std::basic_ostream<Char>& os, const S& format_str,
|
||||
const Args&... args) {
|
||||
using context = basic_printf_context_t<Char>;
|
||||
return vfprintf(os, to_string_view(format_str),
|
||||
make_format_args<context>(args...));
|
||||
}
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
#endif // FMT_PRINTF_H_
|
||||
386
external/fmtlib/include/fmt/ranges.h
vendored
Normal file
386
external/fmtlib/include/fmt/ranges.h
vendored
Normal file
@@ -0,0 +1,386 @@
|
||||
// Formatting library for C++ - experimental range support
|
||||
//
|
||||
// Copyright (c) 2012 - present, Victor Zverovich
|
||||
// All rights reserved.
|
||||
//
|
||||
// For the license information refer to format.h.
|
||||
//
|
||||
// Copyright (c) 2018 - present, Remotion (Igor Schulz)
|
||||
// All Rights Reserved
|
||||
// {fmt} support for ranges, containers and types tuple interface.
|
||||
|
||||
#ifndef FMT_RANGES_H_
|
||||
#define FMT_RANGES_H_
|
||||
|
||||
#include <initializer_list>
|
||||
#include <type_traits>
|
||||
|
||||
#include "format.h"
|
||||
|
||||
// output only up to N items from the range.
|
||||
#ifndef FMT_RANGE_OUTPUT_LENGTH_LIMIT
|
||||
# define FMT_RANGE_OUTPUT_LENGTH_LIMIT 256
|
||||
#endif
|
||||
|
||||
FMT_BEGIN_NAMESPACE
|
||||
|
||||
template <typename Char> struct formatting_base {
|
||||
template <typename ParseContext>
|
||||
FMT_CONSTEXPR auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
|
||||
return ctx.begin();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Char, typename Enable = void>
|
||||
struct formatting_range : formatting_base<Char> {
|
||||
static FMT_CONSTEXPR_DECL const size_t range_length_limit =
|
||||
FMT_RANGE_OUTPUT_LENGTH_LIMIT; // output only up to N items from the
|
||||
// range.
|
||||
Char prefix;
|
||||
Char delimiter;
|
||||
Char postfix;
|
||||
formatting_range() : prefix('{'), delimiter(','), postfix('}') {}
|
||||
static FMT_CONSTEXPR_DECL const bool add_delimiter_spaces = true;
|
||||
static FMT_CONSTEXPR_DECL const bool add_prepostfix_space = false;
|
||||
};
|
||||
|
||||
template <typename Char, typename Enable = void>
|
||||
struct formatting_tuple : formatting_base<Char> {
|
||||
Char prefix;
|
||||
Char delimiter;
|
||||
Char postfix;
|
||||
formatting_tuple() : prefix('('), delimiter(','), postfix(')') {}
|
||||
static FMT_CONSTEXPR_DECL const bool add_delimiter_spaces = true;
|
||||
static FMT_CONSTEXPR_DECL const bool add_prepostfix_space = false;
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <typename RangeT, typename OutputIterator>
|
||||
OutputIterator copy(const RangeT& range, OutputIterator out) {
|
||||
for (auto it = range.begin(), end = range.end(); it != end; ++it)
|
||||
*out++ = *it;
|
||||
return out;
|
||||
}
|
||||
|
||||
template <typename OutputIterator>
|
||||
OutputIterator copy(const char* str, OutputIterator out) {
|
||||
while (*str) *out++ = *str++;
|
||||
return out;
|
||||
}
|
||||
|
||||
template <typename OutputIterator>
|
||||
OutputIterator copy(char ch, OutputIterator out) {
|
||||
*out++ = ch;
|
||||
return out;
|
||||
}
|
||||
|
||||
/// Return true value if T has std::string interface, like std::string_view.
|
||||
template <typename T> class is_like_std_string {
|
||||
template <typename U>
|
||||
static auto check(U* p)
|
||||
-> decltype((void)p->find('a'), p->length(), (void)p->data(), int());
|
||||
template <typename> static void check(...);
|
||||
|
||||
public:
|
||||
static FMT_CONSTEXPR_DECL const bool value =
|
||||
is_string<T>::value || !std::is_void<decltype(check<T>(nullptr))>::value;
|
||||
};
|
||||
|
||||
template <typename Char>
|
||||
struct is_like_std_string<fmt::basic_string_view<Char>> : std::true_type {};
|
||||
|
||||
template <typename... Ts> struct conditional_helper {};
|
||||
|
||||
template <typename T, typename _ = void> struct is_range_ : std::false_type {};
|
||||
|
||||
#if !FMT_MSC_VER || FMT_MSC_VER > 1800
|
||||
template <typename T>
|
||||
struct is_range_<
|
||||
T, conditional_t<false,
|
||||
conditional_helper<decltype(std::declval<T>().begin()),
|
||||
decltype(std::declval<T>().end())>,
|
||||
void>> : std::true_type {};
|
||||
#endif
|
||||
|
||||
/// tuple_size and tuple_element check.
|
||||
template <typename T> class is_tuple_like_ {
|
||||
template <typename U>
|
||||
static auto check(U* p) -> decltype(std::tuple_size<U>::value, int());
|
||||
template <typename> static void check(...);
|
||||
|
||||
public:
|
||||
static FMT_CONSTEXPR_DECL const bool value =
|
||||
!std::is_void<decltype(check<T>(nullptr))>::value;
|
||||
};
|
||||
|
||||
// Check for integer_sequence
|
||||
#if defined(__cpp_lib_integer_sequence) || FMT_MSC_VER >= 1900
|
||||
template <typename T, T... N>
|
||||
using integer_sequence = std::integer_sequence<T, N...>;
|
||||
template <size_t... N> using index_sequence = std::index_sequence<N...>;
|
||||
template <size_t N> using make_index_sequence = std::make_index_sequence<N>;
|
||||
#else
|
||||
template <typename T, T... N> struct integer_sequence {
|
||||
using value_type = T;
|
||||
|
||||
static FMT_CONSTEXPR size_t size() { return sizeof...(N); }
|
||||
};
|
||||
|
||||
template <size_t... N> using index_sequence = integer_sequence<size_t, N...>;
|
||||
|
||||
template <typename T, size_t N, T... Ns>
|
||||
struct make_integer_sequence : make_integer_sequence<T, N - 1, N - 1, Ns...> {};
|
||||
template <typename T, T... Ns>
|
||||
struct make_integer_sequence<T, 0, Ns...> : integer_sequence<T, Ns...> {};
|
||||
|
||||
template <size_t N>
|
||||
using make_index_sequence = make_integer_sequence<size_t, N>;
|
||||
#endif
|
||||
|
||||
template <class Tuple, class F, size_t... Is>
|
||||
void for_each(index_sequence<Is...>, Tuple&& tup, F&& f) FMT_NOEXCEPT {
|
||||
using std::get;
|
||||
// using free function get<I>(T) now.
|
||||
const int _[] = {0, ((void)f(get<Is>(tup)), 0)...};
|
||||
(void)_; // blocks warnings
|
||||
}
|
||||
|
||||
template <class T>
|
||||
FMT_CONSTEXPR make_index_sequence<std::tuple_size<T>::value> get_indexes(
|
||||
T const&) {
|
||||
return {};
|
||||
}
|
||||
|
||||
template <class Tuple, class F> void for_each(Tuple&& tup, F&& f) {
|
||||
const auto indexes = get_indexes(tup);
|
||||
for_each(indexes, std::forward<Tuple>(tup), std::forward<F>(f));
|
||||
}
|
||||
|
||||
template <typename Arg, FMT_ENABLE_IF(!is_like_std_string<
|
||||
typename std::decay<Arg>::type>::value)>
|
||||
FMT_CONSTEXPR const char* format_str_quoted(bool add_space, const Arg&) {
|
||||
return add_space ? " {}" : "{}";
|
||||
}
|
||||
|
||||
template <typename Arg, FMT_ENABLE_IF(is_like_std_string<
|
||||
typename std::decay<Arg>::type>::value)>
|
||||
FMT_CONSTEXPR const char* format_str_quoted(bool add_space, const Arg&) {
|
||||
return add_space ? " \"{}\"" : "\"{}\"";
|
||||
}
|
||||
|
||||
FMT_CONSTEXPR const char* format_str_quoted(bool add_space, const char*) {
|
||||
return add_space ? " \"{}\"" : "\"{}\"";
|
||||
}
|
||||
FMT_CONSTEXPR const wchar_t* format_str_quoted(bool add_space, const wchar_t*) {
|
||||
return add_space ? L" \"{}\"" : L"\"{}\"";
|
||||
}
|
||||
|
||||
FMT_CONSTEXPR const char* format_str_quoted(bool add_space, const char) {
|
||||
return add_space ? " '{}'" : "'{}'";
|
||||
}
|
||||
FMT_CONSTEXPR const wchar_t* format_str_quoted(bool add_space, const wchar_t) {
|
||||
return add_space ? L" '{}'" : L"'{}'";
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <typename T> struct is_tuple_like {
|
||||
static FMT_CONSTEXPR_DECL const bool value =
|
||||
detail::is_tuple_like_<T>::value && !detail::is_range_<T>::value;
|
||||
};
|
||||
|
||||
template <typename TupleT, typename Char>
|
||||
struct formatter<TupleT, Char, enable_if_t<fmt::is_tuple_like<TupleT>::value>> {
|
||||
private:
|
||||
// C++11 generic lambda for format()
|
||||
template <typename FormatContext> struct format_each {
|
||||
template <typename T> void operator()(const T& v) {
|
||||
if (i > 0) {
|
||||
if (formatting.add_prepostfix_space) {
|
||||
*out++ = ' ';
|
||||
}
|
||||
out = detail::copy(formatting.delimiter, out);
|
||||
}
|
||||
out = format_to(out,
|
||||
detail::format_str_quoted(
|
||||
(formatting.add_delimiter_spaces && i > 0), v),
|
||||
v);
|
||||
++i;
|
||||
}
|
||||
|
||||
formatting_tuple<Char>& formatting;
|
||||
size_t& i;
|
||||
typename std::add_lvalue_reference<decltype(
|
||||
std::declval<FormatContext>().out())>::type out;
|
||||
};
|
||||
|
||||
public:
|
||||
formatting_tuple<Char> formatting;
|
||||
|
||||
template <typename ParseContext>
|
||||
FMT_CONSTEXPR auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
|
||||
return formatting.parse(ctx);
|
||||
}
|
||||
|
||||
template <typename FormatContext = format_context>
|
||||
auto format(const TupleT& values, FormatContext& ctx) -> decltype(ctx.out()) {
|
||||
auto out = ctx.out();
|
||||
size_t i = 0;
|
||||
detail::copy(formatting.prefix, out);
|
||||
|
||||
detail::for_each(values, format_each<FormatContext>{formatting, i, out});
|
||||
if (formatting.add_prepostfix_space) {
|
||||
*out++ = ' ';
|
||||
}
|
||||
detail::copy(formatting.postfix, out);
|
||||
|
||||
return ctx.out();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, typename Char> struct is_range {
|
||||
static FMT_CONSTEXPR_DECL const bool value =
|
||||
detail::is_range_<T>::value && !detail::is_like_std_string<T>::value &&
|
||||
!std::is_convertible<T, std::basic_string<Char>>::value &&
|
||||
!std::is_constructible<detail::std_string_view<Char>, T>::value;
|
||||
};
|
||||
|
||||
template <typename RangeT, typename Char>
|
||||
struct formatter<RangeT, Char,
|
||||
enable_if_t<fmt::is_range<RangeT, Char>::value>> {
|
||||
formatting_range<Char> formatting;
|
||||
|
||||
template <typename ParseContext>
|
||||
FMT_CONSTEXPR auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
|
||||
return formatting.parse(ctx);
|
||||
}
|
||||
|
||||
template <typename FormatContext>
|
||||
typename FormatContext::iterator format(const RangeT& values,
|
||||
FormatContext& ctx) {
|
||||
auto out = detail::copy(formatting.prefix, ctx.out());
|
||||
size_t i = 0;
|
||||
auto it = values.begin();
|
||||
auto end = values.end();
|
||||
for (; it != end; ++it) {
|
||||
if (i > 0) {
|
||||
if (formatting.add_prepostfix_space) *out++ = ' ';
|
||||
out = detail::copy(formatting.delimiter, out);
|
||||
}
|
||||
out = format_to(out,
|
||||
detail::format_str_quoted(
|
||||
(formatting.add_delimiter_spaces && i > 0), *it),
|
||||
*it);
|
||||
if (++i > formatting.range_length_limit) {
|
||||
out = format_to(out, " ... <other elements>");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (formatting.add_prepostfix_space) *out++ = ' ';
|
||||
return detail::copy(formatting.postfix, out);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Char, typename... T> struct tuple_arg_join : detail::view {
|
||||
const std::tuple<T...>& tuple;
|
||||
basic_string_view<Char> sep;
|
||||
|
||||
tuple_arg_join(const std::tuple<T...>& t, basic_string_view<Char> s)
|
||||
: tuple{t}, sep{s} {}
|
||||
};
|
||||
|
||||
template <typename Char, typename... T>
|
||||
struct formatter<tuple_arg_join<Char, T...>, Char> {
|
||||
template <typename ParseContext>
|
||||
FMT_CONSTEXPR auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
|
||||
return ctx.begin();
|
||||
}
|
||||
|
||||
template <typename FormatContext>
|
||||
typename FormatContext::iterator format(
|
||||
const tuple_arg_join<Char, T...>& value, FormatContext& ctx) {
|
||||
return format(value, ctx, detail::make_index_sequence<sizeof...(T)>{});
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename FormatContext, size_t... N>
|
||||
typename FormatContext::iterator format(
|
||||
const tuple_arg_join<Char, T...>& value, FormatContext& ctx,
|
||||
detail::index_sequence<N...>) {
|
||||
return format_args(value, ctx, std::get<N>(value.tuple)...);
|
||||
}
|
||||
|
||||
template <typename FormatContext>
|
||||
typename FormatContext::iterator format_args(
|
||||
const tuple_arg_join<Char, T...>&, FormatContext& ctx) {
|
||||
// NOTE: for compilers that support C++17, this empty function instantiation
|
||||
// can be replaced with a constexpr branch in the variadic overload.
|
||||
return ctx.out();
|
||||
}
|
||||
|
||||
template <typename FormatContext, typename Arg, typename... Args>
|
||||
typename FormatContext::iterator format_args(
|
||||
const tuple_arg_join<Char, T...>& value, FormatContext& ctx,
|
||||
const Arg& arg, const Args&... args) {
|
||||
using base = formatter<typename std::decay<Arg>::type, Char>;
|
||||
auto out = ctx.out();
|
||||
out = base{}.format(arg, ctx);
|
||||
if (sizeof...(Args) > 0) {
|
||||
out = std::copy(value.sep.begin(), value.sep.end(), out);
|
||||
ctx.advance_to(out);
|
||||
return format_args(value, ctx, args...);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
\rst
|
||||
Returns an object that formats `tuple` with elements separated by `sep`.
|
||||
|
||||
**Example**::
|
||||
|
||||
std::tuple<int, char> t = {1, 'a'};
|
||||
fmt::print("{}", fmt::join(t, ", "));
|
||||
// Output: "1, a"
|
||||
\endrst
|
||||
*/
|
||||
template <typename... T>
|
||||
FMT_CONSTEXPR tuple_arg_join<char, T...> join(const std::tuple<T...>& tuple,
|
||||
string_view sep) {
|
||||
return {tuple, sep};
|
||||
}
|
||||
|
||||
template <typename... T>
|
||||
FMT_CONSTEXPR tuple_arg_join<wchar_t, T...> join(const std::tuple<T...>& tuple,
|
||||
wstring_view sep) {
|
||||
return {tuple, sep};
|
||||
}
|
||||
|
||||
/**
|
||||
\rst
|
||||
Returns an object that formats `initializer_list` with elements separated by
|
||||
`sep`.
|
||||
|
||||
**Example**::
|
||||
|
||||
fmt::print("{}", fmt::join({1, 2, 3}, ", "));
|
||||
// Output: "1, 2, 3"
|
||||
\endrst
|
||||
*/
|
||||
template <typename T>
|
||||
arg_join<const T*, const T*, char> join(std::initializer_list<T> list,
|
||||
string_view sep) {
|
||||
return join(std::begin(list), std::end(list), sep);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
arg_join<const T*, const T*, wchar_t> join(std::initializer_list<T> list,
|
||||
wstring_view sep) {
|
||||
return join(std::begin(list), std::end(list), sep);
|
||||
}
|
||||
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
#endif // FMT_RANGES_H_
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
#include <opm/output/data/Solution.hpp>
|
||||
#include <opm/output/data/Wells.hpp>
|
||||
#include <opm/output/data/Groups.hpp>
|
||||
#include <opm/parser/eclipse/Deck/UDAValue.hpp>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
@@ -23,6 +25,12 @@ class ParseContext;
|
||||
class Parser;
|
||||
class Python;
|
||||
class SummaryState;
|
||||
class UDQState;
|
||||
|
||||
namespace Action {
|
||||
class State;
|
||||
}
|
||||
|
||||
class msim {
|
||||
|
||||
public:
|
||||
@@ -31,16 +39,18 @@ public:
|
||||
|
||||
msim(const EclipseState& state);
|
||||
|
||||
Opm::UDAValue uda_val();
|
||||
|
||||
void well_rate(const std::string& well, data::Rates::opt rate, std::function<well_rate_function> func);
|
||||
void solution(const std::string& field, std::function<solution_function> func);
|
||||
void run(Schedule& schedule, EclipseIO& io, bool report_only);
|
||||
void post_step(Schedule& schedule, SummaryState& st, data::Solution& sol, data::Wells& well_data, size_t report_step);
|
||||
void post_step(Schedule& schedule, Action::State& action_state, SummaryState& st, data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& group_nwrk_data, size_t report_step);
|
||||
private:
|
||||
|
||||
void run_step(const Schedule& schedule, SummaryState& st, data::Solution& sol, data::Wells& well_data, size_t report_step, EclipseIO& io) const;
|
||||
void run_step(const Schedule& schedule, SummaryState& st, data::Solution& sol, data::Wells& well_data, size_t report_step, double dt, EclipseIO& io) const;
|
||||
void output(SummaryState& st, size_t report_step, bool substep, double seconds_elapsed, const data::Solution& sol, const data::Wells& well_data, EclipseIO& io) const;
|
||||
void simulate(const Schedule& schedule, const SummaryState& st, data::Solution& sol, data::Wells& well_data, size_t report_step, double seconds_elapsed, double time_step) const;
|
||||
void run_step(const Schedule& schedule, Action::State& action_state, SummaryState& st, UDQState& udq_state, data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& group_nwrk_data, size_t report_step, EclipseIO& io) const;
|
||||
void run_step(const Schedule& schedule, Action::State& action_state, SummaryState& st, UDQState& udq_state, data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& group_nwrk_data, size_t report_step, double dt, EclipseIO& io) const;
|
||||
void output(Action::State& action_state, SummaryState& st, const UDQState& udq_state, size_t report_step, bool substep, double seconds_elapsed, const data::Solution& sol, const data::Wells& well_data, const data::GroupAndNetworkValues& group_data, EclipseIO& io) const;
|
||||
void simulate(const Schedule& schedule, const SummaryState& st, data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& group_nwrk_data, size_t report_step, double seconds_elapsed, double time_step) const;
|
||||
|
||||
EclipseState state;
|
||||
std::map<std::string, std::map<data::Rates::opt, std::function<well_rate_function>>> well_rates;
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ActionContext.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Action/State.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
|
||||
@@ -44,35 +47,42 @@ void msim::run(Schedule& schedule, EclipseIO& io, bool report_only) {
|
||||
const double week = 7 * 86400;
|
||||
data::Solution sol;
|
||||
SummaryState st(std::chrono::system_clock::from_time_t(schedule.getStartTime()));
|
||||
UDQState udq_state(schedule.getUDQConfig(0).params().undefinedValue());
|
||||
Action::State action_state;
|
||||
Python python;
|
||||
|
||||
io.writeInitial();
|
||||
for (size_t report_step = 1; report_step < schedule.size(); report_step++) {
|
||||
data::Wells well_data;
|
||||
data::GroupAndNetworkValues group_nwrk_data;
|
||||
if (report_only)
|
||||
run_step(schedule, st, sol, well_data, report_step, io);
|
||||
run_step(schedule, action_state, st, udq_state, sol, well_data, group_nwrk_data, report_step, io);
|
||||
else {
|
||||
double time_step = std::min(week, 0.5*schedule.stepLength(report_step - 1));
|
||||
run_step(schedule, st, sol, well_data, report_step, time_step, io);
|
||||
run_step(schedule, action_state, st, udq_state, sol, well_data, group_nwrk_data, report_step, time_step, io);
|
||||
}
|
||||
post_step(schedule, st, sol, well_data, report_step);
|
||||
post_step(schedule, action_state, st, sol, well_data, group_nwrk_data, report_step);
|
||||
const auto& exit_status = schedule.exitStatus();
|
||||
if (exit_status.has_value())
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
UDAValue msim::uda_val() {
|
||||
return UDAValue();
|
||||
}
|
||||
|
||||
void msim::post_step(Schedule& schedule, SummaryState& st, data::Solution& /* sol */, data::Wells& /* well_data */, size_t report_step) {
|
||||
|
||||
void msim::post_step(Schedule& schedule, Action::State& action_state, SummaryState& st, data::Solution& /* sol */, data::Wells& /* well_data */, data::GroupAndNetworkValues& /* grp_nwrk_data */, size_t report_step) {
|
||||
const auto& actions = schedule.actions(report_step);
|
||||
if (actions.empty())
|
||||
return;
|
||||
|
||||
Action::Context context( st );
|
||||
Action::Context context( st , schedule.getWListManager(report_step));
|
||||
|
||||
auto sim_time = schedule.simTime(report_step);
|
||||
for (const auto& action : actions.pending(sim_time)) {
|
||||
auto result = action->eval(sim_time, context);
|
||||
for (const auto& action : actions.pending(action_state, sim_time)) {
|
||||
auto result = action->eval(context);
|
||||
if (result)
|
||||
schedule.applyAction(report_step, *action, result);
|
||||
}
|
||||
@@ -83,12 +93,12 @@ void msim::post_step(Schedule& schedule, SummaryState& st, data::Solution& /* so
|
||||
|
||||
|
||||
|
||||
void msim::run_step(const Schedule& schedule, SummaryState& st, data::Solution& sol, data::Wells& well_data, size_t report_step, EclipseIO& io) const {
|
||||
this->run_step(schedule, st, sol, well_data, report_step, schedule.stepLength(report_step - 1), io);
|
||||
void msim::run_step(const Schedule& schedule, Action::State& action_state, SummaryState& st, UDQState& udq_state, data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& grp_nwrk_data, size_t report_step, EclipseIO& io) const {
|
||||
this->run_step(schedule, action_state, st, udq_state, sol, well_data, grp_nwrk_data, report_step, schedule.stepLength(report_step - 1), io);
|
||||
}
|
||||
|
||||
|
||||
void msim::run_step(const Schedule& schedule, SummaryState& st, data::Solution& sol, data::Wells& well_data, size_t report_step, double dt, EclipseIO& io) const {
|
||||
void msim::run_step(const Schedule& schedule, Action::State& action_state, SummaryState& st, UDQState& udq_state, data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& group_nwrk_data, size_t report_step, double dt, EclipseIO& io) const {
|
||||
double start_time = schedule.seconds(report_step - 1);
|
||||
double end_time = schedule.seconds(report_step);
|
||||
double seconds_elapsed = start_time;
|
||||
@@ -98,9 +108,7 @@ void msim::run_step(const Schedule& schedule, SummaryState& st, data::Solution&
|
||||
if ((seconds_elapsed + time_step) > end_time)
|
||||
time_step = end_time - seconds_elapsed;
|
||||
|
||||
this->simulate(schedule, st, sol, well_data, report_step, seconds_elapsed, time_step);
|
||||
|
||||
Opm::data::Group group_data;
|
||||
this->simulate(schedule, st, sol, well_data, group_nwrk_data, report_step, seconds_elapsed, time_step);
|
||||
|
||||
seconds_elapsed += time_step;
|
||||
|
||||
@@ -110,24 +118,31 @@ void msim::run_step(const Schedule& schedule, SummaryState& st, data::Solution&
|
||||
this->state,
|
||||
schedule,
|
||||
well_data,
|
||||
group_data,
|
||||
group_nwrk_data,
|
||||
{});
|
||||
|
||||
this->output(st,
|
||||
schedule.getUDQConfig( report_step ).eval(report_step, st, udq_state);
|
||||
|
||||
this->output(action_state,
|
||||
st,
|
||||
udq_state,
|
||||
report_step,
|
||||
(seconds_elapsed < end_time),
|
||||
seconds_elapsed,
|
||||
sol,
|
||||
well_data,
|
||||
group_nwrk_data,
|
||||
io);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void msim::output(SummaryState& st, size_t report_step, bool substep, double seconds_elapsed, const data::Solution& sol, const data::Wells& well_data, EclipseIO& io) const {
|
||||
RestartValue value(sol, well_data);
|
||||
io.writeTimeStep(st,
|
||||
void msim::output(Action::State& action_state, SummaryState& st, const UDQState& udq_state, size_t report_step, bool substep, double seconds_elapsed, const data::Solution& sol, const data::Wells& well_data, const data::GroupAndNetworkValues& group_nwrk_data, EclipseIO& io) const {
|
||||
RestartValue value(sol, well_data, group_nwrk_data);
|
||||
io.writeTimeStep(action_state,
|
||||
st,
|
||||
udq_state,
|
||||
report_step,
|
||||
substep,
|
||||
seconds_elapsed,
|
||||
@@ -135,7 +150,7 @@ void msim::output(SummaryState& st, size_t report_step, bool substep, double sec
|
||||
}
|
||||
|
||||
|
||||
void msim::simulate(const Schedule& schedule, const SummaryState& st, data::Solution& sol, data::Wells& well_data, size_t report_step, double seconds_elapsed, double time_step) const {
|
||||
void msim::simulate(const Schedule& schedule, const SummaryState& st, data::Solution& sol, data::Wells& well_data, data::GroupAndNetworkValues& /* group_nwrk_data */, size_t report_step, double seconds_elapsed, double time_step) const {
|
||||
for (const auto& sol_pair : this->solutions) {
|
||||
auto func = sol_pair.second;
|
||||
func(this->state, schedule, sol, report_step, seconds_elapsed + time_step);
|
||||
@@ -144,15 +159,17 @@ void msim::simulate(const Schedule& schedule, const SummaryState& st, data::Solu
|
||||
for (const auto& well_pair : this->well_rates) {
|
||||
const std::string& well_name = well_pair.first;
|
||||
const auto& sched_well = schedule.getWell(well_name, report_step);
|
||||
if (sched_well.getStatus() != Well::Status::OPEN)
|
||||
continue;
|
||||
bool well_open = (sched_well.getStatus() == Well::Status::OPEN);
|
||||
|
||||
data::Well& well = well_data[well_name];
|
||||
for (const auto& rate_pair : well_pair.second) {
|
||||
auto rate = rate_pair.first;
|
||||
auto func = rate_pair.second;
|
||||
|
||||
well.rates.set(rate, func(this->state, schedule, st, sol, report_step, seconds_elapsed + time_step));
|
||||
if (well_open)
|
||||
well.rates.set(rate, func(this->state, schedule, st, sol, report_step, seconds_elapsed + time_step));
|
||||
else
|
||||
well.rates.set(rate, 0.0);
|
||||
}
|
||||
|
||||
// This is complete bogus; a temporary fix to pass an assert() in the
|
||||
|
||||
@@ -15,6 +15,7 @@ set (opm-common_DEPS
|
||||
list(APPEND opm-common_DEPS
|
||||
# various runtime library enhancements
|
||||
"Boost 1.44.0 COMPONENTS system unit_test_framework REQUIRED"
|
||||
"OpenMP QUIET"
|
||||
)
|
||||
|
||||
find_package_deps(opm-common)
|
||||
|
||||
@@ -17,39 +17,63 @@
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LOCATION_HPP
|
||||
#define LOCATION_HPP
|
||||
#ifndef KEYWORD_LOCATION_HPP
|
||||
#define KEYWORD_LOCATION_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class Location {
|
||||
class KeywordLocation {
|
||||
public:
|
||||
/*
|
||||
Observe that many error messages whcih should print out the name of the
|
||||
problem keyword along with the location {} placeholders can be used. The
|
||||
convention is:
|
||||
|
||||
{keyword} -> keyword
|
||||
{file} -> filename
|
||||
{line} -> lineno
|
||||
|
||||
This convention must be adhered to at the call site *creating the output
|
||||
string*.
|
||||
*/
|
||||
|
||||
std::string keyword;
|
||||
std::string filename = "<memory string>";
|
||||
std::size_t lineno = 0;
|
||||
|
||||
Location() = default;
|
||||
Location(std::string fname, std::size_t lno) :
|
||||
KeywordLocation() = default;
|
||||
KeywordLocation(std::string kw, std::string fname, std::size_t lno) :
|
||||
keyword(std::move(kw)),
|
||||
filename(std::move(fname)),
|
||||
lineno(lno)
|
||||
{}
|
||||
|
||||
static Location serializeObject()
|
||||
std::string message() const {
|
||||
return this->keyword + " in " + this->filename + " at line " + std::to_string(this->lineno);
|
||||
}
|
||||
|
||||
static KeywordLocation serializeObject()
|
||||
{
|
||||
Location result;
|
||||
KeywordLocation result;
|
||||
result.keyword = "KW";
|
||||
result.filename = "test";
|
||||
result.lineno = 1;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool operator==(const Location& data) const {
|
||||
return filename == data.filename &&
|
||||
bool operator==(const KeywordLocation& data) const {
|
||||
return keyword == data.keyword &&
|
||||
filename == data.filename &&
|
||||
lineno == data.lineno;
|
||||
}
|
||||
|
||||
template<class Serializer>
|
||||
void serializeOp(Serializer& serializer)
|
||||
{
|
||||
serializer(keyword);
|
||||
serializer(filename);
|
||||
serializer(lineno);
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
#include <opm/common/OpmLog/Location.hpp>
|
||||
#include <opm/common/OpmLog/KeywordLocation.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@@ -59,8 +59,8 @@ namespace Log {
|
||||
|
||||
|
||||
bool isPower2(int64_t x);
|
||||
std::string fileMessage(const Location& location, const std::string& msg);
|
||||
std::string fileMessage(int64_t messageType , const Location& location , const std::string& msg);
|
||||
std::string fileMessage(const KeywordLocation& location, const std::string& msg);
|
||||
std::string fileMessage(int64_t messageType , const KeywordLocation& location , const std::string& msg);
|
||||
std::string prefixMessage(int64_t messageType , const std::string& msg);
|
||||
std::string colorCodeMessage(int64_t messageType , const std::string& msg);
|
||||
|
||||
|
||||
@@ -1,191 +0,0 @@
|
||||
/*
|
||||
Copyright 2016 Statoil ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SIMULATION_DATA_CONTAINER_HPP
|
||||
#define SIMULATION_DATA_CONTAINER_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
|
||||
/// The SimulationDataContainer is a simple container to manage
|
||||
/// simulation data. The container is instantiated with information
|
||||
/// of how many cells, faces and phases are present in the
|
||||
/// reservoirmodel. You can then add data to the container by using the
|
||||
///
|
||||
/// registerCellData()
|
||||
/// registerFaceData()
|
||||
///
|
||||
/// functions. The container owns and manages the data, but
|
||||
/// mutable references are returned with the getCellData() and
|
||||
/// getFaceData() methods, and the content will typically be
|
||||
/// modified by external scope.
|
||||
class SimulationDataContainer
|
||||
{
|
||||
public:
|
||||
/// Main constructor setting the sizes for the contained data
|
||||
/// types.
|
||||
/// \param num_cells number of elements in cell data vectors
|
||||
/// \param num_faces number of elements in face data vectors
|
||||
/// \param num_phases number of phases, the number of components
|
||||
/// in any data vector must equal 1 or this
|
||||
/// number (this behaviour and argument is deprecated).
|
||||
SimulationDataContainer(size_t num_cells, size_t num_faces, size_t num_phases);
|
||||
|
||||
/// Copy constructor.
|
||||
/// Must be defined explicitly because class contains non-value objects
|
||||
/// (the reference pointers pressure_ref_ etc.) that should not simply
|
||||
/// be copied.
|
||||
SimulationDataContainer(const SimulationDataContainer&);
|
||||
|
||||
/// Copy assignment operator.
|
||||
/// Must be defined explicitly because class contains non-value objects
|
||||
/// (the reference pointers pressure_ref_ etc.) that should not simply
|
||||
/// be copied.
|
||||
SimulationDataContainer& operator=(const SimulationDataContainer&);
|
||||
|
||||
/// Efficient O(1) swap.
|
||||
void swap(SimulationDataContainer& other);
|
||||
|
||||
size_t numPhases() const;
|
||||
size_t numFaces() const;
|
||||
size_t numCells() const;
|
||||
|
||||
bool hasCellData( const std::string& name ) const;
|
||||
|
||||
/// Will register a data vector of size numCells() *
|
||||
/// components.
|
||||
void registerCellData( const std::string& name , size_t components , double initialValue = 0.0 );
|
||||
std::vector<double>& getCellData( const std::string& name );
|
||||
const std::vector<double>& getCellData( const std::string& name ) const;
|
||||
|
||||
bool hasFaceData( const std::string& name ) const;
|
||||
void registerFaceData( const std::string& name , size_t components , double initialValue = 0.0 );
|
||||
std::vector<double>& getFaceData( const std::string& name );
|
||||
const std::vector<double>& getFaceData( const std::string& name ) const;
|
||||
|
||||
/// Will return the number of components of the celldata with
|
||||
/// name @name:
|
||||
///
|
||||
/// numCellDataComponents( "PRESSURE" ) -> 1
|
||||
/// numCellDataComponents( "SATURATION" ) -> 3
|
||||
///
|
||||
/// for a three phase model.
|
||||
size_t numCellDataComponents( const std::string& name ) const;
|
||||
bool equal(const SimulationDataContainer& other) const;
|
||||
|
||||
|
||||
/// Will set the values of component nr @component in the
|
||||
/// field @key. All the cells in @cells will be set to the
|
||||
/// values in @values.
|
||||
void setCellDataComponent( const std::string& key , size_t component , const std::vector<int>& cells , const std::vector<double>& values);
|
||||
|
||||
// Direct explicit field access for certain default fields.
|
||||
// These methods are all deprecated, and will eventually be moved to
|
||||
// concrete subclasses.
|
||||
|
||||
std::vector<double>& pressure ();
|
||||
std::vector<double>& temperature ();
|
||||
std::vector<double>& saturation ();
|
||||
|
||||
std::vector<double>& facepressure();
|
||||
std::vector<double>& faceflux ();
|
||||
|
||||
const std::vector<double>& pressure () const;
|
||||
const std::vector<double>& temperature () const;
|
||||
const std::vector<double>& saturation () const;
|
||||
|
||||
const std::vector<double>& facepressure() const;
|
||||
const std::vector<double>& faceflux () const;
|
||||
|
||||
const std::map<std::string, std::vector<double>>& cellData() const;
|
||||
std::map<std::string, std::vector<double>>& cellData();
|
||||
|
||||
private:
|
||||
void addDefaultFields();
|
||||
void setReferencePointers();
|
||||
|
||||
size_t m_num_cells;
|
||||
size_t m_num_faces;
|
||||
size_t m_num_phases;
|
||||
|
||||
std::map< std::string , std::vector<double> > m_cell_data;
|
||||
std::map< std::string , std::vector<double> > m_face_data;
|
||||
|
||||
std::vector<double>* pressure_ref_;
|
||||
std::vector<double>* temperature_ref_;
|
||||
std::vector<double>* saturation_ref_;
|
||||
std::vector<double>* facepressure_ref_;
|
||||
std::vector<double>* faceflux_ref_;
|
||||
};
|
||||
|
||||
|
||||
// Inline implementations of the direct accessors required to guarantee
|
||||
// performance.
|
||||
|
||||
|
||||
inline std::vector<double>& SimulationDataContainer::pressure( ) {
|
||||
return *pressure_ref_;
|
||||
}
|
||||
|
||||
inline std::vector<double>& SimulationDataContainer::temperature() {
|
||||
return *temperature_ref_;
|
||||
}
|
||||
|
||||
inline std::vector<double>& SimulationDataContainer::saturation() {
|
||||
return *saturation_ref_;
|
||||
}
|
||||
|
||||
inline std::vector<double>& SimulationDataContainer::facepressure() {
|
||||
return *facepressure_ref_;
|
||||
}
|
||||
|
||||
inline std::vector<double>& SimulationDataContainer::faceflux() {
|
||||
return *faceflux_ref_;
|
||||
}
|
||||
|
||||
inline const std::vector<double>& SimulationDataContainer::pressure( ) const {
|
||||
return *pressure_ref_;
|
||||
}
|
||||
|
||||
inline const std::vector<double>& SimulationDataContainer::temperature() const {
|
||||
return *temperature_ref_;
|
||||
}
|
||||
|
||||
inline const std::vector<double>& SimulationDataContainer::saturation() const {
|
||||
return *saturation_ref_;
|
||||
}
|
||||
|
||||
inline const std::vector<double>& SimulationDataContainer::facepressure() const {
|
||||
return *facepressure_ref_;
|
||||
}
|
||||
|
||||
inline const std::vector<double>& SimulationDataContainer::faceflux() const {
|
||||
return *faceflux_ref_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -20,7 +20,7 @@
|
||||
#define OPM_FILESYSTEM_HPP
|
||||
|
||||
#if __cplusplus < 201703L || \
|
||||
(defined(__GNUC__) && __GNUC__ < 8)
|
||||
(defined(__GNUC__) && __GNUC__ < 8 && !defined(__clang__))
|
||||
#include <experimental/filesystem>
|
||||
#else
|
||||
#include <filesystem>
|
||||
@@ -32,7 +32,7 @@
|
||||
namespace Opm
|
||||
{
|
||||
#if __cplusplus < 201703L || \
|
||||
(defined(__GNUC__) && __GNUC__ < 8)
|
||||
(defined(__GNUC__) && __GNUC__ < 8 && !defined(__clang__))
|
||||
namespace filesystem = std::experimental::filesystem;
|
||||
#else
|
||||
namespace filesystem = std::filesystem;
|
||||
|
||||
121
opm/common/utility/OpmInputError.hpp
Normal file
121
opm/common/utility/OpmInputError.hpp
Normal file
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
Copyright 2020 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef OPM_ERROR_HPP
|
||||
#define OPM_ERROR_HPP
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <opm/common/OpmLog/KeywordLocation.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
/*
|
||||
The OpmInputError is a custom exception class which can be used to signal
|
||||
errors in input handling. The importance of the OpmInputError exception is
|
||||
*not* the tecnical functionality it provides, but rather the convention
|
||||
surrounding it, when and how it should be used.
|
||||
|
||||
The OpmInputError should be used in situations which are "close to user
|
||||
input", the root cause can either be incorrect user input or a bug/limitation
|
||||
in opm. OpmInputError should only be used in situations where we have a good
|
||||
understanding of the underlying issue, and can provide a good error message.
|
||||
|
||||
The local error handling should be complete when the OpmInputError is
|
||||
instantiated, it should not be caught and rethrown in order to e.g. add
|
||||
additional context or log messages. In order to avoid inadvertendly catching
|
||||
this exception in a catch all block.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
class OpmInputError : public std::exception {
|
||||
public:
|
||||
/*
|
||||
The message string will be used as format string in the fmt::format()
|
||||
function as, and optional {} markers can be used to inject keyword,
|
||||
filename and linenumber into the final what() message. The placeholders
|
||||
must use named arguments
|
||||
|
||||
{keyword} -> loc.keyword
|
||||
{file} -> loc.filename
|
||||
{line} -> loc.lineno
|
||||
|
||||
additionally, the message can contain any number of positional
|
||||
arguments to add further context to the message.
|
||||
|
||||
KeywordLocation loc("KW", "file.inc", 100);
|
||||
OpmInputError("Error at line {line} in file {file} - keyword: {keyword} ignored", location);
|
||||
OpmInputError("Error at line {line} in file {file} - keyword: {keyword} has invalid argument {}", invalid_argument);
|
||||
*/
|
||||
|
||||
template<typename ... Args>
|
||||
OpmInputError(const std::string& reason, const KeywordLocation& location, const Args& ...furtherLocations)
|
||||
: locations { location, furtherLocations... }
|
||||
, m_what {
|
||||
locations.size() == 1
|
||||
? formatSingle(reason, locations[0])
|
||||
: formatMultiple(reason, locations)
|
||||
}
|
||||
{ }
|
||||
|
||||
/*
|
||||
Allows for the initialisation of an OpmInputError from another exception.
|
||||
|
||||
Usage:
|
||||
|
||||
try {
|
||||
.
|
||||
.
|
||||
.
|
||||
} catch (const Opm::OpmInputError&) {
|
||||
throw;
|
||||
} catch (const std::exception& e) {
|
||||
std::throw_with_nested(Opm::OpmInputError(e, location));
|
||||
}
|
||||
*/
|
||||
OpmInputError(const std::exception& error, const KeywordLocation& location)
|
||||
: locations { location }
|
||||
, m_what { formatException(error, locations[0]) }
|
||||
{ }
|
||||
|
||||
const char * what() const throw()
|
||||
{
|
||||
return this->m_what.c_str();
|
||||
}
|
||||
|
||||
|
||||
static std::string format(const std::string& msg_format, const KeywordLocation& loc);
|
||||
|
||||
private:
|
||||
// The location member is here for debugging; depending on the msg_fmt
|
||||
// passed in the constructor we might not have captured all the information
|
||||
// in the location argument passed to the constructor.
|
||||
std::vector<KeywordLocation> locations;
|
||||
|
||||
std::string m_what;
|
||||
|
||||
static std::string formatException(const std::exception& e, const KeywordLocation& loc);
|
||||
static std::string formatSingle(const std::string& reason, const KeywordLocation&);
|
||||
static std::string formatMultiple(const std::string& reason, const std::vector<KeywordLocation>&);
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
118
opm/common/utility/Serializer.hpp
Normal file
118
opm/common/utility/Serializer.hpp
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
Copyright 2020 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#ifndef OPM_SERIALIZER_HPP
|
||||
#define OPM_SERIALIZER_HPP
|
||||
|
||||
namespace Opm {
|
||||
/*
|
||||
This is a very basic serialization class used to support serialization of
|
||||
small state objects from opm common. The main serialization code used in
|
||||
opm/flow is initiated and controlled from the restart code, and therefor
|
||||
slightly cumbersome to use for objects which should be serialized not as part
|
||||
of the restart code.
|
||||
*/
|
||||
|
||||
|
||||
class Serializer {
|
||||
public:
|
||||
Serializer() = default;
|
||||
explicit Serializer(const std::vector<char>& buffer_arg) :
|
||||
buffer(buffer_arg)
|
||||
{}
|
||||
|
||||
|
||||
template <typename T>
|
||||
void put(const T& value) {
|
||||
this->pack(std::addressof(value), sizeof(T));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void put(const T* ) {
|
||||
throw std::logic_error("Serializer can not pack pointers");
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T get() {
|
||||
T value;
|
||||
std::memcpy(&value, &this->buffer[this->read_pos], sizeof(T));
|
||||
this->read_pos += sizeof(T);
|
||||
return value;
|
||||
}
|
||||
|
||||
template<typename K, typename T>
|
||||
void put(const std::unordered_map<K,T>& values) {
|
||||
this->put(values.size());
|
||||
for (const auto& value_pair : values) {
|
||||
this->put(value_pair.first);
|
||||
this->put(value_pair.second);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename K, typename T>
|
||||
std::unordered_map<K,T> get() {
|
||||
std::unordered_map<K,T> values;
|
||||
auto size = this->get<std::size_t>();
|
||||
for (std::size_t index = 0; index < size; index++) {
|
||||
auto key = this->get<K>();
|
||||
auto value = this->get<T>();
|
||||
values.insert( std::make_pair(key,value) );
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
|
||||
std::vector<char> buffer;
|
||||
private:
|
||||
void pack(const void * ptr, std::size_t value_size) {
|
||||
std::size_t write_pos = this->buffer.size();
|
||||
std::size_t new_size = write_pos + value_size;
|
||||
this->buffer.resize( new_size );
|
||||
std::memcpy(&this->buffer[write_pos], ptr, value_size);
|
||||
}
|
||||
|
||||
std::size_t read_pos = 0;
|
||||
};
|
||||
|
||||
template <>
|
||||
void inline Serializer::put(const std::string& value) {
|
||||
this->put(value.size());
|
||||
if (value.empty())
|
||||
return;
|
||||
|
||||
this->pack(value.c_str(), value.size());
|
||||
}
|
||||
|
||||
template<>
|
||||
std::string inline Serializer::get<std::string>() {
|
||||
std::string::size_type length = this->get<std::string::size_type>();
|
||||
if (length == 0)
|
||||
return std::string{};
|
||||
|
||||
this->read_pos += length;
|
||||
return {std::addressof(this->buffer[this->read_pos - length]), length};
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
@@ -43,7 +43,7 @@ namespace Opm
|
||||
{
|
||||
OPM_THROW(std::runtime_error, "Maximum number of iterations exceeded: " << maxiter << "\n"
|
||||
<< "Current interval is [" << std::min(x0, x1) << ", "
|
||||
<< std::max(x0, x1) << "]");
|
||||
<< std::max(x0, x1) << "] abs(x0-x1) " << std::abs(x0-x1));
|
||||
return -1e100; // Never reached.
|
||||
}
|
||||
};
|
||||
@@ -64,7 +64,7 @@ namespace Opm
|
||||
OPM_REPORT;
|
||||
std::cerr << "Maximum number of iterations exceeded: " << maxiter
|
||||
<< ", current interval is [" << std::min(x0, x1) << ", "
|
||||
<< std::max(x0, x1) << "]";
|
||||
<< std::max(x0, x1) << "] abs(x0-x1) " << std::abs(x0-x1);
|
||||
return 0.5*(x0 + x1);
|
||||
}
|
||||
};
|
||||
@@ -124,7 +124,7 @@ namespace Opm
|
||||
iterations_used = 0;
|
||||
// In every iteraton, x1 is the last point computed,
|
||||
// and x0 is the last point computed that makes it a bracket.
|
||||
while (fabs(x1 - x0) >= 1e-9*eps) {
|
||||
while (fabs(x1 - x0) >= eps) {
|
||||
double xnew = regulaFalsiStep(x0, x1, f0, f1);
|
||||
double fnew = f(xnew);
|
||||
// cout << "xnew = " << xnew << " fnew = " << fnew << endl;
|
||||
@@ -221,7 +221,7 @@ namespace Opm
|
||||
iterations_used = 0;
|
||||
// In every iteraton, x1 is the last point computed,
|
||||
// and x0 is the last point computed that makes it a bracket.
|
||||
while (fabs(x1 - x0) >= 1e-9*eps) {
|
||||
while (fabs(x1 - x0) >= eps) {
|
||||
double xnew = regulaFalsiStep(x0, x1, f0, f1);
|
||||
double fnew = f(xnew);
|
||||
// cout << "xnew = " << xnew << " fnew = " << fnew << endl;
|
||||
@@ -327,7 +327,7 @@ namespace Opm
|
||||
// and x0 is the last point computed that makes it a bracket.
|
||||
double width = fabs(x1 - x0);
|
||||
double contraction = 1.0;
|
||||
while (width >= 1e-9 * eps) {
|
||||
while (width >= eps) {
|
||||
// If we are contracting sufficiently to at least halve
|
||||
// the interval width in two iterations we use regula
|
||||
// falsi. Otherwise, we take a bisection step to avoid
|
||||
|
||||
@@ -57,6 +57,8 @@ public:
|
||||
void LoadData(const std::vector<std::string>& vectList) const;
|
||||
void LoadData() const;
|
||||
|
||||
bool make_lodsmry_file();
|
||||
|
||||
std::chrono::system_clock::time_point startdate() const { return startdat; }
|
||||
|
||||
const std::vector<std::string>& keywordList() const;
|
||||
@@ -65,7 +67,7 @@ public:
|
||||
|
||||
int timestepIdxAtReportstepStart(const int reportStep) const;
|
||||
|
||||
size_t numberOfTimeSteps() const { return timeStepList.size(); }
|
||||
size_t numberOfTimeSteps() const { return nTstep; }
|
||||
|
||||
const std::string& get_unit(const std::string& name) const;
|
||||
const std::string& get_unit(const SummaryNode& node) const;
|
||||
@@ -74,9 +76,11 @@ public:
|
||||
void write_rsm_file(std::optional<Opm::filesystem::path> = std::nullopt) const;
|
||||
|
||||
private:
|
||||
Opm::filesystem::path inputFileName;
|
||||
Opm::filesystem::path inputFileName, lodFileName;
|
||||
int nI, nJ, nK, nSpecFiles;
|
||||
size_t nVect;
|
||||
bool fromSingleRun, lodEnabeled;
|
||||
uint64_t lod_offset, lod_arr_size;
|
||||
size_t nVect, nTstep;
|
||||
|
||||
std::vector<bool> formattedFiles;
|
||||
std::vector<std::string> dataFileList;
|
||||
@@ -129,6 +133,9 @@ private:
|
||||
|
||||
std::vector<std::tuple <std::string, uint64_t>> getListOfArrays(std::string filename, bool formatted);
|
||||
std::vector<int> makeKeywPosVector(int speInd) const;
|
||||
std::string read_string_from_disk(std::fstream& fileH, uint64_t size) const;
|
||||
void inspect_lodsmry();
|
||||
void Load_from_lodsmry(const std::vector<int>& keywIndVect) const;
|
||||
};
|
||||
|
||||
}} // namespace Opm::EclIO
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
namespace Opm { namespace EclIO {
|
||||
|
||||
@@ -31,6 +33,8 @@ namespace Opm { namespace EclIO {
|
||||
float flipEndianFloat(float num);
|
||||
double flipEndianDouble(double num);
|
||||
bool isEOF(std::fstream* fileH);
|
||||
bool fileExists(const std::string& filename);
|
||||
bool isFormatted(const std::string& filename);
|
||||
|
||||
std::tuple<int, int> block_size_data_binary(eclArrType arrType);
|
||||
std::tuple<int, int, int> block_size_data_formatted(eclArrType arrType);
|
||||
@@ -49,6 +53,25 @@ namespace Opm { namespace EclIO {
|
||||
void readFormattedHeader(std::fstream& fileH, std::string& arrName,
|
||||
int64_t &num, Opm::EclIO::eclArrType &arrType);
|
||||
|
||||
template<typename T, typename T2>
|
||||
std::vector<T> readBinaryArray(std::fstream& fileH, const int64_t size, Opm::EclIO::eclArrType type,
|
||||
std::function<T(T2)>& flip);
|
||||
|
||||
std::vector<int> readBinaryInteArray(std::fstream &fileH, const int64_t size);
|
||||
std::vector<float> readBinaryRealArray(std::fstream& fileH, const int64_t size);
|
||||
std::vector<double> readBinaryDoubArray(std::fstream& fileH, const int64_t size);
|
||||
std::vector<bool> readBinaryLogiArray(std::fstream &fileH, const int64_t size);
|
||||
std::vector<std::string> readBinaryCharArray(std::fstream& fileH, const int64_t size);
|
||||
|
||||
template<typename T>
|
||||
std::vector<T> readFormattedArray(const std::string& file_str, const int size, int64_t fromPos,
|
||||
std::function<T(const std::string&)>& process);
|
||||
|
||||
std::vector<int> readFormattedInteArray(const std::string& file_str, const int64_t size, int64_t fromPos);
|
||||
std::vector<std::string> readFormattedCharArray(const std::string& file_str, const int64_t size, int64_t fromPos);
|
||||
std::vector<float> readFormattedRealArray(const std::string& file_str, const int64_t size, int64_t fromPos);
|
||||
std::vector<bool> readFormattedLogiArray(const std::string& file_str, const int64_t size, int64_t fromPos);
|
||||
std::vector<double> readFormattedDoubArray(const std::string& file_str, const int64_t size, int64_t fromPos);
|
||||
|
||||
}} // namespace Opm::EclIO
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
*/
|
||||
|
||||
#ifndef OPM_IO_SUMMARYNODE_HPP
|
||||
#define OPM_IO_SUMMARYNODE_HPP
|
||||
@@ -25,11 +25,10 @@
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
|
||||
namespace Opm::EclIO {
|
||||
namespace Opm { namespace EclIO {
|
||||
|
||||
struct SummaryNode {
|
||||
enum class Category {
|
||||
Aquifer,
|
||||
Well,
|
||||
Group,
|
||||
Field,
|
||||
@@ -37,6 +36,8 @@ struct SummaryNode {
|
||||
Block,
|
||||
Connection,
|
||||
Segment,
|
||||
Aquifer,
|
||||
Node,
|
||||
Miscellaneous,
|
||||
};
|
||||
|
||||
@@ -55,6 +56,7 @@ struct SummaryNode {
|
||||
Type type;
|
||||
std::string wgname;
|
||||
int number;
|
||||
std::string fip_region;
|
||||
|
||||
constexpr static int default_number { std::numeric_limits<int>::min() };
|
||||
|
||||
@@ -72,6 +74,6 @@ struct SummaryNode {
|
||||
std::optional<std::string> display_number(number_renderer) const;
|
||||
};
|
||||
|
||||
} // namespace Opm::EclIO
|
||||
}} // namespace Opm::EclIO
|
||||
|
||||
#endif // OPM_IO_SUMMARYNODE_HPP
|
||||
|
||||
@@ -32,12 +32,19 @@ struct RstHeader;
|
||||
|
||||
struct RstGroup {
|
||||
RstGroup(const UnitSystem& unit_system,
|
||||
const RstHeader& header,
|
||||
const std::string* zwel,
|
||||
const int * igrp,
|
||||
const float * sgrp,
|
||||
const double * xgrp);
|
||||
|
||||
std::string name;
|
||||
|
||||
int parent_group;
|
||||
int prod_cmode;
|
||||
int winj_cmode;
|
||||
int ginj_cmode;
|
||||
|
||||
float oil_rate_limit;
|
||||
float water_rate_limit;
|
||||
float gas_rate_limit;
|
||||
|
||||
@@ -24,10 +24,12 @@
|
||||
#include <cstddef>
|
||||
|
||||
namespace Opm {
|
||||
class UnitSystem;
|
||||
|
||||
namespace RestartIO {
|
||||
|
||||
struct RstHeader {
|
||||
RstHeader(const std::vector<int>& intehead, const std::vector<bool>& logihead, const std::vector<double>& doubhead);
|
||||
RstHeader(const UnitSystem& unit_system, const std::vector<int>& intehead, const std::vector<bool>& logihead, const std::vector<double>& doubhead);
|
||||
|
||||
int nx;
|
||||
int ny;
|
||||
@@ -86,6 +88,7 @@ struct RstHeader {
|
||||
int ntfreg;
|
||||
int nplmix;
|
||||
int ngroup;
|
||||
int nwgmax;
|
||||
|
||||
bool e300_radial;
|
||||
bool e100_radial;
|
||||
@@ -100,6 +103,7 @@ struct RstHeader {
|
||||
bool dir_eps;
|
||||
bool reversible_eps;
|
||||
bool alt_eps;
|
||||
bool group_control_active;
|
||||
|
||||
double next_timestep1;
|
||||
double next_timestep2;
|
||||
@@ -110,6 +114,8 @@ struct RstHeader {
|
||||
double guide_rate_d;
|
||||
double guide_rate_e;
|
||||
double guide_rate_f;
|
||||
double guide_rate_delay;
|
||||
double guide_rate_damping;
|
||||
double udq_range;
|
||||
double udq_undefined;
|
||||
double udq_eps;
|
||||
|
||||
@@ -35,6 +35,11 @@ namespace Opm {
|
||||
|
||||
namespace RestartIO {
|
||||
struct RstState {
|
||||
RstState(const ::Opm::UnitSystem& unit_system,
|
||||
const std::vector<int>& intehead,
|
||||
const std::vector<bool>& logihead,
|
||||
const std::vector<double>& doubhead);
|
||||
|
||||
RstState(const ::Opm::UnitSystem& unit_system,
|
||||
const std::vector<int>& intehead,
|
||||
const std::vector<bool>& logihead,
|
||||
|
||||
@@ -66,6 +66,7 @@ struct RstWell {
|
||||
std::array<int, 2> ij;
|
||||
std::pair<int,int> k1k2;
|
||||
WellType wtype;
|
||||
int well_status;
|
||||
int active_control;
|
||||
int vfp_table;
|
||||
int pred_requested_control;
|
||||
@@ -88,12 +89,14 @@ struct RstWell {
|
||||
float datum_depth;
|
||||
float drainage_radius;
|
||||
float efficiency_factor;
|
||||
float alq_value;
|
||||
|
||||
double oil_rate;
|
||||
double water_rate;
|
||||
double gas_rate;
|
||||
double liquid_rate;
|
||||
double void_rate;
|
||||
double thp;
|
||||
double flow_bhp;
|
||||
double wct;
|
||||
double gor;
|
||||
|
||||
@@ -30,12 +30,26 @@ namespace Json {
|
||||
|
||||
class JsonObject {
|
||||
public:
|
||||
JsonObject();
|
||||
|
||||
explicit JsonObject(const Opm::filesystem::path& jsonFile );
|
||||
explicit JsonObject(const std::string& inline_json);
|
||||
explicit JsonObject(const char * inline_json);
|
||||
explicit JsonObject(cJSON * root);
|
||||
~JsonObject();
|
||||
|
||||
void add(double value);
|
||||
void add(int value);
|
||||
void add(const std::string& value);
|
||||
JsonObject add_array();
|
||||
JsonObject add_object();
|
||||
void add_item(const std::string& key, double value);
|
||||
void add_item(const std::string& key, int value);
|
||||
void add_item(const std::string& key, const std::string& value);
|
||||
JsonObject add_array(const std::string& key);
|
||||
JsonObject add_object(const std::string& key);
|
||||
std::string dump() const;
|
||||
|
||||
bool has_item(const std::string& key) const;
|
||||
JsonObject get_array_item( size_t index ) const;
|
||||
JsonObject get_item(const std::string& key) const;
|
||||
|
||||
@@ -46,14 +46,31 @@ namespace Opm { namespace data {
|
||||
struct AquiferData {
|
||||
int aquiferID; //< One-based ID, range 1..NANAQ
|
||||
double pressure; //< Aquifer pressure
|
||||
double fluxRate; //< Aquifer influx rate (liquid aquifer)
|
||||
// TODO: volume should have a better name, since meaning not clear
|
||||
double volume; //< Produced liquid volume
|
||||
double initPressure; //< Aquifer's initial pressure
|
||||
double datumDepth; //< Aquifer's pressure reference depth
|
||||
|
||||
AquiferType type;
|
||||
std::shared_ptr<FetkovichData> aquFet;
|
||||
|
||||
double get(const std::string& key) const
|
||||
{
|
||||
if ( key == "AAQR" ) {
|
||||
return this->fluxRate;
|
||||
} else if ( key == "AAQT" ) {
|
||||
return this->volume;
|
||||
} else if ( key == "AAQP" ) {
|
||||
return this->pressure;
|
||||
}
|
||||
return 0.;
|
||||
}
|
||||
};
|
||||
|
||||
// TODO: not sure what extension we will need
|
||||
using Aquifers = std::map<int, AquiferData>;
|
||||
|
||||
}} // Opm::data
|
||||
|
||||
#endif // OPM_OUTPUT_AQUIFER_HPP
|
||||
|
||||
@@ -36,10 +36,10 @@ namespace data {
|
||||
from the TargetType enum which indicates why they they have been
|
||||
added to the container - and where they are headed.
|
||||
|
||||
RESTART_SOLUTION : Fields which represent primary variables, and
|
||||
are reqired for restart. Typically pressure and
|
||||
suturation. WIll end up in the SOLUTION section of the restart
|
||||
file.
|
||||
RESTART_SOLUTION : Cell-based quantities that are output to the
|
||||
SOLUTION section of the restart file. ECLIPSE-compatible names.
|
||||
Many, but not necessarily all, of these quantities are required
|
||||
for restarting the simulator.
|
||||
|
||||
RESTART_AUXILIARY : Fields with extra information, not required
|
||||
for restart. Examples of this include fluid in place values or
|
||||
@@ -52,6 +52,10 @@ namespace data {
|
||||
will not be output anywhere else.
|
||||
|
||||
INIT : Fields which should go to the INIT file.
|
||||
|
||||
RESTART_OPM_EXTENDED: Cell-based quantities that are specific to
|
||||
OPM-Flow. Output only to extended OPM restart files. Specifically
|
||||
not output to ECLIPSE-compatible restart files.
|
||||
*/
|
||||
|
||||
|
||||
@@ -60,6 +64,7 @@ namespace data {
|
||||
RESTART_AUXILIARY,
|
||||
SUMMARY,
|
||||
INIT,
|
||||
RESTART_OPM_EXTENDED,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,66 +20,173 @@
|
||||
#ifndef OPM_OUTPUT_GROUPS_HPP
|
||||
#define OPM_OUTPUT_GROUPS_HPP
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <initializer_list>
|
||||
#include <map>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <opm/output/data/GuideRateValue.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp>
|
||||
|
||||
namespace Opm {
|
||||
namespace Opm { namespace data {
|
||||
|
||||
namespace data {
|
||||
|
||||
struct currentGroupConstraints {
|
||||
struct GroupConstraints {
|
||||
Opm::Group::ProductionCMode currentProdConstraint;
|
||||
Opm::Group::InjectionCMode currentGasInjectionConstraint;
|
||||
Opm::Group::InjectionCMode currentWaterInjectionConstraint;
|
||||
|
||||
template <class MessageBufferType>
|
||||
void write(MessageBufferType& buffer) const;
|
||||
|
||||
template <class MessageBufferType>
|
||||
void read(MessageBufferType& buffer);
|
||||
|
||||
inline currentGroupConstraints& set( Opm::Group::ProductionCMode cpc,
|
||||
Opm::Group::InjectionCMode cgic,
|
||||
Opm::Group::InjectionCMode cwic);
|
||||
|
||||
inline bool has();
|
||||
bool operator==(const GroupConstraints& other) const
|
||||
{
|
||||
return this->currentProdConstraint == other.currentProdConstraint &&
|
||||
this->currentGasInjectionConstraint == other.currentGasInjectionConstraint &&
|
||||
this->currentWaterInjectionConstraint == other.currentWaterInjectionConstraint;
|
||||
}
|
||||
|
||||
inline GroupConstraints& set(Opm::Group::ProductionCMode cpc,
|
||||
Opm::Group::InjectionCMode cgic,
|
||||
Opm::Group::InjectionCMode cwic);
|
||||
};
|
||||
|
||||
|
||||
class Group : public std::map<std::string, Opm::data::currentGroupConstraints> {
|
||||
public:
|
||||
struct GroupGuideRates {
|
||||
GuideRateValue production{};
|
||||
GuideRateValue injection{};
|
||||
|
||||
template <class MessageBufferType>
|
||||
void write(MessageBufferType& buffer) const {
|
||||
unsigned int size = this->size();
|
||||
buffer.write(size);
|
||||
for (const auto& witr : *this) {
|
||||
const std::string& name = witr.first;
|
||||
buffer.write(name);
|
||||
const auto& pi_constr = witr.second;
|
||||
pi_constr.write(buffer);
|
||||
}
|
||||
void write(MessageBufferType& buffer) const
|
||||
{
|
||||
this->production.write(buffer);
|
||||
this->injection .write(buffer);
|
||||
}
|
||||
|
||||
template <class MessageBufferType>
|
||||
void read(MessageBufferType& buffer) {
|
||||
unsigned int size;
|
||||
void read(MessageBufferType& buffer)
|
||||
{
|
||||
this->production.read(buffer);
|
||||
this->injection .read(buffer);
|
||||
}
|
||||
|
||||
bool operator==(const GroupGuideRates& other) const
|
||||
{
|
||||
return this->production == other.production
|
||||
&& this->injection == other.injection;
|
||||
}
|
||||
};
|
||||
|
||||
struct GroupData {
|
||||
GroupConstraints currentControl;
|
||||
GroupGuideRates guideRates{};
|
||||
|
||||
template <class MessageBufferType>
|
||||
void write(MessageBufferType& buffer) const
|
||||
{
|
||||
this->currentControl.write(buffer);
|
||||
this->guideRates .write(buffer);
|
||||
}
|
||||
|
||||
template <class MessageBufferType>
|
||||
void read(MessageBufferType& buffer)
|
||||
{
|
||||
this->currentControl.read(buffer);
|
||||
this->guideRates .read(buffer);
|
||||
}
|
||||
|
||||
bool operator==(const GroupData& other) const
|
||||
{
|
||||
return this->currentControl == other.currentControl
|
||||
&& this->guideRates == other.guideRates;
|
||||
}
|
||||
};
|
||||
|
||||
struct NodeData {
|
||||
double pressure { 0.0 };
|
||||
|
||||
template <class MessageBufferType>
|
||||
void write(MessageBufferType& buffer) const
|
||||
{
|
||||
buffer.write(this->pressure);
|
||||
}
|
||||
|
||||
template <class MessageBufferType>
|
||||
void read(MessageBufferType& buffer)
|
||||
{
|
||||
buffer.read(this->pressure);
|
||||
}
|
||||
|
||||
bool operator==(const NodeData& other) const
|
||||
{
|
||||
return this->pressure == other.pressure;
|
||||
}
|
||||
};
|
||||
|
||||
class GroupAndNetworkValues {
|
||||
public:
|
||||
std::map<std::string, GroupData> groupData {};
|
||||
std::map<std::string, NodeData> nodeData {};
|
||||
|
||||
template <class MessageBufferType>
|
||||
void write(MessageBufferType& buffer) const
|
||||
{
|
||||
this->writeMap(this->groupData, buffer);
|
||||
this->writeMap(this->nodeData, buffer);
|
||||
}
|
||||
|
||||
template <class MessageBufferType>
|
||||
void read(MessageBufferType& buffer)
|
||||
{
|
||||
this->readMap(buffer, this->groupData);
|
||||
this->readMap(buffer, this->nodeData);
|
||||
}
|
||||
|
||||
bool operator==(const GroupAndNetworkValues& other) const
|
||||
{
|
||||
return (this->groupData == other.groupData)
|
||||
&& (this->nodeData == other.nodeData);
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
this->groupData.clear();
|
||||
this->nodeData.clear();
|
||||
}
|
||||
|
||||
private:
|
||||
template <class MessageBufferType, class ValueType>
|
||||
void writeMap(const std::map<std::string, ValueType>& map,
|
||||
MessageBufferType& buffer) const
|
||||
{
|
||||
const unsigned int size = map.size();
|
||||
buffer.write(size);
|
||||
|
||||
for (const auto& [name, elm] : map) {
|
||||
buffer.write(name);
|
||||
elm .write(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
template <class MessageBufferType, class ValueType>
|
||||
void readMap(MessageBufferType& buffer,
|
||||
std::map<std::string, ValueType>& map)
|
||||
{
|
||||
unsigned int size;
|
||||
buffer.read(size);
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
|
||||
for (std::size_t i = 0; i < size; ++i) {
|
||||
std::string name;
|
||||
buffer.read(name);
|
||||
currentGroupConstraints cgc;
|
||||
cgc.read(buffer);
|
||||
this->emplace(name, cgc);
|
||||
|
||||
auto elm = ValueType{};
|
||||
elm.read(buffer);
|
||||
|
||||
map.emplace(name, std::move(elm));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -87,35 +194,31 @@ namespace Opm {
|
||||
/* IMPLEMENTATIONS */
|
||||
|
||||
template <class MessageBufferType>
|
||||
void currentGroupConstraints::write(MessageBufferType& buffer) const {
|
||||
void GroupConstraints::write(MessageBufferType& buffer) const {
|
||||
buffer.write(this->currentProdConstraint);
|
||||
buffer.write(this->currentGasInjectionConstraint);
|
||||
buffer.write(this->currentWaterInjectionConstraint);
|
||||
}
|
||||
|
||||
template <class MessageBufferType>
|
||||
void currentGroupConstraints::read(MessageBufferType& buffer) {
|
||||
void GroupConstraints::read(MessageBufferType& buffer) {
|
||||
buffer.read(this->currentProdConstraint);
|
||||
buffer.read(this->currentGasInjectionConstraint);
|
||||
buffer.read(this->currentWaterInjectionConstraint);
|
||||
}
|
||||
|
||||
|
||||
inline currentGroupConstraints& currentGroupConstraints::set( Opm::Group::ProductionCMode cpc,
|
||||
Opm::Group::InjectionCMode cgic,
|
||||
Opm::Group::InjectionCMode cwic) {
|
||||
inline GroupConstraints&
|
||||
GroupConstraints::set(Opm::Group::ProductionCMode cpc,
|
||||
Opm::Group::InjectionCMode cgic,
|
||||
Opm::Group::InjectionCMode cwic)
|
||||
{
|
||||
this->currentGasInjectionConstraint = cgic;
|
||||
this->currentWaterInjectionConstraint = cwic;
|
||||
this->currentProdConstraint = cpc;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline bool currentGroupConstraints::has() {
|
||||
return ((&this->currentGasInjectionConstraint != nullptr) && (&this->currentGasInjectionConstraint != nullptr)
|
||||
&& (&this->currentProdConstraint != nullptr));
|
||||
}
|
||||
|
||||
|
||||
}} // Opm::data
|
||||
|
||||
#endif //OPM_OUTPUT_GROUPS_HPP
|
||||
|
||||
156
opm/output/data/GuideRateValue.hpp
Normal file
156
opm/output/data/GuideRateValue.hpp
Normal file
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
Copyright (c) 2020 Equinor ASA
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef OPM_OUTPUT_DATA_GUIDERATEVALUE_HPP
|
||||
#define OPM_OUTPUT_DATA_GUIDERATEVALUE_HPP
|
||||
|
||||
#include <array>
|
||||
#include <bitset>
|
||||
#include <cstddef>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
namespace Opm { namespace data {
|
||||
|
||||
class GuideRateValue {
|
||||
public:
|
||||
enum class Item : std::size_t {
|
||||
Oil, Gas, Water, ResV,
|
||||
|
||||
// -- Must be last enumerator --
|
||||
NumItems,
|
||||
};
|
||||
|
||||
void clear()
|
||||
{
|
||||
this->mask_.reset();
|
||||
this->value_.fill(0.0);
|
||||
}
|
||||
|
||||
constexpr bool has(const Item p) const
|
||||
{
|
||||
const auto i = this->index(p);
|
||||
|
||||
return (i < Size) && this->mask_[i];
|
||||
}
|
||||
|
||||
bool operator==(const GuideRateValue& vec) const
|
||||
{
|
||||
return (this->mask_ == vec.mask_)
|
||||
&& (this->value_ == vec.value_);
|
||||
}
|
||||
|
||||
double get(const Item p) const
|
||||
{
|
||||
if (! this->has(p)) {
|
||||
throw std::invalid_argument {
|
||||
"Request for Unset Item Value for " + this->itemName(p)
|
||||
};
|
||||
}
|
||||
|
||||
return this->value_[ this->index(p) ];
|
||||
}
|
||||
|
||||
GuideRateValue& set(const Item p, const double value)
|
||||
{
|
||||
const auto i = this->index(p);
|
||||
|
||||
if (i >= Size) {
|
||||
throw std::invalid_argument {
|
||||
"Cannot Assign Item Value for Unsupported Item '"
|
||||
+ this->itemName(p) + '\''
|
||||
};
|
||||
}
|
||||
|
||||
this->mask_.set(i);
|
||||
this->value_[i] = value;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
GuideRateValue& operator+=(const GuideRateValue& rhs)
|
||||
{
|
||||
for (auto i = 0*Size; i < Size; ++i) {
|
||||
if (rhs.mask_[i]) {
|
||||
this->mask_.set(i);
|
||||
this->value_[i] += rhs.value_[i];
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class MessageBufferType>
|
||||
void write(MessageBufferType& buffer) const
|
||||
{
|
||||
auto maskrep = this->mask_.to_ullong();
|
||||
buffer.write(maskrep);
|
||||
|
||||
for (const auto& x : this->value_) {
|
||||
buffer.write(x);
|
||||
}
|
||||
}
|
||||
|
||||
template <class MessageBufferType>
|
||||
void read(MessageBufferType& buffer)
|
||||
{
|
||||
this->clear();
|
||||
|
||||
{
|
||||
auto mask = 0ull;
|
||||
buffer.read(mask);
|
||||
|
||||
this->mask_ = std::bitset<Size>(mask);
|
||||
}
|
||||
|
||||
for (auto& x : this->value_) {
|
||||
buffer.read(x);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
enum { Size = static_cast<std::size_t>(Item::NumItems) };
|
||||
|
||||
std::bitset<Size> mask_{};
|
||||
std::array<double, Size> value_{};
|
||||
|
||||
constexpr std::size_t index(const Item p) const noexcept
|
||||
{
|
||||
return static_cast<std::size_t>(p);
|
||||
}
|
||||
|
||||
std::string itemName(const Item p) const
|
||||
{
|
||||
switch (p) {
|
||||
case Item::Oil: return "Oil";
|
||||
case Item::Gas: return "Gas";
|
||||
case Item::Water: return "Water";
|
||||
case Item::ResV: return "ResV";
|
||||
|
||||
case Item::NumItems:
|
||||
return "Out of bounds (NumItems)";
|
||||
}
|
||||
|
||||
return "Unknown (" + std::to_string(this->index(p)) + ')';
|
||||
}
|
||||
};
|
||||
|
||||
}} // namespace Opm::data
|
||||
|
||||
#endif // OPM_OUTPUT_DATA_GUIDERATEVALUE_HPP
|
||||
@@ -30,6 +30,8 @@
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include <opm/output/data/GuideRateValue.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
|
||||
|
||||
namespace Opm {
|
||||
@@ -66,6 +68,8 @@ namespace Opm {
|
||||
well_potential_water = (1 << 14),
|
||||
well_potential_oil = (1 << 15),
|
||||
well_potential_gas = (1 << 16),
|
||||
brine = (1 << 17),
|
||||
alq = (1 << 18)
|
||||
};
|
||||
|
||||
using enum_size = std::underlying_type< opt >::type;
|
||||
@@ -117,6 +121,8 @@ namespace Opm {
|
||||
double well_potential_water = 0.0;
|
||||
double well_potential_oil = 0.0;
|
||||
double well_potential_gas = 0.0;
|
||||
double brine = 0.0;
|
||||
double alq = 0.0;
|
||||
};
|
||||
|
||||
struct Connection {
|
||||
@@ -131,6 +137,7 @@ namespace Opm {
|
||||
double cell_saturation_water;
|
||||
double cell_saturation_gas;
|
||||
double effective_Kh;
|
||||
double trans_factor;
|
||||
|
||||
bool operator==(const Connection& conn2) const
|
||||
{
|
||||
@@ -251,6 +258,7 @@ namespace Opm {
|
||||
std::vector< Connection > connections;
|
||||
std::unordered_map<std::size_t, Segment> segments;
|
||||
CurrentControl current_control;
|
||||
GuideRateValue guide_rates{};
|
||||
|
||||
inline bool flowing() const noexcept;
|
||||
template <class MessageBufferType>
|
||||
@@ -291,7 +299,8 @@ namespace Opm {
|
||||
control == well2.control &&
|
||||
connections == well2.connections &&
|
||||
segments == well2.segments &&
|
||||
current_control == well2.current_control;
|
||||
current_control == well2.current_control &&
|
||||
guide_rates == well2.guide_rates;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -404,7 +413,9 @@ namespace Opm {
|
||||
productivity_index_oil == rate.productivity_index_oil &&
|
||||
well_potential_water == rate.well_potential_water &&
|
||||
well_potential_oil == rate.well_potential_oil &&
|
||||
well_potential_gas == rate.well_potential_gas;
|
||||
well_potential_gas == rate.well_potential_gas &&
|
||||
brine == rate.brine &&
|
||||
alq == rate.alq;
|
||||
}
|
||||
|
||||
|
||||
@@ -436,6 +447,8 @@ namespace Opm {
|
||||
case opt::well_potential_water: return this->well_potential_water;
|
||||
case opt::well_potential_oil: return this->well_potential_oil;
|
||||
case opt::well_potential_gas: return this->well_potential_gas;
|
||||
case opt::brine: return this->brine;
|
||||
case opt::alq: return this->alq;
|
||||
}
|
||||
|
||||
throw std::invalid_argument(
|
||||
@@ -482,6 +495,8 @@ namespace Opm {
|
||||
buffer.write(this->well_potential_water);
|
||||
buffer.write(this->well_potential_oil);
|
||||
buffer.write(this->well_potential_gas);
|
||||
buffer.write(this->brine);
|
||||
buffer.write(this->alq);
|
||||
}
|
||||
|
||||
template <class MessageBufferType>
|
||||
@@ -494,6 +509,7 @@ namespace Opm {
|
||||
buffer.write(this->cell_saturation_water);
|
||||
buffer.write(this->cell_saturation_gas);
|
||||
buffer.write(this->effective_Kh);
|
||||
buffer.write(this->trans_factor);
|
||||
}
|
||||
|
||||
template <class MessageBufferType>
|
||||
@@ -538,6 +554,7 @@ namespace Opm {
|
||||
}
|
||||
|
||||
this->current_control.write(buffer);
|
||||
this->guide_rates.write(buffer);
|
||||
}
|
||||
|
||||
template <class MessageBufferType>
|
||||
@@ -560,6 +577,8 @@ namespace Opm {
|
||||
buffer.read(this->well_potential_water);
|
||||
buffer.read(this->well_potential_oil);
|
||||
buffer.read(this->well_potential_gas);
|
||||
buffer.read(this->brine);
|
||||
buffer.read(this->alq);
|
||||
}
|
||||
|
||||
template <class MessageBufferType>
|
||||
@@ -572,6 +591,7 @@ namespace Opm {
|
||||
buffer.read(this->cell_saturation_water);
|
||||
buffer.read(this->cell_saturation_gas);
|
||||
buffer.read(this->effective_Kh);
|
||||
buffer.read(this->trans_factor);
|
||||
}
|
||||
|
||||
template <class MessageBufferType>
|
||||
@@ -629,6 +649,7 @@ namespace Opm {
|
||||
}
|
||||
|
||||
this->current_control.read(buffer);
|
||||
this->guide_rates.read(buffer);
|
||||
}
|
||||
|
||||
}} // Opm::data
|
||||
|
||||
@@ -41,6 +41,10 @@ namespace Opm {
|
||||
class Schedule;
|
||||
class UDQInput;
|
||||
class UDQActive;
|
||||
|
||||
namespace Action {
|
||||
class State;
|
||||
}
|
||||
} // Opm
|
||||
|
||||
|
||||
@@ -52,10 +56,11 @@ class AggregateActionxData
|
||||
public:
|
||||
explicit AggregateActionxData(const std::vector<int>& actDims);
|
||||
|
||||
void captureDeclaredActionxData( const Opm::Schedule& sched,
|
||||
const Opm::SummaryState& st,
|
||||
const std::vector<int>& actDims,
|
||||
const std::size_t simStep);
|
||||
void captureDeclaredActionxData( const Opm::Schedule& sched,
|
||||
const Opm::Action::State& action_state,
|
||||
const Opm::SummaryState& st,
|
||||
const std::vector<int>& actDims,
|
||||
const std::size_t simStep);
|
||||
|
||||
const std::vector<int>& getIACT() const
|
||||
{
|
||||
|
||||
@@ -74,8 +74,12 @@ public:
|
||||
"GOPT", "GWPT", "GGPT", "GVPT", "GWIT",
|
||||
"GGIT", "GVIT",
|
||||
"GOPTH", "GWPTH", "GGPTH",
|
||||
"GWITH", "GGITH"};
|
||||
"GWITH", "GGITH",
|
||||
"GOPGR", "GWPGR", "GGPGR", "GVPGR",
|
||||
"GOIGR", "GWIGR", "GGIGR",
|
||||
};
|
||||
|
||||
// Note: guide rates don't exist at the FIELD level.
|
||||
const std::vector<std::string> restart_field_keys = {"FOPP", "FWPP", "FOPR", "FWPR", "FGPR",
|
||||
"FVPR", "FWIR", "FGIR", "FWCT", "FGOR",
|
||||
"FOPT", "FWPT", "FGPT", "FVPT", "FWIT",
|
||||
@@ -101,6 +105,13 @@ public:
|
||||
{"GVIT", 17},
|
||||
{"GOPP", 22},
|
||||
{"GWPP", 23},
|
||||
{"GOPGR", 85},
|
||||
{"GWPGR", 86},
|
||||
{"GGPGR", 87},
|
||||
{"GVPGR", 88},
|
||||
{"GOIGR", 89},
|
||||
{"GWIGR", 91},
|
||||
{"GGIGR", 93},
|
||||
{"GOPTH", 135},
|
||||
{"GWPTH", 139},
|
||||
{"GWITH", 140},
|
||||
@@ -121,6 +132,26 @@ public:
|
||||
{inj_cmode_enum::SALE, 0},
|
||||
};
|
||||
|
||||
// Note: guide rates don't exist at the FIELD level.
|
||||
const std::map<int, inj_cmode_enum> ICntlModeToiCMode = {
|
||||
{0, inj_cmode_enum::NONE},
|
||||
{1, inj_cmode_enum::RATE},
|
||||
{2, inj_cmode_enum::RESV},
|
||||
{3, inj_cmode_enum::REIN},
|
||||
{4, inj_cmode_enum::VREP}, };
|
||||
|
||||
using p_cmode = Opm::Group::ProductionCMode;
|
||||
const std::map<int, p_cmode> PCntlModeToPCMode = {
|
||||
{0, p_cmode::NONE},
|
||||
{1, p_cmode::ORAT},
|
||||
{2, p_cmode::WRAT},
|
||||
{3, p_cmode::GRAT},
|
||||
{4, p_cmode::LRAT},
|
||||
{9, p_cmode::CRAT},
|
||||
{5, p_cmode::RESV},
|
||||
{6, p_cmode::PRBL},
|
||||
};
|
||||
|
||||
const std::map<std::string, size_t> fieldKeyToIndex = {
|
||||
{"FOPR", 0},
|
||||
{"FWPR", 1},
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace Opm {
|
||||
class Schedule;
|
||||
class UDQInput;
|
||||
class UDQActive;
|
||||
class UDQState;
|
||||
} // Opm
|
||||
|
||||
namespace Opm { namespace RestartIO { namespace Helpers {
|
||||
@@ -57,7 +58,7 @@ public:
|
||||
|
||||
void captureDeclaredUDQData(const Opm::Schedule& sched,
|
||||
const std::size_t simStep,
|
||||
const Opm::SummaryState& st,
|
||||
const Opm::UDQState& udqState,
|
||||
const std::vector<int>& inteHead);
|
||||
|
||||
const std::vector<int>& getIUDQ() const
|
||||
@@ -94,12 +95,12 @@ void captureDeclaredUDQData(const Opm::Schedule& sched,
|
||||
{
|
||||
return this->dUDW_.data();
|
||||
}
|
||||
|
||||
|
||||
const std::vector<double>& getDUDG() const
|
||||
{
|
||||
return this->dUDG_.data();
|
||||
}
|
||||
|
||||
|
||||
const std::vector<double>& getDUDF() const
|
||||
{
|
||||
return this->dUDF_.data();
|
||||
@@ -127,10 +128,10 @@ private:
|
||||
|
||||
/// Aggregate 'DUDW' array (Double Precision) for all UDQ data. (Dimension = max no wells * noOfUDQ's)
|
||||
WindowedArray<double> dUDW_;
|
||||
|
||||
|
||||
/// Aggregate 'DUDG' array (Double Precision) for all UDQ data. (Dimension = (max no groups + 1) * noOfUDQ's)
|
||||
WindowedArray<double> dUDG_;
|
||||
|
||||
|
||||
/// Aggregate 'DUDF' array (Double Precision) for all UDQ data. (Dimension = Number of FU - UDQ's, with value equal to the actual constraint)
|
||||
WindowedArray<double> dUDF_;
|
||||
|
||||
|
||||
@@ -33,6 +33,9 @@ namespace Opm {
|
||||
class Schedule;
|
||||
class SummaryState;
|
||||
class UnitSystem;
|
||||
namespace Action {
|
||||
class State;
|
||||
}
|
||||
} // Opm
|
||||
|
||||
namespace Opm { namespace data {
|
||||
@@ -40,22 +43,18 @@ namespace Opm { namespace data {
|
||||
}} // Opm::data
|
||||
|
||||
namespace Opm { namespace RestartIO { namespace Helpers {
|
||||
|
||||
struct ActionResStatus {
|
||||
std::vector<Opm::Action::Result> result;
|
||||
std::vector<std::string> name;
|
||||
};
|
||||
|
||||
class AggregateWellData
|
||||
{
|
||||
public:
|
||||
explicit AggregateWellData(const std::vector<int>& inteHead);
|
||||
|
||||
void captureDeclaredWellData(const Schedule& sched,
|
||||
const UnitSystem& units,
|
||||
const std::size_t sim_step,
|
||||
const ::Opm::SummaryState& smry,
|
||||
const std::vector<int>& inteHead);
|
||||
void captureDeclaredWellData(const Schedule& sched,
|
||||
const UnitSystem& units,
|
||||
const std::size_t sim_step,
|
||||
const ::Opm::Action::State& action_state,
|
||||
const ::Opm::SummaryState& smry,
|
||||
const std::vector<int>& inteHead);
|
||||
|
||||
void captureDynamicWellData(const Opm::Schedule& sched,
|
||||
const std::size_t sim_step,
|
||||
@@ -86,8 +85,8 @@ namespace Opm { namespace RestartIO { namespace Helpers {
|
||||
return this->zWell_.data();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
/// Aggregate 'IWEL' array (Integer) for all wells.
|
||||
WindowedArray<int> iWell_;
|
||||
|
||||
@@ -45,7 +45,8 @@ class EclipseState;
|
||||
class Schedule;
|
||||
class SummaryConfig;
|
||||
class SummaryState;
|
||||
|
||||
class UDQState;
|
||||
namespace Action { class State; }
|
||||
/*!
|
||||
* \brief A class to write the reservoir state and the well state of a
|
||||
* blackoil simulation to disk using the Eclipse binary format.
|
||||
@@ -174,7 +175,9 @@ public:
|
||||
* hardcoded static map misc_units in Summary.cpp.
|
||||
*/
|
||||
|
||||
void writeTimeStep( const SummaryState& st,
|
||||
void writeTimeStep( const Action::State& action_state,
|
||||
const SummaryState& st,
|
||||
const UDQState& udq_state,
|
||||
int report_step,
|
||||
bool isSubstep,
|
||||
double seconds_elapsed,
|
||||
@@ -220,7 +223,7 @@ public:
|
||||
missing, if the bool is false missing keywords will be ignored
|
||||
(there will *not* be an empty vector in the return value).
|
||||
*/
|
||||
RestartValue loadRestart(SummaryState& summary_state, const std::vector<RestartKey>& solution_keys, const std::vector<RestartKey>& extra_keys = {}) const;
|
||||
RestartValue loadRestart(Action::State& action_state, SummaryState& summary_state, const std::vector<RestartKey>& solution_keys, const std::vector<RestartKey>& extra_keys = {}) const;
|
||||
const out::Summary& summary();
|
||||
|
||||
EclipseIO( const EclipseIO& ) = delete;
|
||||
|
||||
@@ -86,6 +86,7 @@ namespace RestartIO {
|
||||
int litmin;
|
||||
int mxwsit;
|
||||
int mxwpit;
|
||||
int wseg_mx_rst;
|
||||
};
|
||||
|
||||
struct Group {
|
||||
|
||||
@@ -20,23 +20,25 @@
|
||||
#ifndef OPM_REGION_CACHE_HPP
|
||||
#define OPM_REGION_CACHE_HPP
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm {
|
||||
class Schedule;
|
||||
class EclipseGrid;
|
||||
class FieldPropsManager;
|
||||
|
||||
namespace out {
|
||||
class RegionCache {
|
||||
public:
|
||||
RegionCache() = default;
|
||||
RegionCache(const std::vector<int>& fipnum, const EclipseGrid& grid, const Schedule& schedule);
|
||||
const std::vector<std::pair<std::string,size_t>>& connections( int region_id ) const;
|
||||
RegionCache(const std::set<std::string>& fip_regions, const FieldPropsManager& fp, const EclipseGrid& grid, const Schedule& schedule);
|
||||
const std::vector<std::pair<std::string,size_t>>& connections( const std::string& region_name, int region_id ) const;
|
||||
|
||||
private:
|
||||
std::vector<std::pair<std::string,size_t>> connections_empty;
|
||||
|
||||
std::map<int , std::vector<std::pair<std::string,size_t>>> connection_map;
|
||||
std::map<std::pair<std::string, int> , std::vector<std::pair<std::string,size_t>>> connection_map;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
#include <opm/output/eclipse/RestartValue.hpp>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@@ -37,6 +36,8 @@ namespace Opm {
|
||||
class EclipseGrid;
|
||||
class EclipseState;
|
||||
class Schedule;
|
||||
class UDQState;
|
||||
class SummaryState;
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
@@ -46,6 +47,12 @@ namespace Opm { namespace EclIO { namespace OutputStream {
|
||||
|
||||
}}}
|
||||
|
||||
namespace Opm { namespace Action {
|
||||
|
||||
class State;
|
||||
|
||||
}}
|
||||
|
||||
/*
|
||||
The two free functions RestartIO::save() and RestartIO::load() can
|
||||
be used to save and load reservoir and well state from restart
|
||||
@@ -76,12 +83,15 @@ namespace Opm { namespace RestartIO {
|
||||
const EclipseState& es,
|
||||
const EclipseGrid& grid,
|
||||
const Schedule& schedule,
|
||||
const Action::State& action_state,
|
||||
const SummaryState& sumState,
|
||||
const UDQState& udqState,
|
||||
bool write_double = false);
|
||||
|
||||
|
||||
RestartValue load(const std::string& filename,
|
||||
int report_step,
|
||||
Action::State& action_state,
|
||||
SummaryState& summary_state,
|
||||
const std::vector<RestartKey>& solution_keys,
|
||||
const EclipseState& es,
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <opm/output/data/Aquifer.hpp>
|
||||
#include <opm/output/data/Solution.hpp>
|
||||
#include <opm/output/data/Wells.hpp>
|
||||
#include <opm/output/data/Groups.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@@ -70,10 +71,11 @@ namespace Opm {
|
||||
using ExtraVector = std::vector<std::pair<RestartKey, std::vector<double>>>;
|
||||
data::Solution solution;
|
||||
data::Wells wells;
|
||||
data::GroupAndNetworkValues grp_nwrk;
|
||||
ExtraVector extra;
|
||||
std::vector<data::AquiferData> aquifer;
|
||||
|
||||
RestartValue(data::Solution sol, data::Wells wells_arg);
|
||||
RestartValue(data::Solution sol, data::Wells wells_arg, data::GroupAndNetworkValues grpn_nwrk_arg);
|
||||
|
||||
RestartValue() {}
|
||||
|
||||
@@ -89,6 +91,7 @@ namespace Opm {
|
||||
{
|
||||
return solution == val2.solution &&
|
||||
wells == val2.wells &&
|
||||
grp_nwrk == val2.grp_nwrk &&
|
||||
extra == val2.extra;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define OPM_OUTPUT_SUMMARY_HPP
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp>
|
||||
#include <opm/output/data/Aquifer.hpp>
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
@@ -38,7 +39,7 @@ namespace Opm {
|
||||
|
||||
namespace Opm { namespace data {
|
||||
class WellRates;
|
||||
class Group;
|
||||
class GroupAndNetworkValues;
|
||||
}} // namespace Opm::data
|
||||
|
||||
namespace Opm { namespace out {
|
||||
@@ -59,20 +60,21 @@ public:
|
||||
|
||||
void add_timestep(const SummaryState& st, const int report_step);
|
||||
|
||||
void eval(SummaryState& summary_state,
|
||||
const int report_step,
|
||||
const double secs_elapsed,
|
||||
const EclipseState& es,
|
||||
const Schedule& schedule,
|
||||
const data::WellRates& well_solution,
|
||||
const data::Group& group_solution,
|
||||
const GlobalProcessParameters& single_values,
|
||||
const RegionParameters& region_values = {},
|
||||
const BlockValues& block_values = {}) const;
|
||||
void eval(SummaryState& summary_state,
|
||||
const int report_step,
|
||||
const double secs_elapsed,
|
||||
const EclipseState& es,
|
||||
const Schedule& schedule,
|
||||
const data::WellRates& well_solution,
|
||||
const data::GroupAndNetworkValues& group_and_nwrk_solution,
|
||||
GlobalProcessParameters single_values,
|
||||
const RegionParameters& region_values = {},
|
||||
const BlockValues& block_values = {},
|
||||
const data::Aquifers& aquifers_values = {}) const;
|
||||
|
||||
void write() const;
|
||||
|
||||
|
||||
|
||||
private:
|
||||
class SummaryImplementation;
|
||||
std::unique_ptr<SummaryImplementation> pImpl_;
|
||||
|
||||
@@ -59,6 +59,8 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
|
||||
TrgFIP = 101,
|
||||
TrgSFT = 102,
|
||||
GRpar_damp = 144, // Guiderate parameter damping factor
|
||||
WsegRedFac = 145, // WSEGITER parameter (item 3) Reduction factor (F_R)
|
||||
WsegIncFac = 146, // WSEGITER parameter (item 4) Increas factor (F_I)
|
||||
UdqPar_2 = 212, // UDQPARAM item number 2 (Permitted range (+/-) of user-defined quantities)
|
||||
UdqPar_3 = 213, // UDQPARAM item number 3 (Value given to undefined elements when outputting data)
|
||||
UdqPar_4 = 214, // UDQPARAM item number 4 (fractional equality tolerance used in ==, <= etc. functions)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems {
|
||||
|
||||
|
||||
|
||||
namespace SGroup {
|
||||
enum prod_index : std::vector<float>::size_type {
|
||||
OilRateLimit = 6, // Group's oil production target/limit
|
||||
@@ -32,8 +32,12 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
|
||||
GasRateLimit = 8, // Group's gas production target/limit
|
||||
LiqRateLimit = 9, // Group's liquid production target/limit
|
||||
};
|
||||
|
||||
|
||||
enum inj_index : std::vector<float>::size_type {
|
||||
oilSurfRateLimit = 10, // Group's oil surface volume injection rate target/limit
|
||||
oilResRateLimit = 11, // Group's oil reservoir volume injection rate target/limit
|
||||
oilReinjectionLimit = 12, // Group's oil reinjection fraction target/limit
|
||||
oilVoidageLimit = 13, // Group's oil voidage injection fraction target/limit
|
||||
waterSurfRateLimit = 15, //i Group's water surface volume injection rate target/limit
|
||||
waterResRateLimit = 16, // Group's water reservoir volume injection rate target/limit
|
||||
waterReinjectionLimit = 17, // Group's water reinjection fraction target/limit
|
||||
@@ -46,8 +50,17 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
|
||||
};
|
||||
} // SGroup
|
||||
|
||||
|
||||
|
||||
|
||||
namespace IGroup {
|
||||
enum index : std::vector<int>::size_type {
|
||||
ProdCMode = 1,
|
||||
WInjCMode = 16,
|
||||
GInjCMode = 21,
|
||||
ParentGroup = 28,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
namespace XGroup {
|
||||
enum index : std::vector<double>::size_type {
|
||||
OilPrRate = 0, // Group's oil production rate
|
||||
@@ -74,6 +87,26 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
|
||||
OilPrPot = 22, // Group's oil production potential
|
||||
WatPrPot = 23, // Group's water production potential
|
||||
|
||||
OilPrGuideRate = 85, // Group's producer guide rate for oil.
|
||||
WatPrGuideRate = 86, // Group's producer guide rate for water.
|
||||
GasPrGuideRate = 87, // Group's producer guide rate for gas.
|
||||
VoidPrGuideRate = 88, // Group's producer guide rate for reservoir voidage volume.
|
||||
|
||||
OilInjGuideRate = 89, // Group's injection guide rate for oil.
|
||||
WatInjGuideRate = 91, // Group's injection guide rate for water.
|
||||
WatInjGuideRate_2 = 92, // Second copy of group's injection guide rate for water.
|
||||
// Not fully characterised.
|
||||
GasInjGuideRate = 93, // Groups injection guide rate for gas.
|
||||
|
||||
OilPrGuideRate_2 = 127, // Second copy of group's producer guide rate for oil.
|
||||
// Not fully characterised.
|
||||
WatPrGuideRate_2 = 128, // Second copy of group's producer guide rate for water.
|
||||
// Not fully characterised.
|
||||
GasPrGuideRate_2 = 129, // Second copy of group's producer guide rate for gas.
|
||||
// Not fully characterised.
|
||||
VoidPrGuideRate_2 = 130, // Second copy of group's producer guide rate for
|
||||
// reservoir voidage volume. Not fully characterised.
|
||||
|
||||
HistOilPrTotal = 135, // Group's total cumulative oil
|
||||
// production (observed/historical rates)
|
||||
HistWatPrTotal = 139, // Group's total cumulative water
|
||||
|
||||
@@ -118,6 +118,8 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
|
||||
|
||||
IHOURZ = 206, // IHOURZ = current simulation time HH:MM:SS – number of hours (HH) (0-23).
|
||||
IMINTS = 207, // IMINTS = current simulation time HH:MM:SS – number of minutes (MM) (0-59).
|
||||
|
||||
WSEGITR_IT2 = 208, // NR - maximum no of times that a new iteration cycle with a reduced Wp will be started
|
||||
|
||||
MAX_ACT_COND = 245, // Maximum number of conditions pr action
|
||||
MAX_AN_AQUIFERS = 252, // Maximum number of analytic aquifers
|
||||
|
||||
@@ -55,6 +55,8 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
|
||||
GasFlowFract = 10, // Normalised Gas flow rate fraction
|
||||
Pressure = 11, // Segment pressure
|
||||
|
||||
item31 = 30, // Very close to Normalised Water flow rate fraction - value used pr today
|
||||
|
||||
item40 = 39, // Unknown
|
||||
|
||||
ValveLength = 40, // Length of valve
|
||||
|
||||
@@ -36,14 +36,14 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
|
||||
ActWCtrl = 7, // Well's active target control mode (constraint).
|
||||
|
||||
item9 = 8, // Unknown
|
||||
item11 = 10, // Unknown
|
||||
Status = 10, // Well status
|
||||
VFPTab = 11, // ID (one-based) of well's current VFP table.
|
||||
|
||||
PredReqWCtrl = 15, // Well's requested control mode from
|
||||
// simulation deck (WCONINJE, WCONPROD).
|
||||
|
||||
item18 = 17, // Unknown
|
||||
XFlow = 22,
|
||||
XFlow = 22,
|
||||
item25 = 24, // Unknown
|
||||
item32 = 31, // Unknown
|
||||
item48 = 47, // Unknown
|
||||
@@ -58,6 +58,20 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
|
||||
// Value 0 for regular wells
|
||||
// Value #segments for MS wells
|
||||
|
||||
MSW_PlossMod = 81, // index for Pressure loss model for well segments
|
||||
// ih value for this index is:
|
||||
// = 0 for regular wells
|
||||
// = 0 for MSW wells and HFA (WELSEGS item 6)
|
||||
// = 1 for MSW wells and HF- (WELSEGS item 6)
|
||||
// = 2 for MSW wells and H-- (WELSEGS item 6)
|
||||
|
||||
MSW_MulPhaseMod = 85, // index for Multiphase flow model for well segments - NOTE DF - model is not implemented yet!!
|
||||
// ih value for this index is:
|
||||
// = 0 for regular wells
|
||||
// = 1 for MSW wells and HO (WELSEGS item 7)
|
||||
// = 2 for MSW wells and DF (WELSEGS item 7)
|
||||
|
||||
|
||||
CompOrd = 98, // Well's completion ordering scheme.
|
||||
};
|
||||
|
||||
@@ -66,7 +80,6 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
|
||||
enum WellCtrlMode : int {
|
||||
WMCtlUnk = -10, // Unknown well control mode (OPM only)
|
||||
Group = - 1, // Well under group control
|
||||
Shut = 0, // Well is shut
|
||||
OilRate = 1, // Well controlled by oil rate
|
||||
WatRate = 2, // Well controlled by water rate
|
||||
GasRate = 3, // Well controlled by gas rate
|
||||
@@ -97,6 +110,29 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
|
||||
// appearance in simulation model's
|
||||
// COMPDAT keyword.
|
||||
};
|
||||
|
||||
enum PLossMod : int {
|
||||
HFA = 0, // Components of pressure loss in MSW model for well (WELSEGS item 6)
|
||||
// Hydrostatic, Friction, Acceleration
|
||||
|
||||
HF_ = 1, // Hydrostatic, Friction,
|
||||
|
||||
H__ = 2, // Hydrostatic
|
||||
};
|
||||
|
||||
/*enum MPMod : int {
|
||||
HO = 1, // Multiphase flow model for MSW well
|
||||
// Homogeneous flow
|
||||
|
||||
DF = 2, // Drift flux model
|
||||
};*/
|
||||
|
||||
enum Status : int {
|
||||
Shut = -1000,
|
||||
Stop = 0,
|
||||
Open = 1,
|
||||
Auto = 3,
|
||||
};
|
||||
} // Value
|
||||
} // IWell
|
||||
|
||||
@@ -113,10 +149,11 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
|
||||
BHPTarget = 6, // Well's bottom hole pressure target
|
||||
|
||||
DatumDepth = 9, // Well's reference depth for BHP
|
||||
Alq_value = 10, // Well's artificial lift quantity
|
||||
|
||||
DrainageRadius = 17, // Well's drainage radius - item 7 from WELSPECS
|
||||
EfficiencyFactor1 = 24, // Item2 from WEFAC; this value is repeated at two locations.
|
||||
EfficiencyFactor2 = 31, //
|
||||
EfficiencyFactor2 = 31, // Item2 from WEFAC
|
||||
HistLiqRateTarget = 33, // Well's historical/observed liquid
|
||||
// rate target/limit
|
||||
|
||||
@@ -135,7 +172,7 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
|
||||
GasPrRate = 2, // Well's gas production rate
|
||||
LiqPrRate = 3, // Well's liquid production rate
|
||||
VoidPrRate = 4, // Well's reservoir voidage production rate
|
||||
|
||||
TubHeadPr = 5, // Well's tubing head pressure
|
||||
FlowBHP = 6, // Well's flowing/producing bottom hole pressure
|
||||
WatCut = 7, // Well's producing water cut
|
||||
GORatio = 8, // Well's producing gas/oil ratio
|
||||
@@ -157,6 +194,12 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
|
||||
|
||||
BHPTarget = 41, // Well's current BHP Target/Limit
|
||||
|
||||
PrimGuideRate = 48, // Well's "primary" guide rate (oil for producers,
|
||||
// preferred phase for injectors)
|
||||
WatPrGuideRate = 49, // Well's producer guide rate for water
|
||||
GasPrGuideRate = 50, // Well's producer guide rate for gas
|
||||
VoidPrGuideRate = 68, // Well's producer guide rate for reservoir voidag volume
|
||||
|
||||
HistOilPrTotal = 75, // Well's total cumulative oil production
|
||||
// (observed/historical rates)
|
||||
HistWatPrTotal = 76, // Well's total cumulative water
|
||||
@@ -169,6 +212,15 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
|
||||
HistGasInjTotal = 82, // Well's total cumulative gas injection
|
||||
// (observed/historical rates)
|
||||
|
||||
PrimGuideRate_2 = 91, // Second copy of well's primary guide rate.
|
||||
// Not fully characterised.
|
||||
WatPrGuideRate_2 = 92, // Second copy of well's producer guide rate for water.
|
||||
// Not fully characterised.
|
||||
GasPrGuideRate_2 = 93, // Second copy of well's producer guide rate for gas
|
||||
// Not fully characterised.
|
||||
VoidPrGuideRate_2 = 94, // Second copy of well's producer guide rate for reservoir voidage
|
||||
// Not fully characterised.
|
||||
|
||||
WatVoidPrRate = 122, // Well's voidage production rate
|
||||
GasVoidPrRate = 123, // Well's voidage production rate
|
||||
};
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace Opm {
|
||||
|
||||
class Schedule;
|
||||
class EclipseGrid;
|
||||
class UnitSystem;
|
||||
|
||||
namespace RptIO {
|
||||
|
||||
@@ -35,12 +36,13 @@ namespace Opm {
|
||||
unsigned value,
|
||||
const Schedule& schedule,
|
||||
const EclipseGrid& grid,
|
||||
const UnitSystem& unit_system,
|
||||
std::size_t time_step
|
||||
);
|
||||
|
||||
namespace workers {
|
||||
|
||||
void write_WELSPECS(std::ostream&, unsigned, const Schedule&, const EclipseGrid& grid, std::size_t);
|
||||
void write_WELSPECS(std::ostream&, unsigned, const Schedule&, const EclipseGrid& grid, const UnitSystem&, std::size_t);
|
||||
|
||||
} } }
|
||||
#endif // OPM_WRITE_RPT_HPP
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <opm/parser/eclipse/Deck/DeckValue.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
|
||||
#include <opm/parser/eclipse/Deck/value_status.hpp>
|
||||
#include <opm/common/OpmLog/Location.hpp>
|
||||
#include <opm/common/OpmLog/KeywordLocation.hpp>
|
||||
|
||||
namespace Opm {
|
||||
class DeckOutput;
|
||||
@@ -43,7 +43,7 @@ namespace Opm {
|
||||
|
||||
DeckKeyword();
|
||||
explicit DeckKeyword(const ParserKeyword& parserKeyword);
|
||||
DeckKeyword(const Location& location, const std::string& keywordName);
|
||||
DeckKeyword(const KeywordLocation& location, const std::string& keywordName);
|
||||
DeckKeyword(const ParserKeyword& parserKeyword, const std::vector<std::vector<DeckValue>>& record_list, UnitSystem& system_active, UnitSystem& system_default);
|
||||
DeckKeyword(const ParserKeyword& parserKeyword, const std::vector<int>& data);
|
||||
DeckKeyword(const ParserKeyword& parserKeyword, const std::vector<double>& data, UnitSystem& system_active, UnitSystem& system_default);
|
||||
@@ -52,7 +52,7 @@ namespace Opm {
|
||||
|
||||
const std::string& name() const;
|
||||
void setFixedSize();
|
||||
const Location& location() const;
|
||||
const KeywordLocation& location() const;
|
||||
|
||||
|
||||
size_t size() const;
|
||||
@@ -105,7 +105,7 @@ namespace Opm {
|
||||
|
||||
private:
|
||||
std::string m_keywordName;
|
||||
Location m_location;
|
||||
KeywordLocation m_location;
|
||||
|
||||
std::vector< DeckRecord > m_recordList;
|
||||
bool m_isDataKeyword;
|
||||
|
||||
@@ -34,7 +34,6 @@ namespace Opm {
|
||||
|
||||
void start_record( );
|
||||
void end_record( );
|
||||
void split_record();
|
||||
|
||||
void start_keyword(const std::string& kw);
|
||||
void end_keyword(bool add_slash);
|
||||
@@ -53,8 +52,10 @@ namespace Opm {
|
||||
size_t row_count;
|
||||
bool record_on;
|
||||
int org_precision;
|
||||
bool split_line;
|
||||
|
||||
template <typename T> void write_value(const T& value);
|
||||
void split_record();
|
||||
void write_sep( );
|
||||
void set_precision(int precision);
|
||||
};
|
||||
|
||||
@@ -54,6 +54,9 @@ public:
|
||||
double getSI() const;
|
||||
bool zero() const;
|
||||
|
||||
//epsilon limit = 1.E-20 (~= 0.)
|
||||
double epsilonLimit() const;
|
||||
|
||||
template<typename T>
|
||||
bool is() const;
|
||||
|
||||
@@ -65,6 +68,7 @@ public:
|
||||
bool operator!=(const UDAValue& other) const;
|
||||
UDAValue& operator=(double value);
|
||||
UDAValue& operator=(const std::string& value);
|
||||
void update_value(const UDAValue& other);
|
||||
|
||||
bool is_numeric() { return numeric_value; }
|
||||
|
||||
|
||||
@@ -118,6 +118,8 @@ namespace Opm {
|
||||
const std::vector<AquiferCT::AQUCT_data>& data() const;
|
||||
bool operator==(const AquiferCT& other) const;
|
||||
|
||||
bool hasAquifer(const int aquID) const;
|
||||
|
||||
template<class Serializer>
|
||||
void serializeOp(Serializer& serializer)
|
||||
{
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
const Aquifetp& fetp() const;
|
||||
const Aquancon& connections() const;
|
||||
bool operator==(const AquiferConfig& other);
|
||||
bool hasAquifer(const int aquID) const;
|
||||
|
||||
template<class Serializer>
|
||||
void serializeOp(Serializer& serializer)
|
||||
|
||||
@@ -76,6 +76,8 @@ class Aquifetp {
|
||||
std::vector<Aquifetp::AQUFETP_data>::const_iterator end() const;
|
||||
bool operator==(const Aquifetp& other) const;
|
||||
|
||||
bool hasAquifer(const int aquID) const;
|
||||
|
||||
template<class Serializer>
|
||||
void serializeOp(Serializer& serializer)
|
||||
{
|
||||
|
||||
@@ -38,9 +38,10 @@ namespace Opm {
|
||||
|
||||
static EclipseConfig serializeObject();
|
||||
|
||||
const InitConfig& init() const;
|
||||
InitConfig& init();
|
||||
IOConfig& io();
|
||||
const IOConfig& io() const;
|
||||
const InitConfig& init() const;
|
||||
const InitConfig& getInitConfig() const;
|
||||
|
||||
bool operator==(const EclipseConfig& data) const;
|
||||
|
||||
@@ -77,6 +77,8 @@ namespace Opm {
|
||||
IOConfig& getIOConfig();
|
||||
|
||||
const InitConfig& getInitConfig() const;
|
||||
InitConfig& getInitConfig();
|
||||
|
||||
const SimulationConfig& getSimulationConfig() const;
|
||||
virtual const EclipseGrid& getInputGrid() const;
|
||||
|
||||
|
||||
@@ -21,8 +21,9 @@
|
||||
#ifndef BOX_HPP_
|
||||
#define BOX_HPP_
|
||||
|
||||
#include <vector>
|
||||
#include <cstddef>
|
||||
#include <limits>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm {
|
||||
class DeckRecord;
|
||||
@@ -31,17 +32,32 @@ namespace Opm {
|
||||
class Box {
|
||||
public:
|
||||
|
||||
|
||||
struct cell_index {
|
||||
std::size_t global_index;
|
||||
std::size_t active_index;
|
||||
std::size_t data_index;
|
||||
|
||||
|
||||
cell_index(std::size_t g,std::size_t a, std::size_t d) :
|
||||
global_index(g),
|
||||
active_index(a),
|
||||
data_index(d)
|
||||
{}
|
||||
|
||||
|
||||
/*
|
||||
This constructor should is used by the global_index_list() member
|
||||
which will return a list of *all* the cells in the box. In this
|
||||
case the active_index will be set to the global_index. This is a
|
||||
hack to simplify the treatment of global fields in the FieldProps
|
||||
implementation.
|
||||
*/
|
||||
cell_index(std::size_t g, std::size_t d) :
|
||||
global_index(g),
|
||||
active_index(g),
|
||||
data_index(d)
|
||||
{}
|
||||
};
|
||||
|
||||
Box(const EclipseGrid& grid);
|
||||
@@ -53,7 +69,7 @@ namespace Opm {
|
||||
bool isGlobal() const;
|
||||
size_t getDim(size_t idim) const;
|
||||
const std::vector<cell_index>& index_list() const;
|
||||
const std::vector<size_t>& getIndexList() const;
|
||||
const std::vector<Box::cell_index>& global_index_list() const;
|
||||
bool equal(const Box& other) const;
|
||||
|
||||
|
||||
@@ -73,8 +89,8 @@ namespace Opm {
|
||||
size_t m_offset[3];
|
||||
|
||||
bool m_isGlobal;
|
||||
std::vector<size_t> global_index_list;
|
||||
std::vector<cell_index> m_index_list;
|
||||
std::vector<cell_index> m_active_index_list;
|
||||
std::vector<cell_index> m_global_index_list;
|
||||
|
||||
int lower(int dim) const;
|
||||
int upper(int dim) const;
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#define OPM_PARSER_ECLIPSE_GRID_HPP
|
||||
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Util/Value.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/MinpvMode.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/PinchMode.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/GridDims.hpp>
|
||||
@@ -32,6 +31,7 @@
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm {
|
||||
@@ -110,6 +110,7 @@ namespace Opm {
|
||||
double getPinchThresholdThickness( ) const;
|
||||
PinchMode::ModeEnum getPinchOption( ) const;
|
||||
PinchMode::ModeEnum getMultzOption( ) const;
|
||||
PinchMode::ModeEnum getPinchGapMode( ) const;
|
||||
|
||||
MinpvMode::ModeEnum getMinpvMode() const;
|
||||
const std::vector<double>& getMinpvVector( ) const;
|
||||
@@ -193,9 +194,10 @@ namespace Opm {
|
||||
private:
|
||||
std::vector<double> m_minpvVector;
|
||||
MinpvMode::ModeEnum m_minpvMode;
|
||||
Value<double> m_pinch;
|
||||
std::optional<double> m_pinch;
|
||||
PinchMode::ModeEnum m_pinchoutMode;
|
||||
PinchMode::ModeEnum m_multzMode;
|
||||
PinchMode::ModeEnum m_pinchGapMode;
|
||||
|
||||
bool m_circle = false;
|
||||
|
||||
|
||||
146
opm/parser/eclipse/EclipseState/Grid/FieldData.hpp
Normal file
146
opm/parser/eclipse/EclipseState/Grid/FieldData.hpp
Normal file
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
Copyright 2020 Equinor AS.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef FIELD_DATA_HPP
|
||||
#define FIELD_DATA_HPP
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/Box.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/Keywords.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/FieldData.hpp>
|
||||
#include <opm/parser/eclipse/Deck/value_status.hpp>
|
||||
|
||||
#include<string>
|
||||
#include<vector>
|
||||
#include<optional>
|
||||
#include<array>
|
||||
#include<algorithm>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
namespace Fieldprops
|
||||
{
|
||||
template<typename T>
|
||||
static void compress(std::vector<T>& data, const std::vector<bool>& active_map) {
|
||||
std::size_t shift = 0;
|
||||
for (std::size_t g = 0; g < active_map.size(); g++) {
|
||||
if (active_map[g] && shift > 0) {
|
||||
data[g - shift] = data[g];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!active_map[g])
|
||||
shift += 1;
|
||||
}
|
||||
|
||||
data.resize(data.size() - shift);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct FieldData {
|
||||
std::vector<T> data;
|
||||
std::vector<value::status> value_status;
|
||||
keywords::keyword_info<T> kw_info;
|
||||
std::optional<std::vector<T>> global_data;
|
||||
std::optional<std::vector<value::status>> global_value_status;
|
||||
mutable bool all_set;
|
||||
|
||||
FieldData() = default;
|
||||
|
||||
FieldData(const keywords::keyword_info<T>& info, std::size_t active_size, std::size_t global_size) :
|
||||
data(std::vector<T>(active_size)),
|
||||
value_status(active_size, value::status::uninitialized),
|
||||
kw_info(info),
|
||||
all_set(false)
|
||||
{
|
||||
if (global_size != 0) {
|
||||
this->global_data = std::vector<T>(global_size);
|
||||
this->global_value_status = std::vector<value::status>(global_size, value::status::uninitialized);
|
||||
}
|
||||
|
||||
if (info.scalar_init)
|
||||
this->default_assign( *info.scalar_init );
|
||||
}
|
||||
|
||||
|
||||
std::size_t size() const {
|
||||
return this->data.size();
|
||||
}
|
||||
|
||||
bool valid() const {
|
||||
if (this->all_set)
|
||||
return true;
|
||||
|
||||
static const std::array<value::status,2> invalid_value = {value::status::uninitialized, value::status::empty_default};
|
||||
const auto& it = std::find_first_of(this->value_status.begin(), this->value_status.end(), invalid_value.begin(), invalid_value.end());
|
||||
this->all_set = (it == this->value_status.end());
|
||||
|
||||
return this->all_set;
|
||||
}
|
||||
|
||||
void compress(const std::vector<bool>& active_map) {
|
||||
Fieldprops::compress(this->data, active_map);
|
||||
Fieldprops::compress(this->value_status, active_map);
|
||||
}
|
||||
|
||||
void copy(const FieldData<T>& src, const std::vector<Box::cell_index>& index_list) {
|
||||
for (const auto& ci : index_list) {
|
||||
this->data[ci.active_index] = src.data[ci.active_index];
|
||||
this->value_status[ci.active_index] = src.value_status[ci.active_index];
|
||||
}
|
||||
}
|
||||
|
||||
void default_assign(T value) {
|
||||
std::fill(this->data.begin(), this->data.end(), value);
|
||||
std::fill(this->value_status.begin(), this->value_status.end(), value::status::valid_default);
|
||||
|
||||
if (this->global_data) {
|
||||
std::fill(this->global_data->begin(), this->global_data->end(), value);
|
||||
std::fill(this->global_value_status->begin(), this->global_value_status->end(), value::status::valid_default);
|
||||
}
|
||||
}
|
||||
|
||||
void default_assign(const std::vector<T>& src) {
|
||||
if (src.size() != this->size())
|
||||
throw std::invalid_argument("Size mismatch got: " + std::to_string(src.size()) + " expected: " + std::to_string(this->size()));
|
||||
|
||||
std::copy(src.begin(), src.end(), this->data.begin());
|
||||
std::fill(this->value_status.begin(), this->value_status.end(), value::status::valid_default);
|
||||
}
|
||||
|
||||
void default_update(const std::vector<T>& src) {
|
||||
if (src.size() != this->size())
|
||||
throw std::invalid_argument("Size mismatch got: " + std::to_string(src.size()) + " expected: " + std::to_string(this->size()));
|
||||
|
||||
for (std::size_t i = 0; i < src.size(); i++) {
|
||||
if (!value::has_value(this->value_status[i])) {
|
||||
this->value_status[i] = value::status::valid_default;
|
||||
this->data[i] = src[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void update(std::size_t index, T value, value::status status) {
|
||||
this->data[index] = value;
|
||||
this->value_status[index] = status;
|
||||
}
|
||||
|
||||
};
|
||||
} // end namespace Fieldprops
|
||||
} // end namespace Opm
|
||||
#endif // FIELD_DATA_HPP
|
||||
@@ -21,6 +21,9 @@
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/TranCalculator.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/FieldData.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@@ -32,30 +35,6 @@ class TableManager;
|
||||
|
||||
class FieldPropsManager {
|
||||
|
||||
struct MemInfo {
|
||||
std::size_t global_size;
|
||||
std::size_t active_size;
|
||||
std::size_t int_fields;
|
||||
std::size_t double_fields;
|
||||
std::size_t total;
|
||||
|
||||
MemInfo(std::size_t gsize, std::size_t asize, std::size_t num_int, std::size_t num_double) :
|
||||
global_size(gsize),
|
||||
active_size(asize),
|
||||
int_fields(num_int),
|
||||
double_fields(num_double),
|
||||
total(asize * sizeof(int) * num_int + // The integer fields like SATNUM and PVTNUM
|
||||
asize * sizeof(double) * num_double + // The double fields like PORO and SWATINIT
|
||||
asize * sizeof(double) * 2 + // Depth and volume of all active cells
|
||||
asize * sizeof(unsigned char) * (num_int + num_double) + // The per cell value status flag
|
||||
gsize * sizeof(int)) // The global ACTNUM mapping
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
public:
|
||||
// The default constructor should be removed when the FieldPropsManager is mandatory
|
||||
@@ -66,7 +45,6 @@ public:
|
||||
const std::string& default_region() const;
|
||||
virtual std::vector<int> actnum() const;
|
||||
virtual std::vector<double> porv(bool global = false) const;
|
||||
MemInfo meminfo( ) const;
|
||||
|
||||
/*
|
||||
The number of cells in the fields managed by this FieldPropsManager.
|
||||
@@ -178,6 +156,14 @@ public:
|
||||
template <typename T>
|
||||
std::vector<std::string> keys() const;
|
||||
|
||||
const Fieldprops::FieldData<int>&
|
||||
get_int_field_data(const std::string& keyword) const;
|
||||
|
||||
/// \brief Get double field data associated with a keyword
|
||||
/// \param allow_unsupported If true we deactivate some checks on the
|
||||
/// keyword and thus allow getting FieldData used by the TranCalculator.
|
||||
const Fieldprops::FieldData<double>&
|
||||
get_double_field_data(const std::string& keyword, bool allow_unsupported=false) const;
|
||||
virtual const std::vector<int>& get_int(const std::string& keyword) const { return this->get<int>(keyword); }
|
||||
virtual std::vector<int> get_global_int(const std::string& keyword) const { return this->get_global<int>(keyword); }
|
||||
|
||||
@@ -187,6 +173,59 @@ public:
|
||||
virtual bool has_int(const std::string& keyword) const { return this->has<int>(keyword); }
|
||||
virtual bool has_double(const std::string& keyword) const { return this->has<double>(keyword); }
|
||||
|
||||
/*
|
||||
The transmissibility keywords TRANX, TRANY and TRANZ do not really fit
|
||||
well in the FieldProps system. The opm codebase is based on a full
|
||||
internalization in the parse phase, and then passing fully assembled
|
||||
objects to the simulator. When it comes to the transmissibilities this
|
||||
model breaks down because the input code in opm-common is not capable of
|
||||
calculating the transmissibility, that is performed in the simulator.
|
||||
|
||||
The EDIT section can have modifiers on TRAN, these must be applied *after*
|
||||
the initial transmissibilities are calculated. To support this all the
|
||||
modifiers to the TRAN{XYZ} fields are assembled in "transmissibility
|
||||
calculators", and then these modifiers can be applied to a TRAN vector
|
||||
after it has been calculated in the simulator. Usage from the simulator
|
||||
could look like:
|
||||
|
||||
|
||||
const auto& fp = eclState.fieldProps();
|
||||
|
||||
// Calculate transmissibilities using grid and permeability
|
||||
std::vector<double> tranx = ....
|
||||
|
||||
// Check if there are any active TRANX modifiers and apply them
|
||||
if (fp.tran_active("TRANX"))
|
||||
fp.apply_tran("TRANX", tranx);
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
Will check if there are any TRAN{XYZ} modifiers active in the deck.
|
||||
*/
|
||||
virtual bool tran_active(const std::string& keyword) const;
|
||||
|
||||
|
||||
/*
|
||||
Will apply all the TRAN modifiers which are present in the deck on the
|
||||
already initialized vector tran_data. The vector tran_data should be
|
||||
organised as the data vectors in the fieldpropsmanager - i.e. one element
|
||||
for each active cell - in lexicographical order. The operations which are
|
||||
supported by the transmissibility calculator are those given by the enum
|
||||
ScalarOperation in FieldProps.hpp.
|
||||
*/
|
||||
virtual void apply_tran(const std::string& keyword, std::vector<double>& tran_data) const;
|
||||
|
||||
/*
|
||||
When using MPI the FieldPropsManager is typically only assembled on the
|
||||
root node and then distributed to the other nodes afterwards. These
|
||||
methods are support methods for that, the real data used by the
|
||||
transmissibility calculators is in the form of custom 3D fields, they are
|
||||
distributed the same way the rest of the 3D fields are distributed.
|
||||
*/
|
||||
virtual std::vector<char> serialize_tran() const;
|
||||
virtual void deserialize_tran(const std::vector<char>& buffer);
|
||||
private:
|
||||
/*
|
||||
Return the keyword values as a std::vector<>. All elements in the return
|
||||
@@ -217,8 +256,8 @@ private:
|
||||
|
||||
/*
|
||||
This is exactly like the get() method, but the returned vector will have
|
||||
global cartesian size, where all inactive cells have been filled with
|
||||
zeros.
|
||||
global cartesian size. If the field has a default value that value will be
|
||||
used for filling in in the inactive cells, otherwise zero is used.
|
||||
*/
|
||||
template <typename T>
|
||||
std::vector<T> get_global(const std::string& keyword) const;
|
||||
@@ -227,6 +266,16 @@ private:
|
||||
std::shared_ptr<FieldProps> fp;
|
||||
};
|
||||
|
||||
|
||||
void deserialize_tran(std::unordered_map<std::string, Fieldprops::TranCalculator>& tran,
|
||||
const std::vector<char>& buffer);
|
||||
|
||||
template<class MapType>
|
||||
void apply_tran(const std::unordered_map<std::string, Fieldprops::TranCalculator>& tran,
|
||||
const MapType& double_data,
|
||||
std::size_t active_size,
|
||||
const std::string& keyword, std::vector<double>& data);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
67
opm/parser/eclipse/EclipseState/Grid/Keywords.hpp
Normal file
67
opm/parser/eclipse/EclipseState/Grid/Keywords.hpp
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
Copyright 2020 Equinor AS.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef OPM_KEYWORDS_HPP
|
||||
#define OPM_KEYWORDS_HPP
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
namespace Fieldprops
|
||||
{
|
||||
|
||||
namespace keywords {
|
||||
|
||||
template <typename T>
|
||||
struct keyword_info {
|
||||
std::optional<std::string> unit = std::nullopt;
|
||||
std::optional<T> scalar_init = std::nullopt;
|
||||
bool multiplier = false;
|
||||
bool top = false;
|
||||
bool global = false;
|
||||
|
||||
keyword_info<T>& init(T init_value) {
|
||||
this->scalar_init = init_value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
keyword_info<T>& unit_string(const std::string& unit_string) {
|
||||
this->unit = unit_string;
|
||||
return *this;
|
||||
}
|
||||
|
||||
keyword_info<T>& distribute_top(bool dtop) {
|
||||
this->top = dtop;
|
||||
return *this;
|
||||
}
|
||||
|
||||
keyword_info<T>& mult(bool m) {
|
||||
this->multiplier = m;
|
||||
return *this;
|
||||
}
|
||||
|
||||
keyword_info<T>& global_kw(bool g) {
|
||||
this->global = g;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
} // end namespace Keywords
|
||||
} // end namespace Fieldprops
|
||||
} //end namespace Opm
|
||||
#endif //OPM_KEYWORDS_HPP
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/FieldPropsManager.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/FaceDir.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Util/Value.hpp>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@@ -28,7 +28,9 @@ namespace Opm {
|
||||
enum ModeEnum {
|
||||
ALL = 1,
|
||||
TOPBOT = 2,
|
||||
TOP = 3
|
||||
TOP = 3,
|
||||
GAP = 4,
|
||||
NOGAP = 5,
|
||||
};
|
||||
|
||||
const std::string PinchMode2String(const ModeEnum enumValue);
|
||||
|
||||
@@ -19,227 +19,147 @@
|
||||
#ifndef ECLIPSE_SATFUNCPROPERTY_INITIALIZERS_HPP
|
||||
#define ECLIPSE_SATFUNCPROPERTY_INITIALIZERS_HPP
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
class Phases;
|
||||
class TableManager;
|
||||
}
|
||||
|
||||
namespace satfunc {
|
||||
namespace Opm { namespace satfunc {
|
||||
|
||||
std::vector<double> SGLEndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
/// Collection of unscaled/raw saturation range endpoints extracted
|
||||
/// directly from tables of tabulated saturation functions.
|
||||
struct RawTableEndPoints
|
||||
{
|
||||
/// Connate saturation endpoints
|
||||
struct {
|
||||
/// Connate gas saturation. One value for each saturation region.
|
||||
/// All zero values unless gas is an active phase.
|
||||
std::vector<double> gas;
|
||||
|
||||
std::vector<double> ISGLEndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
/// Connate water saturation. One value for each saturation region.
|
||||
/// All zero values unless water is an active phase.
|
||||
std::vector<double> water;
|
||||
} connate;
|
||||
|
||||
std::vector<double> SGUEndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
/// Critical saturation endpoints
|
||||
struct {
|
||||
/// Critical saturation of oil in oil/gas two-phase system. One
|
||||
/// value for each saturation region. All zero values unless oil
|
||||
/// is an active phase.
|
||||
std::vector<double> oil_in_gas;
|
||||
|
||||
std::vector<double> ISGUEndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
/// Critical saturation of oil in oil/water two-phase system. One
|
||||
/// value for each saturation region. All zero values unless oil
|
||||
/// is an active phase.
|
||||
std::vector<double> oil_in_water;
|
||||
|
||||
std::vector<double> SWLEndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
/// Critical saturation of gas. One value for each saturation
|
||||
/// region. All zero values unless oil is an active phase.
|
||||
std::vector<double> gas;
|
||||
|
||||
std::vector<double> ISWLEndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
/// Critical saturation of water. One value for each saturation
|
||||
/// region. All zero values unless oil is an active phase.
|
||||
std::vector<double> water;
|
||||
} critical;
|
||||
|
||||
std::vector<double> SWUEndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
/// Maximum saturation endpoints
|
||||
struct {
|
||||
/// Maximum gas saturation value. One value for each saturation
|
||||
/// region All zero values unless gas is an active phase.
|
||||
std::vector<double> gas;
|
||||
|
||||
std::vector<double> ISWUEndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
/// Maximum water saturation value. One value for each saturation
|
||||
/// region All zero values unless gas is an active phase.
|
||||
std::vector<double> water;
|
||||
} maximum;
|
||||
};
|
||||
|
||||
std::vector<double> SGCREndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
/// Collection of unscaled/raw saturation function value range endpoints
|
||||
/// extracted directly from tables of tabulated saturation functions.
|
||||
struct RawFunctionValues
|
||||
{
|
||||
/// Function values for relative permeability of oil.
|
||||
struct {
|
||||
/// Maximum relative permeability value of oil in both oil/gas and
|
||||
/// oil/water two-phase systems. One value for each saturation
|
||||
/// region. All zero values unless oil is an active phase.
|
||||
std::vector<double> max;
|
||||
|
||||
std::vector<double> ISGCREndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
/// Relative permeability of oil at critical saturation of
|
||||
/// displacing phase in oil/gas two-phase system. One value for
|
||||
/// each saturation region. All zero values unless oil is
|
||||
/// an active phase.
|
||||
std::vector<double> rg;
|
||||
|
||||
std::vector<double> SOWCREndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
/// Relative permeability of oil at critical saturation of
|
||||
/// displacing phase in oil/water two-phase system. One value
|
||||
/// for each saturation region. All zero values unless oil is
|
||||
/// an active phase.
|
||||
std::vector<double> rw;
|
||||
} kro;
|
||||
|
||||
std::vector<double> ISOWCREndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
/// Function values for relative permeability of gas.
|
||||
struct {
|
||||
/// Maximum relative permeability value of gas. One value for
|
||||
/// each saturation region. All zero values unless gas is
|
||||
/// an active phase.
|
||||
std::vector<double> max;
|
||||
|
||||
std::vector<double> SOGCREndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
/// Relative permeability of gas at critical saturation of
|
||||
/// displacing phase. One value for each saturation region.
|
||||
/// All zero values unless gas is an active phase.
|
||||
std::vector<double> r;
|
||||
} krg;
|
||||
|
||||
std::vector<double> ISOGCREndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
/// Function values for relative permeability of gas.
|
||||
struct {
|
||||
/// Maximum relative permeability value of water. One value for
|
||||
/// each saturation region. All zero values unless water is
|
||||
/// an active phase.
|
||||
std::vector<double> max;
|
||||
|
||||
std::vector<double> SWCREndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
/// Relative permeability of water at critical saturation of
|
||||
/// displacing phase. One value for each saturation region.
|
||||
/// All zero values unless water is an active phase.
|
||||
std::vector<double> r;
|
||||
} krw;
|
||||
|
||||
std::vector<double> ISWCREndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
/// Maximum capillary function values.
|
||||
struct {
|
||||
/// Maximum gas/oil capillary pressure value (Pg - Po). One
|
||||
/// value for each saturation region. All zero values unless
|
||||
/// both gas and oil are active phase.
|
||||
std::vector<double> g;
|
||||
|
||||
std::vector<double> PCWEndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
/// Maximum oil/eater capillary pressure value (Po - Pw). One
|
||||
/// value for each saturation region. All zero values unless
|
||||
/// both oil and water are active phase.
|
||||
std::vector<double> w;
|
||||
} pc;
|
||||
};
|
||||
|
||||
std::vector<double> IPCWEndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
std::shared_ptr<RawTableEndPoints>
|
||||
getRawTableEndpoints(const Opm::TableManager& tm,
|
||||
const Opm::Phases& phases,
|
||||
const double tolcrit);
|
||||
|
||||
std::vector<double> PCGEndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
|
||||
std::vector<double> IPCGEndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
|
||||
std::vector<double> KRWEndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
|
||||
std::vector<double> IKRWEndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
|
||||
std::vector<double> KRWREndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
|
||||
std::vector<double> IKRWREndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
|
||||
std::vector<double> KROEndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
|
||||
std::vector<double> IKROEndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
|
||||
std::vector<double> KRORWEndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
|
||||
std::vector<double> IKRORWEndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
|
||||
std::vector<double> KRORGEndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
|
||||
std::vector<double> IKRORGEndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
|
||||
std::vector<double> KRGEndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
|
||||
std::vector<double> IKRGEndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
|
||||
std::vector<double> KRGREndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
|
||||
std::vector<double> IKRGREndpoint(const TableManager&,
|
||||
const Phases&,
|
||||
const std::vector<double>&,
|
||||
const std::vector<int>&,
|
||||
const std::vector<int>&);
|
||||
std::shared_ptr<RawFunctionValues>
|
||||
getRawFunctionValues(const Opm::TableManager& tm,
|
||||
const Opm::Phases& phases,
|
||||
const RawTableEndPoints& ep);
|
||||
|
||||
std::vector<double> init(const std::string& kewyord,
|
||||
const TableManager& tables,
|
||||
const Phases& phases,
|
||||
const RawTableEndPoints& ep,
|
||||
const std::vector<double>& cell_depth,
|
||||
const std::vector<int>& num,
|
||||
const std::vector<int>& endnum);
|
||||
}
|
||||
}
|
||||
|
||||
}} // namespace Opm::satfunc
|
||||
|
||||
#endif // ECLIPSE_SATFUNCPROPERTY_INITIALIZERS_HPP
|
||||
|
||||
107
opm/parser/eclipse/EclipseState/Grid/TranCalculator.hpp
Normal file
107
opm/parser/eclipse/EclipseState/Grid/TranCalculator.hpp
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
Copyright 2020 Equinor AS.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef TRAN_CALCULATOR_HPP
|
||||
#define TRAN_CALCULATOR_HPP
|
||||
|
||||
#include<string>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/Keywords.hpp>
|
||||
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
namespace Fieldprops
|
||||
{
|
||||
|
||||
enum class ScalarOperation {
|
||||
ADD = 1,
|
||||
EQUAL = 2,
|
||||
MUL = 3,
|
||||
MIN = 4,
|
||||
MAX = 5
|
||||
};
|
||||
|
||||
|
||||
class TranCalculator {
|
||||
public:
|
||||
|
||||
struct TranAction {
|
||||
ScalarOperation op;
|
||||
std::string field;
|
||||
};
|
||||
|
||||
|
||||
TranCalculator(const std::string& name_arg) :
|
||||
m_name(name_arg)
|
||||
{}
|
||||
|
||||
std::string next_name() const {
|
||||
return this->m_name + std::to_string( this->actions.size() );
|
||||
}
|
||||
|
||||
std::vector<TranAction>::const_iterator begin() const {
|
||||
return this->actions.begin();
|
||||
}
|
||||
|
||||
std::vector<TranAction>::const_iterator end() const {
|
||||
return this->actions.end();
|
||||
}
|
||||
|
||||
void add_action(ScalarOperation op, const std::string& field) {
|
||||
this->actions.push_back(TranAction{op, field});
|
||||
}
|
||||
|
||||
std::size_t size() const {
|
||||
return this->actions.size();
|
||||
}
|
||||
|
||||
const std::string& name() const {
|
||||
return this->m_name;
|
||||
}
|
||||
|
||||
|
||||
keywords::keyword_info<double> make_kw_info(ScalarOperation op) {
|
||||
keywords::keyword_info<double> kw_info;
|
||||
switch (op) {
|
||||
case ScalarOperation::MUL:
|
||||
kw_info.init(1);
|
||||
break;
|
||||
case ScalarOperation::ADD:
|
||||
kw_info.init(0);
|
||||
break;
|
||||
case ScalarOperation::MAX:
|
||||
kw_info.init(std::numeric_limits<double>::max());
|
||||
break;
|
||||
case ScalarOperation::MIN:
|
||||
kw_info.init(std::numeric_limits<double>::lowest());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return kw_info;
|
||||
}
|
||||
private:
|
||||
std::string m_name;
|
||||
std::vector<TranAction> actions;
|
||||
};
|
||||
|
||||
} // namespace Fieldprops
|
||||
} // end namespace Opm
|
||||
#endif // TRAN_CALCULATOR_HPP
|
||||
@@ -165,7 +165,7 @@ namespace Opm {
|
||||
const std::string& getEclipseInputPath() const;
|
||||
|
||||
void overrideNOSIM(bool nosim);
|
||||
|
||||
void consistentFileFlags();
|
||||
|
||||
std::string getRestartFileName(const std::string& restart_base, int report_step, bool output) const;
|
||||
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
#include <optional>
|
||||
|
||||
#include <opm/common/OpmLog/KeywordLocation.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Tabdims.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EndpointScaling.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQParams.hpp>
|
||||
@@ -106,11 +108,17 @@ public:
|
||||
return this->nWMax;
|
||||
}
|
||||
|
||||
const std::optional<KeywordLocation>& location() const {
|
||||
return this->m_location;
|
||||
}
|
||||
|
||||
|
||||
bool operator==(const Welldims& data) const {
|
||||
return this->maxConnPerWell() == data.maxConnPerWell() &&
|
||||
this->maxWellsPerGroup() == data.maxWellsPerGroup() &&
|
||||
this->maxGroupsInField() == data.maxGroupsInField() &&
|
||||
this->maxWellsInField() == data.maxWellsInField();
|
||||
this->maxWellsInField() == data.maxWellsInField() &&
|
||||
this->location() == data.location();
|
||||
}
|
||||
|
||||
template<class Serializer>
|
||||
@@ -120,6 +128,7 @@ public:
|
||||
serializer(nCWMax);
|
||||
serializer(nWGMax);
|
||||
serializer(nGMax);
|
||||
serializer(m_location);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -127,6 +136,7 @@ private:
|
||||
int nCWMax { 0 };
|
||||
int nWGMax { 0 };
|
||||
int nGMax { 0 };
|
||||
std::optional<KeywordLocation> m_location;
|
||||
};
|
||||
|
||||
class WellSegmentDims {
|
||||
@@ -278,6 +288,8 @@ public:
|
||||
const EclHysterConfig& hysterPar() const noexcept;
|
||||
const Actdims& actdims() const noexcept;
|
||||
const SatFuncControls& saturationFunctionControls() const noexcept;
|
||||
int nupcol() const noexcept;
|
||||
bool co2Storage() const noexcept;
|
||||
|
||||
bool operator==(const Runspec& data) const;
|
||||
|
||||
@@ -293,6 +305,8 @@ public:
|
||||
hystpar.serializeOp(serializer);
|
||||
m_actdims.serializeOp(serializer);
|
||||
m_sfuncctrl.serializeOp(serializer);
|
||||
serializer(m_nupcol);
|
||||
serializer(m_co2storage);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -305,6 +319,8 @@ private:
|
||||
EclHysterConfig hystpar;
|
||||
Actdims m_actdims;
|
||||
SatFuncControls m_sfuncctrl;
|
||||
int m_nupcol;
|
||||
bool m_co2storage;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <map>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WListManager.hpp>
|
||||
|
||||
namespace Opm {
|
||||
namespace Action {
|
||||
@@ -37,7 +38,7 @@ namespace Action {
|
||||
|
||||
class Context {
|
||||
public:
|
||||
explicit Context(const SummaryState& summary_state);
|
||||
explicit Context(const SummaryState& summary_state, const WListManager& wlm);
|
||||
|
||||
/*
|
||||
The get methods will first check the internal storage in the 'values' map
|
||||
@@ -50,9 +51,11 @@ public:
|
||||
void add(const std::string& func, double value);
|
||||
|
||||
std::vector<std::string> wells(const std::string& func) const;
|
||||
const WListManager& wlist_manager() const;
|
||||
|
||||
private:
|
||||
const SummaryState& summary_state;
|
||||
const WListManager& wlm;
|
||||
std::map<std::string, double> values;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -101,9 +101,9 @@ public:
|
||||
void add_well(const std::string& well);
|
||||
|
||||
Result& operator|=(const Result& other);
|
||||
Result& operator=(const Result& src);
|
||||
Result& operator=(const Result& src);
|
||||
Result& operator&=(const Result& other);
|
||||
|
||||
|
||||
private:
|
||||
void assign(bool value);
|
||||
bool result;
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace Opm {
|
||||
class DeckKeyword;
|
||||
|
||||
namespace Action {
|
||||
class State;
|
||||
|
||||
/*
|
||||
The ActionX class internalizes the ACTIONX keyword. This keyword represents a
|
||||
@@ -71,13 +72,15 @@ public:
|
||||
static ActionX serializeObject();
|
||||
|
||||
void addKeyword(const DeckKeyword& kw);
|
||||
bool ready(std::time_t sim_time) const;
|
||||
Action::Result eval(std::time_t sim_time, const Action::Context& context) const;
|
||||
bool ready(const State& state, std::time_t sim_time) const;
|
||||
Action::Result eval(const Action::Context& context) const;
|
||||
|
||||
|
||||
std::string name() const { return this->m_name; }
|
||||
size_t max_run() const { return this->m_max_run; }
|
||||
double min_wait() const { return this->m_min_wait; }
|
||||
std::size_t id() const;
|
||||
void update_id(std::size_t id);
|
||||
std::time_t start_time() const { return this->m_start_time; }
|
||||
std::vector<DeckKeyword>::const_iterator begin() const;
|
||||
std::vector<DeckKeyword>::const_iterator end() const;
|
||||
@@ -99,11 +102,10 @@ public:
|
||||
serializer(m_max_run);
|
||||
serializer(m_min_wait);
|
||||
serializer(m_start_time);
|
||||
serializer(m_id);
|
||||
serializer.vector(keywords);
|
||||
condition.serializeOp(serializer);
|
||||
serializer.vector(m_conditions);
|
||||
serializer(run_count);
|
||||
serializer(last_run);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -111,12 +113,11 @@ private:
|
||||
size_t m_max_run = 0;
|
||||
double m_min_wait = 0.0;
|
||||
std::time_t m_start_time;
|
||||
std::size_t m_id = 0;
|
||||
|
||||
std::vector<DeckKeyword> keywords;
|
||||
Action::AST condition;
|
||||
std::vector<Condition> m_conditions;
|
||||
mutable size_t run_count = 0;
|
||||
mutable std::time_t last_run = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
namespace Opm {
|
||||
namespace Action {
|
||||
|
||||
class State;
|
||||
|
||||
/*
|
||||
The Actions class is a container of ACTIONX keywords. The main functionality
|
||||
is to provide a list of ACTIONX keywords which are ready to be evaluated.
|
||||
@@ -48,10 +50,10 @@ public:
|
||||
bool empty() const;
|
||||
void add(const ActionX& action);
|
||||
void add(const PyAction& pyaction);
|
||||
bool ready(std::time_t sim_time) const;
|
||||
bool ready(const State& state, std::time_t sim_time) const;
|
||||
const ActionX& get(const std::string& name) const;
|
||||
const ActionX& get(std::size_t index) const;
|
||||
std::vector<const ActionX *> pending(std::time_t sim_time) const;
|
||||
std::vector<const ActionX *> pending(const State& state, std::time_t sim_time) const;
|
||||
std::vector<const PyAction *> pending_python() const;
|
||||
|
||||
std::vector<ActionX>::const_iterator begin() const;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <opm/common/OpmLog/Location.hpp>
|
||||
#include <opm/common/OpmLog/KeywordLocation.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@@ -77,7 +77,7 @@ enum class Comparator {
|
||||
|
||||
|
||||
Condition() = default;
|
||||
Condition(const std::vector<std::string>& tokens, const Location& location);
|
||||
Condition(const std::vector<std::string>& tokens, const KeywordLocation& location);
|
||||
|
||||
|
||||
Quantity lhs;
|
||||
|
||||
59
opm/parser/eclipse/EclipseState/Schedule/Action/State.hpp
Normal file
59
opm/parser/eclipse/EclipseState/Schedule/Action/State.hpp
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
Copyright 2020 Equinor ASA.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef ACTION_STATE_HPP
|
||||
#define ACTION_STATE_HPP
|
||||
|
||||
#include <ctime>
|
||||
#include <map>
|
||||
|
||||
namespace Opm {
|
||||
namespace Action {
|
||||
|
||||
class ActionX;
|
||||
class State {
|
||||
|
||||
struct RunState {
|
||||
RunState(std::time_t sim_time) :
|
||||
run_count(1),
|
||||
last_run(sim_time)
|
||||
{}
|
||||
|
||||
void add_run(std::time_t sim_time) {
|
||||
this->last_run = sim_time;
|
||||
this->run_count += 1;
|
||||
}
|
||||
|
||||
|
||||
std::size_t run_count;
|
||||
std::time_t last_run;
|
||||
};
|
||||
|
||||
public:
|
||||
void add_run(const ActionX& action, std::time_t sim_time);
|
||||
std::size_t run_count(const ActionX& action) const;
|
||||
std::time_t run_time(const ActionX& action) const;
|
||||
private:
|
||||
std::map<std::pair<std::string, std::size_t>, RunState> run_state;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -21,10 +21,11 @@
|
||||
#ifndef DYNAMICSTATE_HPP_
|
||||
#define DYNAMICSTATE_HPP_
|
||||
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <optional>
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
||||
|
||||
@@ -155,50 +156,49 @@ class DynamicState {
|
||||
Schedule object, if e.g. a well is initially closed in the interval
|
||||
[T1,T2] and then opened at time T1 < Tx < T2 then the open should be
|
||||
applied for all times in the range [Tx,T2].
|
||||
|
||||
The return value is the index of the first element different from value,
|
||||
or an empty optional if there is no such element.
|
||||
*/
|
||||
void update_equal(size_t index, const T& value) {
|
||||
std::optional<std::size_t> update_equal(size_t index, const T& value) {
|
||||
if (this->m_data.size() <= index)
|
||||
throw std::out_of_range("Invalid index for update_equal()");
|
||||
|
||||
const T prev_value = this->m_data[index];
|
||||
if (prev_value == value)
|
||||
return;
|
||||
|
||||
//if (prev_value == value)
|
||||
// return {};
|
||||
while (true) {
|
||||
if (this->m_data[index] != prev_value)
|
||||
break;
|
||||
return index;
|
||||
|
||||
this->m_data[index] = value;
|
||||
|
||||
index++;
|
||||
if (index == this->m_data.size())
|
||||
break;
|
||||
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
/// Will return the index of the first occurence of @value, or
|
||||
/// -1 if @value is not found.
|
||||
int find(const T& value) const {
|
||||
/// Will return the index of the first occurence of @value
|
||||
std::optional<std::size_t> find(const T& value) const {
|
||||
auto iter = std::find( m_data.begin() , m_data.end() , value);
|
||||
if( iter == this->m_data.end() ) return -1;
|
||||
if( iter == this->m_data.end() ) return {};
|
||||
|
||||
return std::distance( m_data.begin() , iter );
|
||||
}
|
||||
|
||||
template<typename P>
|
||||
int find_if(P&& pred) const {
|
||||
std::optional<std::size_t> find_if(P&& pred) const {
|
||||
auto iter = std::find_if(m_data.begin(), m_data.end(), std::forward<P>(pred));
|
||||
if( iter == this->m_data.end() ) return -1;
|
||||
if( iter == this->m_data.end() ) return {};
|
||||
|
||||
return std::distance( m_data.begin() , iter );
|
||||
}
|
||||
|
||||
/// Will return the index of the first value which is != @value, or -1
|
||||
/// if all values are == @value
|
||||
int find_not(const T& value) const {
|
||||
/// Will return the index of the first value which is != @value
|
||||
std::optional<std::size_t> find_not(const T& value) const {
|
||||
auto iter = std::find_if_not( m_data.begin() , m_data.end() , [&value] (const T& elm) { return value == elm; });
|
||||
if( iter == this->m_data.end() ) return -1;
|
||||
if( iter == this->m_data.end() ) return {};
|
||||
|
||||
return std::distance( m_data.begin() , iter );
|
||||
}
|
||||
|
||||
@@ -35,22 +35,22 @@ namespace Opm
|
||||
the Schedule object the NEW_WELL event is triggered
|
||||
every time a WELSPECS keyword is encountered.
|
||||
*/
|
||||
NEW_WELL = 1,
|
||||
NEW_WELL = (1 << 0),
|
||||
|
||||
/*
|
||||
WHen the well data is updated with the WELSPECS keyword
|
||||
this event is triggered. Only applies to individual
|
||||
wells, and not the global Schedule object.
|
||||
*/
|
||||
WELL_WELSPECS_UPDATE = 2,
|
||||
WELL_WELSPECS_UPDATE = (1 << 1),
|
||||
|
||||
|
||||
//WELL_POLYMER_UPDATE = 4,
|
||||
//WELL_POLYMER_UPDATE = (1 << 2),
|
||||
/*
|
||||
The NEW_GROUP event is triggered by the WELSPECS and
|
||||
GRUPTREE keywords.
|
||||
*/
|
||||
NEW_GROUP = 8,
|
||||
NEW_GROUP = (1 << 3),
|
||||
|
||||
/*
|
||||
The PRODUCTION_UPDATE event is triggered by the
|
||||
@@ -59,48 +59,59 @@ namespace Opm
|
||||
is changed. Quite simlar for INJECTION_UPDATE and
|
||||
POLYMER_UPDATE.
|
||||
*/
|
||||
PRODUCTION_UPDATE = 16,
|
||||
INJECTION_UPDATE = 32,
|
||||
//POLYMER_UPDATES = 64,
|
||||
PRODUCTION_UPDATE = (1 << 4),
|
||||
INJECTION_UPDATE = (1 << 5),
|
||||
//POLYMER_UPDATES = (1 << 6),
|
||||
|
||||
/*
|
||||
This event is triggered if the well status is changed
|
||||
between {OPEN,SHUT,STOP,AUTO}. There are many keywords
|
||||
which can trigger a well status change.
|
||||
*/
|
||||
WELL_STATUS_CHANGE = 128,
|
||||
WELL_STATUS_CHANGE = (1 << 7),
|
||||
|
||||
/*
|
||||
COMPDAT and WELOPEN
|
||||
*/
|
||||
COMPLETION_CHANGE = 256,
|
||||
COMPLETION_CHANGE = (1 << 8),
|
||||
|
||||
/*
|
||||
The well group topolyg has changed.
|
||||
*/
|
||||
GROUP_CHANGE = 512,
|
||||
GROUP_CHANGE = (1 << 9),
|
||||
|
||||
|
||||
/*
|
||||
Geology modifier.
|
||||
*/
|
||||
GEO_MODIFIER = 1024,
|
||||
GEO_MODIFIER = (1 << 10),
|
||||
|
||||
/*
|
||||
TUNING has changed
|
||||
*/
|
||||
TUNING_CHANGE = 2048,
|
||||
TUNING_CHANGE = (1 << 11),
|
||||
|
||||
/* The VFP tables have changed */
|
||||
VFPINJ_UPDATE = 4096,
|
||||
VFPPROD_UPDATE = 8192,
|
||||
VFPINJ_UPDATE = (1 << 12),
|
||||
VFPPROD_UPDATE = (1 << 13),
|
||||
|
||||
|
||||
/*
|
||||
GROUP production or injection targets has changed
|
||||
*/
|
||||
GROUP_PRODUCTION_UPDATE = 16384,
|
||||
GROUP_INJECTION_UPDATE = 32768
|
||||
GROUP_PRODUCTION_UPDATE = (1 << 14),
|
||||
GROUP_INJECTION_UPDATE = (1 << 15),
|
||||
|
||||
/*
|
||||
* New explicit well productivity/injectivity assignment.
|
||||
*/
|
||||
WELL_PRODUCTIVITY_INDEX = (1 << 16),
|
||||
|
||||
/*
|
||||
* Well's internal WellConnections structure changed.
|
||||
* Rerun WELPI scaling if applicable.
|
||||
*/
|
||||
WELL_CONNECTIONS_UPDATED = (1 << 17),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user