blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 2
247
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
57
| license_type
stringclasses 2
values | repo_name
stringlengths 4
111
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
58
| visit_date
timestamp[ns]date 2015-07-25 18:16:41
2023-09-06 10:45:08
| revision_date
timestamp[ns]date 1970-01-14 14:03:36
2023-09-06 06:22:19
| committer_date
timestamp[ns]date 1970-01-14 14:03:36
2023-09-06 06:22:19
| github_id
int64 3.89k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 25
values | gha_event_created_at
timestamp[ns]date 2012-06-07 00:51:45
2023-09-14 21:58:52
⌀ | gha_created_at
timestamp[ns]date 2008-03-27 23:40:48
2023-08-24 19:49:39
⌀ | gha_language
stringclasses 159
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 7
10.5M
| extension
stringclasses 111
values | filename
stringlengths 1
195
| text
stringlengths 7
10.5M
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
005ad03c7d687e460a994a95dd50f39a47110e52
|
71889f36c4da58ab07e822728f1c22413403fd2a
|
/LUOGU/P1093.cpp
|
830e2309ac567c68402c3e1900ef0d0e17389ea3
|
[] |
no_license
|
tangsongxiaoba/codebase
|
b8789aab6f7fa14737064f2a12fac7c541e34a6f
|
45db93958ed0e3b175de9da8e245e2d216a64a4b
|
refs/heads/master
| 2023-07-12T16:42:16.550306
| 2021-08-18T13:20:35
| 2021-08-18T13:20:35
| 336,157,040
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 735
|
cpp
|
P1093.cpp
|
//Luogu P1093 奖学金
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
const int MAXN=100000;
struct node{
int ch,ma,en,sc,xh;
node(int ch = 0, int ma = 0, int en = 0, int sc = 0, int xh = 0):ch(ch), ma(ma), en(en), sc(sc), xh(xh) {};
}stu[MAXN];
inline bool cmp(node x, node y) {
if(x.sc == y.sc) {
if(x.ch == y.ch) return x.xh < y.xh;
return x.ch > y.ch;
}
return x.sc > y.sc;
}
int main() {
int n;
cin >> n;
for(int i = 1; i <= n; ++i) {
cin >> stu[i].ch >> stu[i].ma >> stu[i].en;
stu[i].xh = i;
stu[i].sc = stu[i].ch + stu[i].ma + stu[i].en;
}
sort(stu+1, stu+1+n, cmp);
for(int i = 1; i <= 5 && stu[i].xh; ++i)
cout << stu[i].xh << " " << stu[i].sc << endl;
return 0;
}
|
296ae19dc97f3ff932c0ee503f6059f93ef39dc6
|
88b130d5ff52d96248d8b946cfb0faaadb731769
|
/searchlib/src/vespa/searchlib/tensor/hamming_distance.h
|
47b022afc131ccb8a1a62a711c25f4bccb6d4acb
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
vespa-engine/vespa
|
b8cfe266de7f9a9be6f2557c55bef52c3a9d7cdb
|
1f8213997718c25942c38402202ae9e51572d89f
|
refs/heads/master
| 2023-08-16T21:01:12.296208
| 2023-08-16T17:03:08
| 2023-08-16T17:03:08
| 60,377,070
| 4,889
| 619
|
Apache-2.0
| 2023-09-14T21:02:11
| 2016-06-03T20:54:20
|
Java
|
UTF-8
|
C++
| false
| false
| 867
|
h
|
hamming_distance.h
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "distance_function.h"
#include "distance_function_factory.h"
#include <vespa/eval/eval/typed_cells.h>
#include <vespa/vespalib/util/typify.h>
#include <cmath>
namespace search::tensor {
/**
* Calculates the Hamming distance defined as
* "number of cells where the values are different"
* or (for int8 cells, aka binary data only)
* "number of bits that are different"
*/
template <typename FloatType>
class HammingDistanceFunctionFactory : public DistanceFunctionFactory {
public:
HammingDistanceFunctionFactory() = default;
BoundDistanceFunction::UP for_query_vector(const vespalib::eval::TypedCells& lhs) override;
BoundDistanceFunction::UP for_insertion_vector(const vespalib::eval::TypedCells& lhs) override;
};
}
|
d40ce53b8a083be66da57dd3af9a65b69f8fa1d2
|
1b5832d547ec7356d868683f6c4337206d2f4541
|
/ground_plane_removal/include/ground_plane_removal/Parameters.hpp
|
00ee949e60ee3a53f10bc28efa9973e1c31c1b12
|
[
"BSD-3-Clause"
] |
permissive
|
Tarmy3124/tree_detection
|
17d23b77f7e2f1c1fdf15be0be6744f30a6fb5c3
|
8d550f7edb5e1b7770fcde2d51c6b08f1ec7a4cd
|
refs/heads/main
| 2023-07-13T06:31:59.789720
| 2021-08-22T14:35:39
| 2021-08-22T14:35:39
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,000
|
hpp
|
Parameters.hpp
|
/*
* Parameters.hpp
*
* Created on: Aug 19, 2021
* Author: jelavice
*/
#pragma once
#include <string>
#include <yaml-cpp/yaml.h>
#include "grid_map_pcl/PclLoaderParameters.hpp"
namespace ground_removal {
struct GroundPlaneCropBoxParameters
{
double minX_ = -50.0;
double maxX_= 50.0;
double minY_= -50.0;
double maxY_= 50.0;
double minZ_= -10.0;
double maxZ_= 10.0;
};
struct GroundPlaneRemoverParam {
GroundPlaneCropBoxParameters cropBox_;
};
struct ElevationMapGroundPlaneRemoverParam : public GroundPlaneRemoverParam {
grid_map::grid_map_pcl::PclLoaderParameters pclConverter_;
double minHeightAboveGround_ = 0.1;
double maxHeightAboveGround_ = 8.0;
double medianFilteringRadius_ = 2.0;
int medianFilterDownsampleFactor_ = 1;
bool isUseMedianFiltering_ = true;
};
std::ostream& operator<<(std::ostream& out, const GroundPlaneCropBoxParameters& p);
void loadParameters(const YAML::Node &node, GroundPlaneCropBoxParameters *p);
} // namespace ground_removal
|
4c2adc0671dcc8a8d651762fd03a71e9af1118e4
|
c9cf0586ace11aa32fa67606d237a130a06364ee
|
/circular-cylinder-10-1/3.25/U
|
bfc7ae766f26f615871626877613f98e1d1aa335
|
[] |
no_license
|
jezvonek/CFD-Final-Project
|
c74cfa21f22545c27d97d85cf30eb6dc8c824dc1
|
7c9a7fb032d74f20888effa0a0b75b212bf899f4
|
refs/heads/master
| 2022-07-05T14:43:52.967657
| 2020-05-14T03:40:56
| 2020-05-14T03:40:56
| 262,370,756
| 1
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 74,722
|
U
|
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1912 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "3.25";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField nonuniform List<vector>
2400
(
(0.0174969 -0.429109 -1.01632e-20)
(0.00549229 -0.330706 9.18775e-23)
(-0.00265903 -0.261249 3.22973e-21)
(-0.0078011 -0.21314 -6.11983e-21)
(-0.00996193 -0.180455 0)
(-0.00933991 -0.158698 5.36289e-21)
(-0.00646529 -0.144515 0)
(-0.00190721 -0.135418 4.5759e-21)
(0.00383747 -0.129564 -8.68437e-21)
(0.00972212 -0.125631 8.97616e-21)
(0.0508954 -0.423044 6.86379e-21)
(0.032357 -0.324174 5.27867e-22)
(0.0214401 -0.256221 3.02466e-22)
(0.015996 -0.210616 3.10836e-20)
(0.0152724 -0.180759 -1.18101e-20)
(0.0185366 -0.161734 -5.36275e-21)
(0.0248647 -0.149932 2.01568e-20)
(0.0334209 -0.142675 -1.9317e-20)
(0.0435417 -0.137943 0)
(0.0537956 -0.134339 -1.82788e-20)
(0.0836201 -0.415201 3.05727e-20)
(0.0590577 -0.317635 3.09576e-20)
(0.0465111 -0.25233 -1.41623e-20)
(0.042124 -0.210004 2.67439e-20)
(0.0443177 -0.183472 2.48885e-20)
(0.0517423 -0.167501 2.3155e-20)
(0.0630342 -0.158292 0)
(0.0770712 -0.153 2.00595e-20)
(0.0930184 -0.149411 1.86767e-20)
(0.108988 -0.146038 1.91582e-20)
(0.115748 -0.405831 -6.31099e-20)
(0.0860078 -0.311424 4.00684e-22)
(0.0731951 -0.249992 -5.89156e-20)
(0.0713303 -0.211649 5.61692e-20)
(0.0779336 -0.188831 -5.07213e-20)
(0.0909608 -0.176123 -2.31544e-20)
(0.108573 -0.169627 4.32633e-20)
(0.12935 -0.166372 -6.15191e-20)
(0.152291 -0.163916 -5.61748e-20)
(0.174971 -0.160659 2.01526e-20)
(0.147477 -0.395097 -1.04719e-21)
(0.113798 -0.30576 0)
(0.102279 -0.249345 -1.43028e-21)
(0.104616 -0.215537 -3.03485e-20)
(0.117159 -0.196638 -8.17256e-20)
(0.137162 -0.187207 -2.53062e-20)
(0.162293 -0.183372 0)
(0.19083 -0.182111 0)
(0.221627 -0.180742 0)
(0.251647 -0.177533 0)
(0.178957 -0.38302 7.44401e-20)
(0.143188 -0.300761 -1.09107e-19)
(0.134782 -0.250287 1.98736e-19)
(0.143138 -0.221324 -9.52043e-20)
(0.163217 -0.206264 8.51558e-20)
(0.191512 -0.199822 -2.78194e-20)
(0.225187 -0.198313 4.88833e-20)
(0.262231 -0.198785 -4.49554e-20)
(0.301406 -0.198362 0)
(0.339021 -0.195193 4.05839e-20)
(0.210283 -0.369658 -7.44407e-20)
(0.174886 -0.296366 7.39839e-20)
(0.17184 -0.252501 4.38856e-21)
(0.188178 -0.228358 -5.19199e-22)
(0.21741 -0.216696 2.8071e-21)
(0.25522 -0.212565 1.09017e-19)
(0.298258 -0.212649 6.43295e-23)
(0.34424 -0.214267 4.08661e-20)
(0.391927 -0.214472 -4.32538e-20)
(0.437041 -0.21138 4.16182e-20)
(0.241673 -0.355109 1.67502e-19)
(0.209653 -0.292328 -1.26857e-19)
(0.214551 -0.255405 4.78387e-21)
(0.240943 -0.235709 0)
(0.280903 -0.226619 6.45487e-20)
(0.329287 -0.22368 -5.58918e-20)
(0.382217 -0.224129 -5.37749e-20)
(0.43715 -0.225797 1.89152e-19)
(0.493016 -0.225919 -4.68568e-20)
(0.545262 -0.222815 -1.75951e-19)
(0.273433 -0.339396 -2.22808e-19)
(0.248273 -0.288241 1.75342e-19)
(0.26388 -0.258216 5.15788e-21)
(0.302406 -0.242263 0)
(0.354541 -0.234585 3.8805e-21)
(0.414318 -0.231307 -6.22842e-20)
(0.477285 -0.230265 1.10429e-19)
(0.540558 -0.22991 4.79985e-20)
(0.60337 -0.227902 -9.29889e-20)
(0.66178 -0.223643 0)
(0.305885 -0.322398 9.2376e-20)
(0.291412 -0.28349 6.70412e-22)
(0.320505 -0.259974 -8.69089e-20)
(0.37312 -0.246865 -3.92433e-21)
(0.438743 -0.239379 -1.40744e-19)
(0.510734 -0.234214 6.22829e-20)
(0.584188 -0.229607 -1.69817e-19)
(0.655754 -0.224274 2.10107e-19)
(0.724231 -0.216399 -9.75131e-20)
(0.786591 -0.20812 0)
(0.6337 -0.0105693 2.75258e-20)
(0.607717 -0.0576593 -1.85758e-20)
(0.578217 -0.100926 -7.17647e-20)
(0.546141 -0.140253 1.0715e-19)
(0.512338 -0.175671 6.82202e-20)
(0.477566 -0.207353 0)
(0.442452 -0.235587 0)
(0.407481 -0.260747 -1.69661e-19)
(0.373 -0.283277 2.74404e-19)
(0.339192 -0.303678 -1.0619e-19)
(0.868344 0.0137772 -7.32615e-22)
(0.817786 -0.0472087 -9.76407e-22)
(0.760815 -0.100914 -6.78446e-20)
(0.699507 -0.146833 3.22767e-21)
(0.635871 -0.184862 0)
(0.571786 -0.21528 1.84477e-19)
(0.508903 -0.238707 -1.23276e-19)
(0.448578 -0.256054 1.6936e-19)
(0.39184 -0.268455 -2.13822e-19)
(0.339357 -0.277193 6.05835e-21)
(1.06388 0.0594973 -8.29667e-21)
(1.0045 -0.0110564 -2.43327e-21)
(0.935345 -0.0736271 3.25149e-20)
(0.858904 -0.127113 1.22454e-19)
(0.777774 -0.170921 -5.72273e-20)
(0.694545 -0.204981 -2.79292e-19)
(0.611647 -0.229739 5.51454e-21)
(0.531226 -0.246127 5.74644e-21)
(0.45505 -0.255498 5.80096e-21)
(0.384479 -0.259529 9.86186e-20)
(1.21698 0.104133 1.40571e-20)
(1.1585 0.0284769 -7.03745e-20)
(1.0873 -0.0399819 -5.51374e-20)
(1.00574 -0.0996091 -1.07841e-19)
(0.916504 -0.149252 5.80383e-20)
(0.822462 -0.188314 1.52928e-19)
(0.726504 -0.216801 -5.08837e-21)
(0.631346 -0.235358 0)
(0.539391 -0.24526 -8.49252e-20)
(0.452693 -0.248364 8.9262e-20)
(1.32996 0.140811 0)
(1.27814 0.0638359 2.58617e-20)
(1.2115 -0.0074393 -4.89259e-20)
(1.13193 -0.0710221 9.93214e-20)
(1.04179 -0.125287 1.44528e-19)
(0.943858 -0.169091 -1.36085e-19)
(0.841099 -0.201893 -8.92491e-22)
(0.736494 -0.223867 -8.1398e-20)
(0.632819 -0.236011 1.58598e-19)
(0.532618 -0.240245 7.68557e-20)
(1.40821 0.168279 -1.07976e-20)
(1.36591 0.0928007 1.07972e-20)
(1.30772 0.0213017 -4.33121e-20)
(1.23484 -0.044065 4.33111e-20)
(1.14907 -0.101351 4.16216e-20)
(1.05275 -0.148949 3.89053e-20)
(0.948613 -0.185749 -1.57843e-19)
(0.839539 -0.21135 3.57194e-21)
(0.728285 -0.226319 6.98247e-20)
(0.617413 -0.232586 -6.99588e-20)
(1.4582 0.186884 0)
(1.42623 0.11474 -3.6514e-20)
(1.37823 0.0449378 -3.83088e-20)
(1.31472 -0.0203851 3.83077e-20)
(1.23681 -0.0791269 0)
(1.14622 -0.129335 -7.24609e-20)
(1.04516 -0.16937 3.14786e-21)
(0.936127 -0.198178 6.69632e-20)
(0.821383 -0.215729 -1.30655e-19)
(0.702593 -0.223921 1.84825e-19)
(1.48623 0.197889 -7.7839e-21)
(1.46406 0.130053 3.49928e-20)
(1.42651 0.0631705 -3.38913e-20)
(1.37348 -0.000771975 3.389e-20)
(1.30539 -0.0596755 0)
(1.22331 -0.111384 6.5309e-20)
(1.12883 -0.153791 -6.10501e-20)
(1.02385 -0.185079 -2.46308e-19)
(0.909739 -0.204291 -5.61457e-20)
(0.785793 -0.213013 -2.27202e-19)
(1.49768 0.203025 7.46652e-21)
(1.48408 0.139718 0)
(1.45624 0.0762671 -3.00239e-20)
(1.4136 0.014409 8.80449e-20)
(1.35604 -0.0438951 2.99466e-20)
(1.284 -0.0964368 -2.99461e-20)
(1.19852 -0.14074 6.26097e-20)
(1.10097 -0.174094 6.29287e-20)
(0.991902 -0.19385 1.12387e-19)
(0.866652 -0.19959 1.06585e-19)
(1.49669 0.203831 -6.24308e-21)
(1.49006 0.145144 2.58032e-20)
(1.47067 0.0853701 -2.77287e-20)
(1.43762 0.0259277 -3.03632e-20)
(1.39035 -0.0314839 0)
(1.32882 -0.0847794 -5.10234e-20)
(1.25361 -0.131334 -5.5607e-20)
(1.16596 -0.167715 2.16637e-19)
(1.06671 -0.189153 0)
(0.94637 -0.189618 0)
(0.539401 0.500148 -6.08724e-20)
(0.580643 0.461427 1.03568e-19)
(0.615601 0.416966 6.00492e-21)
(0.643527 0.36801 0)
(0.664116 0.315584 0)
(0.677042 0.26073 -6.20255e-20)
(0.682236 0.204621 3.50764e-20)
(0.679928 0.148441 -6.83826e-20)
(0.670612 0.09328 -1.83369e-20)
(0.654992 0.0400586 9.44533e-21)
(0.754299 0.671467 1.02194e-19)
(0.817049 0.63054 -1.30567e-19)
(0.870971 0.579281 3.05983e-20)
(0.914318 0.519328 -1.01832e-19)
(0.945723 0.452236 5.04614e-20)
(0.96439 0.37994 0)
(0.969901 0.304556 1.27106e-19)
(0.962296 0.228249 9.22519e-22)
(0.942121 0.153119 -6.80186e-20)
(0.910393 0.0810813 7.41983e-22)
(0.887755 0.747113 3.84487e-20)
(0.962617 0.712519 1.45556e-20)
(1.02865 0.665433 1.36405e-20)
(1.08375 0.607163 1.24423e-20)
(1.12596 0.53945 4.96352e-20)
(1.15388 0.464321 4.88234e-20)
(1.16654 0.384038 -1.11743e-19)
(1.1635 0.301005 -3.10133e-20)
(1.14484 0.217676 2.74961e-21)
(1.11127 0.136438 8.22914e-21)
(0.968467 0.762041 2.86252e-20)
(1.04907 0.735535 -3.61726e-20)
(1.12208 0.696032 0)
(1.18513 0.644589 -1.35831e-19)
(1.23605 0.582626 -5.24024e-20)
(1.27302 0.511915 1.2366e-19)
(1.29469 0.434471 9.98236e-20)
(1.30008 0.352552 -4.96492e-20)
(1.28876 0.268558 4.01313e-20)
(1.26085 0.184949 1.36314e-20)
(1.01578 0.741751 -2.48169e-20)
(1.0978 0.722593 3.8911e-20)
(1.1738 0.691009 -3.89084e-20)
(1.24131 0.647706 1.20465e-19)
(1.29813 0.593716 -9.5216e-20)
(1.34232 0.530431 -4.43576e-20)
(1.37225 0.459506 -1.00989e-21)
(1.38665 0.382892 -4.24252e-20)
(1.38459 0.302713 -2.44703e-20)
(1.36569 0.221239 0)
(1.04294 0.70337 -2.00529e-20)
(1.12379 0.690025 5.04353e-20)
(1.2 0.665416 9.93906e-21)
(1.2691 0.629832 -8.99537e-20)
(1.32903 0.583949 2.05585e-20)
(1.37793 0.528792 2.90719e-20)
(1.41419 0.465673 3.61018e-20)
(1.43636 0.39622 -3.60998e-20)
(1.44324 0.322173 1.02115e-20)
(1.43402 0.245489 -1.0211e-20)
(1.05864 0.657502 -1.5117e-21)
(1.1372 0.648447 -3.79602e-20)
(1.21188 0.629546 2.35647e-20)
(1.28038 0.600575 7.48348e-20)
(1.34099 0.56193 -4.08039e-20)
(1.39214 0.51438 0)
(1.43242 0.458942 8.60371e-20)
(1.46036 0.397023 -3.07126e-20)
(1.47462 0.329931 3.26542e-20)
(1.47418 0.259279 0)
(1.06838 0.61033 2.40204e-20)
(1.14438 0.604712 4.25212e-20)
(1.21645 0.590456 -3.9183e-21)
(1.28269 0.566843 1.51579e-20)
(1.34205 0.534167 3.35552e-20)
(1.39336 0.493071 0)
(1.43556 0.444365 -2.6844e-20)
(1.46716 0.389501 -2.61734e-20)
(1.48684 0.329223 -3.12944e-20)
(1.49354 0.264841 7.46092e-21)
(1.07615 0.56598 -8.41818e-21)
(1.14903 0.563678 -2.34373e-20)
(1.21733 0.553159 1.42644e-20)
(1.27998 0.53359 -7.3815e-20)
(1.33665 0.505473 -1.69249e-20)
(1.38658 0.469459 1.69236e-20)
(1.42914 0.426203 -1.76966e-20)
(1.46271 0.377431 -2.23413e-20)
(1.48592 0.323201 0)
(1.49794 0.264644 -1.36462e-20)
(1.0876 0.526256 0)
(1.15559 0.525299 0)
(1.21816 0.517025 -6.27331e-20)
(1.27567 0.500262 -2.46855e-20)
(1.32835 0.475682 7.86705e-20)
(1.37549 0.443981 0)
(1.41688 0.40594 6.07981e-20)
(1.45101 0.362169 -2.02518e-20)
(1.47604 0.313285 -2.24042e-20)
(1.49162 0.26022 1.24902e-20)
(0.599894 0.169913 -2.62213e-22)
(0.559066 0.183923 1.30431e-20)
(0.512225 0.20095 -6.93597e-21)
(0.458585 0.222296 0)
(0.397226 0.249694 8.10665e-21)
(0.327636 0.285074 0)
(0.250245 0.329954 -9.46443e-21)
(0.167337 0.384088 -5.3651e-21)
(0.087137 0.442867 -2.59457e-22)
(0.0321814 0.492821 -5.42036e-21)
(0.621258 0.227709 -2.53677e-20)
(0.582186 0.246618 0)
(0.537158 0.26901 2.73082e-20)
(0.485703 0.295923 -2.84939e-20)
(0.426957 0.328612 -8.10657e-21)
(0.360412 0.368025 1.72311e-20)
(0.286417 0.413907 -2.70283e-20)
(0.206933 0.46304 -5.04126e-22)
(0.129329 0.505962 4.04707e-20)
(0.0742147 0.521365 1.10019e-20)
(0.650238 0.282743 2.3004e-20)
(0.613649 0.30634 2.18753e-20)
(0.571141 0.333881 2.35812e-20)
(0.522635 0.366089 2.53919e-20)
(0.467276 0.403739 2.72571e-20)
(0.404425 0.446809 2.9128e-20)
(0.334121 0.493285 3.09216e-20)
(0.25759 0.537056 1.76856e-20)
(0.180608 0.564035 -3.8205e-21)
(0.120469 0.545637 3.43866e-20)
(0.68648 0.334019 -6.7445e-20)
(0.653013 0.361973 1.92113e-20)
(0.613671 0.394312 2.18044e-20)
(0.568821 0.431376 -7.27476e-20)
(0.517551 0.473461 -2.72568e-20)
(0.458965 0.519595 -1.70021e-21)
(0.392561 0.566069 -6.20746e-20)
(0.318453 0.604046 6.02985e-20)
(0.240149 0.615223 -6.59415e-20)
(0.170378 0.564662 -5.01212e-20)
(0.729461 0.380632 0)
(0.699646 0.412502 -1.68788e-20)
(0.664036 0.449157 0)
(0.623462 0.490471 0)
(0.576877 0.536271 -1.98713e-20)
(0.523002 0.584673 2.52263e-20)
(0.460584 0.630376 -7.16696e-20)
(0.38828 0.662069 -2.46497e-20)
(0.306755 0.657814 0)
(0.223153 0.577563 -2.47311e-20)
(0.778489 0.421792 3.70402e-20)
(0.752727 0.457042 1.68785e-20)
(0.721314 0.497397 -2.91427e-20)
(0.685526 0.542193 3.02712e-20)
(0.644085 0.590807 -1.10983e-20)
(0.595208 0.640498 5.16987e-20)
(0.5367 0.684515 2.60796e-20)
(0.465472 0.709405 -2.5556e-20)
(0.378904 0.690323 -9.35593e-21)
(0.277832 0.583628 0)
(0.832681 0.456863 3.02406e-20)
(0.811226 0.494862 7.05382e-20)
(0.784365 0.538166 -1.86383e-20)
(0.753749 0.585513 -5.6769e-20)
(0.717757 0.635877 5.24353e-20)
(0.67398 0.685726 -5.56526e-20)
(0.619117 0.727034 5.6121e-20)
(0.548121 0.744608 -1.43685e-20)
(0.454802 0.71155 2.76212e-20)
(0.333313 0.582325 0)
(0.890897 0.485471 -3.5217e-21)
(0.873857 0.525421 -2.29654e-20)
(0.851805 0.570741 -7.94267e-22)
(0.826644 0.619552 -1.31888e-20)
(0.796247 0.670468 -1.00526e-20)
(0.757469 0.719236 8.63942e-21)
(0.705787 0.756756 0)
(0.634063 0.766556 -1.5062e-20)
(0.532444 0.720624 6.66055e-21)
(0.388404 0.573338 -8.80702e-21)
(0.951655 0.507693 0)
(0.939055 0.548555 2.05609e-20)
(0.92211 0.594685 -3.55386e-20)
(0.902624 0.643662 1.72488e-20)
(0.877778 0.693792 -1.24095e-20)
(0.843662 0.740164 -8.63929e-21)
(0.794473 0.772818 -8.93076e-21)
(0.720958 0.774494 -1.5436e-20)
(0.609701 0.717043 -2.86841e-20)
(0.441897 0.556593 4.18601e-20)
(1.0115 0.521043 0)
(1.00329 0.561948 5.34139e-21)
(0.992636 0.608306 -6.96158e-21)
(0.97949 0.656694 -2.60638e-21)
(0.960218 0.705002 9.96078e-22)
(0.930327 0.747819 -1.22424e-20)
(0.882791 0.774663 2.47521e-21)
(0.806361 0.768037 8.89398e-21)
(0.684419 0.700654 5.12672e-20)
(0.492647 0.532215 -2.5649e-20)
(0.786963 -0.338415 0)
(0.758832 -0.361258 -7.25173e-20)
(0.722832 -0.382016 1.52768e-19)
(0.678001 -0.395528 -1.23963e-19)
(0.619395 -0.396823 4.61066e-20)
(0.540764 -0.377991 -4.5744e-20)
(0.434214 -0.327654 -5.31535e-20)
(0.289846 -0.230937 -5.77687e-20)
(0.0959124 -0.0691908 -5.96477e-21)
(-0.1625 0.180645 6.12428e-20)
(0.743439 -0.305775 0)
(0.713929 -0.327283 -8.21951e-20)
(0.675852 -0.347283 4.0048e-20)
(0.629221 -0.36116 9.22863e-20)
(0.570098 -0.363839 -4.85179e-20)
(0.49297 -0.347368 -1.07821e-19)
(0.390938 -0.300188 5.21537e-20)
(0.255514 -0.206864 -8.46974e-21)
(0.0772937 -0.0474751 1.31323e-19)
(-0.154015 0.203625 -9.90038e-20)
(0.702241 -0.266541 -1.21631e-21)
(0.67068 -0.28614 -4.84664e-20)
(0.630828 -0.304696 1.90053e-19)
(0.582531 -0.317991 -4.88445e-20)
(0.522595 -0.321 -5.46192e-21)
(0.446376 -0.305953 5.58064e-20)
(0.348118 -0.261455 0)
(0.22097 -0.172049 -7.7082e-21)
(0.0582491 -0.0173949 -1.08862e-19)
(-0.145073 0.229317 6.98451e-20)
(0.665877 -0.222871 5.20442e-20)
(0.631882 -0.239769 -5.15203e-20)
(0.590038 -0.25578 5.30104e-20)
(0.539919 -0.267207 -2.73971e-21)
(0.478869 -0.269259 1.20012e-19)
(0.403074 -0.254506 -1.36275e-21)
(0.307951 -0.212004 3.85513e-21)
(0.188383 -0.126792 -6.69188e-21)
(0.0405987 0.020984 8.61599e-20)
(-0.134838 0.257739 0)
(0.635184 -0.174698 -1.57602e-19)
(0.598747 -0.188306 2.6066e-20)
(0.554889 -0.200964 -5.34976e-20)
(0.502943 -0.209495 5.77562e-20)
(0.440673 -0.209457 -2.92833e-20)
(0.365027 -0.193917 1.03182e-19)
(0.272561 -0.15267 -1.10972e-19)
(0.159882 -0.0717796 2.01297e-19)
(0.02615 0.0672054 -1.29932e-19)
(-0.122489 0.288683 0)
(0.610814 -0.122414 0)
(0.572193 -0.132252 -2.60666e-20)
(0.526526 -0.140922 0)
(0.472946 -0.145717 0)
(0.409563 -0.142607 -3.30707e-20)
(0.33401 -0.125296 -1.10852e-19)
(0.243897 -0.0845884 -4.18443e-20)
(0.137458 -0.00805945 4.25413e-20)
(0.0166167 0.120446 0)
(-0.107246 0.321739 4.79471e-20)
(0.59329 -0.0667539 2.94089e-20)
(0.55295 -0.0724058 -8.10889e-20)
(0.505875 -0.0765644 -2.98202e-20)
(0.45104 -0.0769279 -3.24254e-20)
(0.386856 -0.0699165 -3.52793e-20)
(0.311549 -0.0499836 -7.72292e-20)
(0.223666 -0.0091706 8.17331e-20)
(0.122877 0.0629916 -9.00888e-20)
(0.0135365 0.179556 -1.42333e-21)
(-0.0884096 0.356308 -2.51929e-20)
(0.583047 -0.00880889 2.8587e-20)
(0.541597 -0.00981724 2.74663e-20)
(0.493659 -0.00899778 2.98207e-20)
(0.438109 -0.00435943 3.2426e-20)
(0.373611 0.00722529 3.52799e-20)
(0.298895 0.0304759 3.83841e-20)
(0.21328 0.0719241 4.17286e-20)
(0.117615 0.139712 -2.33526e-20)
(0.0182049 0.243104 4.89734e-20)
(-0.0654027 0.391636 5.00284e-20)
(0.580697 0.0505157 2.80295e-20)
(0.538723 0.0544804 0)
(0.490475 0.060605 -3.05754e-20)
(0.434828 0.0706518 3.1903e-20)
(0.370634 0.087297 -8.77917e-21)
(0.296999 0.114372 -1.96959e-20)
(0.213828 0.156833 5.23317e-20)
(0.12282 0.220205 8.93436e-22)
(0.0316279 0.309427 5.72316e-22)
(-0.0377983 0.426841 1.23194e-20)
(0.586343 0.110448 -6.88141e-21)
(0.544546 0.119456 -6.8967e-21)
(0.496636 0.131024 7.18969e-21)
(0.441604 0.146695 0)
(0.378434 0.168679 8.77931e-21)
(0.306485 0.19987 0)
(0.226035 0.243542 -1.03701e-20)
(0.139271 0.302392 5.64996e-21)
(0.0544946 0.376678 2.9383e-22)
(-0.00532324 0.460951 -1.8217e-20)
(0.84826 -0.370584 0)
(0.899919 -0.39212 0)
(0.94741 -0.408038 8.4385e-22)
(0.990928 -0.416557 -1.51155e-20)
(1.03056 -0.41779 4.00175e-20)
(1.06591 -0.41228 0)
(1.09517 -0.400336 -2.06051e-21)
(1.11638 -0.381947 -4.84784e-22)
(1.12831 -0.357508 2.35419e-21)
(1.12934 -0.327603 1.71716e-22)
(0.813038 -0.389564 6.35007e-20)
(0.866741 -0.410354 5.38064e-20)
(0.917068 -0.424555 1.85061e-20)
(0.962724 -0.430892 1.32493e-20)
(1.00304 -0.429281 0)
(1.03727 -0.420101 0)
(1.06365 -0.404169 2.38233e-21)
(1.08053 -0.381429 1.40047e-22)
(1.08649 -0.352586 0)
(1.08001 -0.318652 -2.59224e-21)
(0.775392 -0.407977 -1.32673e-19)
(0.828915 -0.426194 -3.10511e-20)
(0.879586 -0.43707 -8.95876e-20)
(0.925134 -0.43981 -1.24315e-20)
(0.964169 -0.434262 1.3731e-20)
(0.995444 -0.420764 0)
(1.0173 -0.400083 -1.269e-21)
(1.02816 -0.372711 9.4245e-22)
(1.02663 -0.339661 -4.67262e-21)
(1.01152 -0.302304 1.44987e-21)
(0.729662 -0.419963 1.01047e-19)
(0.781589 -0.435395 -5.71981e-20)
(0.830481 -0.442339 2.5512e-20)
(0.873732 -0.440567 -3.58785e-21)
(0.909418 -0.430171 -1.30963e-20)
(0.935908 -0.411673 0)
(0.951565 -0.385969 3.40679e-22)
(0.954934 -0.354055 0)
(0.944899 -0.317314 4.87573e-21)
(0.92075 -0.277458 0)
(0.669669 -0.419121 -3.28487e-20)
(0.718846 -0.431271 3.28463e-20)
(0.764137 -0.433853 1.90876e-20)
(0.802955 -0.427145 -3.1459e-20)
(0.833166 -0.411646 9.38815e-21)
(0.852999 -0.388216 2.98356e-21)
(0.860935 -0.358067 -2.74497e-21)
(0.855813 -0.322639 2.74483e-21)
(0.836953 -0.283679 -1.83873e-21)
(0.804243 -0.24319 1.83868e-21)
(0.588091 -0.397297 7.21148e-20)
(0.632854 -0.4057 -7.6238e-21)
(0.672581 -0.403902 -2.64662e-20)
(0.704865 -0.392622 -3.11467e-21)
(0.727661 -0.372804 -1.40215e-20)
(0.739333 -0.345713 3.1999e-21)
(0.738662 -0.312931 -6.31827e-21)
(0.724935 -0.276275 3.67377e-21)
(0.698031 -0.237769 -3.86995e-21)
(0.658469 -0.199563 0)
(0.475864 -0.343615 3.61513e-20)
(0.513727 -0.348576 -3.56328e-20)
(0.545585 -0.343438 0)
(0.56933 -0.329309 4.2809e-21)
(0.583242 -0.307535 1.62888e-20)
(0.586039 -0.279745 -5.42139e-22)
(0.576964 -0.247818 3.05781e-21)
(0.555844 -0.213792 4.52272e-21)
(0.523134 -0.179784 1.07646e-20)
(0.479912 -0.147877 -2.37043e-21)
(0.321815 -0.244312 3.90827e-20)
(0.349405 -0.247658 -9.18398e-21)
(0.370742 -0.242088 -8.94179e-21)
(0.384189 -0.228926 -8.5084e-21)
(0.388486 -0.209804 -2.36406e-20)
(0.38284 -0.186526 1.7101e-21)
(0.367022 -0.16104 -7.43347e-21)
(0.341372 -0.135339 -3.54053e-21)
(0.306797 -0.11135 3.51235e-22)
(0.264706 -0.0908265 1.51345e-21)
(0.112296 -0.0828153 -4.23021e-21)
(0.124964 -0.0890036 -7.18186e-20)
(0.132627 -0.0889334 4.381e-20)
(0.134203 -0.0838825 -1.16606e-20)
(0.128961 -0.0753347 1.52826e-20)
(0.116662 -0.0648948 0)
(0.0975071 -0.0541795 -1.93493e-21)
(0.0721375 -0.0447364 5.16693e-21)
(0.0415931 -0.0379565 -5.12535e-22)
(0.00722816 -0.0349987 2.26353e-22)
(-0.171374 0.160077 -4.04665e-20)
(-0.18091 0.141867 5.28233e-20)
(-0.191684 0.125337 -4.22795e-20)
(-0.204031 0.109818 9.88177e-21)
(-0.21806 0.0946526 -9.88164e-21)
(-0.233669 0.0791632 5.64021e-21)
(-0.250555 0.0627081 -8.4721e-21)
(-0.268233 0.0447273 7.55849e-21)
(-0.286079 0.0247779 3.41962e-21)
(-0.303385 0.00254408 -5.14057e-21)
(1.11775 -0.293098 1.44335e-21)
(1.09216 -0.255263 -7.26399e-21)
(1.05173 -0.215817 9.72678e-21)
(0.99646 -0.176971 -3.101e-20)
(0.927381 -0.141399 0)
(0.846565 -0.112086 2.20739e-20)
(0.756835 -0.092074 2.6356e-20)
(0.660904 -0.084041 1.42764e-21)
(0.557181 -0.0903431 0)
(0.432814 -0.107765 0)
(1.05971 -0.280924 1.80751e-21)
(1.02473 -0.241104 0)
(0.974912 -0.201271 1.0324e-20)
(0.911014 -0.163838 1.09684e-20)
(0.834765 -0.131427 0)
(0.748717 -0.106647 0)
(0.655744 -0.091764 8.31404e-20)
(0.557989 -0.0881894 -2.88816e-20)
(0.454097 -0.095939 5.9673e-20)
(0.337787 -0.108346 6.04322e-20)
(0.981976 -0.262304 -1.88438e-21)
(0.937794 -0.221687 9.71258e-21)
(0.879582 -0.182723 1.12549e-20)
(0.808823 -0.147818 -1.12547e-20)
(0.727839 -0.119325 0)
(0.639511 -0.099273 -2.79144e-20)
(0.546739 -0.0890124 -2.98532e-20)
(0.451581 -0.0886923 -4.05117e-22)
(0.353898 -0.0966042 -9.25566e-20)
(0.252221 -0.106019 -1.25814e-19)
(0.882256 -0.236458 0)
(0.829964 -0.196538 -1.0135e-20)
(0.765227 -0.159987 0)
(0.690162 -0.129013 0)
(0.607516 -0.105533 0)
(0.520338 -0.0909099 2.94642e-20)
(0.431493 -0.0856368 -5.94619e-20)
(0.343091 -0.0889623 -3.17332e-20)
(0.256002 -0.0984828 6.42695e-20)
(0.171112 -0.108787 3.30051e-20)
(0.758139 -0.203321 2.70164e-21)
(0.699903 -0.166322 -2.70157e-21)
(0.631516 -0.134307 1.32481e-20)
(0.555539 -0.10911 -1.32481e-20)
(0.474913 -0.0920946 -1.49584e-20)
(0.392644 -0.0839416 -1.63033e-20)
(0.311423 -0.0844353 6.37045e-20)
(0.23328 -0.0922598 -3.24429e-20)
(0.159508 -0.104852 -6.85981e-20)
(0.0916129 -0.118033 3.43372e-20)
(0.607346 -0.163804 0)
(0.54649 -0.132553 6.4647e-21)
(0.478293 -0.107563 1.43344e-20)
(0.405482 -0.0901583 7.59999e-22)
(0.330926 -0.0811013 1.58183e-20)
(0.257365 -0.0804579 4.93807e-20)
(0.187145 -0.0874876 -6.78422e-20)
(0.122035 -0.100578 3.56009e-20)
(0.0632877 -0.11726 3.66932e-20)
(0.0122049 -0.134283 8.45635e-22)
(0.427738 -0.119987 -3.26667e-21)
(0.368749 -0.0977773 -1.05556e-20)
(0.305442 -0.0824899 1.55377e-20)
(0.240407 -0.07488 -3.12392e-20)
(0.176174 -0.0751459 -4.97452e-20)
(0.115024 -0.0828739 1.73556e-20)
(0.0588194 -0.0970092 7.19243e-20)
(0.00894043 -0.115871 0)
(-0.0336405 -0.137237 3.90756e-20)
(-0.0680681 -0.158543 -3.7976e-20)
(0.216832 -0.0752367 -1.75844e-21)
(0.165278 -0.0656655 -4.64338e-22)
(0.112304 -0.0627814 8.51984e-21)
(0.0600665 -0.0668029 3.52852e-20)
(0.0105365 -0.0774855 -3.68167e-20)
(-0.034608 -0.0941286 3.40507e-22)
(-0.0740565 -0.115593 1.23999e-21)
(-0.106874 -0.140341 1.06145e-21)
(-0.132433 -0.166516 8.75074e-22)
(-0.150285 -0.192128 -4.04112e-20)
(-0.0294444 -0.0367236 -2.44977e-22)
(-0.0667553 -0.0435197 1.70438e-20)
(-0.103047 -0.0555472 1.27975e-21)
(-0.136854 -0.0726295 -3.79729e-20)
(-0.166925 -0.0942839 0)
(-0.192268 -0.119766 -2.2787e-20)
(-0.212151 -0.1481 4.3512e-20)
(-0.226076 -0.1781 -2.17028e-20)
(-0.233738 -0.208423 9.21569e-20)
(-0.234964 -0.237664 -9.20597e-20)
(-0.319383 -0.0221873 -2.53036e-21)
(-0.333332 -0.049065 4.51269e-21)
(-0.344595 -0.0779976 2.09767e-20)
(-0.352634 -0.108687 -4.29948e-20)
(-0.357051 -0.140717 -4.60637e-22)
(-0.35758 -0.173602 4.69474e-20)
(-0.354065 -0.2068 -4.6948e-20)
(-0.346431 -0.239713 4.97856e-20)
(-0.334658 -0.271703 -1.21774e-19)
(-0.318753 -0.302123 4.88675e-20)
(-0.298636 -0.330305 4.8759e-20)
(-0.229748 -0.264539 -9.33631e-20)
(-0.16014 -0.215477 -4.1742e-20)
(-0.09336 -0.177627 1.10576e-21)
(-0.029033 -0.148685 2.28697e-22)
(0.0335694 -0.127192 3.52352e-20)
(0.0946703 -0.111734 3.14743e-20)
(0.154509 -0.10136 -1.20784e-19)
(0.214397 -0.096219 5.66414e-20)
(0.273659 -0.0933445 0)
(-0.274988 -0.355341 -7.2964e-20)
(-0.21862 -0.288001 9.46832e-20)
(-0.162161 -0.23561 -4.0447e-22)
(-0.108917 -0.193922 0)
(-0.0582683 -0.160875 3.70019e-20)
(-0.00932085 -0.134904 -7.1119e-20)
(0.0384084 -0.11446 6.63567e-20)
(0.0855361 -0.0984343 -9.14802e-20)
(0.133583 -0.0870868 5.78811e-20)
(0.180813 -0.079953 0)
(-0.248241 -0.37714 2.51052e-20)
(-0.202327 -0.307558 -2.28426e-20)
(-0.157241 -0.252041 -3.5964e-22)
(-0.115754 -0.207226 0)
(-0.0768356 -0.171258 3.8162e-20)
(-0.0394304 -0.142581 -3.6207e-20)
(-0.00288275 -0.119793 -3.3413e-20)
(0.0335194 -0.102035 9.77931e-22)
(0.0708087 -0.0895325 -2.80557e-20)
(0.106827 -0.0821809 1.21562e-19)
(-0.218838 -0.39554 -4.80564e-20)
(-0.181766 -0.322902 4.77417e-20)
(-0.146672 -0.264491 -3.5749e-22)
(-0.115401 -0.217262 8.27544e-20)
(-0.0865944 -0.17948 -7.83981e-20)
(-0.0591376 -0.149541 7.29167e-20)
(-0.0323282 -0.126085 -6.82516e-20)
(-0.00553535 -0.1083 -3.02225e-20)
(0.0218944 -0.0961786 9.01507e-20)
(0.0481289 -0.089367 3.12542e-20)
(-0.187243 -0.410354 4.8056e-20)
(-0.158032 -0.334023 -2.41089e-20)
(-0.131803 -0.272829 7.56849e-23)
(-0.109312 -0.223839 2.17472e-20)
(-0.0891728 -0.185105 5.89316e-20)
(-0.0702069 -0.154873 -1.80877e-20)
(-0.0517293 -0.131663 3.44542e-20)
(-0.0332352 -0.114487 -3.22977e-20)
(-0.0143035 -0.102974 0)
(0.00367781 -0.0965308 -9.49727e-20)
(-0.15414 -0.421475 4.80387e-20)
(-0.132169 -0.341072 0)
(-0.113735 -0.277227 -4.48431e-20)
(-0.0988029 -0.227001 -6.31448e-20)
(-0.0859568 -0.187992 2.04518e-20)
(-0.0740351 -0.158133 -1.86221e-20)
(-0.062424 -0.135704 0)
(-0.0507554 -0.119453 0)
(-0.0387644 -0.108629 0)
(-0.02744 -0.10247 0)
(-0.120118 -0.429044 -3.62942e-20)
(-0.105016 -0.344283 -4.87973e-20)
(-0.0934721 -0.27811 4.58679e-20)
(-0.0849291 -0.227139 -4.34932e-20)
(-0.0779932 -0.188399 -2.48983e-23)
(-0.0716028 -0.159395 -1.92655e-20)
(-0.0652607 -0.138099 0)
(-0.0587258 -0.122979 -1.70449e-20)
(-0.0518745 -0.11296 1.54746e-20)
(-0.0455012 -0.107127 -4.98591e-20)
(-0.0856334 -0.433293 2.43039e-20)
(-0.0772634 -0.344165 -2.43221e-22)
(-0.0717997 -0.276111 1.17886e-20)
(-0.0684756 -0.224916 2.17654e-20)
(-0.0660255 -0.186936 2.04803e-20)
(-0.0635687 -0.159187 1.92657e-20)
(-0.0607758 -0.1393 0)
(-0.0575574 -0.125472 1.70451e-20)
(-0.0539413 -0.116384 1.60319e-20)
(-0.0506643 -0.110979 1.66487e-20)
(-0.0510539 -0.434512 6.35307e-21)
(-0.0494216 -0.341383 2.51763e-20)
(-0.0492686 -0.27204 -2.16981e-22)
(-0.0499772 -0.221198 -1.68e-20)
(-0.0505492 -0.184465 1.0679e-20)
(-0.05037 -0.158343 -5.04283e-21)
(-0.0493366 -0.140114 -1.85288e-20)
(-0.0475445 -0.127726 1.7757e-20)
(-0.0451718 -0.119661 0)
(-0.042976 -0.114748 1.70318e-20)
(-0.016637 -0.433036 -3.17681e-21)
(-0.0217963 -0.336665 -8.51529e-23)
(-0.0261918 -0.266789 -3.11244e-21)
(-0.0297307 -0.21695 -5.71118e-21)
(-0.0318407 -0.181975 0)
(-0.0322649 -0.157849 5.04283e-21)
(-0.0311873 -0.141522 0)
(-0.028923 -0.130715 -4.45685e-21)
(-0.0257998 -0.123746 4.27508e-21)
(-0.0226762 -0.119362 -4.34876e-21)
(0.0215121 -0.117272 -1.84711e-21)
(0.0538985 -0.159895 7.94676e-22)
(0.151206 -0.173729 0)
(0.257445 -0.154719 -5.306e-23)
(0.391692 -0.112251 1.62411e-22)
(0.529686 -0.0632658 7.13829e-24)
(0.66042 -0.0225968 -6.65723e-24)
(0.770115 0.00351769 0)
(0.853357 0.0159644 0)
(0.910915 0.0191798 0)
(0.947844 0.0176978 0)
(0.970259 0.0145668 -5.20631e-24)
(0.983389 0.0113076 4.86028e-24)
(0.990916 0.00847963 7.32507e-25)
(0.99516 0.00619501 -6.84186e-25)
(0.997509 0.00441067 8.62194e-25)
(0.998772 0.00305764 0)
(0.999432 0.00202106 1.71441e-26)
(0.999754 0.00133803 -1.60363e-26)
(0.999956 0.000593712 0)
(0.0765781 -0.125438 4.12566e-21)
(0.112928 -0.179434 0)
(0.208024 -0.19921 0)
(0.303804 -0.183612 3.40949e-22)
(0.423632 -0.14192 -8.93465e-22)
(0.548523 -0.0905677 2.13833e-22)
(0.669755 -0.0452041 -9.1042e-23)
(0.773844 -0.0133216 4.51761e-23)
(0.854331 0.00457248 -5.05177e-23)
(0.910793 0.012106 6.4263e-23)
(0.947413 0.0135888 -2.76032e-23)
(0.969821 0.0122925 0)
(0.98303 0.0100872 5.28881e-24)
(0.990643 0.00783776 -2.24649e-24)
(0.994959 0.00586318 -2.51217e-24)
(0.997365 0.00424271 -8.63307e-25)
(0.99867 0.00297497 -1.28187e-25)
(0.999362 0.0019818 -3.6741e-25)
(0.999705 0.00131863 0)
(0.999924 0.0005865 0)
(0.145431 -0.13602 0)
(0.186101 -0.198518 -5.02539e-21)
(0.27839 -0.222573 8.28241e-21)
(0.362549 -0.209581 -2.89833e-21)
(0.465993 -0.168793 0)
(0.575406 -0.115811 0)
(0.684639 -0.0665445 -8.95168e-23)
(0.781011 -0.0294964 1.59667e-22)
(0.857234 -0.00650638 1.22718e-23)
(0.911668 0.00515455 1.28979e-23)
(0.947465 0.00952897 0)
(0.96961 0.0100373 0)
(0.982778 0.00887465 0)
(0.990421 0.00719933 4.88872e-24)
(0.994783 0.00553264 1.12329e-24)
(0.997233 0.0040749 0)
(0.998574 0.00289181 0)
(0.999295 0.00194185 4.87722e-25)
(0.999657 0.00129847 6.74839e-26)
(0.999893 0.000578906 -5.58271e-27)
(0.226503 -0.149292 1.13593e-21)
(0.270919 -0.216736 4.49494e-21)
(0.358918 -0.243359 -5.41089e-21)
(0.430388 -0.232181 2.66414e-22)
(0.516195 -0.192433 0)
(0.608629 -0.138571 0)
(0.704112 -0.0862688 1.48307e-22)
(0.791143 -0.044765 -1.74767e-22)
(0.861857 -0.0171283 4.21917e-23)
(0.913455 -0.00160073 3.35627e-23)
(0.947973 0.00555084 6.4528e-23)
(0.969619 0.00781562 -4.24225e-23)
(0.98263 0.00767609 -7.38887e-24)
(0.99025 0.00656698 -1.28687e-23)
(0.994632 0.00520464 -1.62969e-24)
(0.997113 0.00390785 0)
(0.998484 0.00280849 0)
(0.99923 0.00190137 0)
(0.99961 0.00127765 -6.15096e-26)
(0.999862 0.000570957 0)
(0.318348 -0.165067 -1.15727e-21)
(0.364894 -0.233625 -5.58324e-21)
(0.446152 -0.261123 5.17402e-21)
(0.503897 -0.251112 -1.15285e-21)
(0.571463 -0.212597 1.91839e-21)
(0.646264 -0.158601 0)
(0.727023 -0.104153 1.86143e-23)
(0.803636 -0.0589582 -9.15339e-23)
(0.86792 -0.0272018 -8.03949e-24)
(0.916039 -0.00808986 0)
(0.948891 0.00167793 0)
(0.96983 0.00563997 -2.01711e-23)
(0.982582 0.00649715 2.06541e-23)
(0.990128 0.00594331 -3.85294e-24)
(0.994506 0.00488047 1.99798e-24)
(0.997006 0.00374218 2.01762e-24)
(0.9984 0.00272535 -7.61227e-25)
(0.999168 0.00186051 -1.7036e-25)
(0.999564 0.00125626 2.65043e-25)
(0.999831 0.000562685 0)
(0.419651 -0.182683 -2.13058e-20)
(0.465611 -0.248529 1.26409e-20)
(0.5368 -0.275367 -3.49529e-21)
(0.579826 -0.266145 -7.59895e-21)
(0.629121 -0.229168 -1.86947e-21)
(0.686384 -0.175789 1.4763e-21)
(0.75217 -0.120075 -1.45258e-23)
(0.817831 -0.0719685 1.69529e-22)
(0.875105 -0.0366473 5.86357e-23)
(0.919282 -0.0142717 -1.34139e-22)
(0.950166 -0.00206777 2.3129e-23)
(0.970226 0.00352059 -3.25408e-23)
(0.982627 0.00534263 -5.90209e-24)
(0.990053 0.00533061 -1.39302e-23)
(0.994403 0.00456124 0)
(0.99691 0.00357849 0)
(0.998322 0.00264267 2.60915e-25)
(0.999109 0.00181942 1.70791e-25)
(0.99952 0.00123437 -2.6518e-25)
(0.9998 0.000554123 -1.2512e-26)
(0.529105 -0.201076 1.32835e-21)
(0.570669 -0.260639 0)
(0.627855 -0.285633 -8.11379e-21)
(0.655305 -0.277159 1.11633e-20)
(0.686815 -0.242175 -4.051e-21)
(0.727237 -0.190156 1.28906e-22)
(0.778412 -0.134014 -4.55814e-24)
(0.833074 -0.0837538 -4.00746e-22)
(0.883082 -0.0454218 2.72807e-22)
(0.923035 -0.0201271 0)
(0.951738 -0.00564936 1.18369e-22)
(0.970785 0.0014641 -4.89636e-23)
(0.982756 0.00421739 -8.27337e-24)
(0.99002 0.00473136 -7.01717e-24)
(0.994322 0.00424822 0)
(0.996825 0.00341744 -1.75011e-25)
(0.998249 0.00256078 -5.00446e-25)
(0.999053 0.00177828 0)
(0.999476 0.00121209 -3.88974e-26)
(0.999769 0.000545302 -1.49176e-26)
(0.645217 -0.219277 2.27476e-20)
(0.67753 -0.269692 1.36551e-20)
(0.71664 -0.292177 -3.81245e-21)
(0.727977 -0.284704 -7.46923e-21)
(0.742651 -0.25221 0)
(0.767385 -0.202153 -3.00096e-22)
(0.804765 -0.146244 -3.51612e-23)
(0.848774 -0.0944496 2.58833e-22)
(0.891539 -0.0535789 -2.12406e-22)
(0.927155 -0.0256678 -4.39504e-23)
(0.953544 -0.00906941 -3.17637e-23)
(0.971478 -0.000533957 1.51153e-23)
(0.982959 0.00312498 -2.9934e-24)
(0.990028 0.00414808 1.34005e-23)
(0.994262 0.00394306 5.29381e-24)
(0.996751 0.00326 2.50726e-25)
(0.998182 0.00248023 4.34903e-25)
(0.998999 0.00173735 6.87462e-25)
(0.999434 0.00118952 0)
(0.999739 0.000536268 6.32338e-26)
(0.765822 -0.23619 -2.17222e-20)
(0.783309 -0.276328 2.03442e-20)
(0.800853 -0.296156 1.01782e-20)
(0.796091 -0.290135 -9.08616e-21)
(0.795298 -0.260508 -2.48455e-21)
(0.805794 -0.212734 3.69701e-21)
(0.830484 -0.157408 -9.17035e-22)
(0.864457 -0.104448 -1.45524e-22)
(0.900213 -0.0613403 1.34556e-22)
(0.931511 -0.0310063 4.51021e-23)
(0.955525 -0.012398 0)
(0.972282 -0.00246721 -1.54354e-23)
(0.983227 0.00205736 9.32119e-24)
(0.990069 0.00357908 -5.63393e-24)
(0.99422 0.00364581 -4.10547e-24)
(0.996686 0.00310655 0)
(0.998119 0.00240134 -1.0455e-24)
(0.998948 0.00169684 -2.66235e-25)
(0.999394 0.00116681 -7.21159e-26)
(0.999709 0.000527062 1.5236e-25)
(0.887703 -0.245349 -2.36274e-20)
(0.884526 -0.276432 2.21489e-20)
(0.878648 -0.2948 1.05626e-20)
(0.858538 -0.291409 -1.01505e-20)
(0.84399 -0.265575 -2.60303e-22)
(0.841851 -0.220958 0)
(0.855091 -0.167008 3.1485e-23)
(0.879792 -0.113542 -6.53411e-23)
(0.908909 -0.0686576 6.02427e-23)
(0.936003 -0.0361599 -1.19959e-22)
(0.957637 -0.0156643 3.72883e-23)
(0.973175 -0.00436687 6.74722e-23)
(0.983548 0.000989618 7.08813e-24)
(0.99014 0.00301271 -6.52341e-24)
(0.994193 0.00334966 0)
(0.996629 0.00295326 0)
(0.998061 0.00232212 6.06637e-25)
(0.998899 0.00165582 0)
(0.999354 0.00114357 -9.2296e-26)
(0.999679 0.000517554 -3.58767e-27)
(1.04537 -0.231263 0)
(1.00413 -0.25408 0)
(0.96992 -0.275412 0)
(0.932321 -0.277991 0)
(0.902448 -0.259802 0)
(0.885911 -0.222329 0)
(0.885777 -0.173137 0)
(0.899381 -0.121486 0)
(0.920346 -0.076069 0)
(0.942118 -0.0418742 0)
(0.960628 -0.0195346 0)
(0.974498 -0.00675704 0)
(0.984055 -0.000402788 0)
(0.990277 0.00223743 0)
(0.994175 0.00292872 0)
(0.996559 0.00272852 0)
(0.997983 0.00220303 0)
(0.998831 0.00159331 0)
(0.999299 0.00110832 0)
(0.999638 0.000503204 0)
(1.20099 -0.193482 0)
(1.13844 -0.226866 0)
(1.07946 -0.252893 0)
(1.0239 -0.259444 0)
(0.977529 -0.245812 0)
(0.944509 -0.214334 0)
(0.928003 -0.170974 0)
(0.927092 -0.12351 0)
(0.936865 -0.0800308 0)
(0.95111 -0.0460011 0)
(0.965119 -0.0229115 0)
(0.97655 -0.00916237 0)
(0.984884 -0.00195519 0)
(0.990536 0.00127293 0)
(0.99419 0.00235872 0)
(0.996484 0.0024018 0)
(0.997887 0.00201933 0)
(0.998744 0.00149299 0)
(0.999226 0.0010515 0)
(0.999582 0.000479828 0)
(1.30146 -0.147833 0)
(1.23466 -0.190257 0)
(1.16614 -0.220755 0)
(1.10203 -0.232543 0)
(1.04578 -0.225064 0)
(1.00089 -0.200665 0)
(0.970938 -0.164135 0)
(0.956743 -0.122081 0)
(0.955358 -0.0818415 0)
(0.961595 -0.0490271 0)
(0.970572 -0.0258493 0)
(0.97916 -0.0114617 0)
(0.986014 -0.00355072 0)
(0.990943 0.000254852 0)
(0.994271 0.00173796 0)
(0.996432 0.00203544 0)
(0.997795 0.00180757 0)
(0.998653 0.00137423 0)
(0.999148 0.000982825 0)
(0.99952 0.000451209 0)
(1.33996 -0.103264 0)
(1.28235 -0.14971 0)
(1.21738 -0.182022 0)
(1.15474 -0.198045 0)
(1.09701 -0.197097 0)
(1.04722 -0.180466 0)
(1.00927 -0.151732 0)
(0.985381 -0.116392 0)
(0.97459 -0.0808467 0)
(0.973276 -0.0504907 0)
(0.977057 -0.0280618 0)
(0.982474 -0.0134941 0)
(0.98756 -0.00508431 0)
(0.991573 -0.000780116 0)
(0.994458 0.00108154 0)
(0.996425 0.00163505 0)
(0.997718 0.00156896 0)
(0.998564 0.00123643 0)
(0.999066 0.000901175 0)
(0.999454 0.000416666 0)
(1.33075 -0.0667195 0)
(1.28844 -0.111595 0)
(1.23478 -0.142927 0)
(1.18033 -0.160806 0)
(1.12767 -0.164781 0)
(1.07935 -0.155062 0)
(1.03918 -0.134 0)
(1.01018 -0.105964 0)
(0.992942 -0.0762484 0)
(0.985472 -0.0496226 0)
(0.984408 -0.028982 0)
(0.986526 -0.0149107 0)
(0.989601 -0.00636946 0)
(0.992489 -0.00174494 0)
(0.994793 0.000425959 0)
(0.996486 0.00121232 0)
(0.997669 0.00130502 0)
(0.998483 0.00107785 0)
(0.998985 0.000804374 0)
(0.999384 0.000375018 0)
(1.29746 -0.0398985 0)
(1.26964 -0.0787833 0)
(1.22941 -0.106966 0)
(1.18567 -0.124534 0)
(1.14121 -0.131282 0)
(1.09821 -0.126869 0)
(1.06002 -0.112579 0)
(1.02984 -0.0916309 0)
(1.00918 -0.0681863 0)
(0.997375 -0.0461578 0)
(0.992235 -0.0282335 0)
(0.991186 -0.0153933 0)
(0.99212 -0.00719809 0)
(0.993712 -0.00251942 0)
(0.995299 -0.000170584 0)
(0.996634 0.00079205 0)
(0.997658 0.00102386 0)
(0.998416 0.000899546 0)
(0.998907 0.000691241 0)
(0.999314 0.000325421 0)
(1.25799 -0.0212537 0)
(1.2411 -0.0518759 0)
(1.2131 -0.0754261 0)
(1.17985 -0.0911257 0)
(1.14405 -0.0987426 0)
(1.10769 -0.0978653 0)
(1.07359 -0.0890754 0)
(1.04466 -0.0744965 0)
(1.02282 -0.0571771 0)
(1.00832 -0.0401253 0)
(1.00002 -0.0255875 0)
(0.996154 -0.014661 0)
(0.994981 -0.00734386 0)
(0.995191 -0.00295727 0)
(0.995966 -0.000629207 0)
(0.996869 0.000412389 0)
(0.997691 0.000740788 0)
(0.998369 0.000705865 0)
(0.998838 0.000561866 0)
(0.999247 0.000267455 0)
(1.22197 -0.00943621 0)
(1.21237 -0.0310731 0)
(1.19397 -0.048835 0)
(1.1697 -0.0613796 0)
(1.14163 -0.0682927 0)
(1.11164 -0.0692619 0)
(1.08209 -0.0645293 0)
(1.05547 -0.0553202 0)
(1.03373 -0.0436341 0)
(1.01774 -0.0315906 0)
(1.00717 -0.0208767 0)
(1.00099 -0.0124659 0)
(0.997914 -0.00658331 0)
(0.996788 -0.00290172 0)
(0.996731 -0.000855486 0)
(0.997172 0.000122005 0)
(0.997764 0.000476687 0)
(0.998344 0.000503762 0)
(0.998782 0.000417404 0)
(0.999185 0.000201068 0)
(1.19414 -0.00301817 0)
(1.18895 -0.0158519 0)
(1.17712 -0.026961 0)
(1.15956 -0.0351891 0)
(1.13753 -0.0400794 0)
(1.11268 -0.0414313 0)
(1.08705 -0.0393505 0)
(1.06278 -0.0344348 0)
(1.04171 -0.0277695 0)
(1.02501 -0.0206089 0)
(1.01297 -0.0140076 0)
(1.00509 -0.00863729 0)
(1.00051 -0.00474438 0)
(0.998264 -0.00222075 0)
(0.997473 -0.00076572 0)
(0.997486 -3.69672e-05 0)
(0.997857 0.000250737 0)
(0.998338 0.000300251 0)
(0.99874 0.000259311 0)
(0.999135 0.000126366 0)
(1.1779 -0.000483258 0)
(1.17486 -0.00474447 0)
(1.16651 -0.00853843 0)
(1.15276 -0.0114278 0)
(1.1343 -0.0132085 0)
(1.11253 -0.0138072 0)
(1.08933 -0.0132601 0)
(1.06664 -0.0117477 0)
(1.0462 -0.00960572 0)
(1.0293 -0.00724195 0)
(1.0165 -0.00501166 0)
(1.00768 -0.00315468 0)
(1.00221 -0.00177623 0)
(0.999256 -0.000861371 0)
(0.997988 -0.000320938 0)
(0.997714 -4.27314e-05 0)
(0.997932 7.29872e-05 0)
(0.998342 9.86791e-05 0)
(0.998718 8.8162e-05 0)
(0.999105 4.33512e-05 0)
(1.48027 0.19959 2.47309e-21)
(1.48244 0.151193 -3.10956e-21)
(1.47496 0.100586 1.51916e-21)
(1.45679 0.0486243 0)
(1.42706 -0.00358592 3.18449e-21)
(1.38531 -0.0545667 5.10759e-20)
(1.33174 -0.102298 6.574e-21)
(1.26786 -0.14392 -6.23342e-20)
(1.19822 -0.175245 0)
(1.10446 -0.191563 0)
(1.43954 0.180114 5.32909e-22)
(1.44829 0.14618 -1.13689e-20)
(1.45174 0.110449 1.11211e-21)
(1.44916 0.0731334 1.48203e-20)
(1.43976 0.0345245 2.38164e-21)
(1.42274 -0.00497247 3.67608e-20)
(1.39737 -0.0447758 0)
(1.36284 -0.0840053 2.69215e-21)
(1.32107 -0.121432 -1.34545e-21)
(1.25212 -0.157232 -1.44448e-21)
(1.39079 0.156617 -5.9353e-22)
(1.40146 0.132191 -2.34206e-21)
(1.40954 0.106685 1.58953e-21)
(1.41462 0.0800143 -1.49426e-20)
(1.41607 0.0520685 0)
(1.41311 0.0227375 -1.79981e-21)
(1.40487 -0.00803222 -3.71034e-21)
(1.39022 -0.040144 0)
(1.37065 -0.0731315 2.75534e-20)
(1.33324 -0.108993 2.07269e-21)
(1.34378 0.131436 1.17582e-21)
(1.35314 0.113487 1.11063e-21)
(1.36125 0.0948637 -1.11545e-21)
(1.36795 0.0755026 0)
(1.373 0.0553128 8.92991e-21)
(1.37606 0.0341891 -2.28454e-20)
(1.37672 0.0120326 -1.92278e-20)
(1.37436 -0.0112412 -2.27178e-20)
(1.36947 -0.0355706 -2.1093e-20)
(1.35556 -0.0634459 -1.45389e-21)
(1.30026 0.108271 -6.54201e-22)
(1.30785 0.0950295 0)
(1.31477 0.0813823 1.60781e-21)
(1.321 0.0673159 5.39501e-23)
(1.3265 0.0527978 -3.20114e-21)
(1.33115 0.0377729 0)
(1.3348 0.0221627 1.65227e-20)
(1.33717 0.00585967 3.08896e-20)
(1.33827 -0.0112221 0)
(1.33599 -0.0307822 1.47371e-20)
(1.26061 0.0867444 5.74147e-23)
(1.26669 0.0772124 5.10616e-22)
(1.27233 0.0674014 -2.45253e-22)
(1.27753 0.0573077 2.22873e-21)
(1.28227 0.0469218 -5.34427e-21)
(1.28654 0.0362255 0)
(1.2903 0.025193 2.54746e-21)
(1.29349 0.0137885 -1.43488e-20)
(1.2961 0.00195526 1.35142e-21)
(1.29771 -0.011193 -3.87236e-21)
(1.22527 0.066771 7.0367e-22)
(1.23016 0.0601714 7.67656e-22)
(1.23471 0.0533748 -3.18326e-21)
(1.23892 0.0463806 -1.58968e-21)
(1.24278 0.0391884 1.59287e-21)
(1.2463 0.0317965 -3.38844e-21)
(1.24946 0.0242025 2.60393e-22)
(1.25226 0.0164003 0)
(1.25469 0.00836122 0)
(1.25676 -0.000310636 -8.45696e-21)
(1.19536 0.0478104 0)
(1.19937 0.0435515 -1.26011e-21)
(1.2031 0.0391615 1.02772e-21)
(1.20652 0.0346395 0)
(1.20963 0.0299853 0)
(1.21244 0.0251988 -1.07008e-21)
(1.21494 0.0202807 2.68096e-21)
(1.21712 0.0152317 0)
(1.21899 0.0100416 1.24848e-21)
(1.2206 0.00456502 -1.25511e-21)
(1.17247 0.0292226 0)
(1.17588 0.026858 -5.40825e-22)
(1.17903 0.0244161 2.10405e-21)
(1.18189 0.0218951 -3.13387e-21)
(1.18447 0.019294 1.97259e-21)
(1.18675 0.0166117 2.2039e-21)
(1.18873 0.0138484 -1.66967e-21)
(1.19041 0.0110046 1.73671e-21)
(1.19179 0.00807813 -8.96922e-22)
(1.1929 0.00502964 8.41334e-22)
(1.15902 0.00984395 0)
(1.1621 0.0091083 0)
(1.16491 0.0083479 1.55686e-22)
(1.16746 0.0075601 0)
(1.16973 0.00674264 -2.84956e-21)
(1.17172 0.00589362 5.40028e-21)
(1.17342 0.00501176 -2.53911e-21)
(1.17482 0.0040965 0)
(1.17594 0.0031475 6.21462e-22)
(1.17676 0.00215907 -2.01572e-21)
(1.12928 0.453233 0)
(1.18134 0.450787 0)
(1.23062 0.443759 1.54842e-20)
(1.27613 0.431002 2.76913e-21)
(1.31921 0.412456 -3.22366e-20)
(1.35927 0.388531 1.82329e-21)
(1.39495 0.359811 0)
(1.42588 0.325537 1.26343e-21)
(1.4511 0.28718 1.39524e-21)
(1.46951 0.245093 -3.72827e-21)
(1.15886 0.388552 -2.4494e-22)
(1.19979 0.380528 -5.16011e-22)
(1.2377 0.36916 7.12277e-22)
(1.27175 0.3548 0)
(1.30378 0.337554 -1.90132e-20)
(1.33391 0.317507 1.22745e-20)
(1.36144 0.294786 -1.33724e-20)
(1.38639 0.269641 9.08923e-22)
(1.40833 0.241998 7.05147e-21)
(1.42611 0.212094 4.83291e-22)
(1.18171 0.325997 4.68125e-22)
(1.21207 0.317438 -8.50085e-21)
(1.239 0.306289 0)
(1.26324 0.293046 1.04746e-20)
(1.28615 0.278015 4.30127e-21)
(1.3079 0.261308 -9.32877e-21)
(1.32818 0.24307 1.03121e-20)
(1.34645 0.223482 1.29926e-21)
(1.36294 0.202371 -1.98122e-21)
(1.37785 0.180017 1.97293e-21)
(1.19182 0.26833 -4.01485e-22)
(1.21366 0.259631 8.22961e-21)
(1.23214 0.249302 6.8109e-21)
(1.2491 0.237692 -1.69432e-21)
(1.26542 0.225025 1.20475e-20)
(1.28102 0.211379 -5.47109e-21)
(1.29567 0.196815 0)
(1.3092 0.181414 -9.09053e-22)
(1.3217 0.165401 9.05303e-22)
(1.33327 0.148741 -1.11842e-21)
(1.1895 0.214542 -4.03667e-21)
(1.20486 0.206674 0)
(1.21756 0.197947 -1.21649e-20)
(1.2295 0.188566 -1.07398e-20)
(1.24129 0.178603 0)
(1.2527 0.168081 -1.67096e-22)
(1.2635 0.15703 -9.2976e-23)
(1.27364 0.14549 1.17551e-21)
(1.28313 0.133513 0)
(1.29201 0.121104 6.21646e-22)
(1.17824 0.165182 3.80987e-24)
(1.18903 0.158905 4.02906e-22)
(1.19804 0.152195 3.6015e-21)
(1.20672 0.145155 5.93803e-21)
(1.21541 0.137777 0)
(1.22393 0.130055 3.27665e-21)
(1.23208 0.122 1.62366e-21)
(1.23982 0.113628 -3.13719e-21)
(1.24716 0.104958 4.60433e-22)
(1.2541 0.0959947 -9.99157e-22)
(1.16197 0.121513 2.48251e-21)
(1.16976 0.116991 0)
(1.17651 0.112234 0)
(1.18312 0.10729 1.34166e-21)
(1.18977 0.102137 -1.70596e-21)
(1.19634 0.0967623 1.03031e-21)
(1.20267 0.0911718 -1.02846e-21)
(1.20875 0.0853742 1.22252e-22)
(1.21455 0.0793753 5.57439e-22)
(1.22006 0.0731731 6.3354e-22)
(1.14411 0.0832613 -4.27688e-22)
(1.15012 0.0802971 3.85353e-22)
(1.15557 0.0771981 0)
(1.16095 0.0739861 -1.25673e-21)
(1.16635 0.0706452 5.66893e-22)
(1.17167 0.0671671 0)
(1.17684 0.0635543 0)
(1.18181 0.0598112 8.28132e-22)
(1.18656 0.0559396 -6.31516e-22)
(1.19108 0.0519394 0)
(1.12812 0.048937 0)
(1.1332 0.0472748 -6.28431e-22)
(1.138 0.0455432 3.12493e-22)
(1.14273 0.0437515 -8.20833e-22)
(1.14742 0.0418911 3.39507e-22)
(1.15203 0.0399575 7.80857e-22)
(1.1565 0.0379518 -2.11413e-21)
(1.1608 0.0358754 1.83317e-21)
(1.16491 0.0337283 -7.6578e-22)
(1.1688 0.0315118 0)
(1.11792 0.0162124 -4.23922e-22)
(1.12268 0.0156543 3.90694e-22)
(1.12726 0.0150745 2.72508e-22)
(1.13173 0.0144783 -1.23883e-21)
(1.13611 0.0138651 2.64527e-21)
(1.14037 0.0132351 -1.20862e-21)
(1.14448 0.0125893 0)
(1.14843 0.0119284 -1.17851e-22)
(1.15217 0.0112515 0)
(1.15571 0.0105575 0)
(0.999958 0.00823095 0)
(0.998554 0.0247576 0)
(0.996319 0.0424278 0)
(0.992094 0.0624308 0)
(0.988135 0.0861584 0)
(0.981139 0.117124 0)
(0.979605 0.156455 0)
(0.974339 0.218573 0)
(0.997708 0.288683 0)
(1.03318 0.45028 0)
(1 0.00845841 0)
(0.999182 0.0254202 0)
(0.998016 0.0434809 0)
(0.995579 0.0638075 0)
(0.994309 0.0875216 0)
(0.991336 0.118047 0)
(0.996003 0.155006 0)
(0.999221 0.213322 0)
(1.03523 0.267331 0)
(1.07624 0.401934 0)
(1.00004 0.00857102 0)
(0.999854 0.0257399 0)
(0.999883 0.0439194 0)
(0.999498 0.0642398 0)
(1.00104 0.0873659 0)
(1.00245 0.116657 0)
(1.01215 0.149676 0)
(1.02351 0.201747 0)
(1.06223 0.238813 0)
(1.11208 0.342614 0)
(1.00007 0.00850353 0)
(1.00057 0.0255351 0)
(1.00184 0.0434292 0)
(1.00365 0.0632491 0)
(1.00785 0.085104 0)
(1.01367 0.11229 0)
(1.0268 0.140459 0)
(1.04527 0.185002 0)
(1.08161 0.209267 0)
(1.13634 0.286513 0)
(1.00011 0.00817709 0)
(1.00128 0.0245516 0)
(1.00375 0.0415735 0)
(1.00767 0.060209 0)
(1.01418 0.0799925 0)
(1.02382 0.104092 0)
(1.03904 0.126919 0)
(1.06216 0.162902 0)
(1.09498 0.178353 0)
(1.14775 0.231897 0)
(1.00014 0.00752451 0)
(1.00192 0.0225805 0)
(1.00543 0.038035 0)
(1.01112 0.0547009 0)
(1.01944 0.0717053 0)
(1.0317 0.0917891 0)
(1.04804 0.109389 0)
(1.07256 0.136173 0)
(1.10183 0.146004 0)
(1.14789 0.179559 0)
(1.00016 0.00649959 0)
(1.00241 0.0194827 0)
(1.00672 0.0326405 0)
(1.01362 0.0465545 0)
(1.02314 0.0602626 0)
(1.03659 0.0757075 0)
(1.05317 0.0885777 0)
(1.07648 0.106675 0)
(1.10214 0.112999 0)
(1.13989 0.132096 0)
(1.00018 0.00508714 0)
(1.00271 0.0152207 0)
(1.00751 0.0253758 0)
(1.015 0.0358705 0)
(1.02507 0.0459289 0)
(1.03855 0.0566212 0)
(1.05457 0.0653062 0)
(1.07537 0.0763303 0)
(1.09758 0.0802499 0)
(1.12738 0.090258 0)
(1.00019 0.00330029 0)
(1.00282 0.0098534 0)
(1.0078 0.0163612 0)
(1.0154 0.0229391 0)
(1.02549 0.0291168 0)
(1.03837 0.0353358 0)
(1.05341 0.0403156 0)
(1.07161 0.0460828 0)
(1.09097 0.0481863 0)
(1.11447 0.05285 0)
(1.0002 0.00115813 0)
(1.00283 0.00345278 0)
(1.00781 0.00571841 0)
(1.0153 0.00797604 0)
(1.02518 0.0100707 0)
(1.03748 0.0121085 0)
(1.0517 0.0137231 0)
(1.06815 0.0154968 0)
(1.08577 0.0161392 0)
(1.10563 0.0174979 0)
(0.999864 0.00438397 -6.49999e-22)
(0.996881 0.0129138 9.82975e-23)
(0.991089 0.0215241 -9.65137e-22)
(0.981105 0.030534 0)
(0.96725 0.0402498 0)
(0.9462 0.0513547 0)
(0.917409 0.0646599 1.00839e-21)
(0.873773 0.0811741 -1.00115e-21)
(0.809087 0.105046 1.30366e-21)
(0.705704 0.135008 -2.83991e-21)
(0.999856 0.00480478 7.42347e-22)
(0.996946 0.0142161 -1.50376e-21)
(0.99135 0.0238336 7.72081e-22)
(0.981682 0.0341537 -1.56471e-21)
(0.968338 0.0454925 -1.6315e-21)
(0.948041 0.0591484 0)
(0.920414 0.0757909 -1.86033e-21)
(0.878829 0.09852 -2.03634e-21)
(0.816895 0.131503 0)
(0.720751 0.180321 5.89433e-21)
(0.999848 0.00522006 0)
(0.99702 0.0155033 1.49893e-21)
(0.991648 0.0261135 0)
(0.982335 0.037716 1.56307e-21)
(0.969602 0.0506403 1.63163e-21)
(0.950178 0.0667839 0)
(0.924041 0.0866243 -1.78284e-21)
(0.885004 0.115424 6.34597e-21)
(0.826856 0.156941 -1.84774e-20)
(0.740886 0.223671 9.71385e-21)
(0.999841 0.00562893 3.54792e-21)
(0.997105 0.0167713 -5.11342e-21)
(0.991984 0.0283578 3.01013e-23)
(0.983069 0.0412075 4.6506e-21)
(0.971043 0.0556778 -6.2696e-21)
(0.952608 0.0742275 0)
(0.928292 0.097112 3.66083e-21)
(0.892241 0.131806 -4.47892e-21)
(0.838991 0.181102 1.27985e-20)
(0.765984 0.264514 4.73629e-21)
(0.999837 0.00603046 -2.10921e-21)
(0.997203 0.0180161 2.17392e-21)
(0.992361 0.0305598 2.93976e-21)
(0.983889 0.0446147 -3.0228e-21)
(0.972665 0.0605905 3.15678e-21)
(0.955332 0.0814443 0)
(0.933174 0.107215 0)
(0.900482 0.147576 -3.89014e-21)
(0.853353 0.203705 0)
(0.795838 0.302346 -4.79362e-21)
(0.999837 0.00642361 2.01707e-21)
(0.997318 0.0192331 6.98049e-22)
(0.992783 0.0327113 -6.41202e-23)
(0.984803 0.0479219 -1.02767e-22)
(0.97447 0.0653603 -3.28395e-21)
(0.958359 0.0883913 9.48248e-21)
(0.938697 0.116892 0)
(0.909674 0.162613 3.62059e-21)
(0.870036 0.224444 2.05071e-20)
(0.830135 0.336732 -3.70407e-20)
(0.99984 0.00680744 -3.99745e-21)
(0.997455 0.0204185 1.3615e-21)
(0.993257 0.0348059 -5.58214e-21)
(0.985821 0.0511175 0)
(0.976467 0.0699741 0)
(0.961705 0.0950323 -3.19683e-21)
(0.944866 0.126123 0)
(0.91978 0.176783 -3.6611e-21)
(0.889165 0.243058 -1.93564e-20)
(0.868395 0.367438 1.95963e-20)
(0.99985 0.00718234 2.54677e-21)
(0.997619 0.021576 -2.63566e-21)
(0.993791 0.0368544 8.20235e-21)
(0.986959 0.0542229 1.67222e-22)
(0.97867 0.0744725 -2.86907e-21)
(0.965401 0.101418 -6.34978e-21)
(0.951692 0.135019 6.41026e-21)
(0.930804 0.190085 3.35595e-21)
(0.910892 0.259572 1.75386e-20)
(0.909816 0.394719 -3.21977e-21)
(0.999868 0.00754886 -3.74198e-21)
(0.997823 0.0227103 2.60547e-21)
(0.994405 0.0388741 2.6887e-21)
(0.988247 0.0572771 2.92897e-21)
(0.981113 0.0789276 -8.56232e-21)
(0.969506 0.10766 0)
(0.959213 0.143783 0)
(0.942823 0.20258 -3.40769e-21)
(0.93535 0.27427 -3.57312e-21)
(0.952918 0.418598 0)
(0.9999 0.00788697 2.47696e-21)
(0.998091 0.0237459 -1.27908e-21)
(0.995131 0.0407122 0)
(0.989728 0.0600264 0)
(0.98386 0.0829201 -5.82497e-21)
(0.974115 0.113134 5.92519e-21)
(0.967503 0.151443 1.26439e-20)
(0.955975 0.212761 -1.28699e-20)
(0.962406 0.285427 -1.08315e-20)
(0.994919 0.435884 1.10037e-20)
(0.999843 0.000115497 -7.71732e-24)
(0.996648 -2.14208e-05 1.54051e-21)
(0.990583 -0.00153801 0)
(0.980256 -0.00516956 0)
(0.96697 -0.0123384 7.50171e-21)
(0.94675 -0.0259548 -7.63387e-21)
(0.924648 -0.0479459 -1.81498e-20)
(0.890217 -0.09041 1.84837e-20)
(0.8632 -0.151269 2.18168e-20)
(0.831027 -0.282259 -2.21692e-20)
(0.999847 0.000523724 -4.39689e-21)
(0.996592 0.00118691 3.04996e-21)
(0.990384 0.000626812 -9.58659e-21)
(0.979735 -0.00184858 3.01132e-21)
(0.965768 -0.00724404 3.35585e-21)
(0.944485 -0.0185729 0)
(0.919985 -0.0371752 0)
(0.882062 -0.0750866 -4.70604e-21)
(0.844351 -0.129655 -5.37471e-21)
(0.799955 -0.251289 0)
(0.999855 0.000945037 2.97338e-21)
(0.996577 0.00244489 3.41301e-23)
(0.990272 0.00286895 -2.27235e-23)
(0.979451 0.00148476 -6.87763e-21)
(0.965047 -0.00216222 1.04031e-20)
(0.942969 -0.0108767 7.95646e-21)
(0.916515 -0.0258271 -8.03174e-21)
(0.875853 -0.0585444 4.6348e-21)
(0.829283 -0.105947 -1.69403e-20)
(0.771018 -0.215725 -1.45273e-21)
(0.999864 0.00137095 -1.4891e-21)
(0.996583 0.00372003 -1.54603e-21)
(0.990226 0.00514034 -6.3824e-21)
(0.979309 0.004955 0)
(0.964657 0.00289096 0)
(0.94207 -0.00351225 -3.77014e-21)
(0.914007 -0.0143857 0)
(0.871173 -0.041808 -4.62388e-21)
(0.817581 -0.0819098 1.70615e-20)
(0.745813 -0.178091 -1.64996e-20)
(0.999871 0.00180029 3.79334e-21)
(0.996604 0.00501182 -7.77363e-22)
(0.990235 0.00744689 6.46502e-21)
(0.979289 0.00852056 1.49738e-22)
(0.964463 0.00810683 3.8375e-21)
(0.941723 0.00389654 -3.50626e-21)
(0.912426 -0.00332239 0)
(0.867777 -0.0242791 4.57289e-21)
(0.808855 -0.0566217 -1.72279e-20)
(0.725026 -0.137816 4.22702e-20)
(0.999876 0.00223215 -3.80054e-21)
(0.996636 0.00631835 3.9055e-21)
(0.99029 0.00978096 -6.75927e-23)
(0.979378 0.012144 -4.87421e-23)
(0.964467 0.0134247 3.47848e-21)
(0.941663 0.01162 0)
(0.91173 0.00748549 0)
(0.86581 -0.00682064 -4.51377e-21)
(0.802788 -0.0299035 0)
(0.708955 -0.0949485 -6.04303e-21)
(0.999878 0.0026652 2.29387e-21)
(0.996674 0.00763489 -2.36482e-21)
(0.990382 0.0121311 -3.20671e-21)
(0.979562 0.0158063 -8.03109e-23)
(0.964664 0.018791 -1.00589e-22)
(0.941927 0.0195123 0)
(0.91164 0.0187989 4.02039e-21)
(0.865218 0.0102859 1.41162e-20)
(0.799423 -0.00316256 -4.46882e-21)
(0.69772 -0.0499585 5.9715e-21)
(0.999878 0.00309807 0)
(0.996719 0.00895679 1.55941e-21)
(0.990509 0.0144879 0)
(0.979831 0.0194923 1.63408e-21)
(0.965045 0.0241792 1.71272e-21)
(0.942521 0.0274789 0)
(0.912144 0.0302946 -2.02132e-21)
(0.865654 0.0278233 -2.56592e-21)
(0.798611 0.023286 1.06821e-20)
(0.691743 -0.00414816 -1.10021e-20)
(0.999876 0.00352957 7.56888e-22)
(0.996768 0.0102799 -1.56444e-21)
(0.990669 0.0168439 7.88235e-22)
(0.980179 0.0231863 -1.63581e-21)
(0.965603 0.0295675 -1.71261e-21)
(0.943436 0.03547 0)
(0.913271 0.0418193 -1.97997e-21)
(0.867183 0.0456463 -2.19135e-21)
(0.799976 0.0504399 0)
(0.691123 0.0418636 -6.51407e-21)
(0.999871 0.00395855 -8.53283e-22)
(0.996822 0.0116003 -9.93297e-23)
(0.990862 0.0191917 -5.94911e-22)
(0.980604 0.0268724 0)
(0.966338 0.0349327 0)
(0.944663 0.0434444 0)
(0.915027 0.0533031 -1.02566e-21)
(0.869883 0.0634946 1.01829e-21)
(0.803449 0.0778777 -1.33606e-21)
(0.695808 0.0884876 2.92376e-21)
(1.00012 -0.000685191 0)
(1.00169 -0.00208995 0)
(1.00474 -0.0035838 0)
(1.00948 -0.0052391 0)
(1.01602 -0.00697467 0)
(1.02461 -0.00892739 0)
(1.03522 -0.0108262 0)
(1.0484 -0.013278 0)
(1.06389 -0.0150418 0)
(1.08264 -0.0180519 0)
(1.0001 -0.00187526 0)
(1.00147 -0.00573359 0)
(1.00415 -0.0098729 0)
(1.00842 -0.0145394 0)
(1.01444 -0.0195125 0)
(1.02264 -0.025284 0)
(1.03306 -0.0309806 0)
(1.04658 -0.0385568 0)
(1.06283 -0.0440358 0)
(1.08345 -0.0535638 0)
(1.00007 -0.00268256 0)
(1.00105 -0.0082418 0)
(1.00301 -0.0143089 0)
(1.00631 -0.0213551 0)
(1.0112 -0.0290771 0)
(1.01836 -0.038495 0)
(1.02807 -0.0480274 0)
(1.04158 -0.0613661 0)
(1.05888 -0.0710104 0)
(1.08207 -0.0887633 0)
(1.00003 -0.0030889 0)
(1.00046 -0.00954804 0)
(1.0014 -0.0167709 0)
(1.00319 -0.0254678 0)
(1.00631 -0.035372 0)
(1.01145 -0.048118 0)
(1.01965 -0.0615379 0)
(1.032 -0.0813858 0)
(1.0502 -0.0959903 0)
(1.07536 -0.124643 0)
(0.999986 -0.0031256 0)
(0.999746 -0.00972808 0)
(0.999463 -0.0173494 0)
(0.999283 -0.0268933 0)
(1.00008 -0.0383099 0)
(1.00211 -0.0537405 0)
(1.00783 -0.0709473 0)
(1.01711 -0.0975892 0)
(1.03564 -0.11829 0)
(1.06075 -0.160975 0)
(0.999946 -0.00286009 0)
(0.998993 -0.0089741 0)
(0.997399 -0.0163209 0)
(0.994989 -0.0259238 0)
(0.99309 -0.0380963 0)
(0.991074 -0.0552839 0)
(0.993355 -0.0758928 0)
(0.99717 -0.108804 0)
(1.01499 -0.136961 0)
(1.03674 -0.196358 0)
(0.999909 -0.00237754 0)
(0.998276 -0.00754016 0)
(0.995404 -0.0140779 0)
(0.990741 -0.0230625 0)
(0.985984 -0.0351983 0)
(0.979406 -0.0531 0)
(0.977363 -0.0763105 0)
(0.973575 -0.114326 0)
(0.989178 -0.151049 0)
(1.00302 -0.228596 0)
(0.999879 -0.00176206 0)
(0.997652 -0.00568112 0)
(0.993627 -0.0110401 0)
(0.986912 -0.0189012 0)
(0.979353 -0.0302686 0)
(0.968249 -0.0478768 0)
(0.961112 -0.07251 0)
(0.948624 -0.11423 0)
(0.959684 -0.16007 0)
(0.960911 -0.256936 0)
(0.999855 -0.00108685 0)
(0.997152 -0.00361646 0)
(0.992168 -0.00758999 0)
(0.983764 -0.014027 0)
(0.973697 -0.0241083 0)
(0.958579 -0.0406107 0)
(0.945863 -0.0654823 0)
(0.924729 -0.109443 0)
(0.927229 -0.164619 0)
(0.913596 -0.283397 0)
(0.999842 -0.000411259 0)
(0.996803 -0.0015473 0)
(0.9911 -0.00411006 0)
(0.981438 -0.00902171 0)
(0.969349 -0.0176083 0)
(0.951001 -0.0326385 0)
(0.932769 -0.0567792 0)
(0.903672 -0.10133 0)
(0.891712 -0.163969 0)
(0.866201 -0.302334 0)
(1.09567 -0.0179304 0)
(1.10097 -0.0178438 0)
(1.10632 -0.0177252 -7.14739e-22)
(1.11171 -0.0175823 -2.64577e-21)
(1.11715 -0.0174187 5.19297e-21)
(1.12263 -0.0172358 -2.84798e-21)
(1.12811 -0.0170341 0)
(1.13357 -0.0168137 1.33581e-22)
(1.13899 -0.0165741 0)
(1.14434 -0.0163134 0)
(1.0977 -0.0533747 1.00219e-21)
(1.1035 -0.0532016 -2.64227e-21)
(1.10936 -0.0529323 2.58351e-21)
(1.11526 -0.0525831 -1.55321e-21)
(1.12126 -0.0521598 2.31749e-21)
(1.12733 -0.0516601 3.55359e-22)
(1.13344 -0.051081 -1.26457e-21)
(1.13957 -0.05042 1.69621e-21)
(1.14567 -0.0496764 -4.49645e-22)
(1.15174 -0.0488457 0)
(1.09885 -0.0886487 -1.24722e-21)
(1.10586 -0.0884285 1.12596e-21)
(1.1129 -0.088023 0)
(1.11992 -0.0874687 1.91766e-21)
(1.12702 -0.0867811 -8.79835e-22)
(1.13424 -0.0859557 0)
(1.14153 -0.084985 0)
(1.14885 -0.0838648 6.26877e-22)
(1.15617 -0.0826056 -7.80791e-22)
(1.16346 -0.0811944 0)
(1.09605 -0.125078 -6.93821e-21)
(1.10511 -0.12497 0)
(1.11415 -0.124544 0)
(1.12298 -0.123874 2.22251e-21)
(1.13184 -0.122997 -2.15404e-21)
(1.14083 -0.121908 8.64048e-22)
(1.14992 -0.120596 -8.62485e-22)
(1.159 -0.119055 -1.31298e-21)
(1.16807 -0.117269 3.76875e-22)
(1.17717 -0.115241 2.73184e-22)
(1.08673 -0.16291 -1.99365e-21)
(1.0988 -0.163234 9.1456e-22)
(1.11082 -0.163019 -7.91279e-21)
(1.12226 -0.162406 -4.05626e-21)
(1.13358 -0.161477 0)
(1.14502 -0.160228 -2.06178e-21)
(1.15655 -0.158641 8.05301e-22)
(1.16816 -0.156722 -3.75843e-23)
(1.17979 -0.15445 1.23235e-22)
(1.19134 -0.151828 -4.44155e-23)
(1.06905 -0.201514 1.08824e-20)
(1.08524 -0.202877 0)
(1.1014 -0.203328 1.58245e-20)
(1.11638 -0.203119 1.0258e-20)
(1.13098 -0.202405 0)
(1.14569 -0.20118 -4.94044e-22)
(1.16046 -0.199426 1.1481e-22)
(1.17521 -0.197208 4.14076e-22)
(1.18993 -0.194506 0)
(1.20452 -0.19129 -9.07239e-23)
(1.04185 -0.239556 -9.19411e-22)
(1.06325 -0.242925 -1.09898e-20)
(1.08487 -0.244828 -1.10394e-20)
(1.10445 -0.24568 7.02692e-22)
(1.1233 -0.245713 -7.07693e-21)
(1.14222 -0.244919 2.71969e-21)
(1.161 -0.243317 0)
(1.17956 -0.240853 -1.23756e-22)
(1.19794 -0.237542 1.2324e-22)
(1.21582 -0.233362 -4.58762e-23)
(1.00511 -0.276534 1.25553e-21)
(1.03274 -0.282939 1.4319e-20)
(1.06105 -0.287234 0)
(1.08622 -0.289978 -1.14372e-20)
(1.11027 -0.291309 6.29051e-22)
(1.13421 -0.291167 3.13133e-21)
(1.15787 -0.289631 -1.96205e-21)
(1.18088 -0.286502 7.69156e-23)
(1.20261 -0.281772 -7.65313e-23)
(1.22257 -0.275347 5.27547e-23)
(0.960787 -0.312805 0)
(0.995277 -0.322683 -1.26764e-21)
(1.0306 -0.330261 1.23663e-21)
(1.06195 -0.335642 0)
(1.09208 -0.338508 1.00826e-20)
(1.12151 -0.338699 -3.24313e-21)
(1.14968 -0.336021 1.89824e-21)
(1.1757 -0.330515 1.04977e-24)
(1.19827 -0.322073 6.31926e-22)
(1.21641 -0.310456 -4.0564e-23)
(0.913137 -0.340217 0)
(0.953165 -0.355082 0)
(0.99348 -0.368742 2.3252e-20)
(1.03045 -0.37852 2.24985e-21)
(1.06601 -0.38338 -1.42833e-20)
(1.09967 -0.383294 0)
(1.12998 -0.377704 0)
(1.155 -0.36705 -5.84375e-23)
(1.17338 -0.351254 -1.90606e-21)
(1.18375 -0.330282 6.14932e-22)
(1.14961 -0.016029 0)
(1.15477 -0.0157177 0)
(1.15979 -0.0153755 -8.04607e-23)
(1.16466 -0.0149981 0)
(1.16935 -0.0145812 -8.70641e-22)
(1.17385 -0.0141204 1.7233e-21)
(1.17813 -0.0136112 -8.3279e-22)
(1.1822 -0.0130497 0)
(1.18602 -0.0124303 8.99018e-23)
(1.1896 -0.0117277 5.83264e-23)
(1.15773 -0.0479237 0)
(1.16361 -0.0469061 -4.65443e-22)
(1.16937 -0.0457884 1.11681e-21)
(1.17497 -0.0445656 -6.47431e-22)
(1.1804 -0.0432327 -1.38412e-22)
(1.18563 -0.0417845 3.34534e-22)
(1.19066 -0.0402161 -3.58719e-22)
(1.19546 -0.0385219 1.86231e-22)
(1.20002 -0.0366881 -3.44151e-22)
(1.20435 -0.0346106 -1.68517e-23)
(1.17071 -0.0796233 0)
(1.17786 -0.0778869 -2.36703e-22)
(1.18491 -0.0759808 3.40422e-22)
(1.19182 -0.0738997 0)
(1.19857 -0.0716374 0)
(1.20516 -0.0691874 1.6578e-22)
(1.21155 -0.0665422 1.41314e-22)
(1.21773 -0.063692 0)
(1.22365 -0.060606 -1.06153e-22)
(1.22938 -0.0570218 1.06671e-22)
(1.18625 -0.112974 1.7026e-22)
(1.19525 -0.110465 6.91971e-23)
(1.20416 -0.107705 -1.6596e-22)
(1.21294 -0.104685 -4.23675e-23)
(1.22157 -0.101393 4.24523e-23)
(1.23002 -0.0978105 2.97235e-22)
(1.23823 -0.093913 -4.63552e-22)
(1.24614 -0.089666 0)
(1.25361 -0.0849983 0)
(1.26051 -0.0793553 -2.81085e-21)
(1.20281 -0.14886 -8.34814e-23)
(1.21419 -0.14554 4.78832e-23)
(1.22544 -0.141845 1.76632e-23)
(1.2365 -0.137743 -1.0332e-22)
(1.24725 -0.133181 -1.06834e-21)
(1.25757 -0.128088 0)
(1.26726 -0.122375 -6.85292e-22)
(1.27605 -0.115938 -3.52081e-21)
(1.28364 -0.108634 -4.92103e-22)
(1.28865 -0.0994541 -1.87236e-21)
(1.21891 -0.18754 4.11046e-23)
(1.23299 -0.183212 0)
(1.24662 -0.178231 -2.50254e-22)
(1.25956 -0.172481 -1.07773e-22)
(1.27147 -0.165811 -6.43088e-22)
(1.28189 -0.158039 0)
(1.29024 -0.148967 6.58061e-21)
(1.29586 -0.138417 1.26275e-20)
(1.29825 -0.126207 0)
(1.29243 -0.110904 6.71922e-21)
(1.23291 -0.228216 1.35531e-22)
(1.24885 -0.221938 -1.96571e-22)
(1.26316 -0.214316 1.97418e-22)
(1.27515 -0.205101 0)
(1.28398 -0.194037 2.59598e-21)
(1.28868 -0.180911 -9.39393e-21)
(1.28824 -0.16561 -7.65692e-21)
(1.28171 -0.148173 -7.57473e-21)
(1.2687 -0.128636 -1.66462e-20)
(1.23839 -0.105848 8.26716e-22)
(1.24014 -0.267015 -1.55848e-22)
(1.25448 -0.256501 3.79015e-22)
(1.2645 -0.243521 -3.80945e-22)
(1.26892 -0.227827 -5.17609e-21)
(1.26639 -0.209285 0)
(1.25553 -0.187977 -5.22043e-21)
(1.23521 -0.164318 1.70963e-21)
(1.20508 -0.139105 0)
(1.16504 -0.113057 1.80756e-20)
(1.10033 -0.0862596 -1.29667e-21)
(1.22898 -0.29544 -1.17496e-22)
(1.23458 -0.276898 -2.13695e-21)
(1.23174 -0.25487 -3.10284e-22)
(1.21906 -0.229653 6.85952e-21)
(1.19536 -0.2019 -9.21619e-22)
(1.15993 -0.172723 1.66074e-20)
(1.11271 -0.143751 0)
(1.05503 -0.116977 -1.60151e-21)
(0.986258 -0.0936215 1.64236e-21)
(0.890993 -0.0721083 0)
(1.18439 -0.30434 -5.60954e-22)
(1.17358 -0.273938 6.90364e-21)
(1.14985 -0.239994 -4.51026e-22)
(1.11226 -0.203955 0)
(1.06069 -0.167898 0)
(0.996127 -0.134547 -2.45502e-20)
(0.920844 -0.107153 -3.32005e-21)
(0.839025 -0.0891432 3.37233e-20)
(0.751919 -0.0828979 0)
(0.645941 -0.0824176 0)
(1.19748 -0.00926036 0)
(1.20576 -0.00458693 0)
(1.20858 0.000471189 0)
(1.20464 0.00546207 0)
(1.1933 0.00979431 0)
(1.17487 0.012838 0)
(1.15113 0.0142746 0)
(1.12478 0.0141528 0)
(1.09849 0.0127941 0)
(1.07445 0.0106849 0)
(1.05407 0.00831705 0)
(1.03789 0.00607646 0)
(1.02576 0.00419882 0)
(1.01707 0.00276785 0)
(1.0111 0.00175586 0)
(1.00711 0.00108003 0)
(1.00452 0.00064878 0)
(1.00285 0.000377214 0)
(1.00186 0.000222575 0)
(1.0011 9.36167e-05 0)
(1.21362 -0.027107 0)
(1.22227 -0.0128631 0)
(1.224 0.00249734 0)
(1.21774 0.0175739 0)
(1.20291 0.0304637 0)
(1.18036 0.0392541 0)
(1.1527 0.0430425 0)
(1.12325 0.0420803 0)
(1.09504 0.0374941 0)
(1.07028 0.0308583 0)
(1.05008 0.0236803 0)
(1.0346 0.0170802 0)
(1.02331 0.0116795 0)
(1.01541 0.00764153 0)
(1.01004 0.00482652 0)
(1.00646 0.00296434 0)
(1.00414 0.00178208 0)
(1.00263 0.00103842 0)
(1.00173 0.000614991 0)
(1.00104 0.000259113 0)
(1.24122 -0.043867 0)
(1.25023 -0.0192175 0)
(1.24969 0.00714431 0)
(1.23897 0.0327811 0)
(1.21773 0.0540632 0)
(1.18793 0.0677235 0)
(1.15367 0.0724893 0)
(1.1193 0.0692201 0)
(1.08835 0.060263 0)
(1.06285 0.0484897 0)
(1.04334 0.0364254 0)
(1.02924 0.0257867 0)
(1.01945 0.0173762 0)
(1.01283 0.0112562 0)
(1.00842 0.00707272 0)
(1.00549 0.00433915 0)
(1.00357 0.00261383 0)
(1.0023 0.00152894 0)
(1.00154 0.00091048 0)
(1.00094 0.00038456 0)
(1.27511 -0.0595403 0)
(1.28329 -0.0233489 0)
(1.27877 0.015346 0)
(1.26146 0.0523477 0)
(1.23158 0.0818187 0)
(1.19275 0.0991867 0)
(1.15083 0.103166 0)
(1.11132 0.0957993 0)
(1.07805 0.0811322 0)
(1.05264 0.0635431 0)
(1.03469 0.0465451 0)
(1.0227 0.0322498 0)
(1.01492 0.0213828 0)
(1.00989 0.0137116 0)
(1.0066 0.00857741 0)
(1.0044 0.00526359 0)
(1.00294 0.00318181 0)
(1.00194 0.00187091 0)
(1.00132 0.00112149 0)
(1.00083 0.000475094 0)
(1.30308 -0.0724944 0)
(1.30721 -0.0244707 0)
(1.29651 0.0274467 0)
(1.27117 0.0759349 0)
(1.23269 0.112828 0)
(1.18625 0.132441 0)
(1.13885 0.133863 0)
(1.09664 0.120837 0)
(1.06336 0.0994578 0)
(1.03988 0.0757246 0)
(1.02478 0.0540328 0)
(1.01566 0.0366316 0)
(1.01025 0.0239127 0)
(1.00695 0.0151991 0)
(1.00481 0.00948231 0)
(1.00335 0.00583059 0)
(1.00232 0.00354224 0)
(1.00159 0.00209602 0)
(1.00111 0.00126567 0)
(1.00072 0.000537917 0)
(1.29807 -0.0781106 0)
(1.29386 -0.019672 0)
(1.27645 0.0439243 0)
(1.24542 0.101486 0)
(1.2038 0.143611 0)
(1.15684 0.163729 0)
(1.11107 0.161384 0)
(1.07222 0.142085 0)
(1.04347 0.113963 0)
(1.02488 0.0845406 0)
(1.01423 0.0588936 0)
(1.00867 0.0391601 0)
(1.00583 0.0252321 0)
(1.00424 0.0159373 0)
(1.0032 0.00993917 0)
(1.0024 0.00613518 0)
(1.00177 0.0037509 0)
(1.00127 0.00223522 0)
(1.00092 0.00136004 0)
(1.00061 0.000579963 0)
(1.22305 -0.0713302 0)
(1.2108 -0.0068192 0)
(1.19162 0.0627858 0)
(1.16408 0.124205 0)
(1.13184 0.168352 0)
(1.09719 0.187538 0)
(1.06425 0.181419 0)
(1.03738 0.156757 0)
(1.01892 0.123238 0)
(1.00846 0.0895629 0)
(1.00373 0.0612297 0)
(1.00217 0.0401199 0)
(1.00189 0.02562 0)
(1.0019 0.0161348 0)
(1.00181 0.0100838 0)
(1.00158 0.00625908 0)
(1.00129 0.0038547 0)
(1.00099 0.00231426 0)
(1.00075 0.00141879 0)
(1.00052 0.000607006 0)
(1.05625 -0.0532916 0)
(1.04795 0.0101806 0)
(1.03959 0.0770987 0)
(1.02999 0.136816 0)
(1.02194 0.180717 0)
(1.01269 0.198959 0)
(1.00315 0.190748 0)
(0.995789 0.163186 0)
(0.992182 0.126774 0)
(0.992053 0.0909528 0)
(0.993975 0.0614455 0)
(0.996455 0.0399082 0)
(0.998552 0.0253743 0)
(0.999931 0.0159862 0)
(1.00065 0.0100338 0)
(1.00089 0.00626994 0)
(1.00088 0.00389152 0)
(1.00075 0.00235376 0)
(1.0006 0.00145322 0)
(1.00044 0.000623639 0)
(0.819996 -0.0335008 0)
(0.834022 0.0203612 0)
(0.850414 0.0767368 0)
(0.870641 0.132153 0)
(0.896117 0.176244 0)
(0.919324 0.195833 0)
(0.938367 0.188956 0)
(0.953767 0.161969 0)
(0.966535 0.125585 0)
(0.977101 0.0897085 0)
(0.985466 0.0603143 0)
(0.991625 0.0390409 0)
(0.995777 0.0248086 0)
(0.998311 0.0156721 0)
(0.999687 0.00988999 0)
(1.00032 0.00622351 0)
(1.00054 0.00389184 0)
(1.00054 0.00237 0)
(1.00047 0.0014722 0)
(1.00037 0.00063347 0)
(0.571556 -0.0214119 0)
(0.615647 0.0125016 0)
(0.664464 0.0586304 0)
(0.71882 0.112094 0)
(0.779047 0.158547 0)
(0.834179 0.181974 0)
(0.880498 0.179142 0)
(0.916969 0.155283 0)
(0.94448 0.121045 0)
(0.964428 0.0866215 0)
(0.978331 0.0582543 0)
(0.987602 0.0377274 0)
(0.993474 0.0240264 0)
(0.996966 0.015245 0)
(0.998888 0.00968096 0)
(0.999844 0.00613619 0)
(1.00025 0.00386558 0)
(1.00037 0.00236918 0)
(1.00037 0.00147985 0)
(1.00031 0.000638428 0)
(0.398361 -0.032027 1.7003e-20)
(0.463194 0.00391128 -1.59097e-20)
(0.538774 0.0521026 -1.08426e-20)
(0.618134 0.10518 9.70829e-21)
(0.702911 0.150134 -2.92324e-22)
(0.779525 0.172166 0)
(0.843528 0.168925 -2.97941e-22)
(0.893333 0.145948 3.09431e-22)
(0.930129 0.113532 0)
(0.956047 0.0812219 2.56151e-22)
(0.973543 0.0547234 -5.36537e-23)
(0.984876 0.0355868 -1.67933e-22)
(0.991904 0.0228059 0)
(0.996044 0.0145859 0)
(0.998337 0.00934444 0)
(0.999511 0.00597587 0)
(1.00005 0.00379653 -2.35606e-24)
(1.00024 0.00234415 0)
(1.00029 0.00147378 -2.0145e-25)
(1.00027 0.000637807 4.99325e-25)
(0.281137 -0.0452162 1.61844e-20)
(0.348659 -0.00504202 -1.51237e-20)
(0.441999 0.0425456 -9.05845e-21)
(0.539304 0.0938524 8.71295e-21)
(0.643135 0.137519 3.39156e-21)
(0.736739 0.159412 -3.86567e-21)
(0.81481 0.157278 1.11199e-21)
(0.875167 0.136301 0)
(0.919248 0.106262 0)
(0.949797 0.0762144 7.34856e-23)
(0.970038 0.0515454 0)
(0.982916 0.0337042 -3.3388e-23)
(0.99079 0.0217508 -3.37475e-23)
(0.995397 0.0140214 1.13162e-23)
(0.997953 0.00905576 4.55948e-24)
(0.99928 0.00583613 0)
(0.999904 0.00373398 5.19482e-25)
(1.00016 0.00231971 3.88602e-24)
(1.00023 0.00146613 -1.81547e-25)
(1.00024 0.000636145 -1.41344e-25)
(0.183835 -0.0606604 -1.57949e-20)
(0.24659 -0.0164006 -1.20395e-20)
(0.351064 0.0285079 2.53109e-21)
(0.46263 0.0781803 8.81784e-21)
(0.583746 0.121197 0)
(0.693695 0.143949 -3.71736e-22)
(0.785787 0.143866 -4.45293e-23)
(0.856822 0.125619 3.58656e-23)
(0.908315 0.098445 0)
(0.943569 0.0709435 -7.16103e-23)
(0.966578 0.0482451 -5.20826e-23)
(0.980996 0.0317623 3.2696e-23)
(0.989704 0.0206639 5.23553e-23)
(0.994765 0.0134379 1.16501e-23)
(0.997576 0.00875507 -3.99567e-24)
(0.999051 0.00568881 7.2861e-24)
(0.999765 0.00366675 -3.98059e-24)
(1.00007 0.00229248 -2.25864e-24)
(1.00018 0.00145671 0)
(1.00021 0.000633713 -5.34669e-25)
(0.10433 -0.0738182 1.01733e-21)
(0.159049 -0.0311645 0)
(0.269245 0.00884171 0)
(0.391159 0.0577222 -5.49862e-21)
(0.526965 0.100872 4.39425e-21)
(0.651832 0.125574 1.63563e-22)
(0.757293 0.128601 4.61496e-24)
(0.83875 0.113899 -1.23038e-22)
(0.89756 0.0901195 0)
(0.937473 0.0654588 0)
(0.963214 0.0448676 1.58975e-23)
(0.97914 0.029796 8.05556e-23)
(0.988657 0.0195691 -1.93755e-23)
(0.994155 0.0128509 -2.25934e-23)
(0.99721 0.00845188 0)
(0.998828 0.00553936 -1.00358e-23)
(0.999627 0.00359775 6.56488e-24)
(0.999984 0.00226377 0)
(1.00012 0.00144605 -1.53695e-25)
(1.00018 0.000630679 1.81979e-25)
(0.041444 -0.0839396 1.43956e-20)
(0.0873241 -0.0474078 -9.94211e-21)
(0.199423 -0.0131075 2.58222e-21)
(0.328154 0.0326248 6.18652e-21)
(0.475259 0.0764663 1.5903e-21)
(0.612836 0.10399 -1.78621e-21)
(0.73036 0.111156 -1.55204e-23)
(0.821524 0.10088 -1.37319e-23)
(0.88728 0.0811095 -9.81182e-23)
(0.931652 0.059651 1.69856e-22)
(0.960012 0.0413519 -1.36315e-22)
(0.977377 0.0277743 1.10747e-22)
(0.98766 0.0184523 -6.68939e-23)
(0.993571 0.0122543 2.81119e-23)
(0.996858 0.00814372 0)
(0.998611 0.00538683 0)
(0.999492 0.00352661 3.38521e-24)
(0.9999 0.00223348 -3.49661e-24)
(1.00007 0.00143412 1.58953e-24)
(1.00015 0.000627049 4.96819e-25)
(-0.00500024 -0.0915994 -9.55421e-22)
(0.0333467 -0.0647697 -1.16299e-23)
(0.144359 -0.0363347 0)
(0.276154 0.00405887 2.53594e-21)
(0.431181 0.0484598 -1.4455e-21)
(0.578518 0.0795215 0)
(0.706127 0.0916558 1.08014e-23)
(0.805793 0.0865854 -9.9489e-23)
(0.877808 0.0713992 -4.798e-24)
(0.926265 0.0534993 0)
(0.957041 0.0376825 0)
(0.975736 0.0256881 -3.08743e-23)
(0.986729 0.0173086 3.6226e-23)
(0.993021 0.0116457 8.14361e-24)
(0.996522 0.00782941 -3.1037e-24)
(0.998402 0.00523067 -6.58043e-24)
(0.99936 0.00345308 -1.12401e-24)
(0.999817 0.00220155 3.48778e-24)
(1.00001 0.00142092 -1.52593e-24)
(1.00011 0.000622826 -5.83059e-26)
(-0.0346492 -0.0974439 9.37384e-22)
(-0.00182105 -0.0828649 -5.57111e-21)
(0.106513 -0.0626698 4.0607e-21)
(0.238116 -0.0264347 2.72481e-22)
(0.397164 0.0171501 0)
(0.550699 0.0527036 0)
(0.685751 0.0704288 -2.15509e-22)
(0.792219 0.071179 1.68828e-22)
(0.869489 0.0610621 5.03642e-23)
(0.921474 0.0470342 3.86098e-23)
(0.954372 0.0338717 -8.22999e-23)
(0.974247 0.0235426 5.23339e-23)
(0.985873 0.0161404 8.81468e-24)
(0.992509 0.0110262 2.06283e-23)
(0.996205 0.00750959 -1.734e-23)
(0.998203 0.0050712 0)
(0.999233 0.00337734 0)
(0.999736 0.00216804 0)
(0.999961 0.0014065 -6.15723e-25)
(1.00008 0.00061803 0)
(-0.046881 -0.101995 0)
(-0.0172784 -0.101602 4.74277e-21)
(0.0878641 -0.0904489 -6.98927e-21)
(0.216254 -0.0581517 2.82932e-21)
(0.375132 -0.0151495 0)
(0.531089 0.0242034 0)
(0.670305 0.0478801 1.29728e-23)
(0.78143 0.0548793 6.26009e-23)
(0.862648 0.0502032 2.02715e-22)
(0.91743 0.0403023 -1.65429e-22)
(0.952069 0.0299393 0)
(0.972935 0.0213461 0)
(0.985103 0.0149514 0)
(0.99204 0.0103977 -7.24359e-24)
(0.995909 0.00718519 1.68768e-23)
(0.998013 0.00490893 0)
(0.99911 0.00329964 0)
(0.999657 0.0021331 1.21739e-24)
(0.999908 0.00139092 5.91237e-25)
(1.00005 0.000612689 2.26241e-26)
(-0.0413445 -0.106053 -3.83439e-21)
(-0.0127425 -0.120923 0)
(0.0893771 -0.118686 0)
(0.212246 -0.0909607 -1.10411e-21)
(0.366611 -0.0475521 9.25223e-22)
(0.520649 -0.00511399 -2.30053e-22)
(0.66064 0.024494 1.32736e-22)
(0.773945 0.037955 -2.88194e-22)
(0.857562 0.0389565 5.96482e-23)
(0.914265 0.0333641 6.05302e-24)
(0.950188 0.0259107 2.98016e-23)
(0.971823 0.019109 1.13304e-23)
(0.984429 0.013746 -1.68753e-23)
(0.991616 0.00976226 2.48747e-24)
(0.995635 0.00685724 3.16951e-24)
(0.997833 0.00474439 -1.10817e-24)
(0.998992 0.0032203 0)
(0.999579 0.00209686 -1.21613e-24)
(0.999856 0.00137427 0)
(1.00002 0.000606837 0)
(-0.0182646 -0.110922 1.80472e-21)
(0.0113617 -0.140368 -7.7703e-22)
(0.11092 -0.146673 0)
(0.226275 -0.123542 2.97644e-22)
(0.372252 -0.0804543 -1.63688e-22)
(0.52017 -0.0345222 -6.22448e-24)
(0.657294 0.000815178 5.80492e-24)
(0.770124 0.0207216 0)
(0.854432 0.0274843 0)
(0.912075 0.0262947 0)
(0.948772 0.0218179 0)
(0.970928 0.0168442 5.44081e-24)
(0.983856 0.0125293 -5.0792e-24)
(0.991241 0.00912199 -7.91067e-25)
(0.995385 0.00652675 7.38884e-25)
(0.997665 0.00457807 1.10674e-24)
(0.998879 0.00313951 0)
(0.999504 0.00205944 -2.15717e-26)
(0.999805 0.0013566 2.01778e-26)
(0.999988 0.000600495 0)
)
;
boundaryField
{
inlet
{
type freestream;
freestreamValue uniform (1 0 0);
value uniform (1 0 0);
}
outlet
{
type freestream;
freestreamValue uniform (1 0 0);
value nonuniform List<vector>
40
(
(0.999638 0.000503204 0)
(0.999582 0.000479828 0)
(0.99952 0.000451209 0)
(0.999454 0.000416666 0)
(0.999384 0.000375018 0)
(0.999314 0.000325421 0)
(0.999247 0.000267455 0)
(0.999185 0.000201068 0)
(0.999135 0.000126366 0)
(0.999105 4.33512e-05 0)
(0.999956 0.000593712 0)
(0.999924 0.0005865 0)
(0.999893 0.000578906 -5.58271e-27)
(0.999862 0.000570957 0)
(0.999831 0.000562685 0)
(0.9998 0.000554123 -1.2512e-26)
(0.999769 0.000545302 -1.49176e-26)
(0.999739 0.000536268 6.32338e-26)
(0.999709 0.000527062 1.5236e-25)
(0.999679 0.000517554 -3.58767e-27)
(1.00027 0.000637807 4.99325e-25)
(1.00024 0.000636145 -1.41344e-25)
(1.00021 0.000633713 -5.34669e-25)
(1.00018 0.000630679 1.81979e-25)
(1.00015 0.000627049 4.96819e-25)
(1.00011 0.000622826 -5.83059e-26)
(1.00008 0.00061803 0)
(1.00005 0.000612689 2.26241e-26)
(1.00002 0.000606837 0)
(0.999988 0.000600495 0)
(1.0011 9.36167e-05 0)
(1.00104 0.000259113 0)
(1.00094 0.00038456 0)
(1.00083 0.000475094 0)
(1.00072 0.000537917 0)
(1.00061 0.000579963 0)
(1.00052 0.000607006 0)
(1.00044 0.000623639 0)
(1.00037 0.00063347 0)
(1.00031 0.000638428 0)
)
;
}
top
{
type symmetryPlane;
}
bottom
{
type symmetryPlane;
}
cylinder
{
type rotatingWallVelocity;
origin (0 0 0);
axis (0 0 1);
omega constant -1;
value nonuniform List<vector>
80
(
(0.019816 -0.499213 0)
(0.0588591 -0.496114 0)
(0.0975394 -0.48997 0)
(0.13562 -0.480821 0)
(0.172869 -0.468721 -3.72705e-23)
(0.209058 -0.453746 0)
(0.243965 -0.435985 0)
(0.277377 -0.415548 1.68364e-22)
(0.30909 -0.39256 -2.10347e-22)
(0.338909 -0.367161 0)
(0.499213 -0.019816 0)
(0.496114 -0.0588591 0)
(0.48997 -0.0975394 0)
(0.480821 -0.13562 3.62338e-24)
(0.468721 -0.172869 -3.72705e-23)
(0.453746 -0.209058 0)
(0.435985 -0.243965 0)
(0.415548 -0.277377 0)
(0.39256 -0.30909 -2.10347e-22)
(0.367161 -0.338909 0)
(0.367161 0.338909 0)
(0.39256 0.30909 -2.10347e-22)
(0.415548 0.277377 1.68364e-22)
(0.435985 0.243965 0)
(0.453746 0.209058 0)
(0.468721 0.172869 -3.72705e-23)
(0.480821 0.13562 3.62338e-24)
(0.48997 0.0975394 -0)
(0.496114 0.0588591 -0)
(0.499213 0.019816 -0)
(0.019816 0.499213 0)
(0.0588591 0.496114 0)
(0.0975394 0.48997 0)
(0.13562 0.480821 3.62338e-24)
(0.172869 0.468721 -3.72705e-23)
(0.209058 0.453746 -0)
(0.243965 0.435985 -0)
(0.277377 0.415548 -0)
(0.30909 0.39256 -2.10347e-22)
(0.338909 0.367161 -0)
(-0.338909 0.367161 0)
(-0.30909 0.39256 -2.10347e-22)
(-0.277377 0.415548 1.68364e-22)
(-0.243965 0.435985 0)
(-0.209058 0.453746 0)
(-0.172869 0.468721 -3.72705e-23)
(-0.13562 0.480821 3.62338e-24)
(-0.0975394 0.48997 0)
(-0.0588591 0.496114 0)
(-0.019816 0.499213 0)
(-0.367161 0.338909 0)
(-0.39256 0.30909 -2.10347e-22)
(-0.415548 0.277377 0)
(-0.435985 0.243965 0)
(-0.453746 0.209058 0)
(-0.468721 0.172869 -3.72705e-23)
(-0.480821 0.13562 3.62338e-24)
(-0.48997 0.0975394 0)
(-0.496114 0.0588591 0)
(-0.499213 0.019816 0)
(-0.499213 -0.019816 0)
(-0.496114 -0.0588591 0)
(-0.48997 -0.0975394 0)
(-0.480821 -0.13562 0)
(-0.468721 -0.172869 -3.72705e-23)
(-0.453746 -0.209058 0)
(-0.435985 -0.243965 0)
(-0.415548 -0.277377 1.68364e-22)
(-0.39256 -0.30909 -2.10347e-22)
(-0.367161 -0.338909 0)
(-0.338909 -0.367161 0)
(-0.30909 -0.39256 -2.10347e-22)
(-0.277377 -0.415548 0)
(-0.243965 -0.435985 0)
(-0.209058 -0.453746 0)
(-0.172869 -0.468721 -3.72705e-23)
(-0.13562 -0.480821 3.62338e-24)
(-0.0975394 -0.48997 0)
(-0.0588591 -0.496114 0)
(-0.019816 -0.499213 0)
)
;
}
frontandback
{
type empty;
}
}
// ************************************************************************* //
|
|
d74f90b0ca5e695550cedaf734d83fb9beeea135
|
28dba754ddf8211d754dd4a6b0704bbedb2bd373
|
/Sgu/P146.cpp
|
538020fc680c30af0217220e7ae6923cc69990a5
|
[] |
no_license
|
zjsxzy/algo
|
599354679bd72ef20c724bb50b42fce65ceab76f
|
a84494969952f981bfdc38003f7269e5c80a142e
|
refs/heads/master
| 2023-08-31T17:00:53.393421
| 2023-08-19T14:20:31
| 2023-08-19T14:20:31
| 10,140,040
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 385
|
cpp
|
P146.cpp
|
#include <cstdio>
#include <iostream>
using namespace std;
int N;
long long L, T, V;
int main() {
double l;
scanf("%lf%d", &l, &N);
L = (long long)(l * 10000 + 0.5);
long long S = 0;
for (int i = 0; i < N; i++) {
cin >> T >> V;
S = (S + V * T * 10000 % L) % L;
}
double ret = (double)min(S, L - S) / 10000.0;
printf("%.4lf\n", ret);
return 0;
}
|
c43dd9606760009d7b4dc55b26fc8395419b74c8
|
253d3874706a20e95e92aaf7111ce5e7d23157c2
|
/lab3/p1.cpp
|
3b879f77fa253f30ae93d4626bfd70a9dd502b06
|
[] |
no_license
|
Khem112/CN_codes
|
57061a091c2772dc47fa099198e98b9f559a1ed1
|
c1b95e150a0a7ef30842f60dd4d0f0ec4632369f
|
refs/heads/main
| 2023-04-21T16:23:10.647014
| 2021-03-03T17:18:25
| 2021-03-03T17:18:25
| 335,300,444
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,548
|
cpp
|
p1.cpp
|
#include <stdio.h>
#include <errno.h>
#include <time.h>
#include <string.h>
#include <pthread.h>
#include <signal.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <netinet/ip.h>
#include <arpa/inet.h>
#include <errno.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <net/ethernet.h>
#include <netinet/ether.h>
#include <netinet/udp.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/select.h>
#include <sys/un.h>
#include <sys/shm.h>
#include <sys/socket.h>
#include <semaphore.h>
#include <bits/stdc++.h>
using namespace std;
#define PN 2
#define PERMS 0666
long pid[PN+1];
struct my_msgbuf {
long mtype;
char mtext[200];
};
int msqid;
int len;
key_t key;
struct my_msgbuf buf;
void* Reader(void*){
struct my_msgbuf buf;
for(;;) { /* normally receiving never ends but just to make conclusion
/* this program ends wuth string of end */
if (msgrcv(msqid, &buf, sizeof(buf.mtext), 0, 0) == -1) {
perror("msgrcv");
exit(1);
}
if(buf.mtype == getpid())
printf("%d : \"%s\"\n",(int)(buf.mtype), buf.mtext);
else{
if (msgsnd(msqid, &buf, len+1, 0) == -1) /* +1 for '\0' */
perror("msgsnd");
}
}
}
void *Writer(void*){
struct my_msgbuf buf;
char str[200];
buf.mtype = getpid();
cout << "OK";
fflush(stdout);
while(fgets(buf.mtext, sizeof buf.mtext, stdin) != NULL) {
int len = strlen(buf.mtext);
/* remove newline at end, if it exists */
if (buf.mtext[len-1] == '\n') buf.mtext[len-1] = '\0';
for(int i=0;i< PN;i++){
buf.mtype = pid[i];
if (msgsnd(msqid, &buf, len+1, 0) == -1) /* +1 for '\0' */
perror("msgsnd");
}
}
}
int main(){
if ((key = ftok("msgq.txt", 'B')) == -1) {
perror("ftok");
exit(1);
}
if ((msqid = msgget(key, PERMS | IPC_CREAT)) == -1) {
perror("msgget");
exit(1);
}
cout << "P1 can access MSQ";
fflush(stdout);
sem_t *p1 = sem_open("/p1", O_CREAT | O_RDWR);
int mypid = getpid();
buf.mtype = mypid;
memset(buf.mtext,0,sizeof(buf.mtext));
strcat(buf.mtext,"");
len = strlen(buf.mtext)+1;
for(int i=0;i< PN ; i++){
if (msgsnd(msqid, &buf, len+1, 0) == -1) /* +1 for '\0' */
perror("msgsnd");
}
for(int i=0;i< PN ; i++){
while(1){
if (msgrcv(msqid, &buf, sizeof(buf.mtext), 0, 0) == -1) {
perror("msgrcv");
exit(1);
}
int f = 0;
for(int j=0;j<i;j++){
if(buf.mtype == pid[j]){
f =1;
}
}
if( (f==0) && (buf.mtype!=mypid)) {
pid[i] = buf.mtype;
cout << "PID " << i << " " << pid[i] << "\n";
fflush(stdout);
break;
}
else{
if (msgsnd(msqid, &buf, len+1, 0) == -1) /* +1 for '\0' */
perror("msgsnd");
}
}
}
fflush(stdin);
sem_post(p1);
sleep(5);
sem_wait(p1);
cout << "Now P1 can send msg too";
pthread_t tid1,tid2;
pthread_create(&tid1,NULL,Reader,NULL);
pthread_create(&tid2,NULL,Writer,NULL);
pthread_join(tid1,NULL);
pthread_join(tid2,NULL);
return 0;
}
|
8f59fd3d67337e185fef558e29a214b61b0c27cb
|
5002bbe557c13d0bbf52057ef938e538f112cd7c
|
/src/tmxlite_test_sdl2/src/level.cpp
|
c8f9ce78f4f175d19d72f0983025aa26dbc54973
|
[] |
no_license
|
inniyah/TiledCythonTest
|
532614ca0ff5ec8a6b279d93c093b33211898ddc
|
80e8cbfd2814797d25b3f798b090e1a6ecef057e
|
refs/heads/master
| 2023-06-23T05:41:53.616133
| 2021-07-18T17:02:29
| 2021-07-18T17:02:29
| 343,677,603
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,467
|
cpp
|
level.cpp
|
#include "level.hpp"
#include "assets.hpp"
#include "tmxlite/Map.hpp"
#include "tmxlite/Layer.hpp"
#include "tmxlite/TileLayer.hpp"
#include <iostream>
#include <algorithm>
tile::tile(SDL_Texture* tset, int x, int y, int tx, int ty, int w, int h)
: sheet(tset), x(x), y(y), tx(tx), ty(ty), width(w), height(h) {
}
void tile::draw(SDL_Renderer* ren) {
if (!ren || !sheet)
return;
SDL_Rect src;
src.x = tx;
src.y = ty;
src.w = width;
src.h = height;
SDL_Rect dest;
dest.x = x;
dest.y = y;
dest.w = src.w;
dest.h = src.h;
SDL_RenderCopy(ren, sheet, &src, &dest);
}
level::level(const std::string& name)
: name(name), rows(0), cols(0) {
}
void level::load(const std::string& path, SDL_Renderer* ren) {
// Load and parse the Tiled map with tmxlite
tmx::Map tiled_map;
tiled_map.load(path);
// We need to know the size of the map (in tiles)
auto map_dimensions = tiled_map.getTileCount();
rows = map_dimensions.y;
cols = map_dimensions.x;
// We also need to know the dimensions of the tiles.
auto tilesize = tiled_map.getTileSize();
tile_width = tilesize.x;
tile_height = tilesize.y;
// Load all of the tilesets and store them in a data structure.
// I chose to store them in a map.
auto& map_tilesets = tiled_map.getTilesets();
for (auto& tset : map_tilesets) {
auto tex = assets::instance()
.load_texture(tset.getImagePath(), ren);
tilesets.insert(std::pair<gid, SDL_Texture*>(tset.getFirstGID(), tex));
}
// This is the hard part; iterate through each layer in the map,
// poke each tile for the information you need, and store it in
// our tiles data structure.
//
// We start at the bottom most layer, and work our way up with this
// outer for-loop.
auto& map_layers = tiled_map.getLayers();
for (auto& layer : map_layers) {
// We're only looking to render the tiles on the map, so if
// this layer isn't a tile layer, we'll move on.
if (layer->getType() != tmx::Layer::Type::Tile) {
continue;
}
auto* tile_layer = dynamic_cast<const tmx::TileLayer*>(layer.get());
// Grab all of this layer's tiles.
auto& layer_tiles = tile_layer->getTiles();
// Remember when we needed the size of the Tiled map? This
// is where it comes into play. Because we're making a simple
// 2D game, each tile belongs in an x,y coordinate, so using
// a loop can help us visit each place if there's a tile there.
for (auto y = 0; y < rows; ++y) {
for (auto x = 0; x < cols; ++x) {
// the `layer_tiles` vector that our `getTiles()` call
// returned on line 78 isn't a 2D array, but we can
// convert our x, y coordinates into an index that we
// can access it at.
auto tile_index = x + (y * cols);
// Grab the GID of the tile we're at.
auto cur_gid = layer_tiles[tile_index].ID;
// If the GID is 0, that means it's an empty tile,
// we don't want to waste time on nothing, nor do we
// want to store an empty tile.
if (cur_gid == 0) {
continue;
}
// Find the tileset that this tile belongs to. The tileset
// whose first GID is less-than-or-equal to this GID, is
// the tileset our GID belongs to. A tileset with a first
// GID that is greater than this tile means that this tile
// does not belong to that tileset.
auto tset_gid = -1;
for (auto& ts : tilesets) {
if (ts.first <= cur_gid) {
tset_gid = ts.first;
break;
}
}
// If we didn't find a valid tileset, skip the tile. We can't
// render it if we don't have a tileset to pull from.
if (tset_gid == -1) {
continue;
}
// Normalize the GID.
cur_gid -= tset_gid;
// Find the dimensions of the tile sheet. This is important,
// because our tile is only a small sprite on that sheet, not
// the whole sheet.
auto ts_width = 0;
auto ts_height = 0;
SDL_QueryTexture(tilesets[tset_gid],
NULL, NULL, &ts_width, &ts_height);
// Calculate the area on the tilesheet to draw from.
auto region_x = (cur_gid % (ts_width / tile_width)) * tile_width;
auto region_y = (cur_gid / (ts_width / tile_width)) * tile_height;
// Calculate the world position of our tile. This is easy,
// because we're using nested for-loop to visit each x,y
// coordinate.
auto x_pos = x * tile_width;
auto y_pos = y * tile_height;
// Phew, all done.
tile t(tilesets[tset_gid], x_pos, y_pos,
region_x, region_y, tile_width, tile_height);
tiles.push_back(t);
}
}
}
}
void level::draw(SDL_Renderer* ren) {
for (auto& tile : tiles) {
tile.draw(ren);
}
}
|
dbb3a861ed629b64215cc2b2042d3626b059e0fc
|
5042603e9ced3a23a6058f5e77ba4c1e7fe27ef2
|
/src/hpnmg/datastructures/transitions/DeterministicTransition.cpp
|
9a0095653e485c9e4a33fee5764070661af3181c
|
[] |
no_license
|
jannikhuels/hpnmg
|
378647f17c52113e01cf61dd4f1bae30b738cca9
|
eb366c6043dbb3ac59a6f9fb2c157b1ec66a1b9c
|
refs/heads/master
| 2021-06-06T02:54:59.894465
| 2020-03-25T11:43:47
| 2020-03-25T11:43:47
| 114,992,963
| 1
| 0
| null | 2019-11-11T12:21:13
| 2017-12-21T10:21:20
|
C++
|
UTF-8
|
C++
| false
| false
| 610
|
cpp
|
DeterministicTransition.cpp
|
#include "DeterministicTransition.h"
using namespace std;
namespace hpnmg {
DeterministicTransition::DeterministicTransition(std::string id, unsigned long priority, double weight, double discTime)
: Transition(id), priority(priority), weight(weight), discTime(discTime)
{}
double DeterministicTransition::getDiscTime() { return discTime; }
double DeterministicTransition::getWeight() { return weight; }
double DeterministicTransition::getPriority() { return priority; }
void DeterministicTransition::setDiscTime(double discTime) {
this->discTime = discTime;
}
}
|
d7a645ec09d2f5379733164607340918cecf7eb7
|
6e665dcd74541d40647ebb64e30aa60bc71e610c
|
/600/VoipLib/include/sipstack/TransferMsg.hxx
|
594e9850299b14df7483c793d0249b273f7dfe31
|
[] |
no_license
|
jacklee032016/pbx
|
b27871251a6d49285eaade2d0a9ec02032c3ec62
|
554149c134e50db8ea27de6a092934a51e156eb6
|
refs/heads/master
| 2020-03-24T21:52:18.653518
| 2018-08-04T20:01:15
| 2018-08-04T20:01:15
| 143,054,776
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,089
|
hxx
|
TransferMsg.hxx
|
#ifndef TRANSFERMSG_H
#define TRANSFERMSG_H
/*
* $Id: TransferMsg.hxx,v 1.2 2007/03/01 20:04:28 lizhijie Exp $
*/
#include "SipCommand.hxx"
#include "StatusMsg.hxx"
namespace Vocal
{
class BaseUrl;
///
class TransferMsg : public SipCommand
{
public:
enum TransferMsgForward { transferMsgForward };
///
TransferMsg();
///
TransferMsg(const StatusMsg&, Sptr <BaseUrl> transferTo);
///
TransferMsg(const SipCommand&, Sptr <BaseUrl> transferTo );
///
TransferMsg(const TransferMsg&, enum TransferMsgForward);
///
//called by the sipMsg decode.
TransferMsg( Data& data );
///
TransferMsg& operator =(const TransferMsg&);
///
TransferMsg(const TransferMsg &);
///
// virtual Data encode() const; // get details and create Message, and return.
///
virtual Method getType() const;
private:
void setTransferDetails(const SipMsg&, int type, Sptr <BaseUrl> url);
};
} // namespace Vocal
#endif
|
f0b82c95d2b6d4af2889f406732eac273825b839
|
1934b86552e987f8c3b37123afcc7941596cf213
|
/src/scats/scats.cpp
|
e04a14b170951f5dd537d57936e5248bcc0a6a39
|
[
"Unlicense"
] |
permissive
|
paveloom-c/C3.1
|
86d2607bcb6a735c68cded777a83b3f78e347615
|
6a8bc96e5fbc32b494bddde561cfe3c5707f6b20
|
refs/heads/master
| 2022-09-03T13:55:46.195531
| 2020-04-29T14:23:07
| 2020-04-29T14:23:07
| 258,973,950
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,928
|
cpp
|
scats.cpp
|
#include <pybind11/pybind11.h> // Функции связывания
#include <pybind11/stl.h> // STL контейнеры
#include "prec.h" // Точность вещественных чисел
#include "scats.h" // API модуля
#include <string> // Строки
namespace py = pybind11; // Пространство имен pybind11
// Модуль SCATS
PYBIND11_MODULE(scats, m)
{
#ifdef VERSION_INFO
m.attr("__version__") = VERSION_INFO;
#else
m.attr("__version__") = "dev";
#endif
// Описание модуля
m.doc() = "Модуль для выполнения спектрально-корреляционного анализа временных рядов";
// Вывод версии модуля
m.def(
"version", [] { return VERSION_INFO; }, "Метод для вывода версии модуля SCATS");
// Регистрация исключений
py::register_exception<scats_input_read_exception>(m, "input_read_exception");
py::register_exception<scats_input_read_element_exception>(m, "input_read_element_exception");
// API модуля
py::class_<SCATS_API>(m, "api", "Экземпляр API для спектрально-корелляционного анализа временных рядов")
.def(py::init())
.def_readonly("input", &SCATS_API::input, R"delim(
Экземпляр класса :class:`scats.input` для взаимодействия с входными данными
)delim")
.def(
"read_input", [](SCATS_API &api, const char *file) { api.input.read(file); }, R"delim(
Процедура для считывания входных данных из файла (alias :func:`scats.input.read`)
Args:
file (str): Имя файла для считывания.
Raises:
input_read_exception: Не удалось открыть / закрыть файл или не удалось считать :attr:`scats.input.N`, :attr:`delta_t` или :attr:`q`.
input_read_element_exception: Не удалось считать один из элементов массивов :attr:`scats.input.t` и :attr:`scats.input.x`.
)delim")
.def("deallocate", &SCATS_API::deallocate, "Вспомогательная процедура для общего освобождения памяти");
// Входные данные
py::class_<input_struct<RT>>(m, "input", "Интерфейс для взаимодействия с входными данными.")
.def(py::init())
.def_readwrite("N", &input_struct<RT>::N, "int: Размер выборки.")
.def_readwrite("delta_t", &input_struct<RT>::delta_t, "float: Шаг выборки.")
.def_readwrite("q", &input_struct<RT>::q, "float: Уровень значимости.")
.def_readwrite("t", &input_struct<RT>::t, "array[N]: Массив времени.")
.def_readwrite("x", &input_struct<RT>::x, "array[N]: Массив значений.")
.def("read", &input_struct<RT>::read, py::arg("file"), R"delim(
Процедура для считывания входных данных из файла
Args:
file (str): Имя файла для считывания.
Raises:
input_read_exception: Не удалось открыть / закрыть файл или не удалось считать :attr:`scats.input.N`, :attr:`delta_t` или :attr:`q`.
input_read_element_exception: Не удалось считать один из элементов массивов :attr:`scats.input.t` и :attr:`scats.input.x`.
)delim")
.def("deallocate", &input_struct<RT>::deallocate, "Процедура для освобождения памяти из-под входных данных");
}
|
f0e863576e6c701ab51c314d0a4a51f8caf77dea
|
b9691aa01979b857344252db973757470d94dce4
|
/assignment_package/src/scene/inventory.h
|
47d42c7d6576d4a7ef893d3e843f18b216f850b7
|
[] |
no_license
|
NY-Kim/mini-minecraft
|
fceb78ee783aad2942a38466b647b0cad7676ae3
|
215ce1e545e90a8e0b51934df7cf6614e53c7309
|
refs/heads/master
| 2022-07-05T02:18:33.511782
| 2020-05-17T13:35:44
| 2020-05-17T13:35:44
| 264,672,776
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 518
|
h
|
inventory.h
|
#ifndef INVENTORY_H
#define INVENTORY_H
#include <drawable.h>
#include <la.h>
#include <scene/terrain.h>
#include <QOpenGLContext>
#include <QOpenGLBuffer>
#include <QOpenGLShaderProgram>
class Inventory : public Drawable
{
public:
Inventory(OpenGLContext* context);
virtual void create();
virtual GLenum drawMode();
bool drawn;
std::map<BlockType, int> block_map;
BlockType selected_type;
void printInventory();
void selectRight();
void selectLeft();
};
#endif // INVENTORY_H
|
3ef0411c6ef6a872bb0ee67b6ab7b2eeaa626d36
|
81aaf01c7123da72fc19c17d24baa72ce325847b
|
/Homework/5/phone_book.cpp
|
de3323087a2e68fec8e3923a34d5884560a21fc3
|
[] |
no_license
|
ruslan-shupanov/algorithms_techno_mail
|
b58788a753197322481578887040f6b61acacd62
|
f7cb126817f8e745a0ff491f864ba9cea3110a77
|
refs/heads/main
| 2023-01-31T15:40:59.005008
| 2020-12-14T00:25:34
| 2020-12-14T00:25:34
| 308,096,718
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,109
|
cpp
|
phone_book.cpp
|
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <vector>
using namespace std;
struct Card {
string name;
string value;
Card(string s1, string s2) : name(s1), value(s2) {}
bool operator == (Card const & b)
{
return name == b.name;
}
};
struct Phones {
vector<Card> list;
void add(string name, string value) {
Card tmp = Card(name, value);
auto it = find(list.begin(), list.end(), tmp);
if (it != list.end()){
error();
return;
}
list.push_back(tmp);
}
void del(string name) {
Card tmp = Card(name, "");
auto it = find(list.begin(), list.end(), tmp);
if (it == list.end()) {
error();
return;
}
list.erase(it);
}
void edit(string name, string value) {
Card tmp = Card(name, value);
auto it = find(list.begin(), list.end(), tmp);
if (it == list.end()) {
error();
return;
}
*it = tmp;
}
void print(string name) {
Card tmp = Card(name, "");
auto it = find(list.begin(), list.end(), tmp);
if (it == list.end()) {
error();
return;
}
cout << it->name << " " << it->value << endl;
}
void error() {
cout << "ERROR" << endl;
}
// phone() : list(NULL) {}
};
int main()
{
int N;
cin >> N;
string cmd, name, num;
Phones pb;
for (int i = 0; i < N; i++) {
cin >> cmd;
if (cmd == "ADD") {
cin >> name >> num;
pb.add(name, num);
continue;
}
if (cmd == "DELETE") {
cin >> name;
pb.del(name);
continue;
}
if (cmd == "PRINT") {
cin >> name;
pb.print(name);
continue;
}
if (cmd == "EDITPHONE") {
cin >> name >> num;
pb.edit(name, num);
continue;
}
cout << "ERROR" << endl;
}
return 0;
};
|
569ecd16614512b3ecbe5f163558848bfc0ac8b8
|
4a23908779804445aa382d89df582593945cdd3c
|
/src/sas/models/include/flexible_cylinder.h
|
ef378ee5bc79d4813cffb3a98563b12dcd976992
|
[] |
no_license
|
diffpy/srfit-sasview
|
97930afca42b13774461d4993a80575f3e98c721
|
792e6be8e13f67657de88e5fb9a9afb91a750c30
|
refs/heads/master
| 2021-01-18T05:00:15.447038
| 2015-12-08T16:19:34
| 2015-12-08T16:19:34
| 44,706,210
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,618
|
h
|
flexible_cylinder.h
|
/*
TODO: Add 2D model
*/
#if !defined(flexible_cylinder_h)
#define flexible_cylinder_h
#include "parameters.hh"
/** Structure definition for Flexible cylinder parameters
* [PYTHONCLASS] = FlexibleCylinderModel
* [DISP_PARAMS] = length, kuhn_length, radius
[DESCRIPTION] = <text> Note : scale and contrast=sldCyl-sldSolv are both multiplicative factors in the
model and are perfectly correlated. One or
both of these parameters must be held fixed
during model fitting.
</text>
[FIXED]= <text>length.width; kuhn_length.width; radius.width</text>
[ORIENTATION_PARAMS]= <text></text>
**/
class FlexibleCylinderModel{
public:
// Model parameters
/// Scale factor
// [DEFAULT]=scale=1.0
Parameter scale;
/// Length of the flexible cylinder [A]
// [DEFAULT]=length=1000 [A]
Parameter length;
/// Kuhn length of the flexible cylinder [A]
// [DEFAULT]=kuhn_length=100 [A]
Parameter kuhn_length;
/// Radius of the flexible cylinder [A]
// [DEFAULT]=radius=20.0 [A]
Parameter radius;
/// SLD of cylinder [1/A^(2)]
// [DEFAULT]=sldCyl=1.0e-6 [1/A^(2)]
Parameter sldCyl;
/// SLD of solvent [1/A^(2)]
// [DEFAULT]=sldSolv=6.3e-6 [1/A^(2)]
Parameter sldSolv;
/// Incoherent Background [1/cm]
// [DEFAULT]=background=0.0001 [1/cm]
Parameter background;
// Constructor
FlexibleCylinderModel();
// Operators to get I(Q)
double operator()(double q);
double operator()(double qx, double qy);
double calculate_ER();
double calculate_VR();
double evaluate_rphi(double q, double phi);
};
#endif
|
c3d935bcb3fde4aedd3173a025e38218ee175f72
|
fa7ba9dc69c3d1c47f2caab8b6012c4003eff852
|
/source/ReadAnnotations.h
|
b161ae7bf8d87685e282f54c29e59c7ea3bd776c
|
[
"MIT"
] |
permissive
|
alexdobin/STAR
|
22d6c771b6346b8ec19f89751f21a56fd42549df
|
79affaae7d5e70221287762eab4e40679fad87f7
|
refs/heads/master
| 2023-08-23T07:32:52.945974
| 2023-08-15T19:21:58
| 2023-08-15T19:21:58
| 17,778,869
| 1,686
| 594
|
MIT
| 2023-08-16T15:49:57
| 2014-03-15T15:47:05
|
C
|
UTF-8
|
C++
| false
| false
| 1,655
|
h
|
ReadAnnotations.h
|
#ifndef H_ReadAnnotations
#define H_ReadAnnotations
#include "IncludeDefine.h"
#include "SoloCommon.h"
#include "SoloFeatureTypes.h"
class ReadAnnotFeature {//annotations for one feature
public:
set<uint32> fSet; //set of genes for this read
vector<set<uint32>> fAlign; //gene for each alignment of this read
uint32 ovType;
enum overlapTypes {none, exonic, exonicAS, exonic50p, exonic50pAS, intronic, intronicAS, intergenic, N};
void reset() {
fSet={}; fAlign={}; ovType = 0;
};
};
class ReadAnnotations {
public:
//set<uint32> geneFull, geneFull_Ex50pAS, geneFull_ExonOverIntron, geneConcordant;
//uint32 geneFullTr, geneFull_Ex50pAS_Tr, geneFull_ExonOverIntron_Tr, geneConcordantTr; //index of the annotated align - for multimappers that aligned to one gene only
//vector<int32> geneFull_Al, geneFull_Ex50pAS_Al, geneFull_ExonOverIntron_Al, geneConcordant_Al; //gene for each align
array<ReadAnnotFeature, SoloFeatureTypes::N> annotFeatures;
vector<array<uint32,2>> transcriptConcordant;
vector<int32> geneExonOverlap;
array<uint32,2> geneVelocytoSimple;//first element is gene, then counts of transcript types
vector<trTypeStruct> trVelocytoType;//first element is gene, then counts of transcript types
//vector<array<uint64,2>> sj;
//bool sjAnnot;
void reset () {
transcriptConcordant = {};
trVelocytoType = {};
for (auto &raf : annotFeatures)
raf.reset();
};
};
#endif
|
46151ae5f21c88205712bdb87f43bb10b061e12e
|
eb5f30e2c16e90a4c93326f85134027fc390d5a8
|
/include/chapter7/Exercise7_1_2.h
|
ba9ebeab1df83c5ef147661416a886631ac1205f
|
[] |
no_license
|
windmissing/exerciseForAlgorithmSecond
|
72fb890235286b164fbf33b1652e36349424a089
|
c6ade0da2d7ca6be3415dece65e4f73ade5b4444
|
refs/heads/master
| 2021-01-10T02:18:35.617566
| 2016-12-21T09:43:16
| 2016-12-21T09:43:16
| 48,029,328
| 16
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 395
|
h
|
Exercise7_1_2.h
|
/*************************************************************************
> File Name: ../../include/chapter7/Exercise7_1_2.h
> Author: yinahe
> Mail: yina.he@nokia.com
> Created Time: Sun 29 Nov 2015 11:26:27 AM CST
************************************************************************/
#include<iostream>
using namespace std;
void QuickSort7_1_2(int *A, int p, int r);
|
4d720fb57ebbe77096740089a65a25e24ba4b4ab
|
99ed70e680a4ea821946b5056dd88c46c96e8945
|
/tests/query.cpp
|
6ce08c131a3d13608dbd565d2a8d7eb91f1cc6ae
|
[] |
no_license
|
LiamMartens/sanity-cpp
|
22ed8e5390f84539e27c20a8a1e60a8e553cf428
|
d30e8c95a58478b828446926bfbdad599ab6c67d
|
refs/heads/master
| 2020-04-15T08:02:30.221032
| 2019-04-01T22:08:16
| 2019-04-01T22:08:16
| 164,513,589
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,867
|
cpp
|
query.cpp
|
#include "sanity_query.h"
#include "sanity_filter.h"
#include "sanity_equality_filter.h"
#include "sanity_defined_filter.h"
#include "sanity_defined_filter.h"
#include "sanity_string.h"
#include "sanity_modifiers.h"
#include "sanity_order.h"
#include "Catch2/single_include/catch2/catch.hpp"
TEST_CASE("Test query") {
SanityQuery query;
SanityFilter filter;
filter.AddPart(
SanityEqualityFilter("param1", SanityEqualityFilterCondition::EQ, "param2")
);
filter.AddPart(
SanityDefinedFilter("param3"),
SanityFilterOperator::AND
);
query.SetFilter(filter);
SanityModifiers modifiers;
SanityOrder order("_createdAt", true);
modifiers.AddModifier(order);
query.SetModifiers(modifiers);
SanityObjectProjection proj;
proj.AddProperty(
SanityObjectProjectionProperty("title")
);
proj.AddProperty(
SanityObjectProjectionProperty("description")
);
query.SetProjection(proj);
SECTION("Test query copy") {
SanityQuery query_copy = query;
REQUIRE(
query.build() == "*[param1 == param2 && defined(param3)]|order(_createdAt asc){title,description}"
);
REQUIRE(
query_copy.build() == "*[param1 == param2 && defined(param3)]|order(_createdAt asc){title,description}"
);
}
SECTION("Test query clone") {
SanityQuery* query_clone = (SanityQuery*)query.clone();
REQUIRE(
query.build() == "*[param1 == param2 && defined(param3)]|order(_createdAt asc){title,description}"
);
REQUIRE(
query_clone->build() == "*[param1 == param2 && defined(param3)]|order(_createdAt asc){title,description}"
);
delete query_clone;
}
SECTION("Test query build") {
REQUIRE(
query.build() == "*[param1 == param2 && defined(param3)]|order(_createdAt asc){title,description}"
);
}
SECTION("Test subquery build") {
SanityObjectProjectionProperty subq_prop;
subq_prop.SetRename("relatedMovies");
SanityQuery subq;
SanityFilter subq_filter;
subq_filter.AddPart(
SanityEqualityFilter(
"_type",
SanityEqualityFilterCondition::EQ,
SanityString::QuoteWrap("movie")
)
);
subq_filter.AddPart(SanityDefinedFilter("^._id"), SanityFilterOperator::AND);
subq.SetFilter(subq_filter);
SanityObjectProjection subq_proj;
subq.SetProjection(subq_proj);
subq_prop.SetValue(subq);
proj.AddProperty(subq_prop);
query.SetProjection(proj);
REQUIRE(
query.build() == "*[param1 == param2 && defined(param3)]|order(_createdAt asc){title,description,\"relatedMovies\":*[_type == \"movie\" && defined(^._id)]}}"
);
}
}
|
c6e659cfa4bcb880c4173fcbe07754ce384214d9
|
ca5378cfca62c8364ea850e15bedd04610829ebc
|
/cpp-homeworks/homework_5/include/sifts.hpp
|
f11551e491fdc382e72e78e108c225fefebee19a
|
[] |
no_license
|
HaoWangSir/Modern-cpp-Projects
|
7ac9efdb1f33f0acaa3e4ccfad446c0a9eaba400
|
949dc7d207b3ea9ac7137a336b3d485ca54c8cdd
|
refs/heads/master
| 2022-12-02T08:51:50.150933
| 2020-08-12T20:54:52
| 2020-08-12T20:54:52
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 448
|
hpp
|
sifts.hpp
|
#ifndef SIFTS_
#define SIFTS_
#include <iostream>
#include <opencv2/opencv.hpp>
#include <string>
#include <tuple>
#include <vector>
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/xfeatures2d.hpp>
using std::string;
using std::vector;
using cv::xfeatures2d::SiftDescriptorExtractor;
using cv::xfeatures2d::SiftFeatureDetector;
std::tuple<cv::Mat, cv::Mat> ComputeSifts(const string &fileName);
#endif // SIFTS_
|
adb67150453270deb4ab218da713a05723f3d487
|
569fdf5acfa7096d4bbdcfc912fc6f3b9b2d7571
|
/SFML_start/gamestateModel.cpp
|
1806f845f8ecef89ce417a62ab502d2e16e077ef
|
[] |
no_license
|
xrabohrok/RingsOfMadness
|
f7c9d2f65e0a252f8bbb01a46bd37304969165b4
|
d095a8a85c9c6f9ba55f9cf6238aeccb87390a1a
|
refs/heads/master
| 2020-04-13T23:27:46.046117
| 2013-10-23T20:20:08
| 2013-10-23T20:20:08
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 126
|
cpp
|
gamestateModel.cpp
|
#include "gamestateModel.h"
gamestateModel::gamestateModel(void)
{
}
gamestateModel::~gamestateModel(void)
{
}
|
c7867a4d18283bb12c4b1acaca661ef619d946eb
|
e4e2397cbd4434873d5aeff49232147348a479b1
|
/ehunter/sample/HtsStreamingSampleAnalysis.cpp
|
2e5824ff27c9511e18e143e6bc622a0d73ae22e8
|
[
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"GPL-3.0-or-later",
"Zlib",
"MIT",
"BSL-1.0",
"BSD-2-Clause",
"LicenseRef-scancode-polyform-strict-1.0.0"
] |
permissive
|
Illumina/ExpansionHunter
|
c68b46356aadaea38b4649eb948f631a090146f6
|
b22e63024b9fb6d481fc02f6a301dbbad74d503f
|
refs/heads/master
| 2022-12-12T19:04:37.020106
| 2022-12-08T18:32:31
| 2022-12-08T18:32:31
| 73,416,041
| 154
| 48
|
Apache-2.0
| 2022-10-20T07:18:35
| 2016-11-10T19:53:15
|
C++
|
UTF-8
|
C++
| false
| false
| 13,235
|
cpp
|
HtsStreamingSampleAnalysis.cpp
|
//
// Expansion Hunter
// Copyright 2016-2019 Illumina, Inc.
// All rights reserved.
//
// Author: Egor Dolzhenko <edolzhenko@illumina.com>,
// Chris Saunders <csaunders@illumina.com>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//
#include "sample/HtsStreamingSampleAnalysis.hh"
#include <memory>
#include "absl/container/flat_hash_set.h"
#include "spdlog/spdlog.h"
#include <boost/optional.hpp>
#include "core/HtsHelpers.hh"
#include "core/ThreadPool.hh"
#include "locus/LocusAnalyzer.hh"
#include "locus/LocusAnalyzerUtil.hh"
#include "sample/GenomeQueryCollection.hh"
#include "sample/HtsFileStreamer.hh"
#include "sample/HtsStreamingReadPairQueue.hh"
using ehunter::locus::initializeLocusAnalyzers;
using ehunter::locus::LocusAnalyzer;
using graphtools::AlignmentWriter;
using std::string;
using std::vector;
namespace ehunter
{
namespace
{
/// \brief Mutable data shared by all LocusAnalyzer-processing threads
///
class LocusAnalyzerThreadSharedData
{
public:
LocusAnalyzerThreadSharedData(const unsigned maxActiveLocusAnalyzerQueues, const unsigned locusAnalyzerCount)
: isWorkerThreadException(false)
, readPairQueue(maxActiveLocusAnalyzerQueues, locusAnalyzerCount)
{
}
std::atomic<bool> isWorkerThreadException;
HtsStreamingReadPairQueue readPairQueue;
vector<std::unique_ptr<LocusAnalyzer>> locusAnalyzers;
};
/// \brief Data isolated to each LocusAnalyzer-processing thread
///
struct LocusAnalyzerThreadLocalData
{
std::exception_ptr threadExceptionPtr = nullptr;
std::shared_ptr<graphtools::AlignerSelector> alignerSelectorPtr;
};
/// Process queue for a single LocusAnalyzer on one thread
void processLocusAnalyzerQueue(
const int threadIndex, LocusAnalyzerThreadSharedData& locusAnalyzerThreadSharedData,
std::vector<LocusAnalyzerThreadLocalData>& locusAnalyzerThreadLocalDataPool, const unsigned locusIndex)
{
if (locusAnalyzerThreadSharedData.isWorkerThreadException.load())
{
return;
}
LocusAnalyzerThreadLocalData& locusAnalyzerThreadData(locusAnalyzerThreadLocalDataPool[threadIndex]);
auto& locusAnalyzer(*locusAnalyzerThreadSharedData.locusAnalyzers[locusIndex]);
boost::optional<HtsStreamingReadPairQueue::ReadPair> readPair;
try
{
while (true)
{
locusAnalyzerThreadSharedData.readPairQueue.getNextReadPair(locusIndex, readPair);
if (not readPair)
{
break;
}
processAnalyzerBundleReadPair(
locusAnalyzer, readPair->regionType, readPair->inputType, readPair->read, readPair->mate,
*locusAnalyzerThreadData.alignerSelectorPtr);
}
}
catch (const std::exception& e)
{
locusAnalyzerThreadSharedData.isWorkerThreadException.store(true);
locusAnalyzerThreadData.threadExceptionPtr = std::current_exception();
std::ostringstream oss;
oss << "Exception caught in thread " << threadIndex << " while processing read pair queue for locus: `"
<< locusAnalyzer.locusId() << "`";
if (readPair)
{
oss << " current readPair: `" << readPair->read.fragmentId() << "`";
}
oss << ": " << e.what();
spdlog::error(oss.str());
throw;
}
catch (...)
{
locusAnalyzerThreadSharedData.isWorkerThreadException.store(true);
locusAnalyzerThreadData.threadExceptionPtr = std::current_exception();
std::ostringstream oss;
oss << "Exception caught in thread " << threadIndex << " while processing read pair queue for locus: `"
<< locusAnalyzer.locusId() << "`";
if (readPair)
{
oss << " current readPair: `" << readPair->read.fragmentId() << "`";
}
spdlog::error(oss.str());
throw;
}
}
/// \brief Mutable data shared by all SampleFindings-processing threads
///
class SampleFindingsThreadSharedData
{
public:
SampleFindingsThreadSharedData()
: isWorkerThreadException(false)
, locusIndex(0)
{
}
std::atomic<bool> isWorkerThreadException;
std::atomic<unsigned> locusIndex;
};
/// \brief Data isolated to each SampleFindings-processing thread
///
struct SampleFindingsThreadLocalData
{
std::exception_ptr threadExceptionPtr = nullptr;
};
/// \brief Analyze a series of loci on one thread
///
void analyzeLocus(
const int threadIndex, const Sex sampleSex, vector<std::unique_ptr<LocusAnalyzer>>& locusAnalyzers,
SampleFindings& sampleFindings, SampleFindingsThreadSharedData& sampleFindingsThreadSharedData,
std::vector<SampleFindingsThreadLocalData>& sampleFindingsThreadLocalData)
{
SampleFindingsThreadLocalData& sampleFindingsThreadData(sampleFindingsThreadLocalData[threadIndex]);
std::string locusId = "Unknown";
try
{
const unsigned size(locusAnalyzers.size());
while (true)
{
if (sampleFindingsThreadSharedData.isWorkerThreadException.load())
{
return;
}
const auto locusIndex(sampleFindingsThreadSharedData.locusIndex.fetch_add(1));
if (locusIndex >= size)
{
return;
}
auto& locusAnalyzer(*locusAnalyzers[locusIndex]);
locusId = locusAnalyzer.locusId();
sampleFindings[locusIndex] = locusAnalyzer.analyze(sampleSex, boost::none);
}
}
catch (const std::exception& e)
{
sampleFindingsThreadSharedData.isWorkerThreadException = true;
sampleFindingsThreadData.threadExceptionPtr = std::current_exception();
spdlog::error("Exception caught in thread {} while analyzing locus: {} : {}", threadIndex, locusId, e.what());
throw;
}
catch (...)
{
sampleFindingsThreadSharedData.isWorkerThreadException = true;
sampleFindingsThreadData.threadExceptionPtr = std::current_exception();
spdlog::error("Unknown exception caught in thread {} while analyzing locus: {}", threadIndex, locusId);
throw;
}
}
}
SampleFindings htsStreamingSampleAnalysis(
const InputPaths& inputPaths, Sex sampleSex, const HeuristicParameters& heuristicParams, const int threadCount,
const RegionCatalog& regionCatalog, locus::AlignWriterPtr bamletWriter)
{
// Setup thread-specific data structures and thread pool
const unsigned maxActiveLocusAnalyzerQueues(threadCount + 5);
const unsigned locusAnalyzerCount(regionCatalog.size());
LocusAnalyzerThreadSharedData locusAnalyzerThreadSharedData(maxActiveLocusAnalyzerQueues, locusAnalyzerCount);
std::vector<LocusAnalyzerThreadLocalData> locusAnalyzerThreadLocalDataPool(threadCount);
for (int threadIndex(0); threadIndex < threadCount; ++threadIndex)
{
auto& locusAnalyzerThreadData(locusAnalyzerThreadLocalDataPool[threadIndex]);
locusAnalyzerThreadData.alignerSelectorPtr.reset(
new graphtools::AlignerSelector(heuristicParams.alignerType()));
}
ctpl::thread_pool pool(threadCount);
spdlog::info("Initializing all loci");
graphtools::AlignerSelector alignerSelector(heuristicParams.alignerType());
locusAnalyzerThreadSharedData.locusAnalyzers
= initializeLocusAnalyzers(regionCatalog, heuristicParams, bamletWriter, threadCount);
GenomeQueryCollection genomeQuery(locusAnalyzerThreadSharedData.locusAnalyzers);
spdlog::info("Streaming reads");
auto ReadHash = [](const Read& read) { return std::hash<std::string>()(read.fragmentId()); };
auto ReadEq = [](const Read& read1, const Read& read2) { return (read1.fragmentId() == read2.fragmentId()); };
using ReadCatalog = absl::flat_hash_set<Read, decltype(ReadHash), decltype(ReadEq)>;
ReadCatalog unpairedReads(1000, ReadHash, ReadEq);
const unsigned htsDecompressionThreads(std::min(threadCount, 12));
htshelpers::HtsFileStreamer readStreamer(inputPaths.htsFile(), inputPaths.reference(), htsDecompressionThreads);
while (readStreamer.trySeekingToNextPrimaryAlignment() && readStreamer.isStreamingAlignedReads())
{
// Stop processing reads if an exception is thrown in the worker pool:
if (locusAnalyzerThreadSharedData.isWorkerThreadException.load())
{
break;
}
const bool isReadNearTargetRegion = genomeQuery.targetRegionMask.query(
readStreamer.currentReadContigId(), readStreamer.currentReadPosition());
const bool isMateNearTargetRegion = genomeQuery.targetRegionMask.query(
readStreamer.currentMateContigId(), readStreamer.currentMatePosition());
if (!isReadNearTargetRegion && !isMateNearTargetRegion)
{
continue;
}
if (not readStreamer.currentIsPaired())
{
continue;
}
Read read = readStreamer.decodeRead();
const auto mateIterator = unpairedReads.find(read);
if (mateIterator == unpairedReads.end())
{
unpairedReads.emplace(std::move(read));
continue;
}
Read mate = std::move(*mateIterator);
unpairedReads.erase(mateIterator);
const int64_t readEnd = readStreamer.currentReadPosition() + read.sequence().length();
const int64_t mateEnd = readStreamer.currentMatePosition() + mate.sequence().length();
vector<AnalyzerBundle> analyzerBundles = genomeQuery.analyzerFinder.query(
readStreamer.currentReadContigId(), readStreamer.currentReadPosition(), readEnd,
readStreamer.currentMateContigId(), readStreamer.currentMatePosition(), mateEnd);
const unsigned bundleCount(analyzerBundles.size());
for (unsigned bundleIndex(0); bundleIndex < bundleCount; ++bundleIndex)
{
auto& bundle(analyzerBundles[bundleIndex]);
auto sendReadPair = [&](HtsStreamingReadPairQueue::ReadPair readPair)
{
if (locusAnalyzerThreadSharedData.readPairQueue.insertReadPair(bundle.locusIndex, std::move(readPair)))
{
pool.push(
processLocusAnalyzerQueue, std::ref(locusAnalyzerThreadSharedData),
std::ref(locusAnalyzerThreadLocalDataPool), bundle.locusIndex);
}
};
if ((bundleIndex + 1) < bundleCount)
{
sendReadPair({ bundle.regionType, bundle.inputType, read, mate });
}
else
{
sendReadPair({ bundle.regionType, bundle.inputType, std::move(read), std::move(mate) });
}
}
}
pool.stop(true);
// Rethrow exceptions from the pool in thread order:
if (locusAnalyzerThreadSharedData.isWorkerThreadException.load())
{
for (int threadIndex(0); threadIndex < threadCount; ++threadIndex)
{
const LocusAnalyzerThreadLocalData& locusAnalyzerThreadData(locusAnalyzerThreadLocalDataPool[threadIndex]);
if (locusAnalyzerThreadData.threadExceptionPtr)
{
std::rethrow_exception(locusAnalyzerThreadData.threadExceptionPtr);
}
}
}
spdlog::info("Analyzing read evidence");
SampleFindingsThreadSharedData sampleFindingsThreadSharedData;
std::vector<SampleFindingsThreadLocalData> sampleFindingsThreadLocalDataPool(threadCount);
const unsigned locusCount(locusAnalyzerThreadSharedData.locusAnalyzers.size());
SampleFindings sampleFindings(locusCount);
// Start all sampleFindings worker threads
std::vector<std::thread> sampleFindingsThreads;
for (int threadIndex(0); threadIndex < threadCount; ++threadIndex)
{
sampleFindingsThreads.emplace_back(
analyzeLocus, threadIndex, sampleSex, std::ref(locusAnalyzerThreadSharedData.locusAnalyzers),
std::ref(sampleFindings), std::ref(sampleFindingsThreadSharedData),
std::ref(sampleFindingsThreadLocalDataPool));
}
// Rethrow exceptions from worker pool in thread order:
if (sampleFindingsThreadSharedData.isWorkerThreadException.load())
{
for (int threadIndex(0); threadIndex < threadCount; ++threadIndex)
{
const auto& sampleFindingsThreadData(sampleFindingsThreadLocalDataPool[threadIndex]);
if (sampleFindingsThreadData.threadExceptionPtr)
{
std::rethrow_exception(sampleFindingsThreadData.threadExceptionPtr);
}
}
}
for (int threadIndex(0); threadIndex < threadCount; ++threadIndex)
{
sampleFindingsThreads[threadIndex].join();
}
return sampleFindings;
}
}
|
34208e8162ee5bca70c26f5c9c0b2b51e068341f
|
099a7f4b42a6f14c7f11ce29afbd982ffda34980
|
/BJDP/KataATM/ATM/account.h
|
f2ce9e6d25ddf8d6639d4ecc7267e5ad925d6ef2
|
[] |
no_license
|
e5MaxSpace/BJDP
|
a8c3a30c43cc96adc0afe864523042748b62d4d9
|
31ce3fea0d1ff5452de07fcfffaf385651d94019
|
refs/heads/master
| 2021-01-01T06:26:12.963024
| 2013-09-15T07:35:07
| 2013-09-15T07:35:07
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 252
|
h
|
account.h
|
#ifndef ACCOUNT_H
#define ACCOUNT_H
class Account
{
public:
explicit Account(double balance);
double balance() const;
void deposite(double amount);
bool withdraw(double amount);
private:
double m_balance;
};
#endif // ACCOUNT_H
|
7efb7bca8c5bcf38195effd8bab76cd9e14e1ce1
|
4110496fb8b6cf7fbdabf9682f07255b6dab53f3
|
/Dp/2008. [Like] Maximum Earnings From Taxi.cpp
|
14dced126750f0f9dcdc7c91829dc24986d3829f
|
[] |
no_license
|
louisfghbvc/Leetcode
|
4cbfd0c8ad5513f60242759d04a067f198351805
|
1772036510638ae85b2d5a1a9e0a8c25725f03bd
|
refs/heads/master
| 2023-08-22T19:20:30.466651
| 2023-08-13T14:34:58
| 2023-08-13T14:34:58
| 227,853,839
| 4
| 0
| null | 2020-11-20T14:02:18
| 2019-12-13T14:09:25
|
C++
|
UTF-8
|
C++
| false
| false
| 1,361
|
cpp
|
2008. [Like] Maximum Earnings From Taxi.cpp
|
// Sort by end position. O(NlogN).
// and we just use binary search, try to extand, since end is increasing.
class Solution {
public:
long long maxTaxiEarnings(int n, vector<vector<int>>& rides) {
long res = 0;
sort(rides.begin(), rides.end(), [&](auto &a, auto &b){
return a[1] < b[1];
});
map<int, long> dp{{0, 0}};
for(auto &v: rides){
int l = v[0], r = v[1], c = v[2];
auto it = prev(dp.upper_bound(v[0]));
if(it->second + r - l + c > dp.rbegin()->second){
dp[r] = it->second + r - l + c;
}
}
return dp.rbegin()->second;
}
};
// Build graph O(N + M).
// From each end point, try to get the maximum. dp[i]: maximum get so far.
class Solution {
public:
typedef pair<int, int> ii;
long long maxTaxiEarnings(int n, vector<vector<int>>& rides) {
long res = 0;
vector<vector<ii>> g(n+1);
for(auto &v: rides){
g[v[1]].push_back({v[0], v[1] - v[0] + v[2]});
}
vector<long> dp(n+1);
for(int i = 1; i <= n; ++i){
for(auto &[u, cost]: g[i]){
dp[i] = max(dp[u] + cost, dp[i]);
}
dp[i] = max(dp[i], dp[i-1]);
}
return dp.back();
}
};
|
97ce111d5f48155c3e71b8ad4cd277d90249f88f
|
35dd668ff26a3dd7cd6b33643e7cb30f984c848a
|
/pe5constexpr.cc
|
a9e7ab02166b5e6c16bcdcb273bef1b46912cb6d
|
[] |
no_license
|
akihiro4chawon/pe-meta
|
61b7223d750aed69b4e062abd76d76c57ac2ed77
|
be7b567659cd36a3ecfd862f466986b05a6b5b09
|
refs/heads/master
| 2016-09-11T01:55:24.427381
| 2011-07-08T12:35:30
| 2011-07-08T12:35:30
| 1,959,934
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 430
|
cc
|
pe5constexpr.cc
|
constexpr int gcd(int a, int b)
{
return a % b == 0 ? b : gcd(b, a % b);
}
constexpr int lcm(int a, int b)
{
return a / gcd(a, b) * b;
}
constexpr int fold_range_by(int beg, int end, int seed, int reducer(int, int))
{
return beg < end ? fold_range_by(beg + 1, end, reducer(seed, beg), reducer) : seed;
}
int main()
{
constexpr int answer = fold_range_by(1, 20, 1, lcm);
return answer;
}
|
14c7bc2213911a7c74d44c16be076c84458ec327
|
85c3776d1da1917703bc366d467e920c2c9bb714
|
/PSP Class Assingment/2nd/Class Problem 2 Assingment II.cpp
|
cf399c819f5a8d5adedc7799be7df8dfd3cac401
|
[] |
no_license
|
divyshri/MCA-1st-Sem
|
7ebf2612d6a72625dbc9a1ca2447b4f91f35bd29
|
469574b484499e503c8aff65d02cc3777a04c7c7
|
refs/heads/master
| 2022-06-13T09:20:39.111801
| 2020-05-03T19:50:32
| 2020-05-03T19:50:32
| 261,007,026
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 854
|
cpp
|
Class Problem 2 Assingment II.cpp
|
/* In a town, percentage of men is 52. the percentage of total literacy is 48.
If total percentage of literate males is 35 of toal percentage of literate men is 35 of total population,
write a program to find the total no. of illetrate men and womens in the town
if the total population is 80000 */
#include<iostream>
using namespace std;
int main()
{
int t,m,il,lm,ilm,ilf;
cout<<"Enter the % males in the town"<<endl;
cin>>m;
cout<<"Enter total % of literate people in the town"<<endl;
cin>>il;
cout<<"Enter the % of illetrate males in the town"<<endl;
cin>>lm;
m=m*800;
li=li*800;
lm=lm*800;
ilm=m-lm;
ilf=il-ilm;
cout<<"Total no. of illetrate male in the town "<<ilm<<endl;
cout<<"Total no. of illetrate felmale in the town "<<ilf<<endl;
t=80000-(ilm+ilf);
cout<<"Total no. of litetrate people in the town "<<ilf<<endl;
return 0;
}
|
fb82285b5b99428ae66f172608269b02972d40eb
|
86bfaa0a4fb197b34410f9bd7066cd9d3ce14205
|
/Test1/Node.h
|
39513ec17ebfc572af80bf51d93865b2a6e90067
|
[] |
no_license
|
proflyy/-
|
b7522ba8fa4f6dc5f6c356310739be5b038f15a7
|
45ff92207ba35a108fa8d200dd583ec74d2319b3
|
refs/heads/master
| 2021-01-10T04:40:51.067511
| 2015-12-20T13:27:42
| 2015-12-20T13:27:42
| 47,620,397
| 1
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 699
|
h
|
Node.h
|
#pragma once
class Node
{
public:
CString time; //游览时间
CString longitude; //经度
CString latitude; //纬度
CString Location; //地点
Node *next;
CString filePF; //文件地址
CString fileName;
Node(){}
Node(CString fileName, CString filePF, double lng, double lat, CString time, CString Location) : fileName(fileName), filePF(filePF), time(time), Location(Location) {
longitude.Format("%f", lng);
latitude.Format("%f", lat);
}
~Node() {}
// Node *preNode();
Node *nextNode();
BOOL NodeInfo();
BOOL addNode(CString fileName);
BOOL delNode(CString fileName);
//bool operator< (const Node &a) const;
friend bool sort_by_time (const Node &a, const Node &b);
};
|
ee76aa949ea997fea27c8983e8ceb901ffbd8ed5
|
eab52ab8828d73e4337ba911629d10f3f5497130
|
/Source/SpaceInvaders/DefenderProjectile.cpp
|
37f76063f35f18690fa95c11b58d0f72b353fb87
|
[] |
no_license
|
Micadurp/SpaceInvaders2
|
f5150c4177414c85eec88f66e8f583834ec78ec6
|
1112c7cf5600305a004105b6752b5d1f379bbde0
|
refs/heads/master
| 2020-06-15T12:48:08.316799
| 2019-07-14T16:17:25
| 2019-07-14T16:30:33
| 195,303,411
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 700
|
cpp
|
DefenderProjectile.cpp
|
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserve
#include "DefenderProjectile.h"
#include "GameFramework/ProjectileMovementComponent.h"
#include "UObject/ConstructorHelpers.h"
#include "Components/StaticMeshComponent.h"
#include "GameFramework/ProjectileMovementComponent.h"
#include "Engine/StaticMesh.h"
#include "InvaderShip.h"
ADefenderProjectile::ADefenderProjectile()
{
// Static reference to the mesh to use for the projectile
static ConstructorHelpers::FObjectFinder<UStaticMesh> ProjectileMeshAsset(TEXT("/Game/3D_Icons/Rocket.Rocket"));
ProjectileMesh->SetStaticMesh(ProjectileMeshAsset.Object);
ProjectileMesh->BodyInstance.SetCollisionProfileName("FriendlyProjectile");
}
|
a4cd1d3b08ed4d1bb098ab370bb137c9888de43d
|
ad7491c035d7c5b46e6d358b9010c406a773a158
|
/lib/lab03/src/lifo.cpp
|
6d44eb9e5b37dc43046efdc3c34f6cdd69396dfa
|
[] |
no_license
|
dahmedk1999/cmpe126s20_labs
|
6ef7d9bffed87153709317e370816546473160b6
|
60b0ecb476a08e40565d6a5457af010ed9ebd666
|
refs/heads/master
| 2023-01-24T09:55:10.998611
| 2020-12-07T20:01:58
| 2020-12-07T20:01:58
| 319,430,399
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,708
|
cpp
|
lifo.cpp
|
#include "lifo.h"
namespace lab3
{
lifo::lifo()
{
index = 0;
lifo_storage.reserve(100);
}
lifo::lifo(std::string input_string) {
index=0;
lifo_storage.reserve(100);
lifo_storage[0] = input_string;
index++;
}
lifo::lifo(const lifo &original)
{
index = original.index;
lifo_storage.operator=(original.lifo_storage);
}
lifo::~lifo()
{
index = -1;
}
lifo &lifo::operator=(const lifo &right)
{
if(&right==this)
return*this;
index = right.index;
lifo_storage.operator=(right.lifo_storage);
return *this;
}
bool lifo::is_empty() {
return index == 0;
}
int lifo::size() {
return index;
}
std::string lifo::top()
{
if(index > 0){
return lifo_storage[index-1];
}
}
void lifo::push(std::string input)
{
if(index <= 99) {
lifo_storage[index] = input;
index++;
}
}
void lifo::pop() {
if (index > 0)
{
index--;
}
}
}
//last in first out, stack
/*
namespace lab33{
lifo::lifo()
{
lifo_storage.reserve(100);
index=0;//empty, size=0
lifo_storage[0]="\0";
}
lifo::lifo(std::string input_string)
{
lifo_storage.reserve(100);
index=0;
lifo_storage[index]=(input_string);//not empty
index++;
}
lifo::lifo(const lifo &original)
{
index=original.index;
lifo_storage.operator=(original.lifo_storage);
}
lifo::~lifo() {
index=0;
}
lifo &lifo::operator=(const lifo &right) {
//return <#initializer#>;
if(&right==this)
return *this;
lifo newlifo;
newlifo.lifo_storage=right.lifo_storage;
newlifo.index=right.index;
index = newlifo.index;
lifo_storage = newlifo.lifo_storage;
return *this;
}
bool lifo::is_empty()
{
return index == 0 || lifo_storage[0] == "\0";
}
int lifo::size()
{
if(lifo_storage[0]=="\0")
return 0;
else
return index;
}
std::string lifo::top(){
//return std::__cxx11::string();
if (lifo_storage[0]!="\0" && (index>=0 && index<=99))
return lifo_storage[index];
}
void lifo::push(std::string input)
{//empty array
if(index==0 && lifo_storage[0]=="\0")
{
lifo_storage[index]=input;
index++;
//index is 0 still, pushes new value into empty array
}
// else if(index==0)
// {//0th element exists in array, not empty
// index++;
// lifo_storage[index]=input;//index 1 assigned
// }
else if(index>=0 && index<99 )//cant push when full(99)
{
lifo_storage[index]=input;
index++;
}
else
{
//throw "debug push";
//cant push over 99 or <-1
}
}
void lifo::pop() {
if(index==0)
{
lifo_storage[0]="\0";
//cant pop empty stac
//please push
}
else if(lifo_storage[0]!="\0" && index>=0 && index<=99)//cant pop when index is 0 AND stack is empty
{
//lets say index is 1, it gets nulled, then decremented to 0, above else if block is used next call
// lifo_storage[index] = "\0";
lifo_storage[index]="\0";
index--;//cant use stringvector size and capacity since there is no way to reduce length/size
}
}
}
*/
|
6bd8149c7f020d274e88948b12aa0ae2ac56ec06
|
541bb0bfba9dc8839cfdc56d4a8ccb26fccfc17c
|
/Prova Final/Questão 1/FuncaoSegundoGrau.cpp
|
c787e9bcbc878d3f679483e403db0e9ad092db8c
|
[] |
no_license
|
GeovaniSantosHub/Learning_C-
|
3182e8afb093fb7562e72acc0b28e5aa43482f03
|
ffbec50136398591874b66f09394ed2a5f46a7a9
|
refs/heads/main
| 2023-08-26T03:21:28.712328
| 2021-10-29T14:54:19
| 2021-10-29T14:54:19
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,242
|
cpp
|
FuncaoSegundoGrau.cpp
|
#include "FuncaoSegundoGrau.hpp"
FuncaoSegundoGrau::FuncaoSegundoGrau() //contrutor sem parâmetros
{
}
FuncaoSegundoGrau::FuncaoSegundoGrau(double a, double b, double c) //contrutor com parâmetros para os coefiecente a,b e c
{
this->a = a;
this->b = b;
this->c = c;
}
//método que atribui valores aos coeficientes da função do segundo grau
void FuncaoSegundoGrau::setCoeficientes(double coefA, double coefb, double coefC)
{
if (coefA==0)
{
cout<<"Nao eh uma funcao de segundo grau"<<endl;
exit(1);
}
a = coefA;
b = coefb;
c = coefC;
}
//método que retorna o coefiente a
double FuncaoSegundoGrau::get_a()
{
cout<<"coeficente a: "<<a<<endl;
return a;
}
//método que retorna o coefiente b
double FuncaoSegundoGrau::get_b()
{
cout<<"coeficente b: "<<b<<endl;
return b;
}
//método que retorna o coefiente c
double FuncaoSegundoGrau::get_c()
{
cout<<"Coeficente c: "<<c<<endl;
return c;
}
//método que retorna o valor da função de segundo grau 𝑓(𝑥) para o valor de 𝑥 informado como argumento
double FuncaoSegundoGrau::valor(double x)
{
double funcao = a*(pow(x,2)) + b*x + c;
cout<<"f("<<x<<")="<<funcao<<endl;
return funcao;
}
//método que deve retornar o número de raízes reais da equação
double FuncaoSegundoGrau::nRaizes()
{
//double delta = pow(b,2)-(4*a*c);
double part1 = pow(b,2);//primeira parte para o cálculo do delta
double part2 = (4*a*c);//segunda parte para o cálculo do delta
double delta = part1 - part2;//cálculo do delta
cout<<"Numero de raizes: ";
//se delta for maior que 0 a função possui duas raizes reais e distintas
if (delta>0)
{
cout<<"2"<<endl;
}
//se delta for igual a 0 a função possui duas raizes reais e iguais
else if(delta==0)
{
cout<<"1"<<endl;
}
//se delta for menor que 0 a função não possui raízes reais
else
{
cout<<"0"<<endl;
}
return 0;
}
//ponteiro que aponta para o vetor com as raízes da função
double * FuncaoSegundoGrau::raizes()
{
//cálculo do delta
double part1 = pow(b,2);
double part2 = (4*a*c);
double delta = part1 - part2;
double vetor [2];//vetor com dois espaços de memória
double baskara;//armazena o resultado de baskara
if (delta>0)
{
vetor[1]=baskara=((-b+sqrt(delta))/2*a);//calcula a primera raiz
vetor[2]=baskara=((-b-sqrt(delta))/2*a);//calcula a segunda raiz
cout<<"raiz': "<<vetor[1]<<endl<<"raiz'': "<<vetor[2]<<endl;//imprime as raizes
}
else if(delta==0)
{
//calcula as raizes iguais
vetor[1]=baskara=((-b+sqrt(delta))/2*a);
vetor[2]=baskara=((-b-sqrt(delta))/2*a);
cout<<"raiz: "<<vetor[1]<<endl;
}
else
{
//vetor não armazena valores de raiz
cerr<<"Nao possui raiz"<<endl;
vetor[1]==nullptr;
}
return 0;
}
//imprime em tela os valores dos coefientes da função
void FuncaoSegundoGrau::printf()
{
cout<<"coeficente a: "<<a<<endl<<"coeficente b: "<<b<<endl<<"coeficiente c: "<<c<<endl;
}
|
329848efe6f0409b6701421553019518451414cc
|
71cc506fa01205134abe03ca6efd62e4ca5299e9
|
/baseline/Slab_solps/Main.cpp
|
251e838cab22f68d379877463148054a66f03bc3
|
[] |
no_license
|
ZRZ2233/SOLPS-algorithm
|
b7bc9b8f137cfea37f9d50eb48d8b70a0dc6b1a2
|
df2bbae6d2729b6e012cf65d0f4bd8eb22d3c519
|
refs/heads/master
| 2023-08-23T00:08:01.490598
| 2021-09-18T05:22:44
| 2021-09-18T05:22:44
| 407,758,583
| 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 7,293
|
cpp
|
Main.cpp
|
#include<iostream>
#include<fstream>
#include"Variable.h"
#include"EquationSolve.h"
#include"SolvingMatrixSet.h"
#include"BoundarySet.h"
#include"ohters.h"
#include<string>
#include"eigen3/Eigen/Eigen"
using namespace Eigen;
using namespace std;
//变量存储矩阵初始值设置
void initialValueSet() {
for (int i = 0; i < nx; i++) {
for (int j = 0; j < ny; j++) {
density[i][j] = 3e18;
density_old[i][j] = 3e18;
velocity_x[i][j] = 0;
velocity_y[i][j] = 0;
velocity_parallel_i[i][j] = 1;
velocity_parallel_i_old[i][j] = 1;
temperature_e[i][j] = 40.0 * electron;
temperature_i[i][j] = 40.0 * electron;
pressure_e[i][j] = density[i][j] * temperature_e[i][j];
pressure_i[i][j] = density[i][j] * temperature_i[i][j];
pressure[i][j] = pressure_e[i][j] + pressure_i[i][j];
}
}
}
//把Ax=b中的所有变量都归零
void setZero() {
for (int i = 0; i < nx * ny; i++) {
a[i] = 0;
b[i] = 0;
c[i] = 0;
d[i] = 0;
e[i] = 0;
x[i] = 0;
source[i] = 0;
}
}
//将计算出的值更新到相应变量存储矩阵中去
void resultUpdate(double* new_result, double(*old_result)[ny]) {
for (int i = 0; i < nx; i++) {
for (int j = 0; j < ny; j++) {
old_result[i][j] = new_result[i * ny + j];
}
}
}
//输出最后结果到文件中
void output(string str, double(*matrix)[ny]) {
ofstream out("C:\\Users\\Admin\\Desktop\\baseline_data\\" + str + ".dat", ios::app);
for (int i = 0; i < nx; i++) {
for (int j = 0; j < ny; j++) {
out << matrix[i][j] << " ";
}
out << endl;
}
out.close();
}
void output1(string str, double(*matrix)[ny]) { //用于温度,自动转换能量为温度
ofstream out("C:\\Users\\Admin\\Desktop\\baseline_data\\" + str + ".dat", ios::app);
for (int i = 0; i < nx; i++) {
for (int j = 0; j < ny; j++) {
out << matrix[i][j] / electron << " ";
}
out << endl;
}
out.close();
}
void output2(string str, double* matrix) {
ofstream out("C:\\Users\\Admin\\Desktop\\baseline_data\\" + str + ".dat", ios::app);
for (int i = 0; i < nx; i++) {
for (int j = 0; j < ny; j++) {
out << matrix[i * ny + j] << "||";
}
out << endl;
}
out.close();
}
//output1("a", a);
//output1("b", b);
//output1("c", c);
//output1("d", d);
//output1("e", e);
//output1("source", source);
//string s = "density";
//s = to_string(i) + s;
//output(s, density);
//output("velocityx", velocity_x);
//output("velocityy", velocity_y);
//output("density", density);
void main() {
//前期工作,初始值设置
initialValueSet();
clock_t start, end;
start = clock();
double time = 0;
int count = 1;
//收敛判断
double num_convergence = 1e-3;
double num_int = 3;
bool convergence = true;
double A, B, C, D; //四个值保存均方根
double A_old = 1, B_old = 1, C_old = 1, D_old = 1;
//residual保存
ofstream outnew("C:\\Users\\Admin\\Desktop\\baseline_data\\residual.dat", ios::app);
do {
cout << "baseline计算时间:" << time << "s" << endl;
//连续性方程求解密度////////////////////////////////////////////////////////////////
{
setZero(); //把Ax=b中的所有变量都归零
ContinuityMatrixRenew(); //求解区矩阵设置
ContinuityMatrixBoundary(); //边界矩阵设置
Eigen_use(); //矩阵求解
resultUpdate(x, density); //将计算出的值更新到相应变量存储矩阵中去
}
VxVy_update(); //利用刚刚计算出来的密度更新Vx、Vy
//离子平行动量方程求解平行速度/////////////////////////////////////////////////////////
{
setZero();
MomentumMatrixRenew();
MomentumMatrixBoundary();
Eigen_use();
resultUpdate(x, velocity_parallel_i);
}
VxVy_update();
//电子能量方程,求解电子温度/////////////////////////////////////////////////////////
{
setZero();
ElectronEnergyMatrixRenew();
ElectronEnergyMatrixBoundary();
Eigen_use();
resultUpdate(x, temperature_e);
}
//离子能量方程,求解离子温度///////////////////////////////////////////////////////
{
setZero();
IonEnergyMatrixRenew();
IonEnergyMatrixBoundary();
Eigen_use();
resultUpdate(x, temperature_i);
}
for (int i = 0; i < nx; i++) {
for (int j = 0; j < ny; j++) {
density_old[i][j] = density[i][j];
velocity_parallel_i_old[i][j] = velocity_parallel_i_old[i][j];
}
}
//利用刚刚算出来的温度更新压强//////////////////////////////////////////////////////
for (int i = 0; i < nx; i++) {
for (int j = 0; j < ny; j++) {
pressure_e[i][j] = density[i][j] * temperature_e[i][j];
pressure_i[i][j] = density[i][j] * temperature_i[i][j];
pressure[i][j] = pressure_i[i][j] + pressure_e[i][j];
}
}
//进入下一个时间步
time += delta_t;
//收敛判断
A = 0, B = 0, C = 0, D = 0;
convergence = true;
for (int i = 0; i < nx; i++) {
for (int j = 0; j < ny; j++) {
A += pow(density[i][j], 2.0);
B += pow(velocity_parallel_i[i][j], 2.0);
C += pow(temperature_e[i][j], 2.0);
D += pow(temperature_i[i][j], 2.0);
}
}
A = pow(A / (nx * ny), 0.5);
B = pow(B / (nx * ny), 0.5);
C = pow(C / (nx * ny), 0.5);
D = pow(D / (nx * ny), 0.5);
outnew << time << " " << fabs(A - A_old) / A_old << " " << fabs(B - B_old) / B_old << " " << fabs(C - C_old) / C_old << " " << fabs(D - D_old) / D_old << endl;
if (fabs(A - A_old) / A_old > num_convergence) convergence = false;
if (fabs(B - B_old) / B_old > num_convergence) convergence = false;
if (fabs(C - C_old) / C_old > num_convergence) convergence = false;
if (fabs(D - D_old) / D_old > num_convergence) convergence = false;
if (convergence || time == 0.2691) {
cout << "baseline收敛了" << endl;
end = clock();
double sum_time = (double)(end - start) / CLOCKS_PER_SEC;
string folder = to_string(num_int) + "_" + to_string(time) + "time" + to_string(sum_time);
string command = "mkdir -p C:\\Users\\Admin\\Desktop\\baseline_data\\" + folder;
system(command.c_str());
output(folder + "\\density", density);
output(folder + "\\velocity", velocity_parallel_i);
output1(folder + "\\e_temperature", temperature_e);
output1(folder + "\\i_temperature", temperature_i);
output(folder + "\\pressure_e", pressure_e);
output(folder + "\\pressure_i", pressure_i);
output(folder + "\\pressure", pressure);
output(folder + "\\v_x", velocity_x);
output(folder + "\\x_y", velocity_y);
num_convergence = num_convergence / 10.0;
num_int++;
}
A_old = A;
B_old = B;
C_old = C;
D_old = D;
} while (time < end_time);
outnew.close();
//将能量转换为温度
for (int i = 0; i < nx; i++) {
for (int j = 0; j < ny; j++) {
temperature_e[i][j] = temperature_e[i][j] / electron;
temperature_i[i][j] = temperature_i[i][j] / electron;
}
}
//输出最后结果到文件中
output("density", density);
output("velocity", velocity_parallel_i);
output("e_temperature", temperature_e);
output("i_temperature", temperature_i);
output("pressure_e", pressure_e);
output("pressure_i", pressure_i);
output("pressure", pressure);
}
|
4ff6b7196a3baede7a697541c9e769b72250e133
|
51abcb483d5ec37e9ec6583fdc4ab4fcc37c755b
|
/iterator/test_iterator.cc
|
595ed19389a8df378134c64370a41c11ec796639
|
[] |
no_license
|
treasureb/STL-algorithm
|
d3673862148f482aada7e0aa1da7d90839d1bc43
|
9955b8918a023dfa04534e0badce116e1282f4ba
|
refs/heads/master
| 2020-03-21T04:46:02.412271
| 2018-08-18T16:06:04
| 2018-08-18T16:06:04
| 138,126,093
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,402
|
cc
|
test_iterator.cc
|
#include<iostream>
#include<vector>
#include<list>
using namespace std;
/*
* 迭代器失效的几种情况
* 1.关联式容器(vector)
* a)当进行扩容操作时,所有迭代器都会失效
* b)当进行erase(iterator)时,会时当前节点的迭代器失效
* 采用it=erase(it)的操作,保存返回的迭代器
*
* 2.链表
* a)因为erase会返回待删除节点的迭代器,所以可以采用保存
* b)由于每个节点间互不影响,所以可以采用erase(it++),在删除之前进行++
* 3.关联式容器(红黑树)
* a)erase返回void,所以只能采用erase(it++)
*/
int main(){
vector<int> v = {1,2,3,4,5,6,7,8,9};
list<int> l;
l.push_back(1);
l.push_back(2);
l.push_back(3);
l.push_back(4);
l.push_back(4);
l.push_back(5);
l.push_back(6);
list<int>::iterator lt = l.begin();
vector<int>::iterator vt = v.begin();
#ifdef __LIST__
while(lt != l.end()){
if(*lt % 2 == 0)
{
l.erase(lt++);
}
++lt;
}
lt = l.begin();
while(lt != l.end()){
cout<<*lt <<" ";
++lt;
}
#endif
#ifdef __VECTOR__
while(vt != v.end()){
if(*vt % 2 == 0)
{
v.erase(lt++);
}
++vt;
}
vt = v.begin();
while(vt != v.end()){
cout<<*vt<<" ";
}
#endif
return 0;
}
|
1c0894802bf2c19bcfd07566ad4f67a2cd267e06
|
eeddc37897a43a749f1895654fb2fcff4a6c5fa1
|
/game/windows_manager.hpp
|
d5b5161e9b4232e21454569fa065e4d469c2e469
|
[] |
no_license
|
shubarinv/dnCourseWork
|
ace6fc7603f1fa50ce5cae5e12efb899e9290d95
|
b1398bb927807d6861ae98c2d66db0d503be3be3
|
refs/heads/master
| 2022-05-18T06:02:11.801617
| 2020-01-25T06:47:16
| 2020-01-25T06:47:16
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,092
|
hpp
|
windows_manager.hpp
|
#ifndef DNCOURSEWORK_WINDOWS_MANAGER_HPP
#define DNCOURSEWORK_WINDOWS_MANAGER_HPP
#include <SDL_video.h>
#include <SDL_render.h>
#include <string>
#include <SDL_log.h>
#include <stdexcept>
class WindowsManager {
struct twoInt {
int x, y;
};
public:
WindowsManager() {
functionsWindow = SDL_CreateWindow("Functions", 0, 0, 350, 720, SDL_WINDOW_SHOWN);
if (functionsWindow == nullptr) {
std::string error = SDL_GetError();
SDL_LogCritical(SDL_LOG_CATEGORY_ERROR, "%s", error.c_str());
throw std::runtime_error("Unable to create Functions window");
}
graphWindow = SDL_CreateWindow("Graph", 350, 0, 720, 720, SDL_WINDOW_SHOWN);
if (graphWindow == nullptr) {
std::string error = SDL_GetError();
SDL_LogCritical(SDL_LOG_CATEGORY_ERROR, "%s", error.c_str());
throw std::runtime_error("Unable to create Graph window");
}
functionsWinRender = SDL_CreateRenderer(functionsWindow, -1, 0);
if (functionsWinRender == nullptr) {
SDL_DestroyWindow(functionsWindow);
std::string error = SDL_GetError();
SDL_LogCritical(SDL_LOG_CATEGORY_ERROR, "%s", error.c_str());
throw std::runtime_error("Unable to create Functions render");
}
graphWinRender = SDL_CreateRenderer(graphWindow, -1, 0);
if (graphWinRender == nullptr) {
SDL_DestroyWindow(graphWindow);
std::string error = SDL_GetError();
SDL_LogCritical(SDL_LOG_CATEGORY_ERROR, "%s", error.c_str());
throw std::runtime_error("Unable to create Graph render");
}
}
[[nodiscard]] SDL_Window *getFunctionsWindow() const {
return functionsWindow;
}
[[nodiscard]] SDL_Window *getGraphWindow() const {
return graphWindow;
}
[[nodiscard]] SDL_Renderer *getFunctionsWinRender() const {
return functionsWinRender;
}
[[nodiscard]] SDL_Renderer *getGraphWinRender() const {
return graphWinRender;
}
static twoInt getWindowSize(SDL_Window *window) {
twoInt winSize{};
SDL_GetWindowSize(window, &winSize.x, &winSize.y);
return winSize;
}
void clearRenderer(SDL_Renderer *ren) {
if (SDL_RenderClear(ren) < 0) {
SDL_DestroyWindow(graphWindow);
SDL_DestroyWindow(functionsWindow);
std::string error = SDL_GetError();
SDL_LogCritical(SDL_LOG_CATEGORY_ERROR, "%s", error.c_str());
throw std::runtime_error("Unable to clear render (SDL2)");
}
}
SDL_Window *getFocusedWindow() {
if (SDL_GetWindowFlags(functionsWindow) & SDL_WINDOW_MOUSE_FOCUS)return functionsWindow;
if (SDL_GetWindowFlags(graphWindow) & SDL_WINDOW_MOUSE_FOCUS)return graphWindow;
return nullptr;
}
private:
SDL_Window *functionsWindow{};
SDL_Window *graphWindow{};
SDL_Renderer *functionsWinRender{};
SDL_Renderer *graphWinRender{};
};
#endif //DNCOURSEWORK_WINDOWS_MANAGER_HPP
|
e45aee6162e0279f6f500ab03d1c01e09f173f1b
|
544a6eb07d5a5ffd6c0f5d99ede6d05a4795781b
|
/Lab2/2_simple_calculator/Calc/CalcLexer.h
|
4e1bc6512725a64f023ff4b5062ddf80c083a479
|
[] |
no_license
|
QuimMarset/CL
|
055e36eff47d192e1774ac7b75460398f657d2a5
|
4b6d7234201e2b0331170a369665531faf501427
|
refs/heads/master
| 2023-05-27T04:52:48.639815
| 2018-08-02T14:36:37
| 2018-08-02T14:36:37
| 124,888,373
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,912
|
h
|
CalcLexer.h
|
// Generated from Calc.g4 by ANTLR 4.7.1
#pragma once
#include "antlr4-runtime.h"
class CalcLexer : public antlr4::Lexer {
public:
enum {
T__0 = 1, MUL = 2, ADD = 3, SUB = 4, DIV = 5, LPAR = 6, RPAR = 7, QMARK = 8,
DOUBLE = 9, IF = 10, ENDIF = 11, THEN = 12, ELSE = 13, WHILE = 14, LKEY = 15,
RKEY = 16, MAXFUN = 17, COMMA = 18, AND = 19, OR = 20, NOT = 21, GT = 22,
LT = 23, EQ = 24, NEQ = 25, GET = 26, LET = 27, ID = 28, INT = 29, NEWLINE = 30,
WS = 31
};
CalcLexer(antlr4::CharStream *input);
~CalcLexer();
virtual std::string getGrammarFileName() const override;
virtual const std::vector<std::string>& getRuleNames() const override;
virtual const std::vector<std::string>& getChannelNames() const override;
virtual const std::vector<std::string>& getModeNames() const override;
virtual const std::vector<std::string>& getTokenNames() const override; // deprecated, use vocabulary instead
virtual antlr4::dfa::Vocabulary& getVocabulary() const override;
virtual const std::vector<uint16_t> getSerializedATN() const override;
virtual const antlr4::atn::ATN& getATN() const override;
private:
static std::vector<antlr4::dfa::DFA> _decisionToDFA;
static antlr4::atn::PredictionContextCache _sharedContextCache;
static std::vector<std::string> _ruleNames;
static std::vector<std::string> _tokenNames;
static std::vector<std::string> _channelNames;
static std::vector<std::string> _modeNames;
static std::vector<std::string> _literalNames;
static std::vector<std::string> _symbolicNames;
static antlr4::dfa::Vocabulary _vocabulary;
static antlr4::atn::ATN _atn;
static std::vector<uint16_t> _serializedATN;
// Individual action functions triggered by action() above.
// Individual semantic predicate functions triggered by sempred() above.
struct Initializer {
Initializer();
};
static Initializer _init;
};
|
dbfea03e616c5e8e7c069cc113047fa8477b30ab
|
3e9b78ece7653e78e5144e779cae3817d3daa152
|
/3fd/isam/isam_impl_session.cpp
|
8fae20087a1966efe59fd198423bd6712475db46
|
[
"MS-PL"
] |
permissive
|
faburaya/3fd
|
887ba5e3086711c5bed0c36dfe0830d6ea01ff06
|
cde5d33a2e22dc6a02423334b0a8b766348cb296
|
refs/heads/master
| 2022-07-22T00:30:39.812229
| 2021-05-13T14:29:48
| 2022-07-08T23:49:48
| 36,586,691
| 35
| 5
| null | 2015-09-11T20:23:21
| 2015-05-31T03:45:51
|
C
|
UTF-8
|
C++
| false
| false
| 6,896
|
cpp
|
isam_impl_session.cpp
|
#include "pch.h"
#include "isam_impl.h"
#include <codecvt>
namespace _3fd
{
namespace isam
{
///////////////////////////
// Session Class
///////////////////////////
/// <summary>
/// Finalizes an instance of the <see cref="SessionImpl"/> class.
/// </summary>
SessionImpl::~SessionImpl()
{
if (m_jetSession != NULL) // if the object was not moved
{
CALL_STACK_TRACE;
auto rcode = JetEndSession(m_jetSession, 0);
ErrorHelper::LogError(NULL, m_jetSession, rcode, "Failed to finalize ISAM storage session", core::Logger::PRIO_ERROR);
}
}
/// <summary>
/// Attaches the database to the instance.
/// </summary>
/// <param name="dbFileName">Full name of the database file.</param>
/// <param name="throwNotFound">if set to <c>true</c>, the method will not throw an exception when the database file was not found.</param>
/// <returns>Whether the database file was found and successfully attached to the instance.</returns>
bool SessionImpl::AttachDatabase(const wstring &dbFileName, bool throwNotFound)
{
CALL_STACK_TRACE;
#ifndef _3FD_PLATFORM_WINRT
auto rcode = JetAttachDatabaseW(m_jetSession, dbFileName.c_str(), 0);
#else
auto rcode = JetAttachDatabase2W(m_jetSession, dbFileName.c_str(), 0, 0);
#endif
if (throwNotFound == false && rcode == JET_errFileNotFound)
return STATUS_FAIL;
ErrorHelper::HandleError(NULL, m_jetSession, rcode, [&dbFileName]()
{
std::ostringstream oss;
std::wstring_convert<std::codecvt_utf8<wchar_t>> transcoder;
auto utf8DbFullFileName = transcoder.to_bytes(dbFileName);
oss << "Failed to attach database \'" << utf8DbFullFileName << "\' to ISAM instance";
return oss.str();
});
return STATUS_OKAY;
}
/// <summary>
/// Detaches the database from instance.
/// </summary>
/// <param name="dbFileName">Full name of the database file.</param>
void SessionImpl::DetachDatabase(const wstring &dbFileName)
{
CALL_STACK_TRACE;
#ifndef _3FD_PLATFORM_WINRT
auto rcode = JetDetachDatabaseW(m_jetSession, dbFileName.data());
#else
auto rcode = JetDetachDatabase2W(m_jetSession, dbFileName.data(), 0);
#endif
ErrorHelper::LogError(NULL, m_jetSession, rcode, [&dbFileName]()
{
std::ostringstream oss;
std::wstring_convert<std::codecvt_utf8<wchar_t>> transcoder;
oss << "Failed to detach ISAM database \'" << transcoder.to_bytes(dbFileName.data()) << "\' from session";
return oss.str();
}, core::Logger::PRIO_ERROR); // No exceptions are thrown, because detachment is called by destructors
}
/// <summary>
/// Creates a new database.
/// </summary>
/// <param name="dbFileName">Name of the database file.</param>
/// <returns>A new ISAM database object.</returns>
DatabaseImpl * SessionImpl::CreateDatabase(const wstring &dbFileName)
{
CALL_STACK_TRACE;
try
{
JET_DBID jetDatabaseId(NULL);
auto rcode = JetCreateDatabase2W(m_jetSession, dbFileName.c_str(), 0, &jetDatabaseId, 0);
ErrorHelper::HandleError(NULL, m_jetSession, rcode, [&dbFileName]()
{
std::ostringstream oss;
std::wstring_convert<std::codecvt_utf8<wchar_t>> transcoder;
auto utf8DbFileName = transcoder.to_bytes(dbFileName);
oss << "Failed to create new ISAM database \'" << utf8DbFileName << "\'";
return oss.str();
});
return dbg_new DatabaseImpl(m_jetSession, jetDatabaseId);
}
catch (core::IAppException &)
{
throw; // just forward exceptions regarding errors known to have been previously handled
}
catch (std::exception &ex)
{
std::ostringstream oss;
oss << "Generic failure when creating new ISAM database: " << ex.what();
throw core::AppException<std::runtime_error>(oss.str());
}
}
/// <summary>
/// Opens an already existent database.
/// </summary>
/// <param name="dbFileName">Name of the database file.</param>
/// <returns>An ISAM database object.</returns>
DatabaseImpl * SessionImpl::OpenDatabase(const wstring &dbFileName)
{
CALL_STACK_TRACE;
try
{
JET_DBID jetDatabase(NULL);
auto rcode = JetOpenDatabaseW(m_jetSession, dbFileName.c_str(), nullptr, &jetDatabase, 0);
ErrorHelper::HandleError(NULL, m_jetSession, rcode, [&dbFileName]()
{
std::ostringstream oss;
std::wstring_convert<std::codecvt_utf8<wchar_t>> transcoder;
auto utf8DbFileName = transcoder.to_bytes(dbFileName);
oss << "Failed to open ISAM database \'" << utf8DbFileName << "\'";
return oss.str();
});
return dbg_new DatabaseImpl(m_jetSession, jetDatabase);
}
catch (core::IAppException &)
{
throw; // just forward exceptions regarding errors known to have been previously handled
}
catch (std::exception &ex)
{
std::ostringstream oss;
oss << "Generic failure when opening ISAM database: " << ex.what();
throw core::AppException<std::runtime_error>(oss.str());
}
}
/// <summary>
/// Creates a transaction.
/// </summary>
/// <returns>A new <see cref="TransactionImpl" /> object.</returns>
TransactionImpl * SessionImpl::CreateTransaction()
{
CALL_STACK_TRACE;
try
{
#ifndef _3FD_PLATFORM_WINRT
auto rcode = JetBeginTransaction(m_jetSession);
#else
auto rcode = JetBeginTransaction3(m_jetSession, 0, 0);
#endif
ErrorHelper::HandleError(NULL, m_jetSession, rcode, "Failed to begin ISAM transaction");
return dbg_new TransactionImpl(m_jetSession);
}
catch (std::exception &ex)
{
std::ostringstream oss;
oss << "Generic failure when beginning ISAM transaction: " << ex.what();
throw core::AppException<std::runtime_error>(oss.str());
}
}
/// <summary>
/// Flushes all transactions previously committed by the current session
/// and that have noy yet been flushed to the transaction log file.
/// </summary>
void SessionImpl::Flush()
{
CALL_STACK_TRACE;
auto rcode = JetCommitTransaction(m_jetSession, JET_bitWaitAllLevel0Commit);
ErrorHelper::HandleError(NULL, m_jetSession, rcode, "Failed to flush outstanding ISAM transactions");
}
}// end namespace isam
}// end namespace _3fd
|
caf61d26b179a24608029f7b21121970cc509d8b
|
e71cf8bc0077df065f7778d19a3be85e4a894776
|
/coderushdiv2_4.cpp
|
0b6268d04a1f1814568613b66d7afdca0fa583e8
|
[] |
no_license
|
NishantRaj/program_files
|
c33ac91523a65dc6a1af7cdc35e6c18e969b10f3
|
934a9f1dcdbc2851c50f36e0f33c4e08d214e2e7
|
refs/heads/master
| 2021-01-21T04:54:46.691639
| 2019-05-11T09:22:25
| 2019-05-11T09:22:25
| 39,347,684
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,126
|
cpp
|
coderushdiv2_4.cpp
|
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define ULL unsigned long long
ULL solve(int a,ULL sum)
{
ULL d = (ULL)sqrt(a*a + 8*a*sum);
d-=a;
return d / (2*a);
}
ULL calculate(ULL a[], ULL t , int sz)
{
ULL total = 0;
for(int i = 0 ; i < sz ; i++)
total += solve(a[i], t);
return total;
}
ULL b_search(ULL a[] , ULL b[], LL t ,int sa, int sc)
{
ULL low = 1 , high = t , mid , lhalf = 0 , rhalf , ma = 0 , m2;
while(low < high)
{
mid = (low + high)>>1;
lhalf = calculate(a,mid,sa);
rhalf = calculate(b,t - mid , sc);
if(lhalf <= rhalf){
low = mid + 1;
ma = max(lhalf , ma);
}
else if(lhalf > rhalf)
high = mid;
}
return ma;
}
int main()
{
int t;
cin>>t;
while(t--)
{
ULL p , n , m ;
cin>>p;
cin>>n>>m;
ULL a[n+9];
for(int i = 0 ; i < n ; i ++)
cin>>a[i];
ULL b[m+9];
for(int i = 0 ; i < m ; i++)
cin>>b[i];
cout<<b_search(a,b,p,n,m)<<endl;
}
return 0;
}
|
0e5a98719a87e475e5ba8911b642598e8050bdf0
|
5831128a4b8a0debfdc00a365f79d25c2866d6cc
|
/Kattis/8queens.cpp
|
52ee1d14d81a3eab546ce95d2ca97b019be18284
|
[] |
no_license
|
yameenjavaid/Online-Judge-Solutions
|
b577717d777075f618f84676f20f08c184248ac8
|
7d8ecc4ffb9a7bfddc0cd7d64646ef92ac8c0322
|
refs/heads/master
| 2022-12-24T12:00:20.187337
| 2020-10-13T19:56:17
| 2020-10-13T19:56:17
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 858
|
cpp
|
8queens.cpp
|
#include <bits/stdc++.h>
using namespace std;
// Eight Queens
char g[11][11];
vector<pair<int, int>> queens;
int main(){
for(int i = 0; i < 8; i++)
for(int j = 0; j < 8; j++){
cin >> g[i][j];
if(g[i][j] == '*')
queens.push_back({i, j});
}
if(queens.size() != 8){
cout << "invalid" << endl;
return 0;
}
bool wr = false;
for(int i = 0; i < queens.size(); i++){
for(int j = i + 1; j < queens.size(); j++)
if(queens[i].first == queens[j].first || queens[i].second == queens[j].second || abs(queens[i].first - queens[j].first) == abs(queens[i].second - queens[j].second)){
wr = true;
break;
}
if(wr)
break;
}
if(wr)
cout << "invalid" << endl;
else
cout << "valid" << endl;
}
|
6355fe9a2608fc4c28642b37a3a2e4a4bd6090ae
|
2c78de0b151238b1c0c26e6a4d1a36c7fa09268c
|
/shared/GCI/impl/MMapWin32/FileForMemImpl.cpp
|
f574a742fb63c4e84534277a901815cc6298a80e
|
[] |
no_license
|
bravesoftdz/realwork
|
05a3b308cef59bed8a9efda4212849c391b4b267
|
19b446ce8ad2adf82ab8ce7988bc003221accad2
|
refs/heads/master
| 2021-06-07T23:57:22.429896
| 2016-11-01T18:30:21
| 2016-11-01T18:30:21
| null | 0
| 0
| null | null | null | null |
WINDOWS-1251
|
C++
| false
| false
| 12,295
|
cpp
|
FileForMemImpl.cpp
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Модуль: "w:/shared/GCI/impl/MMapWin32/FileForMemImpl.cpp"
// генератор файлов реализации C++ (.cpp)
// Generated from UML model, root element: <<Servant::Class>> shared::GCI::MMapWin32::FileForMemImpl
//
//
// Все права принадлежат ООО НПП "Гарант-Сервис".
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "shared/Core/sys/std_inc.h"
#include "shared/GCI/LibHome.h"
#include "shared/GCI/impl/MMapWin32/FileForMemImpl.h"
// by <<friend>> dependencies
#include "shared/GCI/impl/MMapWin32/MemoryImpl.h"
//#UC START# *4972185901BE_CUSTOM_INCLUDES*
#if defined(WIN32) && defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0500)
#include <Windows.h>
#include <WinIoCtl.h>
#endif //WIN32 && _WIN32_WINNT>=0x0500
//#UC END# *4972185901BE_CUSTOM_INCLUDES*
#if defined(WIN32) && defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0500)
namespace GCI {
namespace MMapWin32 {
//#UC START# *4972185901BE*
//#UC END# *4972185901BE*
//////////////////////////////////////////////////////////////////////////////////////////
// constructors and destructor
FileForMemImpl::FileForMemImpl (const char* file_name, unsigned long flags, size_t file_increase, bool ro_mode)
//#UC START# *4971EE25002F_4971EE590147_4972185901BE_BASE_INIT*
: m_ro_mode (ro_mode)
, m_flush_count(GCI::MMap::DEFAULT_FLUSH_COUNT)
, m_flush_timeout(GCI::MMap::DEFAULT_FLUSH_TIMEOUT)
, m_file_increase(file_increase)
//#UC END# *4971EE25002F_4971EE590147_4972185901BE_BASE_INIT*
{
//#UC START# *4971EE25002F_4971EE590147_4972185901BE_BODY*
SYSTEM_INFO sinf;
GetSystemInfo(&sinf);
m_info.name = file_name;
m_info.memory_offset = 0;
m_info.desired_size = 0;
m_info.access = GENERIC_READ;
m_info.creation = OPEN_EXISTING;
m_info.shared_mode = FILE_SHARE_READ;
m_info.granularity = sinf.dwAllocationGranularity;
m_info.flags = flags;
if (!m_ro_mode) {
m_info.access |= GENERIC_WRITE;
m_info.shared_mode |= FILE_SHARE_WRITE | FILE_SHARE_DELETE;
}
this->open_and_map ();
//#UC END# *4971EE25002F_4971EE590147_4972185901BE_BODY*
}
FileForMemImpl::FileForMemImpl (const char* file_name, MMap::LongSize size, unsigned long flags)
//#UC START# *4971EE25002F_4971EE6000BB_4972185901BE_BASE_INIT*
: m_ro_mode (false)
, m_flush_count(GCI::MMap::DEFAULT_FLUSH_COUNT)
, m_flush_timeout(GCI::MMap::DEFAULT_FLUSH_TIMEOUT)
, m_file_increase(0)
//#UC END# *4971EE25002F_4971EE6000BB_4972185901BE_BASE_INIT*
{
//#UC START# *4971EE25002F_4971EE6000BB_4972185901BE_BODY*
SYSTEM_INFO sinf;
GetSystemInfo(&sinf);
m_info.name = file_name;
m_info.memory_offset = 0;
m_info.desired_size = size;
m_info.access = GENERIC_READ | GENERIC_WRITE;
m_info.creation = OPEN_ALWAYS;
m_info.flags = flags;
m_info.shared_mode = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
m_info.granularity = sinf.dwAllocationGranularity;
this->open_and_map ();
//#UC END# *4971EE25002F_4971EE6000BB_4972185901BE_BODY*
}
FileForMemImpl::~FileForMemImpl () {
//#UC START# *4972185901BE_DESTR_BODY*
if (m_map_object_id) {
CloseHandle (m_map_object_id);
}
if (m_info.access & GENERIC_WRITE) {
if(!FlushFileBuffers(m_file)) {
GDS_ASSERT (false && "can't execute FlushFileBuffers");
}
}
if (m_file) {
CloseHandle (m_file);
}
//#UC END# *4972185901BE_DESTR_BODY*
}
//////////////////////////////////////////////////////////////////////////////////////////
// self implementation
// аналог map но для немодифицируемой памяти
const MMap::Memory* FileForMemImpl::map_i (
MMap::LongSize offset
, size_t size
, DWORD access_flags
, size_t& inside_offset
) const /*throw (
MMap::SysError
)*/ {
//#UC START# *49736D9000E4*
inside_offset = offset % m_info.granularity;
offset = offset - offset % m_info.granularity;
offset += m_info.memory_offset;
if(size % m_info.granularity != 0) {
size = size - size % m_info.granularity + m_info.granularity;
}
if(offset + size > m_info.desired_size) {
const_cast<FileForMemImpl*>(this)->resize_file(
offset + size - m_info.desired_size > m_file_increase ? offset + size : m_file_increase + m_info.desired_size
);
}
MemoryImpl_var ret = new MemoryImpl (
offset - m_info.memory_offset
, m_info.name
, size
, m_flush_count
, m_flush_timeout
);
ret->m_map_file = FileForMem::_duplicate (this);
ret->m_view_size = size;
ret->m_base_addr = MapViewOfFileEx (
m_map_object_id
, access_flags
, *(((DWORD*) (void*) &offset) + 1)
, *(((DWORD*) (void*) &offset) + 0)
, (SIZE_T) size
, 0
);
if (ret->m_base_addr == NULL) {
throw MMap::SysError (GetLastError (), m_info.name, std::string ("MapViewOfFileEx"));
}
return ret._retn ();
//#UC END# *49736D9000E4*
}
// увеличивает размер фала (если нужно и можно) и ммапит его
void FileForMemImpl::open_and_map () {
//#UC START# *4972231A0384*
m_file = CreateFileA (
m_info.name.c_str()
, m_info.access
, m_info.shared_mode
, NULL
, m_info.creation
, m_info.flags
, NULL
);
if (m_file == INVALID_HANDLE_VALUE) {
throw MMap::SysError (GetLastError (), m_info.name, std::string ("CreateFileA"));
}
LARGE_INTEGER pointer_offset;
pointer_offset.QuadPart = 0;
LARGE_INTEGER real_size;
if (!SetFilePointerEx (m_file, pointer_offset, &real_size, FILE_END)) {
throw MMap::SysError (GetLastError (), m_info.name, std::string ("SetFilePointerEx"));
}
if (m_info.desired_size > (MMap::LongSize) real_size.QuadPart) { // requested size > current size
if (m_ro_mode) {
// try to resize
pointer_offset.QuadPart = m_info.desired_size;
if (!SetFilePointerEx (m_file, pointer_offset, NULL, FILE_BEGIN)) {
throw MMap::SysError (GetLastError (), m_info.name, std::string ("SetFilePointerEx (2)"));
}
} else {
// try to resize
pointer_offset.QuadPart = m_info.desired_size;
if (!SetFilePointerEx (m_file, pointer_offset, NULL, FILE_BEGIN)) {
throw MMap::SysError (GetLastError (), m_info.name, std::string ("SetFilePointerEx (2)"));
}
if (!SetEndOfFile (m_file)) {
throw MMap::SysError (GetLastError (), m_info.name, std::string ("SetEndOfFile"));
}
}
} else {
m_info.desired_size = (MMap::LongSize) real_size.QuadPart;
}
DWORD protect;
if (m_ro_mode) {
protect = PAGE_READONLY;
} else {
protect = PAGE_READWRITE;
}
m_map_object_id = CreateFileMapping (m_file, NULL, protect, 0, 0, NULL);
if (m_map_object_id == NULL) {
throw MMap::SysError (GetLastError (), m_info.name, std::string ("CreateFileMapping"));
}
//#UC END# *4972231A0384*
}
//////////////////////////////////////////////////////////////////////////////////////////
// self data accessors
unsigned long FileForMemImpl::get_flush_count () const {
//#UC START# *49EC8CE301EC_GET_ACCESSOR*
return m_flush_count;
//#UC END# *49EC8CE301EC_GET_ACCESSOR*
}
void FileForMemImpl::set_flush_count (unsigned long flush_count) {
//#UC START# *49EC8CE301EC_SET_ACCESSOR*
m_flush_count = flush_count;
//#UC END# *49EC8CE301EC_SET_ACCESSOR*
}
unsigned long FileForMemImpl::get_flush_timeout () const {
//#UC START# *49EC8D2502EC_GET_ACCESSOR*
return m_flush_timeout;
//#UC END# *49EC8D2502EC_GET_ACCESSOR*
}
void FileForMemImpl::set_flush_timeout (unsigned long flush_timeout) {
//#UC START# *49EC8D2502EC_SET_ACCESSOR*
m_flush_timeout = flush_timeout;
//#UC END# *49EC8D2502EC_SET_ACCESSOR*
}
//////////////////////////////////////////////////////////////////////////////////////////
// implemented interface's methods
// implemented method from MMap::FileForMem
// Дескриптор файла
const ACE_HANDLE FileForMemImpl::get_file_handle () const {
//#UC START# *4A1FD1D8016D_4972185901BE_GET*
return m_file;
//#UC END# *4A1FD1D8016D_4972185901BE_GET*
}
// implemented method from MMap::FileForMem
// Возвращает имя файла
const std::string& FileForMemImpl::get_file_name () const {
//#UC START# *49DE0304038F_4972185901BE*
return m_info.name;
//#UC END# *49DE0304038F_4972185901BE*
}
// implemented method from MMap::FileForMem
// Возвращает размер файла
MMap::LongSize FileForMemImpl::get_file_size () const {
//#UC START# *49DF35B0022E_4972185901BE*
return m_info.desired_size;
//#UC END# *49DF35B0022E_4972185901BE*
}
// implemented method from MMap::FileForMem
// Логический кусок памяти, соответствующий заданному смещению и размеру. Всегда создается новый
// объект и мапируется в данном мап-файле по указанному смещению. После успешного создания в
// атрибуте base_addr содержит логический адрес смапленной области.
const MMap::Memory* FileForMemImpl::get_memory (MMap::LongSize offset, size_t size, size_t& inside_offset) const {
//#UC START# *497F06DA0136_4972185901BE_GET*
if (m_ro_mode) {
return this->map_i (offset, size, FILE_MAP_READ, inside_offset);
} else {
return this->map_i (offset, size, FILE_MAP_WRITE, inside_offset);
}
//#UC END# *497F06DA0136_4972185901BE_GET*
}
MMap::Memory* FileForMemImpl::get_memory (MMap::LongSize offset, size_t size, size_t& inside_offset) {
return const_cast<MMap::Memory*>(((const FileForMemImpl*)this)->get_memory (offset, size, inside_offset));
}
// implemented method from MMap::FileForMem
// системное смещение памяти - смещение от начала файла начиная с которого будут создаваться
// объекты смапленной памяти (Memory), т.е. именно с это позиции будет отсчитываться их смещение
// указанное при создании.
// Может быть полезно если в начале файла идет какая-то служебная информация не предназначенная для
// обычного мапинга в память или если ее наличие необходимо "скрыть" от последующих алгоритмов .
MMap::LongSize FileForMemImpl::get_memory_offset () const {
//#UC START# *497362E10154_4972185901BE_GET*
return m_info.memory_offset;
//#UC END# *497362E10154_4972185901BE_GET*
}
void FileForMemImpl::set_memory_offset (MMap::LongSize memory_offset) {
//#UC START# *497362E10154_4972185901BE_SET*
if(memory_offset % m_info.granularity != 0) {
memory_offset = memory_offset - memory_offset % m_info.granularity + m_info.granularity;
}
m_info.memory_offset = memory_offset;
//#UC END# *497362E10154_4972185901BE_SET*
}
// implemented method from MMap::FileForMem
// Увеличивает размер файла
void FileForMemImpl::resize_file (MMap::LongSize offset) {
//#UC START# *49E6E56B009E_4972185901BE*
if(!CloseHandle(m_map_object_id)) {
throw MMap::SysError (GetLastError (), m_info.name, std::string ("CloseHandle"));
}
LARGE_INTEGER pointer_offset;
pointer_offset.QuadPart = offset;
if (!SetFilePointerEx (m_file, pointer_offset, NULL, FILE_BEGIN)) {
throw MMap::SysError (GetLastError (), m_info.name, std::string ("SetFilePointerEx (2)"));
}
if (!SetEndOfFile (m_file)) {
throw MMap::SysError (GetLastError (), m_info.name, std::string ("SetEndOfFile"));
}
DWORD protect;
if (m_ro_mode) {
protect = PAGE_READONLY;
} else {
protect = PAGE_READWRITE;
}
m_map_object_id = CreateFileMapping (m_file, NULL, protect, 0, 0, NULL);
if (m_map_object_id == NULL) {
throw MMap::SysError (GetLastError (), m_info.name, std::string ("CreateFileMapping"));
}
m_info.desired_size = offset;
//#UC END# *49E6E56B009E_4972185901BE*
}
void FileForMemImpl::upgrade_rw () {
//#UC START# *4972185901BE_UPDATE_RW*
//#UC END# *4972185901BE_UPDATE_RW*
}
} // namespace MMapWin32
} // namespace GCI
#endif //WIN32 && _WIN32_WINNT>=0x0500
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
3e1e64827cf8cacd38aea81a33137c67cb82676b
|
502e207c832ef269a011e65f564925efa78ffa4f
|
/MicroSTL/MicroSTL/micro_uninitialized.h
|
ca501bdb2f13a8cc2d4b106f5f643563a224a66c
|
[] |
no_license
|
Maxmengt/MicroSTL
|
57b8254d79706183d4a495048e602c66a67ad730
|
23b9124d27f35b0ede07171facfdbe7cfe65d0c4
|
refs/heads/master
| 2021-01-11T19:51:46.397010
| 2017-03-03T13:07:22
| 2017-03-03T13:07:22
| 79,409,450
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,074
|
h
|
micro_uninitialized.h
|
#ifndef _MICRO_UNINITIALIZED_H_
#define _MICRO_UNINITIALIZED_H_
#include "micro_construct.h"
#include "micro_iterator.h"
#include "micro_type_traits.h"
namespace MicroSTL {
template<class InputIterator, class ForwardIterator>
inline ForwardIterator uninitialized_copy(InputIterator first, InputIterator last, ForwardIterator result) {
return __uninitialized_copy(first, last, result, value_type(result));
}
template<class InputIterator, class ForwardIterator, class T>
inline ForwardIterator __uninitialized_copy(InputIterator first, InputIterator last, ForwardIterator result, T*) {
typedef typename __type_traits<T>::is_POD_type is_POD;
return __uninitialized_copy_aux(first, last, result, is_POD());
}
template<class InputIterator, class ForwardIterator>
inline ForwardIterator __uninitialized_copy_aux(InputIterator first, InputIterator last, ForwardIterator result, __true_type) {
return copy(first, last, result);
}
template<class InputIterator, class ForwardIterator>
inline ForwardIterator __uninitialized_copy_aux(InputIterator first, InputIterator last, ForwardIterator result, __false_type) {
ForwardIterator cur = result;
while( first != last ) {
construct(&*cur, *first);
++first;
++cur;
}
return cur;
}
template<class ForwardIterator, class T>
void uninitialized_fill(ForwardIterator first, ForwardIterator last, const T& x) {
__uninitialized_fill(first, last, x, value_type(first));
}
template<class ForwardIterator, class T, class T1>
void __uninitialized_fill(ForwardIterator first, ForwardIterator last, const T& x, T1*) {
typedef typename __type_traits<T1>::is_POD_type is_POD;
__uninitialized_fill_aux(first, last, x, is_POD());
}
template<class ForwardIterator, class T>
void __uninitialized_fill_aux(ForwardIterator first, ForwardIterator last, const T& x, __true_type) {
fill(first, last, x);
}
template<class ForwardIterator, class T>
void __uninitialized_fill_aux(ForwardIterator first, ForwardIterator last, const T& x, __false_type) {
ForwardIterator cur = first;
while( cur != last ) {
construct(&*cur, x);
++cur;
}
}
template<class ForwardIterator, class Size, class T>
ForwardIterator uninitialized_fill_n(ForwardIterator first, Size n, const T& x) {
return __uninitialized_fill_n(first, n, x, value_type(first));
}
template<class ForwardIterator, class Size, class T, class T1>
ForwardIterator __uninitialized_fill_n(ForwardIterator first, Size n, const T& x, T1*) {
typedef typename __type_traits<T1>::is_POD_type is_POD;
return __uninitialized_fill_n_aux(first, n, x, is_POD());
}
template<class ForwardIterator, class Size, class T>
ForwardIterator __uninitialized_fill_n_aux(ForwardIterator first, Size n, const T& x, __true_type) {
return fill_n(first, n, x);
}
template<class ForwardIterator, class Size, class T>
ForwardIterator __uninitialized_fill_n_aux(ForwardIterator first, Size n, const T& x, __false_type) {
while( n > 0 ) {
construct(&*cur, x);
++cur;
--n;
}
return cur;
}
}
#endif // !_MICRO_UNINITIALIZED_H_
|
b0f26a66baec767965c234e2735925a1d334b601
|
73a6c73fa08a4fc7aabcc6bb705d2e71132685b3
|
/src/libs/transaction_common/SignedChangeSetBuilder.cpp
|
aaa8906e48d6daf9b31c25d6e250c41be2ae1aea
|
[
"MIT"
] |
permissive
|
blockspacer/keto
|
2f6ff979a9dc9513943bf9cedb4a302a70a2b66a
|
dbe32916a3bbc92fa0bbcb97d9de493d7ed63fd8
|
refs/heads/master
| 2021-02-15T06:48:08.661393
| 2018-05-22T14:01:34
| 2018-05-22T14:01:34
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,300
|
cpp
|
SignedChangeSetBuilder.cpp
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: SignedChangeSetBuilder.cpp
* Author: ubuntu
*
* Created on March 17, 2018, 5:30 AM
*/
#include "keto/transaction_common/SignedChangeSetBuilder.hpp"
#include "keto/asn1/SerializationHelper.hpp"
#include "keto/crypto/SignatureGenerator.hpp"
#include "keto/crypto/HashGenerator.hpp"
#include "keto/asn1/HashHelper.hpp"
#include "keto/asn1/SignatureHelper.hpp"
namespace keto {
namespace transaction_common {
SignedChangeSetBuilder::SignedChangeSetBuilder() {
this->signedChangedSet = (SignedChangeSet_t*)calloc(1, sizeof *signedChangedSet);
}
SignedChangeSetBuilder::SignedChangeSetBuilder(ChangeSet_t* changeSet) {
this->signedChangedSet = (SignedChangeSet_t*)calloc(1, sizeof *signedChangedSet);
keto::asn1::HashHelper hashHelper(
keto::crypto::HashGenerator().generateHash(
keto::asn1::SerializationHelper<ChangeSet_t>(changeSet,&asn_DEF_ChangeSet).operator std::vector<uint8_t>&()
));
this->signedChangedSet->changeSet = *changeSet;
free(changeSet);
this->signedChangedSet->changeSetHash = hashHelper;
}
SignedChangeSetBuilder::SignedChangeSetBuilder(ChangeSet_t* changeSet,
const keto::crypto::KeyLoader& keyLoader) : keyLoader(keyLoader) {
this->signedChangedSet = (SignedChangeSet_t*)calloc(1, sizeof *signedChangedSet);
keto::asn1::HashHelper hashHelper(
keto::crypto::HashGenerator().generateHash(
keto::asn1::SerializationHelper<ChangeSet_t>(changeSet,&asn_DEF_ChangeSet).operator std::vector<uint8_t>&()
));
this->signedChangedSet->changeSet = *changeSet;
free(changeSet);
this->signedChangedSet->changeSetHash = hashHelper;
}
SignedChangeSetBuilder::~SignedChangeSetBuilder() {
if (signedChangedSet) {
ASN_STRUCT_FREE(asn_DEF_SignedChangeSet, signedChangedSet);
signedChangedSet = NULL;
}
}
SignedChangeSetBuilder& SignedChangeSetBuilder::setChangeSet(ChangeSet_t* changeSet) {
keto::asn1::HashHelper hashHelper(
keto::crypto::HashGenerator().generateHash(
keto::asn1::SerializationHelper<ChangeSet_t>(changeSet,&asn_DEF_ChangeSet).operator std::vector<uint8_t>&()
));
this->signedChangedSet->changeSet = *changeSet;
free(changeSet);
this->signedChangedSet->changeSetHash = hashHelper;
return (*this);
}
SignedChangeSetBuilder& SignedChangeSetBuilder::setKeyLoader(
const keto::crypto::KeyLoader& keyloader) {
this->keyLoader = keyLoader;
return (*this);
}
SignedChangeSetBuilder& SignedChangeSetBuilder::sign() {
keto::crypto::SignatureGenerator generator(this->keyLoader);
keto::asn1::HashHelper hashHelper(this->signedChangedSet->changeSetHash);
keto::asn1::SignatureHelper signatureHelper(generator.sign(hashHelper));
this->signedChangedSet->signature = signatureHelper;
return (*this);
}
SignedChangeSetBuilder::operator SignedChangeSet_t*() {
SignedChangeSet_t* result = this->signedChangedSet;
this->signedChangedSet = 0;
return result;
}
SignedChangeSetBuilder::operator SignedChangeSet_t&() {
return *this->signedChangedSet;
}
}
}
|
4e6ad17bce355d0890f1db2cd56650ad47bae088
|
843136d9f46b9e3bab2eb58bf17e8d4b6c35ef26
|
/2ref.cpp
|
c85d4c4089b018a0dd8fd0e304d3605dfcc9ce4f
|
[] |
no_license
|
corvede/OS
|
b082eab8ec6d9f9862e61ab8023c0f706a622cae
|
5cdbfebb5c673ed449303776699e6644d3edf98e
|
refs/heads/master
| 2021-07-24T07:04:20.309152
| 2017-11-04T13:36:40
| 2017-11-04T13:36:40
| 108,743,673
| 0
| 2
| null | 2017-11-03T17:22:39
| 2017-10-29T14:56:25
|
C++
|
UTF-8
|
C++
| false
| false
| 13,364
|
cpp
|
2ref.cpp
|
#include<iostream>
#include<queue>
#include<iterator>
#include<fstream>
#include<vector>
using namespace std;
//Declaring class to maintain process data
class Process
{
public:
Process()
{
pid = 0; arrival = 0; burst1 = 0; waiting_time = 0;
turnaround_time = 0; first_time_run = true;
}
int pid;
int arrival;
int burst1;
int waiting_time;
int turnaround_time;
bool first_time_run;
};
//Comparison class to make arrival sorted so that top() always smallest
class arrival_compare
{
public:
bool operator() (const Process &a, const Process &b)
{
return a.arrival > b.arrival;
}
};
//Comparison class for SJF and SRTF for process that to be chosen first
class burst_compare
{
public:
bool operator() (const Process &a, const Process &b)
{
if(a.burst1 > b.burst1) return true;
else if(a.burst1 == b.burst1)
if(a.arrival > b.arrival) return true;
else if(a.arrival == b.arrival)
if(a.pid > b.pid) return true;
return false;
}
};
void SJF(ifstream& infile, ofstream& outfile)
{
int number_process;
infile >> number_process;
//Vector to fit in process
priority_queue<Process, vector<Process>, arrival_compare> arriving;
priority_queue<Process, vector<Process>, burst_compare> chart;
vector<Process> io_wait;
//Pushing data into the arriving vector
while(number_process--)
{
Process temp;
infile >> temp;
arriving.push(temp);
}
//Declaring process variable to determine ongoing process
Process ongoing;
//Determine if new process can or cannot be assigned to ongoing
bool lock = false;
//Time unit
int time;
//Time increasing slowly by 1 unit of time
for( time = 0; (!chart.empty() || !io_wait.empty() || !arriving.empty()); ++time)
{
//Pushing process that has arrived
while(!arriving.empty())
{
Process temporary = arriving.top();
if(temporary.arrival <= time)
{
chart.push(temporary);
arriving.pop();
}
else break;
}
//Decreasing IO availability by time
for(vector<Process>::iterator it = io_wait.begin(); it < io_wait.end(); ++it)
{
//Decreasing IO time
--it->context_switch;
//If IO time has finished
if(it->context_switch == 0)
{
//New arrival time value back to chart vector
it->arrival = time + 1;
arriving.push(*it);
io_wait.erase(it);
if(!io_wait.empty()) --it;
}
}
//If the ongoing process before has finished
if(!lock && !chart.empty())
{
//Another process cannot preempt ongoing process
lock = true;
//Taking highest priority process
ongoing = chart.top();
chart.pop();
}
else if(!lock) ongoing = Process();
//Decreasing burst time
--ongoing.burst1;
//If the first and second burst has ended
if( ongoing.burst1 == 0 && ongoing.burst2 == 0)
{
//The process has been completed
outfile << ongoing.pid << ":" << time+1 << endl;
//Let new process get in ongoing
lock = false;
}
//If the first burst has ended
else if (ongoing.burst1 == 0)
{
//Let new process get in ongoing
lock = false;
ongoing.burst1 = ongoing.burst2;
ongoing.burst2 = 0;
io_wait.push_back(ongoing);
}
}
//Print the only remaining process
if(ongoing.burst1 != 0 || ongoing.context_switch != 0 || ongoing.burst2 != 0)
outfile << ongoing.pid << ":" << time+ongoing.burst1+ongoing.context_switch+ongoing.burst2 << endl;
return;
}
void SRTF(ifstream& infile, ofstream& outfile)
{
int number_process;
infile >> number_process;
//Vector to fit in process
priority_queue<Process, vector<Process>, arrival_compare> arriving;
priority_queue<Process, vector<Process>, burst_compare> chart;
vector<Process> io_wait;
//Pushing data into the arriving vector
while(number_process--)
{
Process temp;
infile >> temp;
arriving.push(temp);
}
//Declaring process variable to determine ongoing process
Process ongoing;
//Time unit
int time;
//Time increasing slowly by 1 unit of time
for( time = 0; (!chart.empty() || !io_wait.empty() || !arriving.empty()); ++time)
{
//Pushing process that has arrived
while(!arriving.empty())
{
Process temporary = arriving.top();
if(temporary.arrival <= time)
{
chart.push(temporary);
arriving.pop();
}
else break;
}
//Decreasing IO availability by time
for(vector<Process>::iterator it = io_wait.begin(); it < io_wait.end(); ++it)
{
//Decreasing IO time
--it->context_switch;
//If IO time has finished
if(it->context_switch == 0)
{
//New arrival time value back to chart vector
it->arrival = time + 1;
arriving.push(*it);
io_wait.erase(it);
if(!io_wait.empty()) --it;
}
}
//Taking highest priority process
ongoing = chart.top();
chart.pop();
//Decreasing burst time
--ongoing.burst1;
//If the first and second burst has ended
if( ongoing.burst1 == 0 && ongoing.burst2 == 0 )
{
//The process has been completed
outfile << ongoing.pid << ":" << time+1 << endl;
}
//If the first burst has ended
else if (ongoing.burst1 == 0)
{
ongoing.burst1 = ongoing.burst2;
ongoing.burst2 = 0;
io_wait.push_back(ongoing);
}
//Put the ongoing process back to queue to be sorted again
else chart.push(ongoing);
}
return;
}
void MLQF(ifstream& infile, ofstream& outfile)
{
int number_process;
infile >> number_process;
//Vector to fit in process
priority_queue<Process, vector<Process>, arrival_compare> arriving;
queue<Process> rr_chart, fcfs_chart;
vector<Process> rr_io_wait, fcfs_io_wait;
//Pushing data into the arriving vector
while(number_process--)
{
Process temp;
infile >> temp;
arriving.push(temp);
}
//Declaring process variable to determine ongoing process
enum{rr, fcfs};
int on_status = rr;
Process ongoing;
//Determine if new process can or cannot be assigned to ongoing
bool lock = false;
//Time unit
int time, quantum_time;
//Time increasing slowly by 1 unit of time
for( time = 0, quantum_time = 0; (!fcfs_chart.empty() || !rr_chart.empty() || !fcfs_io_wait.empty() || !rr_io_wait.empty() || !arriving.empty()); ++time, ++quantum_time)
{
//If fcfs, then time quantum is not needed
if(on_status == fcfs) quantum_time = 0;
//Pushing process that has arrived
while(!arriving.empty())
{
Process temporary = arriving.top();
if(temporary.arrival <= time)
{
rr_chart.push(temporary);
arriving.pop();
}
else break;
}
//Pushing IO that has already finished
for(vector<Process>::iterator it = rr_io_wait.begin(); it < rr_io_wait.end(); ++it)
{
//If IO time has finished
if(it->context_switch == 0)
{
//New arrival time value back to chart vector
it->arrival = time;
rr_chart.push(*it);
rr_io_wait.erase(it);
if(!rr_io_wait.empty()) --it;
}
}
for(vector<Process>::iterator it = fcfs_io_wait.begin(); it < fcfs_io_wait.end(); ++it)
{
//If IO time has finished
if(it->context_switch == 0)
{
//New arrival time value back to chart vector
it->arrival = time ;
fcfs_chart.push(*it);
fcfs_io_wait.erase(it);
if(!fcfs_io_wait.empty()) --it;
}
}
//Put the ongoing process back to queue to be queued again
if(on_status == rr && quantum_time == 4)
{
//Let other process to get in ongoing
lock = false;
//Reset quantum time
quantum_time = 0;
//Push all process that have not finish in 4 time unit to fcfs queue
ongoing.arrival = time + 1;
fcfs_chart.push(ongoing);
}
//Decreasing IO availability by time for rr_io_wait
for(vector<Process>::iterator it = rr_io_wait.begin(); it < rr_io_wait.end(); ++it) --it->context_switch;
//Decreasing IO availability by time fcfs_io_wait
for(vector<Process>::iterator it = fcfs_io_wait.begin(); it < fcfs_io_wait.end(); ++it) --it->context_switch;
//If there are higher priority process that could preempt ongoing process
if(on_status == fcfs && !rr_chart.empty())
{
//Quantum time
quantum_time = 0;
//Status
on_status = rr;
//Another process cannot preempt ongoing process
lock = true;
//Push back the fcfs ongoing process
ongoing.arrival = time + 1;
fcfs_chart.push(ongoing);
//Taking highest priority process
ongoing = rr_chart.front();
rr_chart.pop();
}
//If the ongoing process before has finished
else if(!lock && !rr_chart.empty())
{
//Quantum time
quantum_time = 0;
//Status
on_status = rr;
//Another process cannot preempt ongoing process
lock = true;
//Taking highest priority process
ongoing = rr_chart.front();
rr_chart.pop();
}
else if(!lock && !fcfs_chart.empty())
{
//Status
on_status = fcfs;
//Another proces cannot preempt ongoing process except for the one in rr queue
lock = true;
//Taking highest prority process
ongoing = fcfs_chart.front();
fcfs_chart.pop();
}
//If nothing is ongoing, quantum time retains it value zero
else if(!lock)
{
//Status
on_status = rr;
//Quantum time
quantum_time = 0;
ongoing = Process();
}
//Decreasing burst time
--ongoing.burst1;
//If the first and second burst has ended
if( ongoing.burst1 == 0 && ongoing.burst2 == 0 )
{
//status
on_status = rr;
//The process has been completed
outfile << ongoing.pid << ":" << time+1 << endl;
//Let new process in the ongoing
lock = false;
//Quantum time is reseted
quantum_time = 0;
}
//If the first burst has ended
else if (ongoing.burst1 == 0)
{
//Let new process in the ongoing
lock = false;
//Reset quantum time
quantum_time = 0;
//Push it into IO queue
ongoing.burst1 = ongoing.burst2;
ongoing.burst2 = 0;
if(on_status == rr) rr_io_wait.push_back(ongoing);
else fcfs_io_wait.push_back(ongoing);
//Status
on_status = rr;
}
}
//Print the only remaining process
if(ongoing.burst1 != 0 || ongoing.context_switch != 0 || ongoing.burst2 != 0)
outfile << ongoing.pid << ":" << time+ongoing.burst1+ongoing.context_switch+ongoing.burst2 << endl;
return;
}
int main(int argc, char *argv[])
{
//Opening file
ifstream infile;
ofstream outfile;
infile.open("input.txt");
if(!infile.is_open())
{
cerr << "Error opening input file";
return 1;
}
outfile.open("0416106.txt");
int quest_type;
infile >> quest_type;
//Determining the question to be answered
if( quest_type == 1 ) SJF(infile, outfile);
else if( quest_type == 2 ) SRTF(infile, outfile);
else if( quest_type == 3 ) MLQF(infile, outfile);
else cerr << "No such comment can be processed\n";
//Closing file
infile.close();
outfile.close();
return 0;
}
|
b877b24948aaf1a73bb5547c93e4e8b46a6eca3b
|
5bd2afeded6a39311403641533f9a8798582b5c6
|
/codeforces/1174/E.cpp
|
ebd800685cd30170f53eb251ee3ead50efdd5218
|
[] |
no_license
|
ShahjalalShohag/ProblemSolving
|
19109c35fc1a38b7a895dbc4d95cbb89385b895b
|
3df122f13808681506839f81b06d507ae7fc17e0
|
refs/heads/master
| 2023-02-06T09:28:43.118420
| 2019-01-06T11:09:00
| 2020-12-27T14:35:25
| 323,168,270
| 31
| 16
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 6,720
|
cpp
|
E.cpp
|
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpll vector<pll>
#define vpii vector<pii>
#define umap unordered_map
#define uset unordered_set
#define PQ priority_queue
#define printa(a,L,R) for(int i=L;i<R;i++) cout<<a[i]<<(i==R-1?'\n':' ')
#define printv(a) printa(a,0,a.size())
#define print2d(a,r,c) for(int i=0;i<r;i++) for(int j=0;j<c;j++) cout<<a[i][j]<<(j==c-1?'\n':' ')
#define pb push_back
#define eb emplace_back
#define mt make_tuple
#define fbo find_by_order
#define ook order_of_key
#define MP make_pair
#define UB upper_bound
#define LB lower_bound
#define SQ(x) ((x)*(x))
#define issq(x) (((ll)(sqrt((x))))*((ll)(sqrt((x))))==(x))
#define F first
#define S second
#define mem(a,x) memset(a,x,sizeof(a))
#define E 2.71828182845904523536
#define gamma 0.5772156649
#define nl "\n"
#define lg(r,n) (int)(log2(n)/log2(r))
#define sz(v) (int)v.size()
#define pf printf
#define sf scanf
#define sf1(a) scanf("%d",&a)
#define sf2(a,b) scanf("%d %d",&a,&b)
#define sf3(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pf1(a) printf("%d\n",a);
#define pf2(a,b) printf("%d %d\n",a,b)
#define pf3(a,b,c) printf("%d %d %d\n",a,b,c)
#define sf1ll(a) scanf("%lld",&a)
#define sf2ll(a,b) scanf("%I64d %I64d",&a,&b)
#define sf3ll(a,b,c) scanf("%I64d %I64d %I64d",&a,&b,&c)
#define pf1ll(a) printf("%lld\n",a);
#define pf2ll(a,b) printf("%I64d %I64d\n",a,b)
#define pf3ll(a,b,c) printf("%I64d %I64d %I64d\n",a,b,c)
#define _ccase printf("Case %lld: ",++cs)
#define _case cout<<"Case "<<++cs<<": "
#define by(x) [](const auto& a, const auto& b) { return a.x < b.x; }
#define asche cerr<<"Ekhane asche\n";
#define rev(v) reverse(v.begin(),v.end())
#define srt(v) sort(v.begin(),v.end())
#define grtsrt(v) sort(v.begin(),v.end(),greater<ll>())
#define all(v) v.begin(),v.end()
#define mnv(v) *min_element(v.begin(),v.end())
#define mxv(v) *max_element(v.begin(),v.end())
#define toint(a) atoi(a.c_str())
#define BeatMeScanf ios_base::sync_with_stdio(false)
#define valid(tx,ty) (tx>=0&&tx<n&&ty>=0&&ty<m)
#define one(x) __builtin_popcount(x)
#define Unique(v) v.erase(unique(all(v)),v.end())
#define stree l=(n<<1),r=l+1,mid=b+(e-b)/2
#define fout(x) fixed<<setprecision(x)
string tostr(int n) {stringstream rr;rr<<n;return rr.str();}
inline void yes(){cout<<"YES\n";exit(0);}
inline void no(){cout<<"NO\n";exit(0);}
template <typename T> using o_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll dx[]={1,0,-1,0,1,-1,-1,1};
ll dy[]={0,1,0,-1,1,1,-1,-1};
//random_device rd;
//mt19937 rnd(rd());
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); deb(_it, args); }
void deb(istream_iterator<string> it) {}
template<typename T, typename... Args>
void deb(istream_iterator<string> it, T a, Args... args) {
cerr << *it << " = " << a << endl;
deb(++it, args...);
}
const int mod=1e9+7;
const int N=1e6+9;
const ld eps=1e-9;
const ld PI=acos(-1.0);
ll gc(ll a,ll b){while(b){ll x=a%b;a=b;b=x;}return a;}
ll lc(ll a,ll b){return a/gc(a,b)*b;}
ll qpow(ll n,ll k) {ll ans=1;assert(k>=0);n%=mod;while(k>0){if(k&1) ans=(ans*n)%mod;n=(n*n)%mod;k>>=1;}return ans%mod;}
template <int32_t MOD>
struct modint {
int32_t value;
modint() = default;
modint(int32_t value_) : value(value_) {}
inline modint<MOD> operator + (modint<MOD> other) const { int32_t c = this->value + other.value; return modint<MOD>(c >= MOD ? c - MOD : c); }
inline modint<MOD> operator - (modint<MOD> other) const { int32_t c = this->value - other.value; return modint<MOD>(c < 0 ? c + MOD : c); }
inline modint<MOD> operator * (modint<MOD> other) const { int32_t c = (int64_t)this->value * other.value % MOD; return modint<MOD>(c < 0 ? c + MOD : c); }
inline modint<MOD> & operator += (modint<MOD> other) { this->value += other.value; if (this->value >= MOD) this->value -= MOD; return *this; }
inline modint<MOD> & operator -= (modint<MOD> other) { this->value -= other.value; if (this->value < 0) this->value += MOD; return *this; }
inline modint<MOD> & operator *= (modint<MOD> other) { this->value = (int64_t)this->value * other.value % MOD; if (this->value < 0) this->value += MOD; return *this; }
inline modint<MOD> operator - () const { return modint<MOD>(this->value ? MOD - this->value : 0); }
modint<MOD> pow(uint64_t k) const {
modint<MOD> x = *this, y = 1;
for (; k; k >>= 1) {
if (k & 1) y *= x;
x *= x;
}
return y;
}
modint<MOD> inv() const { return pow(MOD - 2); } // MOD must be a prime
inline modint<MOD> operator / (modint<MOD> other) const { return *this * other.inv(); }
inline modint<MOD> operator /= (modint<MOD> other) { return *this *= other.inv(); }
inline bool operator == (modint<MOD> other) const { return value == other.value; }
inline bool operator != (modint<MOD> other) const { return value != other.value; }
};
template <int32_t MOD> modint<MOD> operator * (int64_t value, modint<MOD> n) { return modint<MOD>(value) * n; }
template <int32_t MOD> modint<MOD> operator * (int32_t value, modint<MOD> n) { return modint<MOD>(value % MOD) * n; }
template <int32_t MOD> ostream & operator << (ostream & out, modint<MOD> n) { return out << n.value; }
modint<mod> dp[N][22][2];
int32_t main()
{
BeatMeScanf;
int i,j,k,n,m;
cin>>n;
int cnt=0;
while((1<<cnt)<=n) cnt++;
--cnt;
dp[1][cnt][0]=1;
if((1<<(cnt-1))*3<=n) dp[1][cnt-1][1]=1;
auto f=[&](int x,int y)
{
int k=y?3:1;
return n/((1<<x)*k);
};
for(i=1;i<n;i++){
for(int x=0;x<=cnt;x++){
for(int y=0;y<=1;y++){
dp[i+1][x][y]+=dp[i][x][y]*(f(x,y)-i);
if(x) dp[i+1][x-1][y]+=dp[i][x][y]*(f(x-1,y)-f(x,y));
if(y) dp[i+1][x][y-1]+=dp[i][x][y]*(f(x,y-1)-f(x,y));
}
}
}
cout<<dp[n][0][0]<<nl;
return 0;
}
///Before submit=>
/// *check for integer overflow,array bounds
/// *check for n=1
|
3d51db5f856c986980237a29c0b93a03c0feea4d
|
73b75f172d8aab076af80213706a7a92bf6af5d6
|
/src/vr/restapi.hpp
|
4a56aaa00ab0fcce61fbb9554f6dcce49f2a0e1d
|
[] |
no_license
|
boolpae/VR_RT_DNN_ITF_DP
|
eb7506b03b974c47c12925ce1e8f94838be16010
|
22f7803146fc161301610d5778094358b95852ff
|
refs/heads/master
| 2020-04-15T16:46:43.077899
| 2019-01-09T11:29:14
| 2019-01-09T11:29:14
| 164,850,281
| 0
| 0
| null | null | null | null |
UHC
|
C++
| false
| false
| 3,561
|
hpp
|
restapi.hpp
|
/**
* @headerfile restapi.hpp "restapi.hpp"
* @file restapi.hpp
* @brief RESP API
* @author Kijeong Khil (kjkhil@itfact.co.kr)
* @date 2016. 07. 08. 17:23:23
* @see
*/
#include <string>
#include <map>
#include <memory>
#include <microhttpd.h>
#include <log4cpp/Category.hh>
#include <boost/noncopyable.hpp>
#include "configuration.hpp"
#ifndef ITFACT_RESTAPI_HPP
#define ITFACT_RESTAPI_HPP
namespace itfact {
namespace vr {
namespace node {
enum HTTP_METHOD
{
HTTP_GET, ///< GET 방식 통신
HTTP_POST, ///< POST 방식 통신
HTTP_PUT, ///< PUT 방식 통신
HTTP_PATCH, ///< PATCH 방식 통신
HTTP_DELETE ///< DELETE 방식 통신
};
class Version : private boost::noncopyable
{
protected: // member
log4cpp::Category *req_logger;
public:
Version(log4cpp::Category *logger) {req_logger = logger;};
virtual int
handleRequest(const char *job_name,
struct MHD_Connection *connection,
const std::string *resource,
const std::string *id,
const enum HTTP_METHOD method,
const char *upload_data,
size_t *upload_data_size,
void **con_cls) = 0;
private:
Version();
};
class RestApi : private boost::noncopyable
{
private: // Member
struct MHD_Daemon *descriptor = NULL;
// std::shared_ptr<struct MHD_Daemon> daemon;
std::string service_name;
const itfact::common::Configuration *config;
std::map<std::string, std::shared_ptr<Version>> versions;
public:
RestApi(const itfact::common::Configuration *server_config, log4cpp::Category *logger);
~RestApi();
int start();
void stop();
static int
request_handler(void *cls,
struct MHD_Connection *connection,
const char *url,
const char *method,
const char *version,
const char *upload_data,
size_t *upload_data_size,
void **con_cls);
std::shared_ptr<Version> getVersion(const std::string &Version) const;
std::shared_ptr<Version> getVersion(const std::string &Version);
std::string getServiceName() const {return service_name;};
std::string getServiceName() {return service_name;};
static bool response(struct MHD_Connection *connection,
const char *body, size_t body_size);
static bool sendBadRequest( struct MHD_Connection *connection,
const std::string &detail_message);
static bool sendNotFound(struct MHD_Connection *connection,
const std::string &detail_message);
static bool sendUnsupportedMethod(struct MHD_Connection *connection,
const std::string &detail_message);
static bool sendInternalServerError( struct MHD_Connection *connection,
const std::string &detail_message);
private:
RestApi();
};
class Request
{
protected:
const char *job_name;
struct MHD_Connection *connection;
const enum HTTP_METHOD method;
log4cpp::Category *logger;
public:
Request(const char *job_name,
struct MHD_Connection *connection,
const enum HTTP_METHOD method,
log4cpp::Category *logger) : method(method) {
this->job_name = job_name;
this->connection = connection;
this->logger = logger;
};
virtual int request(const std::string *id,
const char *upload_data,
size_t *upload_data_size,
void **con_cls) = 0;
static bool equals(const std::string *resource) {return false;};
private:
Request();
};
}
}
}
#endif /* ITFACT_RESTAPI_HPP */
|
91a3158c01343d5de829125df29b412240aa8c42
|
c43bd54274413eccff05ce1f8d785d3015c98dc3
|
/resources/templates/devkit_iothub/device.ino
|
480046ed56f80ac355db8a364944620d3ae623e1
|
[
"MIT"
] |
permissive
|
dilin-MS/vscode-iot-workbench
|
314e743aac8e6c0f86c39828a297eab57b58ec61
|
839a9e91b9cba6bc1b38c08ae7fb44aac17cde72
|
refs/heads/master
| 2020-11-26T20:38:57.913511
| 2020-01-06T00:57:31
| 2020-01-06T00:57:31
| 199,791,057
| 0
| 0
|
MIT
| 2019-07-31T09:26:49
| 2019-07-31T06:11:55
|
TypeScript
|
UTF-8
|
C++
| false
| false
| 865
|
ino
|
device.ino
|
#include "AZ3166WiFi.h"
#include "DevKitMQTTClient.h"
static bool hasWifi = false;
static bool hasIoTHub = false;
void setup() {
// put your setup code here, to run once:
if (WiFi.begin() == WL_CONNECTED)
{
hasWifi = true;
Screen.print(1, "Running...");
if (!DevKitMQTTClient_Init())
{
hasIoTHub = false;
return;
}
hasIoTHub = true;
}
else
{
hasWifi = false;
Screen.print(1, "No Wi-Fi");
}
}
void loop() {
// put your main code here, to run repeatedly:
if (hasIoTHub && hasWifi)
{
char buff[128];
// replace the following line with your data sent to Azure IoTHub
snprintf(buff, 128, "{\"topic\":\"iot\"}");
if (DevKitMQTTClient_SendEvent(buff))
{
Screen.print(1, "Sending...");
}
else
{
Screen.print(1, "Failure...");
}
delay(2000);
}
}
|
793e31112d5bacc41d5428f5983a6af48652d576
|
a129ec4664bc4c33a681154437734fb1ea526810
|
/LTAnalysis/src/Tree.cxx
|
cfb5ae3458170a9c30824f2bb7ab20b37259ec3c
|
[] |
no_license
|
kskovpen/bTag
|
cea14982b3f51f07aa0a0149deaa0884fa14bda2
|
fcea471f812a7782e6ed2fc0e155a04391b0bbbb
|
refs/heads/master
| 2020-04-12T03:15:50.699567
| 2019-01-30T19:03:01
| 2019-01-30T19:03:01
| 26,447,732
| 0
| 2
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 22,325
|
cxx
|
Tree.cxx
|
#include "../include/Tree.h"
LTANA::Tree::Tree(TChain *ch,char *fname,std::string treename)
{
ch = new TChain(treename.c_str());
std::ifstream infile;
infile.open(fname);
std::string ifile = "";
while( getline(infile, ifile) )
{
std::string fnameStr = std::string(ifile);
ch->Add(fnameStr.c_str());
std::cout << "file: " << fnameStr << std::endl;
}
infile.close();
Init(ch);
}
LTANA::Tree::~Tree()
{
if (!fChain) return;
delete fChain->GetCurrentFile();
}
Int_t LTANA::Tree::GetEntry(Long64_t entry)
{
if (!fChain) return 0;
return fChain->GetEntry(entry);
}
Long64_t LTANA::Tree::LoadTree(Long64_t entry)
{
if (!fChain) return -5;
Long64_t centry = fChain->LoadTree(entry);
if (centry < 0) return centry;
if (fChain->GetTreeNumber() != fCurrent) {
fCurrent = fChain->GetTreeNumber();
}
return centry;
}
void LTANA::Tree::registerInputBranches(TChain *tr)
{
tr->SetBranchStatus("*",1);
std::cout << "Successfully initialized input branches" << std::endl;
}
void LTANA::Tree::Init(TChain *tree)
{
if (!tree) return;
fChain = tree;
fCurrent = -1;
fChain->SetBranchAddress("nBitTrigger", &nBitTrigger, &b_nBitTrigger);
fChain->SetBranchAddress("BitTrigger", BitTrigger, &b_BitTrigger);
fChain->SetBranchAddress("Run", &Run, &b_Run);
fChain->SetBranchAddress("Evt", &Evt, &b_Evt);
fChain->SetBranchAddress("LumiBlock", &LumiBlock, &b_LumiBlock);
fChain->SetBranchAddress("pthat", &pthat, &b_pthat);
fChain->SetBranchAddress("mcweight", &mcweight, &b_mcweight);
fChain->SetBranchAddress("nPV", &nPV, &b_nPV);
fChain->SetBranchAddress("PVz", &PVz, &b_PVz);
fChain->SetBranchAddress("PVez", &PVez, &b_PVez);
fChain->SetBranchAddress("GenPVz", &GenPVz, &b_GenPVz);
fChain->SetBranchAddress("nPUtrue", &nPUtrue, &b_nPUtrue);
fChain->SetBranchAddress("nPU", &nPU, &b_nPU);
fChain->SetBranchAddress("PU_bunch", PU_bunch, &b_PU_bunch);
fChain->SetBranchAddress("PU_z", PU_z, &b_PU_z);
fChain->SetBranchAddress("PU_sumpT_low", PU_sumpT_low, &b_PU_sumpT_low);
fChain->SetBranchAddress("PU_sumpT_high", PU_sumpT_high, &b_PU_sumpT_high);
fChain->SetBranchAddress("PU_ntrks_low", PU_ntrks_low, &b_PU_ntrks_low);
fChain->SetBranchAddress("PU_ntrks_high", PU_ntrks_high, &b_PU_ntrks_high);
fChain->SetBranchAddress("ncQuarks", &ncQuarks, &b_ncQuarks);
fChain->SetBranchAddress("cQuark_pT", cQuark_pT, &b_cQuark_pT);
fChain->SetBranchAddress("cQuark_eta", cQuark_eta, &b_cQuark_eta);
fChain->SetBranchAddress("cQuark_phi", cQuark_phi, &b_cQuark_phi);
fChain->SetBranchAddress("cQuark_pdgID", cQuark_pdgID, &b_cQuark_pdgID);
fChain->SetBranchAddress("cQuark_status", cQuark_status, &b_cQuark_status);
fChain->SetBranchAddress("cQuark_fromGSP", cQuark_fromGSP, &b_cQuark_fromGSP);
fChain->SetBranchAddress("nbQuarks", &nbQuarks, &b_nbQuarks);
fChain->SetBranchAddress("bQuark_pT", bQuark_pT, &b_bQuark_pT);
fChain->SetBranchAddress("bQuark_eta", bQuark_eta, &b_bQuark_eta);
fChain->SetBranchAddress("bQuark_phi", bQuark_phi, &b_bQuark_phi);
fChain->SetBranchAddress("bQuark_pdgID", bQuark_pdgID, &b_bQuark_pdgID);
fChain->SetBranchAddress("bQuark_status", bQuark_status, &b_bQuark_status);
fChain->SetBranchAddress("bQuark_fromGSP", bQuark_fromGSP, &b_bQuark_fromGSP);
fChain->SetBranchAddress("nBHadrons", &nBHadrons, &b_nBHadrons);
fChain->SetBranchAddress("BHadron_pT", BHadron_pT, &b_BHadron_pT);
fChain->SetBranchAddress("BHadron_eta", BHadron_eta, &b_BHadron_eta);
fChain->SetBranchAddress("BHadron_phi", BHadron_phi, &b_BHadron_phi);
fChain->SetBranchAddress("BHadron_mass", BHadron_mass, &b_BHadron_mass);
fChain->SetBranchAddress("BHadron_pdgID", BHadron_pdgID, &b_BHadron_pdgID);
fChain->SetBranchAddress("BHadron_mother", BHadron_mother, &b_BHadron_mother);
fChain->SetBranchAddress("BHadron_hasBdaughter", BHadron_hasBdaughter, &b_BHadron_hasBdaughter);
fChain->SetBranchAddress("BHadron_SVx", BHadron_SVx, &b_BHadron_SVx);
fChain->SetBranchAddress("BHadron_SVy", BHadron_SVy, &b_BHadron_SVy);
fChain->SetBranchAddress("BHadron_SVz", BHadron_SVz, &b_BHadron_SVz);
fChain->SetBranchAddress("BHadron_nCharged", BHadron_nCharged, &b_BHadron_nCharged);
fChain->SetBranchAddress("BHadron_DHadron1", BHadron_DHadron1, &b_BHadron_DHadron1);
fChain->SetBranchAddress("BHadron_DHadron2", BHadron_DHadron2, &b_BHadron_DHadron2);
fChain->SetBranchAddress("nDHadrons", &nDHadrons, &b_nDHadrons);
fChain->SetBranchAddress("nDaughters", &nDaughters, &b_nDaughters);
fChain->SetBranchAddress("DHadron_pT", DHadron_pT, &b_DHadron_pT);
fChain->SetBranchAddress("DHadron_eta", DHadron_eta, &b_DHadron_eta);
fChain->SetBranchAddress("DHadron_phi", DHadron_phi, &b_DHadron_phi);
fChain->SetBranchAddress("DHadron_pdgID", DHadron_pdgID, &b_DHadron_pdgID);
fChain->SetBranchAddress("DHadron_mass", DHadron_mass, &b_DHadron_mass);
fChain->SetBranchAddress("DHadron_SVx", DHadron_SVx, &b_DHadron_SVx);
fChain->SetBranchAddress("DHadron_SVy", DHadron_SVy, &b_DHadron_SVy);
fChain->SetBranchAddress("DHadron_SVz", DHadron_SVz, &b_DHadron_SVz);
fChain->SetBranchAddress("DHadron_nDaughters", DHadron_nDaughters, &b_DHadron_nDaughters);
fChain->SetBranchAddress("DHadron_DaughtersPdgID", DHadron_DaughtersPdgID, &b_DHadron_DaughtersPdgID);
fChain->SetBranchAddress("DHadron_nChargedDaughters", DHadron_nChargedDaughters, &b_DHadron_nChargedDaughters);
fChain->SetBranchAddress("DHadron_nCharged", DHadron_nCharged, &b_DHadron_nCharged);
fChain->SetBranchAddress("nGenlep", &nGenlep, &b_nGenlep);
fChain->SetBranchAddress("Genlep_pT", Genlep_pT, &b_Genlep_pT);
fChain->SetBranchAddress("Genlep_eta", Genlep_eta, &b_Genlep_eta);
fChain->SetBranchAddress("Genlep_phi", Genlep_phi, &b_Genlep_phi);
fChain->SetBranchAddress("Genlep_pdgID", Genlep_pdgID, &b_Genlep_pdgID);
fChain->SetBranchAddress("Genlep_status", Genlep_status, &b_Genlep_status);
fChain->SetBranchAddress("Genlep_mother", Genlep_mother, &b_Genlep_mother);
fChain->SetBranchAddress("nGenquark", &nGenquark, &b_nGenquark);
fChain->SetBranchAddress("Genquark_pT", Genquark_pT, &b_Genquark_pT);
fChain->SetBranchAddress("Genquark_eta", Genquark_eta, &b_Genquark_eta);
fChain->SetBranchAddress("Genquark_phi", Genquark_phi, &b_Genquark_phi);
fChain->SetBranchAddress("Genquark_pdgID", Genquark_pdgID, &b_Genquark_pdgID);
fChain->SetBranchAddress("Genquark_mother", Genquark_mother, &b_Genquark_mother);
fChain->SetBranchAddress("nGenPruned", &nGenPruned, &b_nGenPruned);
fChain->SetBranchAddress("GenPruned_pT", GenPruned_pT, &b_GenPruned_pT);
fChain->SetBranchAddress("GenPruned_eta", GenPruned_eta, &b_GenPruned_eta);
fChain->SetBranchAddress("GenPruned_phi", GenPruned_phi, &b_GenPruned_phi);
fChain->SetBranchAddress("GenPruned_mass", GenPruned_mass, &b_GenPruned_mass);
fChain->SetBranchAddress("GenPruned_pdgID", GenPruned_pdgID, &b_GenPruned_pdgID);
fChain->SetBranchAddress("GenPruned_status", GenPruned_status, &b_GenPruned_status);
fChain->SetBranchAddress("GenPruned_mother", GenPruned_mother, &b_GenPruned_mother);
fChain->SetBranchAddress("nGenV0", &nGenV0, &b_nGenV0);
fChain->SetBranchAddress("GenV0_pT", GenV0_pT, &b_GenV0_pT);
fChain->SetBranchAddress("GenV0_eta", GenV0_eta, &b_GenV0_eta);
fChain->SetBranchAddress("GenV0_phi", GenV0_phi, &b_GenV0_phi);
fChain->SetBranchAddress("GenV0_pdgID", GenV0_pdgID, &b_GenV0_pdgID);
fChain->SetBranchAddress("GenV0_SVx", GenV0_SVx, &b_GenV0_SVx);
fChain->SetBranchAddress("GenV0_SVy", GenV0_SVy, &b_GenV0_SVy);
fChain->SetBranchAddress("GenV0_SVz", GenV0_SVz, &b_GenV0_SVz);
fChain->SetBranchAddress("GenV0_nCharged", GenV0_nCharged, &b_GenV0_nCharged);
fChain->SetBranchAddress("nJet", &nJet, &b_nJet);
fChain->SetBranchAddress("Jet_pt", Jet_pt, &b_Jet_pt);
fChain->SetBranchAddress("Jet_genpt", Jet_genpt, &b_Jet_genpt);
fChain->SetBranchAddress("Jet_residual", Jet_residual, &b_Jet_residual);
fChain->SetBranchAddress("Jet_jes", Jet_jes, &b_Jet_jes);
fChain->SetBranchAddress("Jet_eta", Jet_eta, &b_Jet_eta);
fChain->SetBranchAddress("Jet_phi", Jet_phi, &b_Jet_phi);
fChain->SetBranchAddress("Jet_mass", Jet_mass, &b_Jet_mass);
fChain->SetBranchAddress("Jet_ntracks", Jet_ntracks, &b_Jet_ntracks);
fChain->SetBranchAddress("Jet_nseltracks", Jet_nseltracks, &b_Jet_nseltracks);
fChain->SetBranchAddress("Jet_flavour", Jet_flavour, &b_Jet_flavour);
fChain->SetBranchAddress("Jet_nbHadrons", Jet_nbHadrons, &b_Jet_nbHadrons);
fChain->SetBranchAddress("Jet_ncHadrons", Jet_ncHadrons, &b_Jet_ncHadrons);
fChain->SetBranchAddress("Jet_Ip2N", Jet_Ip2N, &b_Jet_Ip2N);
fChain->SetBranchAddress("Jet_Ip2P", Jet_Ip2P, &b_Jet_Ip2P);
fChain->SetBranchAddress("Jet_Ip3N", Jet_Ip3N, &b_Jet_Ip3N);
fChain->SetBranchAddress("Jet_Ip3P", Jet_Ip3P, &b_Jet_Ip3P);
fChain->SetBranchAddress("Jet_ProbaN", Jet_ProbaN, &b_Jet_ProbaN);
fChain->SetBranchAddress("Jet_ProbaP", Jet_ProbaP, &b_Jet_ProbaP);
fChain->SetBranchAddress("Jet_Proba", Jet_Proba, &b_Jet_Proba);
fChain->SetBranchAddress("Jet_BprobN", Jet_BprobN, &b_Jet_BprobN);
fChain->SetBranchAddress("Jet_BprobP", Jet_BprobP, &b_Jet_BprobP);
fChain->SetBranchAddress("Jet_Bprob", Jet_Bprob, &b_Jet_Bprob);
fChain->SetBranchAddress("Jet_SvxN", Jet_SvxN, &b_Jet_SvxN);
fChain->SetBranchAddress("Jet_Svx", Jet_Svx, &b_Jet_Svx);
fChain->SetBranchAddress("Jet_SvxNHP", Jet_SvxNHP, &b_Jet_SvxNHP);
fChain->SetBranchAddress("Jet_SvxHP", Jet_SvxHP, &b_Jet_SvxHP);
fChain->SetBranchAddress("Jet_CombSvxN", Jet_CombSvxN, &b_Jet_CombSvxN);
fChain->SetBranchAddress("Jet_CombSvxP", Jet_CombSvxP, &b_Jet_CombSvxP);
fChain->SetBranchAddress("Jet_CombSvx", Jet_CombSvx, &b_Jet_CombSvx);
fChain->SetBranchAddress("Jet_CombIVF", Jet_CombIVF, &b_Jet_CombIVF);
fChain->SetBranchAddress("Jet_CombIVF_P", Jet_CombIVF_P, &b_Jet_CombIVF_P);
fChain->SetBranchAddress("Jet_CombIVF_N", Jet_CombIVF_N, &b_Jet_CombIVF_N);
fChain->SetBranchAddress("Jet_cMVAv2", Jet_cMVAv2, &b_Jet_cMVAv2);
// fChain->SetBranchAddress("Jet_cMVAv2_P", Jet_cMVAv2_P, &b_Jet_cMVAv2_P);
// fChain->SetBranchAddress("Jet_cMVAv2_N", Jet_cMVAv2_N, &b_Jet_cMVAv2_N);
fChain->SetBranchAddress("Jet_SoftMuN", Jet_SoftMuN, &b_Jet_SoftMuN);
fChain->SetBranchAddress("Jet_SoftMuP", Jet_SoftMuP, &b_Jet_SoftMuP);
fChain->SetBranchAddress("Jet_SoftMu", Jet_SoftMu, &b_Jet_SoftMu);
fChain->SetBranchAddress("Jet_SoftElN", Jet_SoftElN, &b_Jet_SoftElN);
fChain->SetBranchAddress("Jet_SoftElP", Jet_SoftElP, &b_Jet_SoftElP);
fChain->SetBranchAddress("Jet_SoftEl", Jet_SoftEl, &b_Jet_SoftEl);
fChain->SetBranchAddress("Jet_DoubleSV", Jet_DoubleSV, &b_Jet_DoubleSV);
fChain->SetBranchAddress("Jet_hist1", Jet_hist1, &b_Jet_hist1);
fChain->SetBranchAddress("Jet_hist2", Jet_hist2, &b_Jet_hist2);
fChain->SetBranchAddress("Jet_hist3", Jet_hist3, &b_Jet_hist3);
fChain->SetBranchAddress("Jet_histJet", Jet_histJet, &b_Jet_histJet);
fChain->SetBranchAddress("Jet_histSvx", Jet_histSvx, &b_Jet_histSvx);
// fChain->SetBranchAddress("Jet_nFirstTrack", Jet_nFirstTrack, &b_Jet_nFirstTrack);
// fChain->SetBranchAddress("Jet_nLastTrack", Jet_nLastTrack, &b_Jet_nLastTrack);
// fChain->SetBranchAddress("Jet_nFirstSV", Jet_nFirstSV, &b_Jet_nFirstSV);
// fChain->SetBranchAddress("Jet_nLastSV", Jet_nLastSV, &b_Jet_nLastSV);
fChain->SetBranchAddress("Jet_SV_multi", Jet_SV_multi, &b_Jet_SV_multi);
// fChain->SetBranchAddress("Jet_nFirstTrkInc", Jet_nFirstTrkInc, &b_Jet_nFirstTrkInc);
// fChain->SetBranchAddress("Jet_nLastTrkInc", Jet_nLastTrkInc, &b_Jet_nLastTrkInc);
fChain->SetBranchAddress("Jet_nSM", Jet_nSM, &b_Jet_nSM);
fChain->SetBranchAddress("Jet_nFirstSM", Jet_nFirstSM, &b_Jet_nFirstSM);
fChain->SetBranchAddress("Jet_nLastSM", Jet_nLastSM, &b_Jet_nLastSM);
fChain->SetBranchAddress("Jet_nSE", Jet_nSE, &b_Jet_nSE);
fChain->SetBranchAddress("Jet_nFirstSE", Jet_nFirstSE, &b_Jet_nFirstSE);
fChain->SetBranchAddress("Jet_nLastSE", Jet_nLastSE, &b_Jet_nLastSE);
fChain->SetBranchAddress("Jet_looseID", Jet_looseID, &b_Jet_looseID);
fChain->SetBranchAddress("Jet_tightID", Jet_tightID, &b_Jet_tightID);
// fChain->SetBranchAddress("nTrkInc", &nTrkInc, &b_nTrkInc);
// fChain->SetBranchAddress("TrkInc_pt", &TrkInc_pt, &b_TrkInc_pt);
// fChain->SetBranchAddress("TrkInc_eta", &TrkInc_eta, &b_TrkInc_eta);
// fChain->SetBranchAddress("TrkInc_phi", &TrkInc_phi, &b_TrkInc_phi);
// fChain->SetBranchAddress("TrkInc_ptrel", &TrkInc_ptrel, &b_TrkInc_ptrel);
// fChain->SetBranchAddress("TrkInc_IPsig", &TrkInc_IPsig, &b_TrkInc_IPsig);
// fChain->SetBranchAddress("TrkInc_IP", &TrkInc_IP, &b_TrkInc_IP);
fChain->SetBranchAddress("nPFElectron", &nPFElectron, &b_nPFElectron);
fChain->SetBranchAddress("PFElectron_IdxJet", PFElectron_IdxJet, &b_PFElectron_IdxJet);
fChain->SetBranchAddress("PFElectron_pt", PFElectron_pt, &b_PFElectron_pt);
fChain->SetBranchAddress("PFElectron_eta", PFElectron_eta, &b_PFElectron_eta);
fChain->SetBranchAddress("PFElectron_phi", PFElectron_phi, &b_PFElectron_phi);
fChain->SetBranchAddress("PFElectron_ptrel", PFElectron_ptrel, &b_PFElectron_ptrel);
fChain->SetBranchAddress("PFElectron_deltaR", PFElectron_deltaR, &b_PFElectron_deltaR);
fChain->SetBranchAddress("PFElectron_ratio", PFElectron_ratio, &b_PFElectron_ratio);
fChain->SetBranchAddress("PFElectron_ratioRel", PFElectron_ratioRel, &b_PFElectron_ratioRel);
fChain->SetBranchAddress("PFElectron_IP", PFElectron_IP, &b_PFElectron_IP);
fChain->SetBranchAddress("PFElectron_IP2D", PFElectron_IP2D, &b_PFElectron_IP2D);
fChain->SetBranchAddress("nPFMuon", &nPFMuon, &b_nPFMuon);
fChain->SetBranchAddress("PFMuon_IdxJet", PFMuon_IdxJet, &b_PFMuon_IdxJet);
fChain->SetBranchAddress("PFMuon_nMuHit", PFMuon_nMuHit, &b_PFMuon_nMuHit);
fChain->SetBranchAddress("PFMuon_nTkHit", PFMuon_nTkHit, &b_PFMuon_nTkHit);
fChain->SetBranchAddress("PFMuon_nPixHit", PFMuon_nPixHit, &b_PFMuon_nPixHit);
fChain->SetBranchAddress("PFMuon_nOutHit", PFMuon_nOutHit, &b_PFMuon_nOutHit);
fChain->SetBranchAddress("PFMuon_nTkLwM", PFMuon_nTkLwM, &b_PFMuon_nTkLwM);
fChain->SetBranchAddress("PFMuon_nPixLwM", PFMuon_nPixLwM, &b_PFMuon_nPixLwM);
fChain->SetBranchAddress("PFMuon_nMatched", PFMuon_nMatched, &b_PFMuon_nMatched);
fChain->SetBranchAddress("PFMuon_chi2", PFMuon_chi2, &b_PFMuon_chi2);
fChain->SetBranchAddress("PFMuon_chi2Tk", PFMuon_chi2Tk, &b_PFMuon_chi2Tk);
fChain->SetBranchAddress("PFMuon_isGlobal", PFMuon_isGlobal, &b_PFMuon_isGlobal);
fChain->SetBranchAddress("PFMuon_hist", PFMuon_hist, &b_PFMuon_hist);
fChain->SetBranchAddress("PFMuon_pt", PFMuon_pt, &b_PFMuon_pt);
fChain->SetBranchAddress("PFMuon_eta", PFMuon_eta, &b_PFMuon_eta);
fChain->SetBranchAddress("PFMuon_phi", PFMuon_phi, &b_PFMuon_phi);
fChain->SetBranchAddress("PFMuon_ptrel", PFMuon_ptrel, &b_PFMuon_ptrel);
fChain->SetBranchAddress("PFMuon_deltaR", PFMuon_deltaR, &b_PFMuon_deltaR);
fChain->SetBranchAddress("PFMuon_ratio", PFMuon_ratio, &b_PFMuon_ratio);
fChain->SetBranchAddress("PFMuon_ratioRel", PFMuon_ratioRel, &b_PFMuon_ratioRel);
fChain->SetBranchAddress("PFMuon_IP", PFMuon_IP, &b_PFMuon_IP);
fChain->SetBranchAddress("PFMuon_IP2D", PFMuon_IP2D, &b_PFMuon_IP2D);
fChain->SetBranchAddress("PFMuon_dz", PFMuon_dz, &b_PFMuon_dz);
fChain->SetBranchAddress("PFMuon_GoodQuality", PFMuon_GoodQuality, &b_PFMuon_GoodQuality);
// fChain->SetBranchAddress("nSV", &nSV, &b_nSV);
// fChain->SetBranchAddress("SV_x", SV_x, &b_SV_x);
// fChain->SetBranchAddress("SV_y", SV_y, &b_SV_y);
// fChain->SetBranchAddress("SV_z", SV_z, &b_SV_z);
// fChain->SetBranchAddress("SV_ex", SV_ex, &b_SV_ex);
// fChain->SetBranchAddress("SV_ey", SV_ey, &b_SV_ey);
// fChain->SetBranchAddress("SV_ez", SV_ez, &b_SV_ez);
// fChain->SetBranchAddress("SV_chi2", SV_chi2, &b_SV_chi2);
// fChain->SetBranchAddress("SV_ndf", SV_ndf, &b_SV_ndf);
// fChain->SetBranchAddress("SV_flight", SV_flight, &b_SV_flight);
// fChain->SetBranchAddress("SV_flightErr", SV_flightErr, &b_SV_flightErr);
// fChain->SetBranchAddress("SV_deltaR_jet", SV_deltaR_jet, &b_SV_deltaR_jet);
// fChain->SetBranchAddress("SV_deltaR_sum_jet", SV_deltaR_sum_jet, &b_SV_deltaR_sum_jet);
// fChain->SetBranchAddress("SV_deltaR_sum_dir", SV_deltaR_sum_dir, &b_SV_deltaR_sum_dir);
// fChain->SetBranchAddress("SV_vtx_pt", SV_vtx_pt, &b_SV_vtx_pt);
// fChain->SetBranchAddress("SV_flight2D", SV_flight2D, &b_SV_flight2D);
// fChain->SetBranchAddress("SV_flight2DErr", SV_flight2DErr, &b_SV_flight2DErr);
// fChain->SetBranchAddress("SV_totCharge", SV_totCharge, &b_SV_totCharge);
// fChain->SetBranchAddress("SV_vtxDistJetAxis", SV_vtxDistJetAxis, &b_SV_vtxDistJetAxis);
// fChain->SetBranchAddress("SV_nTrk", SV_nTrk, &b_SV_nTrk);
// fChain->SetBranchAddress("SV_mass", SV_mass, &b_SV_mass);
// fChain->SetBranchAddress("SV_vtx_eta", SV_vtx_eta, &b_SV_vtx_eta);
// fChain->SetBranchAddress("SV_vtx_phi", SV_vtx_phi, &b_SV_vtx_phi);
// fChain->SetBranchAddress("SV_EnergyRatio", SV_EnergyRatio, &b_SV_EnergyRatio);
// fChain->SetBranchAddress("SV_dir_x", SV_dir_x, &b_SV_dir_x);
// fChain->SetBranchAddress("SV_dir_y", SV_dir_y, &b_SV_dir_y);
// fChain->SetBranchAddress("SV_dir_z", SV_dir_z, &b_SV_dir_z);
// fChain->SetBranchAddress("Jet_nFirstTrkTagVarCSV", Jet_nFirstTrkTagVarCSV, &b_Jet_nFirstTrkTagVarCSV);
// fChain->SetBranchAddress("Jet_nLastTrkTagVarCSV", Jet_nLastTrkTagVarCSV, &b_Jet_nLastTrkTagVarCSV);
// fChain->SetBranchAddress("Jet_nFirstTrkEtaRelTagVarCSV", Jet_nFirstTrkEtaRelTagVarCSV, &b_Jet_nFirstTrkEtaRelTagVarCSV);
// fChain->SetBranchAddress("Jet_nLastTrkEtaRelTagVarCSV", Jet_nLastTrkEtaRelTagVarCSV, &b_Jet_nLastTrkEtaRelTagVarCSV);
// fChain->SetBranchAddress("TagVarCSV_trackJetPt", TagVarCSV_trackJetPt, &b_TagVarCSV_trackJetPt);
// fChain->SetBranchAddress("TagVarCSV_jetNTracks", TagVarCSV_jetNTracks, &b_TagVarCSV_jetNTracks);
// fChain->SetBranchAddress("TagVarCSV_jetNTracksEtaRel", TagVarCSV_jetNTracksEtaRel, &b_TagVarCSV_jetNTracksEtaRel);
// fChain->SetBranchAddress("TagVarCSV_trackSumJetEtRatio", TagVarCSV_trackSumJetEtRatio, &b_TagVarCSV_trackSumJetEtRatio);
// fChain->SetBranchAddress("TagVarCSV_trackSumJetDeltaR", TagVarCSV_trackSumJetDeltaR, &b_TagVarCSV_trackSumJetDeltaR);
// fChain->SetBranchAddress("TagVarCSV_trackSip2dValAboveCharm", TagVarCSV_trackSip2dValAboveCharm, &b_TagVarCSV_trackSip2dValAboveCharm);
// fChain->SetBranchAddress("TagVarCSV_trackSip2dSigAboveCharm", TagVarCSV_trackSip2dSigAboveCharm, &b_TagVarCSV_trackSip2dSigAboveCharm);
// fChain->SetBranchAddress("TagVarCSV_trackSip3dValAboveCharm", TagVarCSV_trackSip3dValAboveCharm, &b_TagVarCSV_trackSip3dValAboveCharm);
// fChain->SetBranchAddress("TagVarCSV_trackSip3dSigAboveCharm", TagVarCSV_trackSip3dSigAboveCharm, &b_TagVarCSV_trackSip3dSigAboveCharm);
// fChain->SetBranchAddress("TagVarCSV_vertexCategory", TagVarCSV_vertexCategory, &b_TagVarCSV_vertexCategory);
// fChain->SetBranchAddress("TagVarCSV_jetNSecondaryVertices", TagVarCSV_jetNSecondaryVertices, &b_TagVarCSV_jetNSecondaryVertices);
// fChain->SetBranchAddress("TagVarCSV_vertexMass", TagVarCSV_vertexMass, &b_TagVarCSV_vertexMass);
// fChain->SetBranchAddress("TagVarCSV_vertexNTracks", TagVarCSV_vertexNTracks, &b_TagVarCSV_vertexNTracks);
// fChain->SetBranchAddress("TagVarCSV_vertexEnergyRatio", TagVarCSV_vertexEnergyRatio, &b_TagVarCSV_vertexEnergyRatio);
// fChain->SetBranchAddress("TagVarCSV_vertexJetDeltaR", TagVarCSV_vertexJetDeltaR, &b_TagVarCSV_vertexJetDeltaR);
// fChain->SetBranchAddress("TagVarCSV_flightDistance2dVal", TagVarCSV_flightDistance2dVal, &b_TagVarCSV_flightDistance2dVal);
// fChain->SetBranchAddress("TagVarCSV_flightDistance2dSig", TagVarCSV_flightDistance2dSig, &b_TagVarCSV_flightDistance2dSig);
// fChain->SetBranchAddress("TagVarCSV_flightDistance3dVal", TagVarCSV_flightDistance3dVal, &b_TagVarCSV_flightDistance3dVal);
// fChain->SetBranchAddress("TagVarCSV_flightDistance3dSig", TagVarCSV_flightDistance3dSig, &b_TagVarCSV_flightDistance3dSig);
// fChain->SetBranchAddress("nTrkTagVarCSV", &nTrkTagVarCSV, &b_nTrkTagVarCSV);
// fChain->SetBranchAddress("nTrkEtaRelTagVarCSV", &nTrkEtaRelTagVarCSV, &b_nTrkEtaRelTagVarCSV);
// fChain->SetBranchAddress("TagVarCSV_trackMomentum", TagVarCSV_trackMomentum, &b_TagVarCSV_trackMomentum);
// fChain->SetBranchAddress("TagVarCSV_trackEta", TagVarCSV_trackEta, &b_TagVarCSV_trackEta);
// fChain->SetBranchAddress("TagVarCSV_trackPhi", TagVarCSV_trackPhi, &b_TagVarCSV_trackPhi);
// fChain->SetBranchAddress("TagVarCSV_trackPtRel", TagVarCSV_trackPtRel, &b_TagVarCSV_trackPtRel);
// fChain->SetBranchAddress("TagVarCSV_trackPPar", TagVarCSV_trackPPar, &b_TagVarCSV_trackPPar);
// fChain->SetBranchAddress("TagVarCSV_trackDeltaR", TagVarCSV_trackDeltaR, &b_TagVarCSV_trackDeltaR);
// fChain->SetBranchAddress("TagVarCSV_trackPtRatio", TagVarCSV_trackPtRatio, &b_TagVarCSV_trackPtRatio);
// fChain->SetBranchAddress("TagVarCSV_trackPParRatio", TagVarCSV_trackPParRatio, &b_TagVarCSV_trackPParRatio);
// fChain->SetBranchAddress("TagVarCSV_trackSip2dVal", TagVarCSV_trackSip2dVal, &b_TagVarCSV_trackSip2dVal);
// fChain->SetBranchAddress("TagVarCSV_trackSip2dSig", TagVarCSV_trackSip2dSig, &b_TagVarCSV_trackSip2dSig);
// fChain->SetBranchAddress("TagVarCSV_trackSip3dVal", TagVarCSV_trackSip3dVal, &b_TagVarCSV_trackSip3dVal);
// fChain->SetBranchAddress("TagVarCSV_trackSip3dSig", TagVarCSV_trackSip3dSig, &b_TagVarCSV_trackSip3dSig);
// fChain->SetBranchAddress("TagVarCSV_trackDecayLenVal", TagVarCSV_trackDecayLenVal, &b_TagVarCSV_trackDecayLenVal);
// fChain->SetBranchAddress("TagVarCSV_trackDecayLenSig", TagVarCSV_trackDecayLenSig, &b_TagVarCSV_trackDecayLenSig);
// fChain->SetBranchAddress("TagVarCSV_trackJetDistVal", TagVarCSV_trackJetDistVal, &b_TagVarCSV_trackJetDistVal);
// fChain->SetBranchAddress("TagVarCSV_trackJetDistSig", TagVarCSV_trackJetDistSig, &b_TagVarCSV_trackJetDistSig);
// fChain->SetBranchAddress("TagVarCSV_trackEtaRel", TagVarCSV_trackEtaRel, &b_TagVarCSV_trackEtaRel);
}
|
a49dff52908de40a481d4e2752a5deb3f93be0ff
|
391b46772c6a7d0779d85fcbe3f15b76f5201619
|
/CppExamples/CppExamples/10_24_25/Example40_10_24_25.cpp
|
dd7b96791704ea884ea54ca69133c04352ba8487
|
[] |
no_license
|
cicekozkan/CppExamples
|
b750775cccb73b6880152ef4f04b659389e7d910
|
05a8adf902a7e5b02d5f75aab56e7cf33e4601ae
|
refs/heads/master
| 2021-01-20T10:30:37.773845
| 2016-02-10T15:52:50
| 2016-02-10T15:52:50
| 37,305,590
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 510
|
cpp
|
Example40_10_24_25.cpp
|
// read a file content with istream itearators from end to beginning
#include <iterator>
#include <iostream>
#include <list>
#include <fstream>
using namespace std;
int main()
{
ifstream ifs("orhan.txt");
if (!ifs) {
cout << "acilamadi" << endl;
return 1;
}
istream_iterator<int> iter1(ifs);
istream_iterator<int> iter2;
list<int> mylist(iter1, iter2);
cout << "list size = " << mylist.size() << endl;
mylist.reverse();
for (auto &r : mylist)
cout << r << " ";
cout << endl;
return 0;
}
|
c197110615cb1a19b86532fa796545096f9ba136
|
2835a5f331900d237e8b2ff3c8a623876ffdadd0
|
/UVa 10222 - Decode the Mad man.cpp
|
b52185a1b4ae8b4cd280e6f6a4b95d64b4ddc1a8
|
[] |
no_license
|
naimhasan2711/UVa
|
0dd4de942ad285c498a16f14e42399b53746aea0
|
c72c67453ab509c83bc176c047d70375c73a653c
|
refs/heads/master
| 2020-03-19T03:33:38.044474
| 2018-06-01T16:13:24
| 2018-06-01T16:13:24
| 135,738,881
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,016
|
cpp
|
UVa 10222 - Decode the Mad man.cpp
|
#include<bits/stdc++.h>
using namespace std;
#define pf printf
#define sf scanf
#define ei else if
int main()
{
string s;
int l;
while(getline(cin,s))
{
l=s.length();
for(int i=0; i<l; i++)
{
switch(s[i])
{
case ']':
pf("p");
break;
case '[':
pf("o");
break;
case 'p':
case 'P':
pf("i");
break;
case 'o':
case 'O':
pf("u");
break;
case 'i':
case 'I':
pf("y");
break;
case 'u':
case 'U':
pf("t");
break;
case 'y':
case 'Y':
pf("r");
break;
case 't':
case 'T':
pf("e");
break;
case 'r':
case 'R':
pf("w");
break;
case 'e':
case 'E':
pf("q");
break;
case 'w':
case 'W':
pf("w");
break;
case 'q':
case 'Q':
pf("q");
break;
case '"':
pf("l");
break;
case ';':
case ':':
pf("k");
break;
case 'l':
case 'L':
pf("j");
break;
case 'k':
case 'K':
pf("h");
break;
case 'j':
case 'J':
pf("g");
break;
case 'h':
case 'H':
pf("f");
break;
case 'g':
case 'G':
pf("d");
break;
case 'f':
case 'F':
pf("s");
break;
case 'd':
case 'D':
pf("a");
break;
case '/':
case '?':
pf(",");
break;
case '.':
case '>':
pf("m");
break;
case ',':
case '<':
pf("n");
break;
case 'm':
case 'M':
pf("b");
break;
case 'n':
case 'N':
pf("v");
break;
case 'b':
case 'B':
pf("c");
break;
case 'v':
case 'V':
pf("x");
break;
case 'c':
case 'C':
pf("z");
break;
case 'x':
case 'X':
pf("x");
break;
case 'z':
case 'Z':
pf("z");
break;
case '\'':
pf("l");
break;
case '=':
pf("0");
break;
case '-':
pf("9");
break;
case '0':
pf("8");
break;
case '9':
pf("7");
break;
case '8':
pf("6");
break;
case '7':
pf("5");
break;
case '6':
pf("4");
break;
case '5':
pf("3");
break;
case '4':
pf("2");
break;
case '3':
pf("1");
break;
case '2':
pf("`");
break;
default:
pf("%c",s[i]);
}
}
pf("\n");
}
return 0;
}
|
a3073bc0ebd4cf8e7f3fed5558a3981b2ecad1c5
|
3d4f601fee634723f25f739f755bd0aca2b3a489
|
/cf3/solver/actions/Proto/NodeData.hpp
|
82e09f9d07afe7c789d6045aecabf0a7bf8aaa8a
|
[] |
no_license
|
barche/coolfluid3
|
69d8701a840377e83bb46b158300da6d4d8f3bc5
|
688173daa1a7cf32929b43fc1a0d9c0655e20660
|
refs/heads/master
| 2021-07-16T18:09:42.818240
| 2020-08-06T11:55:11
| 2020-08-06T11:55:11
| 2,173,454
| 2
| 7
| null | 2020-09-20T20:57:29
| 2011-08-08T13:37:11
|
C++
|
UTF-8
|
C++
| false
| false
| 12,678
|
hpp
|
NodeData.hpp
|
// Copyright (C) 2010-2011 von Karman Institute for Fluid Dynamics, Belgium
//
// This software is distributed under the terms of the
// GNU Lesser General Public License version 3 (LGPLv3).
// See doc/lgpl.txt and doc/gpl.txt for the license text.
#ifndef cf3_solver_actions_Proto_NodeData_hpp
#define cf3_solver_actions_Proto_NodeData_hpp
#include <boost/fusion/algorithm/iteration/for_each.hpp>
#include <boost/mpl/for_each.hpp>
#include <boost/mpl/range_c.hpp>
#include "common/FindComponents.hpp"
#include "common/PE/Comm.hpp"
#include <common/Core.hpp>
#include "math/VariablesDescriptor.hpp"
#include "mesh/Field.hpp"
#include "mesh/Mesh.hpp"
#include "mesh/Connectivity.hpp"
#include "mesh/Dictionary.hpp"
#include "mesh/Elements.hpp"
#include "mesh/Region.hpp"
#include "mesh/Space.hpp"
#include "FieldSync.hpp"
#include "Transforms.hpp"
/// @file
/// Data associated with node expressions
namespace cf3 {
namespace solver {
namespace actions {
namespace Proto {
/// Extract the coordinates, given a specific region
inline const common::Table<Real>& extract_coordinates(const mesh::Region& region)
{
const common::Table<Real>* coordinates = nullptr;
coordinates = common::find_component_ptr_with_tag<common::Table<Real> >(region, mesh::Tags::coordinates()).get();
if(!coordinates)
{
BOOST_FOREACH(const mesh::Elements& elements, common::find_components_recursively<mesh::Elements>(region))
{
if(coordinates)
{
cf3_assert(coordinates == &elements.geometry_fields().coordinates());
continue;
}
coordinates = &elements.geometry_fields().coordinates();
}
}
return *coordinates;
}
/// Struct keeping track of data associated with numbered variables in node expressions
template<typename T, Uint Dim = 1>
struct NodeVarData
{
/// Stored value type
typedef T ValueT;
/// Return type of the value() method
typedef ValueT& ValueResultT;
NodeVarData(T& var, mesh::Region&) : m_var(var)
{
}
void set_node(const Uint) {}
/// By default, value just returns the supplied value
ValueResultT value()
{
return m_var;
}
private:
T& m_var;
};
/// Helper function to find a field starting from a region
inline mesh::Field& find_field(mesh::Region& region, const std::string& tag)
{
mesh::Mesh& mesh = common::find_parent_component<mesh::Mesh>(region);
Handle<mesh::Dictionary> dict = common::find_component_ptr_with_tag<mesh::Dictionary>(mesh, tag);
if(is_null(dict))
dict = mesh.geometry_fields().handle<mesh::Dictionary>(); // fall back to the geometry if the dict is not found by tag
return common::find_component_with_tag<mesh::Field>(*dict, tag);
}
template<>
struct NodeVarData< ScalarField >
{
static const Uint dimension = 1;
NodeVarData(const ScalarField& placeholder, mesh::Region& region) :
m_field(find_field(region, placeholder.field_tag())),
m_need_synchronization(false)
{
const math::VariablesDescriptor& descriptor = m_field.descriptor();
m_var_begin = descriptor.offset(placeholder.name());
// Variable must be a scalar
cf3_assert(descriptor.size(placeholder.name()) == 1);
offset = descriptor.offset(placeholder.name());
nb_dofs = descriptor.size();
}
~NodeVarData()
{
if(common::PE::Comm::instance().is_active())
{
const Uint my_sync = m_need_synchronization ? 1 : 0;
Uint global_sync = 0;
common::PE::Comm::instance().all_reduce(common::PE::plus(), &my_sync, 1, &global_sync);
if(global_sync != 0)
FieldSynchronizer::instance().insert(m_field, false);
}
}
void set_node(const Uint idx)
{
m_idx = idx;
m_value = m_field[idx][m_var_begin];
}
typedef Real ValueT;
typedef Real ValueResultT;
/// Value is intended to be const, so we return a copy
ValueResultT value() const
{
return m_value;
}
/// Sets value
void set_value(boost::proto::tag::assign, const Real v)
{
m_need_synchronization = true;
m_value = v;
m_field[m_idx][m_var_begin] = m_value;
}
void set_value(boost::proto::tag::plus_assign, const Real v)
{
m_need_synchronization = true;
m_value += v;
m_field[m_idx][m_var_begin] = m_value;
}
void set_value(boost::proto::tag::minus_assign, const Real v)
{
m_need_synchronization = true;
m_value -= v;
m_field[m_idx][m_var_begin] = m_value;
}
void set_value(boost::proto::tag::divides_assign, const Real v)
{
m_need_synchronization = true;
m_value /= v;
m_field[m_idx][m_var_begin] = m_value;
}
/// Offset for the variable in the field
Uint offset;
/// Total nbdofs in the field that this variable is in
Uint nb_dofs;
private:
mesh::Field& m_field;
Uint m_var_begin;
Uint m_idx;
Real m_value;
bool m_need_synchronization;
};
template<Uint Dim>
struct NodeVarData<VectorField, Dim>
{
typedef Eigen::Matrix<Real, Dim, 1> ValueT;
typedef const ValueT& ValueResultT;
static const Uint dimension = Dim;
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
NodeVarData(const VectorField& placeholder, mesh::Region& region) :
m_field( find_field(region, placeholder.field_tag()) ),
m_need_synchronization(false)
{
const math::VariablesDescriptor& descriptor = m_field.descriptor();
m_var_begin = descriptor.offset(placeholder.name());
// Variable must be a vector
cf3_assert(descriptor.size(placeholder.name()) == dimension);
offset = descriptor.offset(placeholder.name());
nb_dofs = descriptor.size();
}
~NodeVarData()
{
if(common::PE::Comm::instance().is_active())
{
const Uint my_sync = m_need_synchronization ? 1 : 0;
Uint global_sync = 0;
common::PE::Comm::instance().all_reduce(common::PE::plus(), &my_sync, 1, &global_sync);
if(global_sync != 0)
FieldSynchronizer::instance().insert(m_field, false);
}
}
void set_node(const Uint idx)
{
m_idx = idx;
for(Uint i = 0; i != Dim; ++i)
m_value[i] = m_field[idx][m_var_begin + i];
}
/// Return a reference to the stored value
ValueResultT value() const
{
return m_value;
}
/// Sets values using a vector-like container
template<typename VectorT>
void set_value(boost::proto::tag::assign, const VectorT& v)
{
m_need_synchronization = true;
m_value = v;
for(Uint i = 0; i != Dim; ++i)
m_field[m_idx][m_var_begin + i] = v[i];
}
template<typename VectorT>
void set_value(boost::proto::tag::plus_assign, const VectorT& v)
{
m_need_synchronization = true;
m_value += v;
for(Uint i = 0; i != Dim; ++i)
m_field[m_idx][m_var_begin + i] += v[i];
}
template<typename VectorT>
void set_value(boost::proto::tag::minus_assign, const VectorT& v)
{
m_need_synchronization = true;
m_value -= v;
for(Uint i = 0; i != Dim; ++i)
m_field[m_idx][m_var_begin + i] -= v[i];
}
void set_value(boost::proto::tag::divides_assign, const Real& v)
{
m_need_synchronization = true;
m_value /= v;
for(Uint i = 0; i != Dim; ++i)
m_field[m_idx][m_var_begin + i] /= v;
}
void set_value_component(boost::proto::tag::assign, const Real& v, const Uint i)
{
m_need_synchronization = true;
m_value[i] = v;
m_field[m_idx][m_var_begin + i] = v;
}
void set_value_component(boost::proto::tag::plus_assign, const Real& v, const Uint i)
{
m_need_synchronization = true;
m_value[i] += v;
m_field[m_idx][m_var_begin + i] += v;
}
void set_value_component(boost::proto::tag::minus_assign, const Real& v, const Uint i)
{
m_need_synchronization = true;
m_value[i] -= v;
m_field[m_idx][m_var_begin + i] -= v;
}
void set_value_component(boost::proto::tag::divides_assign, const Real& v, const Uint i)
{
m_need_synchronization = true;
m_value[i] /= v;
m_field[m_idx][m_var_begin + i] /= v;
}
/// Offset for the variable in the field
Uint offset;
/// Total nb dofs in the field
Uint nb_dofs;
private:
mesh::Field& m_field;
Uint m_var_begin;
ValueT m_value;
Uint m_idx;
bool m_need_synchronization;
};
/// MPL transform operator to wrap a variable in its data type
template<Uint Dim>
struct AddNodeData
{
template<typename VarT, int Dummy=0>
struct apply
{
typedef NodeVarData<VarT>* type;
};
template<int Dummy>
struct apply<VectorField, Dummy>
{
typedef NodeVarData<VectorField, Dim>* type;
};
};
template<typename VariablesT, typename NbDims>
class NodeData
{
public:
/// Number of variales that we have stored
typedef typename boost::fusion::result_of::size<VariablesT>::type NbVarsT;
/// The dimension of the problem
static const Uint dimension = NbDims::value;
/// Type of the per-variable data
typedef typename boost::mpl::transform< VariablesT, AddNodeData<NbDims::value> >::type VariablesDataT;
/// Return the type of the data stored for variable I (I being an Integral Constant in the boost::mpl sense)
template<typename I>
struct DataType
{
typedef typename boost::remove_pointer
<
typename boost::remove_reference
<
typename boost::fusion::result_of::at
<
VariablesDataT, typename boost::remove_reference<I>::type
>::type
>::type
>::type type;
};
/// Return the data stored at index I
template<typename I>
typename DataType<I>::type& var_data(const I&)
{
return *boost::fusion::at<I>(m_variables_data);
}
/// Type of the coordinates
typedef Eigen::Matrix<Real, NbDims::value, 1> CoordsT;
template<typename ExprT>
NodeData(VariablesT& variables, mesh::Region& region, const common::Table<Real>& coords, const ExprT& expr) :
m_variables(variables),
m_region(region),
m_coordinates(coords)
{
boost::mpl::for_each< boost::mpl::range_c<int, 0, NbVarsT::value> >(InitVariablesData(m_variables, m_region, m_variables_data));
}
~NodeData()
{
boost::mpl::for_each< boost::mpl::range_c<int, 0, NbVarsT::value> >(DeleteVariablesData(m_variables_data));
}
/// Update node index
void set_node(const Uint idx)
{
m_node_idx = idx;
boost::mpl::for_each< boost::mpl::range_c<int, 0, NbVarsT::value> >(SetNode(m_variables_data, m_node_idx));
}
inline Uint node_idx() const
{
return m_node_idx;
}
/// Current node index
Uint m_node_idx;
/// Access to the current coordinates
const CoordsT& coordinates() const
{
const common::Table<Real>::ConstRow row = m_coordinates[m_node_idx];
for(Uint i = 0; i != NbDims::value; ++i)
{
m_position[i] = row[i];
}
return m_position;
}
private:
/// Variables used in the expression
VariablesT& m_variables;
/// Referred region
mesh::Region& m_region;
/// Aray holding the coordinate values
const common::Table<Real>& m_coordinates;
/// Data associated with each numbered variable
VariablesDataT m_variables_data;
/// Current coordinates
mutable CoordsT m_position;
///////////// helper functions and structs /////////////
private:
/// Initializes the pointers in a VariablesDataT fusion sequence
struct InitVariablesData
{
InitVariablesData(VariablesT& vars, mesh::Region& reg, VariablesDataT& vars_data) :
variables(vars),
region(reg),
variables_data(vars_data)
{
}
template<typename I>
void operator()(const I&)
{
apply(boost::fusion::at<I>(variables), boost::fusion::at<I>(variables_data));
}
template<typename VarDataT>
void apply(boost::mpl::void_, VarDataT*& data)
{
data = 0;
}
template<typename VarT, typename VarDataT>
void apply(const VarT& var, VarDataT*& data)
{
const std::string& var_name = var.name();
data = new VarDataT(var, region);
}
VariablesT& variables;
mesh::Region& region;
VariablesDataT& variables_data;
};
/// Delete stored per-variable data
struct DeleteVariablesData
{
DeleteVariablesData(VariablesDataT& vars_data) : variables_data(vars_data)
{
}
template<typename I>
void operator()(const I&)
{
delete boost::fusion::at<I>(variables_data);
}
VariablesDataT& variables_data;
};
/// Set the element on each stored data item
struct SetNode
{
SetNode(VariablesDataT& vars_data, const Uint idx) :
variables_data(vars_data),
node_idx(idx)
{
}
template<typename I>
void operator()(const I&)
{
boost::fusion::at<I>(variables_data)->set_node(node_idx);
}
VariablesDataT& variables_data;
const Uint node_idx;
};
};
} // namespace Proto
} // namespace actions
} // namespace solver
} // namespace cf3
#endif // cf3_solver_actions_Proto_NodeData_hpp
|
576a4dcd57f3887606ee17d4c026583508888363
|
068fb424b9878c9e18542e46dd5925a4cf22ad6b
|
/src/main.cpp
|
a2716436ee03c44b43ce1e28bb9896be6d480726
|
[] |
no_license
|
EirikVea/mp-tfmx
|
69664d2b0cb762f3fd9e34c03819735945d268d4
|
98700c8f5d88560633f70190ffa2b9b2fdc502a4
|
refs/heads/master
| 2016-09-10T09:48:40.082737
| 2013-04-24T20:12:06
| 2013-04-24T20:12:06
| 9,656,504
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,317
|
cpp
|
main.cpp
|
#include "main.h"
struct MyTFMXConfig plugin_cfg;
DWORD g_remaining = 0;
char *g_rembuf;
void DLL_EXPORT mp_PluginInfo(struct mp_plugin_info *info)
{
strcpy(info->name,"TFMX plugin");
info->version = 0x00000101;
}
bool DLL_EXPORT mp_Detect(char *filename, struct mp_song_info *songinfo)
{
if(!IsTFMXFilename(filename))
{
return false;
}
if(LoadTFMXFile(filename) != 0)
{
return false;
}
songinfo->format = (char*)malloc(strlen("TFMX xV") * sizeof(char));
wsprintf(songinfo->format,"TFMX %iV",player_TFMXVoices());
songinfo->name = NULL;
songinfo->artist = NULL;
songinfo->duration = -1;
songinfo->info = (char*)malloc(6 * 40 * sizeof(char));
tfmx_get_module_info(songinfo->info);
songinfo->subsongs = TFMXGetSubSongs();
songinfo->voices = player_TFMXVoices();
songinfo->steps = -1;
TfmxTakedown();
return true;
}
bool DLL_EXPORT mp_InitPlugin(char* filename, int frequency, int bps, int channels)
{
if(g_rembuf)
{
free(g_rembuf);
g_rembuf = NULL;
g_remaining = 0;
}
if(!IsTFMXFilename(filename))
{
return false;
}
if(LoadTFMXFile(filename) != 0)
{
return false;
}
plugin_cfg.freq = frequency;
plugin_cfg.loop_subsong = 1;
plugin_cfg.over = 0;
plugin_cfg.blend = 0;
plugin_cfg.filt = 2;
TFMXSetSubSong(0);
TFMXRewind();
return true;
}
//DWORD DLL_EXPORT mp_SetPluginParams()
//{
//
//}
//
//DWORD DLL_EXPORT mp_SetPluginParams()
//{
//
//}
//
//void DLL_EXPORT mp_GetSongInfo(struct mp_song_info *songinf)
//{
//
//}
DWORD DLL_EXPORT mp_GetPosition()
{
return 0;
}
void DLL_EXPORT mp_SetPosition(DWORD pos)
{
}
DWORD DLL_EXPORT mp_NextSubsong()
{
TFMXSetSubSong(min(TFMXGetSubSong() + 1,TFMXGetSubSongs()));
g_remaining = 0;
if(g_rembuf)
{
free(g_rembuf);
g_rembuf = NULL;
}
return TFMXGetSubSong();
}
DWORD DLL_EXPORT mp_PreviousSubsong()
{
TFMXSetSubSong(max(TFMXGetSubSong() - 1,0));
g_remaining = 0;
if(g_rembuf)
{
free(g_rembuf);
g_rembuf = NULL;
}
return TFMXGetSubSong();
}
void mp_RemoveStereoSep16(short *buffer, DWORD length, float factor)
{
short t1;
for(int i = 0; i < (length >> 1) - 1; i += 1)
{
buffer[i] = ((float)buffer[i] * factor);
buffer[i + 1] = (float)buffer[i + 1] * factor;
t1 = buffer[i];
buffer[i] += buffer[i + 1];
buffer[i + 1] += t1;
}
}
DWORD DLL_EXPORT mp_FillBuffer(void *buffer, DWORD length)
{
int workbuf_length;
if(g_remaining < length)
workbuf_length = g_remaining + ceil((float)length / (float)tfmx_get_block_size()) * tfmx_get_block_size();
else
workbuf_length = g_remaining;
char *workbuf = (char*)calloc(workbuf_length,sizeof(char));
// Copy the remaining bytes from last time over to buffer
if(g_remaining)
{
memcpy(workbuf,g_rembuf,g_remaining);
free(g_rembuf);
g_rembuf = NULL;
}
if(g_remaining < length)
{
for(int i = 0; i < ceil((float)length / (float)tfmx_get_block_size()); i++)
{
tfmx_try_to_make_block();
tfmx_get_block((i * tfmx_get_block_size()) + g_remaining + workbuf);
mp_RemoveStereoSep16((short*)((i * tfmx_get_block_size()) + g_remaining + workbuf),tfmx_get_block_size(),0.5);
}
}
memcpy(buffer,workbuf,length);
// The remaining number of bytes that didn't fit in the requested buffer
// we need to hold on to these until next time
g_remaining = workbuf_length - length;
g_rembuf = (char*)calloc(g_remaining * sizeof(char),sizeof(char));
memcpy(g_rembuf,length + workbuf, g_remaining);
free(workbuf);
return length;
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
// attach to process
// return FALSE to fail DLL load
break;
case DLL_PROCESS_DETACH:
// detach from process
break;
case DLL_THREAD_ATTACH:
// attach to thread
break;
case DLL_THREAD_DETACH:
// detach from thread
break;
}
return TRUE; // succesful
}
|
e0cd336890ca5ab620e3cd7c8c1d06cce10e2bd7
|
d4fe2e8eda0d782946cccfd10433370e5692b564
|
/include/barcodescanner/aw_camerafactory.h
|
3583f81418aa5afbb7f93f9bfb99d4ab9f71f3a3
|
[
"MIT"
] |
permissive
|
angelsware/aw-plugin-barcode-scanner
|
8e151fcaa4beaee7cc4d541f1dc5fa2e8d3940c0
|
75567fa3b7415595ebfa5cf043e1e6cf4bc802e2
|
refs/heads/master
| 2021-07-20T14:10:57.065843
| 2020-10-07T14:23:59
| 2020-10-07T14:23:59
| 218,608,543
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 257
|
h
|
aw_camerafactory.h
|
#ifndef __AW_BARCODE_SCANNER_CAMERA_FACTORY_H__
#define __AW_BARCODE_SCANNER_CAMERA_FACTORY_H__
namespace BarcodeScanner {
class ICamera;
class CCameraFactory
{
public:
static ICamera* create();
static void destroy(ICamera* camera);
};
}
#endif
|
42ca3b93aec12b7235abe1646f22952b2657f787
|
3c8c8143524a5c559eccd2555c1b31ac2f5fb315
|
/include/IBlock.hpp
|
245dd31baa34017c0be72c1ae664c2483d4f905e
|
[] |
no_license
|
KoopOngle/indie_studio
|
06a8215ce631257e5f2cb0b28ee12115aa0b4c7e
|
00f99e1f942ba7775014bd4a8c22ef054aa64ac9
|
refs/heads/master
| 2020-04-22T23:22:50.742434
| 2018-06-10T18:24:29
| 2018-06-10T18:24:29
| 170,739,745
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 367
|
hpp
|
IBlock.hpp
|
//
// EPITECH PROJECT, 2018
// IBlock.hpp
// File description:
// IBlock interface
//
#pragma once
#include "IEntity.hpp"
namespace bbm {
class IBlock : public IEntity {
public:
IBlock(Match &match, float z, float x, bool isTraversable);
virtual ~IBlock();
virtual void spawn() = 0;
virtual void die() = 0;
virtual void update() = 0;
private:
};
}
|
7a7e961f5f1b25dbd068b08960c05326505428dc
|
e8d5015d7586a0eb5ff2bb4b74c9202ce1e2d342
|
/Problem Sets/ps1b.cpp
|
9391f60c72d8ce4eac0df6e2a0dddf7ce4ca4242
|
[] |
no_license
|
exetr/CS2040C
|
963c51e117731776e9768941684424dafe0bde21
|
41930e55169134f6feecf795586b6b4073f5f009
|
refs/heads/master
| 2020-03-28T12:36:47.256730
| 2018-11-17T11:53:58
| 2018-11-17T11:53:58
| 148,315,529
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,620
|
cpp
|
ps1b.cpp
|
#include <bits/stdc++.h>
using namespace std;
void median(double arr[], int n) {
//queue to store smaller half elements
priority_queue<double> s;
//queue to store greater half elements
priority_queue<double, vector<double>, greater<double> > g;
//declare first element as current median
double med = arr[0];
unsigned long long int result = med;
//push first element of array into queue s
s.push(arr[0]);
//iterate through remaining elements within array
for (int i = 1; i < n; i++) {
//set current value as next element in array
double x = arr[i];
//case1: queue s has more elements
if(s.size() > g.size()) {
if(x < med) {
g.push(s.top());
s.pop();
s.push(x);
} else {
g.push(x);
}
//find average of top of s and g queue
med = (s.top() + g.top())/2.0;
}
//case2: both queues are equal in size
else if(s.size() == g.size()) {
if (x < med) {
s.push(x);
//median is top of queue s
//result += (int)s.top();
med = (double)s.top();
} else {
g.push(x);
//median is top of queue g
//med = (int)g.top();
med = (double)g.top();
}
}
//case3: queue g has more elements
else {
if (x > med) {
s.push(g.top());
g.pop();
g.push(x);
} else {
s.push(x);
}
//find average of top of s and g queue
med = (s.top() + g.top())/2.0;
}
//sum with current running median
result += (unsigned long long int)med;
}
//print result
printf("%llu\n", result);
}
int main() {
// get number of test cases
unsigned int tc;
cin >> tc;
//iterate through test cases
for(int i=1; i<=tc; i++) {
//get size of array
unsigned int n;
cin >> n;
//get and process elements of array
unsigned long long int input;
double* array = new double[n];
//read values from stdin and add to array
for(int i=0; i<n; i++) {
cin >> input;
array[i] = (double) input;
}
//get running median of array
median(array, n);
//delete memory allocated for array
delete [] array;
array = NULL;
}
return 0;
}
|
d0eacdb2e1b4ed8ec108cc64cfdcc98e5636e00b
|
3613a2fd1cb1989ce3a7f959153d5a1be48d38bc
|
/Cercetare/SequentialImplementation.h
|
e592e6f4e684fb56e27744ea5a049975a3210a64
|
[
"MIT"
] |
permissive
|
Eteru/Master-s-project
|
380ba488039a208e9e99a686513f7bad078cb05f
|
3374d430392d41e4a4f16f9324e4029e59aaf381
|
refs/heads/master
| 2021-07-14T20:04:33.310698
| 2018-09-07T09:12:53
| 2018-09-07T09:12:53
| 110,660,655
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 812
|
h
|
SequentialImplementation.h
|
#pragma once
#include "Implementation.h"
class SequentialImplementation :
public Implementation
{
public:
SequentialImplementation();
virtual ~SequentialImplementation();
// filters
virtual void CustomFilter(QImage & img, const std::vector<float> & kernel_values);
virtual float Grayscale(QImage & img);
virtual void Sobel(QImage & img);
virtual float GaussianBlur(QImage & img);
virtual void Sharpening(QImage & img);
virtual void ColorSmoothing(QImage & img);
// segmentation
virtual float KMeans(QImage & img, const int centroid_count);
virtual float SOMSegmentation(QImage & img, QImage * ground_truth = nullptr);
virtual void Threshold(QImage & img, const float value);
virtual void RunSIFT(QImage & img);
virtual std::vector<float> FindImageSIFT(QImage & img, QImage & img_to_find);
};
|
02a104cc864f798d88d16caccb9f30618c21f76c
|
188fb8ded33ad7a2f52f69975006bb38917437ef
|
/Fluid/processor2/0.01/U
|
afa4fb1253705ca7ba63af972a57dac22cb59d42
|
[] |
no_license
|
abarcaortega/Tuto_2
|
34a4721f14725c20471ff2dc8d22b52638b8a2b3
|
4a84c22efbb9cd2eaeda92883343b6910e0941e2
|
refs/heads/master
| 2020-08-05T16:11:57.674940
| 2019-10-04T09:56:09
| 2019-10-04T09:56:09
| 212,573,883
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 13,218
|
U
|
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0.01";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField nonuniform List<vector>
465
(
(10.3817 0 -4.13299)
(10.1153 0 -3.66322)
(10.7733 0 -3.82969)
(10.4619 0 -3.44371)
(10.2262 0 -3.08875)
(10.0482 0 -2.76505)
(11.0843 0 -3.49401)
(10.752 0 -3.19089)
(10.4914 0 -2.89873)
(10.2877 0 -2.62268)
(10.1291 0 -2.36499)
(11.3198 0 -3.1478)
(10.9855 0 -2.92021)
(10.7146 0 -2.68832)
(10.4964 0 -2.45992)
(10.3215 0 -2.23973)
(10.1822 0 -2.0304)
(10.0719 0 -1.83323)
(11.4878 0 -2.80662)
(11.1655 0 -2.64443)
(10.8963 0 -2.4673)
(10.6733 0 -2.284)
(10.4898 0 -2.10058)
(10.3399 0 -1.921)
(10.2181 0 -1.74779)
(10.1198 0 -1.58244)
(10.0411 0 -1.42572)
(11.599 0 -2.48174)
(11.2978 0 -2.37357)
(11.039 0 -2.24398)
(10.819 0 -2.10153)
(10.6336 0 -1.9526)
(10.4785 0 -1.80182)
(10.3496 0 -1.65244)
(10.2433 0 -1.50667)
(10.1561 0 -1.36595)
(10.0852 0 -1.23112)
(11.6641 0 -2.17996)
(11.3892 0 -2.11473)
(11.1467 0 -2.0249)
(10.9355 0 -1.9181)
(10.7535 0 -1.80039)
(10.5979 0 -1.6765)
(10.4659 0 -1.55)
(10.3548 0 -1.42351)
(10.2618 0 -1.2989)
(10.1847 0 -1.17744)
(10.1209 0 -1.05997)
(10.0688 0 -0.946924)
(11.6931 0 -1.90486)
(11.4467 0 -1.87255)
(11.2241 0 -1.81488)
(11.0258 0 -1.73818)
(10.8511 0 -1.64786)
(10.6987 0 -1.54835)
(10.5671 0 -1.44317)
(10.4541 0 -1.3351)
(10.3579 0 -1.22624)
(10.2765 0 -1.11814)
(10.2081 0 -1.01191)
(10.1511 0 -0.908268)
(10.104 0 -0.807652)
(11.6949 0 -1.65757)
(11.4771 0 -1.64963)
(11.2759 0 -1.61716)
(11.0928 0 -1.56519)
(10.9283 0 -1.49823)
(10.7822 0 -1.4202)
(10.6535 0 -1.33437)
(10.5412 0 -1.24346)
(10.444 0 -1.14961)
(10.3604 0 -1.05453)
(10.289 0 -0.959471)
(10.2285 0 -0.865356)
(10.1777 0 -0.772818)
(10.1353 0 -0.682229)
(10.1002 0 -0.593751)
(11.677 0 -1.43761)
(11.4865 0 -1.447)
(11.3069 0 -1.4337)
(11.1402 0 -1.40148)
(10.9877 0 -1.35395)
(10.8497 0 -1.2944)
(10.7262 0 -1.22572)
(10.6166 0 -1.15042)
(10.5202 0 -1.07058)
(10.4361 0 -0.987886)
(10.3632 0 -0.90369)
(10.3006 0 -0.819018)
(10.2472 0 -0.734633)
(10.202 0 -0.651046)
(10.1641 0 -0.568565)
(10.1329 0 -0.487323)
(11.6453 0 -1.24348)
(11.48 0 -1.26463)
(11.3212 0 -1.26541)
(11.1712 0 -1.24854)
(11.0315 0 -1.21678)
(10.9031 0 -1.17277)
(10.7862 0 -1.11898)
(10.681 0 -1.05759)
(10.587 0 -0.990529)
(10.5038 0 -0.919409)
(10.4308 0 -0.845571)
(10.3672 0 -0.770082)
(10.3122 0 -0.693768)
(10.2651 0 -0.617241)
(10.2253 0 -0.540921)
(10.1919 0 -0.465048)
(10.1645 0 -0.389696)
(10.1425 0 -0.314807)
(11.6046 0 -1.0731)
(11.462 0 -1.10169)
(11.3227 0 -1.11242)
(11.1889 0 -1.10715)
(11.0623 0 -1.08788)
(10.944 0 -1.05668)
(10.8348 0 -1.01554)
(10.735 0 -0.966323)
(10.6447 0 -0.910721)
(10.5637 0 -0.850214)
(10.4917 0 -0.786069)
(10.4281 0 -0.719341)
(10.3725 0 -0.65088)
(10.3244 0 -0.581354)
(10.2832 0 -0.511248)
(10.2483 0 -0.440881)
(10.2195 0 -0.37043)
(10.1961 0 -0.299923)
(10.178 0 -0.229265)
(11.5586 0 -0.924156)
(11.4361 0 -0.956949)
(11.3146 0 -0.974348)
(11.1961 0 -0.977536)
(11.0823 0 -0.967921)
(10.9744 0 -0.947034)
(10.8734 0 -0.916445)
(10.7798 0 -0.877685)
(10.6941 0 -0.83219)
(10.6161 0 -0.781258)
(10.546 0 -0.726045)
(10.4834 0 -0.667551)
(10.428 0 -0.606615)
(10.3796 0 -0.543919)
(10.3377 0 -0.479983)
(10.302 0 -0.41518)
(10.2721 0 -0.349757)
(10.2477 0 -0.283825)
(10.2287 0 -0.217377)
(10.2148 0 -0.150296)
(11.51 0 -0.79426)
(11.4051 0 -0.828881)
(11.2995 0 -0.850407)
(11.1951 0 -0.859522)
(11.0935 0 -0.857156)
(10.9959 0 -0.844404)
(10.9033 0 -0.822453)
(10.8164 0 -0.792516)
(10.7358 0 -0.755776)
(10.6616 0 -0.713344)
(10.5941 0 -0.666245)
(10.5332 0 -0.615392)
(10.4788 0 -0.56157)
(10.4307 0 -0.505446)
(10.3887 0 -0.447551)
(10.3526 0 -0.388294)
(10.3221 0 -0.327966)
(10.2972 0 -0.266736)
(10.2775 0 -0.20467)
(10.2631 0 -0.141736)
(10.2529 0 -0.0778304)
(11.4608 0 -0.681142)
(11.3711 0 -0.71589)
(11.2797 0 -0.739607)
(11.1881 0 -0.752629)
(11.0979 0 -0.755523)
(11.0101 0 -0.749034)
(10.9257 0 -0.734022)
(10.8457 0 -0.711414)
(10.7706 0 -0.682153)
(10.7007 0 -0.647164)
(10.6363 0 -0.60733)
(10.5777 0 -0.563463)
(10.5248 0 -0.516281)
(10.4776 0 -0.466402)
(10.436 0 -0.41435)
(10.4 0 -0.360549)
(10.3694 0 -0.305318)
(10.3441 0 -0.248865)
(10.3241 0 -0.191312)
(10.3094 0 -0.132696)
(10.299 0 -0.0729912)
(11.4126 0 -0.582689)
(11.3359 0 -0.616379)
(11.2569 0 -0.640852)
(11.1768 0 -0.656206)
(11.097 0 -0.662742)
(11.0184 0 -0.660931)
(10.9421 0 -0.651373)
(10.8688 0 -0.634747)
(10.7993 0 -0.611785)
(10.7339 0 -0.583236)
(10.6731 0 -0.549836)
(10.6172 0 -0.512285)
(10.5662 0 -0.471224)
(10.5204 0 -0.427219)
(10.4797 0 -0.380763)
(10.4441 0 -0.332272)
(10.4137 0 -0.282071)
(10.3884 0 -0.230409)
(10.3683 0 -0.177449)
(10.3534 0 -0.123273)
(10.3428 0 -0.0679206)
(11.3662 0 -0.496978)
(11.3007 0 -0.528818)
(11.2325 0 -0.553008)
(11.1626 0 -0.569488)
(11.0922 0 -0.578372)
(11.0222 0 -0.57993)
(10.9534 0 -0.57455)
(10.8867 0 -0.562715)
(10.8227 0 -0.544978)
(10.762 0 -0.52193)
(10.7049 0 -0.494169)
(10.652 0 -0.462274)
(10.6033 0 -0.426801)
(10.5591 0 -0.388264)
(10.5196 0 -0.347117)
(10.4848 0 -0.303748)
(10.4549 0 -0.25848)
(10.4299 0 -0.211575)
(10.4099 0 -0.163228)
(10.395 0 -0.113563)
(10.3844 0 -0.0626687)
(11.3226 0 -0.422286)
(11.2665 0 -0.451769)
(11.2076 0 -0.474936)
(11.1467 0 -0.491631)
(11.0846 0 -0.501846)
(11.0224 0 -0.505704)
(10.9606 0 -0.503439)
(10.9001 0 -0.495379)
(10.8415 0 -0.481919)
(10.7854 0 -0.463509)
(10.7322 0 -0.440624)
(10.6823 0 -0.413742)
(10.6362 0 -0.383335)
(10.5939 0 -0.34985)
(10.5558 0 -0.313692)
(10.5221 0 -0.275222)
(10.4929 0 -0.234747)
(10.4683 0 -0.192531)
(10.4486 0 -0.148787)
(10.4339 0 -0.103665)
(10.4234 0 -0.0572908)
(11.282 0 -0.357083)
(11.234 0 -0.383904)
(11.1831 0 -0.405535)
(11.1299 0 -0.421773)
(11.0753 0 -0.432532)
(11.02 0 -0.437833)
(10.9646 0 -0.437801)
(10.9099 0 -0.432646)
(10.8564 0 -0.422635)
(10.8047 0 -0.408098)
(10.7553 0 -0.389399)
(10.7087 0 -0.366928)
(10.6651 0 -0.34108)
(10.6249 0 -0.312228)
(10.5885 0 -0.280727)
(10.556 0 -0.246905)
(10.5277 0 -0.211052)
(10.5037 0 -0.173428)
(10.4844 0 -0.134238)
(10.47 0 -0.0936492)
(10.4596 0 -0.0518253)
(11.245 0 -0.300021)
(11.2037 0 -0.324009)
(11.1596 0 -0.343765)
(11.1131 0 -0.359058)
(11.065 0 -0.369761)
(11.0159 0 -0.375832)
(10.9663 0 -0.377315)
(10.9168 0 -0.374323)
(10.8681 0 -0.36704)
(10.8206 0 -0.355699)
(10.7748 0 -0.340575)
(10.7313 0 -0.321969)
(10.6903 0 -0.300194)
(10.6523 0 -0.275567)
(10.6176 0 -0.248397)
(10.5864 0 -0.218975)
(10.5591 0 -0.187563)
(10.536 0 -0.154397)
(10.5172 0 -0.119682)
(10.5031 0 -0.0835991)
(10.4929 0 -0.0463228)
(11.2115 0 -0.24991)
(11.1759 0 -0.270997)
(11.1376 0 -0.288651)
(11.0969 0 -0.30265)
(11.0545 0 -0.312847)
(11.0107 0 -0.319161)
(10.9662 0 -0.321576)
(10.9215 0 -0.320141)
(10.8771 0 -0.314973)
(10.8335 0 -0.306239)
(10.7912 0 -0.294137)
(10.7506 0 -0.278892)
(10.7121 0 -0.260751)
(10.6762 0 -0.239976)
(10.6433 0 -0.216825)
(10.6135 0 -0.191546)
(10.5873 0 -0.164377)
(10.5649 0 -0.135527)
(10.5467 0 -0.105196)
(10.533 0 -0.0735666)
(10.5231 0 -0.0408099)
(11.1819 0 -0.20567)
(11.151 0 -0.223849)
(11.1175 0 -0.23927)
(11.0817 0 -0.251732)
(11.044 0 -0.261084)
(11.005 0 -0.267224)
(10.9649 0 -0.270106)
(10.9244 0 -0.269741)
(10.8839 0 -0.266194)
(10.8438 0 -0.259569)
(10.8046 0 -0.250004)
(10.7668 0 -0.23767)
(10.7308 0 -0.222764)
(10.6969 0 -0.205491)
(10.6656 0 -0.186059)
(10.6372 0 -0.164676)
(10.6121 0 -0.141557)
(10.5906 0 -0.116886)
(10.573 0 -0.090843)
(10.5597 0 -0.063595)
(10.5502 0 -0.0353136)
(11.1562 0 -0.166341)
(11.1292 0 -0.181632)
(11.0997 0 -0.194748)
(11.0679 0 -0.20551)
(11.0343 0 -0.213769)
(10.9992 0 -0.219417)
(10.963 0 -0.222398)
(10.9261 0 -0.222702)
(10.8889 0 -0.220358)
(10.8519 0 -0.215421)
(10.8155 0 -0.207987)
(10.7802 0 -0.198188)
(10.7464 0 -0.186166)
(10.7144 0 -0.172078)
(10.6846 0 -0.156094)
(10.6576 0 -0.138393)
(10.6335 0 -0.119142)
(10.6129 0 -0.0985053)
(10.5959 0 -0.0766435)
(10.5831 0 -0.0537079)
(10.5738 0 -0.029853)
(11.1345 0 -0.131033)
(11.1106 0 -0.143485)
(11.0843 0 -0.154259)
(11.0558 0 -0.163201)
(11.0255 0 -0.17018)
(10.9937 0 -0.1751)
(10.9606 0 -0.177903)
(10.9268 0 -0.17856)
(10.8925 0 -0.177075)
(10.8582 0 -0.173481)
(10.8243 0 -0.167842)
(10.7911 0 -0.160251)
(10.7592 0 -0.150815)
(10.7289 0 -0.139648)
(10.7006 0 -0.126882)
(10.6747 0 -0.112657)
(10.6517 0 -0.0971067)
(10.6318 0 -0.080373)
(10.6154 0 -0.0625949)
(10.6029 0 -0.0439006)
(10.5939 0 -0.0244232)
(11.1168 0 -0.0989086)
(11.0953 0 -0.108569)
(11.0716 0 -0.116982)
(11.0458 0 -0.124022)
(11.0181 0 -0.129585)
(10.9889 0 -0.133598)
(10.9584 0 -0.136005)
(10.927 0 -0.136771)
(10.895 0 -0.135884)
(10.8629 0 -0.133365)
(10.831 0 -0.129255)
(10.7997 0 -0.12361)
(10.7694 0 -0.116505)
(10.7405 0 -0.108028)
(10.7134 0 -0.0982824)
(10.6885 0 -0.0873691)
(10.6663 0 -0.0753888)
(10.6471 0 -0.0624548)
(10.6312 0 -0.0486782)
(10.6192 0 -0.034163)
(10.6104 0 -0.0190183)
(11.1033 0 -0.0691729)
(11.0836 0 -0.0760739)
(11.0617 0 -0.0821117)
(11.0379 0 -0.0871939)
(11.0122 0 -0.0912479)
(10.9849 0 -0.0942155)
(10.9564 0 -0.0960534)
(10.9269 0 -0.0967357)
(10.8967 0 -0.096248)
(10.8663 0 -0.094594)
(10.8359 0 -0.0918)
(10.806 0 -0.0879012)
(10.7769 0 -0.082943)
(10.7492 0 -0.0769909)
(10.7231 0 -0.0701159)
(10.699 0 -0.0623887)
(10.6775 0 -0.0538845)
(10.6588 0 -0.0446762)
(10.6434 0 -0.034842)
(10.6317 0 -0.0244653)
(10.6231 0 -0.0136269)
(11.094 0 -0.0410214)
(11.0755 0 -0.0451743)
(11.0549 0 -0.0488149)
(11.0324 0 -0.0518905)
(11.008 0 -0.0543609)
(10.9821 0 -0.0561895)
(10.9549 0 -0.057344)
(10.9267 0 -0.0578078)
(10.8977 0 -0.0575732)
(10.8684 0 -0.0566373)
(10.8391 0 -0.0550109)
(10.8102 0 -0.052718)
(10.782 0 -0.0497863)
(10.7551 0 -0.0462509)
(10.7296 0 -0.0421518)
(10.7062 0 -0.037533)
(10.6851 0 -0.0324408)
(10.6669 0 -0.0269124)
(10.6517 0 -0.0209922)
(10.6402 0 -0.0147429)
(10.6318 0 -0.00821653)
(11.0778 0 -0.0136197)
(11.0599 0 -0.0150098)
(11.04 0 -0.0162282)
(11.0181 0 -0.0172593)
(10.9945 0 -0.0180911)
(10.9692 0 -0.0187109)
(10.9427 0 -0.0191052)
(10.9152 0 -0.0192699)
(10.8869 0 -0.0192029)
(10.8582 0 -0.0189011)
(10.8295 0 -0.0183666)
(10.8011 0 -0.0176072)
(10.7734 0 -0.0166335)
(10.7469 0 -0.015456)
(10.7219 0 -0.0140904)
(10.6988 0 -0.0125521)
(10.6779 0 -0.0108529)
(10.6599 0 -0.0090035)
(10.6449 0 -0.00702058)
(10.6335 0 -0.00492937)
(10.6252 0 -0.00274774)
)
;
boundaryField
{
inlet
{
type fixedValue;
value nonuniform 0();
}
outlet
{
type zeroGradient;
}
flap
{
type movingWallVelocity;
value nonuniform 0();
}
upperWall
{
type noSlip;
}
lowerWall
{
type noSlip;
}
frontAndBack
{
type empty;
}
procBoundary2to1
{
type processor;
value nonuniform List<vector>
17
(
(11.7477 0 -1.02513)
(11.6796 0 -0.875129)
(11.6123 0 -0.746182)
(11.5472 0 -0.635313)
(11.4855 0 -0.539925)
(11.428 0 -0.45774)
(11.3749 0 -0.386793)
(11.3265 0 -0.325402)
(11.2828 0 -0.272119)
(11.244 0 -0.225682)
(11.2099 0 -0.184995)
(11.1805 0 -0.149089)
(11.1558 0 -0.117076)
(11.1359 0 -0.088141)
(11.1206 0 -0.0615124)
(11.1102 0 -0.0364202)
(11.0934 0 -0.0120793)
)
;
}
procBoundary2to4
{
type processor;
value nonuniform List<vector>
11
(
(10.7489 0 -4.66248)
(11.1849 0 -4.24282)
(11.5063 0 -3.79822)
(11.7293 0 -3.35883)
(11.8698 0 -2.94149)
(11.9451 0 -2.55739)
(11.9711 0 -2.21139)
(11.9613 0 -1.90462)
(11.9264 0 -1.63568)
(11.8752 0 -1.40179)
(11.814 0 -1.1995)
)
;
}
procBoundary2to5
{
type processor;
value nonuniform List<vector>
34
(
(9.91486 0 -4.37907)
(9.71851 0 -3.83304)
(9.92148 0 -3.24763)
(9.92148 0 -3.24763)
(9.78097 0 -2.87967)
(9.91427 0 -2.47111)
(9.91427 0 -2.47111)
(10.0064 0 -2.1262)
(10.0064 0 -2.1262)
(9.91226 0 -1.90593)
(9.98526 0 -1.64866)
(9.98526 0 -1.64866)
(9.91784 0 -1.47659)
(9.97866 0 -1.2779)
(9.97866 0 -1.2779)
(10.0279 0 -1.10262)
(10.0279 0 -1.10262)
(9.982 0 -0.980529)
(10.0265 0 -0.838491)
(10.0265 0 -0.838491)
(10.0653 0 -0.710255)
(10.0653 0 -0.710255)
(10.0338 0 -0.616063)
(10.0716 0 -0.507379)
(10.0716 0 -0.507379)
(10.1074 0 -0.407286)
(10.1074 0 -0.407286)
(10.0873 0 -0.328276)
(10.1256 0 -0.240185)
(10.1256 0 -0.240185)
(10.1648 0 -0.158252)
(10.1648 0 -0.158252)
(10.2051 0 -0.0823865)
(10.2051 0 -0.0823865)
)
;
}
}
// ************************************************************************* //
|
|
80a758f9eadc2c46c1b2a376a6e2bafcb5aebdcd
|
09e5cfe06e437989a2ccf2aeecb9c73eb998a36c
|
/modules/cctbx_project/mmtbx/masks/atom_mask.cpp
|
21acb72bee0f87fd820dbc5289a18aac1a9d4261
|
[
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license",
"BSD-3-Clause-LBNL"
] |
permissive
|
jorgediazjr/dials-dev20191018
|
b81b19653624cee39207b7cefb8dfcb2e99b79eb
|
77d66c719b5746f37af51ad593e2941ed6fbba17
|
refs/heads/master
| 2020-08-21T02:48:54.719532
| 2020-01-25T01:41:37
| 2020-01-25T01:41:37
| 216,089,955
| 0
| 1
|
BSD-3-Clause
| 2020-01-25T01:41:39
| 2019-10-18T19:03:17
|
Python
|
UTF-8
|
C++
| false
| false
| 39,147
|
cpp
|
atom_mask.cpp
|
#include <mmtbx/masks/atom_mask.h>
#include <mmtbx/masks/util.h>
#include <mmtbx/masks/grid_symop.h>
#include <cctbx/maptbx/structure_factors.h>
#include <cctbx/maptbx/gridding.h>
#include <cctbx/sgtbx/direct_space_asu/proto/small_vec_math.h>
#include <cctbx/sgtbx/direct_space_asu/proto/asymmetric_unit.h>
#include <scitbx/fftpack/real_to_complex_3d.h>
#include <scitbx/array_family/flex_types.h>
#include <scitbx/array_family/tiny_types.h>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/random.hpp>
#include <numeric>
#include <sstream>
#if defined(_MSC_VER)
#undef max
#undef min
#endif
namespace mmtbx { namespace masks {
using namespace cctbx::sgtbx::asu;
typedef double f_t;
namespace {
inline int ifloor(f_t x)
{
return scitbx::math::float_int_conversions<f_t, int>::ifloor(x);
}
inline int iceil(f_t x)
{
return scitbx::math::float_int_conversions<f_t, int>::iceil(x);
}
inline scitbx::vec3<int> iceil(const scitbx::vec3<double> &v)
{
return scitbx::vec3<int> (
scitbx::math::float_int_conversions<double, int>::iceil(v[0]),
scitbx::math::float_int_conversions<double, int>::iceil(v[1]),
scitbx::math::float_int_conversions<double, int>::iceil(v[2])
);
}
inline scitbx::vec3<int> ifloor(const scitbx::vec3<double> &v)
{
return scitbx::vec3<int> (
scitbx::math::float_int_conversions<double, int>::ifloor(v[0]),
scitbx::math::float_int_conversions<double, int>::ifloor(v[1]),
scitbx::math::float_int_conversions<double, int>::ifloor(v[2])
);
}
}
inline void translate_into_cell(scitbx::int3 &num, const scitbx::int3 &den)
{
for(register unsigned char i=0; i<3; ++i)
{
register int tn = num[i];
register const int td = den[i];
tn %= td;
if( tn < 0 )
tn += td;
num[i] = tn;
}
}
// seems to be of the same speed as the above
inline void translate_into_cell_2(scitbx::int3 &num, const scitbx::int3 &den)
{
for(unsigned char i=0; i<3; ++i)
{
register int tn = num[i];
register const int td = den[i];
while( tn<0 )
tn += td;
while( tn >= td )
tn -= td;
num[i] = tn;
}
}
unsigned short site_symmetry_order(
const std::vector<cctbx::sgtbx::grid_symop> &symops,
const scitbx::int3 &num, const scitbx::int3 &den )
{
unsigned short nops = 0;
// num must be inside cell
for(size_t i=0; i<symops.size(); ++i)
{
scitbx::int3 sv = symops[i].apply_to( num );
translate_into_cell(sv, den);
if( scitbx::eq_all(sv , num) )
++nops;
}
MMTBX_ASSERT( nops>0U );
return nops;
}
void atom_mask::mask_asu()
{
unsigned short order = group.order_z();
MMTBX_ASSERT( order>0 );
const scitbx::int3 n = this->grid_size();
MMTBX_ASSERT( n[0]>0 && n[1]>0 && n[2] >0 );
// determine expanded asu limits, due to symops arithmetics
const int max_int = std::numeric_limits<int>::max();
scitbx::af::int3 max_grid(max_int, max_int, max_int);
// prepare grid adapted integer symmetry operators
std::vector<cctbx::sgtbx::grid_symop> symops;
for(size_t i=0; i<order; ++i)
{
cctbx::sgtbx::grid_symop grsym( group(i), n );
symops.push_back(grsym);
scitbx::af::int3 grmx;
grsym.get_grid_limits(grmx);
for(unsigned char j=0; j<3U; ++j)
max_grid[j] = std::min(max_grid[j], grmx[j]);
}
MMTBX_ASSERT( symops.size() == order );
scitbx::int3 imn, imx;
this->get_asu_boundaries(imn, imx); // [imn, imx)
scitbx::int3 emn, emx; // enclosed box boundaries [emn, emx]
const bool has_enclosed_box = asu.enclosed_box_corners(emn, emx, n);
this->debug_has_enclosed_box = has_enclosed_box;
if( has_enclosed_box )
{
MMTBX_ASSERT( scitbx::gt_all( emn, imn ) );
MMTBX_ASSERT( scitbx::lt_all( emx, imx ) );
}
asymmetric_unit<direct,optimized> opt_asu(this->asu, n);
scitbx::int3 smn, smx;
this->get_expanded_asu_boundaries(smn,smx); // [smn, smx)
// determine expanded asu limits, due to is_inside arithmetics
scitbx::af::long3 grmx = opt_asu.get_optimized_grid_limits();
for(unsigned char j=0; j<3U; ++j)
{
if( grmx[j] < max_grid[j] )
max_grid[j] = grmx[j];
if( std::abs(smn[j])>max_grid[j] || std::abs(smx[j])>max_grid[j] )
{
std::ostringstream str;
str << "Mask's expanded asymmetric cell dimensions: [" << smn << ", "
<< smx << ") are too large. 64 bit OS and/or software may be needed.";
throw error(str.str());
}
}
const af::ref<data_type, grid_t > data_ref = data.ref();
data_type *d_ptr = data_ref.begin();
register size_t cell_volume = 0;
for(register long i=smn[0]; i<smx[0]; ++i)
{
for(register long j=smn[1]; j<smx[1]; ++j)
{
for(register long k=smn[2]; k<smx[2]; ++k, ++d_ptr)
{
// set points wthin shrink_truncation_radius around asu to
// an arbitrary unique positive value
data_type &dr = *d_ptr;
dr.set_outside();
const scitbx::int3 pos(i,j,k);
if( !(scitbx::ge_all(pos, imn) && scitbx::lt_all(pos, imx)) )
continue;
register unsigned short nops = 0;
if( has_enclosed_box )
{
if( scitbx::ge_all(pos, emn) && scitbx::le_all(pos, emx) )
nops = order;
}
if( nops==0 )
{
const short ww = opt_asu.where_is(pos);
if( ww == 1 ) // inside NOT on the face
nops = order;
else if( ww==-1 ) // inside on the face
{
scitbx::int3 pos_in_cell(pos);
translate_into_cell(pos_in_cell, n);
nops = site_symmetry_order(symops, pos_in_cell, n);
MMTBX_ASSERT( nops>0 );
MMTBX_ASSERT( order%nops == 0);
nops = order / nops;
}
}
if( nops!=0 )
{
MMTBX_ASSERT( dr.multiplicity()==0 || dr.multiplicity() == nops
|| dr.is_outside() );
MMTBX_ASSERT( dr.layer()==0 || dr.layer() == n_layers+1
|| dr.is_outside());
dr.set(n_layers+1, nops);
cell_volume += static_cast<size_t>(nops);
}
} // z-loop
} // y-loop
} // x-loop
MMTBX_ASSERT( cell_volume > 0 );
if( cell_volume != this->grid_size_1d() )
{
// volume(asu)*group_order != volume(cell)
std::ostringstream str;
str << "volume(asymmetric unit)*group_order != volume(unit cell).\n"
<< "Maybe because the mask grid size: " << this->grid_size()
<< " is incompatible with\n"
"the space group symmetry";
throw error( str.str() );
}
}
void atom_mask::compute(
const coord_array_t & sites_frac,
const double_array_t & atom_radii,
const shells_array_t &shells)
{
if( shells.size() >= max_n_layers )
{
std::stringstream str;
str << "Number of radial shells for the mask must be less than "
<< max_n_layers << ". Provided: " << shells.size();
throw error(str.str());
}
this->n_layers = shells.size() + 1U;
boost::posix_time::ptime
tb = boost::posix_time::microsec_clock::local_time(), te;
boost::posix_time::time_duration tdif;
af::const_ref<data_type, grid_t > data_cref = data.const_ref();
this->atoms_to_asu(sites_frac, atom_radii);
te = boost::posix_time::microsec_clock::local_time();
tdif = te - tb;
debug_atoms_to_asu_time = tdif.total_milliseconds();
tb = boost::posix_time::microsec_clock::local_time();
// masking is the slowest part of this routine, for not optimized asus
this->mask_asu();
te = boost::posix_time::microsec_clock::local_time();
tdif = te - tb;
debug_mask_asu_time = tdif.total_milliseconds();
tb = boost::posix_time::microsec_clock::local_time();
this->compute_accessible_surface(this->asu_atoms, shells);
te = boost::posix_time::microsec_clock::local_time();
tdif = te - tb;
debug_accessible_time = tdif.total_milliseconds();
tb = boost::posix_time::microsec_clock::local_time();
this->compute_contact_surface();
te = boost::posix_time::microsec_clock::local_time();
tdif = te - tb;
debug_contact_time = tdif.total_milliseconds();
}
void atom_mask::get_expanded_asu_boundaries(scitbx::double3 &low,
scitbx::double3 &high) const
{
low = this->expanded_box[0];
high = this->expanded_box[1];
}
void atom_mask::get_asu_boundaries(scitbx::int3 &low,
scitbx::int3 &high) const
{
low = this->asu_low;
high = this->asu_high;
}
void atom_mask::get_expanded_asu_boundaries(scitbx::int3 &low,
scitbx::int3 &high) const
{
low = scitbx::int3( this->data.accessor().origin() );
high = scitbx::int3( this->data.accessor().last() );
}
inline scitbx::double3 conv_(const rvector3_t r)
{
return scitbx::double3( boost::rational_cast<double,int>(r[0]),
boost::rational_cast<double,int>(r[1]),
boost::rational_cast<double,int>(r[2]));
}
void atom_mask::determine_boundaries()
{
const scitbx::int3 n = this->grid_size();
MMTBX_ASSERT( n[0]>0 && n[1]>0 && n[2]>0 );
cctbx::sgtbx::asu::rvector3_t mn, mx;
this->asu.box_corners(mn,mx);
this->expanded_box[0] = conv_(mn);
this->expanded_box[1] = conv_(mx);
MMTBX_ASSERT( scitbx::ge_all(expanded_box[1], expanded_box[0]) );
scitbx::mul(mn, n);
scitbx::mul(mx, n);
// inclusive: [imn, imx]
this->asu_low = scitbx::floor(mn);
this->asu_high = scitbx::ceil(mx); // asu boundaries
MMTBX_ASSERT( scitbx::gt_all(this->asu_high, this->asu_low) );
this->asu_high += scitbx::int3(1,1,1); // now typical C++: [imn,imx)
// the following is only assumed in atoms_to_asu
// MMTBX_ASSERT( scitbx::le_all(this->asu_high, n+1) );
// MMTBX_ASSERT( scitbx::ge_all(this->asu_low, -n-1) );
// expand asu by shrink_truncation_radius
const scitbx::af::tiny<double,6> rcell = cell.reciprocal_parameters();
const scitbx::double3 rp(rcell[0], rcell[1], rcell[2]);
// TODO: try different constant 1.005
scitbx::double3 shrink_box = rp * (shrink_truncation_radius*1.05);
this->expanded_box[0] -= shrink_box;
this->expanded_box[1] += shrink_box;
scitbx::mul( shrink_box, n );
// expanded asu boundaries
scitbx::int3 emn, emx;
emn = this->asu_low + ifloor( -shrink_box );
emx = this->asu_high + iceil( shrink_box ) - scitbx::int3(1,1,1);
for(short idim=0; idim<3; ++idim)
if( emx[idim]<asu_high[idim] )
++emx[idim];
MMTBX_ASSERT( scitbx::ge_all(emx, emn) && scitbx::ge_all(emx,this->asu_high)
&& scitbx::le_all(emn, this->asu_low) );
grid_t interval(emn,emx);
double n_bytes = sizeof(mask_array_t::value_type);
for( unsigned char j=0; j<3U; ++j)
n_bytes *= interval.all()[j];
std::size_t max_int = std::numeric_limits<std::size_t>::max()-3;
if( n_bytes > max_int || n_bytes<=0.0 )
{
std::ostringstream str;
str << "mask dimensions: [" << emn << ", " << emx << ") are too large.\n"
<< " It requires " << n_bytes << " Bytes. Maxumum possible: " << max_int
<< ". 64 bit OS and/or software may be required.";
throw error(str.str());
}
this->data.resize(interval);
}
void atom_mask::atoms_to_asu(
const coord_array_t & sites_frac,
const double_array_t & atom_radii)
{
if( sites_frac.size() != atom_radii.size() )
{
std::ostringstream str;
str << "Mask calculation: number of atomic coordinates and radii"
" must be the same. Provided: coordinates= " << sites_frac.size()
<< " radii= " << atom_radii.size();
throw error(str.str());
}
this->asu_atoms.clear();
const scitbx::af::tiny<double,6> rcell = cell.reciprocal_parameters();
const scitbx::double3 rp(rcell[0], rcell[1], rcell[2]);
scitbx::af::shared< cctbx::sgtbx::rt_mx > symops_ = group.all_ops();
scitbx::af::const_ref< cctbx::sgtbx::rt_mx > symops = symops_.const_ref();
const size_t order = symops.size();
MMTBX_ASSERT( order == group.order_z() );
const signed char n_corners = 2;
scitbx::double3 asu_box[n_corners];
this->get_expanded_asu_boundaries(asu_box[0], asu_box[1]);
// TODO: the assumption that asu is within [-1,1] has been removed. The
// asu can span multiple cells, that is not very good. It might lead to
// asu enclosing box being bigger than the unit cell, and require more
// atoms to be tested for intersection. Maybe need to create a
// transformation to bring asu into [-1,1]
const scitbx::vec3<int> cell_min = ifloor(asu_box[0]),
cell_max = iceil(asu_box[1]);
for(size_t iat=0; iat<sites_frac.size(); ++iat)
{
const scitbx::double3 at = sites_frac[iat];
const double at_r = atom_radii[iat];
const double radius = at_r + solvent_radius;
MMTBX_ASSERT( radius >= 0.0 );
scitbx::double3 box = rp * (radius*1.05);
scitbx::vec3<int> ibox = ifloor(box) + 2;
for(short idim=0; idim<3; ++idim)
if( ibox[idim] < 1 )
ibox[idim] = 1;
const scitbx::vec3<int> cmin = cell_min - ibox,
cmax = cell_max + ibox;
for(register size_t isym=0; isym<order; ++isym)
{
scitbx::double3 sym_at = symops[isym]*at;
sym_at -= scitbx::floor(sym_at);
scitbx::vec3<int> cell;
// In previous version there was mapping onto full cell
// so only atoms in the adjacent [1,+1] cells needed
// to be tested for the intersection with the asu.
// Because if the atom in the farther cell [+-n]
// is intersecting with the asu then so does the
// closer one.
// In this version, there is no mapping, so need
// to collect all intersecting atoms
for(cell[0] = cmin[0]; cell[0]<=cmax[0]; ++cell[0])
{
for(cell[1] = cmin[1]; cell[1]<=cmax[1]; ++cell[1])
{
for(cell[2] = cmin[2]; cell[2]<=cmax[2]; ++cell[2])
{
const scitbx::double3 sym_at_cell = sym_at + cell;
cctbx::sgtbx::asu::intersection_kind intersection
= cctbx::sgtbx::asu::none;
const scitbx::double3 atom_box[n_corners] = { sym_at_cell - box,
sym_at_cell + box };
CCTBX_ASSERT( scitbx::ge_all(atom_box[1], atom_box[0]) );
// TODO: improve intersection check to minimize
// number of intersecting atoms
if( scitbx::ge_all(atom_box[1], asu_box[0])
&& scitbx::le_all(atom_box[0], asu_box[1]) )
intersection = partially;
if( intersection != cctbx::sgtbx::asu::none )
{
// due to that there is no mapping onto full cell
// all atoms intersecting with the asu are required
this->asu_atoms.push_back(atom_t(sym_at_cell,at_r));
// TODO: possible optimization?
// test for fully intersecting atom:
// is_inside( every corner of atom box)
// and the atom box needs to be expanded by
// shrink_truncation_radius
// then break out from the symmetry loop
}
} // cell[2] loop
} // cel[1] loop
} // cell[0]
}
}
}
namespace {
typedef scitbx::af::c_grid_padded<3> padded_grid_t;
typedef scitbx::af::versa<double, padded_grid_t >
versa_3d_padded_real_array;
typedef scitbx::af::versa<std::complex<double>, padded_grid_t >
versa_3d_padded_complex_array;
}
versa_3d_padded_real_array
atom_mask::mask_data_whole_uc(unsigned char layer)
{
if( n_layers == 0 )
throw error("Must compute mask before calculating structure "
"factors");
const bool has_layers = n_layers > 1;
if( layer==0 && has_layers )
throw error("Mask has several layers. "
"Must specify non-zero layer for structure factors.");
if( layer==0 && !has_layers )
layer = 1;
if( layer>n_layers )
throw "Wrong mask solvent layer";
++layer; // solvent layers start from 2 in this->data
const mask_array_t &msk = this->get_mask();
const scitbx::int3 grid_full_cell = this->grid_size();
scitbx::fftpack::real_to_complex_3d<double> fft(grid_full_cell);
// m_real : physical dims, n_real - focus dims, m_real >= n_real
const scitbx::int3 mdim = fft.m_real(), ndim = fft.n_real();
MMTBX_ASSERT( ndim == grid_full_cell );
MMTBX_ASSERT( scitbx::le_all( ndim, mdim ) );
double n_bytes = sizeof(double);
for(unsigned char j=0; j<3U; ++j)
n_bytes *= mdim[j];
const std::size_t max_int = std::numeric_limits<std::size_t>::max()-3;
if( n_bytes > max_int || n_bytes <= 0.0 )
{
std::ostringstream str;
str << "mask fft size: " << mdim << " is too large.\n"
<< " It requires " << n_bytes << " Bytes. Maxumum possible: " << max_int
<< ". 64 bit OS and software may be required.";
throw error(str.str());
}
const padded_grid_t pad( mdim, ndim );
// TODO: optimize? padded_real could be a very huge array; filling it with
// 0 could be the slowest part of this routine apart from fft
versa_3d_padded_real_array padded_real(pad, 0.0);
// convert non-padded asu-sized integer mask to padded full-cell
// sized real array
scitbx::af::ref<double, padded_grid_t > prref = padded_real.ref();
scitbx::af::const_ref<data_type, grid_t > mskref = msk.const_ref();
scitbx::int3 imn, imx;
this->get_asu_boundaries(imn, imx); // [imn, imx)
std::vector<long> kc(imx[2]-imn[2]);
long kk = imn[2];
for(std::vector<long>::iterator it=kc.begin(); it!=kc.end(); ++it, ++kk)
{
long k_c = kk % ndim[2];
if( k_c <0 )
k_c += ndim[2];
*it = k_c;
}
MMTBX_ASSERT( kk==imx[2] );
scitbx::vec3<size_t> cn = prref.accessor().all();
scitbx::vec3<long> n( mskref.accessor().all() );
const long nynz = n[1]*n[2], cnynz = cn[1]*cn[2];
long j_c_b = imn[1] % ndim[1];
if( j_c_b<0 )
j_c_b += ndim[1];
j_c_b *= cn[2];
const long j_c_e = ndim[1] * cn[2];
const data_type *p_asu_x = &mskref(imn);
for(long i=imn[0]; i<imx[0]; ++i, p_asu_x += nynz )
{
register long i_c = i % ndim[0];
if( i_c<0 )
i_c += ndim[0];
const long ind_c_x = i_c*cnynz;
long ind_c_y = ind_c_x + j_c_b;
const long ind_c_y_e = ind_c_x + j_c_e;
const data_type *const p_asu_y_e = p_asu_x + (imx[1]-imn[1])*n[2];
for(const data_type *p_asu_y = p_asu_x; p_asu_y!=p_asu_y_e;
p_asu_y += n[2], ind_c_y += cn[2] )
{
if( ind_c_y == ind_c_y_e )
ind_c_y = ind_c_x;
const data_type *p_asu_z = p_asu_y;
for(std::vector<long>::const_iterator k_c=kc.begin(); k_c!=kc.end();
++k_c, ++p_asu_z)
{
const data_type t = *p_asu_z;
MMTBX_ASSERT( t.is_valid_for_fft() );
if( t.layer() == layer )
{
MMTBX_ASSERT( t.multiplicity() > 0 && !t.is_outside() );
prref[ ind_c_y + *k_c ] = t.multiplicity();
}
}
}
}
return padded_real;
}
scitbx::af::shared< std::complex<double> > atom_mask::structure_factors(
const scitbx::af::const_ref< cctbx::miller::index<> > &indices,
unsigned char layer)
{
versa_3d_padded_real_array padded_real =
atom_mask::mask_data_whole_uc(layer);
const scitbx::int3 grid_full_cell = this->grid_size();
scitbx::fftpack::real_to_complex_3d<double> fft(grid_full_cell);
const scitbx::int3 mdim = fft.m_real(), ndim = fft.n_real();
MMTBX_ASSERT( ndim == grid_full_cell );
MMTBX_ASSERT( scitbx::le_all( ndim, mdim ) );
boost::posix_time::ptime
tb = boost::posix_time::microsec_clock::local_time(), te;
fft.forward(padded_real); // in-place forward FFT
const padded_grid_t pad_complex( fft.n_complex(), fft.n_complex() );
versa_3d_padded_complex_array result(padded_real.handle(), pad_complex );
boost::posix_time::time_duration tdif =
boost::posix_time::microsec_clock::local_time() - tb;
debug_fft_time = tdif.total_milliseconds();
const cctbx::maptbx::structure_factors::from_map<double> the_from_map(
group,
false, // anomalous flag
indices,
result.const_ref(),
true); // conjugate_flag
const double scale = cell.volume()
/ ( ndim.product() * static_cast<double>(group.order_z()) );
// result.size() could be approx 1000 * the_from_map.data().size()
// this does not work :( the_from_map.data() *= scale;
scitbx::af::ref< std::complex<double> > dref = the_from_map.data().ref();
// scaling takes no time
for(scitbx::af::ref< std::complex<double> >::iterator i=dref.begin();
i!=dref.end(); ++i)
(*i) *= scale;
return the_from_map.data();
}
void atom_mask::determine_gridding(cctbx::sg_vec3 &grid, double resolution,
double factor) const
{
MMTBX_ASSERT( factor > 0.0 );
double step = resolution/factor;
if(step < 0.15) step = 0.15; // XXX arbitrary, see also masks.py
step = std::min(0.8, step); // XXX arbitrary, can lead to very large maps
const double d_min = 2.0*step, resolution_factor = 0.5;
const cctbx::sgtbx::search_symmetry_flags use_all(
true, // use_space_group_symmetry
0, // use_space_group_ltr, not used if use_space_group_symmetry==true
true, // use_seminvariants
true, // use_normalizer_k2l
true // use_normalizer_l2n
);
grid = cctbx::maptbx::determine_gridding<int>(cell, d_min,
resolution_factor, use_all, group.type());
}
void atom_mask::compute_accessible_surface(const atom_array_t & atoms,
const shells_array_t &shells)
{
cctbx::uctbx::unit_cell const& unit_cell = this->cell;
// Severe code duplication: cctbx/maptbx/average_densities.h
af::ref<data_type, grid_t > data_ref = data.ref();
scitbx::int3 n_g = this->grid_size();
const int nx = n_g[0];
const int ny = n_g[1];
const int nz = n_g[2];
MMTBX_ASSERT( nx>0 && ny>0 && nz>0 );
const f_t mr1= static_cast<f_t>(unit_cell.metrical_matrix()[0]); // a*a
const f_t mr5= static_cast<f_t>(unit_cell.metrical_matrix()[1]); // b*b
const f_t mr9= static_cast<f_t>(unit_cell.metrical_matrix()[2]); // c*c
// a*b*cos(gamma)
const f_t mr2= static_cast<f_t>(unit_cell.metrical_matrix()[3]);
// a*c*cos(beta)
const f_t mr3= static_cast<f_t>(unit_cell.metrical_matrix()[4]);
// c*b*cos(alpha)
const f_t mr6= static_cast<f_t>(unit_cell.metrical_matrix()[5]);
const f_t tmr2 = mr2*2; //2*a*b*cos(gamma);
const f_t tmr3 = mr3*2; //2*a*c*cos(beta);
const f_t tmr6 = mr6*2; //2*b*c*cos(alpha);
const f_t sx = 1/static_cast<f_t>(nx);
const f_t tsx= sx*2;
const f_t sxsq=mr1*sx*sx;
const f_t sy = 1/static_cast<f_t>(ny);
const f_t tsy= sy*2;
const f_t sysq=mr5*sy*sy;
const f_t sz = 1/static_cast<f_t>(nz);
const f_t tsz= sz*2;
const f_t szsq=mr9*sz*sz;
const f_t w1=mr1*sx*tsx; const f_t w4=mr5*sy*tsy;
const f_t w2=mr2*sx*tsy; const f_t w5=mr6*sy*tsz;
const f_t w3=mr3*sx*tsz; const f_t w6=mr9*sz*tsz;
const f_t tsxg1=tsx*mr1; const f_t tsyg4=tsy*mr2; const f_t tszg3=tsz*mr3;
const f_t tsxg4=tsx*mr2; const f_t tsyg5=tsy*mr5; const f_t tszg8=tsz*mr6;
const f_t tsxg7=tsx*mr3; const f_t tsyg8=tsy*mr6; const f_t tszg9=tsz*mr9;
f_t rp[3];
for(unsigned i=0;i<3;i++) {
rp[i] = static_cast<f_t>(unit_cell.reciprocal_parameters()[i]);
}
scitbx::int3 asu_min, asu_max;
this->get_expanded_asu_boundaries(asu_min, asu_max);
const scitbx::vec3<long> sz_asu(data_ref.accessor().all());
const long sz_yz = sz_asu[1]*sz_asu[2];
const long asu_off = sz_yz* asu_min[0] + sz_asu[2]* asu_min[1] + asu_min[2];
f_t shells_rad = 0.0;
for(shells_array_t::const_iterator sh=shells.begin(); sh!=shells.end();
++sh)
{
if( *sh < 0.0 || (*sh)>=std::numeric_limits<double>::max() )
{
std::stringstream str;
str << "Mask calculation: inapropriate radial shell width = " << *sh;
throw error(str.str());
}
shells_rad += *sh;
}
MMTBX_ASSERT( shells_rad>=0.0 );
shells_array_t layers_sq(shells.size()+2);
for(std::size_t i_site=0;i_site<atoms.size();i_site++) {
cctbx::fractional<> const& site = atoms[i_site].first;
const f_t xfi=static_cast<f_t>(site[0]);
const f_t yfi=static_cast<f_t>(site[1]);
const f_t zfi=static_cast<f_t>(site[2]);
const f_t atmrad = atoms[i_site].second;
MMTBX_ASSERT( atmrad >= 0.0 );
const f_t radsq=static_cast<f_t>(atmrad*atmrad);
const f_t prot_cutoff=static_cast<f_t>(atmrad+solvent_radius);
const f_t shell_cutoff = prot_cutoff + shells_rad;
MMTBX_ASSERT( layers_sq.size() == shells.size()+2 );
MMTBX_ASSERT( layers_sq.size() == n_layers+1 );
layers_sq[0] = radsq;
layers_sq[1] = prot_cutoff*prot_cutoff;
f_t csq = prot_cutoff;
for(unsigned ii=0; ii<shells.size(); ++ii)
{
MMTBX_ASSERT( shells[ii]>=0.0 );
csq += shells[ii];
layers_sq[2+ii] = csq*csq;
}
const f_t cutoff=shell_cutoff;
const f_t coas = cutoff*rp[0];
int x1box=ifloor(nx*(xfi-coas));
int x2box=1+iceil(nx*(xfi+coas));
const f_t cobs = cutoff*rp[1];
int y1box=ifloor(ny*(yfi-cobs));
int y2box=1+iceil(ny*(yfi+cobs));
const f_t cocs = cutoff*rp[2];
int z1box=ifloor(nz*(zfi-cocs));
int z2box=1+iceil(nz*(zfi+cocs));
x1box = std::max( x1box, static_cast<int>(asu_min[0]));
y1box = std::max( y1box, static_cast<int>(asu_min[1]));
z1box = std::max( z1box, static_cast<int>(asu_min[2]));
x2box = std::min( x2box, static_cast<int>(asu_max[0]));
y2box = std::min( y2box, static_cast<int>(asu_max[1]));
z2box = std::min( z2box, static_cast<int>(asu_max[2]));
const f_t sxbcen=xfi-x1box*sx;
const f_t sybcen=yfi-y1box*sy;
const f_t szbcen=zfi-z1box*sz;
const f_t distsm=mr1*sxbcen*sxbcen+mr5*sybcen*sybcen+mr9*szbcen*szbcen
+tmr2*sxbcen*sybcen+tmr3*sxbcen*szbcen+tmr6*sybcen*szbcen;
const f_t w7=tsxg1*sxbcen+tsxg4*sybcen+tsxg7*szbcen;
const f_t w8=tsyg4*sxbcen+tsyg5*sybcen+tsyg8*szbcen;
const f_t w9=tszg3*sxbcen+tszg8*sybcen+tszg9*szbcen;
register f_t distsx = distsm;
register f_t s1xx = sxsq - w7;
register f_t s1xy = sysq - w8;
register f_t s1xz = szsq - w9;
const long ind_x_max = sz_yz*x2box - asu_off;
const long yba1 = y1box*sz_asu[2], yba2 = y2box*sz_asu[2];
for(register long ind_x = x1box*sz_yz - asu_off ; ind_x<ind_x_max;
ind_x+=sz_yz)
{
register f_t s2yz = s1xz;
register f_t s2_incr = s1xy;
register f_t s2 = distsx;
const long ind_y_max = ind_x + yba2;
for(register long ind_y=ind_x+yba1; ind_y<ind_y_max; ind_y+=sz_asu[2])
{
register f_t s3_incr = s2yz;
register f_t dist = s2;
const long ind_z_max = ind_y+z2box;
for(register long ind_z=ind_y+z1box; ind_z<ind_z_max; ++ind_z)
{
const f_t dist_c = dist;
for(unsigned ii=0; ii<layers_sq.size(); ++ii)
{
if( dist_c < layers_sq[ii] )
{
data_type& dr = data_ref[ind_z];
if( dr.layer() > ii )
dr.set(ii, ii==0?0:dr.multiplicity());
break;
}
}
dist += s3_incr;
s3_incr += w6;
} // z-box loop
s2 += s2_incr;
s2_incr += w4;
s2yz += w5;
} // y-box loop
distsx += s1xx;
s1xx += w1;
s1xy += w2;
s1xz += w3;
} // x-box loop
} //atom loop
return;
}
typedef af::const_ref< cctbx::sgtbx::rt_mx > symop_array;
void find_neighbors(
std::vector<long> &table,
cctbx::uctbx::unit_cell const& unit_cell,
af::c_grid<3>::index_type const& gridding_n_real,
const scitbx::vec3<long> &na,
double shrink_truncation_radius)
{
int low[3];
int high[3];
for(unsigned i=0;i<3;i++) {
double x = shrink_truncation_radius
* unit_cell.reciprocal_parameters()[i]
* gridding_n_real[i];
low[i] = ifloor(-x);
high[i] = iceil(x);
}
const int n0 = static_cast<int>(gridding_n_real[0]);
const int n1 = static_cast<int>(gridding_n_real[1]);
const int n2 = static_cast<int>(gridding_n_real[2]);
const f_t shrink_truncation_radius_sq = shrink_truncation_radius
* shrink_truncation_radius;
cctbx::fractional<f_t> frac;
for(int p0=low[0];p0<=high[0];p0++)
{
frac[0] = static_cast<f_t>(p0) / n0;
for(int p1=low[1];p1<=high[1];p1++)
{
frac[1] = static_cast<f_t>(p1) / n1;
for(int p2=low[2];p2<=high[2];p2++)
{
frac[2] = static_cast<f_t>(p2) / n2;
f_t dist_sq = unit_cell.length_sq(frac);
if (dist_sq < shrink_truncation_radius_sq)
table.push_back(p0*(na[1]*na[2]) + p1*na[2] + p2);
} // z
} // y
} // x
}
void atom_mask::compute_contact_surface()
{
typedef double f_t;
cctbx::uctbx::unit_cell const& unit_cell = this->cell;
register size_t nsolv = 0;
af::ref<data_type, asu_grid_t > data_ref = data.ref();
std::size_t data_size = data_ref.size();
af::small<std::size_t,max_n_layers+2U> nsolvs;
nsolvs.resize(this->n_solvent_layers()+2U,0UL);
if(shrink_truncation_radius == 0) {
for(std::size_t ilxyz=0;ilxyz<data_size;ilxyz++)
{
data_type &d = data_ref[ilxyz];
if( d.is_contact() || d.is_outside() )
d.set_zero();
nsolv += static_cast<size_t>(d.multiplicity());
nsolvs[d.layer()] += static_cast<size_t>(d.multiplicity());
}
contact_surface_fraction = accessible_surface_fraction
= static_cast<double>(nsolv) / this->grid_size_1d();
}
else
{
af::versa<data_type, asu_grid_t > datacopy = data.deep_copy();
const af::const_ref<data_type, asu_grid_t > datacopy_ref
= datacopy.const_ref();
const scitbx::vec3<long> n(datacopy_ref.accessor().all());
std::vector<long> neighbors;
find_neighbors(neighbors, unit_cell, this->grid_size(), n,
shrink_truncation_radius);
MMTBX_ASSERT(neighbors.size()>0U);
size_t n_access=0;
const data_type *datacopy_ptr = datacopy_ref.begin();
for(data_type *data_ptr = data_ref.begin(); data_ptr!=data_ref.end();
++data_ptr, ++datacopy_ptr)
{
const data_type d_copy = *datacopy_ptr;
data_type &dr = *data_ptr;
if( d_copy.is_outside() )
dr.set_zero();
else if( d_copy.is_solvent() )
n_access += static_cast<size_t>( d_copy.multiplicity() );
else if( d_copy.is_contact() )
{
for(std::vector<long>::const_iterator neighbor=neighbors.begin();
neighbor!=neighbors.end(); ++neighbor)
{
// neighbor could be outside the asu, but must be inside the
// expanded asu
if( datacopy_ptr[*neighbor].is_solvent() )
{
MMTBX_ASSERT( dr.is_contact() );
dr.set_nearest_solvent();
MMTBX_ASSERT( dr.multiplicity() > 0 );
MMTBX_ASSERT( dr.is_solvent() );
goto end_of_neighbors_loop;
}
}
dr.set_zero();
end_of_neighbors_loop:;
}
nsolv += dr.multiplicity();
nsolvs[dr.layer()] += static_cast<size_t>(dr.multiplicity());
} // data_ref array
// currently data is not padded 3-D array, data.size is correct here
contact_surface_fraction = static_cast<double>(nsolv)/this->grid_size_1d();
accessible_surface_fraction = static_cast<double>(n_access)
/ this->grid_size_1d();
}
layer_volume_fractions_.resize(this->n_solvent_layers(),0.0);
std::size_t nsolvt=0;
for(unsigned short j=2; j<nsolvs.size(); ++j)
{
layer_volume_fractions_[j-2] = nsolvs[j]/static_cast<double>(this->grid_size_1d());
nsolvt += nsolvs[j];
}
MMTBX_ASSERT( nsolv == nsolvt );
}
// writing as xplor map is stolen from iotbx/xplor/boost_python/xplor_ext.cpp
// which is inaccessible from C++
namespace
{
template <unsigned Width>
struct format_e
{
static void
throw_error()
{
throw scitbx::error("Floating-point value too large for format.");
}
format_e(const char* fmt, double val)
{
#if !defined(BOOST_MSVC)
s = buf;
std::sprintf(buf, fmt, val);
if (*(s + Width)) throw_error();
#else
s = buf + 1;
std::sprintf(s, fmt, val);
char* p = s + Width;
if (*p) {
p++;
if (*p) throw_error();
}
else {
s--;
*s = ' ';
}
if (*(p-3) != '0') throw_error();
*(p-3) = *(p-2);
*(p-2) = *(p-1);
*(p-1) = '\0';
#endif
}
char buf[32];
char* s;
};
FILE*
write_head(
std::string const& file_name,
cctbx::uctbx::unit_cell const& unit_cell,
const scitbx::af::int3 &n,
const scitbx::af::int3 &first,
const scitbx::af::int3 &last)
{
FILE* fh = fopen(file_name.c_str(), "wb");
MMTBX_ASSERT(fh != 0);
fprintf(fh, "\n%8d !NTITLE\n", 1);
fprintf(fh, "%-264s\n", " REMARKS atom_mask::xplor_write...");
fprintf(fh, " %7d %7d %7d %7d %7d %7d %7d %7d %7d\n", n[0], first[0],
last[0], n[1], first[1], last[1], n[2], first[2], last[2]);
for(std::size_t i=0;i<6;i++) {
fprintf(fh, "%s",
format_e<12>("%12.5E", unit_cell.parameters()[i]).s);
}
fprintf(fh, "\n");
fprintf(fh, "ZYX\n");
return fh;
}
void
write_tail(
FILE* fh,
double average,
double standard_deviation)
{
fprintf(fh, " -9999\n");
fprintf(fh, "%s%s\n",
format_e<12>("%12.4E", average).s,
format_e<12>("%12.4E", standard_deviation).s);
fclose(fh);
}
} // namespace {
void atom_mask::xplor_write_map(std::string const& file_name,
unsigned char layer, bool invert)
{
if( n_layers == 0 )
throw error("Must compute mask before saving it.");
const bool has_layers = n_layers > 1;
if( layer==0 && has_layers )
throw error("Mask has several layers. "
"Must specify non-zero layer to save.");
if( layer==0 && !has_layers )
layer = 1;
if( layer>n_layers )
throw error("Wrong mask solvent layer");
++layer; // solvent layers start from 2 in this->data
const double one = (invert ? 0.0 : 1.0),
zero = (invert ? 1.0 : 0.0);
const mask_array_t &msk = this->get_mask();
scitbx::af::const_ref<data_type, grid_t > mskref = msk.const_ref();
scitbx::int3 imn, imx;
this->get_asu_boundaries(imn, imx); // [imn, imx)
FILE* fh = write_head(file_name, this->cell, this->grid_size(), imn,
imx-scitbx::int3(1,1,1));
register double mean = 0.0, esd = 0.0;
register std::size_t n=0;
for(long iz=imn[2]; iz<imx[2]; ++iz)
{
fprintf(fh, "%8lu\n", static_cast<unsigned long>(iz));
int i_fld = 0;
for(long iy=imn[1]; iy<imx[1]; ++iy)
{
for(long ix=imn[0]; ix<imx[0]; ++ix)
{
const scitbx::int3 pos(ix,iy,iz);
const data_type t = mskref(pos);
const double d = ((t.layer() == layer) ? one : zero);
mean += d;
esd += d*d;
++n;
fprintf(fh, "%s", format_e<12>("%12.5E", d).s);
i_fld++;
if (i_fld == 6)
{
fprintf(fh, "\n");
i_fld = 0;
}
} // x-loop
} // y-loop
if (i_fld > 0) {
fprintf(fh, "\n");
}
} // z-loop
MMTBX_ASSERT(n>=1.0);
mean /= n;
esd = esd / n - mean*mean;
MMTBX_ASSERT(esd>=0.0);
esd = std::sqrt(esd);
write_tail(fh, mean, esd);
}
bool is_nice(const cctbx::sgtbx::rot_mx &rot_mx)
{
int den = rot_mx.den();
CCTBX_ASSERT( den!=0 );
const std::size_t sz = rot_mx.num().size();
CCTBX_ASSERT( sz==9 );
for(int j=0; j<sz; ++j)
{
const int e = rot_mx[j];
if( e != den && e!=-den && e!=0 )
return false;
}
return true;
}
inline bool is_nice(const cctbx::sgtbx::rt_mx &rt_mx)
{
return is_nice(rt_mx.r());
}
bool is_nice(const cctbx::sgtbx::space_group &g)
{
for(int i=0; i<g.n_smx(); ++i)
{
if( !is_nice(g.smx(i)) )
return false;
}
return true;
}
void generate_groups(std::set<std::string> &halls,
const std::string &group_symbol, int ncb)
{
halls.clear();
cctbx::sgtbx::space_group_symbols symbol(group_symbol);
const cctbx::sgtbx::space_group sg_def(symbol);
CCTBX_ASSERT( is_nice(sg_def) );
halls.insert("Hall: "+sg_def.type().hall_symbol());
int n = 0;
int na = 0;
int nf = 0;
boost::mt19937 rng; // produces randomness out of thin air
const int i_max = 2;
boost::uniform_int<> six(-i_max,i_max); // distribution
const double n_max = 1.5*std::pow(2.0*i_max+1.0,9.0);
boost::variate_generator<boost::mt19937&, boost::uniform_int<> >
die(rng, six); // glues randomness with mapping
while( true )
{
n = n + 1;
if( n>ncb*100000 || static_cast<double>(n)>n_max )
break;
cctbx::sgtbx::rot_mx rot_mx;
for(int i=0; i<rot_mx.num().size(); ++i)
rot_mx[i] = die();
cctbx::sgtbx::tr_vec tr;
for(int i=0; i<tr.num().size(); ++i)
tr[i] = die();
if( !((rot_mx.determinant()== 1) && rot_mx.is_valid()) )
continue;
const cctbx::sgtbx::rt_mx rt_mx( rot_mx ); //, tr)
if( !rt_mx.is_valid() )
continue;
std::string h("Hall: ");
cctbx::sgtbx::space_group g;
try
{
const cctbx::sgtbx::change_of_basis_op cb(rt_mx);
if( (!cb.is_valid()) || cb.is_identity_op() )
continue;
g = sg_def.change_basis(cb);
const cctbx::sgtbx::space_group_type t = g.type();
h += t.hall_symbol();
}
catch( const std::exception &)
{
nf = nf+1;
continue;
}
if( !is_nice(g) )
continue;
halls.insert(h);
na = na + 1;
if( halls.size()>=ncb+1 )
break;
} // while(true)
return;
}
}} // namespace mmtbx::masks
|
018dd8035e3d4073439e1ea187aaffc74a6f7427
|
0549dff066db857ffe7e480b37d86430219c9b05
|
/field-force-cpp/field-force-cpp/game/gameconstants.cpp
|
0e44c476fb9d76ace65fef49c5fa0404f7eeeab7
|
[] |
no_license
|
ksburhan/field-force-ais
|
3e97e8bf9247700bf239eab836f013aa836ca199
|
721c7f32d16a0b2edfe9d7c84e0e1d43aaee85e5
|
refs/heads/main
| 2023-08-24T18:32:27.002054
| 2021-09-29T15:47:30
| 2021-09-29T15:47:30
| 378,616,790
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 26
|
cpp
|
gameconstants.cpp
|
#include "gameconstants.h"
|
d08e354e92e4bc9fc9fe8c520d32bee8b9a2e731
|
821e687d7ed2544c44f61cc210e8b65d5245f0cf
|
/Source/JRPG_Learn/UI/PlayerUnitsListUI.h
|
9663ea93c6457099eb76b32baf58f3b77b33510c
|
[] |
no_license
|
Demonmal/JRPG_Learn
|
3b902778f2ad8022ad504c572984b52884619986
|
ad4a2f944b23cb0905c62cca1358a4e6c31ef317
|
refs/heads/main
| 2023-03-27T16:22:17.258745
| 2021-03-25T15:26:33
| 2021-03-25T15:26:33
| 348,419,416
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 791
|
h
|
PlayerUnitsListUI.h
|
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "PlayerUnitsListUI.generated.h"
class APlayerUnitBase;
class ABattleController;
UCLASS()
class JRPG_LEARN_API UPlayerUnitsListUI : public UUserWidget
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable)
void SetPlayerUnitUIList(TArray<APlayerUnitBase *> PlayerUnits, ABattleController *BattleController);
UFUNCTION(BlueprintCallable)
void DisplayUnitUI(APlayerUnitBase *PlayerUnit, ABattleController *BattleController);
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TSubclassOf<class UPlayerUnitUI> PlayerUnitUIClass;
UPROPERTY(BlueprintReadOnly, meta = (BindWidget))
class UHorizontalBox* PlayerUnitList;
};
|
c7646ce1c8125ed125987949df236d6c1fd2c88a
|
59255ea212337bb849e640e3108f43764c23f87a
|
/xrtl/ui/window_demo.cc
|
0d01d16a961f3be5bfcf445070b69751d6e7764d
|
[
"Apache-2.0"
] |
permissive
|
NeoTim/xrtl
|
2aea04e0768590cc68c75c57273c9c221bcc621e
|
8cf0e7cd67371297149bda8e62d03b8c1e2e2dfe
|
refs/heads/master
| 2021-09-18T19:37:25.148899
| 2018-07-18T17:48:33
| 2018-07-18T17:48:33
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,425
|
cc
|
window_demo.cc
|
// Copyright 2017 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "xrtl/testing/demo_main.h"
#include "xrtl/base/logging.h"
#include "xrtl/base/threading/event.h"
#include "xrtl/base/threading/thread.h"
#include "xrtl/ui/window.h"
namespace xrtl {
namespace ui {
namespace {
class WindowDemo : private Control::Listener, private Control::InputListener {
public:
WindowDemo() {
message_loop_ = MessageLoop::Create();
done_event_ = Event::CreateFence();
}
~WindowDemo() { Thread::Wait(message_loop_->Exit()); }
ref_ptr<WaitHandle> Run() {
window_ = Window::Create(message_loop_);
window_->set_title("Window Demo");
auto control = window_->root_control();
control->set_listener(this);
control->set_input_listener(this);
control->set_size({640, 480});
control->set_background_color({255, 0, 0, 255});
Thread::Wait(window_->Open());
return done_event_;
}
private:
void OnError(ref_ptr<Control> target) override {
LOG(INFO) << "OnError";
done_event_->Set();
}
void OnCreating(ref_ptr<Control> target) override {
LOG(INFO) << "OnCreating";
}
void OnCreated(ref_ptr<Control> target) override { LOG(INFO) << "OnCreated"; }
void OnDestroying(ref_ptr<Control> target) override {
LOG(INFO) << "OnDestroying";
}
void OnDestroyed(ref_ptr<Control> target) override {
LOG(INFO) << "OnDestroyed";
done_event_->Set();
}
void OnSystemThemeChanged(ref_ptr<Control> target) override {
LOG(INFO) << "OnSystemThemeChanged";
}
void OnSuspendChanged(ref_ptr<Control> target, bool is_suspended) override {
LOG(INFO) << "OnSuspendChanged: " << is_suspended;
}
void OnFocusChanged(ref_ptr<Control> target, bool is_focused) override {
LOG(INFO) << "OnFocusChanged: " << is_focused;
}
void OnResized(ref_ptr<Control> target, Rect2D bounds) override {
LOG(INFO) << "OnResized: " << bounds.origin.x << "," << bounds.origin.y
<< " " << bounds.size.width << "x" << bounds.size.height;
}
void OnKeyDown(ref_ptr<Control> target, const KeyboardEvent& ev) override {
LOG(INFO) << "OnKeyDown: " << ev.key_code();
}
void OnKeyUp(ref_ptr<Control> target, const KeyboardEvent& ev) override {
LOG(INFO) << "OnKeyUp: " << ev.key_code();
}
void OnKeyPress(ref_ptr<Control> target, const KeyboardEvent& ev) override {
LOG(INFO) << "OnKeyPress: " << ev.key_code();
}
void OnMouseDown(ref_ptr<Control> target, const MouseEvent& ev) override {
LOG(INFO) << "OnMouseDown: " << ev.control_offset_px().x << ","
<< ev.control_offset_px().y << " b"
<< static_cast<int>(ev.action_button());
}
void OnMouseUp(ref_ptr<Control> target, const MouseEvent& ev) override {
LOG(INFO) << "OnMouseUp: " << ev.control_offset_px().x << ","
<< ev.control_offset_px().y << " b"
<< static_cast<int>(ev.action_button());
}
void OnMouseOut(ref_ptr<Control> target, const MouseEvent& ev) override {
LOG(INFO) << "OnMouseOut: " << ev.control_offset_px().x << ","
<< ev.control_offset_px().y;
}
void OnMouseMove(ref_ptr<Control> target, const MouseEvent& ev) override {
LOG(INFO) << "OnMouseMove: " << ev.control_offset_px().x << ","
<< ev.control_offset_px().y;
}
void OnMouseWheel(ref_ptr<Control> target, const MouseEvent& ev) override {
LOG(INFO) << "OnMouseWheel: " << ev.control_offset_px().x << ","
<< ev.control_offset_px().y << " d" << ev.wheel_delta();
}
ref_ptr<MessageLoop> message_loop_;
ref_ptr<Window> window_;
ref_ptr<Event> done_event_;
};
int MyEntry(int argc, char** argv) {
auto demo = absl::make_unique<WindowDemo>();
Thread::Wait(demo->Run());
demo.reset();
LOG(INFO) << "Clean exit!";
return 0;
}
} // namespace
} // namespace ui
} // namespace xrtl
DECLARE_ENTRY_POINT(xrtl::ui::MyEntry);
|
8126299cbce092bb20292a651c686d7bd4fe1827
|
9e4ba85e274c767b04a3be759e546a09d3a58d81
|
/cool-tree.handcode.h
|
0c5332a0b18591574c989dc70aa9b34dcd8f5cb4
|
[] |
no_license
|
kzjeef/coolang
|
84652d17734effceb555b09a0ee26da23b834ac4
|
028999d4bfa221920d0b11287109b0c822b89afc
|
refs/heads/master
| 2021-01-23T03:27:41.886096
| 2013-03-29T09:54:55
| 2013-03-29T09:54:55
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 6,996
|
h
|
cool-tree.handcode.h
|
//
// The following include files must come first.
#ifndef COOL_TREE_HANDCODE_H
#define COOL_TREE_HANDCODE_H
#include <iostream>
#include "tree.h"
#include "cool.h"
#include "stringtab.h"
#define yylineno curr_lineno;
extern int yylineno;
inline Boolean copy_Boolean(Boolean b) {return b; }
inline void assert_Boolean(Boolean) {}
inline void dump_Boolean(ostream& stream, int padding, Boolean b)
{ stream << pad(padding) << (int) b << "\n"; }
void dump_Symbol(ostream& stream, int padding, Symbol b);
void assert_Symbol(Symbol b);
Symbol copy_Symbol(Symbol b);
class Program_class;
typedef Program_class *Program;
class Class__class;
typedef Class__class *Class_;
class Feature_class;
typedef Feature_class *Feature;
class Formal_class;
typedef Formal_class *Formal;
class Expression_class;
typedef Expression_class *Expression;
class Case_class;
typedef Case_class *Case;
typedef list_node<Class_> Classes_class;
typedef Classes_class *Classes;
typedef list_node<Feature> Features_class;
typedef Features_class *Features;
typedef list_node<Formal> Formals_class;
typedef Formals_class *Formals;
typedef list_node<Expression> Expressions_class;
typedef Expressions_class *Expressions;
typedef list_node<Case> Cases_class;
typedef Cases_class *Cases;
#define Program_EXTRAS \
virtual void semant() = 0; \
virtual void dump_with_types(ostream&, int) = 0;
#define public_accessor(type, mem) type get_##mem() { return mem; }
#define program_EXTRAS \
void semant(); \
void dump_with_types(ostream&, int);
#define Class__EXTRAS \
virtual Symbol get_filename() = 0; \
virtual void dump_with_types(ostream&,int) = 0;
#define class__EXTRAS \
Symbol get_filename() { return filename; } \
void dump_with_types(ostream&,int);
#define Class__SHARED_EXTRAS \
public_accessor(Symbol, name) \
public_accessor(Symbol, parent) \
public_accessor(Features, features)
#define Feature_EXTRAS \
virtual void dump_with_types(ostream&,int) = 0;
#define Feature_SHARED_EXTRAS \
public_accessor(Symbol, name) \
void dump_with_types(ostream&,int);
#define attr_EXTRAS \
public_accessor(Expression, init) \
public_accessor(Symbol, type_decl)
#define method_EXTRAS \
public_accessor(Formals, formals) \
public_accessor(Symbol, return_type) \
public_accessor(Expression, expr) \
void set_return_type(Symbol t) { return_type = copy_Symbol(t); }
#define Formal_EXTRAS \
virtual void dump_with_types(ostream&,int) = 0;
#define Formal_SHARED_EXTRAS \
public_accessor(Symbol, name) \
public_accessor(Symbol, type_decl)
#define no_expr_EXTRAS \
virtual bool is_no_expr() { return true; }
#define formal_EXTRAS \
void dump_with_types(ostream&,int);
#define assign_EXTRAS \
public_accessor(Symbol, name) \
public_accessor(Expression, expr)
#define plus_EXTRAS \
public_accessor(Expression, e1) \
public_accessor(Expression, e2)
#define sub_EXTRAS \
public_accessor(Expression, e1) \
public_accessor(Expression, e2)
#define mul_EXTRAS \
public_accessor(Expression, e1) \
public_accessor(Expression, e2)
#define divide_EXTRAS \
public_accessor(Expression, e1) \
public_accessor(Expression, e2)
#define neg_EXTRAS \
public_accessor(Expression, e1)
#define new__EXTRAS \
public_accessor(Symbol, type_name)
#define dispatch_EXTRAS \
public_accessor(Expression, expr) \
public_accessor(Symbol, name) \
public_accessor(Expressions, actual)
#define static_dispatch_EXTRAS \
public_accessor(Expression, expr) \
public_accessor(Symbol, type_name) \
public_accessor(Symbol, name) \
public_accessor(Expressions, actual)
#define branch_EXTRAS \
public_accessor(Symbol, name) \
public_accessor(Symbol, type_decl) \
public_accessor(Expression, expr) \
void dump_with_types(ostream& ,int);
#define cond_EXTRAS \
public_accessor(Expression, pred) \
public_accessor(Expression, then_exp) \
public_accessor(Expression, else_exp)
#define loop_EXTRAS \
public_accessor(Expression, pred) \
public_accessor(Expression, body)
#define typcase_EXTRAS \
public_accessor(Expression, expr) \
public_accessor(Cases, cases)
#define let_EXTRAS \
public_accessor(Symbol, identifier) \
public_accessor(Symbol, type_decl) \
public_accessor(Expression, init) \
public_accessor(Expression, body)
#define lt_EXTRAS \
public_accessor(Expression, e1) \
public_accessor(Expression, e2)
#define eq_EXTRAS \
public_accessor(Expression, e1) \
public_accessor(Expression, e2)
#define leq_EXTRAS \
public_accessor(Expression, e1) \
public_accessor(Expression, e2)
#define comp_EXTRAS \
public_accessor(Expression, e1)
#define bool_const_EXTRAS \
public_accessor(Boolean, val)
#define isvoid_EXTRAS \
public_accessor(Expression, e1)
#define Case_EXTRAS \
virtual void dump_with_types(ostream& ,int) = 0;
#define block_EXTRAS \
public_accessor(Expressions,body)
#define object_EXTRAS \
public_accessor(Symbol, name)
#define Expression_EXTRAS \
Symbol type; \
Symbol get_type() { return type; } \
Expression set_type(Symbol s) { type = s; return this; } \
virtual void dump_with_types(ostream&,int) = 0; \
virtual bool is_no_expr() { return false; } \
void dump_type(ostream&, int); \
Expression_class() { type = (Symbol) NULL; }
#define Expression_SHARED_EXTRAS \
void dump_with_types(ostream&,int);
#endif
|
ad67e04ddef75964087174899cc0a8042a8f1bce
|
5885fd1418db54cc4b699c809cd44e625f7e23fc
|
/fb-hackercup/2019/round3/c.cpp
|
4a13d389ac040939882a354114bcbddea7e8162e
|
[] |
no_license
|
ehnryx/acm
|
c5f294a2e287a6d7003c61ee134696b2a11e9f3b
|
c706120236a3e55ba2aea10fb5c3daa5c1055118
|
refs/heads/master
| 2023-08-31T13:19:49.707328
| 2023-08-29T01:49:32
| 2023-08-29T01:49:32
| 131,941,068
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,265
|
cpp
|
c.cpp
|
#include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// DON'T USE THESE MACROS DURING ICPC PRACTICE
#define For(i,n) for (int i=0; i<n; i++)
#define FOR(i,a,b) for (int i=a; i<=b; i++)
#define Down(i,n) for (int i=n-1; i>=0; i--)
#define DOWN(i,a,b) for (int i=b; i>=a; i--)
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef complex<ld> pt;
typedef vector<pt> pol;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
const char nl = '\n';
const ll INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9+7;
const ld EPS = 1e-10;
template <class T, class U>
ostream& operator << (ostream& os, const pair<T,U>& v) {
return os << '(' << v.first << ',' << v.second << ')';
}
template <class T>
ostream& operator << (ostream& os, const vector<T>& v) {
for (const T& it : v) os << it << " "; return os;
}
template <class T>
ostream& operator << (ostream& os, const set<T>& v) {
os << "{ "; for (const T& it : v) os << it << " ";
return os << '}';
}
template <class T, class U>
ostream& operator << (ostream& os, const map<T,U>& v) {
os << "{ "; for (const pair<T,U>& it : v) os << it << " ";
return os << '}';
}
////////////////////////////////////////////////////////////////////////
const int N = 6e3+1;
const int L = 15;
ll fact[N], invf[N];
ll power(ll b, ll e) {
ll r = 1;
for ( ; e>0; e/=2) {
if (e&1) r = r*b % MOD;
b = b*b % MOD;
}
return r;
}
ll inverse(ll n) {
return power(n, MOD-2);
}
ll ncr(ll n, ll r) {
if (r<0 || r>n) return 0;
return fact[n] * invf[r] % MOD * invf[n-r] % MOD;
}
void solve();
void init() {
fact[0] = invf[0] = 1;
FOR(i,1,N-1) {
fact[i] = i * fact[i-1] % MOD;
invf[i] = inverse(fact[i]);
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
init();
int T;
cin >> T;
for (int cc = 1; cc <= T; cc++) {
cout << "Case #" << cc << ": ";
solve();
}
return 0;
}
////////////////////////////////////////////////////////////////////////
ll p[N], d[N];
ll anc[N][L];
vector<int> adj[N];
void precomp(int u) {
d[u] = d[p[u]]+1;
anc[u][0] = p[u];
FOR(j,1,L-1) {
anc[u][j] = anc[anc[u][j-1]][j-1];
}
for (int v : adj[u]) {
precomp(v);
}
}
int lca(int a, int b) {
if (d[a] < d[b]) {
swap(a,b);
}
Down(j,L) {
if (d[anc[a][j]] >= d[b]) {
a = anc[a][j];
}
}
if (a == b) return a;
assert(d[a] == d[b]);
Down(j,L) {
if (anc[a][j] != anc[b][j]) {
a = anc[a][j];
b = anc[b][j];
}
}
return anc[a][0];
}
void caseinit() {
memset(anc, 0, sizeof anc);
For(i,N) {
adj[i].clear();
}
}
void solve() {
caseinit();
int n, k, a, b;
cin >> n >> k >> a >> b;
ll invn = inverse(n-1);
// keep, collapse
function<ll(ll)> prob0 = [=] (ll x) {
assert(x <= n-1);
ll pgood = (n-1-x) * invn % MOD;
return power(pgood, k);
};
function<ll(ll)> prob1 = [=] (ll x) {
assert(x+1 <= n-1);
ll r = (n-1-x-1) * inverse(n-1-x) % MOD;
ll s = power(n-1-x, k-1) * power(invn, k) % MOD;
ll res = s * (1-power(r,k)) % MOD * inverse(1-r) % MOD;
return (res + MOD) % MOD;
};
function<ll(ll)> prob2 = [=] (ll x) {
ll notone = 2 * prob1(x+1) % MOD;
ll nottwo = prob0(x+2);
ll total = prob0(x);
return (total + MOD-notone + MOD-nottwo) % MOD;
};
FOR(i,2,n) {
cin >> p[i];
adj[p[i]].push_back(i);
}
precomp(1);
int c = lca(a,b);
// probability of not collapsing to lca
ll plca = prob0(d[a]-d[c] + d[b]-d[c]);
ll ans = plca * (d[a]-d[c] + d[b]-d[c]) % MOD;
for (int u=a, i=0; u; u=p[u], i++) {
for (int v=b, j=0; v; v=p[v], j++) {
if (d[u]<=d[c] && d[v]<=d[c]) continue;
if (u==1) {
assert(v!=1);
ans += prob1(i+j) * (i+j+1) % MOD;
} else if (v==1) {
ans += prob1(i+j) * (i+j+1) % MOD;
} else {
ans += prob2(i+j) * (i+j+2) % MOD;
}
}
}
cout << ans % MOD << nl;
return;
}
|
870c293e007ada5d5959020d2bca3fb5b90f51a7
|
05e27725e35622404dac5234868f6cb7c5ee8eac
|
/checkers/checker.cpp
|
a2747d63408e217a2a13afbf5ac8e8aad7d1d25c
|
[] |
no_license
|
anahitH/controlflow-integrity
|
1a5376baa0922d2c2fc1cda3482cf8f35dffa1cc
|
11bfccd59f638233f5d8756adb6cb32dcf970193
|
refs/heads/master
| 2021-01-22T03:31:23.010469
| 2017-07-24T16:44:52
| 2017-07-24T16:44:52
| 92,387,025
| 3
| 2
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,357
|
cpp
|
checker.cpp
|
#include <iostream>
#include <cstdarg>
#include <unordered_set>
#include <execinfo.h>
#include <unistd.h>
#define UNW_LOCAL_ONLY
#include <libunwind.h>
#include <boost/functional/hash.hpp>
#include <unordered_set>
#include <unordered_map>
#include <chrono>
size_t get_hash_of_string(const std::string& str)
{
boost::hash<std::string> string_hash;
return string_hash(str);
}
class call_stack_mgr
{
public:
static call_stack_mgr& get()
{
static call_stack_mgr mgr;
return mgr;
}
public:
size_t get_stack_hash(bool *callStackFail);
private:
std::unordered_map<unw_word_t, std::string> function_addresses;
};
size_t call_stack_mgr::get_stack_hash(bool *callStackFail)
{
size_t hash = 0;
char name[256];
int resp = 10;
unw_cursor_t cursor;
unw_context_t uc;
unw_getcontext (&uc);
unw_init_local (&cursor, &uc);
std::unordered_set<std::string> processed;
while ((resp = unw_step(&cursor)) > 0) {
unw_word_t offset, pc;
unw_get_reg(&cursor, UNW_REG_IP, &pc);
if (pc == 0) {
//printf("pc\n");
break;
}
//printf("0x%lx:\n", pc);
auto name_pos = function_addresses.find(pc);
if (name_pos != function_addresses.end()) {
if (name_pos->second == "check") {
continue;
}
if (!processed.insert(name_pos->second).second) {
continue;
}
//printf("\tsaved\t%s\n", name_pos->second.c_str());
hash ^= get_hash_of_string(name_pos->second);
//printf("use existing name %s\n", name_pos->second.c_str());
if (name_pos->second == "main") {
break;
}
continue;
}
//printf("no existing name. get from stack\n");
char sym[256];
if (unw_get_proc_name(&cursor, sym, sizeof(sym), &offset) == 0) {
std::string f_name = std::string(sym);
auto dyninst_pos = f_name.find("_dyninst");
if (dyninst_pos != std::string::npos) {
f_name = f_name.substr(0, dyninst_pos);
}
function_addresses.insert(std::make_pair(pc, f_name));
if (f_name == "check") {
continue;
}
if (!processed.insert(f_name).second) {
continue;
}
//printf("\tfirst\t%s\n", f_name.c_str());
hash ^= get_hash_of_string(f_name);
if (f_name == "main") {
break;
}
}
}
if (resp <= 0) {
*callStackFail = true;
}
return hash;
}
extern "C" {
size_t previous_path_hash;
int check(int count, ...)
{
bool callStackFail = false;
call_stack_mgr& mgr = call_stack_mgr::get();
size_t current_hash = mgr.get_stack_hash(&callStackFail);
if (callStackFail) {
return 0;
}
bool is_valid_path = false;
va_list args_list;
va_start(args_list, count);
for (unsigned i = 0; i < count; ++i) {
size_t hash = va_arg(args_list, size_t);
if (current_hash == hash) {
is_valid_path = true;
break;
}
}
if (!is_valid_path) {
printf("Untrusted call path. Current hash %zu\n", current_hash);
abort();
}
return 0;
}
}
|
522a0c4cedad7b194cb1e478aa17db1a76a0142e
|
528c811306faa4a34bf51fca7955b7a24ac2e30c
|
/C++/Plus One.h
|
891c6e5b321378417dd9f1721f47aed508b2620a
|
[] |
no_license
|
ganjingcatherine/LeetCode-1
|
1addbd7e4d9254a146601f9d5e28b8becb8235a6
|
488782d3f1e759da2d32b4e82dbf55b96c431244
|
refs/heads/master
| 2021-05-11T03:15:16.810035
| 2016-02-06T06:19:18
| 2016-02-06T06:19:18
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 991
|
h
|
Plus One.h
|
/*
Given a non-negative number represented as an array of digits, plus one to the number.
The digits are stored such that the most significant digit is at the head of the list.
*/
class Solution {
public:
vector<int> plusOne(vector<int>& digits) {
int length = digits.size();
if (length == 0) {
return digits;
}
int carry = 0, idx = length - 1;
while (idx >= 0) {
if (idx == length - 1) {
int current = digits[idx] + 1;
carry = current / 10;
digits[idx] = current % 10;
}
else {
int current = digits[idx] + carry;
carry = current / 10;
digits[idx] = current % 10;
}
if (carry == 0) {
return digits;
}
idx --;
}
if (carry > 0) {
digits.insert(digits.begin(), carry);
}
return digits;
}
};
|
f05de905706d73ff5ed8846912ed02cc0a4c6adc
|
e5c0b38c9cc0c0e6155c9d626e299c7b03affd1e
|
/trunk/Code/Engine/Input/ActionToInput.h
|
c1b57b13c8905848546b04da4de759492ec05ee6
|
[] |
no_license
|
BGCX261/zombigame-svn-to-git
|
4e5ec3ade52da3937e2b7d395424c40939657743
|
aa9fb16789f1721557085deae123771f5aefc4dd
|
refs/heads/master
| 2020-05-26T21:56:40.088036
| 2015-08-25T15:33:27
| 2015-08-25T15:33:27
| 41,597,035
| 0
| 0
| null | null | null | null |
ISO-8859-2
|
C++
| false
| false
| 2,741
|
h
|
ActionToInput.h
|
//----------------------------------------------------------------------------------
// ActionToInput Class
// Author: Miquel Rojas
//
// Description:
// Lectura y tratamiento de acciones realizadas por dispositivos de entrada.
//----------------------------------------------------------------------------------
#pragma once
#ifndef ACTIONTOINPUT_H_
#define ACTIONTOINPUT_H_
#include "Base.h"
#include <vector>
#include <string>
#include <map>
/// <summary>
/// Almacena la información de cada input del XML
/// </summary>
typedef struct
{
signed short dispositivo; // Teclado, raton o gamepad
signed short accion; // Evento o axis
signed short valor; // Tecla
float deltaRaton; // MouseDelta
std::string str_id; // Campo code leido del XML (ej: "KEY_K"). Si no tiene code uso el AxisType, como en el caso del mouse
}SInput;
/// <summary>
/// Gestiona la correspondencia entre nombres de acciones e inputs
/// </summary>
class CActionToInput
{
public:
// Init and End protocols
CActionToInput() : m_bIsOk(false), m_filename(""){}
virtual ~CActionToInput () { Done(); }
virtual bool Init ();
virtual void Done ();
bool IsOk () const { return m_bIsOk; }
bool Load (std::string file);//carga el xml y lee/convierte acciones
bool Reload (); //libera y load
bool Unload (); //libera
bool SaveActions (); //graba la configuracion actual
void GetActionConfig (std::string &config, std::string action);//devuelve la cadena con la configuracion de una accion
float DoAction (std::string _myAction);
private:
typedef std::vector<SInput*> TInputs;
typedef std::map<std::string, TInputs> TMapActions;
bool m_bIsOk; // Initialization boolean control
TMapActions m_InputsPerAction; // Mapa con los inputs asociados a cada accion
std::string m_filename; // Nombre del fichero XML
std::map<std::string, uint32> m_String2Code; // Mapa con los valores numericos asociados a cada literal del XML
void Release ();
void InitString2Input ();
int GetValue (std::string lit); //devuelve el valor del literal de m_String2Code
void AddInput (const std::string &name, SInput* input);
};
#endif
|
ed1aac2ea1948f7b8c4653b337318a8219804b33
|
b6f107b68654a84b96d5a84af12c7238749a6141
|
/Solar_System.cpp
|
1cf540ba5a1c6b217b06a25182ce7382204291de
|
[] |
no_license
|
moundoye/Solar_System_Simulation_M2
|
091900bf607aae1f63276e77ac8d44380249e75e
|
13dc2bc2bd5e03dd708c6b08d5f8db8d4ef303a4
|
refs/heads/master
| 2022-09-16T11:25:45.060890
| 2020-06-02T10:56:06
| 2020-06-02T10:56:06
| 222,020,145
| 0
| 0
| null | null | null | null |
ISO-8859-1
|
C++
| false
| false
| 23,897
|
cpp
|
Solar_System.cpp
|
/************************************************************************
* Projet : Simulation du système solaire en c++ avec vtk *
* Auteur : Mouhamadou Ndoye *
* UE : Développement librairie image *
* Université : Clermont Auvergne *
* Année Universitaire : 2019 - 2020 *
************************************************************************/
/****************************************************************************************************************************************
* Lire le fichier readme.docx avant de compiler et d'exécuter le programme
* L'objectif de ce projet est de simuler le mouvement des planetes autour du soleil *
* Je me suis limité à 6 Planètes car plus la planète est loin du soleil plus son temps de simulation est long *
* Le principe reste le même si on souhaite rajouter les 2 autres planètes (Uranus et Neptune) *
* Ce projet peut être divisé en deux parties distinct : *
+ Une partie C++ avec le calcul de la vitesse et de la position de chaque planète (planet.cpp) *
+ Une partie VTK pour l'affichage Graphique (Solar_System.cpp) *
* Pour calculer les coordonnées de chaque planète j'utilise l'équation générale de la gravité (voir planet.cpp pour plus de détails) *
* Voir la section de chaque fonction pour avoir plus de détails sur celle-ci *
****************************************************************************************************************************************/
#include <iostream>
#include <vtkLineSource.h>
#include <vtkSphereSource.h>
#include <vtkDiskSource.h>
#include <vtkCommand.h>
#include <vtkSmartPointer.h>
#include <vtkPolyDataMapper.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkActor.h>
#include <vtkProperty.h>
#include <vtkTransformTextureCoords.h>
#include <vtkTexture.h>
#include <vtkTextureMapToSphere.h>
#include <vtkImageReader2Factory.h>
#include <vtkImageReader.h>
#include <vtkTexturedSphereSource.h>
#include <vtkPointSource.h>
#include <vtkPolyData.h>
#include "Planet.h"
/*==========================================================================================
vtkSmartPointer<vtkActor> DrawLine(double position_new[3], double position_last[3])
Fonction : Trace l'orbite de chaque planète à partir de 2 points fournis
Paramètres :
position_new[3] : coordonnées x, y, z de la nouvelle position de la planète
position_new[3] : coordonnées x, y, z de la l'ancienne position de la planète
A partir de ces deux positions je trace une ligne qui reprèsente une parite de l'orbite
===========================================================================================*/
vtkSmartPointer<vtkActor> DrawLine(double position_new[3], double position_last[3]) {
vtkSmartPointer<vtkLineSource> lineSource = vtkSmartPointer<vtkLineSource>::New();
//static double position_last[3] = { DISTANCEterrelune / 3865751, 0, 0 };
lineSource->SetPoint1(position_last);
lineSource->SetPoint2(position_new);
lineSource->Update();
vtkSmartPointer<vtkPolyDataMapper> mapperLine = vtkSmartPointer<vtkPolyDataMapper>::New();
mapperLine->SetInputConnection(lineSource->GetOutputPort());
vtkSmartPointer<vtkActor> actorLine = vtkSmartPointer<vtkActor>::New();
actorLine->SetMapper(mapperLine);
actorLine->GetProperty()->SetLineWidth(1);
for (int i = 0; i < 3; i++) position_last[i] = position_new[i]; //update position
return actorLine;
}
/*=========================================================================================================================
double rescale_coordinates(char planet, double value)
Fonction : met à l'echelle les coordonnées de chaque planète pour l'affichage
Paramètres :
Planet : 0 ou 1
++ 0 : On rescale les coordonnées de la lune
++ 1 : Je rescale les coorconnées des autres planètes
Value : Valeur à rescaler
La référence est la position initiale de mercure par rapport à la terre qui vaudra 50 suivant x en échelle graphique
==========================================================================================================================*/
double rescale_coordinates(char planet, double value) {
if (planet == 0) return value / 3865751;
else return (value * 50) / DISTANCEsoleilmercure;
}
/*=========================================================================================================================
class vtkTimerCallback : public vtkCommand
Fonction : Programme d'interruption permettant :
++ De calculer la nouvelle position de chaque planète à chaque interruption
++ De tracer l'orbite de chaque planète en fonction des nouvelles positions
++ De mettre à jour l'affichage graphique
==========================================================================================================================*/
class vtkTimerCallback : public vtkCommand
{
public:
static vtkTimerCallback* New()
{
vtkTimerCallback* cb = new vtkTimerCallback;
cb->TimerCount = 0;
return cb;
}
void Execute(vtkObject* vtkNotUsed(caller), unsigned long eventId, void* vtkNotUsed(callData))
{
//\\//\\Les données de chaque planète sont enregistrés dans un type Planet\\//\\//
static Planet Mercury(PERIODEmercure, MASSEmercure, MASSEsoleil, 0, (2. * pi * DISTANCEsoleilmercure / PERIODEmercure), DISTANCEsoleilmercure, 0);
static Planet Venus(PERIODEvenus, MASSEvenus, MASSEsoleil, 0, (2. * pi * DISTANCEsoleilvenus / PERIODEvenus), DISTANCEsoleilvenus, 0);
static Planet Earth(PERIODEterre, MASSEterre, MASSEsoleil, 0, (2. * pi * DISTANCEsoleilterre / PERIODEterre), DISTANCEsoleilterre, 0);
static Planet Mars(PERIODEmars, MASSEmars, MASSEsoleil, 0, (2. * pi * DISTANCEsoleilmars / PERIODEmars), DISTANCEsoleilmars, 0);
static Planet Jupiter(PERIODEjupiter, MASSEjupiter, MASSEsoleil, 0, (2. * pi * DISTANCEsoleiljupiter / PERIODEjupiter), DISTANCEsoleiljupiter, 0);
static Planet Saturn(PERIODEsaturne, MASSEsaturne, MASSEsoleil, 0, (2. * pi * DISTANCEsoleilsaturne / PERIODEsaturne), DISTANCEsoleilsaturne, 0);
int LockIN = 3600;
static double position_Mercury[3] = { 0, 0, 0 };
static double position_Venus[3] = { 0, 0, 0 };
static double position_Earth[3] = { 0, 0, 0 };
static double position_Mars[3] = { 0, 0, 0 };
static double position_Jupiter[3] = { 0, 0, 0 };
static double position_Saturn[3] = { 0, 0, 0 };
while (LockIN != 0) {
--LockIN;
std::cout << "Status : " << LockIN << std::endl;
//\\//\\Lors de chaque interruptions je calcule la position de chaque planète\\//\\//
Mercury.distance();
Mercury.Update_position_Runge_Kutta(2);
Mercury.Update_position_Runge_Kutta(1);
position_Mercury[0] = rescale_coordinates(1, Mercury.get_position_x());
position_Mercury[1] = rescale_coordinates(1, Mercury.get_position_y());
Venus.distance();
Venus.Update_position_Runge_Kutta(2);
Venus.Update_position_Runge_Kutta(1);
position_Venus[0] = rescale_coordinates(1, Venus.get_position_x());
position_Venus[1] = rescale_coordinates(1, Venus.get_position_y());
Earth.distance();
Earth.Update_position_Runge_Kutta(2);
Earth.Update_position_Runge_Kutta(1);
position_Earth[0] = rescale_coordinates(1, Earth.get_position_x());
position_Earth[1] = rescale_coordinates(1, Earth.get_position_y());
Mars.distance();
Mars.Update_position_Runge_Kutta(2);
Mars.Update_position_Runge_Kutta(1);
position_Mars[0] = rescale_coordinates(1, Mars.get_position_x());
position_Mars[1] = rescale_coordinates(1, Mars.get_position_y());
Jupiter.distance();
Jupiter.Update_position_Runge_Kutta(2);
Jupiter.Update_position_Runge_Kutta(1);
position_Jupiter[0] = rescale_coordinates(1, Jupiter.get_position_x());
position_Jupiter[1] = rescale_coordinates(1, Jupiter.get_position_y());
Saturn.distance();
Saturn.Update_position_Runge_Kutta(2);
Saturn.Update_position_Runge_Kutta(1);
position_Saturn[0] = rescale_coordinates(1, Saturn.get_position_x());
position_Saturn[1] = rescale_coordinates(1, Saturn.get_position_y());
}
if (vtkCommand::TimerEvent == eventId)
{
++this->TimerCount;
//\\//\\Mise à jour de l'affichage graphique\\//\\//
//Drawing Mercury Orbit
static int Mercury_Callback_Counter = 16;
if (Mercury_Callback_Counter != 0) {
--Mercury_Callback_Counter;
static double last_position_Mercury[3] = { position_Mercury[0], position_Mercury[1], position_Mercury[2] };
Mercury_Orbit->SetPoint1(last_position_Mercury);
Mercury_Orbit->SetPoint2(position_Mercury);
Mercury_Orbit->Update();
mapperLine->SetInputConnection(Mercury_Orbit->GetOutputPort());
vtkSmartPointer<vtkActor> actorLine = vtkSmartPointer<vtkActor>::New();
actorLine->SetMapper(mapperLine);
actorLine->GetProperty()->SetLineWidth(2);
renderer->AddActor(actorLine);
renderer->AddActor(DrawLine(position_Mercury, last_position_Mercury));
for (int i = 0; i < 3; i++) last_position_Mercury[i] = position_Mercury[i]; //update position
}
//Drawing Venus Orbit
static int Venus_Callback_Counter = 37;
static double last_position_Venus[3] = { position_Venus[0], position_Venus[1], position_Venus[2] };
if (Venus_Callback_Counter != 0) {
--Venus_Callback_Counter;
//create the orbit
Venus_orbit->SetPoint1(last_position_Venus);
Venus_orbit->SetPoint2(position_Venus);
Venus_orbit->Update();
mapperLine_Venus->SetInputConnection(Venus_orbit->GetOutputPort());
vtkSmartPointer<vtkActor> actorLine_Venus = vtkSmartPointer<vtkActor>::New();
actorLine_Venus->SetMapper(mapperLine_Venus);
actorLine_Venus->GetProperty()->SetLineWidth(2);
renderer->AddActor(actorLine_Venus);
renderer->AddActor(DrawLine(position_Venus, last_position_Venus));
for (int i = 0; i < 3; i++) last_position_Venus[i] = position_Venus[i]; //update position
}
//Drawing Earth Orbit
static int Earth_Callback_Counter = 61;
static double last_position_Earth[3] = { position_Earth[0], position_Earth[1], position_Earth[2] };
if (Earth_Callback_Counter != 0) {
--Earth_Callback_Counter;
//create the orbit
Earth_Orbit->SetPoint1(last_position_Earth);
Earth_Orbit->SetPoint2(position_Earth);
Earth_Orbit->Update();
mapperLine_Earth->SetInputConnection(Earth_Orbit->GetOutputPort());
vtkSmartPointer<vtkActor> actorLine_Earth = vtkSmartPointer<vtkActor>::New();
actorLine_Earth->SetMapper(mapperLine_Earth);
actorLine_Earth->GetProperty()->SetLineWidth(2);
renderer->AddActor(actorLine_Earth);
renderer->AddActor(DrawLine(position_Earth, last_position_Earth));
for (int i = 0; i < 3; i++) last_position_Earth[i] = position_Earth[i]; //update position
}
//Drawing Mars Orbit
static int Mars_Callback_Counter = 100;
static double last_position_Mars[3] = { position_Mars[0], position_Mars[1], position_Mars[2] };
if (Mars_Callback_Counter != 0) {
--Mars_Callback_Counter;
//create the orbit
Mars_Orbit->SetPoint1(last_position_Mars);
Mars_Orbit->SetPoint2(position_Mars);
Mars_Orbit->Update();
mapperLine_Mars->SetInputConnection(Mars_Orbit->GetOutputPort());
vtkSmartPointer<vtkActor> actorLine_Mars = vtkSmartPointer<vtkActor>::New();
actorLine_Mars->SetMapper(mapperLine_Mars);
actorLine_Mars->GetProperty()->SetLineWidth(2);
renderer->AddActor(actorLine_Mars);
renderer->AddActor(DrawLine(position_Mars, last_position_Mars));
for (int i = 0; i < 3; i++) last_position_Mars[i] = position_Mars[i]; //update position
}
//Drawing Jupiter Orbit
static int Jupiter_Callback_Counter = 550;
static double last_position_Jupiter[3] = { position_Jupiter[0], position_Jupiter[1], position_Jupiter[2] };
if (Jupiter_Callback_Counter != 0) {
--Jupiter_Callback_Counter;
//create the orbit
Jupiter_Orbit->SetPoint1(last_position_Jupiter);
Jupiter_Orbit->SetPoint2(position_Jupiter);
Jupiter_Orbit->Update();
mapperLine_Jupiter->SetInputConnection(Jupiter_Orbit->GetOutputPort());
vtkSmartPointer<vtkActor> actorLine_Jupiter = vtkSmartPointer<vtkActor>::New();
actorLine_Jupiter->SetMapper(mapperLine_Jupiter);
actorLine_Jupiter->GetProperty()->SetLineWidth(2);
renderer->AddActor(actorLine_Jupiter);
renderer->AddActor(DrawLine(position_Jupiter, last_position_Jupiter));
for (int i = 0; i < 3; i++) last_position_Jupiter[i] = position_Jupiter[i]; //update position
}
//Drawing Saturn Orbit
static int Saturn_Callback_Counter = 900;
static double last_position_Saturn[3] = { position_Saturn[0], position_Saturn[1], position_Saturn[2] };
if (Saturn_Callback_Counter != 0) {
--Saturn_Callback_Counter;
Saturn_Orbit->SetPoint1(last_position_Saturn);
Saturn_Orbit->SetPoint2(position_Saturn);
Saturn_Orbit->Update();
mapperLine_Saturn->SetInputConnection(Saturn_Orbit->GetOutputPort());
vtkSmartPointer<vtkActor> actorLine_Saturn = vtkSmartPointer<vtkActor>::New();
actorLine_Saturn->SetMapper(mapperLine_Saturn);
actorLine_Saturn->GetProperty()->SetLineWidth(2);
renderer->AddActor(actorLine_Saturn);
renderer->AddActor(DrawLine(position_Saturn, last_position_Saturn));
for (int i = 0; i < 3; i++) last_position_Saturn[i] = position_Saturn[i]; //update position
}
actor_Mercury->SetPosition(position_Mercury);
actor_Venus->SetPosition(position_Venus);
actor_Earth->SetPosition(position_Earth);
actor_Mars->SetPosition(position_Mars);
actor_Jupiter->SetPosition(position_Jupiter);
actor_Saturn->SetPosition(position_Saturn);
actor_Saturn_Rings->SetPosition(position_Saturn);
renderWindow->Render();
}
}
vtkSmartPointer<vtkActor> actor_Sun;
vtkSmartPointer<vtkActor> actor_Mercury;
vtkSmartPointer<vtkActor> actor_Venus;
vtkSmartPointer<vtkActor> actor_Earth;
vtkSmartPointer<vtkActor> actor_Mars;
vtkSmartPointer<vtkActor> actor_Jupiter;
vtkSmartPointer<vtkActor> actor_Saturn;
vtkSmartPointer<vtkActor> actor_Saturn_Rings;
vtkSmartPointer<vtkActor> actor_Uranus;
vtkSmartPointer<vtkActor> actor_Neptune;
vtkSmartPointer<vtkActor> actor_Moon;
vtkSmartPointer<vtkRenderer> renderer;
vtkSmartPointer<vtkRenderWindow> renderWindow;
//\\//\\ Mapper for Planet line orbit
vtkSmartPointer<vtkPolyDataMapper> mapperLine = vtkSmartPointer<vtkPolyDataMapper>::New();
vtkSmartPointer<vtkPolyDataMapper> mapperLine_Venus = vtkSmartPointer<vtkPolyDataMapper>::New();
vtkSmartPointer<vtkPolyDataMapper> mapperLine_Earth = vtkSmartPointer<vtkPolyDataMapper>::New();
vtkSmartPointer<vtkPolyDataMapper> mapperLine_Mars = vtkSmartPointer<vtkPolyDataMapper>::New();
vtkSmartPointer<vtkPolyDataMapper> mapperLine_Jupiter = vtkSmartPointer<vtkPolyDataMapper>::New();
vtkSmartPointer<vtkPolyDataMapper> mapperLine_Saturn = vtkSmartPointer<vtkPolyDataMapper>::New();
//\\//\\Je crée des vtkLineSource pour le tracé des orbites\\//\\//
vtkSmartPointer<vtkLineSource> Mercury_Orbit = vtkSmartPointer<vtkLineSource>::New();
vtkSmartPointer<vtkLineSource> Venus_orbit = vtkSmartPointer<vtkLineSource>::New();
vtkSmartPointer<vtkLineSource> Earth_Orbit = vtkSmartPointer<vtkLineSource>::New();
vtkSmartPointer<vtkLineSource> Mars_Orbit = vtkSmartPointer<vtkLineSource>::New();
vtkSmartPointer<vtkLineSource> Jupiter_Orbit = vtkSmartPointer<vtkLineSource>::New();
vtkSmartPointer<vtkLineSource> Saturn_Orbit = vtkSmartPointer<vtkLineSource>::New();
private:
int TimerCount;
};
/*=========================================================================================================================
int main(int argc, char* argv[])
Fonction : Programme principal :
1 -> Je lis les images de texture
2 -> Je crée chaque sphére de chaque planète en appliquant la texture
3 -> Je crée les mappers
4 -> Je crée les acteurs
5 -> Je crée le renderer et le renderer window
6 -> J'ajoute les acteurs dans le renderer
7 -> J'initialise l'interracteur et le programme d'interruption
==========================================================================================================================*/
int main(int argc, char* argv[])
{
if (argc < 2)
{
std::cout << "Usage: " << argv[0]
<< " texture(.png)"
<< " [translate]" << std::endl;
return EXIT_FAILURE;
}
double translate[3];
if (argc > 2)
{
translate[0] = atof(argv[0]);
}
else
{
translate[0] = 0.0;
}
translate[1] = 0.0;
translate[2] = 0.0;
std::cout << translate[0] << ", "
<< translate[1] << ", "
<< translate[2] << "\n";
//vtkSmartPointer<vtkNamedColors> colors = vtkSmartPointer<vtkNamedColors>::New();
// Sign up to receive TimerEvent
vtkSmartPointer<vtkTimerCallback> cb = vtkSmartPointer<vtkTimerCallback>::New();
/////////////////////////////////UPDATE/////////////////////////////////////////////
vtkSmartPointer<vtkTexturedSphereSource> Sphere_Planet[NB_Planet];
vtkSmartPointer<vtkImageReader2Factory> readerFactory[NB_Planet];
vtkImageReader2* imageReader[NB_Planet];
// Create texture
vtkSmartPointer<vtkTexture> texture [NB_Planet];
vtkSmartPointer<vtkTransformTextureCoords> transformTexture [NB_Planet];
for (int i = 0; i < NB_Planet; i++) {
Sphere_Planet [i] = vtkSmartPointer<vtkTexturedSphereSource>::New();
readerFactory [i] = vtkSmartPointer<vtkImageReader2Factory>::New();
texture [i] = vtkSmartPointer<vtkTexture>::New();
transformTexture[i] = vtkSmartPointer<vtkTransformTextureCoords>::New();
}
for (int i = 0; i < NB_Planet; i++) {
if (i == 0) Sphere_Planet[0]->SetRadius(35.0);
else Sphere_Planet[i]->SetRadius(35.0 - (35.0-(2.0*i + 3.0)) );
// Make the surface smooth.
Sphere_Planet[i]->SetPhiResolution(100);
Sphere_Planet[i]->SetThetaResolution(100);
imageReader [i] = readerFactory[i]->CreateImageReader2(argv[i+1]);
imageReader [i]->SetFileName(argv[i+1]);
texture [i]->SetInputConnection(imageReader [i]->GetOutputPort());
transformTexture [i]->SetInputConnection(Sphere_Planet [i]->GetOutputPort());
transformTexture [i]->SetPosition(translate);
}
///////////////////////////////////////////////////////////////////////////////////////
/***************************************** Create Saturn Ring **********************************************/
vtkSmartPointer<vtkDiskSource> Saturn_Rings = vtkSmartPointer<vtkDiskSource>::New();
Saturn_Rings->SetInnerRadius(16);
Saturn_Rings->SetOuterRadius(19);
Saturn_Rings->SetRadialResolution(100);
Saturn_Rings->SetCircumferentialResolution(100);
/*********************************************** Create Belt Asteroid ***************************************/
vtkSmartPointer<vtkDiskSource> Asteroid_Belt = vtkSmartPointer<vtkDiskSource>::New();
Asteroid_Belt->SetInnerRadius(rescale_coordinates(1, 503E9));
Asteroid_Belt->SetOuterRadius(rescale_coordinates(1, 303E9));
Asteroid_Belt->SetRadialResolution(5);
Asteroid_Belt->SetCircumferentialResolution(5);
// Create a point cloud
vtkSmartPointer<vtkPointSource> pointSource = vtkSmartPointer<vtkPointSource>::New();
pointSource->SetCenter(rescale_coordinates(1, 503E9), 0.0, 0.0);
pointSource->SetNumberOfPoints(1000);
pointSource->SetRadius(rescale_coordinates(1, 1E9));
pointSource->SetDistributionToShell();
pointSource->Update();
//////////////////////////////////////////////////////////UPDATE////////////////////////////////////////////
vtkSmartPointer<vtkPolyDataMapper> mapper [NB_Planet];
for (int i = 0; i < NB_Planet; i++) {
mapper [i] = vtkSmartPointer<vtkPolyDataMapper>::New();
}
//making up the mapper
vtkSmartPointer<vtkPolyDataMapper> mapperSaturn_Rings = vtkSmartPointer<vtkPolyDataMapper>::New();
vtkSmartPointer<vtkPolyDataMapper> mapperOrion_Belt = vtkSmartPointer<vtkPolyDataMapper>::New();
vtkSmartPointer<vtkPolyDataMapper> mapperMoon = vtkSmartPointer<vtkPolyDataMapper>::New();
for (int i = 0; i < NB_Planet; i++) {
mapper[i]->SetInputConnection(transformTexture[i]->GetOutputPort());
}
mapperSaturn_Rings->SetInputConnection(Saturn_Rings->GetOutputPort());
mapperOrion_Belt->SetInputConnection(pointSource->GetOutputPort());
//creating the actor
double Position_Sun[3] = { 0, 0, 0 };
double Position_Mercury[3] = { rescale_coordinates(1, DISTANCEsoleilmercure), 0, 0 };
double Position_Venus[3] = { rescale_coordinates(1, DISTANCEsoleilvenus), 0, 0 };
double Position_Earth[3] = { rescale_coordinates(1, DISTANCEsoleilterre), 0, 0 };
double Position_Mars[3] = { rescale_coordinates(1, DISTANCEsoleilmars), 0, 0 };
double Position_Jupiter[3] = { rescale_coordinates(1, DISTANCEsoleiljupiter), 0, 0 };
double Position_Saturn[3] = { rescale_coordinates(1, DISTANCEsoleilsaturne), 0, 0 };
double Position_Saturn_Rings[3] = { rescale_coordinates(1, DISTANCEsoleilsaturne), 0, 0 };
double Position_Orion_Belt[3] = { 0, 0, 0 };
vtkSmartPointer<vtkActor> actor [NB_Planet];
for (int i = 0; i < NB_Planet; i++) {
actor [i] = vtkSmartPointer<vtkActor>::New();
actor[i]->SetMapper(mapper[i]);
actor[i]->SetTexture(texture[i]);
}
cb->actor_Mercury = actor[1];
cb->actor_Venus = actor[2];
cb->actor_Earth = actor[3];
cb->actor_Mars = actor[4];
cb->actor_Jupiter = actor[5];
cb->actor_Saturn = actor[6];
actor[0]->SetPosition(Position_Sun);
actor[1]->SetPosition(Position_Mercury);
actor[2]->SetPosition(Position_Venus);
actor[3]->SetPosition(Position_Earth);
actor[4]->SetPosition(Position_Mars);
actor[5]->SetPosition(Position_Jupiter);
actor[6]->SetPosition(Position_Saturn);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
vtkSmartPointer<vtkActor> actor_Saturn_Rings = vtkSmartPointer<vtkActor>::New();
cb->actor_Saturn_Rings = actor_Saturn_Rings;
actor_Saturn_Rings->SetPosition(Position_Saturn_Rings);
actor_Saturn_Rings->SetMapper(mapperSaturn_Rings);
actor_Saturn_Rings->GetProperty()->SetColor(0.96078, 0.96078, 0.86274);
actor_Saturn_Rings->SetTexture(texture[6]);
vtkSmartPointer<vtkActor> actor_Orion_Belt = vtkSmartPointer<vtkActor>::New();
actor_Orion_Belt->SetPosition(Position_Orion_Belt);
actor_Orion_Belt->SetMapper(mapperOrion_Belt);
actor_Orion_Belt->GetProperty()->SetColor(0.96078, 0.96078, 0.86274);
// Setup renderer, render window, and interactor
vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
cb->renderer = renderer;
vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);
for (int i = 0; i < NB_Planet; i++) {
renderer->AddActor(actor[i]);
}
renderer->AddActor(actor_Saturn_Rings);
renderer->AddActor(actor_Orion_Belt);
vtkSmartPointer<vtkRenderWindowInteractor> interactor = vtkSmartPointer<vtkRenderWindowInteractor>::New();
interactor->SetRenderWindow(renderWindow);
// Initialize must be called prior to creating timer events.
interactor->Initialize();
cb->renderWindow = renderWindow;
interactor->AddObserver(vtkCommand::TimerEvent, cb);
int timerId = interactor->CreateRepeatingTimer(0.01);
std::cout << "timerId: " << timerId << std::endl;
// Start the interaction and timer
renderWindow->Render();
interactor->Start();
getchar();
return 0;
}
|
2acb57b11a9de05430bf50ec436d1f92f95a606e
|
6409650a23f65136afd961206c2a8870e1f78c7e
|
/ConceptEngine/ConceptEngine/ConceptEngineRenderer/Physics/PhysX/CEPhysXDebugger.cpp
|
2e5c25c3f6ca16597fe93dbec15d4f7379a957e7
|
[
"MIT"
] |
permissive
|
Ludaxord/ConceptEngine
|
830486b52a72e1fe7a4b821b4f725443ff180afe
|
16775bc9b518d4fd4c8bd32bb5f297223dfacbae
|
refs/heads/master
| 2023-08-16T11:33:00.694333
| 2021-10-07T21:11:00
| 2021-10-07T21:11:00
| 293,779,912
| 6
| 0
|
MIT
| 2021-08-16T20:33:47
| 2020-09-08T10:42:33
|
C++
|
UTF-8
|
C++
| false
| false
| 1,390
|
cpp
|
CEPhysXDebugger.cpp
|
#include "CEPhysXDebugger.h"
#include <pvd/PxPvdTransport.h>
#include "CEPhysX.h"
struct CEPhysXData {
physx::PxPvd* Debugger;
physx::PxPvdTransport* Transport;
};
static CEPhysXData* PhysXData = nullptr;
bool CEPhysXDebugger::Create() {
PhysXData = DBG_NEW CEPhysXData();
PhysXData->Debugger = physx::PxCreatePvd(CEPhysX::GetFoundation());
if (!PhysXData->Debugger) {
return false;
}
return true;
}
physx::PxPvd* CEPhysXDebugger::GetDebugger() {
return PhysXData->Debugger;
}
//TODO: Implement
void CEPhysXDebugger::StopDebugging() {
if (!PhysXData->Debugger->isConnected())
return;
PhysXData->Debugger->disconnect();
PhysXData->Transport->release();
}
void CEPhysXDebugger::Release() {
PhysXData->Debugger->release();
delete PhysXData;
PhysXData = nullptr;
}
bool CEPhysXDebugger::IsDebugging() {
return PhysXData->Debugger->isConnected();
}
void CEPhysXDebugger::StartDebugging(const std::string& Path, bool LiveDebugging) {
StopDebugging();
if (!LiveDebugging) {
PhysXData->Transport = physx::PxDefaultPvdFileTransportCreate((Path + ".pxd2").c_str());
PhysXData->Debugger->connect(*PhysXData->Transport, physx::PxPvdInstrumentationFlag::eALL);
}
else {
PhysXData->Transport = physx::PxDefaultPvdSocketTransportCreate("localhost", 5425, 1000);
PhysXData->Debugger->connect(*PhysXData->Transport, physx::PxPvdInstrumentationFlag::eALL);
}
}
|
47ec03c1b77b824914b1a7f5a383b6ac0221c6d5
|
0012959be29434d6aa356f6a6a9cffc3d8fc1e0e
|
/H3API/lib/h3api/H3Exception/H3Exception.hpp
|
1a71eeedd99dbb39cdc928eb36a669a6e62f4e03
|
[
"MIT"
] |
permissive
|
RoseKavalier/H3Plugins
|
27c6acb0d64d8a6124898f6ea427cf6d2e70722d
|
749e16310cc940598f3e3769ddc96c63cca19e5b
|
refs/heads/master
| 2023-08-18T13:59:02.335987
| 2023-04-05T00:59:17
| 2023-04-05T00:59:17
| 190,291,736
| 68
| 11
|
MIT
| 2022-10-16T20:30:35
| 2019-06-04T23:08:54
|
C++
|
UTF-8
|
C++
| false
| false
| 2,683
|
hpp
|
H3Exception.hpp
|
//////////////////////////////////////////////////////////////////////
// //
// Created by RoseKavalier: //
// rosekavalierhc@gmail.com //
// Created: 2019-12-06 //
// ***You may use or distribute these files freely //
// so long as this notice remains present.*** //
// //
//////////////////////////////////////////////////////////////////////
#ifndef _H3EXCEPTION_HPP_
#define _H3EXCEPTION_HPP_
#ifdef _CPPUNWIND
#include "../H3_String.hpp"
#include <eh.h>
#include <exception>
#include <Psapi.h>
namespace h3
{
// * Only available if stack unwinding is enabled (enable C++ exceptions).
// * you should use /EHa compiler flag when using this file
namespace H3Internal
{
CHAR const OfferToLog[] = "\nWould you like to save this error to file ?";
_H3API_ void _h3TransFunction(UINT code, EXCEPTION_POINTERS* ep);
_H3API_ LPCSTR _opDescription(const ULONG opcode);
_H3API_ LPCSTR _seDescription(const UINT& code);
_H3API_ VOID _exInformation(H3String& error, _EXCEPTION_POINTERS* ep, UINT code = 0, bool log_error = true);
}
// * Catches std::exception and SEH errors
// * when combined with H3SEHandler
class H3Exception : public std::exception
{
public:
_H3API_ H3Exception(LPCSTR message);
_H3API_ H3Exception(const H3String& message);
// * creates an in-game dialog showing the error
_H3API_ VOID ShowInGame() const;
// * creates an in-game dialog showing the error
_H3API_ BOOL ShowInGameLog() const;
// * creates a out-of-game messagebox showing the error
_H3API_ VOID ShowMessagebox() const;
// * creates a out-of-game messagebox showing the error
_H3API_ BOOL ShowMessageboxLog() const;
// * logs error to specified path
_H3API_ VOID LogError(LPCSTR path) const;
_H3API_ VOID LogError(const H3String& path) const;
};
// * create a H3SEHandler object on the stack where you want to use try{} catch{}
// * to receive the error code, use the what() exception member function
// * e.g. this snippet would show an error in-game without crashing the game
// * H3SEHandler seh;
// * try
// * {
// * some stuff that can create an error...
// * }
// * catch (H3Exception& e)
// * {
// * e.ShowInGame();
// * }
class H3SEHandler
{
const _se_translator_function m_oldTranslator;
public:
_H3API_ H3SEHandler();
_H3API_ ~H3SEHandler();
};
}
#endif /* #ifdef _CPPUNWIND */
#endif /* #define _H3EXCEPTION_HPP_ */
|
4286e4b90a6d85fca1041de443f96eb782f2eee5
|
fc3aa9ea0af827ceb1ae33af7edffeaa90750f45
|
/src/ScriptManager.cpp
|
e38295459a0a29b374b0bf8ba1b835943adfd5fe
|
[] |
no_license
|
nutti/GameEngine
|
6ef06624970e4889220ad1dfa4c8105119bdd465
|
2b4f09465ecfcf0ed778ada7dbfe96aaa840d479
|
refs/heads/master
| 2016-09-05T09:06:20.595686
| 2014-03-09T11:30:55
| 2014-03-09T11:30:55
| 5,918,684
| 1
| 0
| null | null | null | null |
SHIFT_JIS
|
C++
| false
| false
| 6,572
|
cpp
|
ScriptManager.cpp
|
#include "ScriptManager.h"
#include <MAPIL/MAPIL.h>
#include <vector>
#include <fstream>
#include "ScriptCompiler.h"
#include "ScriptLoader.h"
#include "Util.h"
namespace GameEngine
{
// スクリプトファイル構成図
//
// Stage構成情報ファイル ------> Stage1構成ファイル --------> リソーススクリプトファイル
// | |
// | ---> 敵スクリプトファイル 0 ...
// | |
// | ---> 敵弾スクリプトファイル 0 ...
// | |
// | ---> ステージスクリプトファイル
// |
// ---> Stage2構成ファイル
// |
// ステージタグ
struct StageTag
{
int m_StageNo; // ステージ番号
std::string m_FileName; // ファイル名
};
// ScriptManager実装クラス
class ScriptManager::Impl
{
private:
std::weak_ptr < EventMediator > m_pEventMediator; // イベント仲介役クラス
ScriptCompiler m_Compiler; // コンパイラ
ScriptLoader m_Loader; // ローダ
ScriptFileType m_ScriptFileType; // スクリプトファイルタイプ
std::vector < StageTag > m_StageFileList; // ステージファイル名リスト
int GetInt( char** p ); // データ列から、整数を取得する
int GetID( const char* pStr ); // データ列から、IDを取得する
char* GetFileName( char* pStr ); // データ列から、ファイル名を取得する
public:
Impl( std::shared_ptr < EventMediator > pEventMediator );
~Impl(){}
void BuildFileStructure( const std::string& fileName, ScriptFileType type );
void BuildScriptData( int stage ); // スクリプトデータの構築
ScriptData GetScriptData();
void BuildFileStructure( int archiveHandle, const std::string& fileName, ScriptFileType type );
void BuildScriptData( int archiveHandle, int stage );
};
int ScriptManager::Impl::GetInt( char** p )
{
int i = MAPIL::TransformCharIntoInt32( *p, MAPIL::BYTE_ORDER_LITTLE );
*p += 4;
return i;
}
int ScriptManager::Impl::GetID( const char* pStr )
{
char buf[ 5 ]; // 1000まで格納可能
int pos = 0;
while( *pStr ){
if( *pStr == ' ' || pos > 3 ){
break;
}
buf[ pos++ ] = *pStr++;
}
buf[ pos ] = '\0';
return ::atoi( buf );
}
char* ScriptManager::Impl::GetFileName( char* pStr )
{
while( *pStr++ != ' ' ){
}
return pStr;
}
ScriptManager::Impl::Impl( std::shared_ptr < EventMediator > pEventMediator ) : m_pEventMediator( pEventMediator ),
m_Compiler(),
m_Loader(),
m_ScriptFileType( SCRIPT_FILE_TYPE_UNKNOWN )
{
}
void ScriptManager::Impl::BuildFileStructure( const std::string& fileName, ScriptFileType type )
{
m_ScriptFileType = type;
std::ifstream fIn( fileName, std::ios::in );
if( !fIn ){
exit( 1 );
}
while( !fIn.eof() ){
char buf[ 1024 ];
fIn.getline( buf, sizeof( buf ) );
StageTag tag;
tag.m_StageNo = GetID( buf ); // ID取得
tag.m_FileName = GetFileName( buf ); // ファイル名取得
m_StageFileList.push_back( tag );
}
fIn.close();
}
void ScriptManager::Impl::BuildScriptData( int stage )
{
// ファイル構成スクリプトの検索
unsigned int cur = 0;
for( ; cur < m_StageFileList.size(); ++cur ){
if( m_StageFileList[ cur ].m_StageNo == stage ){
break;
}
}
if( cur == m_StageFileList.size() ){
throw MAPIL::MapilException( CURRENT_POSITION, TSTR( "Stage File List not found." ), -1 );
//exit( 1 ); // 指定されたステージのファイル構成スクリプトは存在しない
}
if( m_ScriptFileType == SCRIPT_FILE_TYPE_SOURCE_CODE ){
m_Compiler.Compile( m_StageFileList[ cur ].m_FileName );
}
else if( m_ScriptFileType == SCRIPT_FILE_TYPE_BINARY ){
m_Loader.Load( m_StageFileList[ cur ].m_FileName );
}
else{
exit( 1 ); // 不明なファイル形式
}
}
ScriptData ScriptManager::Impl::GetScriptData()
{
if( m_ScriptFileType == SCRIPT_FILE_TYPE_SOURCE_CODE ){
return m_Compiler.GetScriptData();
}
else if( m_ScriptFileType == SCRIPT_FILE_TYPE_BINARY ){
return m_Loader.GetScriptData();
}
ScriptData data;
return data;
}
void ScriptManager::Impl::BuildFileStructure( int archiveHandle, const std::string& fileName, ScriptFileType type )
{
m_ScriptFileType = type;
if( m_ScriptFileType != SCRIPT_FILE_TYPE_BINARY ){
exit( -1 );
}
int fileSize = MAPIL::GetContentsSizeOnArchiveFile( archiveHandle, fileName.c_str() );
char* pData = new char [ fileSize ];
char* pBegin = pData;
char* pEnd = pData + fileSize;
MAPIL::LoadDataFromArchiveFile( archiveHandle, fileName.c_str(), pData );
while( pData != pEnd ){
char buf[ 1024 ];
GetLineFromString( &pData, pEnd, buf, sizeof( buf ) );
StageTag tag;
tag.m_StageNo = GetID( buf );
tag.m_FileName = GetFileName( buf );
m_StageFileList.push_back( tag );
}
MAPIL::SafeDeleteArray( pBegin );
}
void ScriptManager::Impl::BuildScriptData( int archiveHandle, int stage )
{
if( m_ScriptFileType != SCRIPT_FILE_TYPE_BINARY ){
exit( -1 );
}
// ファイル構成スクリプトの検索
unsigned int cur = 0;
for( ; cur < m_StageFileList.size(); ++cur ){
if( m_StageFileList[ cur ].m_StageNo == stage ){
break;
}
}
if( cur == m_StageFileList.size() ){
exit( 1 ); // 指定されたステージのファイル構成スクリプトは存在しない
}
if( m_ScriptFileType == SCRIPT_FILE_TYPE_BINARY ){
m_Loader.Load( archiveHandle, m_StageFileList[ cur ].m_FileName );
}
}
// ----------------------------------
// 実装クラスの呼び出し
// ----------------------------------
ScriptManager::ScriptManager( std::shared_ptr < EventMediator > pEventMediator ) : m_pImpl( new ScriptManager::Impl( pEventMediator ) )
{
}
ScriptManager::~ScriptManager()
{
}
void ScriptManager::BuildFileStructure( const std::string& fileName, ScriptFileType type )
{
m_pImpl->BuildFileStructure( fileName, type );
}
void ScriptManager::BuildScriptData( int stage )
{
m_pImpl->BuildScriptData( stage );
}
ScriptData ScriptManager::GetScriptData()
{
return m_pImpl->GetScriptData();
}
void ScriptManager::BuildFileStructure( int archiveHandle, const std::string& fileName, ScriptFileType type )
{
return m_pImpl->BuildFileStructure( archiveHandle, fileName, type );
}
void ScriptManager::BuildScriptData( int archiveHandle, int stage )
{
m_pImpl->BuildScriptData( archiveHandle, stage );
}
}
|
13cb983efd2c743280185f7128cf97ac4a017a08
|
7913f96eb8f7510b879f4383b4bf9b0dc4dac8cf
|
/Include/Shader/DefaultShader_Specular.h
|
dec98871462061b2e775beb16a8b566eaced9375
|
[] |
no_license
|
zncnf/DirectX11-PF-FrameWork
|
2cf2ce38e23896a1742670a85fbc36833775c41c
|
9e9455b661e82dc7931085010c5850ab457f8141
|
refs/heads/master
| 2022-12-16T00:18:59.193583
| 2020-08-18T10:27:59
| 2020-08-18T10:27:59
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 844
|
h
|
DefaultShader_Specular.h
|
#pragma once
#include "Shader.h"
class DefaultShader_Specular : public Shader
{
public:
DefaultShader_Specular() = default;
virtual ~DefaultShader_Specular();
public:
virtual void Init() override;
virtual void Update(D3DXMATRIX world, D3DXMATRIX view, D3DXMATRIX projection, D3DXVECTOR4 diffuseColor, D3DXVECTOR4 ambientColor, D3DXVECTOR4 specularColor, float specularPower, std::vector<struct BoneInfo>* boneInfo = nullptr) override;
private:
ID3D11VertexShader* VS_Shader = nullptr;
ID3D11PixelShader* PS_Shader = nullptr;
ID3D11InputLayout* inputLayout = nullptr;
ID3D11Buffer* matrixBuffer = nullptr;
ID3D11Buffer* lightBuffer = nullptr;
ID3D11Buffer* cameraBuffer = nullptr;
ID3D11ShaderResourceView* shaderResource = nullptr;
ID3D11SamplerState* sampleState = nullptr;
};
|
4c0a5f1faa36c515b9820469a4414c554655e8d2
|
7dcc021a54186053194fa12fb10f7266dcc6d511
|
/src/nnet_cpu/nnet-rnnlmaux.h
|
72794a3d23f159c23f6c69ca17646c08f5da86e6
|
[
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] |
permissive
|
troylee/kaldi
|
fcdb3cda8a95f0aae71b05242f5a777a02131351
|
33b9f3bcebca5f2e280c6416f95962d664a1d26d
|
refs/heads/master
| 2020-05-25T10:07:08.210149
| 2014-07-18T08:32:35
| 2014-07-18T08:32:35
| 21,224,820
| 2
| 4
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,008
|
h
|
nnet-rnnlmaux.h
|
// nnet/nnet-rnnlmaux.h
// Copyright 2011 Karel Vesely
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
// See the Apache 2 License for the specific language governing permissions and
// limitations under the License.
#ifndef KALDI_NNET_RNNLMAUX_H
#define KALDI_NNET_RNNLMAUX_H
#include "base/io-funcs.h"
#include "util/kaldi-io.h"
#include <map>
#include <fstream>
#include <cstring>
namespace kaldi {
/**
* Auxiliary class to group Rnnlm functions
*/
class RnnlmAux {
public:
static void ReadDict(const std::string &file, std::map<std::string, int32> *dict) {
bool binary;
Input in(file, &binary);
std::string word;
int32 index;
while (Peek(in.Stream(), binary) != EOF) {
ReadBasicType(in.Stream(), binary, &index);
ReadToken(in.Stream(), binary, &word);
(*dict)[word] = index;
}
in.Close();
}
static bool AddLine(std::istream &is, const std::map<std::string, int32> &dict, std::vector<int32> *seq) {
char line[4096];
is.getline(line, 4096);
const char *delim = " \t";
std::vector<const char*> words;
// parse the line, check OOVs'
const char *w = NULL;
while (NULL != (w = strtok((w==NULL?line:NULL), delim))) {
if(dict.find(w) == dict.end()) return false; // OOV
words.push_back(w);
}
// add line to seq
for(int32 i=0; i<words.size(); i++) {
std::string key(words[i]);
seq->push_back(dict.find(key)->second);
}
// add end of sentence token
seq->push_back(1);
return true;
}
};
}
#endif
|
c20bcfee7542be270d95842c0464b14be997bcfd
|
725b9aa5a2a67fd0ba5ebdf590714bc09991c1ac
|
/public/win32/win32_dxut_misc.cpp
|
00415e72a4a1789413d24d39b2b4b38c7407a695
|
[] |
no_license
|
johnoponno/nornware_public
|
a63bb7abca015e58374b146681bd29f175e68fdd
|
3c8dbec17dcb34bb18d6877cb7ce44d07a13a813
|
refs/heads/master
| 2023-05-02T05:12:26.725866
| 2023-04-20T15:54:34
| 2023-04-20T15:54:34
| 216,572,079
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 6,553
|
cpp
|
win32_dxut_misc.cpp
|
#include "stdafx.h"
#include "win32_d3d9_state.h"
//--------------------------------------------------------------------------------------
// MsgProc for DXUTDisplaySwitchingToREFWarning() dialog box
//--------------------------------------------------------------------------------------
static INT_PTR CALLBACK __display_switching_to_ref_warning_proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM)
{
switch (message)
{
case WM_INITDIALOG:
// Easier to set text here than in the DLGITEMTEMPLATE
::SetWindowTextA(hDlg, win32_d3d9_state.m_window_title);
::SendMessage(::GetDlgItem(hDlg, 0x100), STM_SETIMAGE, IMAGE_ICON, (LPARAM)::LoadIcon(0, IDI_QUESTION));
::SetDlgItemText(hDlg, 0x101, "Switching to the Direct3D reference rasterizer, a software device\nthat implements the entire Direct3D feature set, but runs very slowly.\nDo you wish to continue?");
::SetDlgItemText(hDlg, IDYES, "&Yes");
::SetDlgItemText(hDlg, IDNO, "&No");
::SetDlgItemText(hDlg, IDIGNORE, "&Don't show again");
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDIGNORE: ::CheckDlgButton(hDlg, IDIGNORE, (IsDlgButtonChecked(hDlg, IDIGNORE) == BST_CHECKED) ? BST_UNCHECKED : BST_CHECKED); EnableWindow(GetDlgItem(hDlg, IDNO), (IsDlgButtonChecked(hDlg, IDIGNORE) != BST_CHECKED)); break;
case IDNO: ::EndDialog(hDlg, (IsDlgButtonChecked(hDlg, IDIGNORE) == BST_CHECKED) ? IDNO | 0x80 : IDNO | 0x00); return TRUE;
case IDCANCEL:
case IDYES: ::EndDialog(hDlg, (IsDlgButtonChecked(hDlg, IDIGNORE) == BST_CHECKED) ? IDYES | 0x80 : IDYES | 0x00); return TRUE;
}
break;
}
return FALSE;
}
//--------------------------------------------------------------------------------------
// Shared code for samples to ask user if they want to use a REF device or quit
//--------------------------------------------------------------------------------------
void win32_d3d9_display_switching_to_ref_warning()
{
// Open the appropriate registry key
DWORD dwSkipWarning = 0;
HKEY hKey;
LONG lResult = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Microsoft\\DirectX 9.0 SDK", 0, KEY_READ, &hKey);
if (ERROR_SUCCESS == lResult)
{
DWORD dwType;
DWORD dwSize = sizeof(DWORD);
lResult = RegQueryValueEx(hKey, "Skip Warning On REF", nullptr, &dwType, (BYTE*)&dwSkipWarning, &dwSize);
RegCloseKey(hKey);
}
if (dwSkipWarning == 0)
{
// Compact code to create a custom dialog box without using a template in a resource file.
// If this dialog were in a .rc file, this would be a lot simpler but every sample calling this function would
// need a copy of the dialog in its own .rc file. Also MessageBox API could be used here instead, but
// the MessageBox API is simpler to call but it can't provide a "Don't show again" checkbox
typedef struct { DLGITEMTEMPLATE a; WORD b; WORD c; WORD d; WORD e; WORD f; } DXUT_DLG_ITEM;
typedef struct { DLGTEMPLATE a; WORD b; WORD c; char d[2]; WORD e; char f[14]; DXUT_DLG_ITEM i1; DXUT_DLG_ITEM i2; DXUT_DLG_ITEM i3; DXUT_DLG_ITEM i4; DXUT_DLG_ITEM i5; } DXUT_DLG_DATA;
DXUT_DLG_DATA dtp =
{
{ WS_CAPTION | WS_POPUP | WS_VISIBLE | WS_SYSMENU | DS_ABSALIGN | DS_3DLOOK | DS_SETFONT | DS_MODALFRAME | DS_CENTER,0,5,0,0,269,82 },0,0," ",8,"MS Sans Serif",
{ { WS_CHILD | WS_VISIBLE | SS_ICON | SS_CENTERIMAGE,0,7,7,24,24,0x100 },0xFFFF,0x0082,0,0,0 }, // icon
{ { WS_CHILD | WS_VISIBLE,0,40,7,230,25,0x101 },0xFFFF,0x0082,0,0,0 }, // static text
{ { WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON,0,80,39,50,14,IDYES },0xFFFF,0x0080,0,0,0 }, // Yes button
{ { WS_CHILD | WS_VISIBLE,0,133,39,50,14,IDNO },0xFFFF,0x0080,0,0,0 }, // No button
{ { WS_CHILD | WS_VISIBLE | BS_CHECKBOX,0,7,59,70,16,IDIGNORE },0xFFFF,0x0080,0,0,0 }, // checkbox
};
int32_t nResult = (int32_t) ::DialogBoxIndirect(win32_d3d9_state.m_hinstance, (DLGTEMPLATE*)&dtp, win32_d3d9_hwnd(), __display_switching_to_ref_warning_proc);
if ((nResult & 0x80) == 0x80) // "Don't show again" checkbox was checked
{
lResult = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Microsoft\\DirectX 9.0 SDK", 0, KEY_WRITE, &hKey);
if (ERROR_SUCCESS == lResult)
{
dwSkipWarning = 1;
RegSetValueEx(hKey, "Skip Warning On REF", 0, REG_DWORD, (BYTE*)&dwSkipWarning, sizeof(DWORD));
RegCloseKey(hKey);
}
}
// User choose not to continue
if ((nResult & 0x0F) == IDNO)
win32_d3d9_shutdown(1);
}
}
::HRESULT WINAPI win32_d3d9_trace(const char* strFile, DWORD dwLine, HRESULT hr, const char* strMsg, bool bPopMsgBox)
{
if (bPopMsgBox && true == false)
bPopMsgBox = false;
return ::DXTraceA(strFile, dwLine, hr, strMsg, bPopMsgBox);
}
//--------------------------------------------------------------------------------------
// Multimon API handling for OSes with or without multimon API support
//--------------------------------------------------------------------------------------
#define DXUT_PRIMARY_MONITOR ((HMONITOR)0x12340042)
typedef HMONITOR(WINAPI* LPMONITORFROMWINDOW)(HWND, DWORD);
typedef BOOL(WINAPI* LPGETMONITORINFO)(HMONITOR, LPMONITORINFO);
BOOL win32_d3d9_get_monitor_info(HMONITOR hMonitor, LPMONITORINFO lpMonitorInfo)
{
static bool s_bInited = false;
static LPGETMONITORINFO s_pFnGetMonitorInfo = nullptr;
if (!s_bInited)
{
s_bInited = true;
::HMODULE hUser32 = GetModuleHandle("USER32");
if (hUser32)
{
s_pFnGetMonitorInfo = (LPGETMONITORINFO)GetProcAddress(hUser32, "GetMonitorInfoA");
}
}
if (s_pFnGetMonitorInfo)
return s_pFnGetMonitorInfo(hMonitor, lpMonitorInfo);
RECT rcWork;
if ((hMonitor == DXUT_PRIMARY_MONITOR) && lpMonitorInfo && (lpMonitorInfo->cbSize >= sizeof(MONITORINFO)) && SystemParametersInfoA(SPI_GETWORKAREA, 0, &rcWork, 0))
{
lpMonitorInfo->rcMonitor.left = 0;
lpMonitorInfo->rcMonitor.top = 0;
lpMonitorInfo->rcMonitor.right = GetSystemMetrics(SM_CXSCREEN);
lpMonitorInfo->rcMonitor.bottom = GetSystemMetrics(SM_CYSCREEN);
lpMonitorInfo->rcWork = rcWork;
lpMonitorInfo->dwFlags = MONITORINFOF_PRIMARY;
return TRUE;
}
return FALSE;
}
HMONITOR win32_d3d9_monitor_from_window(HWND hWnd, DWORD dwFlags)
{
static bool s_bInited = false;
static LPMONITORFROMWINDOW s_pFnGetMonitorFronWindow = nullptr;
if (!s_bInited)
{
s_bInited = true;
HMODULE hUser32 = GetModuleHandle("USER32");
if (hUser32) s_pFnGetMonitorFronWindow = (LPMONITORFROMWINDOW)GetProcAddress(hUser32, "MonitorFromWindow");
}
if (s_pFnGetMonitorFronWindow)
return s_pFnGetMonitorFronWindow(hWnd, dwFlags);
if (dwFlags & (MONITOR_DEFAULTTOPRIMARY | MONITOR_DEFAULTTONEAREST))
return DXUT_PRIMARY_MONITOR;
return nullptr;
}
|
5c98a342226403b0fe331d27e7ea3fdf51da7298
|
993aa856da05f9e6d0dc75167962c64777f69031
|
/hw3d/WaterPlane.h
|
b54f33fea9428b3b78a22520c6be6b4b1779efb2
|
[] |
no_license
|
dreamer1995/Chili-s-Engine
|
c78757fa4ab31ab7dbcd59dbf090db1ecdcc4a3f
|
a172ded8d09b54fffbc27c34e9141fb63fbe5d4d
|
refs/heads/master
| 2020-07-10T03:48:22.422998
| 2019-12-16T07:54:51
| 2019-12-16T07:54:51
| 204,159,802
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,903
|
h
|
WaterPlane.h
|
#pragma once
#include "Drawable.h"
class WaterPlane : public Drawable
{
public:
WaterPlane(Graphics& gfx, float size);
void SetPos(DirectX::XMFLOAT3 pos) noexcept;
void SetRotation(float roll, float pitch, float yaw) noexcept;
DirectX::XMMATRIX GetTransformXM() const noexcept override;
void SpawnControlWindow(Graphics& gfx) noexcept;
void ChangeSphereMaterialState(Graphics& gfx, float pitch, float yaw, float roll) noexcept;
void Bind(Graphics& gfx, float deltaTime) noexcept;
public:
struct VSMaterialConstant
{
float time;
alignas(16) DirectX::XMFLOAT4 amplitude = { 0.071f,0.032f,0.048f,0.063f };
alignas(16) DirectX::XMFLOAT4 speed = { 0.097f,0.258f,0.179f,0.219f };
alignas(16) DirectX::XMFLOAT4 wavelength = { 0.887f,0.774f,0.790f,0.844f };
alignas(16) DirectX::XMFLOAT4 omega = { 0.0f,0.0f,0.0f,0.0f };
alignas(16) DirectX::XMFLOAT4 Q = { 1.0f,0.871f,0.935f,0.844f };
alignas(16) DirectX::XMFLOAT4 directionX = { 0.0f,0.113f,0.306f,0.281f };
alignas(16) DirectX::XMFLOAT4 directionZ = { 0.629f,0.081f,0.484f,0.156f };
alignas(16) DirectX::XMFLOAT3 color = { 0.0f,0.384313f,0.580392f };
alignas(16) DirectX::XMFLOAT3 attenuation = { 5.0f,5.0f,5.0f };
alignas(16) DirectX::XMFLOAT3 scatteringKd = { 1.0f,1.0f,1.0f };
float depth = 1.0f;
float padding[2];
} vmc;
struct PSMaterialConstant
{
/*float specularIntensity = 0.18f;
float specularPower = 18.0f;
BOOL normalMappingEnabled = TRUE;
float padding[1];*/
float metallic = 0.572f;
float roughness = 0.321f;
BOOL normalMappingEnabled = TRUE;
DirectX::XMMATRIX EVRotation = DirectX::XMMatrixIdentity();
float time = 0.0f;
float speed = 0.25f;
float depth = 2.471;
float tilling = 1.0f;
float flatten1 = 0.182f;
float flatten2 = 0.0f;
float padding[3];
} pmc;
private:
DirectX::XMFLOAT3 pos = { 0.0f,0.0f,0.0f };
float roll = 0.0f;
float pitch = 0.0f;
float yaw = 0.0f;
};
|
ecf27450132f5ab5b66d81306d5a13296f1bcbfb
|
d03c789b56d33e4d218719ea498ee09b3290c7cb
|
/client/dayz_code/configs/CfgMagazines/bullets/b_762x51.hpp
|
985b59b3d514d895adde4b34d9d1ae55cd111857
|
[] |
no_license
|
thyjukki/End-of-DayZ
|
cbaed9bf547f668a28f93cb98a718582931da281
|
2f42f178a6f46c469e4ee1fec2c4658688d4d6ce
|
refs/heads/master
| 2021-01-19T02:56:21.226440
| 2016-08-09T08:36:01
| 2016-08-09T08:36:01
| 36,795,551
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 42,964
|
hpp
|
b_762x51.hpp
|
class 762x51_x1 : baseBullet {
scope = public;
displayName = "7.62x51mm (x1)";
ammo = "B_762x51_Ball";
bulletCount = 1;
baseName = "762x51_x";
initSpeed=780;
baseDesc = "7.62x51mm";
picture = "\dayz_equip\textures\equip_ball.paa";
model = "\dayz_equip\models\ammo_acp45.p3d";
descriptionShort = "Caliber: 7.62x51mm rounds";
class ItemActions {
class Stack {
text = "Stack...";
script = "spawn player_combineAmmo;";
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_x2 : 762x51_x1 {
scope = public;
displayName = "7.62x51mm (x2)";
bulletCount = 2;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_x1",
"762x51_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_x3 : 762x51_x1 {
scope = public;
displayName = "7.62x51mm (x3)";
bulletCount = 3;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_x1",
"762x51_x1",
"762x51_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_x4 : 762x51_x1 {
scope = public;
displayName = "7.62x51mm (x4)";
bulletCount = 4;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_x1",
"762x51_x1",
"762x51_x1",
"762x51_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_x5 : 762x51_x1 {
scope = public;
displayName = "7.62x51mm (x5)";
bulletCount = 5;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_x1",
"762x51_x1",
"762x51_x1",
"762x51_x1",
"762x51_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_x6 : 762x51_x1 {
scope = public;
displayName = "7.62x51mm (x6)";
bulletCount = 6;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_x1",
"762x51_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_x7 : 762x51_x1 {
scope = public;
displayName = "7.62x51mm (x7)";
bulletCount = 7;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x5...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_x1",
"762x51_x1",
"762x51_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_x8 : 762x51_x1 {
scope = public;
displayName = "7.62x51mm (x8)";
bulletCount = 8;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x5...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_x1",
"762x51_x1",
"762x51_x1",
"762x51_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_x9 : 762x51_x1 {
scope = public;
displayName = "7.62x51mm (x9)";
bulletCount = 9;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x9...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_x1",
"762x51_x1",
"762x51_x1",
"762x51_x1",
"762x51_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_x10 : 762x51_x1 {
scope = public;
displayName = "7.62x51mm (x10)";
bulletCount = 10;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x5...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_x5",
"762x51_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_x20 : 762x51_x1 {
scope = public;
displayName = "7.62x51mm (x20)";
bulletCount = 20;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_x10",
"762x51_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_x30 : 762x51_x1 {
scope = public;
displayName = "7.62x51mm (x30)";
bulletCount = 30;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_x20",
"762x51_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_x40 : 762x51_x1 {
scope = public;
displayName = "7.62x51mm (x40)";
bulletCount = 40;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_x30",
"762x51_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_x50 : 762x51_x1 {
scope = public;
displayName = "7.62x51mm (x50)";
bulletCount = 50;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_x40",
"762x51_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_x100 : 762x51_x1 {
scope = public;
displayName = "7.62x51mm (x100)";
bulletCount = 100;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x50...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_x50",
"762x51_x50"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_HP_x1 : 762x51_x1 {
scope = public;
displayName = "7.62x51mm HP (x1)";
ammo = "B_762x51_HP";
bulletCount = 1;
baseName = "762x51_HP_x";
baseDesc = "7.62x51mm Hollow Point";
picture = "\dayz_equip\textures\equip_hp.paa";
model = "\dayz_equip\models\ammo_acp45.p3d";
descriptionShort = "Caliber: 7.62x51mm Hollow Point rounds";
displayNameShort="HP";
class ItemActions {
class Stack {
text = "Stack...";
script = "spawn player_combineAmmo;";
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_HP_x2 : 762x51_HP_x1 {
scope = public;
displayName = "7.62x51mm HP (x2)";
bulletCount = 2;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_HP_x1",
"762x51_HP_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_HP_x3 : 762x51_HP_x1 {
scope = public;
displayName = "7.62x51mm HP (x3)";
bulletCount = 3;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_HP_x1",
"762x51_HP_x1",
"762x51_HP_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_HP_x4 : 762x51_HP_x1 {
scope = public;
displayName = "7.62x51mm HP (x4)";
bulletCount = 4;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_HP_x1",
"762x51_HP_x1",
"762x51_HP_x1",
"762x51_HP_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_HP_x5 : 762x51_HP_x1 {
scope = public;
displayName = "7.62x51mm HP (x5)";
bulletCount = 5;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_HP_x1",
"762x51_HP_x1",
"762x51_HP_x1",
"762x51_HP_x1",
"762x51_HP_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_HP_x6 : 762x51_HP_x1 {
scope = public;
displayName = "7.62x51mm HP (x6)";
bulletCount = 6;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_HP_x1",
"762x51_HP_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_HP_x7 : 762x51_HP_x1 {
scope = public;
displayName = "7.62x51mm HP (x7)";
bulletCount = 7;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x5...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_HP_x1",
"762x51_HP_x1",
"762x51_HP_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_HP_x8 : 762x51_HP_x1 {
scope = public;
displayName = "7.62x51mm HP (x8)";
bulletCount = 8;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x5...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_HP_x1",
"762x51_HP_x1",
"762x51_HP_x1",
"762x51_HP_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_HP_x9 : 762x51_HP_x1 {
scope = public;
displayName = "7.62x51mm HP (x9)";
bulletCount = 9;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x9...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_HP_x1",
"762x51_HP_x1",
"762x51_HP_x1",
"762x51_HP_x1",
"762x51_HP_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_HP_x10 : 762x51_HP_x1 {
scope = public;
displayName = "7.62x51mm HP (x10)";
bulletCount = 10;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x5...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_HP_x5",
"762x51_HP_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_HP_x20 : 762x51_HP_x1 {
scope = public;
displayName = "7.62x51mm HP (x20)";
bulletCount = 20;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_HP_x10",
"762x51_HP_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_HP_x30 : 762x51_HP_x1 {
scope = public;
displayName = "7.62x51mm HP (x30)";
bulletCount = 30;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_HP_x20",
"762x51_HP_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_HP_x40 : 762x51_HP_x1 {
scope = public;
displayName = "7.62x51mm HP (x40)";
bulletCount = 40;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_HP_x30",
"762x51_HP_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_HP_x50 : 762x51_HP_x1 {
scope = public;
displayName = "7.62x51mm HP (x50)";
bulletCount = 50;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_HP_x40",
"762x51_HP_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_HP_x100 : 762x51_HP_x1 {
scope = public;
displayName = "7.62x51mm HP (x100)";
bulletCount = 100;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x50...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_HP_x50",
"762x51_HP_x50"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_TRACER_x1 : 762x51_x1 {
scope = public;
displayName = "7.62x51mm Tracer (x1)";
ammo = "B_762x51_TRACER";
bulletCount = 1;
baseName = "762x51_TRACER_x";
baseDesc = "7.62x51mm Tracer";
picture = "\dayz_equip\textures\equip_tracer.paa";
model = "\dayz_equip\models\ammo_acp45.p3d";
descriptionShort = "Caliber: 7.62x51mm Tracer rounds";
displayNameShort="Tracer";
class ItemActions {
class Stack {
text = "Stack...";
script = "spawn player_combineAmmo;";
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_TRACER_x2 : 762x51_TRACER_x1 {
scope = public;
displayName = "7.62x51mm Tracer (x2)";
bulletCount = 2;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_TRACER_x1",
"762x51_TRACER_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_TRACER_x3 : 762x51_TRACER_x1 {
scope = public;
displayName = "7.62x51mm Tracer (x3)";
bulletCount = 3;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_TRACER_x1",
"762x51_TRACER_x1",
"762x51_TRACER_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_TRACER_x4 : 762x51_TRACER_x1 {
scope = public;
displayName = "7.62x51mm Tracer (x4)";
bulletCount = 4;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_TRACER_x1",
"762x51_TRACER_x1",
"762x51_TRACER_x1",
"762x51_TRACER_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_TRACER_x5 : 762x51_TRACER_x1 {
scope = public;
displayName = "7.62x51mm Tracer (x5)";
bulletCount = 5;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_TRACER_x1",
"762x51_TRACER_x1",
"762x51_TRACER_x1",
"762x51_TRACER_x1",
"762x51_TRACER_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_TRACER_x6 : 762x51_TRACER_x1 {
scope = public;
displayName = "7.62x51mm Tracer (x6)";
bulletCount = 6;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_TRACER_x1",
"762x51_TRACER_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_TRACER_x7 : 762x51_TRACER_x1 {
scope = public;
displayName = "7.62x51mm Tracer (x7)";
bulletCount = 7;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x5...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_TRACER_x1",
"762x51_TRACER_x1",
"762x51_TRACER_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_TRACER_x8 : 762x51_TRACER_x1 {
scope = public;
displayName = "7.62x51mm Tracer (x8)";
bulletCount = 8;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x5...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_TRACER_x1",
"762x51_TRACER_x1",
"762x51_TRACER_x1",
"762x51_TRACER_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_TRACER_x9 : 762x51_TRACER_x1 {
scope = public;
displayName = "7.62x51mm Tracer (x9)";
bulletCount = 9;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x9...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_TRACER_x1",
"762x51_TRACER_x1",
"762x51_TRACER_x1",
"762x51_TRACER_x1",
"762x51_TRACER_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_TRACER_x10 : 762x51_TRACER_x1 {
scope = public;
displayName = "7.62x51mm Tracer (x10)";
bulletCount = 10;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x5...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_TRACER_x5",
"762x51_TRACER_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_TRACER_x20 : 762x51_TRACER_x1 {
scope = public;
displayName = "7.62x51mm Tracer (x20)";
bulletCount = 20;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_TRACER_x10",
"762x51_TRACER_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_TRACER_x30 : 762x51_TRACER_x1 {
scope = public;
displayName = "7.62x51mm Tracer (x30)";
bulletCount = 30;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_TRACER_x20",
"762x51_TRACER_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_TRACER_x40 : 762x51_TRACER_x1 {
scope = public;
displayName = "7.62x51mm Tracer (x40)";
bulletCount = 40;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_TRACER_x30",
"762x51_TRACER_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_TRACER_x50 : 762x51_TRACER_x1 {
scope = public;
displayName = "7.62x51mm Tracer (x50)";
bulletCount = 50;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_TRACER_x40",
"762x51_TRACER_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_TRACER_x100 : 762x51_TRACER_x1 {
scope = public;
displayName = "7.62x51mm Tracer (x100)";
bulletCount = 100;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x50...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_TRACER_x50",
"762x51_TRACER_x50"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_RUBBER_x1 : 762x51_x1 {
scope = public;
displayName = "7.62x51mm Rubber (x1)";
ammo = "B_762x51_RUBBER";
initSpeed=200;
bulletCount = 1;
baseName = "762x51_RUBBER_x";
baseDesc = "7.62x51mm Rubber";
picture = "\dayz_equip\textures\equip_rubber.paa";
model = "\dayz_equip\models\ammo_acp45.p3d";
descriptionShort = "Caliber: 7.62x51mm Rubber rounds";
displayNameShort="Rubber";
class ItemActions {
class Stack {
text = "Stack...";
script = "spawn player_combineAmmo;";
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_RUBBER_x2 : 762x51_RUBBER_x1 {
scope = public;
displayName = "7.62x51mm Rubber (x2)";
bulletCount = 2;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_RUBBER_x1",
"762x51_RUBBER_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_RUBBER_x3 : 762x51_RUBBER_x1 {
scope = public;
displayName = "7.62x51mm Rubber (x3)";
bulletCount = 3;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_RUBBER_x1",
"762x51_RUBBER_x1",
"762x51_RUBBER_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_RUBBER_x4 : 762x51_RUBBER_x1 {
scope = public;
displayName = "7.62x51mm Rubber (x4)";
bulletCount = 4;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_RUBBER_x1",
"762x51_RUBBER_x1",
"762x51_RUBBER_x1",
"762x51_RUBBER_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_RUBBER_x5 : 762x51_RUBBER_x1 {
scope = public;
displayName = "7.62x51mm Rubber (x5)";
bulletCount = 5;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_RUBBER_x1",
"762x51_RUBBER_x1",
"762x51_RUBBER_x1",
"762x51_RUBBER_x1",
"762x51_RUBBER_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_RUBBER_x6 : 762x51_RUBBER_x1 {
scope = public;
displayName = "7.62x51mm Rubber (x6)";
bulletCount = 6;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_RUBBER_x1",
"762x51_RUBBER_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_RUBBER_x7 : 762x51_RUBBER_x1 {
scope = public;
displayName = "7.62x51mm Rubber (x7)";
bulletCount = 7;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x5...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_RUBBER_x1",
"762x51_RUBBER_x1",
"762x51_RUBBER_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_RUBBER_x8 : 762x51_RUBBER_x1 {
scope = public;
displayName = "7.62x51mm Rubber (x8)";
bulletCount = 8;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x5...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_RUBBER_x1",
"762x51_RUBBER_x1",
"762x51_RUBBER_x1",
"762x51_RUBBER_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_RUBBER_x9 : 762x51_RUBBER_x1 {
scope = public;
displayName = "7.62x51mm Rubber (x9)";
bulletCount = 9;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x9...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_RUBBER_x1",
"762x51_RUBBER_x1",
"762x51_RUBBER_x1",
"762x51_RUBBER_x1",
"762x51_RUBBER_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_RUBBER_x10 : 762x51_RUBBER_x1 {
scope = public;
displayName = "7.62x51mm Rubber (x10)";
bulletCount = 10;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x5...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_RUBBER_x5",
"762x51_RUBBER_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_RUBBER_x20 : 762x51_RUBBER_x1 {
scope = public;
displayName = "7.62x51mm Rubber (x20)";
bulletCount = 20;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_RUBBER_x10",
"762x51_RUBBER_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_RUBBER_x30 : 762x51_RUBBER_x1 {
scope = public;
displayName = "7.62x51mm Rubber (x30)";
bulletCount = 30;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_RUBBER_x20",
"762x51_RUBBER_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_RUBBER_x40 : 762x51_RUBBER_x1 {
scope = public;
displayName = "7.62x51mm Rubber (x40)";
bulletCount = 40;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_RUBBER_x30",
"762x51_RUBBER_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_RUBBER_x50 : 762x51_RUBBER_x1 {
scope = public;
displayName = "7.62x51mm Rubber (x50)";
bulletCount = 50;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_RUBBER_x40",
"762x51_RUBBER_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_RUBBER_x100 : 762x51_RUBBER_x1 {
scope = public;
displayName = "7.62x51mm Rubber (x100)";
bulletCount = 100;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x50...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_RUBBER_x50",
"762x51_RUBBER_x50"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_BT_x1 : 762x51_x1 {
scope = public;
displayName = "7.62x51mm Ballistic Tip (x1)";
ammo = "B_762x51_BT";
bulletCount = 1;
baseName = "762x51_BT_x";
baseDesc = "7.62x51mm Ballistic Tip";
picture = "\dayz_equip\textures\equip_bt.paa";
model = "\dayz_equip\models\ammo_acp45.p3d";
descriptionShort = "Caliber: 7.62x51mm Ballistic Tip rounds";
displayNameShort="BT";
class ItemActions {
class Stack {
text = "Stack...";
script = "spawn player_combineAmmo;";
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_BT_x2 : 762x51_BT_x1 {
scope = public;
displayName = "7.62x51mm Ballistic Tip (x2)";
bulletCount = 2;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_BT_x1",
"762x51_BT_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_BT_x3 : 762x51_BT_x1 {
scope = public;
displayName = "7.62x51mm Ballistic Tip (x3)";
bulletCount = 3;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_BT_x1",
"762x51_BT_x1",
"762x51_BT_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_BT_x4 : 762x51_BT_x1 {
scope = public;
displayName = "7.62x51mm Ballistic Tip (x4)";
bulletCount = 4;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_BT_x1",
"762x51_BT_x1",
"762x51_BT_x1",
"762x51_BT_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_BT_x5 : 762x51_BT_x1 {
scope = public;
displayName = "7.62x51mm Ballistic Tip (x5)";
bulletCount = 5;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_BT_x1",
"762x51_BT_x1",
"762x51_BT_x1",
"762x51_BT_x1",
"762x51_BT_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_BT_x6 : 762x51_BT_x1 {
scope = public;
displayName = "7.62x51mm Ballistic Tip (x6)";
bulletCount = 6;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_BT_x1",
"762x51_BT_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_BT_x7 : 762x51_BT_x1 {
scope = public;
displayName = "7.62x51mm Ballistic Tip (x7)";
bulletCount = 7;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x5...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_BT_x1",
"762x51_BT_x1",
"762x51_BT_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_BT_x8 : 762x51_BT_x1 {
scope = public;
displayName = "7.62x51mm Ballistic Tip (x8)";
bulletCount = 8;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x5...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_BT_x1",
"762x51_BT_x1",
"762x51_BT_x1",
"762x51_BT_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_BT_x9 : 762x51_BT_x1 {
scope = public;
displayName = "7.62x51mm Ballistic Tip (x9)";
bulletCount = 9;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x9...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_BT_x1",
"762x51_BT_x1",
"762x51_BT_x1",
"762x51_BT_x1",
"762x51_BT_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_BT_x10 : 762x51_BT_x1 {
scope = public;
displayName = "7.62x51mm Ballistic Tip (x10)";
bulletCount = 10;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x5...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_BT_x5",
"762x51_BT_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_BT_x20 : 762x51_BT_x1 {
scope = public;
displayName = "7.62x51mm Ballistic Tip (x20)";
bulletCount = 20;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_BT_x10",
"762x51_BT_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_BT_x30 : 762x51_BT_x1 {
scope = public;
displayName = "7.62x51mm Ballistic Tip (x30)";
bulletCount = 30;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_BT_x20",
"762x51_BT_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_BT_x40 : 762x51_BT_x1 {
scope = public;
displayName = "7.62x51mm Ballistic Tip (x40)";
bulletCount = 40;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_BT_x30",
"762x51_BT_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_BT_x50 : 762x51_BT_x1 {
scope = public;
displayName = "7.62x51mm Ballistic Tip (x50)";
bulletCount = 50;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_BT_x40",
"762x51_BT_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_BT_x100 : 762x51_BT_x1 {
scope = public;
displayName = "7.62x51mm Ballistic Tip (x100)";
bulletCount = 100;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x50...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_BT_x50",
"762x51_BT_x50"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_SD_x1 : 762x51_x1 {
scope = public;
displayName = "7.62x51mm SD (x1)";
ammo = "B_762x51_SD";
bulletCount = 1;
baseName = "762x51_SD_x";
initSpeed=320;
baseDesc = "7.62x51mm SD";
picture = "\dayz_equip\textures\equip_sd.paa";
model = "\dayz_equip\models\ammo_acp45.p3d";
descriptionShort = "Caliber: 7.62x51mm SD rounds";
displayNameShort="SD";
class ItemActions {
class Stack {
text = "Stack...";
script = "spawn player_combineAmmo;";
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_SD_x2 : 762x51_SD_x1 {
scope = public;
displayName = "7.62x51mm SD (x2)";
bulletCount = 2;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_SD_x1",
"762x51_SD_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_SD_x3 : 762x51_SD_x1 {
scope = public;
displayName = "7.62x51mm SD (x3)";
bulletCount = 3;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_SD_x1",
"762x51_SD_x1",
"762x51_SD_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_SD_x4 : 762x51_SD_x1 {
scope = public;
displayName = "7.62x51mm SD (x4)";
bulletCount = 4;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_SD_x1",
"762x51_SD_x1",
"762x51_SD_x1",
"762x51_SD_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_SD_x5 : 762x51_SD_x1 {
scope = public;
displayName = "7.62x51mm SD (x5)";
bulletCount = 5;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_SD_x1",
"762x51_SD_x1",
"762x51_SD_x1",
"762x51_SD_x1",
"762x51_SD_x1"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_SD_x6 : 762x51_SD_x1 {
scope = public;
displayName = "7.62x51mm SD (x6)";
bulletCount = 6;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x1";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_SD_x1",
"762x51_SD_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_SD_x7 : 762x51_SD_x1 {
scope = public;
displayName = "7.62x51mm SD (x7)";
bulletCount = 7;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x5...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_SD_x1",
"762x51_SD_x1",
"762x51_SD_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_SD_x8 : 762x51_SD_x1 {
scope = public;
displayName = "7.62x51mm SD (x8)";
bulletCount = 8;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x5...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_SD_x1",
"762x51_SD_x1",
"762x51_SD_x1",
"762x51_SD_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_SD_x9 : 762x51_SD_x1 {
scope = public;
displayName = "7.62x51mm SD (x9)";
bulletCount = 9;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x9...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_SD_x1",
"762x51_SD_x1",
"762x51_SD_x1",
"762x51_SD_x1",
"762x51_SD_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_SD_x10 : 762x51_SD_x1 {
scope = public;
displayName = "7.62x51mm SD (x10)";
bulletCount = 10;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x5...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_SD_x5",
"762x51_SD_x5"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_SD_x20 : 762x51_SD_x1 {
scope = public;
displayName = "7.62x51mm SD (x20)";
bulletCount = 20;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_SD_x10",
"762x51_SD_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_SD_x30 : 762x51_SD_x1 {
scope = public;
displayName = "7.62x51mm SD (x30)";
bulletCount = 30;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_SD_x20",
"762x51_SD_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_SD_x40 : 762x51_SD_x1 {
scope = public;
displayName = "7.62x51mm SD (x40)";
bulletCount = 40;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_SD_x30",
"762x51_SD_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_SD_x50 : 762x51_SD_x1 {
scope = public;
displayName = "7.62x51mm SD (x50)";
bulletCount = 50;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x10...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_SD_x40",
"762x51_SD_x10"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
class 762x51_SD_x100 : 762x51_SD_x1 {
scope = public;
displayName = "7.62x51mm SD (x100)";
bulletCount = 100;
class ItemActions {
class Stack {
text = "Stack..";
script = "spawn player_combineAmmo;";
};
class Split {
text = "Split to x50...";
script = "spawn player_splitAmmo;";
out[] = {
"762x51_SD_x50",
"762x51_SD_x50"};
};
class loadMag {
text = "Load to...";
script = "spawn player_loadAmmo;";
};
};
};
|
c5466d65a9f141b3e3fc210c5ccb090aeaaec1dc
|
1b4c547ab90aa5157b04d16abfda75b5b5e52259
|
/2 семестр/Лабораторная работа 14/node.hpp
|
0d0de4c9a2807c55b6d830653d5b91b4eb5c695f
|
[] |
no_license
|
akimich11/Cpp-Labs
|
73c75bf0043cf3c81590e78434569bef6b355f7d
|
61e58a0678d370c5c72553052042c744286ed6bd
|
refs/heads/master
| 2023-02-22T16:39:41.351805
| 2021-01-25T12:00:43
| 2021-01-25T12:00:43
| 332,727,528
| 1
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 418
|
hpp
|
node.hpp
|
#pragma once
class Node
{
private:
int Info;
Node* Left;
Node* Right;
Node* Father;
friend class Tree;
public:
Node(): Left(NULL), Right(NULL), Father(NULL){};
Node(const int& c): Info(c), Left(NULL), Right(NULL), Father(NULL){};
int GetInfo() { return Info; };
Node* GetRight() { return Right; };
Node* GetLeft() { return Left; };
Node* Getfather() { return Father; };
};
|
1f233c478be423ca911332bff4bad678daf04099
|
d17a8870ff8ac77b82d0d37e20c85b23aa29ca74
|
/lite/backends/x86/math/concat_and_split.cc
|
df75654aebaba26b9889d97445bd889cdf2f4eb0
|
[
"Apache-2.0"
] |
permissive
|
PaddlePaddle/Paddle-Lite
|
4ab49144073451d38da6f085a8c56822caecd5b2
|
e241420f813bd91f5164f0d9ee0bc44166c0a172
|
refs/heads/develop
| 2023-09-02T05:28:14.017104
| 2023-09-01T10:32:39
| 2023-09-01T10:32:39
| 104,208,128
| 2,545
| 1,041
|
Apache-2.0
| 2023-09-12T06:46:10
| 2017-09-20T11:41:42
|
C++
|
UTF-8
|
C++
| false
| false
| 4,204
|
cc
|
concat_and_split.cc
|
/* Copyright (c) 2018 paddlepaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include "lite/backends/x86/math/concat_and_split.h"
#include <algorithm>
#include <vector>
namespace paddle {
namespace lite {
namespace x86 {
namespace math {
/*
* All tensors' dimension should be the same and the values of
* each dimension must be the same, except the axis dimension.
*/
template <typename T>
class ConcatFunctor<lite::TargetType::kX86, T> {
public:
void operator()(const lite::X86Context& context,
const std::vector<lite::Tensor>& input,
int axis,
lite::Tensor* output) {
// TODO(zcd): Add input data validity checking
int num = input.size();
int rows = 1;
auto dim_0 = input[0].dims();
for (int i = 0; i < axis; ++i) {
rows *= dim_0[i];
}
int out_rows = rows, out_cols = 0;
std::vector<int64_t> input_cols(input.size());
for (int i = 0; i < num; ++i) {
int t_cols = input[i].numel() / rows;
out_cols += t_cols;
input_cols[i] = t_cols;
}
// auto cpu_place = boost::get<platform::CPUPlace>(context.GetPlace());
// computation
auto output_data = output->template mutable_data<T>();
int col_idx = 0;
for (int j = 0; j < num; ++j) {
int col_len = input_cols[j];
auto* input_data = input[j].data<T>();
for (int k = 0; k < out_rows; ++k) {
// memory::Copy(cpu_place, output_data + k * out_cols + col_idx,
// cpu_place,
// input_data + k * col_len, sizeof(T) * col_len);
std::copy_n(input_data + k * col_len,
col_len,
output_data + k * out_cols + col_idx);
}
col_idx += col_len;
}
}
};
/*
* All tensors' dimension should be the same and the values of
* each dimension must be the same, except the axis dimension.
*/
template <typename T>
class SplitFunctor<lite::TargetType::kX86, T> {
public:
void operator()(const lite::X86Context& context,
const lite::Tensor& input,
const std::vector<const lite::Tensor*>& ref_inputs,
const int axis,
std::vector<lite::Tensor*>* outputs) {
// TODO(zcd): Add input data validity checking
size_t num = outputs->size();
int input_rows = 1;
auto dim_0 = ref_inputs[0]->dims();
for (int i = 0; i < axis; ++i) {
input_rows *= dim_0[i];
}
int input_cols = 0;
std::vector<int64_t> output_cols(outputs->size());
for (size_t i = 0; i < num; ++i) {
int t_cols = ref_inputs[i]->numel() / input_rows;
input_cols += t_cols;
output_cols[i] = t_cols;
}
// auto cpu_place = boost::get<platform::CPUPlace>(context.GetPlace());
// computation
for (int k = 0; k < input_rows; ++k) {
const T* src_ptr = input.data<T>() + k * input_cols;
int col_idx = 0;
for (size_t j = 0; j < num; ++j) {
int col_len = output_cols[j];
auto* out_tensor = outputs->at(j);
if (out_tensor != nullptr) {
T* dst_ptr = out_tensor->template mutable_data<T>() + k * col_len;
std::copy_n(src_ptr + col_idx, col_len, dst_ptr);
// memory::Copy(cpu_place, dst_ptr, cpu_place, src_ptr + col_idx,
// sizeof(T) * col_len);
}
col_idx += col_len;
}
}
}
};
#define DEFINE_FUNCTOR(type) \
template class ConcatFunctor<lite::TargetType::kX86, type>; \
template class SplitFunctor<lite::TargetType::kX86, type>;
FOR_ALL_TYPES(DEFINE_FUNCTOR);
} // namespace math
} // namespace x86
} // namespace lite
} // namespace paddle
|
505945645b7c7189f5279be69084eb5421207437
|
3ea06db0a30bc609ed2411209111f6d163edebd4
|
/eloncplusplus/src/util/memory.cpp
|
729144d93ea08217d01a3c1d5ff6a3fdfa41a4d4
|
[
"Apache-2.0"
] |
permissive
|
ylforever/elon-cplusplus
|
872785bd83c8af75eb5f0b613366c71862bba0c9
|
7ed4e33b2567d741fc31c480b593399ea4561872
|
refs/heads/master
| 2022-10-22T01:44:02.059282
| 2022-10-14T06:25:05
| 2022-10-14T06:25:05
| 121,075,697
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 44
|
cpp
|
memory.cpp
|
#pragma once
#include "src/util_h/memory.h"
|
4c1a7e5c8bcc3f0eb69bd5170b6e1814115080e3
|
2dfb188267cb75688ffdc3575b54cc89d0247feb
|
/MultiWii.ino
|
746013adce7e023024430da810acad409c308c18
|
[] |
no_license
|
Ziege-One/MultiHoTT-Module
|
0140fa947ee406ca5c5a1234e915820b8c360f7e
|
1d699f531e2abc3798378698c6ad40b3dbbc5375
|
refs/heads/master
| 2021-01-21T03:33:58.562462
| 2012-10-26T09:48:32
| 2012-10-26T09:48:32
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,154
|
ino
|
MultiWii.ino
|
#include "MultiHoTTModule.h"
/**
* Requests via serial interface data from MultWii (>= 2.1) and stores requested
* data in MultiHoTTModule struct. Requests at least REQUEST_DATA_DELAY milliseconds
* a new data frame. Frames are requested in Round Robin.
*/
#define REQUEST_DATA_DELAY 250
#define INPUT_BUFFER_SIZE 64
#define MSP_IDENT 100
#define MSP_STATUS 101
#define MSP_BAT 110
#define MSP_ALTITUDE 109
static uint8_t inBuffer[INPUT_BUFFER_SIZE];
const static uint8_t schedule[] = { MSP_BAT, MSP_ALTITUDE };
/**
* Main method of MultiWii integration.
*/
void multiWiiRequestData() {
static uint32_t previousMillis = 0;
static uint8_t index = 0;
if ((millis() - previousMillis) > REQUEST_DATA_DELAY) {
previousMillis = millis();
if (Serial.available() == 0) {
mwRequestData(schedule[index++ % sizeof(schedule)]);
} else {
mwEvaluateResponse();
}
}
}
/**
* Sends a request to MultiWii with given cmd
*/
static void mwRequestData(uint8_t cmd) {
char cmdBuffer[6] = { '$', 'M', '<', 0x0, cmd, cmd };
if (0 == Serial.available()) {
for (uint8_t i = 0; i < 6; i++) {
Serial.write(cmdBuffer[i]);
}
}
}
/**
* Reads a MultWii command from serial interface and stores result in
* inBuffer.
*/
void mwEvaluateResponse() {
uint8_t c = 0;
uint8_t cmd = 0;
uint8_t checksum = 0;
uint8_t payloadSize = 0;
uint8_t offset = 0;
static enum _serial_state {
IDLE,
HEADER_START,
HEADER_M,
HEADER_ARROW,
HEADER_SIZE,
HEADER_CMD,
} c_state = IDLE;
while(Serial.available()) {
c = Serial.read();
if (IDLE == c_state) {
c_state = ('$' == c) ? HEADER_START : IDLE;
} else if (HEADER_START == c_state) {
c_state = ('M' == c) ? HEADER_M : IDLE;
} else if (HEADER_M == c_state) {
c_state = ('>' == c) ? HEADER_ARROW : IDLE;
} else if (HEADER_ARROW == c_state) {
checksum = 0;
offset = 0;
memset(inBuffer, 0, sizeof(inBuffer));
payloadSize = c;
checksum ^= c;
c_state = HEADER_SIZE;
} else if (HEADER_SIZE == c_state) {
cmd = c;
checksum ^= c;
c_state = HEADER_CMD;
} else if (HEADER_CMD == c_state && offset < payloadSize) {
checksum ^= c;
inBuffer[offset++] = c;
} else if (HEADER_CMD == c_state && offset >= payloadSize) {
if (checksum == c) {
mwEvaluateMSPResponse(cmd, inBuffer);
}
c_state = IDLE;
}
}
}
/**
* Evaluates valid MultiWii Serial Protocol message and
* stores needed data for later transmission via HoTT.
*/
static void mwEvaluateMSPResponse(uint8_t cmd, uint8_t *data) {
switch(cmd) {
case MSP_BAT:
mwEvaluateMSP_BAT(data);
break;
case MSP_ALTITUDE:
mwEvaluateMSP_ALTITUDE(data);
break;
}
}
/**
* Reads VBAT from given MSP data frame and stores it for later usage.
*/
static void mwEvaluateMSP_BAT(uint8_t *data) {
MultiHoTTModule.driveVoltage = data[0];
}
/**
* Reads altitude from MSP data frame and stores it for later usage.
*/
static void mwEvaluateMSP_ALTITUDE(uint8_t *data) {
}
|
4889fb5f81a7c9d1a43d4dc1f31706a09f014335
|
74870e1d278f20027ea0213d9d87ee6128a01f65
|
/Q16236_3.cpp
|
9833a4b7a727005471ea0c0bb5ec8e57a8b004d1
|
[] |
no_license
|
jleun1403/BOJ_CPP
|
795816db9e8a2828ec48aaf9f8da9276d4b0abef
|
415502a8fd7093f469a3b7bf1c5e756505ae0e76
|
refs/heads/master
| 2020-07-10T01:28:42.157301
| 2019-08-24T11:41:03
| 2019-08-24T11:41:03
| 204,131,610
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,157
|
cpp
|
Q16236_3.cpp
|
#include <bits/stdc++.h>
using namespace std;
int n;
int a[21][21];
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, -1, 1};
int dist[21][21];
int startx, starty;
int sharksize;
int eat_num;
int ans;
void bfs(int xx, int yy){
queue <pair<int,int>> q;
q.push(make_pair(xx,yy));
dist[xx][yy] = 1;
while(!q.empty()){
int x =q.front().first;
int y = q.front().second;
q.pop();
for(int k=0; k<4; k++){
int nx = x + dx[k];
int ny = y + dy[k];
if(nx>=0 && nx <n && ny>=0 && ny <n){
if((a[nx][ny] <= sharksize || a[nx][ny] == 0) && dist[nx][ny] == 0){
dist[nx][ny] = dist[x][y] +1;
q.push(make_pair(nx,ny));
}
}
}
}
}
int main(){
cin >> n;
sharksize = 2;
eat_num = 0;
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
cin >> a[i][j];
if(a[i][j] == 9){
startx = i;
starty = j;
}
}
}
while(true){
memset(dist, 0, sizeof(dist));
int mindist = 987654321;
bfs(startx, starty);
int caneat = 0;
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
if(dist[i][j] !=0 && a[i][j] < sharksize && a[i][j] !=0){
caneat +=1;
mindist = min(mindist, dist[i][j]);
}
}
}
if(caneat ==0) break;
bool found = false;
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
if(dist[i][j] == mindist && a[i][j] < sharksize && a[i][j] !=0){
eat_num +=1;
a[i][j] = 9;
a[startx][starty] = 0;
startx = i;
starty = j;
found = true;
break;
}
}
if(found==true) break;
}
if(sharksize == eat_num){
sharksize +=1;
eat_num = 0;
}
ans += mindist-1;
}
printf("%d\n", ans);
return 0;
}
|
0c62bf0c289fe94c9ad0b1d29048de0f633cefef
|
3d1d2e69d80810b297b5fe70eb841c3fe5d9306d
|
/src/stormcast/Fulminators.cpp
|
da8234a251ea0937775fc5a936e3078e3f2d06cd
|
[
"MIT"
] |
permissive
|
indeterminateoutcomesstudios/AoSSimulator
|
dce3da661f16e9db794cb619685ed4701cd334ef
|
d125464e516b461205aaf23a8cc206ca797e83de
|
refs/heads/master
| 2020-04-26T10:41:22.143680
| 2019-02-24T06:23:52
| 2019-02-24T06:23:52
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,195
|
cpp
|
Fulminators.cpp
|
/*
* Warhammer Age of Sigmar battle simulator.
*
* Copyright (C) 2019 by Rick Weyrauch - rpweyrauch@gmail.com
*
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
*/
#include <stormcast/Fulminators.h>
#include <UnitFactory.h>
namespace StormcastEternals
{
static FactoryMethod factoryMethod = {
Fulminators::Create,
nullptr,
nullptr,
{
{
ParamType::Integer, "numModels", {.m_intValue = Fulminators::MIN_UNIT_SIZE}, Fulminators::MIN_UNIT_SIZE,
Fulminators::MAX_UNIT_SIZE, Fulminators::MIN_UNIT_SIZE
},
},
ORDER,
STORMCAST_ETERNAL
};
bool Fulminators::s_registered = false;
Fulminators::Fulminators() :
StormcastEternal("Fulminators", 10, WOUNDS, 7, 3, false),
m_stormBlast(Weapon::Type::Missile, "Storm Blast", 12, 1, 4, 0, 0, 0),
m_stormstrkeGlaive(Weapon::Type::Melee, "Stormstrike Glaive", 2, 3, 3, 3, -1, 1),
m_clawsAndFangs(Weapon::Type::Melee, "Claws and Fangs", 1, 3, 3, 3, -1, 1)
{
m_keywords = {ORDER, CELESTIAL, HUMAN, DRACOTH, STORMCAST_ETERNAL, DRACOTHIAN_GUARD, FULMINATORS};
}
bool Fulminators::configure(int numModels)
{
if (numModels < MIN_UNIT_SIZE || numModels > MAX_UNIT_SIZE)
{
return false;
}
for (int i = 0; i < numModels; i++)
{
Model model(BASESIZE, WOUNDS);
model.addMissileWeapon(&m_stormBlast);
model.addMeleeWeapon(&m_stormstrkeGlaive);
model.addMeleeWeapon(&m_clawsAndFangs);
addModel(model);
}
m_points = numModels / MIN_UNIT_SIZE * POINTS_PER_BLOCK;
if (numModels == MAX_UNIT_SIZE)
{
m_points = POINTS_MAX_UNIT_SIZE;
}
return true;
}
void Fulminators::visitWeapons(std::function<void(const Weapon *)> &visitor)
{
visitor(&m_stormBlast);
visitor(&m_stormstrkeGlaive);
visitor(&m_clawsAndFangs);
}
Unit *Fulminators::Create(const ParameterList ¶meters)
{
auto unit = new Fulminators();
int numModels = GetIntParam("numModels", parameters, MIN_UNIT_SIZE);
bool ok = unit->configure(numModels);
if (!ok)
{
delete unit;
unit = nullptr;
}
return unit;
}
void Fulminators::Init()
{
if (!s_registered)
{
s_registered = UnitFactory::Register("Fulminators", factoryMethod);
}
}
Wounds Fulminators::weaponDamage(const Weapon *weapon, const Unit *target, int hitRoll, int woundRoll) const
{
// Impaling Strike
if (m_charged && (weapon->name() == m_clawsAndFangs.name()))
{
return {weapon->damage()+2, 0};
}
// Intolerable Damage
if ((hitRoll == 6) && (weapon->name() == m_clawsAndFangs.name()))
{
Dice dice;
return {dice.rollD6(), 0};
}
return StormcastEternal::weaponDamage(weapon, target, hitRoll, woundRoll);
}
Rerolls Fulminators::toSaveRerolls(const Weapon *weapon) const
{
// Sigmarite Shields
return RerollOnes;
}
int Fulminators::toSaveModifier(const Weapon *weapon) const
{
int modifier = StormcastEternal::toSaveModifier(weapon);
// Glaivewall
if (weapon->isMissile())
{
modifier += 1;
}
return modifier;
}
} //namespace StormcastEternals
|
c6d7b72fa7c45a7c948dcbe955c2f503f7977eea
|
b5e4cdae017a4d71867a4bb4be4cebcd70ef8850
|
/Vendig_machine_TM4C/SchedulerClass.cpp
|
e5018b8b90ed578832b5b0845b421af465de3578
|
[] |
no_license
|
frick01/project_cpp_vending_machine
|
47174c1ae14fed4986ec1a9b00352214a85dc4e1
|
06dc7c1c8f2a73963e13e95318448382f62564f5
|
refs/heads/master
| 2022-12-03T05:28:40.216535
| 2020-08-25T18:33:41
| 2020-08-25T18:33:41
| 290,292,304
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,032
|
cpp
|
SchedulerClass.cpp
|
#include "SchedulerClass.h"
void int_Handler(void);
uint32_t ticks;
unsigned int Tick;
unsigned long milis(void);
const unsigned long m_last_ = 0;
#define M_LAST (m_last_ - 1)
static inline unsigned long timing() { return milis(); }
//static inline unsigned long timing() { return micros(); }
// Constructor
SchedulerClass::SchedulerClass(void)
{
SysCtlPeripheralEnable(SYSCTL_PERIPH_WTIMER3);
TimerConfigure(WTIMER3_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_B_PERIODIC);
TimerLoadSet(WTIMER3_BASE, TIMER_B, 12500);
IntEnable(INT_WTIMER3B_TM4C123);
TimerIntEnable(WTIMER3_BASE,TIMER_TIMB_TIMEOUT);
IntRegister(INT_WTIMER3B_TM4C123, int_Handler);
TimerEnable(WTIMER3_BASE, TIMER_B);
nTasks = 0;
}
unsigned char SchedulerClass :: getMaxNTasks(void)
{
return nTasks;
}
int SchedulerClass :: InsertTask (TaskClass *ptrTask)
{
//int ret;
// check if there is room free for inclusion
if (nTasks >= _MAX_N_TASKS)
{
return -1;
}
// if room free, insert and return number of tasks
ptrTaskList[nTasks] = ptrTask;
//ret = nTasks;
nTasks++;
return nTasks;
}
void SchedulerClass :: Start (void)
{
time_prev = timing();
}
bool SchedulerClass :: Run (void)
{
unsigned long time_now;
unsigned long delta_time;
bool ret;
int i;
time_now = timing();
ret = false;
if (time_now == time_prev)
return ret;
if (time_now > time_prev)
{
delta_time = (time_now > time_prev);
}
else // (time_now < time_prev) // will enter here not so often,just in overflow cases.
{
delta_time = ((M_LAST - time_prev) + time_now);
}
time_prev = time_now;
// update all elapsed time now and check if it is ready;
for (i = 0; i < nTasks; i++)
{
if (ptrTaskList[i]->period != 0)
{
ptrTaskList[i]->elapsed_time += delta_time;
if (ptrTaskList[i]->elapsed_time >= ptrTaskList[i]->period)
{
ptrTaskList[i]->elapsed_time = 0;
ptrTaskList[i]->ready = true;
ret = true;
}
}
}
return ret;
}
TaskClass* SchedulerClass :: GetReadyTask(void)
{
TaskClass* f = NULL;
int i;
for (i = 0; i < nTasks; i++)
{
if (ptrTaskList[i]->ready)
{
f = ptrTaskList[i];
break;
}
}
return f;
}
// method to sort task list in decreasing priority.
void SchedulerClass :: Sort(void)
{
int i, j;
TaskClass* pTask;
for(i=0; i<(nTasks-1); i++)
{
for(j=0; j<(nTasks-(i+1)); j++)
{
if(ptrTaskList[j] > ptrTaskList[j+1])
{
pTask = ptrTaskList[j];
ptrTaskList[j] = ptrTaskList[j+1];
ptrTaskList[j+1] = pTask;
}
}
}
}
/*
void clock_st(void)
{
uint32_t ticks = start_timer(1, int_Handler);
// cout<<" TICKS: "<<ticks<<endl;
}
*/
unsigned long milis(void)
{
return Tick;
}
/*
void SchedulerClass::Timer_scheduler(void)
{
Tick++;
}
*/
void int_Handler(void){
//Scheduler.Timer_scheduler();
Tick++;
TimerIntClear(WTIMER3_BASE, TIMER_TIMB_TIMEOUT);
}
|
1f0fbcfb0a64cc2f1839fab215e035319499361c
|
378c9e0017eb8dd7aaace096e2726baa9308fbc9
|
/Lab1/problem2.cpp
|
2e101e8674722e178b678646048c229576a6edeb
|
[] |
no_license
|
reynld/c-labs-hw
|
31d5545b40f06c7deb639675fed6cdacec2c1501
|
521a70e9889644aee86bdec7e957ca882967a7f2
|
refs/heads/master
| 2021-09-14T16:02:02.472524
| 2018-05-15T21:07:37
| 2018-05-15T21:07:37
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,042
|
cpp
|
problem2.cpp
|
/*
Christopher Cedeno Problem 2
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 1008514753 ?
*/
#include <iostream>
using namespace std;
int num = 1008514753, largest, cnt;
int main()
{
for (int i = 1; i <= num; i++) //loops from 1 to value of num
{
if (num % i == 0) //checks if num is divided evenly by current i value
{
cnt = 0; //presets cnt to 0 for use in next loop
for (int j = 2; cnt == 0 && i > j; j++) //checks if its the first iteration of the loop and if the current i value is less than j
{
if (i % j == 0) //checks if current i value is divisible by current j value
cnt++;
}
/*
if cnt is 0 it means the current i value is a
prime factor since it evely divided into num value and not 2
*/
if (cnt == 0)
largest = i;
}
}
cout << largest << endl;
}
|
6f7503d8998705b15bca50d2792cdb97325c307f
|
0b1a87e3aac9d80f719a34e5522796cdb061d64d
|
/encoderbase.h
|
a89ae9a84bd11dfa67ea6bb29379f676c7be15d4
|
[] |
no_license
|
xiangruipuzhao/qaac
|
6769239471d920d42095a916c94ab0e706a76619
|
ed2a1392a3c6c9df2046bd559b6486965928af53
|
refs/heads/master
| 2021-01-21T01:39:23.237184
| 2011-02-05T14:01:10
| 2011-02-05T14:01:10
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,247
|
h
|
encoderbase.h
|
#ifndef _ENCODERBASE_H
#define _ENCODERBASE_H
#include "stdaudio.h"
#include "iointer.h"
class EncoderBase : public StdAudioComponentX {
protected:
ISource *m_src;
ISink *m_sink;
std::vector<AudioStreamPacketDescription> m_packet_desc;
std::vector<char> m_input_buffer, m_output_buffer;
uint64_t m_samples_read, m_frames_written, m_bytes_written;
double m_max_bitrate, m_cur_bitrate;
AudioStreamBasicDescription m_input_desc, m_output_desc;
public:
EncoderBase(ISource *src, uint32_t formatID);
void setSink(ISink &sink) { m_sink = &sink; }
uint64_t samplesRead() const { return m_samples_read; }
uint64_t framesWritten() const { return m_frames_written; }
uint64_t bytesWritten() const { return m_bytes_written; }
double currentBitrate() const { return m_cur_bitrate; }
double maxBitrate() const { return m_max_bitrate; }
double overallBitrate() const
{
return calcBitrate(m_bytes_written,
m_output_desc.mFramesPerPacket * m_frames_written);
}
bool encodeChunk(UInt32 nframes);
const AudioStreamBasicDescription &getInputBasicDescription() const
{
return m_input_desc;
}
const AudioStreamBasicDescription &getOutputBasicDescription() const
{
return m_output_desc;
}
void setOutputBasicDescription(const AudioStreamBasicDescription &desc)
{
setBasicDescription(desc);
m_output_desc = desc;
}
ISource *src() { return m_src; }
ISink *sink() { return m_sink; }
private:
static ComponentResult staticInputDataProc(
ComponentInstance ci,
UInt32 *ioNumberDataPackets,
AudioBufferList *ioData,
AudioStreamPacketDescription **outDataPacketDescription,
void *inRefCon)
{
EncoderBase* self = reinterpret_cast<EncoderBase*>(inRefCon);
return self->inputDataProc(ioNumberDataPackets, ioData);
}
double calcBitrate(uint64_t bytes, uint64_t samples) const
{
return (bytes * m_output_desc.mSampleRate * 8) / (1000.0 * samples);
}
long inputDataProc(UInt32 *nframes, AudioBufferList *abl);
void prepareOutputBuffer(uint32_t nframes);
void prepareInputBuffer(AudioBufferList *abl, size_t nframe);
};
#endif
|
1b08dcae5f910ac2db2e3c276f211544f6e5500b
|
dca5d83f240690b327e9fb1450a335d5f3875b00
|
/day3/main.cpp
|
ab4be9917457ccc67cddcadc572cc757285f1ce1
|
[] |
no_license
|
aherdzik/adventofcode2019
|
b6e701ca9ac1ca31243c000bf430aec7813597e3
|
94e1f7315610d76f8b31e9e0e5370e260e2f3e12
|
refs/heads/master
| 2020-11-27T14:06:02.878113
| 2019-12-30T01:55:14
| 2019-12-30T01:55:14
| 229,476,834
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,228
|
cpp
|
main.cpp
|
#include <iostream>
#include <fstream>
#include <set>
#include <sstream>
#include <vector>
#include <string>
#include <tuple>
using namespace std;
std::set<std::tuple<int, int>> firstSet;
std::set<std::tuple<int, int>> secondSet;
std::vector<std::tuple<int, int>> firstVector;
std::vector<std::tuple<int, int>> secondVector;
void addDirectionsToSet(int &x, int &y, char direction, int length, bool isFirstSet)
{
std::vector<std::tuple<int, int>> & vectorToFill = isFirstSet ? firstVector : secondVector;
std::set<std::tuple<int, int>>& setToUse = isFirstSet ? firstSet : secondSet;
switch (direction)
{
case 'U':
for (int i = 0; i < length; i++)
{
y++;
setToUse.insert(std::make_tuple(x, y));
vectorToFill.push_back(std::make_tuple(x, y));
}
break;
case 'D':
for (int i = 0; i < length; i++)
{
y--;
setToUse.insert(std::make_tuple(x, y));
vectorToFill.push_back(std::make_tuple(x, y));
}
break;
case 'L':
for (int i = 0; i < length; i++)
{
x--;
setToUse.insert(std::make_tuple(x, y));
vectorToFill.push_back(std::make_tuple(x, y));
}
break;
case 'R':
for (int i = 0; i < length; i++)
{
x++;
setToUse.insert(std::make_tuple(x, y));
vectorToFill.push_back(std::make_tuple(x, y));
}
break;
default:
break;
}
}
int getDistanceForTuple(std::tuple<int, int> currentTuple, std::vector<std::tuple<int, int>>& currentVector)
{
for(int i=0; i<currentVector.size(); i++)
{
if(currentVector[i] == currentTuple)
{
return i+1;
}
}
return -1;
}
int main()
{
string line;
ifstream myfile("day3input.txt");
if (myfile.is_open())
{
bool firstline = true;
while (getline(myfile, line))
{
stringstream ss(line);
int x = 0, y = 0;
while (ss.good())
{
string command;
getline(ss, command, ',');
char direction = command.at(0);
command.erase(0, 1);
int length = std::stoi(command, 0, 10);
addDirectionsToSet(x, y, direction, length, firstline);
}
firstline = false;
}
myfile.close();
}
std::set<std::tuple<int, int>> finalSet;
;
// Iterate till the end of set
for (std::set<std::tuple<int, int>>::iterator it = firstSet.begin(); it != firstSet.end(); ++it)
{
if(secondSet.find(*it) != secondSet.end())
{
finalSet.insert(*it);
}
}
int maxDistance = 99999999;
for (std::set<std::tuple<int, int>>::iterator it = finalSet.begin(); it != finalSet.end(); ++it)
{
std::tuple<int, int> currentTuple = *it;
int distanceFromCenter= getDistanceForTuple(currentTuple,firstVector) + getDistanceForTuple(currentTuple,secondVector);
if(distanceFromCenter < maxDistance)
{
maxDistance = distanceFromCenter;
}
}
cout << endl;
}
|
0dd0319c0d3c85a36305bfe2122f341e82e17eea
|
dc25b23f8132469fd95cee14189672cebc06aa56
|
/vendor/mediatek/proprietary/hardware/mtkcam/feature/common/mfnr/core/MfllCore.cpp
|
f426f1aa12026591b49c12a031047b0aba77f5b8
|
[] |
no_license
|
nofearnohappy/alps_mm
|
b407d3ab2ea9fa0a36d09333a2af480b42cfe65c
|
9907611f8c2298fe4a45767df91276ec3118dd27
|
refs/heads/master
| 2020-04-23T08:46:58.421689
| 2019-03-28T21:19:33
| 2019-03-28T21:19:33
| 171,048,255
| 1
| 5
| null | 2020-03-08T03:49:37
| 2019-02-16T20:25:00
|
Java
|
UTF-8
|
C++
| false
| false
| 49,734
|
cpp
|
MfllCore.cpp
|
#include "MfllCore.h"
#include "MfllLog.h"
#include "MfllFeatureMrp.h"
#include <utils/threads.h> // ANDROID_PRIORITY_FOREGROUND
#include <cutils/xlog.h> // XLOG
#include <sys/time.h>
#include <vector> // std::vector
#include <map>
using namespace mfll;
using android::sp;
using std::vector;
using std::map;
static map<enum EventType, const char*> EVENTTYPE_NAME = {
{EventType_Init, "EventType_Init"},
{EventType_AllocateRawBuffer, "EventType_AllocateRawBuffer"},
{EventType_AllocateQyuvBuffer, "EventType_AllocateQyuvBuffer"},
{EventType_AllocateYuvBase, "EventType_AllocateYuvBase"},
{EventType_AllocateYuvGolden, "EventType_AllocateYuvGolden"},
{EventType_AllocateYuvWorking, "EventType_AllocateYuvWorking"},
{EventType_AllocateYuvMixing, "EventType_AllocateYuvMixing"},
{EventType_AllocateWeighting, "EventType_AllocateWeighting"},
{EventType_AllocateMemc, "EventType_AllocateMemc"},
{EventType_AllocatePostview, "EventType_AllocatePostview"},
{EventType_AllocateThumbnail, "EventType_AllocateThumbnail"},
{EventType_AllocateJpeg, "EventType_AllocateJpeg"},
{EventType_Capture, "EventType_Capture"},
{EventType_CaptureRaw, "EventType_CaptureRaw"},
{EventType_CaptureYuvQ, "EventType_CaptureYuvQ"},
{EventType_CaptureEis, "EventType_CaptureEis"},
{EventType_Bss, "EventType_Bss"},
{EventType_EncodeYuvBase, "EventType_EncodeYuvBase"},
{EventType_EncodeYuvGolden, "EventType_EncodeYuvGolden"},
{EventType_MotionEstimation, "EventType_MotionEstimation"},
{EventType_MotionCompensation, "EventType_MotionCompensation"},
{EventType_Blending, "EventType_Blending"},
{EventType_Mixing, "EventType_Mixing"},
{EventType_NoiseReduction, "EventType_NoiseReduction"},
{EventType_Postview, "EventType_Postview"},
{EventType_Thumbnail, "EventType_Thumbnail"},
{EventType_EncodeJpeg, "EventType_EncodeJpeg"},
{EventType_Destroy, "EventType_Destroy"}
};
const pthread_attr_t PTHREAD_DEFAULT_ATTR = {
0, NULL, 1024 * 1024, 4096, SCHED_OTHER, ANDROID_PRIORITY_FOREGROUND
};
/* This thread will allocate all buffers sequentially */
static void* thread_allocate_memory(void *arg)
{
void *ret = 0;
mfllFunctionIn();
MfllCore *pCore = (MfllCore*)arg;
int frameNum = (int)pCore->getBlendFrameNum();
/* allocate raw buffers frames */
for(int i = 0; i < frameNum; i++)
pCore->doAllocRawBuffer((void*)(long)i);
/* allocate QYUV buffers */
for(int i = 0; i < frameNum; i++)
pCore->doAllocQyuvBuffer((void*)(long)i);
/* ME/MC working buffer */
for(int i = 0; i < frameNum - 1; i++)
pCore->doAllocMemcWorking((void*)(long)i);
/* After BSS done, we can convert RAW to YUV base */
pCore->doAllocYuvBase(NULL);
/* YUV working buffer for ME/MC */
pCore->doAllocYuvWorking(NULL);
/* Allocate weighting table */
pCore->doAllocWeighting((void*)(long)0);
pCore->doAllocWeighting((void*)(long)1);
/* After BSS done, we can convert RAW to YUV golden too (is not urgent) */
pCore->doAllocYuvGolden(NULL);
/* Postview / thumbnail / JPEG related buffers */
pCore->doAllocPostview(NULL);
pCore->doAllocThumbnail(NULL);
pCore->doAllocJpeg(NULL);
lbExit:
pCore->decStrong(pCore);
mfllFunctionOut();
return ret;
}
/**
* Thread phase1 has responsibility to capture frames, execute BSS, and encode
* YUV base/golden frames.
*/
static void* thread_phase1(void *arg)
{
void *ret = 0;
mfllFunctionIn();
MfllCore *c = (MfllCore*)arg;
c->doCapture(NULL);
c->doBss(NULL);
c->doEncodeYuvBase(NULL);
c->doEncodeYuvGolden(NULL);
c->decStrong(c);
mfllFunctionOut();
return ret;
}
/**
* Since our hardware only provides that only one a pass2 driver, all the
* operation invokes pass2 driver will be processed in this thread.
*
* Due to pass2 driver is a thread-safe and FIFO mechanism, every operation
* can be dispatched as a sub thread to ask pass2 driver for operation using
* greedy algorithm.
*/
static void* thread_phase2(void *arg)
{
void *ret = 0;
mfllFunctionIn();
MfllCore *c = (MfllCore*)arg;
int times = (int)c->getBlendFrameNum() - 1;
for (int i = 0; i < times; i++)
c->doBlending((void*)(long)i);
c->doMixing(NULL);
c->doNoiseReduction(NULL);
c->doCreatePostview(NULL);
c->doEncodeThumbnail(NULL);
c->doEncodeJpeg(NULL);
c->decStrong(c);
mfllFunctionOut();
return ret;
}
/**
* Thread motion estimation will be invoked parallelly. There will be
* (m_frameNum - 1) mfll_thread_me
*/
typedef struct _memc_attr {
MfllCore *pCore;
vector<int> indexQueue;
} memc_attr_t;
static void* thread_memc(void *arg_memc_attr)
{
enum MfllErr err = MfllErr_Ok;
memc_attr_t *pMemcAttr = (memc_attr_t*)arg_memc_attr;
MfllCore *c = pMemcAttr->pCore;
mfllFunctionIn();
for (size_t i = 0; i < pMemcAttr->indexQueue.size(); i++ )
{
void *void_index = (void*)(long)pMemcAttr->indexQueue[i];
err = c->doMotionEstimation(void_index);
if (err != MfllErr_Ok) {
mfllLogW("%s: ME(%d) failed, ignore MC and blending(%d)", __FUNCTION__, i, i);
c->m_bypass.bypassMotionCompensation[i] = 1;
c->m_bypass.bypassBlending[i] = 1;
}
err = pMemcAttr->pCore->doMotionCompensation(void_index);
if (err != MfllErr_Ok) {
mfllLogW("%s: MC(%d) failed, ignore blending(%d)", __FUNCTION__, i, i);
c->m_bypass.bypassMotionCompensation[i] = 1;
}
}
lbExit:
mfllFunctionOut();
return (void*)(long)err;
}
static void* thread_memc_parallel(void *arg)
{
void *ret = 0;
mfllFunctionIn();
MfllCore *c = (MfllCore*)arg;
int times = (int)c->getBlendFrameNum() - 1;
int instanceNum = (int)c->getMemcInstanceNum();
int threadsNum = (times <= instanceNum ? times : instanceNum);
mfllLogD("%s: times to blend(%d), MEMC instanceNum(%d), threadsNum(%d)", __FUNCTION__, times, instanceNum, threadsNum);
memc_attr_t *attrs = new memc_attr_t[threadsNum];
pthread_t *pThreads = new pthread_t[threadsNum];
pthread_attr_t pthreadAttr = PTHREAD_DEFAULT_ATTR;
/* create threadsNum threads for executing ME/MC */
for (int i = 0; i < times; i++) {
attrs[i % threadsNum].indexQueue.push_back(i);
attrs[i % threadsNum].pCore = c;
}
for (int i = 0; i < threadsNum; i++) {
pthread_create((pThreads + i), &pthreadAttr, thread_memc, (void*)&attrs[i]);
}
/* sync threads */
for (int i = 0; i < threadsNum; i++) {
void *r;
pthread_join(*(pThreads + i), (void**)&r);
}
lbExit:
delete [] pThreads;
delete [] attrs;
c->decStrong(c);
mfllFunctionOut();
return ret;
}
/* this thread will process ME/MC sequentially */
static void* thread_memc_seq(void *arg)
{
enum MfllErr err = MfllErr_Ok;
mfllFunctionIn();
MfllCore *c = (MfllCore*)arg;
int times = (int)c->getBlendFrameNum() - 1;
memc_attr_t memcAttr;
memcAttr.pCore = c;
for (int i = 0; i < times; i++) {
memcAttr.indexQueue.push_back(i);
}
err = (enum MfllErr)(long)thread_memc((void*)&memcAttr);
c->decStrong(c);
mfllFunctionOut();
return (void*)(long)err;
}
IMfllCore* IMfllCore::createInstance(void)
{
return (IMfllCore*)new MfllCore;
}
enum MfllErr IMfllCore::getCaptureInfo(const struct MfllConfig *pCfgIn, struct MfllConfig *pCfgOut)
{
return MfllErr_NotImplemented;
}
const char* IMfllCore::getEventTypeName(enum EventType e)
{
unsigned int index = (unsigned int)e;
if (e < 0 || e >= (unsigned int)EventType_Size)
return "Unknown_EventType";
return EVENTTYPE_NAME[e];
}
bool IMfllCore::isZsdMode(const enum MfllMode &m)
{
return (m == MfllMode_ZsdMfll || m == MfllMode_ZsdAis) ? true : false;
}
/**
* MfllCore
*/
MfllCore::MfllCore(void)
{
mfllFunctionIn();
/* modules */
m_spCapturer = NULL;
/* event dispatcher */
m_event = IMfllEvents::createInstance();
/* attributes */
m_frameNum = MFLL_BLEND_FRAME;
m_frameNumCaptured = MFLL_CAPTURE_FRAME;
m_memcInstanceNum = 1;
m_bShooted = false;
m_sensorId = -1;
m_mutexShoot = PTHREAD_MUTEX_INITIALIZER;
m_privateData = NULL;
m_privateDataSize = 0;
/* set image buffer smart pointers to NULL */
m_imgYuvBase = NULL;
m_imgYuvGolden = NULL;
m_imgYuvBlended = NULL;
m_imgWeighting[0] = NULL;
m_imgWeighting[1] = NULL;
/* pointers of IMfllImageBuffers */
IMfllImageBuffer *m_ptrImgYuvBase = NULL;
IMfllImageBuffer *m_ptrImgYuvRef = NULL;
IMfllImageBuffer *m_ptrImgYuvGolden = NULL;
IMfllImageBuffer *m_ptrImgYuvBlended = NULL;
IMfllImageBuffer *m_ptrImgYuvMixed = NULL;
IMfllImageBuffer *m_ptrImgWeightingIn = NULL;
IMfllImageBuffer *m_ptrImgWeightingOut = NULL;
IMfllImageBuffer *m_ptrImgWeightingFinal = NULL;
/* sync objects, lock as default */
lockSyncObject(&m_syncCapture);
lockSyncObject(&m_syncEncodeYuvBase);
lockSyncObject(&m_syncEncodeYuvGolden);
lockSyncObject(&m_syncBss);
lockSyncObject(&m_syncMixing);
lockSyncObject(&m_syncNoiseReduction);
lockSyncObject(&m_syncPostview);
lockSyncObject(&m_syncThumbnail);
lockSyncObject(&m_syncEncJpeg);
for (unsigned int i = 0; i < MFLL_MAX_FRAMES; i++) {
/* set image buffer smart pointers = NULL */
m_imgRaws[i] = NULL;
m_imgQYuvs[i] = NULL;
m_imgMemc[i] = NULL;
/* sync object for operation */
lockSyncObject(&m_syncCapturedRaw[i]);
lockSyncObject(&m_syncCapturedYuvQ[i]);
lockSyncObject(&m_syncMotionEstimation[i]);
lockSyncObject(&m_syncMotionCompensation[i]);
lockSyncObject(&m_syncBlending[i]);
}
mfllLogD("Create MfllCore version: %s",((std::string)getReversionString()).c_str());
mfllFunctionOut();
}
MfllCore::~MfllCore(void)
{
MfllErr err;
int iResult;
MfllEventStatus_t status;
mfllFunctionIn();
m_event->onEvent(EventType_Destroy, status, (void*)this);
/* release sync data */
if (m_privateData) {
delete m_privateData;
m_privateDataSize = 0;
}
m_event->doneEvent(EventType_Destroy, status, (void*)this);
mfllFunctionOut();
}
enum MfllErr MfllCore::init(const MfllConfig_t *pCfg /* = 0 */)
{
MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionIn();
pthread_mutex_lock(&m_mutexShoot);
if (m_bShooted) {
err = MfllErr_Shooted;
goto lbExit;
}
m_event->onEvent(EventType_Init, status, (void*)this);
/* assign pointers to real buffer */
m_ptrImgYuvBase = m_imgYuvBase.get();
m_ptrImgYuvGolden = m_imgYuvGolden.get();
m_ptrImgYuvBlended = m_imgYuvBlended.get();
/* check parameter is ok or not */
if (getBlendFrameNum() <= 0) {
err = MfllErr_IllegalBlendFrameNum;
mfllLogE("%s: blending frame number is <= 0", __FUNCTION__);
goto lbExit;
}
if (getCaptureFrameNum() <= 0 || getCaptureFrameNum() < getBlendFrameNum()) {
err = MfllErr_IllegalCaptureFrameNum;
mfllLogE("%s: catpure frame num is illegal.", __FUNCTION__);
goto lbExit;
}
lbExit:
pthread_mutex_unlock(&m_mutexShoot);
status.err = err;
m_event->doneEvent(EventType_Init, status, (void*)this);
if (err == MfllErr_Shooted)
mfllLogW("%s: MFLL has shooted, cannot init MFLL anymore", __FUNCTION__);
mfllFunctionOut();
return err;
}
enum MfllErr MfllCore::doMfll(void)
{
MfllFeatureOpt_t opts;
return doMfll(opts);
}
enum MfllErr MfllCore::doMfll(MfllFeatureOpt_t featureOpts)
{
MfllErr err = MfllErr_Ok;
std::vector<pthread_t> vThreadToJoin;
pthread_t pThread;
pthread_t pThreadPhase1;
void *ret;
std::vector<pthread_t>::iterator itr;
/* function pointer to memc */
void* (*ptr_thread_memc)(void*) = NULL;
/* only Dual Phase may invoke Mfll async */
bool bIsAsync = (featureOpts.dualphase_mode != 0 ? true : false);
mfllFunctionIn();
/* init first */
init();
/* use mutex to protect operating shoot state */
pthread_mutex_lock(&m_mutexShoot);
if (m_bShooted) {
pthread_mutex_unlock(&m_mutexShoot);
mfllLogW("MFLL has been shooted, cancel this shoot");
err = MfllErr_Shooted;
goto lbExit;
}
else {
m_bShooted = true;
pthread_mutex_unlock(&m_mutexShoot);
}
/**
* M F L L S T A R T
*/
/* register Memory Reduce Plan feature */
//if (featureOpts.mrp_mode != MrpMode_BestPerformance) {
if (1) {
registerEventListenerNoLock(new MfllFeatureMrp);
}
/* assign ME/MC thread */
switch(featureOpts.memc_mode){
case MemcMode_Sequential:
ptr_thread_memc = &thread_memc_seq;
break;
case MemcMode_Parallel:
m_memcInstanceNum = MFLL_MEMC_THREADS_NUM;
ptr_thread_memc = &thread_memc_parallel;
break;
default:
mfllLogE("%s: memc_mode(%d) is out of range. Use memc_seq as default", __FUNCTION__, (int)featureOpts.memc_mode);
ptr_thread_memc = &thread_memc_seq;
break;
}
/* thread to allocate buffers sequentially */
createThread(&pThread, thread_allocate_memory);
vThreadToJoin.push_back(pThread);
/* thread for capture image->bss->raw2yuv */
createThread(&pThreadPhase1, thread_phase1);
/* thread to do ME&MC */
createThread(&pThread, (*ptr_thread_memc));
vThreadToJoin.push_back(pThread);
/* thread for blending->mixing->NR->Postview->JPEG */
createThread(&pThread, thread_phase2);
vThreadToJoin.push_back(pThread);
/**
* Ok, here we need to sync threads.
*/
/* Phase1 should be always joined. */
err = joinThread(&pThreadPhase1);
/* if not async call, we have to join these threads */
for( itr = vThreadToJoin.begin(); itr != vThreadToJoin.end(); itr++) {
pthread_t t = (*itr);
if (bIsAsync == false) {
pthread_join(t, &ret);
}
else {
pthread_detach(t);
}
}
lbExit:
mfllFunctionOut();
return err;
}
IMfllImageBuffer* MfllCore::getRawBuffer(unsigned int index)
{
if (index >= getCaptureFrameNum())
return NULL;
return m_imgRaws[index].get();
}
vector<IMfllImageBuffer*> MfllCore::getRawBuffers(void)
{
vector<IMfllImageBuffer*> v;
for (int i = 0; i < (int)getCaptureFrameNum(); i++) {
v.push_back(m_imgRaws[i].get());
}
return v;
}
int MfllCore::getSensorId(void)
{
return m_sensorId;
}
IMfllImageBuffer* MfllCore::getQYuvBuffer(unsigned int index)
{
if (index >= getCaptureFrameNum())
return NULL;
return m_imgQYuvs[index].get();
}
vector<IMfllImageBuffer*> MfllCore::getQYuvBuffers(void)
{
vector<IMfllImageBuffer*> v;
for (int i = 0; i < (int)getCaptureFrameNum(); i++) {
v.push_back(m_imgQYuvs[i].get());
}
return v;
}
unsigned int MfllCore::getReversion(void)
{
unsigned int v0;
unsigned int v1;
unsigned int v2;
v0 = MFLL_CORE_REVERSION_BUGFIX;
v1 = MFLL_CORE_REVERSION_MINOR;
v2 = MFLL_CORE_REVERSION_MAJOR;
return (v2 << 20) | (v1 << 12) | v0;
}
std::string MfllCore::getReversionString(void)
{
std::string s;
s += std::to_string(MFLL_CORE_REVERSION_MAJOR);
s += ".";
s += std::to_string(MFLL_CORE_REVERSION_MINOR);
s += ".";
s += std::to_string(MFLL_CORE_REVERSION_BUGFIX);
return s;
}
bool MfllCore::isShooted(void)
{
bool b = false;
pthread_mutex_lock(&m_mutexShoot);
b = m_bShooted;
pthread_mutex_unlock(&m_mutexShoot);
return b;
}
enum MfllErr MfllCore::registerEventListener(const sp<IMfllEventListener> &e)
{
bool b = false;
pthread_mutex_lock(&m_mutexShoot);
b = m_bShooted;
pthread_mutex_unlock(&m_mutexShoot);
if (b) {
mfllLogW("%s: Mfll is shooted, ignored.", __FUNCTION__);
return MfllErr_Shooted;
}
return registerEventListenerNoLock(e);
}
enum MfllErr MfllCore::registerEventListenerNoLock(const sp<IMfllEventListener> &e)
{
mfllFunctionIn();
vector<enum EventType> t = e->getListenedEventTypes();
for (size_t i = 0; i < t.size(); i++) {
m_event->registerEventListener(t[i], e);
}
mfllFunctionOut();
return MfllErr_Ok;
}
enum MfllErr MfllCore::removeEventListener(IMfllEventListener *e)
{
bool b = false;
pthread_mutex_lock(&m_mutexShoot);
b = m_bShooted;
pthread_mutex_unlock(&m_mutexShoot);
if (b) {
mfllLogW("%s: Mfll is shooted, ignored.", __FUNCTION__);
return MfllErr_Shooted;
}
vector<enum EventType> t = e->getListenedEventTypes();
for (size_t i = 0; i < t.size() ; i++) {
m_event->removeEventListener(t[i], e);
}
return MfllErr_Ok;
}
enum MfllErr MfllCore::setBypassOption(const MfllBypassOption_t &b)
{
bool shooted = false;
pthread_mutex_lock(&m_mutexShoot);
shooted = m_bShooted;
pthread_mutex_unlock(&m_mutexShoot);
if (shooted) {
mfllLogW("%s: Mfll is shooted, ignored.", __FUNCTION__);
return MfllErr_Shooted;
}
m_bypass = b;
return MfllErr_Ok;
}
enum MfllErr MfllCore::setCaptureResolution(unsigned int width, unsigned int height)
{
enum MfllErr err = MfllErr_Ok;
pthread_mutex_lock(&m_mutexShoot);
if (m_bShooted) {
err = MfllErr_Shooted;
goto lbExit;
}
m_width = width;
m_height = height;
lbExit:
pthread_mutex_unlock(&m_mutexShoot);
if (err == MfllErr_Shooted)
mfllLogW("MFLL has shooted, cannot set resolution");
return err;
}
enum MfllErr MfllCore::setCaptureQResolution(unsigned int qwidth, unsigned int qheight)
{
enum MfllErr err = MfllErr_Ok;
pthread_mutex_lock(&m_mutexShoot);
if (m_bShooted) {
err = MfllErr_Shooted;
goto lbExit;
}
m_qwidth = qwidth;
m_qheight = qheight;
lbExit:
pthread_mutex_unlock(&m_mutexShoot);
if (err == MfllErr_Shooted)
mfllLogW("MFLL has shooted, cannot set Q resolution");
return err;
}
enum MfllErr MfllCore::setCapturer(const sp<IMfllCapturer> &capturer)
{
enum MfllErr err = MfllErr_Ok;
pthread_mutex_lock(&m_mutexShoot);
if (m_bShooted) {
err = MfllErr_Shooted;
goto lbExit;
}
m_spCapturer = capturer;
lbExit:
pthread_mutex_unlock(&m_mutexShoot);
if (err == MfllErr_Shooted)
mfllLogW("MFLL has shooted, cannot set Q resolution");
return err;
}
/**
* ---------------------------------------------------------------------------
* MFLL OPERATIONS
*
* These functions are operations that MFLL will invoke. Function name template
* is do{$action} where {$action} is the meaniful name for the operation
* -----------------------------------------------------------------------------
*/
/**
* The first operation of MFLL is to capture frames, but it's necessary to wait
* RAW buffers and QYUV buffers for capture are ready.
*
* We have to capture getBlendFrameNum() RAW and QYUV frames by IMfllCapturer
*/
enum MfllErr MfllCore::doCapture(JOB_VOID)
{
enum MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionIn();
/* invokes events */
m_event->onEvent(EventType_Capture, status, this);
if (m_bypass.bypassCapture || status.ignore) {
mfllLogD("%s: Bypass capture operation", __FUNCTION__);
usleep(500 * 1000); // assume 500 ms
status.ignore = 1;
}
else {
/* aquire buffers first */
for (int i = 0; i < (int)getCaptureFrameNum(); i++) {
err = doAllocRawBuffer((void*)(long)i);
if (err != MfllErr_Ok) {
mfllLogE("%s: allocate RAW buffer(%d) failed", __FUNCTION__, i);
goto lbExit;
}
err = doAllocQyuvBuffer((void*)(long)i);
if (err != MfllErr_Ok) {
mfllLogE("%s: allocate QYUV buffer (%d) failed", __FUNCTION__, i);
goto lbExit;
}
}
/* check if IMfllCapturer has been assigned */
if (m_spCapturer.get() == NULL) {
mfllLogD("%s: create MfllCapturer", __FUNCTION__);
m_spCapturer = IMfllCapturer::createInstance();
if (m_spCapturer.get() == NULL) {
mfllLogE("%s: create MfllCapturer instance", __FUNCTION__);
err = MfllErr_CreateInstanceFailed;
goto lbExit;
}
}
vector< sp<IMfllImageBuffer> > raws;
vector< sp<IMfllImageBuffer> > qyuvs;
vector<MfllMotionVector_t> gmvs;
/* prepare IMfllImageBuffer to IMfllCapturer */
for (int i = 0; i < (int)getCaptureFrameNum(); i++) {
raws.push_back(m_imgRaws[i]);
qyuvs.push_back(m_imgQYuvs[i]);
gmvs.push_back(MfllMotionVector_t());
}
/* register event dispatcher */
err = m_spCapturer->registerEventDispatcher(m_event);
if (err != MfllErr_Ok) {
mfllLogE("%s: MfllCapture::registerEventDispatcher failed with code %d", __FUNCTION__, err);
goto lbExit;
}
/* Catpure frames */
err = m_spCapturer->captureFrames(getCaptureFrameNum(), raws, qyuvs, gmvs);
if (err != MfllErr_Ok) {
mfllLogE("%s: MfllCapture::captureFrames failed with code %d", __FUNCTION__, err);
goto lbExit;
}
/* copy global motion vector back */
for(int i = 0; i < (int)getCaptureFrameNum() - 1; i++) {
m_globalMv[i] = gmvs[i];
}
}
lbExit:
handleError(err);
status.err = err;
m_event->doneEvent(EventType_Capture, status, this);
syncAnnounceDone(&m_syncCapture);
mfllFunctionOut();
return err;
}
/**
* Best Shot Selection should takes captured images
*/
enum MfllErr MfllCore::doBss(JOB_VOID)
{
enum MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionIn();
/* conditions */
syncWaitDone(&m_syncCapture);
/* trigger events */
m_event->onEvent(EventType_Bss, status, this);
if (m_bypass.bypassBss || status.ignore) {
mfllLogD("%s: Bypass bss", __FUNCTION__);
usleep(40 * 1000);
status.ignore = 1;
}
else {
}
lbExit:
handleError(err);
status.err = err;
m_event->doneEvent(EventType_Bss, status, this);
syncAnnounceDone(&m_syncBss);
mfllFunctionOut();
return err;
}
/**
* To encode base RAW buffer to YUV base buffer. This operation must be invoked
* after doBss() has done and YUV base buffer is available to use. Hence the
* conditions are:
*
* 1. Buffer of YUV base is ready
* 2. BSS has been done
*/
enum MfllErr MfllCore::doEncodeYuvBase(JOB_VOID)
{
enum MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionIn();
/* conditions */
syncWaitDone(&m_syncBss);
/* invokes events */
m_event->onEvent(EventType_EncodeYuvBase, status, this);
if (m_bypass.bypassEncodeYuvBase || status.ignore) {
mfllLogD("%s: Bypass encoding YUV base", __FUNCTION__);
usleep(50 * 1000);
status.ignore = 1;
}
else {
err = doAllocYuvBase(NULL);
if (err != MfllErr_Ok) {
mfllLogE("%s: allocate YUV base failed", __FUNCTION__);
err = MfllErr_UnexpectedError;
goto lbExit;
}
// TODO: encode base RAW to YUV base
}
lbExit:
status.err = err;
m_event->doneEvent(EventType_EncodeYuvBase, status, this);
syncAnnounceDone(&m_syncEncodeYuvBase);
mfllFunctionOut();
return err;
}
/**
* To encode base RAW buffer to YUV golden buffer. This operation must be invoked
* after doBss() has done and YUV golden buffer is available to use.
*
* 1. Buffer of YUV golden is ready
* 2. BSS has been done
*/
enum MfllErr MfllCore::doEncodeYuvGolden(JOB_VOID)
{
enum MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionIn();
/* conditions */
syncWaitDone(&m_syncBss);
/* invokes events */
m_event->onEvent(EventType_EncodeYuvGolden, status, this); // invokes events
if (m_bypass.bypassEncodeYuvGolden || status.ignore) {
mfllLogD("%s: Bypass encoding YUV golden", __FUNCTION__);
usleep(50 * 1000); // 50 ms
status.ignore = 1;
}
else {
err = doAllocYuvGolden(NULL);
if (err != MfllErr_Ok) {
mfllLogE("%s: allocate YUV golden failed", __FUNCTION__);
err = MfllErr_UnexpectedError;
goto lbExit;
}
// TODO: encode base RAW to YUV golden
}
lbExit:
status.err = err;
m_event->doneEvent(EventType_EncodeYuvGolden, status, this);
syncAnnounceDone(&m_syncEncodeYuvGolden);
mfllFunctionOut();
return err;
}
/**
* Calculate motion estimation using MfllMemc. This operation must be invoked
* while these conditions are matched:
*
* 1. BSS has been done
* 2. memory for MfllMemc should be ready too.
*/
enum MfllErr MfllCore::doMotionEstimation(void *void_index)
{
unsigned int index = (unsigned int)(long)void_index;
enum MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionInInt(index);
/* conditions */
syncWaitDone(&m_syncBss);
/* invokes event */
m_event->onEvent(EventType_MotionEstimation, status, this, (void*)(long)index);
if (m_bypass.bypassMotionEstimation[index] || status.ignore) {
mfllLogD("%s: Bypass motion estimation(%d)", __FUNCTION__, index);
usleep(100 * 1000); // 100 ms
status.ignore = 1;
}
else {
err = doAllocMemcWorking(void_index);
if (err != MfllErr_Ok) {
mfllLogE("%s: allocate MEMC working buffer(%d) failed", __FUNCTION__, index);
err = MfllErr_UnexpectedError;
goto lbExit;
}
// TODO: do motion estimation
}
lbExit:
status.err = err;
m_event->doneEvent(EventType_MotionEstimation, status, this, (void*)(long)index);
syncAnnounceDone(&m_syncMotionEstimation[index]);
mfllFunctionOut();
return err;
}
/**
* Motion compensation is a pure software algorithm, the i-th motion compensation
* should be executed if only if:
*
* 1. The i-th motion estimation has been done.
* 2. The (i-1)-th compensation has been done (if i > 1)
*/
enum MfllErr MfllCore::doMotionCompensation(void *void_index)
{
unsigned int index = (unsigned int)(long)void_index;
enum MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionInInt(index);
/* conditions */
syncWaitDone(&m_syncMotionEstimation[index]);
if (index > 0)
syncWaitDone(&m_syncMotionCompensation[index - 1]);
/* trigger events */
m_event->onEvent(EventType_MotionCompensation, status, this, (void*)(long)index);
if (m_bypass.bypassMotionCompensation[index] || status.ignore) {
mfllLogD("%s: Bypass motion compensation(%d)", __FUNCTION__, index);
usleep(50 * 1000); // 50 ms
status.ignore = 1;
}
else {
// TODO: do motion compensation.
}
lbExit:
status.err = err;
m_event->doneEvent(EventType_MotionCompensation, status, this, (void*)(long)index);
syncAnnounceDone(&m_syncMotionCompensation[index]);
mfllFunctionOut();
return err;
}
/**
* Blending using MTK hardware, furthurmore, operation blending depends on that
* the previous blended output. Therefore, the conditions of this operaion are:
*
* 1. YUV working buffer for blending is ready.
* 2. The i-th motion compensation has been done.
* 3. The (i-1)-th blending has been done.
*/
enum MfllErr MfllCore::doBlending(void *void_index)
{
unsigned int index = (unsigned int)(long)void_index;
enum MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionInInt(index);
/* conditions */
syncWaitDone(&m_syncMotionCompensation[index]);
if (index > 0)
syncWaitDone(&m_syncBlending[index - 1]);
/* trigger events */
m_event->onEvent(EventType_Blending, status, this, (void*)(long)index);
if (m_bypass.bypassBlending[index] || status.ignore) {
mfllLogD("%s: Bypass blending(%d)", __FUNCTION__, index);
usleep(50 * 1000);
status.ignore = 1;
}
else {
err = doAllocYuvWorking(NULL);
if (err != MfllErr_Ok) {
mfllLogE("%s: allocate YUV working buffer failed", __FUNCTION__);
goto lbExit;
}
if (m_spMfb.get() == NULL) {
mfllLogD("%s: create IMfllMfb instance", __FUNCTION__);
m_spMfb = IMfllMfb::createInstance();
if (m_spMfb.get() == NULL) {
mfllLogE("%s: m_spMfb is NULL", __FUNCTION__);
err = MfllErr_CreateInstanceFailed;
goto lbExit;
}
}
err = m_spMfb->init(m_sensorId); // TODO: pass in the correct sensor ID
err = m_spMfb->setSyncPrivateData(m_privateData, m_privateDataSize);
if (err != MfllErr_Ok) {
mfllLogE("%s: m_spMfb init failed with code %d", __FUNCTION__, (int)err);
goto lbExit;
}
/* prepare weighting buffers */
if (index % 2 == 0) {
m_ptrImgWeightingIn = m_imgWeighting[0].get();
m_ptrImgWeightingOut = m_imgWeighting[1].get();
}
else {
m_ptrImgWeightingIn = m_imgWeighting[1].get();
m_ptrImgWeightingOut = m_imgWeighting[0].get();
}
err = m_spMfb->blend(m_ptrImgYuvBase, m_ptrImgYuvRef, m_ptrImgYuvBlended, m_ptrImgWeightingIn, m_ptrImgWeightingOut);
if (err != MfllErr_Ok) {
mfllLogE("%s: Mfb failed with code %d", __FUNCTION__, (int)err);
goto lbExit;
}
else {
/* save for mixing */
m_ptrImgWeightingFinal = m_ptrImgWeightingOut;
}
}
lbExit:
status.err = err;
m_event->doneEvent(EventType_Blending, status, this, (void*)(long)index);
syncAnnounceDone(&m_syncBlending[index]);
mfllFunctionOut();
return err;
}
/**
* Mixing a blended frame and a golden frame. Therefore, we must have a blended
* frame which means that this operation must wait until blending done. Hence
* the conditions are
*
* 1. YUV mixing output frame buffer ready
* 2. All blending has been done.
*/
enum MfllErr MfllCore::doMixing(JOB_VOID)
{
enum MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionIn();
/* conditions */
for (int i = 0; i < (int)getBlendFrameNum() - 1; i++)
syncWaitDone(&m_syncBlending[i]);
/* trigger events */
m_event->onEvent(EventType_Mixing, status, this);
if (m_bypass.bypassMixing || status.ignore) {
mfllLogD("%s: Bypass mixing", __FUNCTION__);
usleep(50 * 1000);
status.ignore = 1;
}
else {
if (m_spMfb.get() == NULL) {
m_spMfb = IMfllMfb::createInstance();
if (m_spMfb.get() == NULL) {
mfllLogE("%s: create MFB instance failed", __FUNCTION__);
err = MfllErr_CreateInstanceFailed;
goto lbExit;
}
}
/* set sensor ID and private data for sync */
err = m_spMfb->init(m_sensorId);
err = m_spMfb->setSyncPrivateData(m_privateData, m_privateDataSize);
if (err != MfllErr_Ok) {
mfllLogE("%s: init MFB instance failed with code %d", __FUNCTION__, (int)err);
goto lbExit;
}
err = m_spMfb->setWeightingBuffer(m_imgWeighting[0], m_imgWeighting[1]);
if (err != MfllErr_Ok) {
mfllLogE("%s: set weighting buffers failed with code %d", __FUNCTION__, (int)err);
goto lbExit;
}
m_ptrImgYuvMixed = m_ptrImgYuvBase; // re-use YUV base frame as output.
err = m_spMfb->mix(m_ptrImgYuvBlended, m_ptrImgYuvGolden, m_ptrImgYuvMixed);
if (err != MfllErr_Ok) {
mfllLogE("%s: mix failed with code %d", __FUNCTION__, err);
goto lbExit;
}
}
lbExit:
status.err = err;
m_event->doneEvent(EventType_Mixing, status, this);
syncAnnounceDone(&m_syncMixing);
mfllFunctionOut();
return err;
}
/**
* Noise reduction is processed after mixing has been done. So the conditions
* are
*
* 1. YUV mixing has been done
*/
enum MfllErr MfllCore::doNoiseReduction(JOB_VOID)
{
enum MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionIn();
/* conditions */
syncWaitDone(&m_syncMixing);
/* trigger events */
m_event->onEvent(EventType_NoiseReduction, status, this);
if (m_bypass.bypassNoiseReduction || status.ignore) {
mfllLogD("%s: Bypass noise reduction", __FUNCTION__);
usleep(170 * 1000);
status.ignore = 1;
}
else {
// TODO: do NR
}
lbExit:
status.err = err;
m_event->doneEvent(EventType_NoiseReduction, status, this);
syncAnnounceDone(&m_syncNoiseReduction);
mfllFunctionOut();
return err;
}
/**
* After all post-processings are done, creating Postview for application.
* We notic that the last post-processing is Noise Reduction and which cannot
* be processed parallelly therefore we can assume the conditions for this
* funcion are
*
* 1. Noise Reduction has been done.
* 2. Postview related buffers are ready.
*/
enum MfllErr MfllCore::doCreatePostview(JOB_VOID)
{
enum MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionIn();
/* conditions */
syncWaitDone(&m_syncNoiseReduction);
/* trigger events */
m_event->onEvent(EventType_Postview, status, this);
if (m_bypass.bypassPostview || status.ignore) {
mfllLogD("%s: Bypass create postview", __FUNCTION__);
usleep(10 * 1000);
status.ignore = 1;
}
else {
// TODO: create postview
}
lbExit:
handleError(err);
status.err = err;
m_event->doneEvent(EventType_Postview, status, this);
syncAnnounceDone(&m_syncPostview);
mfllFunctionOut();
return err;
}
/**
* Thumbnail can be created after all the post-processings are done, and buffers
* for Thumbnail are ready. Hence conditions are
*
* 1. Noise Reduction has been done.
* 2. Thumbnail related buffers are ready.
*/
enum MfllErr MfllCore::doEncodeThumbnail(JOB_VOID)
{
enum MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionIn();
/* conditions */
syncWaitDone(&m_syncNoiseReduction);
/* trigger events */
m_event->onEvent(EventType_Thumbnail, status, this);
if (m_bypass.bypassThumbnail || status.ignore) {
mfllLogD("%s: Bypass create thumbnail", __FUNCTION__);
usleep(25 * 1000);
status.ignore = 1;
}
else {
// TODO: create thumbnail.
}
lbExit:
status.err = err;
m_event->doneEvent(EventType_Thumbnail, status, this);
syncAnnounceDone(&m_syncThumbnail);
mfllFunctionOut();
return err;
}
/**
* JPEG can be encoded after all the post-processings are done, and buffers
* for encoding JPEG are ready. Hence the conditions are
*
* 1. Noise Reduction has been done.
* 2. JPEG encoding related buffers are ready.
*/
enum MfllErr MfllCore::doEncodeJpeg(JOB_VOID)
{
enum MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionIn();
/* conditions */
syncWaitDone(&m_syncNoiseReduction);
/* trigger events */
m_event->onEvent(EventType_EncodeJpeg, status, this);
if (m_bypass.bypassEncodeJpeg || status.ignore) {
mfllLogD("%s: Bypass encoding JPEG", __FUNCTION__);
usleep(70 * 1000);
status.ignore = 1;
}
else {
}
lbExit:
status.err = err;
m_event->doneEvent(EventType_EncodeJpeg, status, this);
syncAnnounceDone(&m_syncEncJpeg);
mfllFunctionOut();
return MfllErr_NotImplemented;
}
enum MfllErr MfllCore::doAllocRawBuffer(void *void_index)
{
unsigned int index = (unsigned int)(long)void_index;
enum MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionIn();
/* trigger events */
m_event->onEvent(EventType_AllocateRawBuffer, status, this, (void*)(long)index);
if (m_bypass.bypassAllocRawBuffer[index] || status.ignore) {
mfllLogD("%s: Bypass allocate raw buffers", __FUNCTION__);
usleep(50 * 1000);
status.ignore = 1;
}
else {
/* create IMfllImageBuffer instances */
IMfllImageBuffer *pImg = m_imgRaws[index].get();
if (pImg == NULL) {
pImg = IMfllImageBuffer::createInstance();
if (pImg == NULL) {
mfllLogE("%s: create IMfllImageBuffer(%d) failed", __FUNCTION__, index);
err = MfllErr_CreateInstanceFailed;
goto lbExit;
}
m_imgRaws[index] = pImg;
}
pImg->setImageFormat(ImageFormat_Raw10);
pImg->setResolution(m_width, m_height);
err = pImg->initBuffer();
if (err != MfllErr_Ok) {
mfllLogE("%s: init raw buffer(%d) failed", __FUNCTION__, index);
err = MfllErr_UnexpectedError;
goto lbExit;
}
}
lbExit:
status.err = err;
m_event->doneEvent(EventType_AllocateRawBuffer, status, this, (void*)(long)index);
mfllFunctionOut();
return err;
}
enum MfllErr MfllCore::doAllocQyuvBuffer(void *void_index)
{
unsigned int index = (unsigned int)(long)void_index;
enum MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionIn();
/* trigger events */
m_event->onEvent(EventType_AllocateQyuvBuffer, status, this, (void*)(long)index);
if (m_bypass.bypassAllocQyuvBuffer[index] || status.ignore) {
mfllLogD("%s: Bypass allocate QYUV buffers", __FUNCTION__);
usleep(50 * 1000);
status.ignore = 1;
}
else {
IMfllImageBuffer *pImg = m_imgQYuvs[index].get();
if (pImg == NULL) {
pImg = IMfllImageBuffer::createInstance();
if (pImg == NULL) {
mfllLogE("%s: create QYUV buffer instance (%d) failed", __FUNCTION__, index);
err = MfllErr_CreateInstanceFailed;
goto lbExit;
}
m_imgQYuvs[index] = pImg;
}
pImg->setImageFormat(ImageFormat_Yuy2);
pImg->setResolution(m_qwidth, m_qheight);
err = pImg->initBuffer();
if (err != MfllErr_Ok) {
mfllLogE("%s: init QYUV buffer(%d) failed", __FUNCTION__, index);
err = MfllErr_UnexpectedError;
goto lbExit;
}
}
lbExit:
status.err = err;
m_event->doneEvent(EventType_AllocateQyuvBuffer, status, this, (void*)(long)index);
mfllFunctionOut();
return err;
}
enum MfllErr MfllCore::doAllocYuvBase(JOB_VOID)
{
enum MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionIn();
/* trigger events */
m_event->onEvent(EventType_AllocateYuvBase, status, this);
if (m_bypass.bypassAllocYuvBase || status.ignore) {
mfllLogD("%s: Bypass allocate YUV base buffer", __FUNCTION__);
usleep(100 * 1000);
status.ignore = 1;
}
else {
IMfllImageBuffer *pImg = m_imgYuvBase.get();
if (pImg == NULL) {
pImg = IMfllImageBuffer::createInstance();
if (pImg == NULL) {
mfllLogE("%s: create YUV base buffer instance failed", __FUNCTION__);
err = MfllErr_CreateInstanceFailed;
goto lbExit;
}
m_imgYuvBase = pImg;
}
pImg->setImageFormat(ImageFormat_Yuy2);
pImg->setResolution(m_width, m_height);
err = pImg->initBuffer();
if (err != MfllErr_Ok) {
mfllLogE("%s: init YUV base buffer failed", __FUNCTION__);
err = MfllErr_UnexpectedError;
goto lbExit;
}
}
lbExit:
status.err = err;
m_event->doneEvent(EventType_AllocateYuvBase, status, this);
mfllFunctionOut();
return err;
}
enum MfllErr MfllCore::doAllocYuvGolden(JOB_VOID)
{
enum MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionIn();
/* trigger events */
m_event->onEvent(EventType_AllocateYuvGolden, status, this);
if (m_bypass.bypassAllocYuvGolden || status.ignore) {
mfllLogD("%s: Bypass allocate YUV golen buffer", __FUNCTION__);
usleep(100 * 1000);
status.ignore = 1;
}
else {
IMfllImageBuffer *pImg = m_imgYuvGolden.get();
if (pImg == NULL) {
pImg = IMfllImageBuffer::createInstance();
if (pImg == NULL) {
mfllLogE("%s: create YUV golden instance failed", __FUNCTION__);
err = MfllErr_CreateInstanceFailed;
goto lbExit;
}
m_imgYuvGolden = pImg;
}
pImg->setImageFormat(ImageFormat_Yuy2);
pImg->setResolution(m_width, m_height);
err = pImg->initBuffer();
if (err != MfllErr_Ok) {
mfllLogE("%s: init YUV golden buffer failed", __FUNCTION__);
err = MfllErr_UnexpectedError;
goto lbExit;
}
}
lbExit:
status.err = err;
m_event->doneEvent(EventType_AllocateYuvGolden, status, this);
mfllFunctionOut();
return err;
}
enum MfllErr MfllCore::doAllocYuvWorking(JOB_VOID)
{
enum MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionIn();
/* trigger events */
m_event->onEvent(EventType_AllocateYuvWorking, status, this);
if (m_bypass.bypassAllocYuvWorking || status.ignore) {
mfllLogD("%s: Bypass allocate YUV working(mixing) buffer", __FUNCTION__);
usleep(100 * 1000);
status.ignore = 1;
}
else {
IMfllImageBuffer *pImg = m_imgYuvBlended.get();
if (pImg == NULL) {
pImg = IMfllImageBuffer::createInstance();
if (pImg == NULL) {
mfllLogE("%s: create YUV blended buffer instance failed", __FUNCTION__);
err = MfllErr_CreateInstanceFailed;
goto lbExit;
}
m_imgYuvBlended = pImg;
}
pImg->setImageFormat(ImageFormat_Yuy2);
pImg->setResolution(m_width, m_height);
err = pImg->initBuffer();
if (err != MfllErr_Ok) {
mfllLogE("%s: init YUV blended buffer failed", __FUNCTION__);
err = MfllErr_UnexpectedError;
goto lbExit;
}
}
lbExit:
status.err = err;
m_event->doneEvent(EventType_AllocateYuvWorking, status, this);
mfllFunctionOut();
return err;
}
enum MfllErr MfllCore::doAllocWeighting(void *void_index)
{
unsigned int index = (unsigned int)(long)void_index;
enum MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionIn();
/* trigger events */
m_event->onEvent(EventType_AllocateWeighting, status, this, (void*)(long)index);
if (m_bypass.bypassAllocWeighting[index] || status.ignore) {
mfllLogD("%s: Bypass allocate weighting table(%d)", __FUNCTION__, index);
usleep(10 * 1000);
status.ignore = 1;
}
else {
/* index should be smaller than 2 or it's the critical condition */
if (index >= 2) {
mfllLogE("%s: index(%d) of weighting table is greater than 2", __FUNCTION__, index);
abort();
}
IMfllImageBuffer *pImg = m_imgWeighting[index].get();
if (pImg == NULL) {
pImg = IMfllImageBuffer::createInstance();
if (pImg == NULL) {
mfllLogE("%s: create weighting table(%d) buffer instance failed", __FUNCTION__, index);
err = MfllErr_CreateInstanceFailed;
goto lbExit;
}
m_imgWeighting[index] = pImg;
}
pImg->setImageFormat(ImageFormat_Y8);
pImg->setResolution(m_width, m_height);
err = pImg->initBuffer();
if (err != MfllErr_Ok) {
mfllLogE("%s: init weighting table(%d) buffer failed", __FUNCTION__, index);
err = MfllErr_UnexpectedError;
goto lbExit;
}
}
lbExit:
status.err = err;
m_event->doneEvent(EventType_AllocateWeighting, status, this, (void*)(long)index);
mfllFunctionOut();
return err;
}
enum MfllErr MfllCore::doAllocMemcWorking(void *void_index)
{
unsigned int index = (unsigned int)(long)void_index;
enum MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionIn();
/* trigger events */
m_event->onEvent(EventType_AllocateMemc, status, this, (void*)(long)index);
if (m_bypass.bypassAllocMemc[index] || status.ignore) {
mfllLogD("%s: Bypass allocate MEMC working buffer(%d)", __FUNCTION__, index);
usleep(20 * 1000);
status.ignore = 1;
}
else {
IMfllImageBuffer *pImg = m_imgMemc[index].get();
if (pImg == NULL) {
pImg = IMfllImageBuffer::createInstance();
if (pImg == NULL) {
mfllLogE("%s: create MEMC working buffer(%d) instance failed", __FUNCTION__, index);
err = MfllErr_CreateInstanceFailed;
goto lbExit;
}
m_imgMemc[index] = pImg;
}
pImg->setImageFormat(ImageFormat_Y8);
pImg->setResolution(m_width, m_height);
err = pImg->initBuffer();
if (err != MfllErr_Ok) {
mfllLogE("%s: init MEMC working buffer(%d) failed", __FUNCTION__, index);
err = MfllErr_UnexpectedError;
goto lbExit;
}
}
lbExit:
status.err = err;
m_event->doneEvent(EventType_AllocateMemc, status, this, (void*)(long)index);
mfllFunctionOut();
return err;
}
enum MfllErr MfllCore::doAllocPostview(JOB_VOID)
{
enum MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionIn();
/* trigger events */
m_event->onEvent(EventType_AllocatePostview, status, this);
if (m_bypass.bypassAllocPostview) {
usleep(10 * 1000);
status.ignore = 1;
}
else {
}
lbExit:
status.err = err;
m_event->doneEvent(EventType_AllocatePostview, status, this);
mfllFunctionOut();
return err;
}
enum MfllErr MfllCore::doAllocThumbnail(JOB_VOID)
{
enum MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionIn();
/* trigger events */
m_event->onEvent(EventType_AllocateThumbnail, status, this);
if (m_bypass.bypassAllocThumbnail) {
usleep(10 * 1000);
status.ignore = 1;
}
else {
}
lbExit:
status.err = err;
m_event->doneEvent(EventType_AllocateThumbnail, status, this);
mfllFunctionOut();
return err;
}
enum MfllErr MfllCore::doAllocJpeg(JOB_VOID)
{
enum MfllErr err = MfllErr_Ok;
MfllEventStatus_t status;
mfllFunctionIn();
/* trigger events */
m_event->onEvent(EventType_AllocateJpeg, status, this);
if (m_bypass.bypassAllocJpeg) {
usleep(20 * 1000);
status.ignore = 1;
}
else {
}
lbExit:
status.err = err;
m_event->doneEvent(EventType_AllocateJpeg, status, this);
mfllFunctionOut();
return err;
}
void MfllCore::handleError(enum MfllErr err)
{
//TODO: handle errors....
MFLL_UNUSED(err);
}
enum MfllErr MfllCore::createThread(pthread_t *pThread, void *(*routine)(void*), bool bDistach /* = false */)
{
pthread_attr_t attr = PTHREAD_DEFAULT_ATTR;
mfllFunctionIn();
/* increase lifetime, the routine should invoke decStrong */
incStrong(this);
pthread_create(pThread, &attr, routine, (void*)this);
if (bDistach) {
pthread_detach(*pThread);
}
mfllFunctionOut();
return MfllErr_Ok;
}
enum MfllErr MfllCore::joinThread(pthread_t *pThread)
{
enum MfllErr err = MfllErr_Ok;
void *ret;
mfllFunctionIn();
int r = pthread_join(*pThread, &ret);
if (r == EINVAL) {
mfllLogE("Join pthread %p failed, perhaps it's not a joinable thread", (void*)pThread);
err = MfllErr_UnexpectedError;
}
mfllFunctionOut();
return err;
}
void MfllCore::lockSyncObject(MfllSyncObj_t *pSyncObj)
{
pthread_mutex_lock(&pSyncObj->trigger);
pthread_mutex_lock(&pSyncObj->done);
}
void MfllCore::unlockSyncObject(MfllSyncObj_t *pSyncObj)
{
pthread_mutex_unlock(&pSyncObj->trigger);
pthread_mutex_unlock(&pSyncObj->done);
}
void MfllCore::syncWaitTrigger(MfllSyncObj_t *pSyncObj)
{
pthread_mutex_lock(&pSyncObj->trigger);
pthread_mutex_unlock(&pSyncObj->trigger);
}
void MfllCore::syncAnnounceTrigger(MfllSyncObj_t *pSyncObj)
{
pthread_mutex_unlock(&pSyncObj->trigger);
}
void MfllCore::syncWaitDone(MfllSyncObj_t *pSyncObj)
{
pthread_mutex_lock(&pSyncObj->done);
pthread_mutex_unlock(&pSyncObj->done);
}
void MfllCore::syncAnnounceDone(MfllSyncObj_t *pSyncObj)
{
pthread_mutex_unlock(&pSyncObj->done);
}
MfllConfig_t* MfllCore::createMfllConfig(void)
{
MfllConfig_t *cfg = new MfllConfig_t;
// TODO: create MFLL default MfllConfig_t
return cfg;
}
|
c00a4768a0517c12b6c7c26a4ee9d557f42ef598
|
3efc50ba20499cc9948473ee9ed2ccfce257d79a
|
/data/code-jam/files/6254486_carriez_5636311922769920_0_extracted_Source.cpp
|
314df8faeb4909a5e9b9d0fdfd6866172bc671fe
|
[] |
no_license
|
arthurherbout/crypto_code_detection
|
7e10ed03238278690d2d9acaa90fab73e52bab86
|
3c9ff8a4b2e4d341a069956a6259bf9f731adfc0
|
refs/heads/master
| 2020-07-29T15:34:31.380731
| 2019-12-20T13:52:39
| 2019-12-20T13:52:39
| 209,857,592
| 9
| 4
| null | 2019-12-20T13:52:42
| 2019-09-20T18:35:35
|
C
|
UTF-8
|
C++
| false
| false
| 927
|
cpp
|
6254486_carriez_5636311922769920_0_extracted_Source.cpp
|
#define _CRT_SECURE_NO_WARNINGS
#include<vector>
#include<unordered_map>
#include<unordered_set>
#include<set>
#include<iostream>
#include<math.h>
#include<algorithm>
#include<string>
#include<queue>
#include<stdint.h>
#include<bitset>
using namespace std;
typedef long long ll;
//#define TEST
#define SMALL
//#define LARGE
int main() {
#ifdef TEST
freopen("test.in", "r", stdin);
freopen("test.out", "w", stdout);
#endif
#ifdef SMALL
freopen("D-small-attempt0.in", "r", stdin);
freopen("D-small-attempt0.out", "w", stdout);
#endif
#ifdef LARGE
freopen("B-large.in", "r", stdin);
freopen("B-large.out", "w", stdout);
#endif
int n = 0;
cin >> n;
string dump;
getline(cin, dump);
//bitset<128> s;
for (int i = 1; i <= n; i++) {
printf("Case #%d: ", i);
int k, c, s;
cin >> k >> c >> s;
for (int i = 1; i <=k ; ++i){
cout << i << " ";
}
cout << endl;
}
}
|
1361070196f842969e239f35f0867fcd9ef5e83e
|
88e343e03dc6027b706a08c60fea35e90952fd40
|
/Part02_Football/Football/Football/Person.h
|
4747d2c95362733bd6a3223d3ac79e8dfc8f0bef
|
[] |
no_license
|
ariel-levin/10216-CPP
|
932e0fe3b05d7c6ca4fa4e8977b5d82b6ab20c3f
|
2279e8f974f831233878557db582a1257f33094f
|
refs/heads/master
| 2021-01-10T13:56:40.834877
| 2015-10-11T20:43:33
| 2015-10-11T20:43:33
| 44,026,350
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 609
|
h
|
Person.h
|
#ifndef _PERSON_H
#define _PERSON_H
#include <iostream>
using namespace std;
class Person
{
public:
Person(const char* name, int age);
Person(const Person& other);
virtual ~Person();
virtual Person& operator=(const Person& other);
bool operator==(const Person& other) const;
const char* getName() const;
void setName(const char* name);
int getAge() const;
void setAge(int age);
int getId() const;
virtual void toOs(ostream& os) const {};
friend ostream& operator<<(ostream& os, const Person& person);
private:
char* name;
int age;
int id;
static int counter;
};
#endif // !_PERSON_H
|
3ad56c50725c8e67d96c25a93b6577e923bbc742
|
2f3b0c92643818d30a31b704b5c8c857be500d9f
|
/yaml/qyamlproject.h
|
d43d79d16414be3c5ae9536cf3db7a132390f74d
|
[
"MIT"
] |
permissive
|
Manfredo-Ma/yaml-qt5
|
6801a7bc97c4ff92765c2eae017b26b7c8b3a07d
|
232ccf3cda49222d1a93c94b7a2335c318a3e9de
|
refs/heads/master
| 2020-05-14T23:22:43.712175
| 2019-04-18T02:02:32
| 2019-04-18T02:02:45
| 181,996,098
| 7
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 247
|
h
|
qyamlproject.h
|
#ifndef QYAMLPROJECT_H
#define QYAMLPROJECT_H
#include "yaml_global.h"
namespace YAML {
class Node;
}
class YAMLSHARED_EXPORT QYamlProject
{
public:
QYamlProject();
QYamlProject(const YAML::Node &node);
};
#endif // QYAMLPROJECT_H
|
09381f57e96b405230ff24fbaff4ba88d1fd9ac5
|
4fd2c7f78072ad2e9f4a71b7470e5b0379cd224f
|
/models/bricks/bricksLeftEdge.cpp
|
2896d56a6dad48a5909161e2f1b5dc7c4c1d37cc
|
[] |
no_license
|
marcclintdion/_MATHMATICAL_MARIO_6
|
d0e57773b969c2ae05389520b0b4c306c991fab9
|
f863f92b4b7378dde9a4cbc6e1059d6f2eaef3b1
|
refs/heads/master
| 2020-04-28T23:37:06.821972
| 2015-09-17T09:53:52
| 2015-09-17T09:53:52
| 42,648,498
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,111
|
cpp
|
bricksLeftEdge.cpp
|
Vertex bricksLeftEdge[] =
{
//number of vertices = 18
{0.802227, 0.160994, -1, 0, 0, -0.512, 0.2514, 0.51005},
{0.00293226, 0.482312, -1, 0, 0, -0.512, -0.2514, -0.51005},
{0.802227, 0.482312, -1, 0, 0, -0.512, -0.2514, 0.51005},
{0.802227, 0.160994, -1, 0, 0, -0.512, 0.2514, 0.51005},
{0.00293226, 0.160994, -1, 0, 0, -0.512, 0.2514, -0.51005},
{0.00293226, 0.482312, -1, 0, 0, -0.512, -0.2514, -0.51005},
{0.00293715, 0.160999, 0, 1, 0, -0.512, 0.2514, -0.51005},
{0.802227, 0.160994, 0, 1, 0, -0.512, 0.2514, 0.51005},
{0.802232, 0.00365859, 0, 1, 0, -0.312, 0.2514, 0.51005},
{0.00293715, 0.00365859, 0, 1, 0, -0.312, 0.2514, -0.51005},
{0.00293715, 0.160999, 0, 1, 0, -0.512, 0.2514, -0.51005},
{0.802232, 0.00365859, 0, 1, 0, -0.312, 0.2514, 0.51005},
{0.952692, 0.160994, 0, 0, 1, -0.512, 0.2514, 0.51005},
{0.952692, 0.482312, 0, 0, 1, -0.512, -0.2514, 0.51005},
{0.79824, 0.482312, 0, 0, 1, -0.312, -0.2514, 0.51005},
{0.79824, 0.160994, 0, 0, 1, -0.312, 0.2514, 0.51005},
{0.952692, 0.160994, 0, 0, 1, -0.512, 0.2514, 0.51005},
{0.79824, 0.482312, 0, 0, 1, -0.312, -0.2514, 0.51005},
};
|
1df16969e45eb18bd69b3bf283cc8e8abb271628
|
15a105b54659046f227b97540e9f4b13c1822e97
|
/benchmarks/time/lexm/lexm_bn.cpp
|
7ca3c2c2e909d160a8f66b6f1d9da9fedb004ef3
|
[] |
no_license
|
francescocastelli/aa-project
|
6a575f59edddab7305e52a2b49eee41572a1c2f7
|
ae7ac25ec3f65d8d327734ecd73bdc5ef03a1669
|
refs/heads/master
| 2023-06-26T18:32:35.983506
| 2021-07-29T09:22:20
| 2021-07-29T09:22:20
| 381,402,654
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 970
|
cpp
|
lexm_bn.cpp
|
#include <iostream>
#include <numeric>
#include <bits/stdc++.h>
#include <benchmark/benchmark.h>
#include "../../../include/graph.h"
#include "../../../include/lexm.h"
static void BM_lexm(benchmark::State& state)
{
Graph g(state.range(0));
g.randomPopulate(state.range(0), (float) (state.range(1)) / 10.0f);
// n is the number of nodes of the graph g
// e is the number of edges of the graph g
state.counters["n"] = g.getNodeNumber();
state.counters["e"] = g.getEdgeNumber();
for (auto _ : state)
{
graph_algorithms::lexm(g);
}
// the complexity should be O(ne)
state.SetComplexityN(state.counters["n"] * state.counters["e"]);
}
BENCHMARK(BM_lexm)->Unit(benchmark::kMicrosecond)
->RangeMultiplier(2)
->Ranges({{1<<5, 1<<12}, {1, 9}})
// linear here bc we set N as n+e
->Complexity([](benchmark::IterationCount n)->double{return static_cast<double>(n);});
//and call the main of the benchmark
BENCHMARK_MAIN();
|
0172750b100473ed84a04056fd52f87736fcab65
|
a3634de7800ae5fe8e68532d7c3a7570b9c61c5b
|
/codechef/GRAYSC.cpp
|
3d0608d84738bfaf2f545c65d04b11e16ee60838
|
[] |
no_license
|
MayankChaturvedi/competitive-coding
|
a737a2a36b8aa7aea1193f2db4b32b081f78e2ba
|
9e9bd21de669c7b7bd29a262b29965ecc80ad621
|
refs/heads/master
| 2020-03-18T01:39:29.447631
| 2018-02-19T15:04:32
| 2018-02-19T15:04:32
| 134,152,930
| 0
| 1
| null | 2018-05-20T13:27:35
| 2018-05-20T13:27:34
| null |
UTF-8
|
C++
| false
| false
| 848
|
cpp
|
GRAYSC.cpp
|
#include <iostream>
#include <vector>
#include <utility>
#include <map>
using ull = unsigned long long;
using namespace std;
int log2(ull x)
{ int a=0;
while(x>0)
{ a++;
x>>=1;
}
return a;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin>>n;
ull arr[n];
vector<int> diff_by(66, -1);
for(int i=0; i<n; i++)
{ cin>>arr[i];
}
for(int i=1; i<n; i++)
{ ull temp = arr[i]^arr[i-1];//temp = 2^k. k belongs to N.
int t = diff_by.at(log2(temp));
if(t == -1)
{ diff_by.at(log2(temp)) = i-1;
}
else if(t == i-2)
{
}
else
{ cout<<"Yes";
return 0;
}
}
map<ull, int> freq;
int gEQ2 =0;
for(int i=0; i<n; i++)
{ freq[arr[i]]++;
}
for(auto i: freq)
{ if(i.second>1)
gEQ2++;
if(i.second>3)
{ cout<<"Yes";
return 0;
}
}
if(gEQ2 > 1)
cout<<"Yes";
else
cout<<"No";
}
|
8d72f0fe321e8e4abe7511a020db8ac380758889
|
abbbe9c9ee41ce234d1d1cc4f22345e0905ea2c0
|
/String_window.cpp
|
66fb64ef558de8a6905adadb9685d2fd92a9f5bb
|
[] |
no_license
|
2505shivang/Competitive-Programing-codingblocks-solution
|
7869cd2405887cdbe5e0f88b4f1b31422b559b62
|
73056ae42853d79df0020fe272522daa42dafa4c
|
refs/heads/main
| 2023-04-22T15:58:56.344012
| 2021-05-03T21:33:02
| 2021-05-03T21:33:02
| 356,541,741
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,233
|
cpp
|
String_window.cpp
|
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
string common_substr(string str1, string str2) {
unordered_map<char, int> mymap_str1;
unordered_map<char, int> mymap_str2;
for (ll i = 0; i < str2.size(); ++i) {
mymap_str2[str2[i]]++;
}
ll cnt = 0;
ll idx = -1;
ll minlen = INT_MAX;
ll i = 0, j = 0;
while (i < str1.size() && j < str1.size()) {
mymap_str1[str1[i]]++;
if (mymap_str2[str1[i]] != 0 && mymap_str1[str1[i]] <= mymap_str2[str1[i]]) {
cnt++;
}
if (cnt == str2.size()) {
ll start = j;
while (mymap_str2[str1[start]] == 0 || mymap_str1[str1[start]] > mymap_str2[str1[start]]) {
if (mymap_str1[str1[start]] > mymap_str2[str1[start]]) {
mymap_str1[str1[start]]--;
}
start++;
}
ll len = i - start + 1;
if (len < minlen) {
idx = start;
minlen = len;
}
j = start;
}
i++;
}
if (idx == -1) {
return "No String";
}
return str1.substr(idx, minlen);
}
void input() {
string str1, str2;
getline(cin, str1);
getline(cin, str2);
string ans = common_substr(str1, str2);
cout << ans << endl;
}
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
input();
return 0;
}
|
9b70a1c682ebfc678f225b3ea6bdda3b8b31aa8f
|
0121780612b3d92bcc32f8ea1bea8091012fa6c4
|
/LBEP/session9_2.cpp
|
c0c8dfd433af013f4d1226e4e69af952974462cb
|
[] |
no_license
|
billytrinh/T1907M
|
0753fc1729aa980950eee99882edfc9f332e318f
|
28a3e7423891eaaeb58d5f01a9825ffb161c95c6
|
refs/heads/master
| 2020-06-23T05:57:27.725996
| 2019-08-16T03:53:54
| 2019-08-16T03:53:54
| 198,536,546
| 3
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 505
|
cpp
|
session9_2.cpp
|
#include <stdio.h>
#include <string.h>
void in_chuoi_dai_nhat(char s[][20],int n){
int vi_tri = 0;
long int max = strlen(s[0]);
for (int i = 0; i < n; ++i)
{
if(max < strlen(s[i])){
max = strlen(s[i]);
vi_tri=i;
}
}
printf("chuoi dai nhat: %s\n",s[vi_tri]);
}
int main(){
char s[4][20];
for (int i = 0; i < 4; ++i)
{
printf("Nhap chuoi:\n");
scanf("%s",s[i]);
}
for (int i = 0; i < 4; ++i)
{
printf("chuoi %d vua nhap: %s\n",i,s[i] );
}
in_chuoi_dai_nhat(s,4);
return 0;
}
|
adf73212877d4aa106bcc67a70b20a9042a28b9a
|
3ac0923505e1e03a07742355edec43f23ead82b7
|
/Daily/CPP/Leetcode1002-查找常用字符.h
|
8e31d3d0e5c50789ae9f6282822aeac34aac3cb2
|
[] |
no_license
|
lock19960613/SCL
|
5055c940d2529eef981a29698c7ea04212a8b9de
|
3ea28fd8f5d5233411341283c85667e4b9fc64d5
|
refs/heads/main
| 2023-08-03T04:36:33.555296
| 2021-09-11T06:48:49
| 2021-09-11T06:48:49
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 770
|
h
|
Leetcode1002-查找常用字符.h
|
#include <string>
#include <vector>
#include <climits>
using namespace std;
class Solution {
public:
vector<string> commonChars(vector<string>& A) {
vector<string> res;
vector<int> minfreq(26,INT_MAX);
vector<int> freq(26);
int n = A.size();
for(const string& str:A){
fill(freq.begin(),freq.end(),0);
for(auto chr:str){
++freq[chr-'a'];
}
for(int i =0;i<26;i++){
minfreq[i] = min(minfreq[i],freq[i]);
}
}
for(int i = 0;i<26;i++){
for(int j = 0;j<minfreq[i];j++){
string a = "a";
a[0]+=i;
res.push_back(a);
}
}
return res;
}
};
|
caf15f4ed1c6ed15432c74a54df5a03803516f9a
|
62ec6bae293411cbde16162caf18d7b9ac22a5c2
|
/MRS/ServiceBase.h
|
c052d77554b1259e104ce52f1662b46102f5b1c8
|
[] |
no_license
|
overlord7a/MRS
|
eca8501d2518c3ca8c5df6324a547e6e62fe554e
|
16b7844a3208566573e9555b8b509a3b67f54059
|
refs/heads/master
| 2022-11-22T02:43:13.365363
| 2020-07-23T07:23:19
| 2020-07-23T07:23:19
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 389
|
h
|
ServiceBase.h
|
#pragma once
#include <string>
using namespace std;
class ServiceBase
{
protected:
static bool open_file(std::fstream& my_file);
static bool open_file(std::ostream& my_file);
static bool open_file(std::istream& my_file);
static int find_last_line(string _Filename);
static string ToString(int input);
static int ToInt(const string input);
static string ToLower(string input);
};
|
48cdf615b68c55a832d20069c0573e2a91cb90f3
|
0a7419a39794bebc9313e2f7f055bb36b543425a
|
/pgms/graph.cpp
|
1daa4eff77c992168a7099cf9be726273c4e5aae
|
[] |
no_license
|
veenanitk/Digital-Image-Processing
|
6c9b537ba652b9746f935940b29c490497c37da6
|
f956118c8550d2732361ecb7c65b425c7a055408
|
refs/heads/master
| 2022-12-24T21:18:12.326783
| 2020-09-30T21:06:39
| 2020-09-30T21:06:39
| 300,062,471
| 0
| 2
| null | 2020-10-01T10:24:24
| 2020-09-30T21:04:50
|
C++
|
UTF-8
|
C++
| false
| false
| 1,325
|
cpp
|
graph.cpp
|
#include<bits/stdc++.h>
using namespace std;
class Graph
{
int V;
list<int> *adj;
public:
Graph(int V);
void addEdge(int v, int w);
void BFS(int s);
};
Graph::Graph(int V)
{
this->V = V;
adj = new list<int>[V];
}
void Graph::addEdge(int v, int w)
{
adj[v].push_back(w);
adj[w].push_back(v);
}
void Graph::BFS(int s)
{
bool *visited = new bool[V];
for(int i = 0; i < V; i++)
visited[i] = false;
list<int> queue;
int time=0;
int ans=0,ans1=0,x=0;
visited[s] = true;
queue.push_back(s);
list<int>::iterator i;
while(!queue.empty() && time<=ans)
{
s = queue.front();
cout<<s+1<<endl;
queue.pop_front();
for (i = adj[s].begin(); i != adj[s].end(); ++i)
{
if (!visited[*i])
{
visited[*i] = true;
queue.push_back(*i);
cout<<"asd"<<(*i)+1<<endl;
if(x==0){
ans++;
}
ans1++;
}
}
x++;
time++;
}
cout<<ans1;
}
int main(){
int n,e;
cin>>n>>e;
Graph g(n);
for(int i=0;i<e;i++){
int a,b;
cin>>a>>b;
g.addEdge(a-1,b-1);
}
int m;
cin>>m;
g.BFS(m-1);
return 0;
}
|
88c2f08a24f00135f11458eb60525fe562f272f4
|
4097012d9daa16ee613523f499d4c0016167be83
|
/Homework_4/WordFont.h
|
6d2e64897f9752b5b03113e8a6facb0a2975faa6
|
[] |
no_license
|
pcgallant/CIS544_Assignments
|
f30b16e2ec243b31cae0d018d3feefb4a5178fc4
|
485b13f74db5e33df3d1f7405abbfcb31f2349f8
|
refs/heads/master
| 2021-04-28T16:13:33.673721
| 2018-03-30T22:29:37
| 2018-03-30T22:29:37
| 122,009,683
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,321
|
h
|
WordFont.h
|
#include <string>
#include <vector>
#include <stdexcept>
using namespace std;
class WordFont
{
public:
WordFont(); //default constructor
void setFontSize(int fSize); //set the fontSize for the word
int getFontSize();
void setFontWeight(char weight);
char getFontWeight();
void setPixelChar(char inputC);
char getPixelChar();
int const getMaxFontSize();
int const getMinFontSize();
size_t const getMaxWordLength();
string getImplementedLetters(); // will return the list of implemented letters
bool validateFontSize(int fSize);
bool validateFontWeight(char fWeight);
bool validateWordLength(string inWord);
void printWord(int fontSize, char pixelChar, char fontWeight, string word);
private:
int const minFontSize;
int const maxFontSize;
size_t const maxWordLength;
int const normalFont;
int const boldFont;
char pixelChar; //The character the user wants to use to draw the letters
int fontSize; // the size of the font -- between 8 (default) and 12
char weightTyp; //The weight of the character B = bold, N = Normal (default)
const string implementedLetters;
bool setFormattedWord(string word); // this helper method will create the appropriate 2D vector for each letter of the word in preparation for printing
// vector declaration
vector<vector<vector<char>>> formattedWord;
string word; // the word being drawn this needs to be an array of 2D vectors, one for each letter in the word
// implemented letters (minimum of 15 required)
int formatA(int letIdx); //must have
int formatB(int letIdx);
int formatC(int letIdx);
int formatD(int letIdx);
int formatE(int letIdx); //must have
int formatH(int letIdx);
int formatI(int letIdx); //must have
int formatL(int letIdx);
int formatM(int letIdx);
int formatN(int letIdx);
int formatO(int letIdx); // must have
int formatR(int letIdx);
int formatS(int letIdx);
int formatT(int letIdx);
int formatU(int letIdx); // must have
void maskLetter(int letIdx, char letter);
//TODO if you have time
// int formatF(int letIdx);
// int formatG(int letIdx);
// int formatJ(int letIdx);
// int formatK(int letIdx);
// int formatP(int letIdx);
// int formatQ(int letIdx);
// int formatV(int letIdx);
// int formatW(int letIdx);
// int formatX(int letIdx);
// int formatY(int letIdx);
// int printZ(int letIdx);
};
|
ddf3b0cfe09afae81cf7115f4ba30d4f3eca0d27
|
030fb85d954e9b0de470bbf76d11e801048e8cba
|
/OOP/Homeworks/03_Homework/2/TeamLead.cpp
|
7304185850a2f4879fe98e97aa49123dc6cc1193
|
[
"MIT"
] |
permissive
|
didov02/FMI
|
09a44da55f62d53f4eed075bbe23bcc36b325d08
|
a4ce6e745a684a4ab60a07c8574c94b4db82eadd
|
refs/heads/main
| 2023-06-05T09:13:51.943491
| 2021-06-15T06:15:37
| 2021-06-15T06:15:37
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,757
|
cpp
|
TeamLead.cpp
|
#include "TeamLead.hpp"
const int NOT_FOUND_INDEX = -1;
TeamLead::TeamLead(const string &name, double salary) : Developer(name) {
this->salary = salary;
this->teamLead = this;
}
vector<Developer *> TeamLead::getTeam() const {
return team;
}
void TeamLead::addDeveloperToTeam(Developer *developer, double salary) {
if (developer == nullptr) {
return;
}
developer->setInitialSalary(salary);
if (!isManagerOf(developer)) {
team.push_back(developer);
}
developer->setTeamLead(this);
}
bool TeamLead::isManagerOf(Developer *developer) const {
for (Developer *currentDeveloper : team) {
if (currentDeveloper == developer) {
return true;
}
}
return false;
}
void TeamLead::removeDeveloperFromTeam(const string &name) {
tryRemoveDeveloper(name);
}
void TeamLead::increaseTeamSalariesBy(double amount) {
for (Developer *developer : team) {
developer->increaseSalary(amount);
}
}
void TeamLead::decreaseTeamSalariesBy(double amount) {
for (Developer *developer : team) {
developer->decreaseSalary(amount);
}
}
void TeamLead::addLeavingRequest(const LeavingRequest &leavingRequest) {
leavingRequests.push_back(leavingRequest);
}
void TeamLead::addPromotionRequest(const PromotionRequest &promotionRequest) {
promotionRequests.push_back(promotionRequest);
}
void TeamLead::fulfillLeavingRequests() {
for (int i = 0; i < leavingRequests.size(); ++i) {
bool isDeveloperRemoved = tryRemoveDeveloper(leavingRequests[i].getSender());
if(isDeveloperRemoved) {
leavingRequests.erase(leavingRequests.begin() + i);
i--;
}
}
}
void TeamLead::fulfillPromotionRequests() {
for (int i = 0; i < promotionRequests.size(); ++i) {
PromotionRequest promotionRequest = promotionRequests[i];
int developerIndex = getDeveloperIndex(promotionRequest.getSender());
if (developerIndex == NOT_FOUND_INDEX) {
continue;
}
Developer *developer = team[developerIndex];
developer->increaseSalary(promotionRequest.getAmount());
promotionRequests.erase(promotionRequests.begin() + i);
i--;
}
}
bool TeamLead::tryRemoveDeveloper(const string& name) {
int developerIndex = getDeveloperIndex(name);
if (developerIndex == NOT_FOUND_INDEX) {
return false;
}
team[developerIndex]->setTeamLead(nullptr);
team.erase(team.begin() + developerIndex);
return true;
}
int TeamLead::getDeveloperIndex(const string &name) {
for (int i = team.size() - 1; i >= 0; i--) {
if (team[i]->getName() == name) {
return i;
}
}
return NOT_FOUND_INDEX;
}
|
5c042592e51868cb879f3da42f017552e9f2fdda
|
5fd89fb912f8ed055b5c8ab90b59ac2636d7fa8e
|
/samples/EarthTrackball/src/Earth.cpp
|
826059dcb16626d61132d1d3b96b05510af7fc7a
|
[
"BSD-2-Clause"
] |
permissive
|
matchingponies/Cinder-Pivot
|
a2b8f1418664ad826303c3380ae166a808a167e2
|
ca2c2dae43e8fb49f04833ab8be2a92d1d24781f
|
refs/heads/master
| 2021-03-19T18:40:39.755399
| 2018-03-27T18:20:53
| 2018-03-27T18:20:53
| 4,790,608
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 8,170
|
cpp
|
Earth.cpp
|
/*
* Earth.cpp
*
* Created by Robert Hodgin on 6/30/09.
* Copyright 2009 The Barbarian Group. All rights reserved.
*
*/
#include "Earth.h"
#include "cinder/gl/gl.h"
#include "cinder/Rand.h"
using namespace ci;
using std::list;
Earth::Earth()
{
}
Earth::Earth( ci::gl::Texture aTexDiffuse, ci::gl::Texture aTexNormal, ci::gl::Texture aTexMask )
{
mLoc = Vec3f::zero();
mRadius = 250.0f;
mTexDiffuse = aTexDiffuse;
mTexNormal = aTexNormal;
mTexMask = aTexMask;
mMinMagToRender = 5.0f;
}
void Earth::setRadius( float rad )
{
mRadius = rad;
}
void Earth::setQuakeLocTip()
{
for( list<Quake>::iterator quake = mQuakes.begin(); quake != mQuakes.end(); ++quake ) {
quake->mLoc += Rand::randVec3f() * 0.001f;
quake->mLocTip = mLoc + quake->mLoc * ( mRadius + quake->mMag * quake->mMag );
quake->mLocTipAnchor = mLoc + quake->mLoc * mRadius;
}
}
void Earth::update()
{
repelLocTips();
}
void Earth::repelLocTips()
{
float E, F;
Vec3f dir;
float distSqrd;
float charge = -2.0f;
for( list<Quake>::iterator quake1 = mQuakes.begin(); quake1 != mQuakes.end(); ++quake1 ) {
float thisQTimesInvM = quake1->mMag * charge;
for( list<Quake>::iterator quake2 = quake1; quake2 != mQuakes.end(); ++quake2 ) {
if( quake1 != quake2 && quake1->mMag > mMinMagToRender && quake2->mMag > mMinMagToRender ){
dir = quake1->mLocTip - quake2->mLocTip;
distSqrd = dir.lengthSquared();
if( distSqrd < 50.0f && distSqrd > 0.001f ) {
float per = 1.0f - abs( distSqrd )/50.0f;
E = charge / distSqrd;
F = E * thisQTimesInvM;
if( F > 2.0f )
F = 2.0f;
dir.normalize();
dir *= F * per;
quake1->mLocTip += dir;
quake2->mLocTip -= dir;
}
}
}
}
for( list<Quake>::iterator quake = mQuakes.begin(); quake != mQuakes.end(); ++quake ) {
dir = quake->mLocTip - quake->mLocTipAnchor;
float limit = ( 10.0f - quake->mMag ) * ( 10.0f - quake->mMag ) * 0.75f + 15.0f;
if( dir.length() > limit ){
dir.normalize();
quake->mLocTip = quake->mLocTipAnchor + dir * limit;
}
quake->mLocTip.normalize();
quake->mLocTip *= mRadius + quake->mMag + 10.0f;
}
}
void Earth::draw()
{
mTexDiffuse.bind( 0 );
mTexNormal.bind( 1 );
mTexMask.bind( 2 );
gl::drawSphere( mLoc, mRadius, 64 );
}
void Earth::drawQuakes()
{
for( list<Quake>::iterator it = mQuakes.begin(); it != mQuakes.end(); ++it ) {
float mag = (it->mMag);
gl::drawSphere( it->mLocTip, mag * 0.25f, 16 );
}
}
void Earth::drawQuakeLabelsOnBillboard( const Vec3f &sRight, const Vec3f &sUp )
{
Vec3f right;
Vec3f up;
float perLeft, perRight;
glBegin( GL_QUADS );
for( list<Quake>::iterator it = mQuakes.begin(); it != mQuakes.end(); ++it ) {
it->mLabel.bind();
float mag = (it->mMag);
if( mag >= mMinMagToRender ){
float x = it->mLocTip.x;
float y = it->mLocTip.y;
float z = it->mLocTip.z;
float w = it->mLabel.getWidth() * 0.5f;
float h = it->mLabel.getHeight() * 0.5f;
// perLeft and Right is a partially implemented solution for getting the text
// to move based on the rotation of the Earth. Will get back to it shortly.
perLeft = -1.0f;
perRight = 1.0f;
right = sRight * w;
up = sUp * h;
glTexCoord2f( 0, 1 );
glVertex3f( x + right.x * perLeft + up.x * perLeft, y + right.y * perLeft + up.y * perLeft, z + right.z * perLeft + up.z * perLeft );
glTexCoord2f( 1, 1 );
glVertex3f( x + right.x * perRight + up.x * perLeft, y + right.y * perRight + up.y * perLeft, z + right.z * perRight + up.z * perLeft );
glTexCoord2f( 1, 0 );
glVertex3f( x + right.x * perRight + up.x * perRight, y + right.y * perRight + up.y * perRight, z + right.z * perRight + up.z * perRight );
glTexCoord2f( 0, 0 );
glVertex3f( x + right.x * perLeft + up.x * perRight, y + right.y * perLeft + up.y * perRight, z + right.z * perLeft + up.z * perRight );
}
}
glEnd();
}
void Earth::drawQuakeLabelsOnSphere( const Vec3f eyeNormal, const float eyeDist )
{
float distMulti = eyeDist * 0.001f;
for( list<Quake>::iterator it = mQuakes.begin(); it != mQuakes.end(); ++it ) {
it->mLabel.bind();
float mag = (it->mMag);
if( mag >= mMinMagToRender ){
float x = it->mLocTip.x;
float y = it->mLocTip.y;
float z = it->mLocTip.z;
float dp = it->mLoc.dot( eyeNormal ) - 0.85;
if( dp <= 0.0f )
dp = 0.0f;
float w = it->mLabel.getWidth() * dp * distMulti;
float h = it->mLabel.getHeight() * dp * distMulti;
Vec3f dir = mLoc - it->mLoc;
dir.normalize();
Vec3f perp1 = dir.cross( Vec3f::yAxis() );
Vec3f perp2 = perp1.cross( dir );
perp1 = perp2.cross( dir );
glBegin( GL_QUADS );
glTexCoord2f( 0, 1 );
glVertex3f( x + perp1.x * w - perp2.x * h, y + perp1.y * w - perp2.y * h, z + perp1.z * w - perp2.z * h );
glTexCoord2f( 1, 1 );
glVertex3f( x - perp1.x * w - perp2.x * h, y - perp1.y * w - perp2.y * h, z - perp1.z * w - perp2.z * h );
glTexCoord2f( 1, 0 );
glVertex3f( x - perp1.x * w + perp2.x * h, y - perp1.y * w + perp2.y * h, z - perp1.z * w + perp2.z * h );
glTexCoord2f( 0, 0 );
glVertex3f( x + perp1.x * w + perp2.x * h, y + perp1.y * w + perp2.y * h, z + perp1.z * w + perp2.z * h );
glEnd();
}
}
}
void Earth::drawQuakeVectors()
{
float radialSubdivisions = 64.0f;
Vec3f loc;
Vec3f norm;
Vec3f normFinal;
for( list<Quake>::iterator it = mQuakes.begin(); it != mQuakes.end(); ++it ) {
float mag = (it->mMag );
if( mag >= mMinMagToRender ){
Vec3f dir = mLoc - it->mLoc;
dir.safeNormalize();
Vec3f perp1 = dir.cross( Vec3f::yAxis() );
Vec3f perp2 = perp1.cross( dir );
perp1 = perp2.cross( dir );
float largeRadius = mag;
float smallRadius = 0.1f;
glBegin( GL_TRIANGLE_STRIP );
for( int i=0; i<radialSubdivisions; i++ ){
float angle = ( (float)i/(radialSubdivisions-1.0f) - 0.5f ) * 6.283185f;
float cosa = cos( angle );
float sina = sin( angle );
Vec3f locOffset = ( perp1 * cosa + perp2 * sina );
norm = perp1 * -sina + perp2 * cosa;
normFinal = Vec3f( norm.y * dir.z - dir.y * norm.z, norm.z * dir.x - dir.z * norm.x, norm.x * dir.y - dir.x * norm.y );
loc = ( it->mLocTip ) + locOffset * smallRadius;
glTexCoord2f( 0.0f, 1.0f );
glVertex3f( loc.x, loc.y, loc.z );
glNormal3f( it->mLoc.x, it->mLoc.y, it->mLoc.z );
loc = ( it->mLoc * mRadius ) + locOffset * largeRadius;
glTexCoord2f( 0.0f, 0.0f );
glVertex3f( loc.x, loc.y, loc.z );
glNormal3f( normFinal.x, normFinal.y, normFinal.z );
}
glEnd();
}
}
}
/*
void Earth::drawQuakeVectors()
{
float radialSubdivisions = 64.0f;
Vec3f loc;
Vec3f norm;
for( list<Quake>::iterator it = mQuakes.begin(); it != mQuakes.end(); ++it ) {
float mag = (it->mMag );
if( mag >= mMinMagToRender ){
Vec3f dir = mLoc - it->mLoc;
dir.normalize();
Vec3f perp1 = dir.cross( Vec3f::yAxis() );
Vec3f perp2 = perp1.cross( dir );
perp1 = perp2.cross( dir );
float largeRadius = mag * mag * 0.35f + 5.0f;
float smallRadius = 0.1f;
glBegin( GL_TRIANGLE_FAN );
glVertex3f( it->mLocTip.x, it->mLocTip.y, it->mLocTip.z );
glNormal3f( it->mLoc.x, it->mLoc.y, it->mLoc.z );
for( int i=0; i<radialSubdivisions; i++ ){
float angle = ( (float)i/(radialSubdivisions-1.0f) ) * 6.28f;
float cosa = cos( angle );
float sina = sin( angle );
Vec3f locOffset = ( perp1 * cosa + perp2 * sina );
norm = perp1 * -sina + perp2 * cosa;
loc = ( it->mLoc * mRadius ) + locOffset * largeRadius;
glVertex3f( loc.x, loc.y, loc.z );
glNormal3f( norm.y * dir.z - dir.y * norm.z, norm.z * dir.x - dir.z * norm.x, norm.z * dir.y - dir.x * norm.y );
}
glEnd();
}
}
}
*/
void Earth::addQuake( float aLat, float aLong, float aMag, std::string aTitle )
{
mQuakes.push_back( Quake( aLat, aLong, aMag, aTitle ) );
}
void Earth::setMinMagToRender( float amt )
{
mMinMagToRender += amt;
if( mMinMagToRender < 2.0f ){
mMinMagToRender = 2.0f;
} else if( mMinMagToRender > 8.0f ){
mMinMagToRender = 8.0f ;
}
}
|
f0185295eb39e731208990ecee379337d247164c
|
4970f62a81a089bd11470a592b6994232f7da8f0
|
/android/app/src/main/jni/lsd-jni.cpp
|
76e7477506694b558da013ad4a87a86fb70494db
|
[] |
no_license
|
joshuarrrrr/dont-slam-your-head
|
b4bb3f9da56c2257f4ecd41afb48614366d218c9
|
2bdf2702e0f0a7851be5244ca4c96f03ed66ade8
|
refs/heads/master
| 2021-06-09T13:03:51.375069
| 2016-10-27T11:14:18
| 2016-10-27T11:14:18
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 6,798
|
cpp
|
lsd-jni.cpp
|
#include <android/log.h>
#include <jni.h>
#include <sstream>
#include <ctime>
#include <queue>
#include <vector>
#include <functional>
#include <Eigen/Core>
#include <Eigen/Geometry>
#include <sophus/sim3.hpp>
#include <lsd_slam/LiveSLAMWrapper.h>
#include <lsd_slam/IOWrapper/Timestamp.h>
#include <lsd_slam/util/Undistorter.h>
#include <lsd_slam/util/SophusUtil.h>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#define LOG_TAG "lsd-jni.cpp"
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
//#define STORE_DEBUG_IMAGES
//#define DEBUG_PRINTS
static lsd_slam::LiveSLAMWrapper* slam;
static lsd_slam::UndistorterOpenCV* undistorter;
static int frameCount = 0;
static float* idepthMap = nullptr;
static float* idepthVar = nullptr;
// values for 320x240 input images
/*static float in_width = 320;
static float in_height = 240;
static float fx = 275.831f;
static float fy = 275.26f;
static float cx = 159.32f;
static float cy = 121.474f;
static float k1 = 0.0454102f;
static float k2 = 0.225756f;
static float p1 = 0.00056932f;
static float p2 = 0.000524407f;*/
// values for 640x480 input images
static unsigned int in_width = 640;
static unsigned int in_height = 480;
static float in_fx = 554.342f;
static float in_fy = 553.345f;
static float in_cx = 320.898f;
static float in_cy = 243.149f;
static float in_k1 = 0.0781625f;
static float in_k2 = -0.243653f;
static float in_p1 = -0.000555435f;
static float in_p2 = -0.000276287f;
// values for the undistored images
// TODO: get these values from the undistorter
static unsigned int out_width = 320;
static unsigned int out_height = 240;
static float out_fx = 276.011f;
static float out_fy = 277.207f;
static float out_cx = 159.893f;
static float out_cy = 120.989f;
static float fxi = 1.0 / out_fx;
static float fyi = 1.0 / out_fy;
static float cxi = -out_cx / out_fx;
static float cyi = -out_cy / out_fy;
static int numPoints = 500;
static float* points= nullptr;
static Sim3 camToWorld;
void getBestPoints() {
typedef std::pair<float, int> P;
std::priority_queue<P, std::vector<P>, std::greater<P>> q;
for (int i = 0; i < out_width * out_height; i += 13) {
q.push(std::pair<float, int>(idepthVar[i], i));
}
for (int i = 0; i < numPoints; ++i) {
int idx = q.top().second;
int x = idx % out_width;
int y = idx / out_height;
float depth = 1.0 / idepthMap[idx];
Sophus::Vector3f pos((x * fxi + cxi) * depth, (y * fyi + cyi) * depth, depth);
Sophus::Vector3f world_pos = camToWorld.cast<float>() * pos;
points[i * 3] = world_pos[0];
points[i * 3 + 1] = world_pos[1];
points[i * 3 + 2] = world_pos[2];
#ifdef DEBUG_PRINTS
// debug log of five points with lowest variance, TODO remove
if (i < 5) {
LOGD("%d: index[%d] = %f => (%.3f, %.3f, %.3f)", i, idx, idepthVar[idx],
pos.x(), pos.y(), pos.z());
}
#endif
q.pop();
}
}
extern "C" {
JNIEXPORT void Java_de_joshuareibert_dontslamyourhead_MainActivity_initSLAM(
JNIEnv* env, jobject thiz,
int w, int h) {
undistorter = new lsd_slam::UndistorterOpenCV(
in_fx, in_fy, in_cx, in_cy, in_k1, in_k2, in_p1, in_p2,
in_width, in_height,
"crop",
out_width, out_height);
slam = new lsd_slam::LiveSLAMWrapper(undistorter);
idepthMap = new float[out_width * out_height];
idepthVar = new float[out_width * out_height];
points = new float[numPoints * 3];
}
JNIEXPORT void Java_de_joshuareibert_dontslamyourhead_MainActivity_updateSLAM(
JNIEnv* env, jobject thiz,
jlong grayImgAddress, jlong rgbaImgAddress, jlong depthImgAddress,
jfloatArray jiDepthMap, jfloatArray jPoints)
{
cv::Mat& image = *(cv::Mat*)grayImgAddress;
cv::Mat& out_image = *(cv::Mat*)rgbaImgAddress;
cv::Mat& depth_image = *(cv::Mat*)depthImgAddress;
cv::Mat undist_image;
undistorter->undistort(image, undist_image);
SE3 pose = slam->newImageCallback(undist_image, idepthMap, idepthVar, camToWorld, lsd_slam::Timestamp::now());
getBestPoints();
env->SetFloatArrayRegion(jiDepthMap, 0, out_width * out_height, idepthMap);
env->SetFloatArrayRegion(jPoints, 0, numPoints * 3, points);
#ifdef STORE_DEBUG_IMAGES
++frameCount;
if (frameCount % 50 == 0) {
std::ostringstream ss;
ss << frameCount;
std::time_t rawtime;
std::tm* timeinfo;
char buffer [80];
std::time(&rawtime);
timeinfo = std::localtime(&rawtime);
std::strftime(buffer,80,"%Y%m%d%H%M%S",timeinfo);
std::string datestr(buffer, 14);
std::string filename = "/sdcard/lsdslam/image" + datestr;
cv::imwrite(filename + "_distorted.png", image);
cv::imwrite(filename + "_undistorted.png", undist_image);
//if (depth_image.type() > 0 && !depth_image.empty())
// cv::imwrite(filename + "_depth.png", depth_image);
LOGD("stored frame#%d on disk", frameCount);
}
#endif
// if there is a depth image, set is as output image
//if (depth_image.type() > 0 && !depth_image.empty()) {
// cv::Mat depth_image_rgba;
// cv::resize(depth_image, depth_image_rgba, out_image.size());
// cv::cvtColor(depth_image_rgba, out_image, CV_RGB2RGBA);
//}
//Eigen::Vector3f trans = Eigen::AngleAxisf(M_PI, Eigen::Vector3f::UnitZ()) * pose.translation().cast<float>();
Eigen::Vector3f trans = pose.translation().cast<float>();
Sophus::Quaternionf quat = pose.unit_quaternion().cast<float>();
jclass activity = env->FindClass("de/joshuareibert/dontslamyourhead/MainActivity");
if (activity == NULL) {
LOGE("activity class not found!");
return;
}
jmethodID trans_setter = env->GetMethodID(activity, "setTranslation", "(FFF)V");
if (trans_setter == NULL) {
LOGE("setTranslation method not found!");
return;
}
jmethodID rot_setter = env->GetMethodID(activity, "setRotation", "(FFFF)V");
if (rot_setter == NULL) {
LOGE("setRotation method not found!");
return;
}
env->CallObjectMethod(thiz, trans_setter, trans[0], trans[1], trans[2]);
env->CallObjectMethod(thiz, rot_setter, quat.x(), quat.y(), quat.z(), quat.w());
}
JNIEXPORT void Java_de_joshuareibert_dontslamyourhead_MainActivity_resetSLAM(
JNIEnv* env, jobject thiz) {
slam->requestReset();
}
JNIEXPORT void Java_de_joshuareibert_dontslamyourhead_MainActivity_exportPointCloud(
JNIEnv* env, jobject thiz) {
slam->dumpMap("/sdcard/lsdslam/mapdump");
}
}
|
ccf28400b30c83a1964c78b35481916ac832fab0
|
d5d67dd5000a4c03c164cf27a68dc5d6ea47500e
|
/lab08/state/MultiGumballMachineTest/CoutRedirect.h
|
35895a281a424bdbedae439a1a0ef7c01f4eb095
|
[] |
no_license
|
ImbaCow/OOD
|
db127161159eab83f440b1e9de41a0e7ff373f57
|
725a37b383265b14fe349da2efdfd1e71f2675af
|
refs/heads/master
| 2020-07-16T14:30:34.544134
| 2019-12-30T15:59:21
| 2019-12-30T15:59:21
| 205,805,646
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 220
|
h
|
CoutRedirect.h
|
#pragma once
#include "pch.h"
struct CoutRedirect
{
CoutRedirect(std::streambuf* new_buffer)
: old(std::cout.rdbuf(new_buffer))
{
}
~CoutRedirect()
{
std::cout.rdbuf(old);
}
private:
std::streambuf* old;
};
|
56b72abac8f1f3b6cbd4800530e14684f0ae1e38
|
ec5fe32e920f04b41ca0e228b970f068de98d86e
|
/FantasyEmblem/headers/Creditos.h
|
944a8981665301aa79ecf72daf0070c9ed16563d
|
[] |
no_license
|
asalieto/FantasyEmblem
|
93e801ad91697ea69a5a9622c8fab596fb2af9f1
|
f044748798494323f4f6ff05240dc374cdb5a88b
|
refs/heads/master
| 2021-05-30T00:11:20.758788
| 2015-05-20T20:31:09
| 2015-05-20T20:31:09
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,318
|
h
|
Creditos.h
|
/*
* File: Creditos.h
* Author: Oliver Rull
*
* Created on 19 de mayo de 2015, 19:21
*/
#ifndef CREDITOS_H
#define CREDITOS_H
#include "../headers/Juego.h"
#include "../headers/Escenario.h"
#include "../headers/Estado.h"
#include <iostream>
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
#include <stdio.h>
#include <string>
//using namespace tinyxml2;
using namespace std;
using namespace sf;
class Creditos: public Estado{
public:
static Creditos* Instance();
void input();
protected:
Creditos();
~Creditos();
private:
static Creditos* pinstance;
void init_State();
void render_State();
void update_State();
sf::Font* fuente;
sf::Text* t_textoPause;
sf::Text* t_textoPause2;
sf::Text* t_textoPause3;
sf::Text* t_textoPause4;
sf::Clock* reloj;
sf::Event* evento;
sf::Texture* per1;
sf::Sprite* sprite1;
sf::Texture* per2;
sf::Sprite* sprite2;
sf::Texture* per3;
sf::Sprite* sprite3;
sf::Texture* per4;
sf::Sprite* sprite4;
int cont;
int cont1i;
int cont1j;
int cont2i;
int cont2j;
int cont3i;
int cont3j;
int cont4i;
int cont4j;
sf::SoundBuffer* pause_close;
sf::Sound* cpause;
sf::Time time1;
};
#endif /* ESTADOPAUSE_H */
|
737305794ea581f8199c4f1b82c34abd9a042e97
|
d57a588f74673811151e71e9457c5a56fac85ddd
|
/c++/1390fourDivisors.cc
|
3837d17180bc864614a9d495a51c7e5f3b358aa0
|
[] |
no_license
|
Acytoo/leetcode
|
933c5a79140798d8c0ee6d39022561dadd1ce7f7
|
3a8bfc07465f1bc349b8e5a9f570fd458075de72
|
refs/heads/master
| 2022-10-14T20:01:15.131676
| 2022-09-29T20:17:04
| 2022-09-29T20:17:04
| 155,707,667
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,079
|
cc
|
1390fourDivisors.cc
|
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <queue>
#include <climits>
#include <stack>
#include <algorithm>
#include <cmath>
#include <set>
#include <unordered_map>
#include <list>
#include <unordered_set>
#include <map>
#include <functional>
#include <bitset>
#include <numeric>
#include <deque>
#include <mutex>
#include <utility>
#include <memory>
#include <cstring>
using namespace std;
// 1 <= nums.length <= 10^4
// 1 <= nums[i] <= 10^5
static int x = [] () {ios::sync_with_stdio(false); cin.tie(0); return 0;} ();
class Solution {
public:
int sumFourDivisors(vector<int>& nums) {
int res = 0;
for (const int num: nums) {
if (num <= 4) continue;
int root = sqrt(num);
if (root * root == num) continue;
int count = 2; // 1 and itself
int sum = 1 + num;
for (int i = 2; i <= root; ++i)
if (num % i == 0) {
count += 2;
sum += i + num / i;
}
if (count == 4) res += sum;
}
return res;
}
};
int main() {
Solution s;
return 0;
}
|
0dcbb8e9b38369faae1f9e7b46363feaffab3f4f
|
3e7f7de4c0f9a5dd47443a25cd6f049ae26a2c04
|
/30-day/anagrams.cpp
|
b0be2afac8aafc9f8c719892aa705373a22895ee
|
[] |
no_license
|
ankitsridhar16/Leetcode-problems
|
2ec092f8faab8b9f67652414354c5d480901e167
|
932db6a2b67b1726e24ac1b4a457d3b3d31efd89
|
refs/heads/master
| 2023-04-22T10:30:36.796114
| 2021-05-13T21:26:59
| 2021-05-13T21:26:59
| 260,401,394
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 542
|
cpp
|
anagrams.cpp
|
//Given an array of strings, group anagrams together.
class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
unordered_map<string, vector<string>>res;
for (int i = 0; i < strs.size(); i++) {
string str = strs[i];
sort(str.begin(), str.end());
res[str].push_back(strs[i]);
}
vector<vector<string>>ans;
for (auto it = res.begin(); it != res.end(); it++)
ans.push_back(it->second);
return ans;
}
};
|
974336ae9269c86c12919d4350eafd4b221c04a5
|
059a126febb9554536e7edfdb75f32ea0a327a6d
|
/1794 - Lavanderia/1794.cpp
|
40c198fc415d079bcf14a0ea67a10c72864af3f9
|
[] |
no_license
|
derrix060/URI
|
6c642bf590dd94d41507b17bd6f1e7cc0653d7e9
|
b3615fb7f50480fd1e534403c473a30fd29f82e1
|
refs/heads/master
| 2021-01-19T14:09:55.359320
| 2016-12-07T19:14:44
| 2016-12-07T19:14:44
| 75,674,567
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 322
|
cpp
|
1794.cpp
|
#include <iostream>
using namespace std;
int main() {
int n, la, lb, sa, sb;
int resto;
cin >> n >> la >> lb >> sa >> sb;
if ((n >= la && n <=lb) && (n >= sa && n <= sb )) //menor que o mínimo
cout << "possivel"<<endl;
else
cout << "impossivel"<<endl;
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.