blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 3 264 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 5 140 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 986
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 3.89k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 23
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 145
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 10.4M | extension stringclasses 122
values | content stringlengths 3 10.4M | authors listlengths 1 1 | author_id stringlengths 0 158 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
19888cd0bb14097cc561eeb96d610b5c8746833f | ddf51c74f4426f38093b3e86861e9a60d907bd85 | /contest/codeforces_normal/round_211/e.cpp | c5d0c029d53599bd1bb7db97fbf178b9119a0673 | [] | no_license | TheSkyFucker/acm-icpc | 65359e77855459c86f4717cd59b4bbc5b7d40f60 | 994173541054921e03ff29333242f61f6ac4869d | refs/heads/master | 2018-09-26T20:33:54.107075 | 2018-07-24T17:48:05 | 2018-07-24T17:48:05 | 111,862,682 | 6 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 2,025 | cpp | #include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pw(x) (1ll << (x))
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define rep(i,l,r) for(int i=(l);i<(r);++i)
#define per(i,l,r) for(int i=(r)-1;i>=(l);--i)
#define dd(x) cout << #x << " = " << x << ", "
#define de(x) cout << #x << " = " << x << endl
//-----
const int N = 5e2 + 7;
int n, m, r, a[N][N];
vector<pii> o1, o2;
void geto() {
int dy = r;
rep(dx, 0, r + 1) {
while (dx * dx + dy * dy > r * r) dy--;
o1.pb({dx, dy});
if (dx) o1.pb({-dx, dy});
}
for (auto p : o1) for (auto v : o1)
o2.pb({p.fi + v.fi, - p.se - v.se});
sort(all(o2));
vector<pii> ret;
rep(i, 0, sz(o2)) if (!i || o2[i].fi != o2[i - 1].fi)
ret.pb({o2[i].fi, -o2[i].se});
swap(ret, o2);
}
int dp[N][N], mx[N];
pii rt[N][N];
int main() {
scanf("%d%d%d", &n, &m, &r);
rep(i, 0, n) rep(j, 0, m) scanf("%d", &a[i][j]);
geto();
rep(i, r, n - r) {
for (auto v : o1)
rep(j, -v.se, v.se + 1)
dp[i][r] += a[i + v.fi][r + j];
rep(j, r + 1, m - r) {
dp[i][j] = dp[i][j - 1];
for (auto v : o1) dp[i][j] += a[i + v.fi][j + v.se] - a[i + v.fi][j - v.se - 1];
}
}
rep(i, r, n - r) {
per(j, r, m - r) {
rt[i][j] = rt[i][j + 1];
if (rt[i][j + 1].fi == dp[i][j]) rt[i][j].se++;
else if (rt[i][j + 1].fi < dp[i][j]) rt[i][j] = {dp[i][j], 1};
}
}
pair<int, ll> ans = {0, 0};
rep(i, r, n - r) {
fill_n(mx, n, 0);
rep(j, r, m - r) {
rep(k, 0, i) mx[k] = max(mx[k], j);
rep(k, i, n) mx[k] = max(mx[k], j + 1);
for (auto v : o2)
if (i + v.fi >= 0 && i + v.fi < n)
mx[i + v.fi] = max(mx[i + v.fi], j + v.se + 1);
rep(k, r, n - r) if (mx[k] < m - r) {
pii tmp = rt[k][mx[k]]; tmp.fi += dp[i][j];
if (tmp.fi == ans.fi) ans.se += tmp.se;
else if (tmp.fi > ans.fi) ans = tmp;
}
}
}
printf("%d %lld", ans.fi, ans.se);
return 0;
}
| [
"359084415@qq.com"
] | 359084415@qq.com |
b458530aa06254f23dd9aacb15e42c1982ef055e | 7a2425190626dd2e75dd6cbca9fe47727afbad42 | /src/nstd/execution/on.cpp | 506ff4c4b17460d918d99638ddfa084a6c191f5c | [] | no_license | dietmarkuehl/kuhllib | fadd4073c9b09992479e92112ef34c367cb90fad | 482ddc2b910870398a9a2bcaa0a77a145e081f78 | refs/heads/main | 2023-08-31T22:13:02.079530 | 2023-08-21T22:14:14 | 2023-08-21T22:14:14 | 3,148,966 | 71 | 7 | null | 2023-08-21T22:14:15 | 2012-01-10T21:49:09 | C++ | UTF-8 | C++ | false | false | 1,569 | cpp | // nstd/execution/on.cpp -*-C++-*-
// ----------------------------------------------------------------------------
// Copyright (C) 2022 Dietmar Kuehl http://www.dietmar-kuehl.de
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify,
// merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
// ----------------------------------------------------------------------------
#include <nstd/execution/on.hpp>
// ----------------------------------------------------------------------------
namespace nstd::execution {
int on_dummy{};
}
| [
"dietmar.kuehl@me.com"
] | dietmar.kuehl@me.com |
c54e25ab12831738e570a33e210b17f6dee50b8d | 84b05fa68d4e90911bc38543e544730239cfe15f | /src/object.hpp | b49e2d31e3f2c1813c9f6bbc5f3bf80d3bbabf90 | [] | no_license | TongCt/ray-tracing | 6a1e12f3c908a31cac8f75de97c6ad4077b92b93 | 79c8846e2c9e2864c7ae1ddcefb7e6d223bcb31d | refs/heads/master | 2021-05-27T23:22:09.804625 | 2013-07-08T01:52:55 | 2013-07-08T01:52:55 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,133 | hpp | /// @file object.hpp @version 1.0 @date 06/11/2013
/// @author BlahGeek@Gmail.com
#ifndef H_OBJECT_
#define H_OBJECT_
#include "common.hpp"
#include "geometry.hpp"
#include <vector>
using std::vector;
struct HandlingRay {
Ray ray;
Number ray_t;
Ray law;
HandlingRay(const Ray & _r): ray(_r){}
HandlingRay & operator = (const HandlingRay & a){
ray = a.ray; ray_t = a.ray_t; law = a.law;
}
};
class Object{
public:
Number N; // index of refraction
Number reflection_fact, refraction_fact;
Number specular_power;
Vec specular_fact;
Vec diffuse_fact;
Object(): reflection_fact(0.5), N(1.2), refraction_fact(0.5),
specular_fact(Vec(1, 1, 1)),
specular_power(60.0),
diffuse_fact(1, 1, 1){}
virtual Number closestIntersection(HandlingRay & h) = 0;
virtual Vec getDiffuseFace(const Vec & p) const;
Ray reflect(HandlingRay & h);
Ray refract(HandlingRay & h);
virtual void print() const = 0;
Color lambert(HandlingRay & h, const Color & light_color);
};
#endif
| [
"blahgeek@gmai.com"
] | blahgeek@gmai.com |
f2b66fb268df1476b85f4d4ebd1d4b1dab7affb6 | 4f0023d6356d9e956d0d8cf2e20d86b089349d94 | /Challenge017_Palindromes/main.cpp | b962193d23156b0d1ffff4bc8862072f68ab03cb | [] | no_license | bi3mer/challenges | b4a867360b10f734e6b93d935bab493c2632b421 | 6912c7d27749aacea24a26e503f955573e7585f1 | refs/heads/master | 2021-10-11T08:30:11.168285 | 2019-01-23T21:35:48 | 2019-01-23T21:35:48 | 103,853,412 | 3 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 662 | cpp | #include <string.h>
#include <stdio.h>
bool is_palindrome(char* str) {
// cast down because on odd length cases the middle most
// character can be anything
int size = strlen(str);
int required_iterations = size / 2;
bool palindrome = true;
for(int i = 0; i < required_iterations; ++i) {
int start = i;
int end = size - 1 - i;
if(str[start] != str[end]) {
palindrome = false;
break;
}
}
return palindrome;
}
int main(int argc, char* argv[]) {
for(int i = 1; i < argc; ++i) {
const char* result = is_palindrome(argv[i]) ? "true" : "false";
printf("\"%s\" is a palindrome: %s\n", argv[i], result);
}
return 0;
}
| [
"colan@comcast.net"
] | colan@comcast.net |
76f2fe91bb6b8a224b3b6e69b9f0bb654cfbb27a | 10e2ba3142e71411c37451ee81ae3fd675569b46 | /Examples/vpgtracker/main.cpp | 86e271c06c341e597507a225592b886124704826 | [] | no_license | Bearzeng/vpglib | 8194933eea024e3e507a5fef1f6fed34d2f1e400 | a3584e0ce4240e7fe41317f151db7404b8fc673a | refs/heads/master | 2020-06-03T01:50:15.107591 | 2019-03-22T09:00:01 | 2019-03-22T09:00:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 21,940 | cpp | #include <iostream>
#include <fstream>
#include <vpg.h>
#include <dlib/image_processing/frontal_face_detector.h>
#include <dlib/image_processing.h>
#include <dlib/opencv.h>
#include "facetracker.h"
// Comment to make deployment build
#define FACE_CASCADE_FILENAME "C:/Programming/3rdPArties/opencv330/build/etc/haarcascades/haarcascade_frontalface_alt2.xml"
#define EYE_CASCADE_FILENAME "C:/Programming/3rdPArties/opencv330/build/etc/haarcascades/haarcascade_eye.xml"
//#define DLIB_FACE_SHAPE_FILENAME "C:/Programming/3rdParties/Dlib/models/shape_predictor_5_face_landmarks.dat"
#define DLIB_FACE_SHAPE_FILENAME "C:/Programming/3rdParties/Dlib/models/shape_predictor_68_face_landmarks.dat"
template <typename T>
std::string num2str(T value, unsigned char precision=1);
void render_face_shape (cv::Mat &img, const dlib::full_object_detection& d);
void drawDataWindow(const cv::String &_title, const cv::Size _windowsize, const std::vector<const double *> _data, const int _datalength, double _ymax, double _ymin, const std::vector<cv::Scalar> &_colors);
void selectRegionByMouse(int event, int x, int y, int flags, void* userdata);
void loadSelection(void* userdata);
void saveSelection(void* userdata);
const cv::String keys = "{help h | | - print help}"
"{device d | 0 | - video capture device enumerator}"
"{facesize | 256 | - horizontal size of the face region}"
"{outputfilename o| facevpg.csv | - output filename that contains all the measurements}"
"{colorchannel c | green | - color channel that should be used to compute vpg signal, allowed names: red, green, blue. You also be able to toggle color channels interctively by r, g, b keys}";
int main(int argc, char *argv[])
{
cv::CommandLineParser cmdargsparser(argc, argv, keys);
cmdargsparser.about(cv::String(APP_NAME) + " v." + cv::String(APP_VERSION));
if(cmdargsparser.has("help")) {
cmdargsparser.printMessage();
std::cout << "Designed by " << APP_DESIGNER << std::endl;
return 0;
}
// Open file for output
std::ofstream ofs;
ofs.open(cmdargsparser.get<std::string>("outputfilename"));
if(ofs.is_open() == false) {
std::cout << "Can not open file '" << cmdargsparser.get<std::string>("outputfilename") << "' for write! Abort..." << std::endl;
return -1;
}
// Facetracker
std::cout << "Loading resources from HDD. Please wait..." << std::endl;
cv::String facecascadefilename;
#ifdef FACE_CASCADE_FILENAME
facecascadefilename = cv::String(FACE_CASCADE_FILENAME);
#else
facecascadefilename = "haarcascade_frontalface_alt2.xml";
#endif
cv::CascadeClassifier facedet(facecascadefilename);
if(facedet.empty()) {
std::cout << "Could not load face detector resources! Abort..." << std::endl;
return -1;
}
cv::String eyecascadefilename;
#ifdef EYE_CASCADE_FILENAME
eyecascadefilename = cv::String(EYE_CASCADE_FILENAME);
#else
eyecascadefilename = "haarcascade_eye.xml";
#endif
cv::CascadeClassifier eyedet(eyecascadefilename);
if(eyedet.empty()) {
std::cout << "Could not load eye detector resources! Abort..." << std::endl;
return -1;
}
FaceTracker facetracker(11, FaceTracker::FaceShape);
//FaceTracker facetracker(64, FaceTracker::NoAlign);
facetracker.setFaceClassifier(&facedet);
facetracker.setEyeClassifier(&eyedet);
// Video capture
cv::VideoCapture videocapture;
if(videocapture.open(cmdargsparser.get<int>("device")) == false) {
std::cerr << "Can not open video device # " << cmdargsparser.get<int>("device") << "! Abort..." << std::endl;
return -1;
} else {
videocapture.set(CV_CAP_PROP_FRAME_WIDTH, 640);
videocapture.set(CV_CAP_PROP_FRAME_HEIGHT, 480);
videocapture.set(CV_CAP_PROP_FPS, 30.0);
}
// Dlib's stuff
dlib::shape_predictor dlibshapepredictor;
try {
#ifdef DLIB_FACE_SHAPE_FILENAME
dlib::deserialize(DLIB_FACE_SHAPE_FILENAME) >> dlibshapepredictor;
#else
dlib::deserialize("shape_predictor_68_face_landmarks.dat") >> dlibshapepredictor;
#endif
}
catch(...) {
std::cerr << "Can not load dlib's resources!" << std::endl;
}
facetracker.setFaceShapeDetector(&dlibshapepredictor);
// VPGLIB's stuff
#ifdef FACE_CASCADE_FILENAME
facecascadefilename = cv::String(FACE_CASCADE_FILENAME);
#else
facecascadefilename = "haarcascade_frontalface_alt2.xml";
#endif
vpg::FaceProcessor faceproc(facecascadefilename);
if(faceproc.empty()) {
std::cout << "Could not load face detector resources! Abort..." << std::endl;
return -1;
}
std::cout << "Calibrating frame period. Please wait..." << std::endl;
double framePeriod = faceproc.measureFramePeriod(&videocapture); // ms
std::cout << framePeriod << " ms" << std::endl;
std::vector<std::vector<cv::Scalar>> _vvc;
std::vector<cv::Scalar> _colors;
// Red
_colors.push_back(cv::Scalar(0,127,255));
_colors.push_back(cv::Scalar(0,0,255));
_vvc.push_back(_colors);
_colors.clear();
//Green
_colors.push_back(cv::Scalar(0,255,255));
_colors.push_back(cv::Scalar(0,255,0));
_vvc.push_back(_colors);
_colors.clear();
//Blue
_colors.push_back(cv::Scalar(255,127,0));
_colors.push_back(cv::Scalar(255,127,127));
_vvc.push_back(_colors);
std::string _colorchannelstr = cmdargsparser.get<std::string>("colorchannel");
size_t _colorset = 0;
if(_colorchannelstr.compare("red") == 0) {
_colorset = 0;
} else if(_colorchannelstr.compare("green") == 0) {
_colorset = 1;
} else if(_colorchannelstr.compare("blue") == 0) {
_colorset = 2;
}
vpg::PulseProcessor pulseprocfirst(framePeriod), pulseprocsecond(framePeriod);
std::vector<const double *> _vpgsignals;
_vpgsignals.push_back(pulseprocfirst.getSignal());
_vpgsignals.push_back(pulseprocsecond.getSignal());
// Add peak detector for the cardio intervals evaluation and analysis
int totalcardiointervals = 25;
vpg::PeakDetector peakdetfirst(pulseprocfirst.getLength(), totalcardiointervals, 11, framePeriod), peakdetsecond(pulseprocsecond.getLength(), totalcardiointervals, 11, framePeriod);
pulseprocfirst.setPeakDetector(&peakdetfirst);
pulseprocsecond.setPeakDetector(&peakdetsecond);
std::vector<const double *> _vhrvsignals;
_vhrvsignals.push_back(peakdetfirst.getIntervalsVector());
_vhrvsignals.push_back(peakdetsecond.getIntervalsVector());
// Create local variables to store frame and processing values
double _hrupdateIntervalms = 0.0;
double _r = 0.0, _g = 0.0, _b = 0.0, t = 0.0;
double _dummytime = 0.0; // it is dummy variable, it is needed because we do not want to modify frame time on the second frame processing call
std::pair<unsigned int, unsigned int> _hr(pulseprocfirst.getFrequency(),pulseprocsecond.getFrequency());
std::pair<double, double> _snr(0.0,0.0);
double _avgBlue[] = {0,0,0,0}, _avgGreen[] = {0,0,0,0}, _avgRed[] = {0,0,0,0};
cv::Mat frame, faceregion;
cv::Size targetfacesize(cmdargsparser.get<int>("facesize"), cmdargsparser.get<int>("facesize") * 1.33);
double _frametime = 0.0, _timemark = cv::getTickCount();
cv::namedWindow("Select regions");
//set the callback function for any mouse event
std::pair<cv::Rect,cv::Rect> _selectionpair = std::make_pair(cv::Rect(), cv::Rect());
// Prepare output -------------------------------------------------------------------------------------------------------------
std::cout << "Measurements will be written to '" << cmdargsparser.get<std::string>("outputfilename") << "'" << std::endl;
std::time_t _timet = std::time(0);
struct std::tm * now = localtime( &_timet );
ofs << "This file has been created by " << APP_NAME << " v." << APP_VERSION << std::endl;
ofs << "Record was started at "
<< std::setw(2) << std::setfill('0') << now->tm_mday << '.'
<< std::setw(2) << std::setfill('0') << (now->tm_mon + 1) << '.'
<< (now->tm_year + 1900) << ' '
<< std::setw(2) << std::setfill('0') << (now->tm_hour) << ":"
<< std::setw(2) << std::setfill('0') << (now->tm_min) << ":"
<< std::setw(2) << std::setfill('0') << now->tm_sec << std::endl
<< "Measurement time interval " << framePeriod << "[ms]" << std::endl
<< "Face scheme: |3|0|" << std::endl
<< " |2|1|" << std::endl
<< "r[0],\tg[0],\tb[0],\tr[1],\tg[1],\tb[1],\tr[2],\tg[2],\tb[2],\tr[3],\tg[3],\tb[3]"
<< ",\tR_C1,\tG_C1,\tB_C1,\tR_C2,\tG_C2,\tB_C2,\tVPG_C1,\tVPG_C2";
for(unsigned int k = 0; k < 68; ++k)
ofs << ",\tP[" << k << "].X,\tP[" << k << "].Y";
ofs << std::fixed << std::setprecision(3) << std::endl;
// -----------------------------------------------------------------------------------------------------------------------------
std::cout << "You can select regions you want to process on the window 'Select regions'. Use your mouse..." << std::endl;
cv::setMouseCallback("Select regions", selectRegionByMouse, &_selectionpair);
loadSelection(&_selectionpair);
while(videocapture.read(frame)) {
faceregion = facetracker.getResizedFaceImage(frame,targetfacesize);
if(!faceregion.empty()) {
faceproc.enrollFace(faceregion,_avgRed,_avgGreen,_avgBlue,t);
for(unsigned int _part = 0; _part < 4; ++_part) {
ofs << _avgRed[_part] << ",\t" << _avgGreen[_part] << ",\t" << _avgBlue[_part] << ",\t";
}
faceproc.enrollImagePart(faceregion,_r,_g,_b,_dummytime,_selectionpair.first);
ofs << _r << ",\t" << _g << ",\t" << _b << ",\t";
switch(_colorset) {
case 0:
pulseprocfirst.update(_r,t);
break;
case 1:
pulseprocfirst.update(_g,t);
break;
case 2:
pulseprocfirst.update(_b,t);
break;
}
faceproc.enrollImagePart(faceregion,_r,_g,_b,_dummytime,_selectionpair.second);
ofs << _r << ",\t" << _g << ",\t" << _b << ",\t";
switch(_colorset) {
case 0:
pulseprocsecond.update(_r,t);
break;
case 1:
pulseprocsecond.update(_g,t);
break;
case 2:
pulseprocsecond.update(_b,t);
break;
}
_hrupdateIntervalms += t;
if(_hrupdateIntervalms > 1000.0) {
_hr.first = (_hr.first + pulseprocfirst.computeFrequency() + (60000.0 / peakdetfirst.averageCardiointervalms())) / 3.0;
_snr.first = pulseprocfirst.getSNR();
_hr.second = (_hr.second + pulseprocsecond.computeFrequency() + (60000.0 / peakdetsecond.averageCardiointervalms())) / 3.0;
_snr.second = pulseprocsecond.getSNR();
_hrupdateIntervalms = 0.0;
}
std::string _hrstr = "HR: " + std::to_string(_hr.first) + " bpm";
cv::putText(frame, _hrstr, cv::Point(4,20), CV_FONT_HERSHEY_SIMPLEX, 0.65, cv::Scalar(0,0,0),1,CV_AA);
cv::putText(frame, _hrstr, cv::Point(3,19), CV_FONT_HERSHEY_SIMPLEX, 0.65, _vvc[_colorset][0],1,CV_AA);
_hrstr = "HR: " + std::to_string(_hr.second) + " bpm";
cv::putText(frame, _hrstr, cv::Point(4,45), CV_FONT_HERSHEY_SIMPLEX, 0.65, cv::Scalar(0,0,0),1,CV_AA);
cv::putText(frame, _hrstr, cv::Point(3,44), CV_FONT_HERSHEY_SIMPLEX, 0.65, _vvc[_colorset][1],1,CV_AA);
drawDataWindow("VPG (normalized)", cv::Size(640,240), _vpgsignals, pulseprocfirst.getLength(), 3.0,-3.0,_vvc[_colorset]);
//drawDataWindow("HRV", cv::Size(640,240), _vhrvsignals, peakdetfirst.getIntervalsLength(), 1100.0,300.0,_vcolors);
cv::rectangle(faceregion,_selectionpair.first,_vvc[_colorset][0],1,CV_AA);
cv::rectangle(faceregion,_selectionpair.second,_vvc[_colorset][1],1,CV_AA);
cv::imshow("Select regions",faceregion);
cv::RotatedRect _faceRrect = facetracker.getFaceRotatedRect();
/*cv::Point2f _vert[4]; // Rectangle around the face
_faceRrect.points(_vert);
for(unsigned char i = 0; i < 4; ++i) {
cv::line(frame,_vert[i], _vert[(i+1)%4],cv::Scalar(0,0,255),1,CV_AA);
}*/
if(facetracker.getFaceAlignMethod() == FaceTracker::FaceShape) {
ofs << pulseprocfirst.getSignalSampleValue() << ",\t" << pulseprocsecond.getSignalSampleValue();
dlib::full_object_detection _faceshape = facetracker.getFaceShape();
for(size_t i = 0; i < _faceshape.num_parts(); ++i) {
dlib::point _p = _faceshape.part(i), _tp;
float _anglerad = - CV_PI * _faceRrect.angle / 180.0;
_tp.x() = _p.x()*std::cos(_anglerad) + _p.y()*std::sin(_anglerad);
_tp.y() = - _p.x()*std::sin(_anglerad) + _p.y()*std::cos(_anglerad);
_tp += dlib::point(_faceRrect.center.x,_faceRrect.center.y);
_faceshape.part(i) = _tp;
ofs << ",\t" << _tp.x() << ",\t" << _tp.y();
}
ofs << std::endl;
render_face_shape(frame,_faceshape);
}
}
_frametime = (cv::getTickCount() - _timemark) * 1000.0 / cv::getTickFrequency();
_timemark = cv::getTickCount();
cv::String _periodstr = num2str(frame.cols,0) + "x" + num2str(frame.rows,0) + " " + num2str(_frametime) + " ms, options keys: s - video settings; esc - quit";
cv::putText(frame, _periodstr, cv::Point(4,frame.rows-6), CV_FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(0,0,0), 1, CV_AA);
cv::putText(frame, _periodstr, cv::Point(3,frame.rows-7), CV_FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(255,255,255), 1, CV_AA);
cv::imshow(APP_NAME, frame);
int c = cv::waitKey(1);
if( (char)c == 27 ) { // 27 is escape ASCII code
break;
} else switch(c) {
case 's':
videocapture.set(CV_CAP_PROP_SETTINGS,0.0);
break;
case 'r':
_colorset = 0;
break;
case 'g':
_colorset = 1;
break;
case 'b':
_colorset = 2;
break;
}
}
videocapture.release();
return 0;
}
template <typename T>
std::string num2str(T value, unsigned char precision)
{
std::string _fullstring = std::to_string(value);
size_t _n = 0;
for(size_t i = 0; i < _fullstring.size(); ++i) {
if(_fullstring[i] == '.')
break;
_n++;
}
if(precision > 0) {
_n += precision + 1;
}
return std::string(_fullstring.begin(), _fullstring.begin() + _n);
}
// Grabbed from http://www.learnopencv.com/speeding-up-dlib-facial-landmark-detector/
void draw_polyline(cv::Mat &img, const dlib::full_object_detection& d, const int start, const int end, bool isClosed = false)
{
std::vector <cv::Point> points;
for (int i = start; i <= end; ++i) {
//cv::putText(img,std::to_string(i),cv::Point(d.part(i).x(), d.part(i).y()),CV_FONT_HERSHEY_SIMPLEX,0.4,cv::Scalar(0,0,255),1,CV_AA);
points.push_back(cv::Point(d.part(i).x(), d.part(i).y()));
}
cv::polylines(img, points, isClosed, cv::Scalar(0,255,0), 1, CV_AA);
}
void render_face_shape (cv::Mat &img, const dlib::full_object_detection& d)
{
DLIB_CASSERT (
d.num_parts() == 68 || d.num_parts() == 5,
"\n\t Invalid inputs were given to this function. "
<< "\n\t d.num_parts(): " << d.num_parts()
);
if(d.num_parts() == 68) {
draw_polyline(img, d, 0, 16); // Jaw line
draw_polyline(img, d, 17, 21); // Left eyebrow
draw_polyline(img, d, 22, 26); // Right eyebrow
draw_polyline(img, d, 27, 30); // Nose bridge
draw_polyline(img, d, 30, 35, true); // Lower nose
draw_polyline(img, d, 36, 41, true); // Left eye
draw_polyline(img, d, 42, 47, true); // Right Eye
draw_polyline(img, d, 48, 59, true); // Outer lip
draw_polyline(img, d, 60, 67, true); // Inner lip
} else if(d.num_parts() == 5) {
draw_polyline(img, d, 0, 1); // Left eye
draw_polyline(img, d, 2, 3); // Right Eye
draw_polyline(img, d, 4, 4); // Lower nose
}
}
void drawDataWindow(const cv::String &_title, const cv::Size _windowsize, const std::vector<const double *>_data, const int _datalength, double _ymax, double _ymin, const std::vector<cv::Scalar> &_colors)
{
if((_datalength > 0) && (_windowsize.area() > 0) && (_data.size() > 0) && (_data.size() == _colors.size())) {
const cv::Scalar _backgroundcolor = cv::Scalar(15,15,15);
const cv::Scalar _coordcolor = cv::Scalar(55,55,55);
const cv::Scalar _fontcolor = cv::Scalar(155,155,155);
cv::Mat _colorplot = cv::Mat::zeros(_windowsize, CV_8UC3);
cv::rectangle(_colorplot,cv::Rect(0,0,_colorplot.cols,_colorplot.rows),_backgroundcolor, -1);
int _ticksX = 10;
double _tickstepX = static_cast<double>(_windowsize.width)/ _ticksX ;
for(int i = 1; i < _ticksX ; i++)
cv::line(_colorplot, cv::Point2f(i*_tickstepX,0), cv::Point2f(i*_tickstepX,_colorplot.rows), _coordcolor, 1);
int _ticksY = 8;
double _tickstepY = static_cast<double>(_windowsize.height)/ _ticksY ;
for(int i = 1; i < _ticksY ; i++) {
cv::line(_colorplot, cv::Point2f(0,i*_tickstepY), cv::Point2f(_colorplot.cols,i*_tickstepY), _coordcolor, 1);
cv::putText(_colorplot, num2str(_ymax - i * (_ymax-_ymin)/_ticksY), cv::Point(5, i*_tickstepY - 10), CV_FONT_HERSHEY_SIMPLEX, 0.4, _fontcolor, 1, CV_AA);
}
double invstepY = (_ymax - _ymin) / _windowsize.height;
double stepX = static_cast<double>(_windowsize.width) / (_datalength - 1);
for(size_t c = 0; c < _data.size(); ++c) {
const double *_curve = _data[c];
for(int i = 0; i < _datalength - 1; i++) {
cv::line(_colorplot, cv::Point2f(i*stepX, _windowsize.height - (_curve[i] - _ymin)/invstepY),
cv::Point2f((i+1)*stepX, _windowsize.height - (_curve[i+1] - _ymin)/invstepY),
_colors[c], 1, CV_AA);
}
}
cv::imshow(_title, _colorplot);
}
}
void loadSelection(void* userdata)
{
cv::FileStorage _cvfilestorage;
if(_cvfilestorage.open(cv::String(APP_NAME) + cv::String(".yml"), cv::FileStorage::READ)) {
std::pair<cv::Rect,cv::Rect> *_selectionrects = reinterpret_cast<std::pair<cv::Rect,cv::Rect>*>(userdata);
_cvfilestorage["rect_1"] >> _selectionrects->first;
_cvfilestorage["rect_2"] >> _selectionrects->second;
}
_cvfilestorage.release();
}
void saveSelection(void* userdata)
{
cv::FileStorage _cvfilestorage(cv::String(APP_NAME) + cv::String(".yml"), cv::FileStorage::WRITE);
std::pair<cv::Rect,cv::Rect> *_selectionrects = reinterpret_cast<std::pair<cv::Rect,cv::Rect>*>(userdata);
_cvfilestorage << "rect_1" << _selectionrects->first;
_cvfilestorage << "rect_2" << _selectionrects->second;
_cvfilestorage.release();
}
void selectRegionByMouse(int event, int x, int y, int flags, void* userdata)
{
static int leftbtnX0 = 0, leftbtnY0 = 0, leftbtnPressed = 0,
rightbtnX0 = 0, rightbtnY0 = 0, rightbtnPressed = 0;
switch(event) {
case cv::EVENT_LBUTTONDOWN:
leftbtnX0 = x;
leftbtnY0 = y;
leftbtnPressed = 1;
break;
case cv::EVENT_LBUTTONUP:
leftbtnPressed = 0;
saveSelection(userdata);
break;
case cv::EVENT_MOUSEMOVE:
if(leftbtnPressed) {
cv::Rect &_selection = reinterpret_cast<std::pair<cv::Rect,cv::Rect>*>(userdata)->first;
if(x < leftbtnX0) {
_selection.x = x;
_selection.width = leftbtnX0-x;
} else {
_selection.x = leftbtnX0;
_selection.width = x-leftbtnX0;
}
if(y < leftbtnY0) {
_selection.y = y;
_selection.height = leftbtnY0-y;
} else {
_selection.y = leftbtnY0;
_selection.height = y-leftbtnY0;
}
}
if(rightbtnPressed) {
cv::Rect &_selection = reinterpret_cast<std::pair<cv::Rect,cv::Rect>*>(userdata)->second;
if(x < rightbtnX0) {
_selection.x = x;
_selection.width = rightbtnX0-x;
} else {
_selection.x = rightbtnX0;
_selection.width = x-rightbtnX0;
}
if(y < rightbtnY0) {
_selection.y = y;
_selection.height = rightbtnY0-y;
} else {
_selection.y = rightbtnY0;
_selection.height = y-rightbtnY0;
}
}
break;
case cv::EVENT_RBUTTONDOWN:
rightbtnX0 = x;
rightbtnY0 = y;
rightbtnPressed= 1;
break;
case cv::EVENT_RBUTTONUP:
rightbtnPressed= 0;
saveSelection(userdata);
break;
}
}
| [
"pi-null-mezon@yandex.ru"
] | pi-null-mezon@yandex.ru |
8bd9098c07e72d7c6016299a2f13ae5491519a5f | 75331337a771070fa96df9fda353f0857cb9f055 | /code/src/svm/umSVM.h | 3913c4138fbec5302ae811875749d50fc1b2ea6f | [] | no_license | GiannisPapadopoulos/DiscriminativePatches | 63d1867152f341a7df3df4859c38807a8f973e2e | f115577a7a4deba4bd02abc3481f6376e9b4d1a8 | refs/heads/master | 2021-01-10T18:21:32.733347 | 2016-01-22T10:16:31 | 2016-01-22T10:16:31 | 43,167,165 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,052 | h | /*****************************************************************************
* Master AI project ws15 group 4
* Mid-level discriminative patches
*
* cvSVM.h
*
* Created on: Nov 24, 2015
* Author: stefan
*
*****************************************************************************
* THIS SOFTWARE IS PROVIDED 'AS IS'. ANY WARRANTIES ARE DISCLAIMED. IN
* NO CASE SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DAMAGES.
*****************************************************************************/
#ifndef SRC_SVM_UMSVM_H_
#define SRC_SVM_UMSVM_H_
#include <opencv2/core/core.hpp>
#include <opencv2/ml/ml.hpp>
#include <string>
#include <vector>
namespace mai{
class DataSet;
/**
* OpenCV Support Vector Machine application
*
* @see http://docs.opencv.org/2.4/modules/ml/doc/support_vector_machines.html#
*/
class umSVM
{
public:
/**
* Initializes object with new OpenCV SVM.
*
* @param dCValue Penalty multiplier for outliers on imperfect separation.
*/
umSVM(double dCValue = 0.1);
/**
* Deletes CvSVM
*/
virtual ~umSVM();
/**
* Train linear SVM with standard parameters.
*
* @param[in] data Training data
* @param[in] labels Labels
* @param[out] vSupport Support vectors
* @return Number of support vectors
*/
int trainSVM(const cv::Mat &data,
const cv::Mat &labels,
std::vector<std::vector<float> > &vSupport);
/**
* Predict the given image.
*
* @param data Input image
* @param bReturnfDFValue Return DFValue or label ? (@see OpenCV documentation)
* @return Label(false) or value depending on bReturnfDFValue
*/
float predict(const cv::Mat &data, bool bReturnfDFValue = false);
/**
* Predict the given data.
*
* @param data Input matrix, images row-wise
* @param results Prediction results corresponding row-wise ( labels of type float )
*/
void predict(const cv::Mat &data, cv::Mat &results);
/**
* Save svm as xml. ".xml" will be added to the given name.
*
* @param strFilename Filename to save the SVM at.
*/
void saveSVM(const std::string &strFilename);
/**
* Load svm from given file.
*
* @param strFilename Filename of trained SVM to load.
*/
void loadSVM(const std::string &strFilename);
/**
* Search vectors of vSupport in input data vData.
*
* @param vData SVM training data
* @param vSupport SVM support vectors
* @param bSort Should the vectors be sorted before comparison ?
*/
static void searchSupportVector(const std::vector<std::vector<float> > &vData,
const std::vector<std::vector<float> > &vSupport,
bool bSort = false);
/**
* Search vectors of vSupport in input data data.
*
* @param data SVM training data
* @param vSupport SVM support vectors
* @param bSort Should the vectors be sorted before comparison ?
*/
static void searchSupportVector(const DataSet* const data,
const std::vector<std::vector<float> > &vSupport,
bool bSort = false);
private:
CvSVM* m_pSVM;
double m_dCValue;
};
}// namespace mai
#endif /* SRC_SVM_UMSVM_H_ */
| [
"s.selzer@student.maastrichtuniversity.nl"
] | s.selzer@student.maastrichtuniversity.nl |
1e39d52bfcc6c7b27cca052c603eb802efe6e0bf | 0b6530ec3938127f4422815fd01f59b72f0b92d6 | /Project 8/CompilerCommands/taWRITE.cpp | bb0a0cd778c0a6b3571f500365490ffa8ad9465f | [] | no_license | brenthompson2/Compiler-Construction | c9160921b48252b63981388c6fcc82d38af46eb0 | 1f239285515d49d241c10d3aad42e6e89d9bcd9f | refs/heads/master | 2021-08-29T19:05:26.702578 | 2017-12-14T18:10:36 | 2017-12-14T18:10:36 | 107,502,420 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,055 | cpp | /*
==============================================================================
File: taWRITE.cpp
Author: Brendan Thompson
Updated: 10/30/17
Description: Implementation of Functions for processing aWRITE command for Compiler object made for Transylvania University University Fall Term 2017 Compiler Construction class
==============================================================================
*/
#include "taWRITE.h"
/* ==============================================================================
Constructor & Destructor
============================================================================== */
taWRITE::taWRITE(){
return;
}
taWRITE::~taWRITE(){
return;
}
/* ==============================================================================
Public Manipulator Methods
============================================================================== */
// Connects local pointer to FileManager & SymbolTable with the parent's (compiler's) versions
void taWRITE::prepareAWRITE(FileManager *parentFileManager, SymbolTable *parentMemoryManager){
currentFileManager = parentFileManager;
currentMemoryManager = parentMemoryManager;
}
// calls the functions necessary to parse the line, sync the variables with the SymbolTable, and print the object code to the file while counting errors
// returns number of errors
int taWRITE::handleAWRITE(string currentLine, int correspondingLineNumber){
globalCurrentLine = currentLine;
// cout << "\t\t[aWRITE]: Compiling Line " << correspondingLineNumber << ": " << globalCurrentLine << endl;
// numVariablesInArray = 0;
globalNumErrors = 0;
parseParameters();
getMemoryLocation();
if (globalNumErrors == 0){
outputAWRITECommand();
// cout << "\t\t[aWRITE]: Successfully compiled aWRITE command\n";
}
else {
cout << "\t\t[aWRITE]: Failed to compile aWRITE command in line " << correspondingLineNumber << " with " << globalNumErrors << " errors\n";
}
return globalNumErrors;
}
/* ==============================================================================
Private Manipulator Methods
============================================================================== */
// calls parseVariable() to get globalArrayName, and then parseIndex() twice to get the start & end indexes
void taWRITE::parseParameters(){
bool continueParsingParameters;
int currentCharIterator = INDEX_FIRST_CHAR_AFTER_AWRITE_COMMAND;
// Get Array Name
continueParsingParameters = parseVariable(¤tCharIterator, ARRAY_CODE);
// Parse START Index
if (continueParsingParameters){
if ((isdigit(globalCurrentLine[currentCharIterator])) || (globalCurrentLine[currentCharIterator] == '.') || (globalCurrentLine[currentCharIterator] == '-')){
continueParsingParameters = parseConstant(¤tCharIterator, START_INDEX_CODE);
}
else {
continueParsingParameters = parseVariable(¤tCharIterator, START_INDEX_CODE);
}
}
else {
cout << "\t\t\t[aWRITE]: Invalid Syntax: Expecting End Index: " << globalCurrentLine << endl;
globalNumErrors++;
}
// Parse END Index
if (continueParsingParameters){
if ((isdigit(globalCurrentLine[currentCharIterator])) || (globalCurrentLine[currentCharIterator] == '.') || (globalCurrentLine[currentCharIterator] == '-')){
continueParsingParameters = parseConstant(¤tCharIterator, END_INDEX_CODE);
}
else {
continueParsingParameters = parseVariable(¤tCharIterator, END_INDEX_CODE);
}
}
else {
cout << "\t\t\t[aWRITE]: Invalid Syntax: Expecting End Index: " << globalCurrentLine << endl;
globalNumErrors++;
}
// Check if Extra Parameters
if (continueParsingParameters){
cout << "\t\t\t[aWRITE]: Error: Not Expecting parameters after End index: " << globalCurrentLine << endl;
globalNumErrors++;
}
return;
}
// parses through a line one character at a time, manages the global member variable associated with the parameterNumber, and returns whether or not there are any more parameters to parse
bool taWRITE::parseVariable(int *currentCharIterator, int parameterNumber){
char currentChar;
string currentVariableName = "";
int numCharactersInVarName = 0;
bool continueParsingVariable = true;
bool isNotLastParameter = false;
bool isValidVariableName = true;
bool caseFound;
while (continueParsingVariable){
currentChar = globalCurrentLine[(*currentCharIterator)];
caseFound = false;
// cout << "\t\t\t[aWRITE]: Current Character: " << currentChar << endl;
// Alphabetic
if (isalpha(currentChar)){
currentVariableName += currentChar;
numCharactersInVarName++;
(*currentCharIterator)++;
caseFound = true;
// cout << "\t\t\t[aWRITE]: Current Variable Name: " << currentVariableName << endl;
}
// Digit
if (isdigit(currentChar)){
if (numCharactersInVarName == 0){
cout << "\t\t\t[aWRITE]: Invalid Syntax: Variable names can not start with a digit: " << globalCurrentLine << endl;
isValidVariableName = false;
globalNumErrors++;
}
currentVariableName += currentChar;
numCharactersInVarName++;
(*currentCharIterator)++;
caseFound = true;
// cout << "\t\t\t[aWRITE]: Current Variable Name: " << currentVariableName << endl;
}
// Underscore
if (currentChar == '_'){
if (numCharactersInVarName == 0){
cout << "\t\t\t[aWRITE]: Invalid Syntax: Variables can not start with an underscore: " << globalCurrentLine << endl;
isValidVariableName = false;
globalNumErrors++;
}
currentVariableName += currentChar;
numCharactersInVarName++;
(*currentCharIterator)++;
caseFound = true;
// cout << "\t\t\t[aWRITE]: Current Variable Name: " << currentVariableName << endl;
}
// Comma ,
if (currentChar == ','){
if (parameterNumber == END_INDEX_CODE){
cout << "\t\t\t[aWRITE]: Invalid Syntax: Not Expecting Comma after EndIndex: " << globalCurrentLine << endl;
globalNumErrors++;
}
else {
if (numCharactersInVarName == 0){
cout << "\t\t\t[aWRITE]: Invalid Syntax: Expecting an ID before , " << globalCurrentLine << endl;
isValidVariableName = false;
globalNumErrors++;
}
}
continueParsingVariable = false;
isNotLastParameter = true;
(*currentCharIterator)++;
caseFound = true;
}
// End Of Line
if (currentChar == '\0'){
if (numCharactersInVarName == 0){
cout << "\t\t\t[aWRITE]: Invalid Syntax: Expecting an ID before End of Line: " << globalCurrentLine << endl;
isValidVariableName = false;
globalNumErrors++;
}
if (parameterNumber == START_INDEX_CODE){
cout << "\t\t\t[aWRITE]: Invalid Syntax: Expecting EndIndex after StartIndex: " << globalCurrentLine << endl;
isValidVariableName = false;
globalNumErrors++;
}
continueParsingVariable = false;
isNotLastParameter = false;
caseFound = true;
}
if (!caseFound){
cout << "\t\t\t[aWRITE]: Invalid Syntax: Unknown Character in line: " << globalCurrentLine << endl;
(*currentCharIterator)++;
globalNumErrors++;
}
}
// Assign to Global Parameter Name
if (isValidVariableName){
switch (parameterNumber){
case ARRAY_CODE:
globalArrayObject.variableName = currentVariableName;
break;
case START_INDEX_CODE:
globalStartIndex.variableName = currentVariableName;
globalStartIndex.isConstant = false;
break;
case END_INDEX_CODE:
globalEndIndex.variableName = currentVariableName;
globalEndIndex.isConstant = false;
break;
}
}
return isNotLastParameter;
}
// parses through a line one character at a time, manages the global member variable associated with the parameterNumber, and returns whether or not there are any more parameters to parse
bool taWRITE::parseConstant(int *currentCharIterator, int parameterNumber){
char currentChar;
string currentVariableName = "";
int numCharactersInVarName = 0;
bool continueParsingVariable = true;
bool isNotLastParameter = false;
bool isValidVariableName = true;
bool readingDecimal = false;
bool caseFound;
// Handle Negatives
currentChar = globalCurrentLine[(*currentCharIterator)];
if (currentChar == '-'){
currentVariableName += currentChar;
numCharactersInVarName++;
(*currentCharIterator)++;
// cout << "\t\t\t[CDUMP]: Current Variable Name: " << currentVariableName << endl;
}
while (continueParsingVariable){
currentChar = globalCurrentLine[(*currentCharIterator)];
caseFound = false;
// cout << "\t\t\t[aWRITE]: Current Character: " << currentChar << endl;
// Alphabetic
if (isalpha(currentChar)){
currentVariableName += currentChar;
numCharactersInVarName++;
(*currentCharIterator)++;
caseFound = true;
// cout << "\t\t\t[aWRITE]: Current Variable Name: " << currentVariableName << endl;
}
// Digit
if (isdigit(currentChar)){
currentVariableName += currentChar;
numCharactersInVarName++;
(*currentCharIterator)++;
caseFound = true;
// cout << "\t\t\t[aWRITE]: Current Variable Name: " << currentVariableName << endl;
}
// Decimal Point
if (currentChar == '.'){
if (readingDecimal){
cout << "\t\t\t[aWRITE]: Invalid Syntax: Multiple Decimal Points in One Constant: " << globalCurrentLine << endl;
isValidVariableName = false;
globalNumErrors++;
isNotLastParameter = true;
}
else {
readingDecimal = true;
currentVariableName += currentChar;
numCharactersInVarName++;
(*currentCharIterator)++;
}
caseFound = true;
// cout << "\t\t\t[aWRITE]: Current Variable Name: " << currentVariableName << endl;
}
// Comma ,
if (currentChar == ','){
if (parameterNumber == END_INDEX_CODE){
cout << "\t\t\t[aWRITE]: Invalid Syntax: Not Expecting Comma after EndIndex: " << globalCurrentLine << endl;
globalNumErrors++;
}
else {
if (numCharactersInVarName == 0){
cout << "\t\t\t[aWRITE]: Invalid Syntax: Expecting an ID before , " << globalCurrentLine << endl;
isValidVariableName = false;
globalNumErrors++;
}
}
continueParsingVariable = false;
isNotLastParameter = true;
(*currentCharIterator)++;
caseFound = true;
}
// End Of Line
if (currentChar == '\0'){
if (numCharactersInVarName == 0){
cout << "\t\t\t[aWRITE]: Invalid Syntax: Expecting a Variable Name before End of Line: " << globalCurrentLine << endl;
isValidVariableName = false;
globalNumErrors++;
}
if (parameterNumber == START_INDEX_CODE){
cout << "\t\t\t[aWRITE]: Invalid Syntax: Expecting EndIndex after StartIndex: " << globalCurrentLine << endl;
isValidVariableName = false;
globalNumErrors++;
}
continueParsingVariable = false;
isNotLastParameter = false;
caseFound = true;
}
if (!caseFound){
cout << "\t\t\t[aWRITE]: Invalid Syntax: Unknown Character in line: " << globalCurrentLine << endl;
(*currentCharIterator)++;
globalNumErrors++;
}
}
// Assign to Global Parameter Name
if (isValidVariableName){
switch (parameterNumber){
case ARRAY_CODE:
globalArrayObject.variableName = currentVariableName;
break;
case START_INDEX_CODE:
globalStartIndex.variableName = currentVariableName;
globalStartIndex.isConstant = true;
break;
case END_INDEX_CODE:
globalEndIndex.variableName = currentVariableName;
globalEndIndex.isConstant = true;
break;
}
}
return isNotLastParameter;
}
// Ensures the globalArrayName already exists in the Symbol Table and gets the memory location
void taWRITE::getMemoryLocation(){
if ((*currentMemoryManager).currentlyExists(globalArrayObject.variableName)){
globalArrayObject.memoryLocation = (*currentMemoryManager).lookup(globalArrayObject.variableName);
}
else {
cout << "\t\t\t[aWRITE]: Failed to get memory Location as " << globalArrayObject.variableName << " is undeclared: " << globalCurrentLine << endl;
globalArrayObject.memoryLocation = -1;
globalNumErrors++;
}
globalStartIndex.isArray = false;
globalStartIndex.size = 1;
globalEndIndex.isArray = false;
globalEndIndex.size = 1;
(*currentMemoryManager).manageMemoryTableObject(&globalStartIndex);
(*currentMemoryManager).manageMemoryTableObject(&globalEndIndex);
return;
}
// tells the FileManager to print the object code for the command, which includes the command op code and the variable memoryLocations
void taWRITE::outputAWRITECommand(){
// cout << "\t\t[aWRITE]: Attempting to Print Object code to .obj...\n";
(*currentFileManager).writeStringToObj(AWRITE_OP_CODE);
(*currentFileManager).writeStringToObj(" ");
(*currentFileManager).writeNumToObj((double) globalArrayObject.memoryLocation);
(*currentFileManager).writeStringToObj(" ");
(*currentFileManager).writeNumToObj((double) globalStartIndex.memoryLocation);
(*currentFileManager).writeStringToObj(" ");
(*currentFileManager).writeNumToObj((double) globalEndIndex.memoryLocation);
(*currentFileManager).writeStringToObj("\n");
// cout << "\t\t[aWRITE]: Wrote to .obj\n";
return;
}
/* ==============================================================================
Private Accessor Methods
============================================================================== */
| [
"brenthompson2@gmail.com"
] | brenthompson2@gmail.com |
1991f5106a8fbd6ba4615d484d56798d291769bc | c847f0dc30ca056c84c75836baeed78581ee01a0 | /Metaheuristics/AntColonyOptimization.h | 8678b3f2f6e0203eb003df39939816eb99901380 | [] | no_license | nfmmendes/Frameuristic | 524ba05cf5e326084e7129cb36ce121a35de6034 | 144bac4324deccb7dacf77af018bbdf01409c0dd | refs/heads/main | 2023-05-25T08:09:49.341712 | 2021-06-05T15:52:19 | 2021-06-05T15:52:19 | 374,104,809 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 225 | h | #ifndef ANT_COLONY_OPTIMIZATION_H
#define ANT_COLONY_OPTIMIZATION_H
#include<iostream>
#include "../Heuristic.h"
namespace Metaheuristic {
class AntColonyOptimization<class TSol> : Heuristic<class TSol> {
};
}
#endif | [
"nilson.fmmendes@outlook.com"
] | nilson.fmmendes@outlook.com |
a91dc631a288cf33ba7f101373d6faf93ecff0e3 | 7e5e5e2f195b1e1b6204988adcaae7a20611b696 | /palmod/Game/TMNTTF_SNES_DEF.h | 238d7ae2b8ba949004da29e497aed850a764a328 | [] | no_license | Preppy/PalMod | 08194536fab486f3562666f9eba8de908cb208c2 | 6b8b57db3f4ec90965a4ef73a0f90b8096dcd4ee | refs/heads/master | 2023-08-24T20:34:27.611939 | 2023-08-22T04:37:53 | 2023-08-22T04:37:53 | 239,400,781 | 31 | 23 | null | 2023-09-01T17:50:29 | 2020-02-10T01:05:30 | C++ | UTF-8 | C++ | false | false | 25,804 | h | #pragma once
// To add characters or palette lists:
// * If you need a new character, add them to TMNTTF_SNES_UNITS.
// * Add an associated collection of their respective nodes
// * or expand nodes as needed
// * Then create the set of palettes for that character
// That should be it. Good luck.
const std::vector<uint16_t> TMNTTF_SNES_IMGIDS_USED =
{
indexTMNTTFSprites_Armaggon, // 0x39
indexTMNTTFSprites_Aska, // 0x3A
indexTMNTTFSprites_ChromeDome, // 0x3B
indexTMNTTFSprites_CyberShredder, // 0x3C
indexTMNTTFSprites_Donatello, // 0x3D
indexTMNTTFSprites_FakeBrother, // 0x3E
indexTMNTTFSprites_Karai, // 0x3F
indexTMNTTFSprites_Leonardo, // 0x40
indexTMNTTFSprites_Michelangelo, // 0x41
indexTMNTTFSprites_Raphael, // 0x42
indexTMNTTFSprites_RatKing, // 0x43
indexTMNTTFSprites_War, // 0x44
indexTMNTTFSprites_Wingnut, // 0x45
indexTMNTTFSprites_Bonus, // 0x46
indexTMNTTFSprites_Stages, // 0x47
};
const sGame_PaletteDataset TMNTTF_SNES_LEO_PALETTES_P1[] =
{
{ L"Leo P1", 0x0487bc, 0x0487dc, indexTMNTTFSprites_Leonardo, 0x00, &pairNext2 },
};
const sGame_PaletteDataset TMNTTF_SNES_LEO_PALETTES_P2[] =
{
{ L"Leo P2", 0x0487Dc, 0x0487FC, indexTMNTTFSprites_Leonardo, 0x00, &pairNext },
};
const sGame_PaletteDataset TMNTTF_SNES_LEO_PALETTES_SHARED[] =
{
{ L"Leo Katanas", 0x0487Fc, 0x04880c, indexTMNTTFSprites_Leonardo, 0x01 },
{ L"Leo FX", 0x04880c, 0x04882c, indexTMNTTFSprites_Leonardo, 0x02 },
};
const sGame_PaletteDataset TMNTTF_SNES_RALPH_PALETTES_P1[] =
{
{ L"Ralph P1", 0x04882c, 0x04884C, indexTMNTTFSprites_Leonardo },
};
const sGame_PaletteDataset TMNTTF_SNES_RALPH_PALETTES_P2[] =
{
{ L"Ralph P2", 0x04884c, 0x04886C, indexTMNTTFSprites_Leonardo },
};
const sGame_PaletteDataset TMNTTF_SNES_RALPH_PALETTES_SHARED[] =
{
{ L"Ralph Sais", 0x04886c, 0x04887c },
{ L"Ralph Jamboree", 0x04887c, 0x04888C },
};
const sGame_PaletteDataset TMNTTF_SNES_DON_PALETTES_P1[] =
{
{ L"Don P1", 0x04890c, 0x04892C, indexTMNTTFSprites_Leonardo },
};
const sGame_PaletteDataset TMNTTF_SNES_DON_PALETTES_P2[] =
{
{ L"Don P2", 0x04892c, 0x04894C, indexTMNTTFSprites_Leonardo },
};
const sGame_PaletteDataset TMNTTF_SNES_DON_PALETTES_SHARED[] =
{
{ L"Don Bo", 0x04894c, 0x04895c },
{ L"Don FX", 0x04895c, 0x04897C },
};
const sGame_PaletteDataset TMNTTF_SNES_MIKE_PALETTES_P1[] =
{
{ L"Mike P1", 0x04889c, 0x0488BC, indexTMNTTFSprites_Leonardo },
};
const sGame_PaletteDataset TMNTTF_SNES_MIKE_PALETTES_P2[] =
{
{ L"Mike P2", 0x0488Bc, 0x0488DC, indexTMNTTFSprites_Leonardo },
};
const sGame_PaletteDataset TMNTTF_SNES_MIKE_PALETTES_SHARED[] =
{
{ L"Mike Nunchakus", 0x0488dc, 0x0488eC },
{ L"Mike Dragon Breath", 0x0488Ec, 0x0488FC },
};
const sGame_PaletteDataset TMNTTF_SNES_SHREDDER_PALETTES_P1[] =
{
{ L"C. Shredder P1", 0x048450, 0x048470, indexTMNTTFSprites_CyberShredder, 0x00, &pairNext },
{ L"C. Shredder P1 FX 1", 0x048470, 0x04847e, indexTMNTTFSprites_CyberShredder, 0x01 },
{ L"C. Shredder P1 FX 2", 0x048480, 0x0484a0 },
};
const sGame_PaletteDataset TMNTTF_SNES_SHREDDER_PALETTES_P2[] =
{
{ L"C. Shredder P2", 0x0484A0, 0x0484C0, indexTMNTTFSprites_CyberShredder, 0x00, &pairNext },
{ L"C. Shredder P2 FX", 0x0484C0, 0x0484Ce, indexTMNTTFSprites_CyberShredder, 0x01 },
{ L"C. Shredder P2 FX 2", 0x0484d0, 0x0484F0 },
};
const sGame_PaletteDataset TMNTTF_SNES_WAR_PALETTES_P1[] =
{
{ L"War P1", 0x048Aae, 0x048Ace, indexTMNTTFSprites_War },
{ L"War P1 FX", 0x048Aee, 0x048b0e },
};
const sGame_PaletteDataset TMNTTF_SNES_WAR_PALETTES_P2[] =
{
{ L"War P2", 0x048Ace, 0x048AEe, indexTMNTTFSprites_War },
{ L"War P2 FX", 0x048b0e, 0x048b2e },
};
const sGame_PaletteDataset TMNTTF_SNES_ASKA_PALETTES_P1[] =
{
{ L"Aska P1", 0x04855a, 0x04857A, indexTMNTTFSprites_Aska },
{ L"Aska P1 FX", 0x04859a, 0x0485BA },
{ L"Aska P1 FX 2", 0x0485da, 0x0485fA },
};
const sGame_PaletteDataset TMNTTF_SNES_ASKA_PALETTES_P2[] =
{
{ L"Aska P2", 0x04857a, 0x04859A, indexTMNTTFSprites_Aska },
{ L"Aska P2 FX", 0x0485Ba, 0x0485DA },
{ L"Aska P2 FX 2", 0x0485fc, 0x04861c },
};
const sGame_PaletteDataset TMNTTF_SNES_CHROME_PALETTES_P1[] =
{
{ L"Chrome Dome P1", 0x04897c, 0x04899c, indexTMNTTFSprites_ChromeDome },
{ L"Chrome Dome P1 FX", 0x04899c, 0x0489BC },
};
const sGame_PaletteDataset TMNTTF_SNES_CHROME_PALETTES_P2[] =
{
{ L"Chrome Dome P2", 0x048A5c, 0x048A7C, indexTMNTTFSprites_ChromeDome },
{ L"Chrome Dome P2 FX", 0x048A7c, 0x048A9C },
};
const sGame_PaletteDataset TMNTTF_SNES_CHROME_PALETTES_SHARED[] =
{
{ L"Chrome Dome Chrome Bomb FX 1", 0x489bc, 0x489dc },
{ L"Chrome Dome Chrome Bomb FX 2", 0x489dc, 0x489fc },
{ L"Chrome Dome Chrome Bomb FX 3", 0x489fc, 0x48a1c },
{ L"Chrome Dome Electric FX 1", 0x48a1c, 0x48a3c },
{ L"Chrome Dome Electric FX 2", 0x48a3c, 0x48a5c },
};
const sGame_PaletteDataset TMNTTF_SNES_WINGNUT_PALETTES_P1[] =
{
{ L"Wingnut P1", 0x048B2e, 0x048B4E, indexTMNTTFSprites_Wingnut },
{ L"Wingnut P1 Moonbuster/FX", 0x048B4e, 0x048B6E },
};
const sGame_PaletteDataset TMNTTF_SNES_WINGNUT_PALETTES_P2[] =
{
{ L"Wingnut P2", 0x048B6e, 0x048B8E, indexTMNTTFSprites_Wingnut },
{ L"Wingnut P2 Moonbuster/FX", 0x048B8e, 0x048BAE },
};
const sGame_PaletteDataset TMNTTF_SNES_ARMAGGON_PALETTES_P1[] =
{
{ L"Armaggon P1", 0x0484F0, 0x048510, indexTMNTTFSprites_Armaggon },
};
const sGame_PaletteDataset TMNTTF_SNES_ARMAGGON_PALETTES_P2[] =
{
{ L"Armaggon P2", 0x048510, 0x048530, indexTMNTTFSprites_Armaggon },
};
const sGame_PaletteDataset TMNTTF_SNES_ARMAGGON_PALETTES_SHARED[] =
{
{ L"Armaggon FX", 0x048530, 0x048540 },
{ L"Armaggon FX 2", 0x048540, 0x04855a },
};
const sGame_PaletteDataset TMNTTF_SNES_KARAI_PALETTES_P1[] =
{
{ L"Karai P1", 0x048bae, 0x048bce, indexTMNTTFSprites_Karai },
};
const sGame_PaletteDataset TMNTTF_SNES_KARAI_PALETTES_P2[] =
{
{ L"Karai P2", 0x048c2e, 0x048c4e, indexTMNTTFSprites_Karai },
};
const sGame_PaletteDataset TMNTTF_SNES_KARAI_PALETTES_SHARED[] =
{
{ L"Karai Bakuretsu Jigokuken", 0x048bee, 0x048c0e },
{ L"Karai Dark Thunder", 0x048c0e, 0x048c2e },
{ L"Karai Dark Thunder FX", 0x048bce, 0x048bee },
};
const sGame_PaletteDataset TMNTTF_SNES_RATKING_PALETTES_P1[] =
{
{ L"Rat King P1", 0x04861e, 0x04863e, indexTMNTTFSprites_RatKing },
{ L"Rat King P1FX", 0x04863e, 0x04865e },
{ L"Rat King P1FX 2", 0x04865e, 0x04867e },
};
const sGame_PaletteDataset TMNTTF_SNES_RATKING_PALETTES_P2[] =
{
{ L"Rat King P2", 0x04867e, 0x04869e, indexTMNTTFSprites_RatKing },
{ L"Rat King P2FX", 0x04869e, 0x0486be },
{ L"Rat King P2FX 2", 0x0486be, 0x0486de },
};
const sGame_PaletteDataset TMNTTF_SNES_FAKE_PALETTES_P1[] =
{
{ L"Fake Brother P1", 0x048cbc, 0x048cdc, indexTMNTTFSprites_FakeBrother },
};
const sGame_PaletteDataset TMNTTF_SNES_FAKE_PALETTES_P2[] =
{
{ L"Fake Brother P2", 0x048cdc, 0x048cfc, indexTMNTTFSprites_FakeBrother },
};
const sGame_PaletteDataset TMNTTF_SNES_FAKE_PALETTES_SHARED[] =
{
{ L"Fake Brother Weapon", 0x048cfc, 0x048d0c },
{ L"Fake Brother Leo FX", 0x048d0c, 0x048d2c },
{ L"Fake Brother Ralph FX", 0x048d6c, 0x048d8c },
{ L"Fake Brother Don FX", 0x048d4c, 0x048d6c },
{ L"Fake Brother Mike FX", 0x048d2c, 0x048d4c },
};
const sGame_PaletteDataset TMNTTF_SNES_STAGE_ARTMUSEUM_PALETTES[] =
{
{ L"Sculptures, Walls", 0x4A8EC, 0x4A90C },
{ L"Center Hallway", 0x4A90A, 0x4A92A },
{ L"Floor, pillars", 0x4A928, 0x4A948 },
{ L"Center Sculpture", 0x4A946, 0x4A966 },
{ L"Mousers, Big pillars", 0x4A964, 0x4A984 },
{ L"People", 0x4A982, 0x4A9A2 },
{ L"Art Museum - Center Statue Glow", 0x9BEE, 0x9C0E },
{ L"Thunder Dome - Small Floor Lights 1", 0x49ED0, 0x49EE0 },
{ L"Thunder Dome - Small Floor Lights 2", 0x49C68, 0x49C78 },
{ L"Thunder Dome - Big Floor Lights", 0x49EE0, 0x49EF8 },
{ L"Thunder Dome - Dinosaur Glow", 0x49EF8, 0x49F18 },
};
const sGame_PaletteDataset TMNTTF_SNES_STAGE_BACKALLEY_PALETTES[] =
{
{ L"Sidewalk, smashed car", 0x4837A, 0x4839A },
{ L"Garbage cans, windows, horizon", 0x48398, 0x483B8 },
{ L"Phonebooth", 0x483B6, 0x483D6 },
{ L"Torn Poster", 0x483D4, 0x483F4 },
{ L"Building, lamp posts, crates", 0x483F2, 0x48412 },
{ L"People", 0x48410, 0x48430 },
};
const sGame_PaletteDataset TMNTTF_SNES_STAGE_CAFETERIA_PALETTES[] =
{
{ L"Bar", 0x49F38, 0x49F58 },
{ L"Bar decorations / Windows", 0x49F56, 0x49F76 },
{ L"Menus, coffee, brickwall", 0x49F74, 0x49F94 },
{ L"People, barstools", 0x49F92, 0x49FB2 },
{ L"Pinball machines, Jukebox", 0x49FB0, 0x49FD0 },
{ L"Neon Sign 1", 0x49FD0, 0x49FF0 },
{ L"Neon Sign 2", 0x49FF2, 0x4A012 },
};
const sGame_PaletteDataset TMNTTF_SNES_STAGE_METROTRAIN_PALETTES[] =
{
{ L"Buildings 1, Horizon", 0x481AC, 0x481CC },
{ L"Buildings 2, Trees", 0x481CA, 0x481EA },
{ L"Brown buildings", 0x481E8, 0x48208 },
{ L"Train / Red girders 1", 0x48206, 0x48226 },
{ L"Train / Red girders 2", 0x48284, 0x482A4 },
{ L"Train / Red girders 3", 0x482A4, 0x482C4 },
{ L"Building 3", 0x48224, 0x48244 },
{ L"Chopper 1", 0x48244, 0x48264 },
{ L"Chopper 2", 0x48264, 0x48284 },
};
const sGame_PaletteDataset TMNTTF_SNES_STAGE_METALWORKS_PALETTES[] =
{
{ L"Floor", 0x482C4, 0x482E4 },
{ L"Truck / Orange Foot Soldier", 0x482E2, 0x48302 },
{ L"Red supports / Purple Foot", 0x48300, 0x48320 },
{ L"Yellow supports / Violet Foot", 0x4831E, 0x4833E },
{ L"Yellow supports / Green Foot", 0x4833C, 0x4835C },
{ L"Background", 0x4835A, 0x4837A },
{ L"Metal Works Background Cycle", 0x9BCE, 0x9BEE },
};
const sGame_PaletteDataset TMNTTF_SNES_STAGE_MTOLYMPUS_PALETTES[] =
{
{ L"Floor + Head Statue", 0x4A2F2, 0x4A312 },
{ L"Stone Blocks + Foot Clan", 0x4A310,0x4A330 },
{ L"Bebop + Pillar", 0x4A32E, 0x4A34E },
{ L"Rocksteady + Pillar", 0x4A34C, 0x4A36C },
{ L"Sphinx + Sky", 0x4A36A, 0x4A38A },
{ L"Parthanon + Sky", 0x4A388, 0x4A3A8 },
};
const sGame_PaletteDataset TMNTTF_SNES_STAGE_NOHSTAGE_PALETTES[] =
{
{ L"Floor, Cherry Blossom Trees", 0x4AD8E, 0x4ADAE },
{ L"People (robed), Shrines", 0x4ADAC, 0x4ADCC },
{ L"Frog", 0x4ADCA, 0x4ADEA },
{ L"Stairs, Roof", 0x4ADE8, 0x4AE08 },
{ L"Walls, Banners", 0x4AE06, 0x4AE26 },
{ L"Tsunami art walls", 0x4AE24, 0x4AE44 },
{ L"Guy on Frog", 0x4AE44, 0x4AE64 },
};
const sGame_PaletteDataset TMNTTF_SNES_STAGE_PIRATESHIP_PALETTES[] =
{
{ L"Water / Floor", 0x4A3A8, 0x4A3C8 },
{ L"Cannons, Wood, Water", 0x4A3C6,0x4A3E6 },
{ L"Purple BG, Wood", 0x4A3E4, 0x4A404 },
{ L"Barrels", 0x4A402, 0x4A422 },
{ L"Tentacles", 0x4A420, 0x4A440 },
{ L"Squid", 0x4A43E, 0x4A45E },
};
const sGame_PaletteDataset TMNTTF_SNES_STAGE_SCRAPYARD_PALETTES[] =
{
{ L"Floor + Casey", 0x4AE64, 0x4AE84 },
{ L"Fence, Tires, Wrecking ball, Clouds", 0x4AE82, 0x4AEA2 },
{ L"Yellow Car", 0x4AEA0, 0x4AEC0 },
{ L"Pink Car", 0x4AEBE, 0x4AEDE },
{ L"Background cars, Clear Sky", 0x4AEDC, 0x4AEFC },
{ L"Baxter", 0x4AEFA, 0x4AF1A },
};
const sGame_PaletteDataset TMNTTF_SNES_STAGE_SKYPALACE_PALETTES[] =
{
{ L"Floor", 0x4A5DC, 0x4A5FC },
{ L"Skyline (Green, Red buildings)", 0x4A5FA, 0x4A61A },
{ L"Skyline (Purple)", 0x4A618, 0x4A638 },
{ L"Billboard (left)", 0x4A636, 0x4A656 },
{ L"Billboard (right)", 0x4A654, 0x4A674 },
{ L"KONAMI sign 1", 0x4A674, 0x4A694 },
{ L"KONAMI sign 2", 0x4A694, 0x4A6B4 },
{ L"KONAMI sign 3", 0x4A6B4, 0x4A6D4 },
{ L"KONAMI sign 4", 0x4A6D4, 0x4A6F4 },
};
const sGame_PaletteDataset TMNTTF_SNES_STAGE_STUDIO6_PALETTES[] =
{
{ L"Curtains", 0x4A45E, 0x4A47E },
{ L"Desk, Cameras", 0x4A47C, 0x4A49C },
{ L"Crates, Stage lights", 0x4A49A, 0x4A4BA },
{ L"Floor, Neon Sign 1", 0x4A4B8, 0x4A4D8 },
{ L"Floor, Neon Sign 2", 0x4A58E, 0x4A5AE },
{ L"People, $ signs", 0x4A4D6, 0x4A4F6 },
};
const sGame_PaletteDataset TMNTTF_SNES_STAGE_THUNDERDOME_PALETTES[] =
{
{ L"Stage lights, supports, crowd", 0x49BB0, 0x49BD0 },
{ L"lights, stage, drummer 1", 0x49Bce, 0x49Bee },
{ L"Instruments", 0x49BEC, 0x49C0C },
{ L"Floor", 0x49C0A, 0x49C2A },
{ L"Band / Rockers", 0x49C28, 0x49C48 },
{ L"Dinosaurs / Lights", 0x49C46, 0x49C66 },
{ L"Singer", 0x49F18, 0x49F38 },
};
const sGame_PaletteDataset TMNTTF_SNES_BONUS_PALETTES_SELECT[] =
{
{ L"Turtles Portrait Weapons", 0x049860, 0x049880, indexTMNTTFSprites_Bonus, 0x08 },
{ L"Leo Portrait P1", 0x049882, 0x0498A2, indexTMNTTFSprites_Bonus, 0x05 },
{ L"Leo Portrait P2", 0x049A1A, 0x049A3A, indexTMNTTFSprites_Bonus, 0x05 },
{ L"Ralph Portrait P1", 0x0498C6, 0x0498E6, indexTMNTTFSprites_Bonus, 0x07 },
{ L"Ralph Portrait P2", 0x049A5E, 0x049A7E, indexTMNTTFSprites_Bonus, 0x07 },
{ L"Don Portrait P1", 0x0498E8, 0x049908, indexTMNTTFSprites_Bonus, 0x04 },
{ L"Don Portrait P2", 0x049A80, 0x049AA0, indexTMNTTFSprites_Bonus, 0x04 },
{ L"Mike Portrait P1", 0x0498A4, 0x0498C4, indexTMNTTFSprites_Bonus, 0x06 },
{ L"Mike Portrait P2", 0x049A3c, 0x049A5C, indexTMNTTFSprites_Bonus, 0x06 },
{ L"C. Shredder Portrait P1", 0x04994E, 0x04996E, indexTMNTTFSprites_Bonus, 0x03 },
{ L"C. Shredder Portrait P2", 0x049AE6, 0x049B06, indexTMNTTFSprites_Bonus, 0x03 },
{ L"War Portrait P1", 0x049992, 0x0499B2, indexTMNTTFSprites_Bonus, 0x09 },
{ L"War Portrait P2", 0x049B2A, 0x049B4A, indexTMNTTFSprites_Bonus, 0x09 },
{ L"Aska Portrait P1", 0x0499B4, 0x0499D4, indexTMNTTFSprites_Bonus, 0x01 },
{ L"Aska Portrait P2", 0x049B4c, 0x049B6C, indexTMNTTFSprites_Bonus, 0x01 },
{ L"Chrome Dome Portrait P1", 0x04992c, 0x04994C, indexTMNTTFSprites_Bonus, 0x02 },
{ L"Chrome Dome Portrait P2", 0x049AC4, 0x049AE4, indexTMNTTFSprites_Bonus, 0x02 },
{ L"Wingnut Portrait P1", 0x0499D6, 0x0499F6, indexTMNTTFSprites_Bonus, 0x0a },
{ L"Wingnut Portrait P2", 0x049B6E, 0x049B8E, indexTMNTTFSprites_Bonus, 0x0a },
{ L"Armaggon Portrait P1", 0x049AA2, 0x049AC2, indexTMNTTFSprites_Bonus, 0x00 },
{ L"Armaggon Portrait P2", 0x04990A, 0x04992A, indexTMNTTFSprites_Bonus, 0x00 },
{ L"Karai Portrait P1", 0x0499f8, 0x049a18 },
{ L"Karai Portrait P2", 0x049B90, 0x049Bb0 },
{ L"Rat King Portrait P1", 0x049970, 0x049990 },
{ L"Rat King Portrait P2", 0x049b08, 0x049b28 },
};
const sGame_PaletteDataset TMNTTF_SNES_BONUS_PALETTES_SELECTICONS[] =
{
{ L"Leo & Ralph Select Icon", 0x0496f8, 0x049718 },
{ L"Don & Mike Select Icon", 0x0496d8, 0x0496f8 },
{ L"C.Shredder Select Icon", 0x0496b8, 0x0496d8 },
{ L"War Select Icon", 0x049800, 0x049820 },
{ L"Aska Select Icon", 0x04975c, 0x04977c },
{ L"Chrome Dome Select Icon", 0x0486fe, 0x04871e },
{ L"Wingnut Select Icon", 0x0497a0, 0x0497c0 },
{ L"Armaggon Select Icon", 0x049820, 0x049840 },
};
const sGame_PaletteDataset TMNTTF_SNES_BONUS_PALETTES_STAGESELECTICONS[] =
{
{ L"Satellite", 0x49EAE, 0x49ECE },
{ L"US Map", 0x49CD2, 0x49CF2 },
{ L"Statue of Liberty / Horizontal Gradient / Stars", 0x49C96, 0x49CB6 },
{ L"US Flag", 0x49CB4, 0x49CD4 },
{ L"Back Alley Select Icon", 0x49D2e, 0x49D4E },
{ L"Thunder Dome Select Icon", 0x49D4e, 0x49D6E },
{ L"Metal Works Select Icon", 0x49D6e, 0x49D8E },
{ L"Cafeteria Select Icon", 0x49DAe, 0x49DCE },
{ L"Mt. Olympus Select Icon", 0x49DCe, 0x49DEE },
{ L"Pirate Ship Select Icon", 0x49DEe, 0x49E0E },
{ L"Sky Palace Select Icon", 0x49E0e, 0x49E2E },
{ L"Art Museum Select Icon", 0x49E4e, 0x49E6E },
{ L"Noh-Stage Select Icon", 0x49E6e, 0x49E8E },
{ L"Scrapyard Select Icon", 0x49E8e, 0x49EAE },
{ L"Studio 6 Select Icon", 0x49E2E, 0x49E4E },
{ L"Metro Train Select Icon", 0x49D8E, 0x49DAE },
};
const sGame_PaletteDataset TMNTTF_SNES_BONUS_PALETTES_UNSELECTICONS[] =
{
{ L"Turtles UnSelect Icon", 0x04973a, 0x04975a },
{ L"C.Shredder UnSelect Icon", 0x049718, 0x049738 },
{ L"War UnSelect Icon", 0x04871e, 0x04873e },
{ L"Aska UnSelect Icon", 0x04977e, 0x04979e },
{ L"Chrome Dome UnSelect Icon", 0x0486de, 0x0486fe },
{ L"Wingnut UnSelect Icon", 0x0497c2, 0x0497e2 },
};
const sGame_PaletteDataset TMNTTF_SNES_BONUS_PALETTES_BONUS[] =
{
{ L"Characters Names", 0x049840, 0x049860 },
{ L"Character Select BG", 0x49678, 0x49698 },
};
const sDescTreeNode TMNTTF_SNES_LEO_COLLECTION[] =
{
{ L"P1", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_LEO_PALETTES_P1, ARRAYSIZE(TMNTTF_SNES_LEO_PALETTES_P1) },
{ L"P2", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_LEO_PALETTES_P2, ARRAYSIZE(TMNTTF_SNES_LEO_PALETTES_P2) },
{ L"Shared", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_LEO_PALETTES_SHARED, ARRAYSIZE(TMNTTF_SNES_LEO_PALETTES_SHARED) },
};
const sDescTreeNode TMNTTF_SNES_RALPH_COLLECTION[] =
{
{ L"P1", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_RALPH_PALETTES_P1, ARRAYSIZE(TMNTTF_SNES_RALPH_PALETTES_P1) },
{ L"P2", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_RALPH_PALETTES_P2, ARRAYSIZE(TMNTTF_SNES_RALPH_PALETTES_P2) },
{ L"Shared", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_RALPH_PALETTES_SHARED, ARRAYSIZE(TMNTTF_SNES_RALPH_PALETTES_SHARED) },
};
const sDescTreeNode TMNTTF_SNES_DON_COLLECTION[] =
{
{ L"P1", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_DON_PALETTES_P1, ARRAYSIZE(TMNTTF_SNES_DON_PALETTES_P1) },
{ L"P2", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_DON_PALETTES_P2, ARRAYSIZE(TMNTTF_SNES_DON_PALETTES_P2) },
{ L"Shared", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_DON_PALETTES_SHARED, ARRAYSIZE(TMNTTF_SNES_DON_PALETTES_SHARED) },
};
const sDescTreeNode TMNTTF_SNES_MIKE_COLLECTION[] =
{
{ L"P1", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_MIKE_PALETTES_P1, ARRAYSIZE(TMNTTF_SNES_MIKE_PALETTES_P1) },
{ L"P2", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_MIKE_PALETTES_P2, ARRAYSIZE(TMNTTF_SNES_MIKE_PALETTES_P2) },
{ L"Shared", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_MIKE_PALETTES_SHARED, ARRAYSIZE(TMNTTF_SNES_MIKE_PALETTES_SHARED) },
};
const sDescTreeNode TMNTTF_SNES_SHREDDER_COLLECTION[] =
{
{ L"P1", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_SHREDDER_PALETTES_P1, ARRAYSIZE(TMNTTF_SNES_SHREDDER_PALETTES_P1) },
{ L"P2", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_SHREDDER_PALETTES_P2, ARRAYSIZE(TMNTTF_SNES_SHREDDER_PALETTES_P2) },
};
const sDescTreeNode TMNTTF_SNES_WAR_COLLECTION[] =
{
{ L"P1", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_WAR_PALETTES_P1, ARRAYSIZE(TMNTTF_SNES_WAR_PALETTES_P1) },
{ L"P2", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_WAR_PALETTES_P2, ARRAYSIZE(TMNTTF_SNES_WAR_PALETTES_P2) },
};
const sDescTreeNode TMNTTF_SNES_ASKA_COLLECTION[] =
{
{ L"P1", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_ASKA_PALETTES_P1, ARRAYSIZE(TMNTTF_SNES_ASKA_PALETTES_P1) },
{ L"P2", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_ASKA_PALETTES_P2, ARRAYSIZE(TMNTTF_SNES_ASKA_PALETTES_P2) },
};
const sDescTreeNode TMNTTF_SNES_CHROME_COLLECTION[] =
{
{ L"P1", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_CHROME_PALETTES_P1, ARRAYSIZE(TMNTTF_SNES_CHROME_PALETTES_P1) },
{ L"P2", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_CHROME_PALETTES_P2, ARRAYSIZE(TMNTTF_SNES_CHROME_PALETTES_P2) },
{ L"Bonus", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_CHROME_PALETTES_SHARED, ARRAYSIZE(TMNTTF_SNES_CHROME_PALETTES_SHARED) },
};
const sDescTreeNode TMNTTF_SNES_WINGNUT_COLLECTION[] =
{
{ L"P1", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_WINGNUT_PALETTES_P1, ARRAYSIZE(TMNTTF_SNES_WINGNUT_PALETTES_P1) },
{ L"P2", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_WINGNUT_PALETTES_P2, ARRAYSIZE(TMNTTF_SNES_WINGNUT_PALETTES_P2) },
};
const sDescTreeNode TMNTTF_SNES_ARMAGGON_COLLECTION[] =
{
{ L"P1", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_ARMAGGON_PALETTES_P1, ARRAYSIZE(TMNTTF_SNES_ARMAGGON_PALETTES_P1) },
{ L"P2", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_ARMAGGON_PALETTES_P2, ARRAYSIZE(TMNTTF_SNES_ARMAGGON_PALETTES_P2) },
{ L"Shared", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_ARMAGGON_PALETTES_SHARED, ARRAYSIZE(TMNTTF_SNES_ARMAGGON_PALETTES_SHARED) },
};
const sDescTreeNode TMNTTF_SNES_KARAI_COLLECTION[] =
{
{ L"P1", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_KARAI_PALETTES_P1, ARRAYSIZE(TMNTTF_SNES_KARAI_PALETTES_P1) },
{ L"P2", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_KARAI_PALETTES_P2, ARRAYSIZE(TMNTTF_SNES_KARAI_PALETTES_P2) },
{ L"Shared", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_KARAI_PALETTES_SHARED, ARRAYSIZE(TMNTTF_SNES_KARAI_PALETTES_SHARED) },
};
const sDescTreeNode TMNTTF_SNES_RATKING_COLLECTION[] =
{
{ L"P1", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_RATKING_PALETTES_P1, ARRAYSIZE(TMNTTF_SNES_RATKING_PALETTES_P1) },
{ L"P2", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_RATKING_PALETTES_P2, ARRAYSIZE(TMNTTF_SNES_RATKING_PALETTES_P2) },
};
const sDescTreeNode TMNTTF_SNES_FAKE_COLLECTION[] =
{
{ L"P1", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_FAKE_PALETTES_P1, ARRAYSIZE(TMNTTF_SNES_FAKE_PALETTES_P1) },
{ L"P2", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_FAKE_PALETTES_P2, ARRAYSIZE(TMNTTF_SNES_FAKE_PALETTES_P2) },
{ L"Shared", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_FAKE_PALETTES_SHARED, ARRAYSIZE(TMNTTF_SNES_FAKE_PALETTES_SHARED) },
};
const sDescTreeNode TMNTTF_SNES_STAGES_COLLECTION[] =
{
{ L"Art Museum", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_STAGE_ARTMUSEUM_PALETTES, ARRAYSIZE(TMNTTF_SNES_STAGE_ARTMUSEUM_PALETTES) },
{ L"Back Alley", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_STAGE_BACKALLEY_PALETTES, ARRAYSIZE(TMNTTF_SNES_STAGE_BACKALLEY_PALETTES) },
{ L"Cafeteria", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_STAGE_CAFETERIA_PALETTES, ARRAYSIZE(TMNTTF_SNES_STAGE_CAFETERIA_PALETTES) },
{ L"Metal Works", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_STAGE_METALWORKS_PALETTES, ARRAYSIZE(TMNTTF_SNES_STAGE_METALWORKS_PALETTES) },
{ L"Metro Train", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_STAGE_METROTRAIN_PALETTES, ARRAYSIZE(TMNTTF_SNES_STAGE_METROTRAIN_PALETTES) },
{ L"Mt. Olympus", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_STAGE_MTOLYMPUS_PALETTES, ARRAYSIZE(TMNTTF_SNES_STAGE_MTOLYMPUS_PALETTES) },
{ L"Noh Stage", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_STAGE_NOHSTAGE_PALETTES, ARRAYSIZE(TMNTTF_SNES_STAGE_NOHSTAGE_PALETTES) },
{ L"Pirate Ship", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_STAGE_PIRATESHIP_PALETTES, ARRAYSIZE(TMNTTF_SNES_STAGE_PIRATESHIP_PALETTES) },
{ L"Scrapyard", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_STAGE_SCRAPYARD_PALETTES, ARRAYSIZE(TMNTTF_SNES_STAGE_SCRAPYARD_PALETTES) },
{ L"Sky Palace", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_STAGE_SKYPALACE_PALETTES, ARRAYSIZE(TMNTTF_SNES_STAGE_SKYPALACE_PALETTES) },
{ L"Studio 6", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_STAGE_STUDIO6_PALETTES, ARRAYSIZE(TMNTTF_SNES_STAGE_STUDIO6_PALETTES) },
{ L"Thunder Dome", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_STAGE_THUNDERDOME_PALETTES, ARRAYSIZE(TMNTTF_SNES_STAGE_THUNDERDOME_PALETTES) },
{ L"Stage Select", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_BONUS_PALETTES_STAGESELECTICONS, ARRAYSIZE(TMNTTF_SNES_BONUS_PALETTES_STAGESELECTICONS) },
};
const sDescTreeNode TMNTTF_SNES_BONUS_COLLECTION[] =
{
{ L"Select Portraits", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_BONUS_PALETTES_SELECT, ARRAYSIZE(TMNTTF_SNES_BONUS_PALETTES_SELECT) },
{ L"Selected Icons", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_BONUS_PALETTES_SELECTICONS, ARRAYSIZE(TMNTTF_SNES_BONUS_PALETTES_SELECTICONS) },
{ L"Unselected Icons", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_BONUS_PALETTES_UNSELECTICONS, ARRAYSIZE(TMNTTF_SNES_BONUS_PALETTES_UNSELECTICONS) },
{ L"Bonus", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_BONUS_PALETTES_BONUS, ARRAYSIZE(TMNTTF_SNES_BONUS_PALETTES_BONUS) },
};
const sDescTreeNode TMNTTF_SNES_UNITS[] =
{
{ L"Leo", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_LEO_COLLECTION, ARRAYSIZE(TMNTTF_SNES_LEO_COLLECTION) },
{ L"Ralph", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_RALPH_COLLECTION, ARRAYSIZE(TMNTTF_SNES_RALPH_COLLECTION) },
{ L"Don", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_DON_COLLECTION, ARRAYSIZE(TMNTTF_SNES_DON_COLLECTION) },
{ L"Mike", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_MIKE_COLLECTION, ARRAYSIZE(TMNTTF_SNES_MIKE_COLLECTION) },
{ L"C. Shredder", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_SHREDDER_COLLECTION, ARRAYSIZE(TMNTTF_SNES_SHREDDER_COLLECTION) },
{ L"War", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_WAR_COLLECTION, ARRAYSIZE(TMNTTF_SNES_WAR_COLLECTION) },
{ L"Aska", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_ASKA_COLLECTION, ARRAYSIZE(TMNTTF_SNES_ASKA_COLLECTION) },
{ L"Chrome Dome", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_CHROME_COLLECTION, ARRAYSIZE(TMNTTF_SNES_CHROME_COLLECTION) },
{ L"Wingnut", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_WINGNUT_COLLECTION, ARRAYSIZE(TMNTTF_SNES_WINGNUT_COLLECTION) },
{ L"Armaggon", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_ARMAGGON_COLLECTION, ARRAYSIZE(TMNTTF_SNES_ARMAGGON_COLLECTION) },
{ L"Karai", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_KARAI_COLLECTION, ARRAYSIZE(TMNTTF_SNES_KARAI_COLLECTION) },
{ L"Rat King", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_RATKING_COLLECTION, ARRAYSIZE(TMNTTF_SNES_RATKING_COLLECTION) },
{ L"Fake Brother", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_FAKE_COLLECTION, ARRAYSIZE(TMNTTF_SNES_FAKE_COLLECTION) },
{ L"Bonus Palettes", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_BONUS_COLLECTION, ARRAYSIZE(TMNTTF_SNES_BONUS_COLLECTION) },
{ L"Stages", DESC_NODETYPE_TREE, (void*)TMNTTF_SNES_STAGES_COLLECTION, ARRAYSIZE(TMNTTF_SNES_STAGES_COLLECTION) },
};
| [
"meandyouftw@gmail.com"
] | meandyouftw@gmail.com |
c6c9005dc9b12f461a74cff8f171bc44e549bee1 | 7883b5ec7509325c26162ed2da8130fc6a4a4586 | /external/gli-0.3.1.0/external/glm-0.9.1.1/glm/core/type_mat3x2.inl | 8198574c5b74454bbf8b4d8bb1b8a040be41b326 | [
"MIT"
] | permissive | GPUOpen-LibrariesAndSDKs/Tessellation | ef7f5dceac664e7341d3959fb0ae618c53a6cf38 | b73d7975cd992c978ea6e39c24c0425965202814 | refs/heads/master | 2023-05-31T22:34:56.366007 | 2016-01-27T11:29:15 | 2016-01-27T11:29:15 | 50,381,493 | 67 | 22 | null | null | null | null | UTF-8 | C++ | false | false | 12,045 | inl | ///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2006-08-05
// Updated : 2010-01-05
// Licence : This source is under MIT License
// File : glm/core/type_mat3x2.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace detail
{
template <typename T>
inline typename tmat3x2<T>::size_type tmat3x2<T>::col_size()
{
return 2;
}
template <typename T>
inline typename tmat3x2<T>::size_type tmat3x2<T>::row_size()
{
return 3;
}
//////////////////////////////////////
// Accesses
template <typename T>
inline typename tmat3x2<T>::col_type &
tmat3x2<T>::operator[]
(
size_type i
)
{
assert(i < this->row_size());
return this->value[i];
}
template <typename T>
inline typename tmat3x2<T>::col_type const &
tmat3x2<T>::operator[]
(
size_type i
) const
{
assert(i < this->row_size());
return this->value[i];
}
//////////////////////////////////////////////////////////////
// Constructors
template <typename T>
inline tmat3x2<T>::tmat3x2()
{
this->value[0] = col_type(1, 0);
this->value[1] = col_type(0, 1);
this->value[2] = col_type(0, 0);
}
template <typename T>
inline tmat3x2<T>::tmat3x2
(
tmat3x2<T> const & m
)
{
this->value[0] = m.value[0];
this->value[1] = m.value[1];
this->value[2] = m.value[2];
}
template <typename T>
inline tmat3x2<T>::tmat3x2
(
ctor
)
{}
template <typename T>
inline tmat3x2<T>::tmat3x2
(
value_type const & s
)
{
this->value[0] = col_type(s, 0);
this->value[1] = col_type(0, s);
this->value[2] = col_type(0, 0);
}
template <typename T>
inline tmat3x2<T>::tmat3x2
(
value_type const & x0, value_type const & y0,
value_type const & x1, value_type const & y1,
value_type const & x2, value_type const & y2
)
{
this->value[0] = col_type(x0, y0);
this->value[1] = col_type(x1, y1);
this->value[2] = col_type(x2, y2);
}
template <typename T>
inline tmat3x2<T>::tmat3x2
(
col_type const & v0,
col_type const & v1,
col_type const & v2
)
{
this->value[0] = v0;
this->value[1] = v1;
this->value[2] = v2;
}
// Conversion
template <typename T>
template <typename U>
inline tmat3x2<T>::tmat3x2
(
tmat3x2<U> const & m
)
{
this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]);
}
template <typename T>
inline tmat3x2<T>::tmat3x2
(
tmat2x2<T> const & m
)
{
this->value[0] = m[0];
this->value[1] = m[1];
this->value[2] = col_type(T(0));
}
template <typename T>
inline tmat3x2<T>::tmat3x2
(
tmat3x3<T> const & m
)
{
this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]);
}
template <typename T>
inline tmat3x2<T>::tmat3x2
(
tmat4x4<T> const & m
)
{
this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]);
}
template <typename T>
inline tmat3x2<T>::tmat3x2
(
tmat2x3<T> const & m
)
{
this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]);
this->value[2] = col_type(T(0));
}
template <typename T>
inline tmat3x2<T>::tmat3x2
(
tmat2x4<T> const & m
)
{
this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]);
this->value[2] = col_type(T(0));
}
template <typename T>
inline tmat3x2<T>::tmat3x2
(
tmat3x4<T> const & m
)
{
this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]);
}
template <typename T>
inline tmat3x2<T>::tmat3x2
(
tmat4x2<T> const & m
)
{
this->value[0] = m[0];
this->value[1] = m[1];
this->value[2] = m[2];
}
template <typename T>
inline tmat3x2<T>::tmat3x2
(
tmat4x3<T> const & m
)
{
this->value[0] = col_type(m[0]);
this->value[1] = col_type(m[1]);
this->value[2] = col_type(m[2]);
}
//////////////////////////////////////////////////////////////
// Unary updatable operators
template <typename T>
inline tmat3x2<T>& tmat3x2<T>::operator=
(
tmat3x2<T> const & m
)
{
this->value[0] = m[0];
this->value[1] = m[1];
this->value[2] = m[2];
return *this;
}
template <typename T>
template <typename U>
inline tmat3x2<T>& tmat3x2<T>::operator=
(
tmat3x2<U> const & m
)
{
this->value[0] = m[0];
this->value[1] = m[1];
this->value[2] = m[2];
return *this;
}
template <typename T>
template <typename U>
inline tmat3x2<T>& tmat3x2<T>::operator+=
(
U const & s
)
{
this->value[0] += s;
this->value[1] += s;
this->value[2] += s;
return *this;
}
template <typename T>
template <typename U>
inline tmat3x2<T>& tmat3x2<T>::operator+=
(
tmat3x2<U> const & m
)
{
this->value[0] += m[0];
this->value[1] += m[1];
this->value[2] += m[2];
return *this;
}
template <typename T>
template <typename U>
inline tmat3x2<T>& tmat3x2<T>::operator-=
(
U const & s
)
{
this->value[0] -= s;
this->value[1] -= s;
this->value[2] -= s;
return *this;
}
template <typename T>
template <typename U>
inline tmat3x2<T>& tmat3x2<T>::operator-=
(
tmat3x2<U> const & m
)
{
this->value[0] -= m[0];
this->value[1] -= m[1];
this->value[2] -= m[2];
return *this;
}
template <typename T>
template <typename U>
inline tmat3x2<T>& tmat3x2<T>::operator*=
(
U const & s
)
{
this->value[0] *= s;
this->value[1] *= s;
this->value[2] *= s;
return *this;
}
template <typename T>
template <typename U>
inline tmat3x2<T>& tmat3x2<T>::operator*=
(
tmat3x2<U> const & m
)
{
return (*this = tmat3x2<T>(*this * m));
}
template <typename T>
template <typename U>
inline tmat3x2<T> & tmat3x2<T>::operator/=
(
U const & s
)
{
this->value[0] /= s;
this->value[1] /= s;
this->value[2] /= s;
return *this;
}
template <typename T>
inline tmat3x2<T>& tmat3x2<T>::operator++ ()
{
++this->value[0];
++this->value[1];
++this->value[2];
return *this;
}
template <typename T>
inline tmat3x2<T>& tmat3x2<T>::operator-- ()
{
--this->value[0];
--this->value[1];
--this->value[2];
return *this;
}
//////////////////////////////////////////////////////////////
// Binary operators
template <typename T>
inline tmat3x2<T> operator+
(
tmat3x2<T> const & m,
typename tmat3x2<T>::value_type const & s
)
{
return tmat3x2<T>(
m[0] + s,
m[1] + s,
m[2] + s);
}
template <typename T>
inline tmat3x2<T> operator+
(
tmat3x2<T> const & m1,
tmat3x2<T> const & m2
)
{
return tmat3x2<T>(
m1[0] + m2[0],
m1[1] + m2[1],
m1[2] + m2[2]);
}
template <typename T>
inline tmat3x2<T> operator-
(
tmat3x2<T> const & m,
typename tmat3x2<T>::value_type const & s
)
{
return tmat3x2<T>(
m[0] - s,
m[1] - s,
m[2] - s);
}
template <typename T>
inline tmat3x2<T> operator-
(
tmat3x2<T> const & m1,
tmat3x2<T> const & m2
)
{
return tmat3x2<T>(
m1[0] - m2[0],
m1[1] - m2[1],
m1[2] - m2[2]);
}
template <typename T>
inline tmat3x2<T> operator*
(
tmat3x2<T> const & m,
typename tmat3x2<T>::value_type const & s
)
{
return tmat3x2<T>(
m[0] * s,
m[1] * s,
m[2] * s);
}
template <typename T>
inline tmat3x2<T> operator*
(
typename tmat3x2<T>::value_type const & s,
tmat3x2<T> const & m
)
{
return tmat3x2<T>(
m[0] * s,
m[1] * s,
m[2] * s);
}
template <typename T>
inline typename tmat3x2<T>::col_type operator*
(
tmat3x2<T> const & m,
typename tmat3x2<T>::row_type const & v)
{
return typename tmat3x2<T>::col_type(
m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z,
m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z);
}
template <typename T>
inline typename tmat3x2<T>::row_type operator*
(
typename tmat3x2<T>::col_type const & v,
tmat3x2<T> const & m)
{
return typename tmat3x2<T>::row_type(
v.x * m[0][0] + v.y * m[0][1],
v.x * m[1][0] + v.y * m[1][1],
v.x * m[2][0] + v.y * m[2][1]);
}
template <typename T>
inline tmat2x2<T> operator*
(
tmat3x2<T> const & m1,
tmat2x3<T> const & m2
)
{
const T SrcA00 = m1[0][0];
const T SrcA01 = m1[0][1];
const T SrcA10 = m1[1][0];
const T SrcA11 = m1[1][1];
const T SrcA20 = m1[2][0];
const T SrcA21 = m1[2][1];
const T SrcB00 = m2[0][0];
const T SrcB01 = m2[0][1];
const T SrcB02 = m2[0][2];
const T SrcB10 = m2[1][0];
const T SrcB11 = m2[1][1];
const T SrcB12 = m2[1][2];
tmat2x2<T> Result(tmat2x2<T>::null);
Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02;
Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02;
Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12;
Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11 + SrcA21 * SrcB12;
return Result;
}
template <typename T>
inline tmat3x2<T> operator/
(
tmat3x2<T> const & m,
typename tmat3x2<T>::value_type const & s
)
{
return tmat3x2<T>(
m[0] / s,
m[1] / s,
m[2] / s);
}
template <typename T>
inline tmat3x2<T> operator/
(
typename tmat3x2<T>::value_type const & s,
tmat3x2<T> const & m
)
{
return tmat3x2<T>(
s / m[0],
s / m[1],
s / m[2]);
}
// Unary constant operators
template <typename T>
inline tmat3x2<T> const operator-
(
tmat3x2<T> const & m
)
{
return tmat3x2<T>(
-m[0],
-m[1],
-m[2]);
}
template <typename T>
inline tmat3x2<T> const operator++
(
tmat3x2<T> const & m,
int
)
{
typename tmat3x2<T>::value_type One(1);
return tmat3x2<T>(
m[0] + One,
m[1] + One,
m[2] + One);
}
template <typename T>
inline tmat3x2<T> const operator--
(
tmat3x2<T> const & m,
int
)
{
typename tmat3x2<T>::value_type One(1);
return tmat3x2<T>(
m[0] - One,
m[1] - One,
m[2] - One);
}
//////////////////////////////////////
// Boolean operators
template <typename T>
inline bool operator==
(
tmat3x2<T> const & m1,
tmat3x2<T> const & m2
)
{
return (m1[0] == m2[0]) && (m1[1] == m2[1]) && (m1[2] == m2[2]);
}
template <typename T>
inline bool operator!=
(
tmat3x2<T> const & m1,
tmat3x2<T> const & m2
)
{
return (m1[0] != m2[0]) || (m1[1] != m2[1]) || (m1[2] != m2[2]);
}
} //namespace detail
} //namespace glm
| [
"sean.oconnell@amd.com"
] | sean.oconnell@amd.com |
d0d8f0239e6713d7d2a58ebbb5c8a5785776686b | 48532034bc26775520e60ad3489df537f96ad8ea | /7-24/Square Ice.cpp | 1892d82921ce645060408b7ffd801c0b8e1c5dfa | [] | no_license | OUC-MYM/Summer-training | aeffac0cbf86ab433bcf2d7cc2f3798b2d1bb783 | 5ec46b5879a1acbd9b20e616c90f586a6c234695 | refs/heads/master | 2021-01-20T06:55:19.685395 | 2015-08-22T15:54:25 | 2015-08-22T15:54:25 | 39,383,049 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,651 | cpp | #include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
char map[50][50];
int mapnum[50][50];
int m;
void add(int i,int j)
{
if(i-2>0&&map[i-2][j]!='H')
{
map[i-1][j]='|';
map[i-2][j]='H';
}
else
{
map[i+1][j]='|';
map[i+2][j]='H';
}
if(j-2>0&&map[i][j-2]!='H')
{
map[i][j-1]='-';
map[i][j-2]='H';
}
else
{
map[i][j+1]='-';
map[i][j+2]='H';
}
}
int main()
{
int N=0;
while(cin >> m && m)
{
N++;
memset(map,' ',sizeof(map));
for(int i=1; i<4*m-1; i+=4)
for(int j=3; j<4*m+3; j+=4)
{
map[i][j]='O';
cin >> mapnum[i][j];
if(mapnum[i][j]==1)
{
map[i][j-1]=map[i][j+1]='-';
map[i][j-2]=map[i][j+2]='H';
}
else if(mapnum[i][j]==-1)
{
map[i-1][j]=map[i+1][j]='|';
map[i-2][j]=map[i+2][j]='H';
}
else add(i,j);
}
for(int i=0; i<4*m+3; i++)
map[0][i]='*';
for(int i=0; i<4*m+3; i++)
map[4*m-2][i]='*';
for(int i=0; i<4*m-1; i++)
map[i][0]='*';
for(int i=0; i<4*m-1; i++)
map[i][4*m+2]='*';
cout << "Case " << N << ":" << endl << endl;
for(int i=0; i<4*m-1; i++)
{
for(int j=0; j<4*m+3; j++)
cout << map[i][j];
cout << endl;
}
cout << endl;
}
return 0;
}
| [
"570109323@qq.com"
] | 570109323@qq.com |
2d2063c4433c67795d9c32a8470d2b9851c5f34f | 777a75e6ed0934c193aece9de4421f8d8db01aac | /src/Providers/UNIXProviders/ProcessStatistics/UNIX_ProcessStatistics_HPUX.hpp | 76051a6070a6866359e4d013722004adead75489 | [
"MIT"
] | permissive | brunolauze/openpegasus-providers-old | 20fc13958016e35dc4d87f93d1999db0eae9010a | b00f1aad575bae144b8538bf57ba5fd5582a4ec7 | refs/heads/master | 2021-01-01T20:05:44.559362 | 2014-04-30T17:50:06 | 2014-04-30T17:50:06 | 19,132,738 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,920 | hpp | //%LICENSE////////////////////////////////////////////////////////////////
//
// Licensed to The Open Group (TOG) under one or more contributor license
// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
// this work for additional information regarding copyright ownership.
// Each contributor licenses this file to you under the OpenPegasus Open
// Source License; you may not use this file except in compliance with the
// License.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////
//
//%/////////////////////////////////////////////////////////////////////////
UNIX_ProcessStatistics::UNIX_ProcessStatistics(void)
{
}
UNIX_ProcessStatistics::~UNIX_ProcessStatistics(void)
{
}
Boolean UNIX_ProcessStatistics::getStats(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_STATS, getStats());
return true;
}
CIMInstance UNIX_ProcessStatistics::getStats() const
{
return CIMInstance(CIMName("CIM_ManagedElement"));
}
Boolean UNIX_ProcessStatistics::getElement(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_ELEMENT, getElement());
return true;
}
CIMInstance UNIX_ProcessStatistics::getElement() const
{
return CIMInstance(CIMName("CIM_ManagedElement"));
}
Boolean UNIX_ProcessStatistics::initialize()
{
return false;
}
Boolean UNIX_ProcessStatistics::load(int &pIndex)
{
return false;
}
Boolean UNIX_ProcessStatistics::finalize()
{
return false;
}
Boolean UNIX_ProcessStatistics::find(Array<CIMKeyBinding> &kbArray)
{
CIMKeyBinding kb;
String statsKey;
String elementKey;
for(Uint32 i = 0; i < kbArray.size(); i++)
{
kb = kbArray[i];
CIMName keyName = kb.getName();
if (keyName.equal(PROPERTY_STATS)) statsKey = kb.getValue();
else if (keyName.equal(PROPERTY_ELEMENT)) elementKey = kb.getValue();
}
/* EXecute find with extracted keys */
return false;
}
| [
"brunolauze@msn.com"
] | brunolauze@msn.com |
657189a745e360b50a4002ddaeab30ace05b822c | a55372600d9da8c8b857bb2b8257c0b887276019 | /core/olap/perftests/queue-perf/queue-perf.cpp | 77805bfedfd5b454493e1077b987de8105a57313 | [] | no_license | epfl-dias/proteus | 75ae8036f19b9a41f295903233f08beecd28fa86 | 575c0bcfc5d280d2d1c98c0a907302c5ad9d5b22 | refs/heads/main | 2023-09-03T16:23:07.999208 | 2023-08-18T22:31:29 | 2023-08-19T00:19:09 | 158,891,236 | 8 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 18,691 | cpp | /*
Proteus -- High-performance query processing on heterogeneous hardware.
Copyright (c) 2021
Data Intensive Applications and Systems Laboratory (DIAS)
École Polytechnique Fédérale de Lausanne
All Rights Reserved.
Permission to use, copy, modify and distribute this software and
its documentation is hereby granted, provided that both the
copyright notice and this permission notice appear in all copies of
the software, derivative works or modified versions, and any
portions thereof, and that both notices appear in supporting
documentation.
This code is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS
DISCLAIM ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER
RESULTING FROM THE USE OF THIS SOFTWARE.
*/
#include <benchmark/benchmark.h>
#include <platform/util/glog.hpp>
#include "lib/util/datastructures/threadsafe-set.hpp"
class QueueBench : public ::benchmark::Fixture {};
///**
// *
// * @tparam N slots in the ring buffer. Prefer powers of two.
// */
// template <typename T, size_t N, typename index_t = uint32_t>
// class UnsafeRingBuffer {
// class alignas(64) Entry {
// public:
// /**
// * odd value => free
// * even value => filled
// */
// std::atomic<index_t> marker;
// T data;
// };
//
// // std::atomic<index_t> head{0}; // only odd values
// index_t head{0}; // only odd values
// std::atomic<index_t> tail{0}; // only odd values
// std::vector<Entry> slots;
//
// public:
// UnsafeRingBuffer() : slots(N) {
// for (size_t i = 0; i < N; ++i) {
// slots[i].marker = index_t(-2);
// }
// }
//
// template <typename... Args>
// void emplace(Args &&...args) noexcept {
// // Assumes single producer
// index_t h = (head += 2) - 2;
// while (slots[h % N].marker & 1)
// ;
// slots[h % N].data = T{std::forward<Args>(args)...};
// slots[h % N].marker = h + 1;
// }
//
// T pop() noexcept {
// index_t t = (tail += 2) - 2;
// while (slots[t % N].marker != t + 1)
// ;
// T tmp = std::move(slots[t % N].data);
// slots[t % N].marker = t;
// return tmp;
// }
//
// bool empty_unsafe() const { return head == tail; }
// size_t size_unsafe() const { return (head - tail) / 2; }
//};
// template <typename T>
// class threadsafe_set { /* SPMC */
// private:
// std::stack<T> data;
// std::mutex m;
// std::condition_variable cv;
//
// public:
// [[nodiscard]] bool empty_unsafe() const noexcept { return data.empty(); }
// [[nodiscard]] auto size_unsafe() const noexcept { return data.size(); }
//
// [[nodiscard]] bool empty() noexcept {
// std::lock_guard<std::mutex> lock{m};
// return empty_unsafe();
// }
//
// template <typename... Args>
// void emplace(Args &&...args) noexcept {
// // FIXME: seems like emplace starves pop!
// event_range<log_op::EXCHANGE_CONSUMER_WAIT_FOR_FREE_END> er(this);
// {
// std::lock_guard<std::mutex> lock{m};
// data.push(std::forward<Args>(args)...);
// }
// cv.notify_one();
// }
//
// T pop() noexcept {
// std::unique_lock<std::mutex> lock{m};
// while (empty_unsafe()) {
// event_range<log_op::EXCHANGE_CONSUMER_WAIT_FOR_FREE_END> er(this);
// cv.wait(lock, // std::chrono::milliseconds{1},
// [this]() { return !empty_unsafe(); });
// LOG_IF_EVERY_N(INFO, empty_unsafe(), 1000)
// << "woke up to check, but is empty";
// }
// T v = std::move(data.top());
// data.pop();
// return std::move(v);
// }
// };
//
// template <typename T>
// class threadsafe_set { /* SPMC */
// private:
// UnsafeRingBuffer<T, 1024, uint32_t> buffer;
//
// public:
// [[nodiscard]] bool empty_unsafe() const noexcept {
// return buffer.empty_unsafe();
// }
// [[nodiscard]] auto size_unsafe() const noexcept {
// return buffer.size_unsafe();
// }
//
// template <typename... Args>
// void emplace(Args &&...args) noexcept {
// // FIXME: seems like emplace starves pop!
// // event_range<log_op::EXCHANGE_CONSUMER_WAIT_FOR_FREE_END> er(this);
// buffer.emplace(std::forward<Args>(args)...);
// }
//
// T pop() noexcept {
// // event_range<log_op::EXCHANGE_CONSUMER_WAIT_FOR_FREE_END> er(this);
// return buffer.pop();
// }
//};
//
// BENCHMARK_F(QueueBench, CreateAndInsertToQueue)(benchmark::State &state) {
// for (auto _ : state) {
// threadsafe_set<int> q;
// int val = 5;
// q.emplace(val);
// }
//}
#include <barrier>
#include <olap/common/olap-common.hpp>
#include <stack>
#include <thread>
//
// template <typename T>
// class threadsafe_set2 { /* SPMC */
// private:
// std::stack<T> data;
// std::mutex m;
// std::condition_variable cv;
//
// public:
// [[nodiscard]] bool empty_unsafe() const noexcept { return data.empty(); }
// [[nodiscard]] auto size_unsafe() const noexcept { return data.size(); }
//
// [[nodiscard]] bool empty() noexcept {
// std::lock_guard<std::mutex> lock{m};
// return empty_unsafe();
// }
//
// template <typename... Args>
// void emplace(Args &&...args) noexcept {
// // FIXME: seems like emplace starves pop!
// // event_range<log_op::EXCHANGE_CONSUMER_WAIT_FOR_FREE_END> er(this);
// {
// std::lock_guard<std::mutex> lock{m};
// data.push(std::forward<Args>(args)...);
// }
// cv.notify_one();
// }
//
// T pop() noexcept {
// std::unique_lock<std::mutex> lock{m};
// while (empty_unsafe()) {
// // event_range<log_op::EXCHANGE_CONSUMER_WAIT_FOR_FREE_END>
// // er(this);
// cv.wait(lock, // std::chrono::milliseconds{1},
// [this]() { return !empty_unsafe(); });
// LOG_IF_EVERY_N(INFO, empty_unsafe(), 1000)
// << "woke up to check, but is empty";
// }
// T v = std::move(data.top());
// data.pop();
// return std::move(v);
// }
//};
void exec(AsyncQueueMPMC<size_t> &origin, AsyncQueueMPMC<size_t> *qs,
size_t c) {
set_exec_location_on_scope e(topology::getInstance().getCores()[c]);
while (true) {
size_t x;
if (!origin.pop(x)) break;
qs[x & 1].emplace(x);
}
qs[0].close();
qs[1].close();
}
size_t exec2(AsyncQueueMPMC<size_t> &origin, size_t c) {
set_exec_location_on_scope e(topology::getInstance().getCores()[c]);
size_t cnt = 0;
while (true) {
size_t x;
if (!origin.pop(x)) break;
cnt += 1;
}
return cnt;
}
template <typename T>
void BM_MultiThreaded_core(benchmark::State &state) {
// set_exec_location_on_scope
// eg(topology::getInstance().getCpuNumaNodes()[0]);
set_exec_location_on_scope eg(topology::getInstance().getCores()[14]);
auto origin_ptr = (AsyncQueueMPMC<size_t> *)MemoryManager::mallocPinned(
sizeof(AsyncQueueMPMC<size_t>));
auto firstGroup_ptr = (AsyncQueueMPMC<size_t> *)MemoryManager::mallocPinned(
sizeof(AsyncQueueMPMC<size_t>) * 2);
auto secondGroup_ptr = (AsyncQueueMPMC<size_t> *)MemoryManager::mallocPinned(
sizeof(AsyncQueueMPMC<size_t>) * 2);
new (origin_ptr) AsyncQueueMPMC<size_t>(0);
new (firstGroup_ptr) AsyncQueueMPMC<size_t>(0);
new (firstGroup_ptr + 1) AsyncQueueMPMC<size_t>(0);
new (secondGroup_ptr) AsyncQueueMPMC<size_t>(0);
new (secondGroup_ptr + 1) AsyncQueueMPMC<size_t>(0);
size_t totalcnt = 0;
size_t vecs[4]{0, 0, 0, 0};
for (auto _ : state) {
std::thread t1{[&]() { exec(*origin_ptr, firstGroup_ptr, 1); }};
std::thread t2{[&]() { exec(*origin_ptr, secondGroup_ptr, 3); }};
std::thread t3{[&]() { vecs[0] += exec2(firstGroup_ptr[0], 5); }};
std::thread t4{[&]() { vecs[1] += exec2(firstGroup_ptr[1], 7); }};
std::thread t5{[&]() { vecs[2] += exec2(secondGroup_ptr[0], 9); }};
std::thread t6{[&]() { vecs[3] += exec2(secondGroup_ptr[1], 11); }};
size_t maxitems = 1024 * 1024;
totalcnt += maxitems;
for (size_t i = 0; i < maxitems; ++i) {
while (origin_ptr->size_unsafe() < 8 * 1024) std::this_thread::yield();
origin_ptr->emplace(i);
}
origin_ptr->close();
t1.join();
t2.join();
t3.join();
t4.join();
t5.join();
t6.join();
origin_ptr->reset();
firstGroup_ptr[0].reset();
firstGroup_ptr[1].reset();
secondGroup_ptr[0].reset();
secondGroup_ptr[1].reset();
}
LOG(INFO) << std::setprecision(2) << std::fixed
<< std::abs(vecs[0] * 1.0 - vecs[1]) / (vecs[0] + vecs[1]) << " "
<< std::abs(vecs[2] * 1.0 - vecs[3]) / (vecs[2] + vecs[3]);
// LOG_IF(ERROR, vecs[0] + vecs[1] + vecs[2] + vecs[3] != totalcnt)
// << "broken..." << vecs[0] + vecs[1] + vecs[2] + vecs[3] << " vs "
// << totalcnt;
state.SetItemsProcessed(totalcnt);
}
void exec_2(AsyncQueueMPMC<size_t> &origin, AsyncQueueMPMC<size_t> *qs,
size_t c) {
set_exec_location_on_scope e(
topology::getInstance().getCores()[c].getLocalCPUNumaNode());
while (true) {
size_t x;
if (!origin.pop(x)) break;
qs[x & 1].emplace(x);
}
qs[0].close();
qs[1].close();
}
size_t exec2_2(AsyncQueueMPMC<size_t> &origin, size_t c) {
set_exec_location_on_scope e(
topology::getInstance().getCores()[c].getLocalCPUNumaNode());
size_t cnt = 0;
while (true) {
size_t x;
if (!origin.pop(x)) break;
cnt += 1;
}
return cnt;
}
template <typename T>
void BM_MultiThreaded_socket(benchmark::State &state) {
// set_exec_location_on_scope
// eg(topology::getInstance().getCpuNumaNodes()[1]);
set_exec_location_on_scope eg(
topology::getInstance().getCores()[14].getLocalCPUNumaNode());
auto origin_ptr = (AsyncQueueMPMC<size_t> *)MemoryManager::mallocPinned(
sizeof(AsyncQueueMPMC<size_t>));
auto firstGroup_ptr = (AsyncQueueMPMC<size_t> *)MemoryManager::mallocPinned(
sizeof(AsyncQueueMPMC<size_t>) * 2);
auto secondGroup_ptr = (AsyncQueueMPMC<size_t> *)MemoryManager::mallocPinned(
sizeof(AsyncQueueMPMC<size_t>) * 2);
new (origin_ptr) AsyncQueueMPMC<size_t>(0);
new (firstGroup_ptr) AsyncQueueMPMC<size_t>(0);
new (firstGroup_ptr + 1) AsyncQueueMPMC<size_t>(0);
new (secondGroup_ptr) AsyncQueueMPMC<size_t>(0);
new (secondGroup_ptr + 1) AsyncQueueMPMC<size_t>(0);
size_t totalcnt = 0;
size_t vecs[4]{0, 0, 0, 0};
for (auto _ : state) {
std::thread t1{[&]() { exec_2(*origin_ptr, firstGroup_ptr, 1); }};
std::thread t2{[&]() { exec_2(*origin_ptr, secondGroup_ptr, 3); }};
std::thread t3{[&]() { vecs[0] = exec2_2(firstGroup_ptr[0], 5); }};
std::thread t4{[&]() { vecs[1] = exec2_2(firstGroup_ptr[1], 7); }};
std::thread t5{[&]() { vecs[2] = exec2_2(secondGroup_ptr[0], 9); }};
std::thread t6{[&]() { vecs[3] = exec2_2(secondGroup_ptr[1], 11); }};
size_t maxitems = 1024 * 1024;
totalcnt = maxitems;
for (size_t i = 0; i < maxitems; ++i) {
while (origin_ptr->size_unsafe() < 64 * 1024) std::this_thread::yield();
origin_ptr->emplace(i);
}
origin_ptr->close();
t1.join();
t2.join();
t3.join();
t4.join();
t5.join();
t6.join();
origin_ptr->reset();
firstGroup_ptr[0].reset();
firstGroup_ptr[1].reset();
secondGroup_ptr[0].reset();
secondGroup_ptr[1].reset();
}
LOG(INFO) << std::setprecision(2) << std::fixed
<< std::abs(vecs[0] * 1.0 - vecs[1]) / (vecs[0] + vecs[1]) << " "
<< std::abs(vecs[2] * 1.0 - vecs[3]) / (vecs[2] + vecs[3]);
// LOG_IF(ERROR, vecs[0] + vecs[1] + vecs[2] + vecs[3] != totalcnt)
// << "broken..." << vecs[0] + vecs[1] + vecs[2] + vecs[3] << " vs "
// << totalcnt;
state.SetItemsProcessed(totalcnt);
}
template <typename T>
void BM_MultiThreaded_sym(benchmark::State &state) {
size_t totalcnt = 0;
size_t vecs[4]{0, 0, 0, 0};
for (auto _ : state) {
size_t maxitems = 1024 * 1024;
for (size_t i = 0; i < 4; ++i) vecs[i] = 0;
totalcnt = maxitems;
for (size_t i = 0; i < maxitems; ++i) {
auto x = (rand() & 1);
++vecs[x * 2 + (i & 1)];
}
}
auto A = vecs[0] + vecs[1];
auto B = vecs[2] + vecs[3];
LOG(INFO) << std::setprecision(2) << std::fixed
<< std::abs(vecs[0] * 1.0 - vecs[1]) / A << " "
<< std::abs(vecs[2] * 1.0 - vecs[3]) / B << " "
<< std::abs(A * 1.0 - B) / (A + B);
state.SetItemsProcessed(totalcnt);
}
void atomiccnt_fighter(std::atomic<size_t> &counter, size_t limit,
size_t *vecs) {
size_t localvec[2]{0, 0};
while (counter > limit * 2)
;
do {
auto tmp = counter++;
if (tmp > limit) break;
++localvec[tmp & 1];
} while (true);
vecs[0] = localvec[0];
vecs[1] = localvec[1];
}
void atomiccnt_fighter_core(std::atomic<size_t> &counter, size_t limit,
size_t *vecs, size_t core_id) {
set_exec_location_on_scope eg(topology::getInstance().getCores()[core_id]);
size_t localvec[2]{0, 0};
while (counter > limit * 2)
;
do {
auto tmp = counter++;
if (tmp > limit) break;
++localvec[tmp & 1];
} while (true);
vecs[0] = localvec[0];
vecs[1] = localvec[1];
}
template <typename T>
void BM_MultiThreaded_sym_atomiccntfight_core(benchmark::State &state) {
size_t totalcnt = 0;
size_t vecs[4]{0, 0, 0, 0};
std::atomic<size_t> cnt;
for (auto _ : state) {
size_t maxitems = 1024 * 1024;
cnt = 4 * maxitems;
std::thread t1{
[&]() { atomiccnt_fighter_core(cnt, maxitems, vecs + 0, 3); }};
std::thread t2{
[&]() { atomiccnt_fighter_core(cnt, maxitems, vecs + 2, 5); }};
std::this_thread::sleep_for(std::chrono::milliseconds{10});
cnt = 0;
t1.join();
t2.join();
}
auto A = vecs[0] + vecs[1];
auto B = vecs[2] + vecs[3];
LOG(INFO) << std::setprecision(2) << std::fixed
<< std::abs(vecs[0] * 1.0 - vecs[1]) / A << " "
<< std::abs(vecs[2] * 1.0 - vecs[3]) / B << " "
<< std::abs(A * 1.0 - B) / (A + B);
// LOG_IF(ERROR, vecs[0] + vecs[1] + vecs[2] + vecs[3] != totalcnt)
// << "broken..." << vecs[0] + vecs[1] + vecs[2] + vecs[3] << " vs "
// << totalcnt;
state.SetItemsProcessed(totalcnt);
}
template <typename T>
void BM_MultiThreaded_sym_atomiccntfight(benchmark::State &state) {
size_t totalcnt = 0;
size_t vecs[4]{0, 0, 0, 0};
std::atomic<size_t> cnt;
for (auto _ : state) {
size_t maxitems = 1024 * 1024;
cnt = 4 * maxitems;
std::thread t1{[&]() { atomiccnt_fighter(cnt, maxitems, vecs + 0); }};
std::thread t2{[&]() { atomiccnt_fighter(cnt, maxitems, vecs + 2); }};
std::this_thread::sleep_for(std::chrono::milliseconds{10});
cnt = 0;
t1.join();
t2.join();
}
auto A = vecs[0] + vecs[1];
auto B = vecs[2] + vecs[3];
LOG(INFO) << std::setprecision(2) << std::fixed
<< std::abs(vecs[0] * 1.0 - vecs[1]) / A << " "
<< std::abs(vecs[2] * 1.0 - vecs[3]) / B << " "
<< std::abs(A * 1.0 - B) / (A + B);
state.SetItemsProcessed(totalcnt);
}
void atomiccnt_fighter_socket(std::atomic<size_t> &counter, size_t limit,
size_t *vecs, size_t core_id) {
set_exec_location_on_scope eg(
topology::getInstance().getCores()[core_id].getLocalCPUNumaNode());
size_t localvec[2]{0, 0};
while (counter > limit * 2)
;
do {
auto tmp = counter++;
if (tmp > limit) break;
++localvec[tmp & 1];
} while (true);
vecs[0] = localvec[0];
vecs[1] = localvec[1];
}
template <typename T>
void BM_MultiThreaded_sym_atomiccntfight_socket(benchmark::State &state) {
size_t totalcnt = 0;
size_t vecs[4]{0, 0, 0, 0};
std::atomic<size_t> cnt;
for (auto _ : state) {
size_t maxitems = 1024 * 1024;
cnt = 4 * maxitems;
std::thread t1{
[&]() { atomiccnt_fighter_socket(cnt, maxitems, vecs + 0, 3); }};
std::thread t2{
[&]() { atomiccnt_fighter_socket(cnt, maxitems, vecs + 2, 5); }};
std::this_thread::sleep_for(std::chrono::milliseconds{10});
cnt = 0;
t1.join();
t2.join();
}
auto A = vecs[0] + vecs[1];
auto B = vecs[2] + vecs[3];
LOG(INFO) << std::setprecision(2) << std::fixed
<< std::abs(vecs[0] * 1.0 - vecs[1]) / A << " "
<< std::abs(vecs[2] * 1.0 - vecs[3]) / B << " "
<< std::abs(A * 1.0 - B) / (A + B);
// LOG_IF(ERROR, vecs[0] + vecs[1] + vecs[2] + vecs[3] != totalcnt)
// << "broken..." << vecs[0] + vecs[1] + vecs[2] + vecs[3] << " vs "
// << totalcnt;
state.SetItemsProcessed(totalcnt);
}
BENCHMARK_TEMPLATE(BM_MultiThreaded_core, threadsafe_set<size_t>)
// ->RangeMultiplier(1 << 10)
// ->Range(1 << 10, 1 << 20)
->Unit(benchmark::kMillisecond)
// ->MinTime(10 /* seconds */)
->UseRealTime();
BENCHMARK_TEMPLATE(BM_MultiThreaded_socket, threadsafe_set<size_t>)
// ->RangeMultiplier(1 << 10)
// ->Range(1 << 10, 1 << 20)
->Unit(benchmark::kMillisecond)
// ->MinTime(10 /* seconds */)
->UseRealTime();
BENCHMARK_TEMPLATE(BM_MultiThreaded_sym, threadsafe_set<size_t>)
// ->RangeMultiplier(1 << 10)
// ->Range(1 << 10, 1 << 20)
->Unit(benchmark::kMillisecond)
// ->MinTime(10 /* seconds */)
->UseRealTime();
BENCHMARK_TEMPLATE(BM_MultiThreaded_sym_atomiccntfight, threadsafe_set<size_t>)
// ->RangeMultiplier(1 << 10)
// ->Range(1 << 10, 1 << 20)
->Unit(benchmark::kMillisecond)
// ->MinTime(10 /* seconds */)
->UseRealTime();
BENCHMARK_TEMPLATE(BM_MultiThreaded_sym_atomiccntfight_core,
threadsafe_set<size_t>)
// ->RangeMultiplier(1 << 10)
// ->Range(1 << 10, 1 << 20)
->Unit(benchmark::kMillisecond)
// ->MinTime(10 /* seconds */)
->UseRealTime();
BENCHMARK_TEMPLATE(BM_MultiThreaded_sym_atomiccntfight_socket,
threadsafe_set<size_t>)
// ->RangeMultiplier(1 << 10)
// ->Range(1 << 10, 1 << 20)
->Unit(benchmark::kMillisecond)
// ->MinTime(10 /* seconds */)
->UseRealTime();
// BENCHMARK_TEMPLATE(BM_MultiThreaded, threadsafe_set2<size_t>)
// // ->RangeMultiplier(1 << 10)
// ->Range(1 << 10, 1 << 20)
// ->Threads(benchmark::CPUInfo::Get().num_cpus / 2)
// ->Threads(benchmark::CPUInfo::Get().num_cpus)
// ->Unit(benchmark::kMillisecond)
//// ->MinTime(10 /* seconds */)
// ->UseRealTime();
//
// int main(int argc, char **argv) {
// auto ctx = proteus::olap(0.02, 0.001);
// benchmark::Initialize(&argc, argv);
// benchmark::RunSpecifiedBenchmarks();
//}
| [
"periklis93@yahoo.gr"
] | periklis93@yahoo.gr |
75987d8c4dca0ad1dc2b68d7354cee098a17ff91 | 55b8fe6bb73f62d1bba6ca42c8fdd26adffb5de4 | /harry_loop _while.cpp | 7449ad3992b38e7b2b3d5d9af16bfd636d402335 | [] | no_license | ROS22202-git/roshan-c-code | 775b5f79a999176f50ab3699e74bb96c0a6b17dc | bbe1d8443d6e204b79bf6eee33cf1312ec4daf97 | refs/heads/master | 2023-08-22T12:21:42.272151 | 2021-10-07T04:06:46 | 2021-10-07T04:06:46 | 414,455,509 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 165 | cpp | #include<stdio.h>
int main()
{
int a,b=6;
a=5;
while((a>=0 && a<=20) )
{
printf("the value of a=%d\n",a);
a=b++;
}
printf("Hello world");
return 0;
}
| [
"91904758+ROS22202-git@users.noreply.github.com"
] | 91904758+ROS22202-git@users.noreply.github.com |
08eaf7ac1f8caff10381bc2ab7ecd26f45b52326 | 3fe692c3ebf0b16c0a6ae9d8633799abc93bd3bb | /Practices/BZOJ/BZ4487.cpp | a03458e91556d639948994ab7998abc0121be8f0 | [] | no_license | kaloronahuang/KaloronaCodebase | f9d297461446e752bdab09ede36584aacd0b3aeb | 4fa071d720e06100f9b577e87a435765ea89f838 | refs/heads/master | 2023-06-01T04:24:11.403154 | 2023-05-23T00:38:07 | 2023-05-23T00:38:07 | 155,797,801 | 14 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,109 | cpp | // BZ4487.cpp
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int MAX_N = 440, mod = 1000000007;
ll n, m, c, fac[MAX_N], fac_inv[MAX_N];
ll quick_pow(ll bas, ll tim)
{
ll ans = 1;
bas %= mod;
while (tim)
{
if (tim & 1)
ans = ans * bas % mod;
bas = bas * bas % mod;
tim >>= 1;
}
return ans;
}
ll C(ll a, ll b) { return fac[a] * fac_inv[b] % mod * fac_inv[a - b] % mod; }
int main()
{
fac[0] = fac_inv[0] = 1;
for (int i = 1; i < MAX_N; i++)
fac[i] = fac[i - 1] * i % mod;
fac_inv[MAX_N - 1] = quick_pow(fac[MAX_N - 1], mod - 2);
for (int i = MAX_N - 2; i >= 1; i--)
fac_inv[i] = fac_inv[i + 1] * (i + 1) % mod;
scanf("%lld%lld%lld", &n, &m, &c);
ll ans = 0;
for (int i = 0; i <= n; i++)
for (int j = 0; j <= m; j++)
for (int k = 0; k <= c; k++)
(ans += 1LL * (((i + j + k) & 1) ? -1 : 1) * C(n, i) % mod * C(m, j) % mod * C(c, k) % mod * quick_pow(c - k + 1, (n - i) * (m - j)) % mod + mod) %= mod;
printf("%lld", ans);
return 0;
} | [
"kaloronahuang@gmail.com"
] | kaloronahuang@gmail.com |
27a5716d7f6c06057f8f9723d6fd51af7f725523 | 9058939a9c2c513fbe6c67c225ddf03c68198d08 | /POJ/3100.cpp | 9018552f162d0dda0287a51319931c8991f5c6ef | [] | no_license | comzyh/ICPCcode | 7335123fcdd6607ef1d2ef289392f692294a28bb | 99acc36af5bd1e925ec0205a52f369f3c514ef08 | refs/heads/master | 2020-05-18T15:49:22.592994 | 2018-11-19T12:03:07 | 2018-11-19T12:03:07 | 12,371,932 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 463 | cpp | #include <cstdio>
#include <cstring>
int pow(int a,int k)
{
int ans=a;
while (--k)
ans*=a;
return ans;
}
inline int abs(int n)
{
if (n<0)
return -n;
else
return n;
}
int A,B,N,dis;
int main()
{
int i,tans;
while (scanf("%d%d",&B,&N),B>0 && N>0)
{
dis=0x7fffffff;
i=0;
while(1)
{
tans=pow(++i,N);
//printf("tans=%d\n",tans);
if (abs(tans-B)<dis)
dis=abs(tans-B);
else
{
printf("%d\n",i-1);
break;
}
}
}
}
| [
"comzyh@gmail.com"
] | comzyh@gmail.com |
547436aea416d89557fedbc91a78ab33846433dc | 22069dac0dc17447536bad91a158c96165dc9889 | /EmbSysLib/Src/MCU/STM32F7xx/Src/RTC_MCU.cpp | 2c6fdd4410f52a5877b560654df90022c92e0df4 | [
"MIT"
] | permissive | Gagonjh/Embedded-C-Tic-Tac-Toe | 6a8168e938e24ccd8ccd83d2d3763b4a97334348 | 72f0cf1d21877faf633988ff4df680f0ff9284b9 | refs/heads/master | 2023-06-12T02:56:19.249830 | 2021-07-09T18:44:27 | 2021-07-09T18:44:27 | 375,101,112 | 0 | 0 | null | 2021-07-06T15:24:09 | 2021-06-08T18:02:43 | C | UTF-8 | C++ | false | false | 4,350 | cpp | //*******************************************************************
/*!
\file RTC_MCU.cpp
\author Thomas Breuer (Bonn-Rhein-Sieg University of Applied Sciences)
\date 23.03.2016
This file is released under the MIT License.
*/
//*******************************************************************
#include "RTC_MCU.h"
//*******************************************************************
//
// cHwRTC_0
//
//*******************************************************************
//-------------------------------------------------------------------
cHwRTC_0::cHwRTC_0( RTC_ClockConfig_t config )
{
PWR->CR1 |= PWR_CR1_DBP;
//TODO: flag an Konstruktor useExternalOszillator
if( config == LSE )
{
RCC->BDCR &= ~(0x03<<8); // reset RTCSEL
RCC->BDCR |= ( 1<<15) // RTC enable
|(0x01<< 8) // LSE select
|(1<<0); // LSEON
}
else if(config == LSI)
{
if( !(RCC->BDCR & (3<<8)) ) // nicht HSE
{
RCC->BDCR |= (0x01<<16); // BDRST
RCC->BDCR &= ~(0x01<<16); // BDRST
}
RCC->BDCR &= ~(0x03<<8); // reset RTCSEL
RCC->BDCR |= ( 1<<15) // RTC enable
|(0x03<< 8) // LSE select
|(1<<0); // LSEON
}
RCC->CFGR &= ~(0x1F<<16);
RCC->CFGR |= ( (_HSE_CLK/1000)<<16); // HSE=8MHz => 1MHz
// unlock write protection:
RTC->WPR = 0xCA;
RTC->WPR = 0x53;
// initialization
RTC->ISR |= RTC_ISR_INIT;
while( !(RTC->ISR & RTC_ISR_INITF) );
// ???
if( config == LSE )
{
//RTC->PRER = ((MTYPE)(20000-1)<< 0); // sychronous
//RTC->PRER |= ((MTYPE)( 50-1)<<16); // asynchronous
}
else if( config == LSI )
{
RTC->PRER = ((MTYPE)(8000-1)<< 0); // sychronous
RTC->PRER |= ((MTYPE)( 125-1)<<16); // asynchronous
}
// ???
// exit initialization
RTC->ISR &= ~RTC_ISR_INIT;
/*
PWR->CR |= PWR_CR_DBP;
RCC->BDCR &= ~(0x03<<8); // reset RTCSEL
RCC->BDCR |= ( 1<<15) // RTC enable
|(0x03<< 8); // HSE select
RCC->CFGR &= ~(0x1F<<16);
RCC->CFGR |= ( (_HSE_CLK/1000)<<16); // HSE=8MHz => 1MHz
// unlock write protection:
RTC->WPR = 0xCA;
RTC->WPR = 0x53;
// initialization
RTC->ISR |= RTC_ISR_INIT;
while( !(RTC->ISR & RTC_ISR_INITF) );
RTC->PRER = ((MTYPE)(20000-1)<< 0); // sychronous
RTC->PRER |= ((MTYPE)( 50-1)<<16); // asynchronous
// exit initialization
RTC->ISR &= ~RTC_ISR_INIT;
*/
}
//-------------------------------------------------------------------
void cHwRTC_0::set( const cHwRTC::Properties &clock )
{
BYTE dow;
// unlock write protection:
RTC->WPR = 0xCA;
RTC->WPR = 0x53;
// initialization
RTC->ISR |= RTC_ISR_INIT;
while( !(RTC->ISR & RTC_ISR_INITF) );
if( clock.dow == 0 )
{
dow = getDayOfWeek( clock.day, clock.month, clock.year );
}
else
{
dow = clock.dow;
}
WORD year = clock.year%100;
RTC->TR = ((DWORD)((clock.second%10)&0xF) << 0)
|((DWORD)((clock.second/10)&0x7) << 4)
|((DWORD)((clock.minute%10)&0xF) << 8)
|((DWORD)((clock.minute/10)&0x7) <<12)
|((DWORD)((clock.hour %10)&0xF) <<16)
|((DWORD)((clock.hour /10)&0x3) <<20);
RTC->DR = ((DWORD)((clock.day %10)&0xF) << 0)
|((DWORD)((clock.day /10)&0x3) << 4)
|((DWORD)((clock.month%10)&0xF) << 8)
|((DWORD)((clock.month/10)&0x1) <<12)
|((DWORD)((dow % 8)&0x7) <<13)
|((DWORD)((year %10)&0xF) <<16)
|((DWORD)((year /10)&0xF) <<20);
// exit initialization
RTC->ISR &= ~RTC_ISR_INIT;
}
//-------------------------------------------------------------------
BYTE cHwRTC_0::get( cHwRTC::Properties &clock )
{
BYTE sec;
clock.second = (BYTE)(((RTC->TR >> 0)&0xF) + 10*((RTC->TR >> 4)&0x7));
clock.minute = (BYTE)(((RTC->TR >> 8)&0xF) + 10*((RTC->TR >>12)&0x7));
clock.hour = (BYTE)(((RTC->TR >>16)&0xF) + 10*((RTC->TR >>20)&0x3));
clock.dow = (BYTE)(((RTC->DR >>13)&0x7) );
clock.day = (BYTE)(((RTC->DR >> 0)&0xF) + 10*((RTC->DR >> 4)&0x3));
clock.month = (BYTE)(((RTC->DR >> 8)&0xF) + 10*((RTC->DR >>12)&0x1));
clock.year = (BYTE)(((RTC->DR >>16)&0xF) + 10*((RTC->DR >>20)&0xF));
// reread sec to check overflow
sec = (BYTE)(((RTC->TR >> 0)&0xF) + 10*((RTC->TR >> 4)&0x7));
clock.year += 2000;
return( (clock.second <= sec) ? true : false );
}
// EOF
| [
"joshua.hahn@smail.inf.h-brs.de"
] | joshua.hahn@smail.inf.h-brs.de |
94a87c35021dfeb99262f407da554dac78870306 | 527739ed800e3234136b3284838c81334b751b44 | /include/RED4ext/Types/generated/ent/ReplicatedInputSetterBase.hpp | 3993e79169ee751b43d40f13c0292a1650c1f0df | [
"MIT"
] | permissive | 0xSombra/RED4ext.SDK | 79ed912e5b628ef28efbf92d5bb257b195bfc821 | 218b411991ed0b7cb7acd5efdddd784f31c66f20 | refs/heads/master | 2023-07-02T11:03:45.732337 | 2021-04-15T16:38:19 | 2021-04-15T16:38:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 616 | hpp | #pragma once
// This file is generated from the Game's Reflection data
#include <cstdint>
#include <RED4ext/Common.hpp>
#include <RED4ext/REDhash.hpp>
#include <RED4ext/CName.hpp>
#include <RED4ext/Types/generated/net/Time.hpp>
namespace RED4ext
{
namespace ent {
struct ReplicatedInputSetterBase
{
static constexpr const char* NAME = "entReplicatedInputSetterBase";
static constexpr const char* ALIAS = NAME;
uint8_t unk00[0x8 - 0x0]; // 0
CName name; // 08
net::Time applyServerTime; // 10
};
RED4EXT_ASSERT_SIZE(ReplicatedInputSetterBase, 0x18);
} // namespace ent
} // namespace RED4ext
| [
"expired6978@gmail.com"
] | expired6978@gmail.com |
f03edeaa015d7d10a7e91e6a15450b0c28da3e14 | 5beed0d7eaaed2254de2611496a286b099e29db7 | /10161_antonachessboard.cpp | ebb2815ff1cb0e27c25039fb709ad591ce28750a | [] | no_license | s-s-9/UVA-Codes | ff41350f18f1a746f8135755355f030ed5767083 | 7e985a3a5861ab09adf4bf08ce5a7f1e9538ffe7 | refs/heads/master | 2021-01-01T20:04:43.942824 | 2017-07-29T21:57:19 | 2017-07-29T21:57:19 | 98,763,671 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,346 | cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long int arr[100000], n, i, result, c, r, p1, p2;
for(i = 0; i<100000; i++){
arr[i] = i*i;
}
while(scanf("%lld", &n)==1){
if(n==0){
break;
}
for(i = 0; i<100000;i++){
if(arr[i]>=n){
result = i;
break;
}
}
if((result*result)==n){
if(result%2==0){
printf("%lld 1\n", result);
}
else{
printf("1 %lld\n", result);
}
}
else{
//printf("result: %d\n", result);
p1 = (result*result)-n;
p2 = n-((result-1)*(result-1));
//printf("%lld %lld\n", p1, p2);
if(result%2==0){
if(p1>p2){
r = result;
c = p2;
}
else{
r = p1+1;
c = result;
}
}
else{
if(p1>p2){
r = p2;
c = result;
}
else{
r = result;
c = p1+1;
}
}
printf("%lld %lld\n", c, r);
}
}
return 0;
}
| [
"ss9jo.o.o.o.oss@gmail.com"
] | ss9jo.o.o.o.oss@gmail.com |
855c0af09eb7c938f2f493ce145709684ff7b49d | 4b92641666d40f79afc976c23e454e171a0cedd6 | /SpecMode.cpp | 49b8cd981bb88590f4e199cfbeabc8cbc5e9ed71 | [] | no_license | duyanning/ropevm | b2108d54b49428a6cbd23bcbff56d38bdea13603 | aa22a708d93e6fcf347d6e007e15140a6b01ac25 | refs/heads/master | 2021-01-17T16:03:41.069344 | 2018-12-25T07:27:49 | 2018-12-25T07:27:49 | 65,167,317 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,570 | cpp | #include "std.h"
#include "rope.h"
#include "SpecMode.h"
#include "SpmtThread.h"
#include "lock.h"
#include "Message.h"
#include "RopeVM.h"
#include "interp.h"
#include "MiniLogger.h"
#include "Loggers.h"
#include "Snapshot.h"
#include "Helper.h"
#include "frame.h"
#include "Effect.h"
#include "Break.h"
using namespace std;
SpecMode::SpecMode()
:
UncertainMode("SPEC mode")
{
}
uint32_t
SpecMode::mode_read(uint32_t* addr)
{
return m_st->m_state_buffer.read(addr);
}
void
SpecMode::mode_write(uint32_t* addr, uint32_t value)
{
m_st->m_state_buffer.write(addr, value);
}
void
SpecMode::do_invoke_method(Object* target_object, MethodBlock* new_mb)
{
MINILOG(s_logger, "#" << m_st->id()
<< " (S) is to invoke method: " << new_mb);
if (new_mb->is_synchronized()) {
MINILOG(s_logger, "#" << m_st->id()
<< " (S) " << new_mb << "is sync method");
m_st->halt(RunningState::halt_cannot_exec_sync_method);
return;
}
if (new_mb->is_native() and not new_mb->is_rope_spec_safe()) {
MINILOG(s_logger, "#" << m_st->id()
<< " (S) " << new_mb << "is native method");
m_st->halt(RunningState::halt_cannot_exec_native_method);
return;
}
assert(not new_mb->is_synchronized());
frame->last_pc = pc;
SpmtThread* target_st = target_object->get_st();
if (target_st == m_st or new_mb->is_rope_invoker_execute()) {
sp -= new_mb->args_count;
std::vector<uintptr_t> args;
for (int i = 0; i < new_mb->args_count; ++i) {
args.push_back(read(&sp[i]));
}
invoke_impl(target_object, new_mb, &args[0],
m_st, pc, frame, sp, false);
}
else {
// pop up arguments
sp -= new_mb->args_count;
// InvokeMsg的构造函数和invoke_impl取用参数都是不考虑模式的,所以我们先根据模式读出来
std::vector<uintptr_t> args;
for (int i = 0; i < new_mb->args_count; ++i) {
args.push_back(read(&sp[i]));
}
MINILOG(s_logger, "#" << m_st->m_id
<< " (S) target thread is #" << target_st->id());
// 构造推测性的invoke_msg发送给目标线程
InvokeMsg* invoke_msg = new InvokeMsg(m_st, target_st,
target_object, new_mb, &args[0],
pc, frame, sp);
m_st->send_msg(invoke_msg);
// 推测性的return_msg在rvp方法获得推测性的返回值之后才能构造
MethodBlock* rvp_method = ::get_rvp_method(new_mb);
if (rvp_method == nullptr) { // 若无rvp方法就不推测执行了,停机。
MINILOG(rvp_logger, "#" << m_st->m_id
<< "no rvp-method for " << new_mb);
m_st->halt(RunningState::halt_no_syn_msg);
throw Break();
}
MINILOG(s_logger, "#" << m_st->m_id
<< " (S)invokes rvp-method: " << rvp_method);
m_st->m_rvp_mode.invoke_impl(target_object,
rvp_method,
&args[0],
m_st,
pc, frame, sp, false);
m_st->switch_to_rvp_mode();
}
}
void
SpecMode::do_method_return(int len)
{
assert(len == 0 || len == 1 || len == 2);
assert(not frame->mb->is_synchronized());
Frame* current_frame = frame;
MINILOG(s_logger, "#" << m_st->id()
<< " (S) is to return from " << frame);
SpmtThread* target_st = current_frame->caller;
if (target_st == m_st) {
if (current_frame->is_top_frame()) {
m_st->halt(RunningState::halt_cannot_return_from_top_method);
}
else {
sp -= len;
uintptr_t* caller_sp = current_frame->caller_sp;
for (int i = 0; i < len; ++i) {
write(caller_sp++, read(&sp[i]));
}
frame = current_frame->prev;
sp = caller_sp;
pc = current_frame->caller_pc;
pop_frame(current_frame);
pc += (*pc == OPC_INVOKEINTERFACE_QUICK ? 5 : 3);
}
}
else {
sp -= len;
std::vector<uintptr_t> ret_val;
for (int i = 0; i < len; ++i) {
ret_val.push_back(read(&sp[i]));
}
// 构造推测性的return_msg(该消息只是被记录在effect中,并不真正发送给目标线程)
ReturnMsg* return_msg = new ReturnMsg(target_st,
&ret_val[0], len,
current_frame->caller_pc,
current_frame->prev,
current_frame->caller_sp);
pop_frame(current_frame);
m_st->send_msg(return_msg);
// 需要加载下一条待处理消息
m_st->m_spec_running_state = RunningState::ongoing_but_need_launch_new_msg;
reset_context();
}
}
void
SpecMode::before_signal_exception(Class *exception_class)
{
MINILOG(s_exception_logger, "#" << m_st->id()
<< " (S) exception detected!!! " << exception_class->name());
m_st->halt(RunningState::halt_cannot_signal_exception);
throw Break();
}
Frame*
SpecMode::push_frame(Object* object, MethodBlock* new_mb, uintptr_t* args,
SpmtThread* caller, CodePntr caller_pc, Frame* caller_frame, uintptr_t* caller_sp,
bool is_top)
{
Frame* new_frame = g_create_frame(m_st, object, new_mb, args, caller, caller_pc, caller_frame, caller_sp, is_top);
MINILOG(s_push_frame_logger, "#" << m_st->id()
<< " (S) push frame " << new_frame);
// 把创建的栈桢记录下来
Effect* current_effect = m_st->m_current_spec_msg->get_effect();
assert(current_effect);
current_effect->add_to_C(new_frame);
return new_frame;
}
void
SpecMode::pop_frame(Frame* frame)
{
MINILOG(s_pop_frame_logger, "#" << m_st->id()
<< " (S) destroy " << (frame->pinned ? "(skipped) " : "") << "frame "
<< frame);
Effect* current_effect = m_st->m_current_spec_msg->get_effect();
assert(current_effect);
if (not frame->pinned) {
m_st->clear_frame_in_state_buffer(frame);
// 把已销毁的栈桢从记录中去掉
current_effect->remove_from_C(frame);
g_destroy_frame(frame);
}
else {
current_effect->add_to_R(frame);
}
}
void
SpecMode::do_get_field(Object* target_object, FieldBlock* fb, uintptr_t* addr, int size, bool is_static)
{
assert(size == 1 || size == 2);
MINILOG(s_logger, "#" << m_st->id()
<< " (S) is to getfield: " << fb)
//<< " of " << target_object);
SpmtThread* target_st = target_object->get_st();
assert(target_st->m_thread == m_st->m_thread);
if (target_st == m_st) {
sp -= is_static ? 0 : 1;
for (int i = 0; i < size; ++i) {
write(sp, read(addr + i));
sp++;
}
pc += 3;
}
else {
sp -= is_static ? 0 : 1;
// 构造推测性的get_msg发送给目标线程
GetMsg* get_msg = new GetMsg(m_st, target_st,
target_object, fb);
MINILOG(s_logger, "#" << m_st->id()
<< " (S) add get msg to #"
<< target_st->id() << ": " << get_msg);
m_st->send_msg(get_msg);
// 直接从稳定内存读取,构造推测性的get_ret_msg供自己使用
vector<uintptr_t> value;
for (int i = 0; i < size; ++i) {
value.push_back(addr[i]);
}
GetRetMsg* get_ret_msg = new GetRetMsg(target_st,
&value[0], value.size());
m_st->launch_spec_msg(get_ret_msg);
}
}
void
SpecMode::do_put_field(Object* target_object, FieldBlock* fb,
uintptr_t* addr, int size, bool is_static)
{
assert(size == 1 || size == 2);
MINILOG(s_logger, "#" << m_st->id()
<< " (S) is to put: " << fb);
SpmtThread* target_st = target_object->get_st();
assert(target_st->m_thread == m_st->m_thread);
if (target_st == m_st) {
sp -= size;
for (int i = 0; i < size; ++i) {
write(addr + i, read(sp + i));
}
sp -= is_static ? 0 : 1;
pc += 3;
}
else {
sp -= size;
// 构造推测性的put_msg发送给目标线程
vector<uintptr_t> val;
for (int i = 0; i < size; ++i) {
val.push_back(read(sp + i));
}
sp -= is_static ? 0 : 1;
PutMsg* put_msg = new PutMsg(m_st, target_st,
target_object, fb, &val[0]);
MINILOG(s_logger, "#" << m_st->id()
<< " (S) add put msg to #"
<< target_st->id() << ": " << put_msg);
m_st->send_msg(put_msg);
// 构造推测性的put_ret_msg供自己使用
PutRetMsg* put_ret_msg = new PutRetMsg(m_st);
m_st->launch_spec_msg(put_ret_msg);
}
}
void
SpecMode::do_array_load(Object* array, int index, int type_size)
{
MINILOG(s_logger, "#" << m_st->id()
<< " (S) is to load from array");
Object* target_object = array;
SpmtThread* target_st = target_object->get_st();
assert(target_st->m_thread == m_st->m_thread);
int nslots = type_size > 4 ? 2 : 1; // number of slots for value
if (target_st == m_st) {
sp -= 2; // pop up arrayref and index
load_from_array(sp, array, index, type_size);
sp += nslots;
pc += 1;
}
else {
sp -= 2; // pop up arrayref and index
// 构造推测性的aload_msg发送给目标线程
ALoadMsg* aload_msg = new ALoadMsg(m_st, target_st,
array, type_size, index);
MINILOG(s_logger, "#" << m_st->id()
<< " (S) add arrayload msg to #"
<< target_st->id() << ": " << aload_msg);
m_st->send_msg(aload_msg);
// 直接从稳定内存取数,构造推测性的arrayload_return消息并使用
vector<uintptr_t> value;
g_load_from_stable_array_to_c(&value[0], array, index, type_size);
ALoadRetMsg* aload_ret_msg = new ALoadRetMsg(m_st,
&value[0], value.size());
m_st->launch_spec_msg(aload_ret_msg);
}
}
void
SpecMode::do_array_store(Object* array, int index, int type_size)
{
MINILOG(s_logger, "#" << m_st->id()
<< " (S) is to store to array");
Object* target_object = array;
SpmtThread* target_st = target_object->get_st();
assert(target_st->m_thread == m_st->m_thread);
//void* addr = array_elem_addr(array, index, type_size);
int nslots = type_size > 4 ? 2 : 1; // number of slots for value
if (target_st == m_st) {
sp -= nslots; // pop up value
store_to_array(sp, array, index, type_size);
sp -= 2; // pop arrayref and index
pc += 1;
}
else {
sp -= nslots; // pop up value
// 构造推测性的astore_msg发送给目标线程
uint32_t val[2]; // at most 2 slots
for (int i = 0; i < nslots; ++i) {
val[i] = read(sp + i);
}
sp -= 2;
AStoreMsg* astore_msg = new AStoreMsg(m_st, target_st,
array,
type_size, index, &val[0]);
MINILOG(s_logger, "#" << m_st->id()
<< " (S) add arraystore task to #"
<< target_st->id() << ": " << astore_msg);
m_st->send_msg(astore_msg);
// 构造推测性的astore_ret_msg供自己使用
AStoreRetMsg* astore_ret_msg = new AStoreRetMsg(m_st);
m_st->launch_spec_msg(astore_ret_msg);
}
}
void*
SpecMode::do_execute_method(Object* target_object,
MethodBlock *mb,
std::vector<uintptr_t>& jargs, DummyFrame* dummy)
{
MINILOG(step_loop_in_out_logger, "#" << m_st->id()
<< " (S) to be execute java method: " << mb);
// 大多数execute_method调用的目的都是为了在解释new指令的时候通过解
// 释方法ClassLoader.loadClass来加载类。如果我们需要的类已经被加载,
// 就不会调用execute_method。而且,就算现在这个类尚未加载,需要解释
// ClassLoader.loadClass,而我们(在推测模式下)又没有资格调用
// execute_method,只能中断new指令的解释过程,但过了一会之后,可能
// 其他线程(在确定模式下)已经调用execute_method解释了
// ClassLoader.loadClass,从而加载了我们没能加载的类,那么我们的
// new指令就可以重新执行了。是让被中断的new指令不停地重试,还是等一
// 会?前者代价太大。那么就等一会,等到什么时候(在推测模式下)重试
// 呢?等到我们resume推测执行的时候。
// SpmtThread::resume_suspended_spec_execution中有对应实现。
m_st->halt(RunningState::halt_cannot_exec_method);
throw Break();
return 0;
}
void
SpecMode::send_msg(Message* msg)
{
Effect* current_effect = m_st->m_current_spec_msg->get_effect();
current_effect->msg_sent = msg;
MINILOG(spec_msg_logger, "#" << m_st->id()
<< " send" << (g_is_async_msg(msg) ? "" : "(only record)")
<< " spec msg to "
<< "#" << msg->get_target_st()->id()
<< " " << msg);
// 同步消息是只记录,但不真正发送出去
// and msg->get_type() != MsgType::GET
if (g_is_async_msg(msg)) {
msg->get_target_st()->add_spec_msg(msg);
}
}
void
SpecMode::do_spec_barrier()
{
if (not RopeVM::support_spec_barrier) { // 如不支持推测路障,推测线程也能通过推测路障
pc += 3;
return;
}
m_st->halt(RunningState::halt_spec_barrier);
MINILOG(spec_barrier_logger, "#" << m_st->id()
<< " halt because spec barrier");
//pc += 3; 不增加pc,推测模式下无法越过该路障
}
| [
"duyanning@gmail.com"
] | duyanning@gmail.com |
f36035e412d392b3851d162f4c67534f9074010f | f6f0f87647e23507dca538760ab70e26415b8313 | /6.3.1/msvc2022_arm64/include/QtCore/6.3.1/QtCore/private/qxmlstreamgrammar_p.h | 6533d92409ad2a0c55a99ce1a173fca9b451bce8 | [] | no_license | stenzek/duckstation-ext-qt-minimal | a942c62adc5654c03d90731a8266dc711546b268 | e5c412efffa3926f7a4d5bf0ae0333e1d6784f30 | refs/heads/master | 2023-08-17T16:50:21.478373 | 2023-08-15T14:53:43 | 2023-08-15T14:53:43 | 233,179,313 | 3 | 1 | null | 2021-11-16T15:34:28 | 2020-01-11T05:05:34 | C++ | UTF-8 | C++ | false | false | 4,965 | h | /****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of other Qt classes. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
// This file was generated by qlalr - DO NOT EDIT!
#ifndef QXMLSTREAMGRAMMAR_P_H
#define QXMLSTREAMGRAMMAR_P_H
#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
class QXmlStreamGrammar
{
public:
enum VariousConstants {
EOF_SYMBOL = 0,
AMPERSAND = 5,
ANY = 41,
ATTLIST = 31,
BANG = 25,
CDATA = 47,
CDATA_START = 28,
COLON = 17,
COMMA = 19,
DASH = 20,
DBLQUOTE = 8,
DIGIT = 27,
DOCTYPE = 29,
DOT = 23,
ELEMENT = 30,
EMPTY = 40,
ENTITIES = 51,
ENTITY = 32,
ENTITY_DONE = 45,
EQ = 14,
ERROR = 43,
FIXED = 39,
HASH = 6,
ID = 48,
IDREF = 49,
IDREFS = 50,
IMPLIED = 38,
LANGLE = 3,
LBRACK = 9,
LETTER = 26,
LPAREN = 11,
NDATA = 36,
NMTOKEN = 52,
NMTOKENS = 53,
NOTATION = 33,
NOTOKEN = 1,
PARSE_ENTITY = 44,
PCDATA = 42,
PERCENT = 15,
PIPE = 13,
PLUS = 21,
PUBLIC = 35,
QUESTIONMARK = 24,
QUOTE = 7,
RANGLE = 4,
RBRACK = 10,
REQUIRED = 37,
RPAREN = 12,
SEMICOLON = 18,
SHIFT_THERE = 56,
SLASH = 16,
SPACE = 2,
STAR = 22,
SYSTEM = 34,
UNRESOLVED_ENTITY = 46,
VERSION = 55,
XML = 54,
ACCEPT_STATE = 416,
RULE_COUNT = 270,
STATE_COUNT = 427,
TERMINAL_COUNT = 57,
NON_TERMINAL_COUNT = 84,
GOTO_INDEX_OFFSET = 427,
GOTO_INFO_OFFSET = 1030,
GOTO_CHECK_OFFSET = 1030
};
static const char *const spell[];
static const short lhs[];
static const short rhs[];
static const short goto_default[];
static const short action_default[];
static const short action_index[];
static const short action_info[];
static const short action_check[];
static inline int nt_action (int state, int nt)
{
const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt;
if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != nt)
return goto_default [nt];
return action_info [GOTO_INFO_OFFSET + yyn];
}
static inline int t_action (int state, int token)
{
const int yyn = action_index [state] + token;
if (yyn < 0 || action_check [yyn] != token)
return - action_default [state];
return action_info [yyn];
}
};
QT_END_NAMESPACE
#endif // QXMLSTREAMGRAMMAR_P_H
| [
"stenzek@gmail.com"
] | stenzek@gmail.com |
28928f021f7f9da85934d25feba5595481a71f25 | 1dbb60db92072801e3e7eaf6645ef776e2a26b29 | /server/src/common/proto/trial/PQTrialRewardList.h | 3a8e59853a2c387679a0f0ea9f34c4b450bc83b6 | [] | no_license | atom-chen/phone-code | 5a05472fcf2852d1943ad869b37603a4901749d5 | c0c0f112c9a2570cc0390703b1bff56d67508e89 | refs/heads/master | 2020-07-05T01:15:00.585018 | 2015-06-17T08:52:21 | 2015-06-17T08:52:21 | 202,480,234 | 0 | 1 | null | 2019-08-15T05:36:11 | 2019-08-15T05:36:09 | null | UTF-8 | C++ | false | false | 1,140 | h | #ifndef _PQTrialRewardList_H_
#define _PQTrialRewardList_H_
#include <weedong/core/seq/seq.h>
#include <proto/common/SMsgHead.h>
class PQTrialRewardList : public SMsgHead
{
public:
uint32 id; //试炼ID
PQTrialRewardList() : id(0)
{
msg_cmd = 644273634;
}
virtual ~PQTrialRewardList()
{
}
virtual wd::CSeq* clone(void)
{
return ( new PQTrialRewardList(*this) );
}
virtual bool write( wd::CStream &stream )
{
uint32 uiSize = 0;
return loop( stream, wd::CSeq::eWrite, uiSize );
}
virtual bool read( wd::CStream &stream )
{
uint32 uiSize = 0;
return loop( stream, wd::CSeq::eRead, uiSize );
}
bool loop( wd::CStream &stream, wd::CSeq::ELoopType eType, uint32& uiSize )
{
uint32 _uiSize = 0;
return SMsgHead::loop( stream, eType, _uiSize )
&& wd::CSeq::loop( stream, eType, uiSize )
&& TFVarTypeProcess( id, eType, stream, uiSize )
&& loopend( stream, eType, uiSize );
}
operator const char* ()
{
return "PQTrialRewardList";
}
};
#endif
| [
"757690733@qq.com"
] | 757690733@qq.com |
f9f447693015d4317889057a1a0933394b273e5d | 75f5a664b0303391e1aa138fa196e49ff4dc6236 | /70 Climbing Stairs.cpp | 23166080cb4e26bf0ffe2998fa7b9cae7c8fdb74 | [] | no_license | lxlsosi/Leetcode | b22c93ed5a87ad1fdd045642f4e809535725d40e | eb14c7764a46dc782cad35bc9f4c1b7542dd665b | refs/heads/master | 2021-06-04T07:43:20.783605 | 2016-08-17T09:37:26 | 2016-08-17T09:37:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 348 | cpp | public class Solution
{
public int climbStairs(int n)
{
if(n == 0 || n == 1 || n == 2)
{
return n;
}
int[] mem = new int[n];
mem[0] = 1;
mem[1] = 2;
for(int i = 2; i < n; i++)
{
mem[i] = mem[i-1] + mem[i-2];
}
return mem[n-1];
}
}
| [
"sosisarah@gmail.com"
] | sosisarah@gmail.com |
4eff37df902a62399c8bb9002d97072101fadbaf | 7b93f65c8d36750afdd5add6b6676b1523e818ec | /cpp/robel_intro/chap10/Exception1.cpp | 38d643681a81ae48a1645abeaffb123564e36e53 | [] | no_license | DaisukeYamato/book | 9cbb3620e5f297832a7c0dc4b35f38b61a6395ea | 0308106dedf8a23b491aada942f781d2ab000b69 | refs/heads/master | 2021-01-22T13:13:02.365196 | 2015-08-26T00:12:56 | 2015-08-26T00:12:56 | 40,760,927 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 416 | cpp | #include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
using namespace std;
int main() {
ifstream file;
file.open("test.txt");
if (!file.is_open()){
cerr << "cannot open file!!" << endl;
return EXIT_FAILURE;
}
string line;
getline(file, line);
if (file.fail()){
cerr << "cannot read from file!!" << endl;
return EXIT_FAILURE;
}
cout << line << endl;
}
| [
"yamato.hep.fermicern@gmail.com"
] | yamato.hep.fermicern@gmail.com |
0932675f0a5b62d06d48844fb6e62e0906738af9 | 78d059c7a7d8883774917047f243b23bc5809597 | /view24_pcd.cpp | 6c49585f62ec740a9a087ad3ab8f67566cbf0435 | [] | no_license | louxiu/game-graph | 3bbd3a24f3e17b5d3831de2cf0e5c25b43da73f1 | e25d7db941f9a1cddf3501dfff9e37f83e663a5c | refs/heads/master | 2016-09-01T18:20:30.975897 | 2015-03-13T06:58:06 | 2015-03-13T06:58:06 | 28,659,739 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,216 | cpp | #include "view24_pcd.h"
#include "util.h"
#include "data/view24_pcd_res_texture.c"
GLuint view11_program = 0;
GLint view11_attr_coord2d, view11_uniform_offset_x,
view11_uniform_scale_x, view11_uniform_sprite, view11_uniform_mytexture;
GLuint view11_texture_id = 0;
float view11_offset_x = 0.0, view11_scale_x = 1.0;
int view11_mode = 0;
GLuint view11_vbo = 0;
// struct point3d {
// GLfloat x;
// GLfloat y;
// // GLfloat z;
// };
// static point3d graph[8000000];
// int load_sin_data_example()
// {
// for (int i = 0; i < 2000; i++) {
// float x = (i - 1000.0) / 100.0;
// graph[i].x = x;
// graph[i].y = sin(x * 10.0) / (1.0 + x * x);
// // graph[i].z = 0;
// // printf ("%f %f %f\n", graph[i].x, graph[i].y, graph[i].z);
// }
// return 2000;
// }
int view11_initResources()
{
glClearColor(1.0, 1.0, 1.0, 0);
view11_program = create_program("glsl/pcd.24.v.glsl",
"glsl/pcd.24.f.glsl");
view11_attr_coord2d = get_attrib(view11_program, "coord2d");
view11_uniform_offset_x = get_uniform(view11_program, "offset_x");
view11_uniform_scale_x = get_uniform(view11_program, "scale_x");
view11_uniform_sprite = get_uniform(view11_program, "sprite");
view11_uniform_mytexture = get_uniform(view11_program, "mytexture");
// TODO: move other enable to init
/* Enable blending */
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
/* Upload the texture for our point sprites */
glActiveTexture(GL_TEXTURE0);
glGenTextures(1, &view11_texture_id);
glBindTexture(GL_TEXTURE_2D, view11_texture_id);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, view11_res_texture.width,
view11_res_texture.height, 0, GL_RGBA, GL_UNSIGNED_BYTE,
view11_res_texture.pixel_data);
// Create the vertex buffer object
glGenBuffers(1, &view11_vbo);
glBindBuffer(GL_ARRAY_BUFFER, view11_vbo);
// Create our own temporary buffer
point graph[2000];
// Fill it in just like an array
for (int i = 0; i < 2000; i++) {
float x = (i - 1000.0) / 100.0;
graph[i].x = x;
graph[i].y = sin(x * 10.0) / (1.0 + x * x);
}
int len = 2000;
// int len = load_sin_data_example();
// Tell OpenGL to copy our array to the buffer object
printf ("sizeof(graph) = %d\n", sizeof(graph));
glBufferData(GL_ARRAY_BUFFER, sizeof(graph), graph, GL_STATIC_DRAW);
return 0;
}
// TODO: how to check the memory use of GPU
void view11Display()
{
// TODO: what's this?
// uniform lowp float sprite;
glUseProgram(view11_program);
glUniform1i(view11_uniform_mytexture, 0);
glUniform1f(view11_uniform_offset_x, view11_offset_x);
glUniform1f(view11_uniform_scale_x, view11_scale_x);
glClear(GL_COLOR_BUFFER_BIT);
/* Draw using the vertices in our vertex buffer object */
glBindBuffer(GL_ARRAY_BUFFER, view11_vbo);
glEnableVertexAttribArray(view11_attr_coord2d);
glVertexAttribPointer(view11_attr_coord2d, 2, GL_FLOAT, GL_FALSE, 0, 0);
/* Push each element in buffer_vertices to the vertex shader */
switch (view11_mode) {
case 0:
glUniform1f(view11_uniform_sprite, 0);
glDrawArrays(GL_LINE_STRIP, 0, 2000);
break;
case 1:
glUniform1f(view11_uniform_sprite, 1);
glDrawArrays(GL_POINTS, 0, 2000);
break;
case 2:
glUniform1f(view11_uniform_sprite, view11_res_texture.width);
glDrawArrays(GL_POINTS, 0, 2000);
break;
}
glutSwapBuffers();
}
void view11_special(int key, int x, int y)
{
switch (key) {
case GLUT_KEY_F1:
view11_mode = 0;
// printf("Now drawing using lines.\n");
break;
case GLUT_KEY_F2:
view11_mode = 1;
// printf("Now drawing using points.\n");
break;
case GLUT_KEY_F3:
view11_mode = 2;
// printf("Now drawing using point sprites.\n");
break;
case GLUT_KEY_LEFT:
view11_offset_x -= 0.1;
break;
case GLUT_KEY_RIGHT:
view11_offset_x += 0.1;
break;
case GLUT_KEY_UP:
view11_scale_x *= 1.5;
break;
case GLUT_KEY_DOWN:
view11_scale_x /= 1.5;
break;
case GLUT_KEY_HOME:
view11_offset_x = 0.0;
view11_scale_x = 1.0;
break;
}
glutPostRedisplay();
}
void view11_freeResources()
{
glDisable(GL_BLEND);
glDeleteProgram(view11_program);
glDeleteBuffers(1, &view11_vbo);
glDeleteTextures(1, &view11_texture_id);
}
void view11_entry(Window *window)
{
window->display = view11Display;
window->entry = viewEntry;
window->init = view11_initResources;
window->free = view11_freeResources;
window->special = view11_special;
}
#ifdef TEST_ALONE
int main(int argc, char *argv[])
{
Window window;
resetWindow(&window);
view11_entry(&window);
if (mini_initWindow(argc, argv, &window) == 0){
glutMainLoop();
}
return 0;
}
#endif /* TEST_ALONE */
| [
"yunlong.lou@duobei.com"
] | yunlong.lou@duobei.com |
b92e90fa48fd3f6fe2be36d7d9f823262f0f081d | 464aa9d7d6c4906b083e6c3da12341504b626404 | /src/lib/terrain/terrain2/grid_vertex_buffer.cpp | 1a38a8d6796b88a09570527ab44a1cefa5dde8cb | [] | no_license | v2v3v4/BigWorld-Engine-2.0.1 | 3a6fdbb7e08a3e09bcf1fd82f06c1d3f29b84f7d | 481e69a837a9f6d63f298a4f24d423b6329226c6 | refs/heads/master | 2023-01-13T03:49:54.244109 | 2022-12-25T14:21:30 | 2022-12-25T14:21:30 | 163,719,991 | 182 | 167 | null | null | null | null | UTF-8 | C++ | false | false | 3,966 | cpp | /******************************************************************************
BigWorld Technology
Copyright BigWorld Pty, Ltd.
All Rights Reserved. Commercial in confidence.
WARNING: This computer program is protected by copyright law and international
treaties. Unauthorized use, reproduction or distribution of this program, or
any portion of this program, may result in the imposition of civil and
criminal penalties as provided by law.
******************************************************************************/
#include "pch.hpp"
#include "grid_vertex_buffer.hpp"
namespace Terrain
{
// -----------------------------------------------------------------------------
// Section: GridVertexBuffer
// -----------------------------------------------------------------------------
/**
* Constructor.
*/
GridVertexBuffer::GridVertexBuffer() :
resolutionX_( 0 ),
resolutionZ_( 0 )
{
}
/**
* Destructor.
*/
GridVertexBuffer::~GridVertexBuffer()
{
del( this );
}
/*
* This method inits the grid vertex buffer
* The buffer is filled with two heights per vertex, the x grid position
* and the z grid position, both values between 0 and 1
* @param resolutionX the x resolution
* @param resolutionZ the z resolution
* @return true if successful
*/
bool GridVertexBuffer::init( uint16 resolutionX, uint16 resolutionZ )
{
BW_GUARD;
bool res = false;
if (Moo::rc().device())
{
uint32 nVertices = uint32(resolutionX) * uint32(resolutionZ);
pVertexBuffer_.release();
resolutionX_ = resolutionX;
resolutionZ_ = resolutionZ;
// Creeate the vertex buffer
if (SUCCEEDED(pVertexBuffer_.create( sizeof( Vector2 ) * nVertices,
D3DUSAGE_WRITEONLY, 0, D3DPOOL_MANAGED ) ) )
{
Moo::VertexLock<Vector2> vl( pVertexBuffer_ );
if (vl)
{
float z = 0.f;
float zi = 1.f / float(resolutionZ - 1);
int index = 0;
for (uint32 zind = 0; zind < resolutionZ; zind++)
{
float x = 0.f;
float xi = 1.f / float(resolutionX - 1);
for( uint32 xind = 0; xind < resolutionX; xind++)
{
vl[index].x = x;
vl[index].y = z;
x += xi;
++index;
}
z += zi;
}
res = true;
}
// Add the buffer to the preload list so that it can get uploaded
// to video memory
pVertexBuffer_.addToPreloadList();
}
}
return res;
}
/*
* This method creates a token for the map from the two grid resolution values.
* This token contains the x resolution in the upper 16 bits and the z resolution
* in the lower 16 bits.
* @param resolutionX the x resolution
* @param resolutionZ the Z resolution
* @return the token
*/
uint32 GridVertexBuffer::token( uint16 resolutionX, uint16 resolutionZ )
{
return (uint32( resolutionX ) << 16) | uint32(resolutionZ );
}
/**
* This static method returns the grid vertex buffer for the supplied resolution.
* @param resolutionX the x resolution
* @param resolutionZ the z resolution
*
*/
GridVertexBuffer* GridVertexBuffer::get( uint16 resolutionX, uint16 resolutionZ )
{
BW_GUARD;
SimpleMutexHolder smh( s_mutex_ );
std::map< uint32, GridVertexBuffer* >::iterator it
= s_gridVertexBuffers_.find( token( resolutionX, resolutionZ ) );
GridVertexBuffer* pRes = NULL;
if (it != s_gridVertexBuffers_.end() )
{
pRes = it->second;
}
else
{
GridVertexBuffer* pBuf = new GridVertexBuffer;
if (pBuf->init( resolutionX, resolutionZ ))
{
s_gridVertexBuffers_.insert(
std::make_pair( token( resolutionX, resolutionZ ), pBuf ) );
pRes = pBuf;
}
}
return pRes;
}
void GridVertexBuffer::del( GridVertexBuffer* pBuf )
{
BW_GUARD;
SimpleMutexHolder smh( s_mutex_ );
std::map< uint32, GridVertexBuffer* >::iterator it =
s_gridVertexBuffers_.find(
token( pBuf->resolutionX_, pBuf->resolutionZ_ ) );
if (it != s_gridVertexBuffers_.end())
{
s_gridVertexBuffers_.erase( it );
}
}
std::map< uint32, GridVertexBuffer* > GridVertexBuffer::s_gridVertexBuffers_;
SimpleMutex GridVertexBuffer::s_mutex_;
} | [
"terran.erre@mail.ru"
] | terran.erre@mail.ru |
a2cb149c167aa72869504ad575542f83e54dca1f | 1419caa2578df20403a5aa53ef9ee356d979cd80 | /lte/gateway/c/oai/tasks/nas5g/include/ies/M5GExtendedProtocolDiscriminator.h | b994e830d07c0114bfce72c2e803db1f8011245c | [
"BSD-3-Clause"
] | permissive | jpad-freedomfi/magma | a5f81069778a69b96f9d102141c87cd13ff9cb00 | 8cd5a677536f9af83b7f0b331b0c8244788ccc31 | refs/heads/master | 2023-03-26T17:00:34.483676 | 2021-03-16T19:51:30 | 2021-03-16T19:51:30 | 265,432,509 | 1 | 0 | NOASSERTION | 2020-05-20T02:54:20 | 2020-05-20T02:54:19 | null | UTF-8 | C++ | false | false | 1,175 | h | /*
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
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.
*/
#pragma once
#include <sstream>
#include <cstdint>
using namespace std;
namespace magma5g {
// ExtendedProtocolDiscriminator IE Class
class ExtendedProtocolDiscriminatorMsg {
public:
uint8_t extended_proto_discriminator;
ExtendedProtocolDiscriminatorMsg();
~ExtendedProtocolDiscriminatorMsg();
int EncodeExtendedProtocolDiscriminatorMsg(
ExtendedProtocolDiscriminatorMsg* extended_protocol_discriminator,
uint8_t iei, uint8_t* buffer, uint32_t len);
int DecodeExtendedProtocolDiscriminatorMsg(
ExtendedProtocolDiscriminatorMsg* extended_protocol_discriminator,
uint8_t iei, uint8_t* buffer, uint32_t len);
};
} // namespace magma5g
| [
"noreply@github.com"
] | jpad-freedomfi.noreply@github.com |
de4c1f2a6928012d2cc4adafe49f1601d7237f75 | 834478799b329077cdd143b103a981bdc4659c80 | /1293D.cpp | 60680f720c5dec9c1e6104a45759975d723dee01 | [] | no_license | lovinix/Codeforces | b67e53f530772b2b1b13d6972d52212ab46a1edf | b51b6b04ef659c6ed59aca2c37d4dbe45efbe064 | refs/heads/master | 2022-09-07T16:24:45.983390 | 2019-08-28T08:58:58 | 2019-08-28T08:58:58 | 267,228,357 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,216 | cpp | #pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using lli = unsigned long long;
using pll = pair<lli, lli>;
lli x0, yk, ax, ay, bx, by, xs, ys, t, ans;
vector<pll> vt;
lli dist(lli x1, lli x2, lli y1, lli y2)
{
return max(x1, x2) - min(x1, x2) + max(y1, y2) - min(y1, y2);
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> x0 >> yk >> ax >> ay >> bx >> by >> xs >> ys >> t;
vt.emplace_back(x0, yk);
while (vt.back().first <= 1e17 && vt.back().second <= 1e17)
vt.emplace_back(vt.back().first * ax + bx, vt.back().second * ay + by);
for (int i = 0; i < vt.size(); ++i)
{
lli d = dist(xs, vt[i].first, ys, vt[i].second);
if (d > t) continue;
lli sum = d, cnt = 1;
for (lli j = i + 1; j < vt.size(); ++j)
{
lli curd = dist(vt[j - 1].first, vt[j].first, vt[j - 1].second, vt[j].second);
if (sum + curd > t) break;
sum += curd;
++cnt;
}
ans = max(ans, cnt);
sum = d, cnt = 1;
for (int j = i - 1; j >= 0; --j)
{
lli curd = dist(vt[j + 1].first, vt[j].first, vt[j + 1].second, vt[j].second);
if (sum + curd > t) break;
sum += curd;
++cnt;
}
ans = max(ans, cnt);
}
cout << ans;
} | [
"sylph0606@gmail.com"
] | sylph0606@gmail.com |
2dfefc009233e48edaa3ac6b20ba1499e0be805d | 7d0d0f38a46fe5a8fa8b42c56bebf4e114b307aa | /OctopusPolarizer.h | 1ec94e59ee4e681b8a9fa87ce224c0962b99d1ed | [] | no_license | mpacella88/octopus | cd6f2bb3f62a8bfee0c07c0bbec4475f98af1b58 | 8ab842d46171f581a31012d00b37e9bd93d77f69 | refs/heads/master | 2020-03-18T13:12:09.957332 | 2018-05-24T20:53:09 | 2018-05-24T20:53:09 | 134,767,500 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,855 | h |
#if !defined(AFX_H_OctopusPolarizer)
#define AFX_H_OctopusPolarizer
#include "stdafx.h"
#include "OctopusGlobals.h"
#include "APTMotor.h"
class COctopusPolarizer : public CDialog
{
public:
COctopusPolarizer(CWnd* pParent = NULL);
virtual ~COctopusPolarizer();
enum { IDD = IDC_STAGE_POL };
void MoveRel( float deg );
void MoveCW( void );
void MoveCCW( void );
void ScanStartStop( void );
protected:
virtual void DoDataExchange(CDataExchange* pDX);
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
afx_msg void OnNMCustomdrawExecute( NMHDR* pNMHDR, LRESULT* pResult );
CBitmap m_bmp_yes;
CBitmap m_bmp_no;
DECLARE_MESSAGE_MAP()
CStatic m_Pos;
CStatic m_Step;
CStatic m_status_rot;
float save_pos_deg_T;
UINT scan_number_of_steps;
UINT scan_number_of_steps_z;
u16 scan_current_step;
u16 scan_current_step_z;
float stepsize_deg_T;
float scan_step_size_deg;
float scan_step_size_microns_z;
float scan_start_deg_T;
void GetPosition( void );
void ShowPosition( void );
void ShowStep( void );
void UpdatePosition( void );
bool Initialized;
virtual BOOL OnInitDialog();
afx_msg void ScanSetStart( void );
void ScanDone( void );
void ScanStep( void );
void MoveAE_T( float deg, bool wait );
double FrameConvert( double deg );
UINT TIMER_Polarizer_Pos;
UINT TIMER_Polarizer_Scan;
CButton m_ctl_Rot_CheckBox;
CButton m_ctl_Rot_CheckBox2;
CButton m_ctl_Rot_CheckBox3;
bool PolRot_Both;
bool PolRot_Only_Pol;
bool PolRot_Only_Z;
public:
afx_msg void SavePositionSet();
afx_msg void SavePositionGoTo();
afx_msg void OnKillfocusGeneral();
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnBnClickedRot();
afx_msg void OnBnClickedRot2();
afx_msg void OnBnClickedRot3();
void Initialize( void );
void Close( void );
afx_msg void Zero();
CMgmotorctrl1 Polarizer_T;
};
#endif | [
"mpacella88@gmail.com"
] | mpacella88@gmail.com |
2ad25fc9bad5ae01d1ac5e77d0f1c9b0597cd245 | aa06e49aa870b2164936a0485d44fb3979110e0b | /main.cpp | 1c142fa9fc281e0dde727303326c3a4f9a07b796 | [] | no_license | CleversonCAS/Ponteiros-Genericos | 2ad3091e84e88f32c2ce09f92ada29f50e366e71 | 68dd7ca7074dcb31f0e7f8aead1cd557c053b649 | refs/heads/master | 2020-03-29T06:37:00.098223 | 2018-09-27T20:41:34 | 2018-09-27T20:41:34 | 149,633,175 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,697 | cpp | #include <iostream>
#include <iterator>
#include <string>
#include <ctime> //rand
#include <vector>
#include "fun.h"
#include <fstream>
using std::begin;
using std::end;
//namespace graal;
//namespace graal;
//#include "imp.cpp"
//Os ponteiro para função, aonde devo colocar?(No momento estão no .h)
//E as função bool?(tão na main)
//Em quais funções devo usar memcpy?
bool menor(const void *a ,const void *b)
{
return *static_cast<const int *>(a) < *static_cast<const int *>(b);//Pq tenho que comparar como sendo int?
}
bool par( const void *a)
{
return *static_cast<const int *>(a) % 2 == 0 ;//achar o primeiro par
}
bool impar(const void *a)
{
return *static_cast<const int *>(a) % 2 == 1 ;//achar o primeiro impar//Se for negativo, retorna o próximo positivo(?)
}
bool eq(const void *a ,const void *b)
{
return *static_cast<const int *>(a) == *static_cast<const int *>(b);
}
int main()
{
int A[]={0,-15,12,12,-15,25,10};
int B[]={72,51,23 ,15,94};
int C[]={-11,-2,10,15,12,9};
int D[]={2,2,2,4,6,8,12,5,5,5,5,5,5,5,5,10,5,12,14,8,10,16,16};
int E[]={5,7,1,9,10,2,8,3,4,6};
printEspaco(1);
//Questão 1 OK
//criarVetorAleatorio( begin(A) , sizeof(int) ,10);
std::cout << "Vetor: ";
printVetor(begin(A) , end(A));
auto result_min = (const int*) min(begin(A) , end(A) , sizeof(int) , menor);
std::cout << "Menor elemento do vetor é: " << *result_min << std::endl;
printEspaco( 2);
//Questão 2 OK(???)//testar com outros vetores //Está imprimindo números "aleatórios" em alguns caso
std::cout << "Vetor: ";
printVetor(begin(B) , end(B));
reverse(begin(B) , end(B) , sizeof(int));
std::cout<<"Vetor revertido: \n";
printVetor(begin(B) , end(B));
printEspaco(3);
//Questão OK
std::cout << "Vetor que será copiado: ";
printVetor(begin(A) , end(A));
std::cout<<"Vetor aleatório: ";
printVetor(begin(B) , end(B));
auto result_copy = (const int*)copy(begin(A) , end(A), begin(B), sizeof(int));
std::cout<<"Novo Vetor copiado\n";
std::cout<<*result_copy<<'\n';
printVetor(begin(B) , end(B));
//Questão 4 //?Num sei fazer nao
printEspaco(5);
//Questão 5 OK
std::ofstream outFile;
outFile.open("teste.txt");
outFile<<"AAAAAAAAAA"<<std::endl;
std::cout << "Vetor: ";
printVetor(begin(D) , end(D));
auto result_par = (const int*)find_if(begin(D) , end(D) , sizeof(int) , par);
std::cout << "Primeiro par do vetor: "<<*result_par<<'\n';
auto result_impar = (const int*)find_if(begin(D) , end(D) , sizeof(int) , impar);
std::cout << "Primeiro impar do vetor: "<<*result_impar<<'\n';
std::cout << "PS: Se não encontrado retorna o ultimo elemento\n";
printEspaco(6);
//Questão 6 OK
std::cout << "Vetor: ";
printVetor(begin(A) , end(A));
int *p,a=12;//Necessário, pois a função tem como parametro um ponteiro
p=&a;
std::cout << *p<<'\n';
auto result_find = (int*)find(begin(A) , end(A) , sizeof(int) , p , eq);//Acontece falha de segmentação (?)
std::cout << "Valor retornado(Se não encontrado, retornará o ultimo elemento): "<<*result_find<<'\n';
printEspaco(7);
//Questão 7 OK
std::cout << "Vetor: ";
printVetor(begin(D) , end(D));
auto result_all_of= all_of(begin(D) , end(D) , sizeof(int) , par);////////////////
std::cout<<"Todos são pares? "<<result_all_of<<std::endl;
std::cout << "Vetor: ";
printVetor(begin(D) , end(D));
auto result_any_of = any_of(begin(D) , end(D) , sizeof(int) , par);////////////////
std::cout<<"Algum é par? "<<result_any_of<<std::endl;
std::cout << "Vetor: ";
printVetor(begin(D) , end(D));
auto result_none_of = none_of(begin(D) , end(D), sizeof(int) , par);////////////////
std::cout<<"Nenhum é par? "<<result_none_of<<std::endl;
printEspaco(8);
//Questão 8 OK
std::cout << "Vetor A: ";
printVetor(begin(A) , end(A));
std::cout << "Vetor B: ";
printVetor(begin(B) , end(B));
auto result_equal_1 = equal(begin(A) , end(A), begin(B), sizeof(int), eq );
std::cout<<"A == B? "<<result_equal_1<<std::endl;
std::cout << "Vetor A: ";
printVetor(begin(A) , end(A));
std::cout << "Vetor B: ";
printVetor(begin(C) , end(C));
auto result_equal_2 = equal(begin(A) , end(A), begin(C), end(C) , sizeof(int) , eq);
std::cout<<"A == B? "<<result_equal_2<<std::endl;
//Questão 9
printEspaco(9);
std::cout << "Vetor: ";
printVetor(begin(D) , end(D));
int * fin = (int*)unique(begin(D) , end(D), sizeof(int),eq);
std::cout<<"Vetor arrumado: ";
printVetor(begin(D) , fin);
//Questão 10
printEspaco(11);
//Questão 11
std::cout << "Vetor: ";
printVetor(begin(E) , end(E));
sort(begin(E) , end(E), sizeof(int),menor);
std::cout<<"Vetor ordenado: ";
printVetor(begin(E) , end(E));
return 0;
} | [
"noreply@github.com"
] | CleversonCAS.noreply@github.com |
8dd06b339e5b109a0261dbefd302a04fcf9ff670 | df983affa658d3169aebcd95e255c7cafccf1aa0 | /devel/include/sensor_msgs/Illuminance.h | 235b0c81d8c5bcfdff7704b32b9ef9f6410b9fab | [] | no_license | Ektachaurasia/Backup | 17045d3cd3185ca47c53b02298fe1c123ee8a058 | e5ab8532f6cd599ebe4b501626ddba2c6c5d83ab | refs/heads/main | 2023-06-20T21:49:54.092227 | 2021-07-28T04:31:15 | 2021-07-28T04:31:15 | 390,155,001 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,125 | h | // Generated by gencpp from file sensor_msgs/Illuminance.msg
// DO NOT EDIT!
#ifndef SENSOR_MSGS_MESSAGE_ILLUMINANCE_H
#define SENSOR_MSGS_MESSAGE_ILLUMINANCE_H
#include <string>
#include <vector>
#include <map>
#include <ros/types.h>
#include <ros/serialization.h>
#include <ros/builtin_message_traits.h>
#include <ros/message_operations.h>
#include <std_msgs/Header.h>
namespace sensor_msgs
{
template <class ContainerAllocator>
struct Illuminance_
{
typedef Illuminance_<ContainerAllocator> Type;
Illuminance_()
: header()
, illuminance(0.0)
, variance(0.0) {
}
Illuminance_(const ContainerAllocator& _alloc)
: header(_alloc)
, illuminance(0.0)
, variance(0.0) {
(void)_alloc;
}
typedef ::std_msgs::Header_<ContainerAllocator> _header_type;
_header_type header;
typedef double _illuminance_type;
_illuminance_type illuminance;
typedef double _variance_type;
_variance_type variance;
typedef boost::shared_ptr< ::sensor_msgs::Illuminance_<ContainerAllocator> > Ptr;
typedef boost::shared_ptr< ::sensor_msgs::Illuminance_<ContainerAllocator> const> ConstPtr;
}; // struct Illuminance_
typedef ::sensor_msgs::Illuminance_<std::allocator<void> > Illuminance;
typedef boost::shared_ptr< ::sensor_msgs::Illuminance > IlluminancePtr;
typedef boost::shared_ptr< ::sensor_msgs::Illuminance const> IlluminanceConstPtr;
// constants requiring out of line definition
template<typename ContainerAllocator>
std::ostream& operator<<(std::ostream& s, const ::sensor_msgs::Illuminance_<ContainerAllocator> & v)
{
ros::message_operations::Printer< ::sensor_msgs::Illuminance_<ContainerAllocator> >::stream(s, "", v);
return s;
}
template<typename ContainerAllocator1, typename ContainerAllocator2>
bool operator==(const ::sensor_msgs::Illuminance_<ContainerAllocator1> & lhs, const ::sensor_msgs::Illuminance_<ContainerAllocator2> & rhs)
{
return lhs.header == rhs.header &&
lhs.illuminance == rhs.illuminance &&
lhs.variance == rhs.variance;
}
template<typename ContainerAllocator1, typename ContainerAllocator2>
bool operator!=(const ::sensor_msgs::Illuminance_<ContainerAllocator1> & lhs, const ::sensor_msgs::Illuminance_<ContainerAllocator2> & rhs)
{
return !(lhs == rhs);
}
} // namespace sensor_msgs
namespace ros
{
namespace message_traits
{
template <class ContainerAllocator>
struct IsMessage< ::sensor_msgs::Illuminance_<ContainerAllocator> >
: TrueType
{ };
template <class ContainerAllocator>
struct IsMessage< ::sensor_msgs::Illuminance_<ContainerAllocator> const>
: TrueType
{ };
template <class ContainerAllocator>
struct IsFixedSize< ::sensor_msgs::Illuminance_<ContainerAllocator> >
: FalseType
{ };
template <class ContainerAllocator>
struct IsFixedSize< ::sensor_msgs::Illuminance_<ContainerAllocator> const>
: FalseType
{ };
template <class ContainerAllocator>
struct HasHeader< ::sensor_msgs::Illuminance_<ContainerAllocator> >
: TrueType
{ };
template <class ContainerAllocator>
struct HasHeader< ::sensor_msgs::Illuminance_<ContainerAllocator> const>
: TrueType
{ };
template<class ContainerAllocator>
struct MD5Sum< ::sensor_msgs::Illuminance_<ContainerAllocator> >
{
static const char* value()
{
return "8cf5febb0952fca9d650c3d11a81a188";
}
static const char* value(const ::sensor_msgs::Illuminance_<ContainerAllocator>&) { return value(); }
static const uint64_t static_value1 = 0x8cf5febb0952fca9ULL;
static const uint64_t static_value2 = 0xd650c3d11a81a188ULL;
};
template<class ContainerAllocator>
struct DataType< ::sensor_msgs::Illuminance_<ContainerAllocator> >
{
static const char* value()
{
return "sensor_msgs/Illuminance";
}
static const char* value(const ::sensor_msgs::Illuminance_<ContainerAllocator>&) { return value(); }
};
template<class ContainerAllocator>
struct Definition< ::sensor_msgs::Illuminance_<ContainerAllocator> >
{
static const char* value()
{
return " # Single photometric illuminance measurement. Light should be assumed to be\n"
" # measured along the sensor's x-axis (the area of detection is the y-z plane).\n"
" # The illuminance should have a 0 or positive value and be received with\n"
" # the sensor's +X axis pointing toward the light source.\n"
"\n"
" # Photometric illuminance is the measure of the human eye's sensitivity of the\n"
" # intensity of light encountering or passing through a surface.\n"
"\n"
" # All other Photometric and Radiometric measurements should\n"
" # not use this message.\n"
" # This message cannot represent:\n"
" # Luminous intensity (candela/light source output)\n"
" # Luminance (nits/light output per area)\n"
" # Irradiance (watt/area), etc.\n"
"\n"
" Header header # timestamp is the time the illuminance was measured\n"
" # frame_id is the location and direction of the reading\n"
"\n"
" float64 illuminance # Measurement of the Photometric Illuminance in Lux.\n"
"\n"
" float64 variance # 0 is interpreted as variance unknown\n"
"================================================================================\n"
"MSG: std_msgs/Header\n"
"# Standard metadata for higher-level stamped data types.\n"
"# This is generally used to communicate timestamped data \n"
"# in a particular coordinate frame.\n"
"# \n"
"# sequence ID: consecutively increasing ID \n"
"uint32 seq\n"
"#Two-integer timestamp that is expressed as:\n"
"# * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n"
"# * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n"
"# time-handling sugar is provided by the client library\n"
"time stamp\n"
"#Frame this data is associated with\n"
"string frame_id\n"
;
}
static const char* value(const ::sensor_msgs::Illuminance_<ContainerAllocator>&) { return value(); }
};
} // namespace message_traits
} // namespace ros
namespace ros
{
namespace serialization
{
template<class ContainerAllocator> struct Serializer< ::sensor_msgs::Illuminance_<ContainerAllocator> >
{
template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m)
{
stream.next(m.header);
stream.next(m.illuminance);
stream.next(m.variance);
}
ROS_DECLARE_ALLINONE_SERIALIZER
}; // struct Illuminance_
} // namespace serialization
} // namespace ros
namespace ros
{
namespace message_operations
{
template<class ContainerAllocator>
struct Printer< ::sensor_msgs::Illuminance_<ContainerAllocator> >
{
template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::sensor_msgs::Illuminance_<ContainerAllocator>& v)
{
s << indent << "header: ";
s << std::endl;
Printer< ::std_msgs::Header_<ContainerAllocator> >::stream(s, indent + " ", v.header);
s << indent << "illuminance: ";
Printer<double>::stream(s, indent + " ", v.illuminance);
s << indent << "variance: ";
Printer<double>::stream(s, indent + " ", v.variance);
}
};
} // namespace message_operations
} // namespace ros
#endif // SENSOR_MSGS_MESSAGE_ILLUMINANCE_H
| [
"ektachaurasia02@gmail.com"
] | ektachaurasia02@gmail.com |
e4d80960a0363677b2872fd6e8175992ec3d3b66 | ec9fb45bee21b26554ab3d57f1e2239f8379c41c | /include/bela/terminal.hpp | 7193c6c233b2a68e6823044feedd4c4b62cc8412 | [
"Apache-2.0"
] | permissive | Isabellarossi/bela | fb9d8ebc3585767a164b059d7247034d3549db18 | 3342e779439205ef37c81adacd3231e1559f107c | refs/heads/master | 2023-01-13T21:32:22.363526 | 2020-11-23T14:15:43 | 2020-11-23T14:15:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,183 | hpp | //
#ifndef BELA_TERMINAL_HPP
#define BELA_TERMINAL_HPP
#include "base.hpp"
#include "fmt.hpp"
namespace bela {
namespace terminal {
//
// Is same terminal maybe console or Cygwin pty
bool IsSameTerminal(HANDLE fd);
bool IsSameTerminal(FILE *fd);
// Is console terminal
bool IsTerminal(HANDLE fd);
bool IsTerminal(FILE *fd);
// Is cygwin terminal
bool IsCygwinTerminal(HANDLE fd);
bool IsCygwinTerminal(FILE *fd);
struct terminal_size {
uint32_t columns;
uint32_t rows;
};
bool TerminalSize(HANDLE fd, terminal_size &sz);
bool TerminalSize(FILE *fd, terminal_size &sz);
bela::ssize_t WriteTerminal(HANDLE fd, std::wstring_view data);
bela::ssize_t WriteSameFile(HANDLE fd, std::wstring_view data);
bela::ssize_t WriteSameFile(HANDLE fd, std::string_view data);
// Warning, currently bela :: terminal :: WriteAuto does not support redirect
// operations like freopen, please do not use this
bela::ssize_t WriteAuto(FILE *fd, std::wstring_view data);
// UTF-8 version cache write
bela::ssize_t WriteAuto(FILE *fd, std::string_view data);
// If you need to call freopen, you should use the following:
bela::ssize_t WriteAutoFallback(FILE *fd, std::wstring_view data);
// UTF-8 version direct write
bela::ssize_t WriteAutoFallback(FILE *fd, std::string_view data);
} // namespace terminal
template <typename... Args> ssize_t FPrintF(FILE *out, const wchar_t *fmt, Args... args) {
const format_internal::FormatArg arg_array[] = {args...};
auto str = format_internal::StrFormatInternal(fmt, arg_array, sizeof...(args));
return bela::terminal::WriteAuto(out, str);
}
inline ssize_t FPrintF(FILE *out, const wchar_t *fmt) {
auto str = StrFormat(fmt);
return bela::terminal::WriteAuto(out, str);
}
template <typename... Args> ssize_t FPrintFallbackF(FILE *out, const wchar_t *fmt, Args... args) {
const format_internal::FormatArg arg_array[] = {args...};
auto str = format_internal::StrFormatInternal(fmt, arg_array, sizeof...(args));
return bela::terminal::WriteAutoFallback(out, str);
}
inline ssize_t FPrintFallbackF(FILE *out, const wchar_t *fmt) {
auto str = StrFormat(fmt);
return bela::terminal::WriteAutoFallback(out, str);
}
} // namespace bela
#endif | [
"charlieio@outlook.com"
] | charlieio@outlook.com |
e4e75d138da72fa9b727dceccec14311bafd81ab | b1e2d2211fcec5dd16ce0726ea528dd6bfe668f3 | /KyouEngine/src/Shader.cpp | e06e9e36885842ddbe36e2d9d50bef172cb2ad34 | [] | no_license | kyoushiiro/KyouEngine | 1d9381b5f1707d5ff79a252905ab7bd1f2a27f7b | dcef78025352ac96b3f61443e2128de2139b3d61 | refs/heads/master | 2022-04-07T12:21:13.028659 | 2020-03-09T07:33:55 | 2020-03-09T07:33:55 | 240,673,193 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,907 | cpp | #include "Shader.h"
Shader::Shader(const char* vertexPath, const char* fragmentPath)
{
// retrieve the vertex/fragment source code from file paths
std::string vertexCode;
std::string fragmentCode;
std::ifstream vShaderFile;
std::ifstream fShaderFile;
// ensure ifstream objects can throw exceptions
vShaderFile.exceptions(std::ifstream::failbit | std::ifstream::badbit);
fShaderFile.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try {
vShaderFile.open(vertexPath);
fShaderFile.open(fragmentPath);
std::stringstream vShaderStream, fShaderStream;
vShaderStream << vShaderFile.rdbuf();
fShaderStream << fShaderFile.rdbuf();
vShaderFile.close();
fShaderFile.close();
vertexCode = vShaderStream.str();
fragmentCode = fShaderStream.str();
}
catch (std::ifstream::failure e) {
std::cout << "ERROR::SHADER::FILE_NOT_SUCCESSFULLY_READ" << std::endl;
}
const char* vShaderCode = vertexCode.c_str();
const char* fShaderCode = fragmentCode.c_str();
unsigned int vertex, fragment;
vertex = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertex, 1, &vShaderCode, NULL);
glCompileShader(vertex);
checkCompileErrors(vertex, "VERTEX");
fragment = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fragment, 1, &fShaderCode, NULL);
glCompileShader(fragment);
checkCompileErrors(fragment, "FRAGMENT");
this->ID = glCreateProgram();
glAttachShader(ID, vertex);
glAttachShader(ID, fragment);
glLinkProgram(ID);
checkCompileErrors(ID, "PROGRAM");
glDeleteShader(vertex);
glDeleteShader(fragment);
this->use();
}
void Shader::use()
{
glUseProgram(this->ID);
}
void Shader::setBool(const std::string &name, bool value) const
{
glUniform1i(glGetUniformLocation(this->ID, name.c_str()), (int)value);
}
void Shader::setInt(const std::string& name, int value) const
{
glUniform1i(glGetUniformLocation(this->ID, name.c_str()), value);
}
void Shader::setFloat(const std::string& name, float value) const
{
glUniform1f(glGetUniformLocation(this->ID, name.c_str()), value);
}
void Shader::checkCompileErrors(unsigned int shader, std::string type)
{
int success;
char infoLog[1024];
if (type != "PROGRAM") {
glGetShaderiv(shader, GL_COMPILE_STATUS, &success);
if (!success) {
glGetShaderInfoLog(shader, 1024, NULL, infoLog);
std::cout << "ERROR::SHADER_COMPILATION_ERROR of type: "
<< type << "\n" << infoLog << "\n";
}
}
else {
glGetProgramiv(shader, GL_LINK_STATUS, &success);
if (!success) {
glGetProgramInfoLog(shader, 1024, NULL, infoLog);
std::cout << "ERROR::PROGRAM_LINKING_ERROR of type: "
<< type << "\n" << infoLog << "\n";
}
}
} | [
"aylam@ucsc.edu"
] | aylam@ucsc.edu |
5c5feaee981adcec20c097d1c293aa03310da477 | 60e322eb94713ec92f62ce06de3fa3de48bb4a6f | /mar25/a1.cpp | 40b0eb4755fb1e09499981624ca27fb69fcd91b8 | [] | no_license | Nwon2464/cpp | 68d83bfae8ab8402027b48192e177c32c47e5e73 | e275e4be1ca1bee54d110e1e80c7559a2b4384c7 | refs/heads/master | 2023-06-12T09:00:24.361735 | 2021-07-11T06:22:58 | 2021-07-11T06:22:58 | 347,665,952 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,650 | cpp | #include <bits/stdc++.h>
using namespace std;
//Warsaw debug template
#define LOCAL
#define sim template <class c
#define ris return *this
#define dor > debug& operator<<
#define eni(x) \
sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) \
{
sim > struct rge {
c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c> { i, j }; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug()
{
cerr << endl;
}
eni(!=) cerr << boolalpha << i;
ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
ris << "(" << d.first << "," << d.second << ")";
}
sim dor(rge<c> d)
{
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << "," + (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&)
{
ris;
}
#endif
}
;
#define imie(...) "[" << #__VA_ARGS__ ":" << (__VA_ARGS__) << "]"
//End of debug template
//Codeforces Round #481 (Div. 3) A-Remove Duplicates
//tip : use visted array to check to see if elements are duplicate
using ll = long long;
int vis[1005] = { 0 };
int main()
{
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<int> ans;
for (int i = n - 1; i >= 0; i--) {
if (vis[a[i]] == 0) {
vis[a[i]] = 1;
ans.push_back(a[i]);
}
}
reverse(ans.begin(), ans.end());
cout << ans.size() << "\n";
for (auto it : ans) {
cout << it << " ";
}
return 0;
}
| [
"nwon2464@gmail.com"
] | nwon2464@gmail.com |
b542547eb0e63b034249b368247db05b7c004bda | 9dd4edf1b1e5384677ae1eb09fe3a91ed8d76d41 | /prog01.cpp | 0f799e33d1b6ec71013655e9ff95fb5c54593f28 | [] | no_license | abeldjesusp/code_cpp | 48fb158de4f11b7c757db7b014b627bd96b5e515 | 114752b71faf0f0ec534bdabdd8db54d6dfc8f20 | refs/heads/master | 2021-08-31T21:04:52.077341 | 2017-12-22T22:57:13 | 2017-12-22T22:57:13 | 115,154,713 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,100 | cpp | /**********************
* *
* Programa 01 *
* *
*********************/
#include <iostream>
using namespace std;
struct Nomina{
char nombre[30];
float sueldo1;
float sueldo2;
float sueldo3;
float totalIngresos;
}empleados[4];
int main(){
float ingresoMayor = 0;
char j;
for(int i = 0; i < 4; i++){
cout << "Nombre : ";
cin >> empleados[i].nombre;
cout << "Sueldo 1: ";
cin >> empleados[i].sueldo1;
cout << "Sueldo 2: ";
cin >> empleados[i].sueldo2;
cout << "Sueldo 3: ";
cin >> empleados[i].sueldo3;
cout << endl;
empleados[i].totalIngresos = empleados[i].sueldo1 + empleados[i].sueldo2 + empleados[i].sueldo3;
}
for(int i = 0; i < 4; i++){
cout << "Nombre : " << empleados[i].nombre << endl;
cout << "Total de ingresos : " << empleados[i].totalIngresos << endl;
cout << endl;
if(ingresoMayor < empleados[i].totalIngresos){
ingresoMayor = empleados[i].totalIngresos;
j = i;
}
}
cout << "Empleado con mayores ingresos" << endl;
cout << empleados[j].nombre << endl;
cout << ingresoMayor << endl;
return 0;
} | [
"abeldjesusp@gmail.com"
] | abeldjesusp@gmail.com |
1b2bae87740ae4c6884380a818c2b5fc3bb280be | d9af6ca49774c009c4b277c24fb78f796fe8476b | /src/invalid.cpp | 148d2be5dc8b6f935a9cfd3e450297a66d83b628 | [
"MIT"
] | permissive | loxevesavu/Ingenuity | 7924abf996ca1b96885b961b924a565b7fd41312 | f57a4d8f089c245d0d7ea676dd4573bb30c05300 | refs/heads/master | 2020-04-25T22:34:05.740695 | 2018-12-11T05:56:01 | 2018-12-11T05:56:01 | 173,115,384 | 0 | 0 | null | 2019-02-28T13:17:58 | 2019-02-28T13:17:57 | null | UTF-8 | C++ | false | false | 2,326 | cpp | // Copyright (c) 2018 The Ingenuity developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "invalid.h"
#include "invalid_outpoints.json.h"
#include "invalid_serials.json.h"
namespace invalid_out
{
std::set<CBigNum> setInvalidSerials;
std::set<COutPoint> setInvalidOutPoints;
UniValue read_json(const std::string& jsondata)
{
UniValue v;
if (!v.read(jsondata) || !v.isArray())
{
return UniValue(UniValue::VARR);
}
return v.get_array();
}
bool LoadOutpoints()
{
UniValue v = read_json(LoadInvalidOutPoints());
if (v.empty())
return false;
for (unsigned int idx = 0; idx < v.size(); idx++) {
const UniValue &val = v[idx];
const UniValue &o = val.get_obj();
const UniValue &vTxid = find_value(o, "txid");
if (!vTxid.isStr())
return false;
uint256 txid = uint256(vTxid.get_str());
if (txid == 0)
return false;
const UniValue &vN = find_value(o, "n");
if (!vN.isNum())
return false;
auto n = static_cast<uint32_t>(vN.get_int());
COutPoint out(txid, n);
setInvalidOutPoints.insert(out);
}
return true;
}
bool LoadSerials()
{
UniValue v = read_json(LoadInvalidSerials());
if (v.empty())
return false;
for (unsigned int idx = 0; idx < v.size(); idx++) {
const UniValue &val = v[idx];
const UniValue &o = val.get_obj();
const UniValue &vSerial = find_value(o, "s");
if (!vSerial.isStr())
return false;
CBigNum bnSerial = 0;
bnSerial.SetHex(vSerial.get_str());
if (bnSerial == 0)
return false;
setInvalidSerials.insert(bnSerial);
}
return true;
}
bool ContainsOutPoint(const COutPoint& out)
{
return static_cast<bool>(setInvalidOutPoints.count(out));
}
bool ContainsSerial(const CBigNum& bnSerial)
{
return static_cast<bool>(setInvalidSerials.count(bnSerial));
}
}
| [
"44764450+IngenuityCoin@users.noreply.github.com"
] | 44764450+IngenuityCoin@users.noreply.github.com |
e0faba914035b4961ce6ee7f6a16cb23a29eeea3 | 7896cbc2ee03ffda1a3ef50dd72b65ffed0db61e | /The one with gcd using while loop.cpp | 6d959ff1b746256d840e601dae221568e128d22b | [
"MIT"
] | permissive | chinmoyee-A/C-Language | b13e44244fd7daf544f104e772ebcca31d0b65b3 | a5d985e84c953c8dcc4074dfd3e96d1539cb1d3e | refs/heads/master | 2023-01-07T02:31:27.071016 | 2020-10-29T13:19:06 | 2020-10-29T13:19:06 | 299,307,714 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 225 | cpp | #include<stdio.h>
int main()
{
int n1,n2;
printf("Enter two positive integer:");
scanf("%d%d",&n1,&n2);
while(n1!=n2)
{
if(n1>n2)
n1=n1-n2;
else
n2=n2-n1;
}
printf("GCD:%d",n1,n2);
return 0;
}
| [
"noreply@github.com"
] | chinmoyee-A.noreply@github.com |
c30cf66bd228bc01ace873b7f2e77a655152b431 | f0a8be48a873d1e1841f60bd2ab87089b3be1869 | /wk12/wk12.ino | b40f721ddd971bc520cdb90c989a68cf34f9ab59 | [] | no_license | scream870102/Arduino | 794b789d04997b10e3dabcce4aa121ae6e37ef5f | 2f065fa6d1b1bb6bc9f339ee3a47b19baa34d4d5 | refs/heads/master | 2021-01-20T08:07:49.946153 | 2017-11-08T12:37:43 | 2017-11-08T12:37:43 | 90,104,462 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,803 | ino | byte seven_seg_digits[16][7] = { { 1,1,1,1,1,1,0 }, // = 0
{ 0,1,1,0,0,0,0 }, // = 1
{ 1,1,0,1,1,0,1 }, // = 2
{ 1,1,1,1,0,0,1 }, // = 3
{ 0,1,1,0,0,1,1 }, // = 4
{ 1,0,1,1,0,1,1 }, // = 5
{ 1,0,1,1,1,1,1 }, // = 6
{ 1,1,1,0,0,0,0 }, // = 7
{ 1,1,1,1,1,1,1 }, // = 8
{ 1,1,1,0,0,1,1 }, // = 9
{ 1,1,1,0,1,1,1 }, //A
{ 0,0,1,1,1,1,1 }, //B
{ 1,0,0,1,1,1,0 }, //C
{ 0,1,1,1,1,0,1 }, //D
{ 1,0,0,1,1,1,1 }, //E
{ 1,0,0,0,1,1,1 } //F
};
const int buttonPin = 12;
int buttonState = 0;
int num = 0;
void sevenSegWrite(byte digit) {
byte pin = 2;
for (byte seg = 0; seg < 7; ++seg) {
digitalWrite(pin, seven_seg_digits[digit][seg]);
++pin;
}
}
void setup() {
// put your setup code here, to run once:
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
digitalWrite(9, 0); // 關閉小數點
digitalWrite(buttonPin,HIGH);
pinMode(buttonPin,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
buttonState = digitalRead(buttonPin);
if(buttonState == HIGH){
num ++;
if(num > 15){
num = 0;
}
}
sevenSegWrite(num);
delay(1000);
}
| [
"noreply@github.com"
] | scream870102.noreply@github.com |
f85d27f94bbde21852d4831838b2a2cc4b028b22 | f6ba36e6c9ff4a9b861e8115dc32a40fa1a5c26c | /Source/Strider/Public/BoneChain.h | baee89742a95b27df4d13fa905aa352310afe70a | [] | no_license | Tabroid/AlphaOne | 57b4211d024d4efa48b57634111bb0445e9eb0ba | 3ed7abed40d6c5a09e3b93e2c4a5af2194a7c36f | refs/heads/master | 2023-08-02T04:41:26.395756 | 2021-09-15T04:28:04 | 2021-09-15T04:28:04 | 387,068,779 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,547 | h | // Copyright 2020 Kenneth Claassen, All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "BoneContainer.h"
#include "BonePose.h"
#include "EStriderEnumerations.h"
#include "BoneChain.generated.h"
/** A data structure representing a single bone in a bone chain */
USTRUCT(BlueprintType)
struct FBoneChainLink
{
GENERATED_BODY()
public:
/** Reference to the bone which is part of this chain link */
UPROPERTY(EditAnywhere, Category = Settings)
FBoneReference Bone;
/** The weight of this chain link */
UPROPERTY(EditAnywhere, Category = Settings, meta = (ClampMin = -1.0f, ClampMax = 1.0f))
float Weight;
float NormalizedWeight;
public:
FBoneChainLink();
};
/** A data structure representing a bone chain in a local space pose */
USTRUCT(BlueprintType)
struct FBoneChain
{
GENERATED_BODY()
public:
/** A list defining a bone chain */
UPROPERTY(EditAnywhere, Category = BoneReferences)
TArray<FBoneChainLink> BoneChain;
TArray<FCompactPoseBoneIndex> RootToAnchorBoneIndexHierarchy;
public:
FBoneChain();
void Initialize(const FBoneContainer& BoneContainer);
bool ValidateData(const FBoneContainer& BoneContainer);
void CalculateAnchorRotation(FQuat& OutAnchorRotation_CS, const FCompactPose& CompactPose);
void ApplyComponentSpaceRotation(FCompactPose& CompactPose, FQuat& AnchorRotation_CS,
FVector Axis, float Angle/*Radians*/, float alpha = 1.0f);
private:
void InitializeBoneChain(const FBoneContainer& BoneContainer);
void InitializeRootToAnchorHierarchy(const FBoneContainer& BoneContainer);
}; | [
"pengc2019@gmail.com"
] | pengc2019@gmail.com |
8f34d110b262b938063ef018b3682e14b54686a5 | af2bcb03b0ca34e376084eb8676666306e2dde99 | /ext/googletest/googletest/test/gtest-port_test.cc | 240a99040f93d3431c70a31835bafad8ee0bbc40 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license",
"LGPL-2.0-or-later",
"MIT"
] | permissive | multifacet/ASAP | 5c0b26dd2f06cd3c125e809b318c16721720f5e2 | 68cb32c43e3ebad2a5dfb947ce98442375b235c7 | refs/heads/asap | 2023-04-11T16:02:42.997035 | 2021-11-30T15:05:22 | 2021-11-30T15:05:22 | 426,381,088 | 4 | 2 | BSD-3-Clause | 2022-12-12T23:33:17 | 2021-11-09T20:43:59 | C++ | UTF-8 | C++ | false | false | 40,501 | cc | // Copyright 2008, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Authors: vladl@google.com (Vlad Losev), wan@google.com (Zhanyong Wan)
//
// This file tests the internal cross-platform support utilities.
#include <cstdio>
#include "gtest/internal/gtest-port.h"
#if GTEST_OS_MAC
# include <time.h>
#endif // GTEST_OS_MAC
#include <list>
#include <utility> // For std::pair and std::make_pair.
#include <vector>
#include "gtest/gtest-spi.h"
#include "gtest/gtest.h"
// Indicates that this translation unit is part of Google Test's
// implementation. It must come before gtest-internal-inl.h is
// included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in
// his code.
#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
#undef GTEST_IMPLEMENTATION_
using std::make_pair;
using std::pair;
namespace testing {
namespace internal {
TEST(IsXDigitTest, WorksForNarrowAscii) {
EXPECT_TRUE(IsXDigit('0'));
EXPECT_TRUE(IsXDigit('9'));
EXPECT_TRUE(IsXDigit('A'));
EXPECT_TRUE(IsXDigit('F'));
EXPECT_TRUE(IsXDigit('a'));
EXPECT_TRUE(IsXDigit('f'));
EXPECT_FALSE(IsXDigit('-'));
EXPECT_FALSE(IsXDigit('g'));
EXPECT_FALSE(IsXDigit('G'));
}
TEST(IsXDigitTest, ReturnsFalseForNarrowNonAscii) {
EXPECT_FALSE(IsXDigit('\x80'));
EXPECT_FALSE(IsXDigit(static_cast<char>('0' | '\x80')));
}
TEST(IsXDigitTest, WorksForWideAscii) {
EXPECT_TRUE(IsXDigit(L'0'));
EXPECT_TRUE(IsXDigit(L'9'));
EXPECT_TRUE(IsXDigit(L'A'));
EXPECT_TRUE(IsXDigit(L'F'));
EXPECT_TRUE(IsXDigit(L'a'));
EXPECT_TRUE(IsXDigit(L'f'));
EXPECT_FALSE(IsXDigit(L'-'));
EXPECT_FALSE(IsXDigit(L'g'));
EXPECT_FALSE(IsXDigit(L'G'));
}
TEST(IsXDigitTest, ReturnsFalseForWideNonAscii) {
EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(0x80)));
EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(L'0' | 0x80)));
EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(L'0' | 0x100)));
}
class Base {
public:
// Copy constructor and assignment operator do exactly what we need, so we
// use them.
Base() : member_(0) {}
explicit Base(int n) : member_(n) {}
virtual ~Base() {}
int member() { return member_; }
private:
int member_;
};
class Derived : public Base {
public:
explicit Derived(int n) : Base(n) {}
};
TEST(ImplicitCastTest, ConvertsPointers) {
Derived derived(0);
EXPECT_TRUE(&derived == ::testing::internal::ImplicitCast_<Base*>(&derived));
}
TEST(ImplicitCastTest, CanUseInheritance) {
Derived derived(1);
Base base = ::testing::internal::ImplicitCast_<Base>(derived);
EXPECT_EQ(derived.member(), base.member());
}
class Castable {
public:
explicit Castable(bool* converted) : converted_(converted) {}
operator Base() {
*converted_ = true;
return Base();
}
private:
bool* converted_;
};
TEST(ImplicitCastTest, CanUseNonConstCastOperator) {
bool converted = false;
Castable castable(&converted);
Base base = ::testing::internal::ImplicitCast_<Base>(castable);
EXPECT_TRUE(converted);
}
class ConstCastable {
public:
explicit ConstCastable(bool* converted) : converted_(converted) {}
operator Base() const {
*converted_ = true;
return Base();
}
private:
bool* converted_;
};
TEST(ImplicitCastTest, CanUseConstCastOperatorOnConstValues) {
bool converted = false;
const ConstCastable const_castable(&converted);
Base base = ::testing::internal::ImplicitCast_<Base>(const_castable);
EXPECT_TRUE(converted);
}
class ConstAndNonConstCastable {
public:
ConstAndNonConstCastable(bool* converted, bool* const_converted)
: converted_(converted), const_converted_(const_converted) {}
operator Base() {
*converted_ = true;
return Base();
}
operator Base() const {
*const_converted_ = true;
return Base();
}
private:
bool* converted_;
bool* const_converted_;
};
TEST(ImplicitCastTest, CanSelectBetweenConstAndNonConstCasrAppropriately) {
bool converted = false;
bool const_converted = false;
ConstAndNonConstCastable castable(&converted, &const_converted);
Base base = ::testing::internal::ImplicitCast_<Base>(castable);
EXPECT_TRUE(converted);
EXPECT_FALSE(const_converted);
converted = false;
const_converted = false;
const ConstAndNonConstCastable const_castable(&converted, &const_converted);
base = ::testing::internal::ImplicitCast_<Base>(const_castable);
EXPECT_FALSE(converted);
EXPECT_TRUE(const_converted);
}
class To {
public:
To(bool* converted) { *converted = true; } // NOLINT
};
TEST(ImplicitCastTest, CanUseImplicitConstructor) {
bool converted = false;
To to = ::testing::internal::ImplicitCast_<To>(&converted);
(void)to;
EXPECT_TRUE(converted);
}
TEST(IteratorTraitsTest, WorksForSTLContainerIterators) {
StaticAssertTypeEq<int,
IteratorTraits< ::std::vector<int>::const_iterator>::value_type>();
StaticAssertTypeEq<bool,
IteratorTraits< ::std::list<bool>::iterator>::value_type>();
}
TEST(IteratorTraitsTest, WorksForPointerToNonConst) {
StaticAssertTypeEq<char, IteratorTraits<char*>::value_type>();
StaticAssertTypeEq<const void*, IteratorTraits<const void**>::value_type>();
}
TEST(IteratorTraitsTest, WorksForPointerToConst) {
StaticAssertTypeEq<char, IteratorTraits<const char*>::value_type>();
StaticAssertTypeEq<const void*,
IteratorTraits<const void* const*>::value_type>();
}
// Tests that the element_type typedef is available in scoped_ptr and refers
// to the parameter type.
TEST(ScopedPtrTest, DefinesElementType) {
StaticAssertTypeEq<int, ::testing::internal::scoped_ptr<int>::element_type>();
}
// TODO(vladl@google.com): Implement THE REST of scoped_ptr tests.
TEST(GtestCheckSyntaxTest, BehavesLikeASingleStatement) {
if (AlwaysFalse())
GTEST_CHECK_(false) << "This should never be executed; "
"It's a compilation test only.";
if (AlwaysTrue())
GTEST_CHECK_(true);
else
; // NOLINT
if (AlwaysFalse())
; // NOLINT
else
GTEST_CHECK_(true) << "";
}
TEST(GtestCheckSyntaxTest, WorksWithSwitch) {
switch (0) {
case 1:
break;
default:
GTEST_CHECK_(true);
}
switch (0)
case 0:
GTEST_CHECK_(true) << "Check failed in switch case";
}
// Verifies behavior of FormatFileLocation.
TEST(FormatFileLocationTest, FormatsFileLocation) {
EXPECT_PRED_FORMAT2(IsSubstring, "foo.cc", FormatFileLocation("foo.cc", 42));
EXPECT_PRED_FORMAT2(IsSubstring, "42", FormatFileLocation("foo.cc", 42));
}
TEST(FormatFileLocationTest, FormatsUnknownFile) {
EXPECT_PRED_FORMAT2(
IsSubstring, "unknown file", FormatFileLocation(NULL, 42));
EXPECT_PRED_FORMAT2(IsSubstring, "42", FormatFileLocation(NULL, 42));
}
TEST(FormatFileLocationTest, FormatsUknownLine) {
EXPECT_EQ("foo.cc:", FormatFileLocation("foo.cc", -1));
}
TEST(FormatFileLocationTest, FormatsUknownFileAndLine) {
EXPECT_EQ("unknown file:", FormatFileLocation(NULL, -1));
}
// Verifies behavior of FormatCompilerIndependentFileLocation.
TEST(FormatCompilerIndependentFileLocationTest, FormatsFileLocation) {
EXPECT_EQ("foo.cc:42", FormatCompilerIndependentFileLocation("foo.cc", 42));
}
TEST(FormatCompilerIndependentFileLocationTest, FormatsUknownFile) {
EXPECT_EQ("unknown file:42",
FormatCompilerIndependentFileLocation(NULL, 42));
}
TEST(FormatCompilerIndependentFileLocationTest, FormatsUknownLine) {
EXPECT_EQ("foo.cc", FormatCompilerIndependentFileLocation("foo.cc", -1));
}
TEST(FormatCompilerIndependentFileLocationTest, FormatsUknownFileAndLine) {
EXPECT_EQ("unknown file", FormatCompilerIndependentFileLocation(NULL, -1));
}
#if GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_QNX
void* ThreadFunc(void* data) {
internal::Mutex* mutex = static_cast<internal::Mutex*>(data);
mutex->Lock();
mutex->Unlock();
return NULL;
}
TEST(GetThreadCountTest, ReturnsCorrectValue) {
const size_t starting_count = GetThreadCount();
pthread_t thread_id;
internal::Mutex mutex;
{
internal::MutexLock lock(&mutex);
pthread_attr_t attr;
ASSERT_EQ(0, pthread_attr_init(&attr));
ASSERT_EQ(0, pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE));
const int status = pthread_create(&thread_id, &attr, &ThreadFunc, &mutex);
ASSERT_EQ(0, pthread_attr_destroy(&attr));
ASSERT_EQ(0, status);
EXPECT_EQ(starting_count + 1, GetThreadCount());
}
void* dummy;
ASSERT_EQ(0, pthread_join(thread_id, &dummy));
// The OS may not immediately report the updated thread count after
// joining a thread, causing flakiness in this test. To counter that, we
// wait for up to .5 seconds for the OS to report the correct value.
for (int i = 0; i < 5; ++i) {
if (GetThreadCount() == starting_count)
break;
SleepMilliseconds(100);
}
EXPECT_EQ(starting_count, GetThreadCount());
}
#else
TEST(GetThreadCountTest, ReturnsZeroWhenUnableToCountThreads) {
EXPECT_EQ(0U, GetThreadCount());
}
#endif // GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_QNX
TEST(GtestCheckDeathTest, DiesWithCorrectOutputOnFailure) {
const bool a_false_condition = false;
const char regex[] =
#ifdef _MSC_VER
"gtest-port_test\\.cc\\(\\d+\\):"
#elif GTEST_USES_POSIX_RE
"gtest-port_test\\.cc:[0-9]+"
#else
"gtest-port_test\\.cc:\\d+"
#endif // _MSC_VER
".*a_false_condition.*Extra info.*";
EXPECT_DEATH_IF_SUPPORTED(GTEST_CHECK_(a_false_condition) << "Extra info",
regex);
}
#if GTEST_HAS_DEATH_TEST
TEST(GtestCheckDeathTest, LivesSilentlyOnSuccess) {
EXPECT_EXIT({
GTEST_CHECK_(true) << "Extra info";
::std::cerr << "Success\n";
exit(0); },
::testing::ExitedWithCode(0), "Success");
}
#endif // GTEST_HAS_DEATH_TEST
// Verifies that Google Test choose regular expression engine appropriate to
// the platform. The test will produce compiler errors in case of failure.
// For simplicity, we only cover the most important platforms here.
TEST(RegexEngineSelectionTest, SelectsCorrectRegexEngine) {
#if !GTEST_USES_PCRE
# if GTEST_HAS_POSIX_RE
EXPECT_TRUE(GTEST_USES_POSIX_RE);
# else
EXPECT_TRUE(GTEST_USES_SIMPLE_RE);
# endif
#endif // !GTEST_USES_PCRE
}
#if GTEST_USES_POSIX_RE
# if GTEST_HAS_TYPED_TEST
template <typename Str>
class RETest : public ::testing::Test {};
// Defines StringTypes as the list of all string types that class RE
// supports.
typedef testing::Types<
::std::string,
# if GTEST_HAS_GLOBAL_STRING
::string,
# endif // GTEST_HAS_GLOBAL_STRING
const char*> StringTypes;
TYPED_TEST_CASE(RETest, StringTypes);
// Tests RE's implicit constructors.
TYPED_TEST(RETest, ImplicitConstructorWorks) {
const RE empty(TypeParam(""));
EXPECT_STREQ("", empty.pattern());
const RE simple(TypeParam("hello"));
EXPECT_STREQ("hello", simple.pattern());
const RE normal(TypeParam(".*(\\w+)"));
EXPECT_STREQ(".*(\\w+)", normal.pattern());
}
// Tests that RE's constructors reject invalid regular expressions.
TYPED_TEST(RETest, RejectsInvalidRegex) {
EXPECT_NONFATAL_FAILURE({
const RE invalid(TypeParam("?"));
}, "\"?\" is not a valid POSIX Extended regular expression.");
}
// Tests RE::FullMatch().
TYPED_TEST(RETest, FullMatchWorks) {
const RE empty(TypeParam(""));
EXPECT_TRUE(RE::FullMatch(TypeParam(""), empty));
EXPECT_FALSE(RE::FullMatch(TypeParam("a"), empty));
const RE re(TypeParam("a.*z"));
EXPECT_TRUE(RE::FullMatch(TypeParam("az"), re));
EXPECT_TRUE(RE::FullMatch(TypeParam("axyz"), re));
EXPECT_FALSE(RE::FullMatch(TypeParam("baz"), re));
EXPECT_FALSE(RE::FullMatch(TypeParam("azy"), re));
}
// Tests RE::PartialMatch().
TYPED_TEST(RETest, PartialMatchWorks) {
const RE empty(TypeParam(""));
EXPECT_TRUE(RE::PartialMatch(TypeParam(""), empty));
EXPECT_TRUE(RE::PartialMatch(TypeParam("a"), empty));
const RE re(TypeParam("a.*z"));
EXPECT_TRUE(RE::PartialMatch(TypeParam("az"), re));
EXPECT_TRUE(RE::PartialMatch(TypeParam("axyz"), re));
EXPECT_TRUE(RE::PartialMatch(TypeParam("baz"), re));
EXPECT_TRUE(RE::PartialMatch(TypeParam("azy"), re));
EXPECT_FALSE(RE::PartialMatch(TypeParam("zza"), re));
}
# endif // GTEST_HAS_TYPED_TEST
#elif GTEST_USES_SIMPLE_RE
TEST(IsInSetTest, NulCharIsNotInAnySet) {
EXPECT_FALSE(IsInSet('\0', ""));
EXPECT_FALSE(IsInSet('\0', "\0"));
EXPECT_FALSE(IsInSet('\0', "a"));
}
TEST(IsInSetTest, WorksForNonNulChars) {
EXPECT_FALSE(IsInSet('a', "Ab"));
EXPECT_FALSE(IsInSet('c', ""));
EXPECT_TRUE(IsInSet('b', "bcd"));
EXPECT_TRUE(IsInSet('b', "ab"));
}
TEST(IsAsciiDigitTest, IsFalseForNonDigit) {
EXPECT_FALSE(IsAsciiDigit('\0'));
EXPECT_FALSE(IsAsciiDigit(' '));
EXPECT_FALSE(IsAsciiDigit('+'));
EXPECT_FALSE(IsAsciiDigit('-'));
EXPECT_FALSE(IsAsciiDigit('.'));
EXPECT_FALSE(IsAsciiDigit('a'));
}
TEST(IsAsciiDigitTest, IsTrueForDigit) {
EXPECT_TRUE(IsAsciiDigit('0'));
EXPECT_TRUE(IsAsciiDigit('1'));
EXPECT_TRUE(IsAsciiDigit('5'));
EXPECT_TRUE(IsAsciiDigit('9'));
}
TEST(IsAsciiPunctTest, IsFalseForNonPunct) {
EXPECT_FALSE(IsAsciiPunct('\0'));
EXPECT_FALSE(IsAsciiPunct(' '));
EXPECT_FALSE(IsAsciiPunct('\n'));
EXPECT_FALSE(IsAsciiPunct('a'));
EXPECT_FALSE(IsAsciiPunct('0'));
}
TEST(IsAsciiPunctTest, IsTrueForPunct) {
for (const char* p = "^-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~"; *p; p++) {
EXPECT_PRED1(IsAsciiPunct, *p);
}
}
TEST(IsRepeatTest, IsFalseForNonRepeatChar) {
EXPECT_FALSE(IsRepeat('\0'));
EXPECT_FALSE(IsRepeat(' '));
EXPECT_FALSE(IsRepeat('a'));
EXPECT_FALSE(IsRepeat('1'));
EXPECT_FALSE(IsRepeat('-'));
}
TEST(IsRepeatTest, IsTrueForRepeatChar) {
EXPECT_TRUE(IsRepeat('?'));
EXPECT_TRUE(IsRepeat('*'));
EXPECT_TRUE(IsRepeat('+'));
}
TEST(IsAsciiWhiteSpaceTest, IsFalseForNonWhiteSpace) {
EXPECT_FALSE(IsAsciiWhiteSpace('\0'));
EXPECT_FALSE(IsAsciiWhiteSpace('a'));
EXPECT_FALSE(IsAsciiWhiteSpace('1'));
EXPECT_FALSE(IsAsciiWhiteSpace('+'));
EXPECT_FALSE(IsAsciiWhiteSpace('_'));
}
TEST(IsAsciiWhiteSpaceTest, IsTrueForWhiteSpace) {
EXPECT_TRUE(IsAsciiWhiteSpace(' '));
EXPECT_TRUE(IsAsciiWhiteSpace('\n'));
EXPECT_TRUE(IsAsciiWhiteSpace('\r'));
EXPECT_TRUE(IsAsciiWhiteSpace('\t'));
EXPECT_TRUE(IsAsciiWhiteSpace('\v'));
EXPECT_TRUE(IsAsciiWhiteSpace('\f'));
}
TEST(IsAsciiWordCharTest, IsFalseForNonWordChar) {
EXPECT_FALSE(IsAsciiWordChar('\0'));
EXPECT_FALSE(IsAsciiWordChar('+'));
EXPECT_FALSE(IsAsciiWordChar('.'));
EXPECT_FALSE(IsAsciiWordChar(' '));
EXPECT_FALSE(IsAsciiWordChar('\n'));
}
TEST(IsAsciiWordCharTest, IsTrueForLetter) {
EXPECT_TRUE(IsAsciiWordChar('a'));
EXPECT_TRUE(IsAsciiWordChar('b'));
EXPECT_TRUE(IsAsciiWordChar('A'));
EXPECT_TRUE(IsAsciiWordChar('Z'));
}
TEST(IsAsciiWordCharTest, IsTrueForDigit) {
EXPECT_TRUE(IsAsciiWordChar('0'));
EXPECT_TRUE(IsAsciiWordChar('1'));
EXPECT_TRUE(IsAsciiWordChar('7'));
EXPECT_TRUE(IsAsciiWordChar('9'));
}
TEST(IsAsciiWordCharTest, IsTrueForUnderscore) {
EXPECT_TRUE(IsAsciiWordChar('_'));
}
TEST(IsValidEscapeTest, IsFalseForNonPrintable) {
EXPECT_FALSE(IsValidEscape('\0'));
EXPECT_FALSE(IsValidEscape('\007'));
}
TEST(IsValidEscapeTest, IsFalseForDigit) {
EXPECT_FALSE(IsValidEscape('0'));
EXPECT_FALSE(IsValidEscape('9'));
}
TEST(IsValidEscapeTest, IsFalseForWhiteSpace) {
EXPECT_FALSE(IsValidEscape(' '));
EXPECT_FALSE(IsValidEscape('\n'));
}
TEST(IsValidEscapeTest, IsFalseForSomeLetter) {
EXPECT_FALSE(IsValidEscape('a'));
EXPECT_FALSE(IsValidEscape('Z'));
}
TEST(IsValidEscapeTest, IsTrueForPunct) {
EXPECT_TRUE(IsValidEscape('.'));
EXPECT_TRUE(IsValidEscape('-'));
EXPECT_TRUE(IsValidEscape('^'));
EXPECT_TRUE(IsValidEscape('$'));
EXPECT_TRUE(IsValidEscape('('));
EXPECT_TRUE(IsValidEscape(']'));
EXPECT_TRUE(IsValidEscape('{'));
EXPECT_TRUE(IsValidEscape('|'));
}
TEST(IsValidEscapeTest, IsTrueForSomeLetter) {
EXPECT_TRUE(IsValidEscape('d'));
EXPECT_TRUE(IsValidEscape('D'));
EXPECT_TRUE(IsValidEscape('s'));
EXPECT_TRUE(IsValidEscape('S'));
EXPECT_TRUE(IsValidEscape('w'));
EXPECT_TRUE(IsValidEscape('W'));
}
TEST(AtomMatchesCharTest, EscapedPunct) {
EXPECT_FALSE(AtomMatchesChar(true, '\\', '\0'));
EXPECT_FALSE(AtomMatchesChar(true, '\\', ' '));
EXPECT_FALSE(AtomMatchesChar(true, '_', '.'));
EXPECT_FALSE(AtomMatchesChar(true, '.', 'a'));
EXPECT_TRUE(AtomMatchesChar(true, '\\', '\\'));
EXPECT_TRUE(AtomMatchesChar(true, '_', '_'));
EXPECT_TRUE(AtomMatchesChar(true, '+', '+'));
EXPECT_TRUE(AtomMatchesChar(true, '.', '.'));
}
TEST(AtomMatchesCharTest, Escaped_d) {
EXPECT_FALSE(AtomMatchesChar(true, 'd', '\0'));
EXPECT_FALSE(AtomMatchesChar(true, 'd', 'a'));
EXPECT_FALSE(AtomMatchesChar(true, 'd', '.'));
EXPECT_TRUE(AtomMatchesChar(true, 'd', '0'));
EXPECT_TRUE(AtomMatchesChar(true, 'd', '9'));
}
TEST(AtomMatchesCharTest, Escaped_D) {
EXPECT_FALSE(AtomMatchesChar(true, 'D', '0'));
EXPECT_FALSE(AtomMatchesChar(true, 'D', '9'));
EXPECT_TRUE(AtomMatchesChar(true, 'D', '\0'));
EXPECT_TRUE(AtomMatchesChar(true, 'D', 'a'));
EXPECT_TRUE(AtomMatchesChar(true, 'D', '-'));
}
TEST(AtomMatchesCharTest, Escaped_s) {
EXPECT_FALSE(AtomMatchesChar(true, 's', '\0'));
EXPECT_FALSE(AtomMatchesChar(true, 's', 'a'));
EXPECT_FALSE(AtomMatchesChar(true, 's', '.'));
EXPECT_FALSE(AtomMatchesChar(true, 's', '9'));
EXPECT_TRUE(AtomMatchesChar(true, 's', ' '));
EXPECT_TRUE(AtomMatchesChar(true, 's', '\n'));
EXPECT_TRUE(AtomMatchesChar(true, 's', '\t'));
}
TEST(AtomMatchesCharTest, Escaped_S) {
EXPECT_FALSE(AtomMatchesChar(true, 'S', ' '));
EXPECT_FALSE(AtomMatchesChar(true, 'S', '\r'));
EXPECT_TRUE(AtomMatchesChar(true, 'S', '\0'));
EXPECT_TRUE(AtomMatchesChar(true, 'S', 'a'));
EXPECT_TRUE(AtomMatchesChar(true, 'S', '9'));
}
TEST(AtomMatchesCharTest, Escaped_w) {
EXPECT_FALSE(AtomMatchesChar(true, 'w', '\0'));
EXPECT_FALSE(AtomMatchesChar(true, 'w', '+'));
EXPECT_FALSE(AtomMatchesChar(true, 'w', ' '));
EXPECT_FALSE(AtomMatchesChar(true, 'w', '\n'));
EXPECT_TRUE(AtomMatchesChar(true, 'w', '0'));
EXPECT_TRUE(AtomMatchesChar(true, 'w', 'b'));
EXPECT_TRUE(AtomMatchesChar(true, 'w', 'C'));
EXPECT_TRUE(AtomMatchesChar(true, 'w', '_'));
}
TEST(AtomMatchesCharTest, Escaped_W) {
EXPECT_FALSE(AtomMatchesChar(true, 'W', 'A'));
EXPECT_FALSE(AtomMatchesChar(true, 'W', 'b'));
EXPECT_FALSE(AtomMatchesChar(true, 'W', '9'));
EXPECT_FALSE(AtomMatchesChar(true, 'W', '_'));
EXPECT_TRUE(AtomMatchesChar(true, 'W', '\0'));
EXPECT_TRUE(AtomMatchesChar(true, 'W', '*'));
EXPECT_TRUE(AtomMatchesChar(true, 'W', '\n'));
}
TEST(AtomMatchesCharTest, EscapedWhiteSpace) {
EXPECT_FALSE(AtomMatchesChar(true, 'f', '\0'));
EXPECT_FALSE(AtomMatchesChar(true, 'f', '\n'));
EXPECT_FALSE(AtomMatchesChar(true, 'n', '\0'));
EXPECT_FALSE(AtomMatchesChar(true, 'n', '\r'));
EXPECT_FALSE(AtomMatchesChar(true, 'r', '\0'));
EXPECT_FALSE(AtomMatchesChar(true, 'r', 'a'));
EXPECT_FALSE(AtomMatchesChar(true, 't', '\0'));
EXPECT_FALSE(AtomMatchesChar(true, 't', 't'));
EXPECT_FALSE(AtomMatchesChar(true, 'v', '\0'));
EXPECT_FALSE(AtomMatchesChar(true, 'v', '\f'));
EXPECT_TRUE(AtomMatchesChar(true, 'f', '\f'));
EXPECT_TRUE(AtomMatchesChar(true, 'n', '\n'));
EXPECT_TRUE(AtomMatchesChar(true, 'r', '\r'));
EXPECT_TRUE(AtomMatchesChar(true, 't', '\t'));
EXPECT_TRUE(AtomMatchesChar(true, 'v', '\v'));
}
TEST(AtomMatchesCharTest, UnescapedDot) {
EXPECT_FALSE(AtomMatchesChar(false, '.', '\n'));
EXPECT_TRUE(AtomMatchesChar(false, '.', '\0'));
EXPECT_TRUE(AtomMatchesChar(false, '.', '.'));
EXPECT_TRUE(AtomMatchesChar(false, '.', 'a'));
EXPECT_TRUE(AtomMatchesChar(false, '.', ' '));
}
TEST(AtomMatchesCharTest, UnescapedChar) {
EXPECT_FALSE(AtomMatchesChar(false, 'a', '\0'));
EXPECT_FALSE(AtomMatchesChar(false, 'a', 'b'));
EXPECT_FALSE(AtomMatchesChar(false, '$', 'a'));
EXPECT_TRUE(AtomMatchesChar(false, '$', '$'));
EXPECT_TRUE(AtomMatchesChar(false, '5', '5'));
EXPECT_TRUE(AtomMatchesChar(false, 'Z', 'Z'));
}
TEST(ValidateRegexTest, GeneratesFailureAndReturnsFalseForInvalid) {
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(NULL)),
"NULL is not a valid simple regular expression");
EXPECT_NONFATAL_FAILURE(
ASSERT_FALSE(ValidateRegex("a\\")),
"Syntax error at index 1 in simple regular expression \"a\\\": ");
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("a\\")),
"'\\' cannot appear at the end");
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("\\n\\")),
"'\\' cannot appear at the end");
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("\\s\\hb")),
"invalid escape sequence \"\\h\"");
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("^^")),
"'^' can only appear at the beginning");
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(".*^b")),
"'^' can only appear at the beginning");
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("$$")),
"'$' can only appear at the end");
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("^$a")),
"'$' can only appear at the end");
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("a(b")),
"'(' is unsupported");
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("ab)")),
"')' is unsupported");
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("[ab")),
"'[' is unsupported");
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("a{2")),
"'{' is unsupported");
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("?")),
"'?' can only follow a repeatable token");
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("^*")),
"'*' can only follow a repeatable token");
EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("5*+")),
"'+' can only follow a repeatable token");
}
TEST(ValidateRegexTest, ReturnsTrueForValid) {
EXPECT_TRUE(ValidateRegex(""));
EXPECT_TRUE(ValidateRegex("a"));
EXPECT_TRUE(ValidateRegex(".*"));
EXPECT_TRUE(ValidateRegex("^a_+"));
EXPECT_TRUE(ValidateRegex("^a\\t\\&?"));
EXPECT_TRUE(ValidateRegex("09*$"));
EXPECT_TRUE(ValidateRegex("^Z$"));
EXPECT_TRUE(ValidateRegex("a\\^Z\\$\\(\\)\\|\\[\\]\\{\\}"));
}
TEST(MatchRepetitionAndRegexAtHeadTest, WorksForZeroOrOne) {
EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, 'a', '?', "a", "ba"));
// Repeating more than once.
EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, 'a', '?', "b", "aab"));
// Repeating zero times.
EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, 'a', '?', "b", "ba"));
// Repeating once.
EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, 'a', '?', "b", "ab"));
EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, '#', '?', ".", "##"));
}
TEST(MatchRepetitionAndRegexAtHeadTest, WorksForZeroOrMany) {
EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, '.', '*', "a$", "baab"));
// Repeating zero times.
EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, '.', '*', "b", "bc"));
// Repeating once.
EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, '.', '*', "b", "abc"));
// Repeating more than once.
EXPECT_TRUE(MatchRepetitionAndRegexAtHead(true, 'w', '*', "-", "ab_1-g"));
}
TEST(MatchRepetitionAndRegexAtHeadTest, WorksForOneOrMany) {
EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, '.', '+', "a$", "baab"));
// Repeating zero times.
EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, '.', '+', "b", "bc"));
// Repeating once.
EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, '.', '+', "b", "abc"));
// Repeating more than once.
EXPECT_TRUE(MatchRepetitionAndRegexAtHead(true, 'w', '+', "-", "ab_1-g"));
}
TEST(MatchRegexAtHeadTest, ReturnsTrueForEmptyRegex) {
EXPECT_TRUE(MatchRegexAtHead("", ""));
EXPECT_TRUE(MatchRegexAtHead("", "ab"));
}
TEST(MatchRegexAtHeadTest, WorksWhenDollarIsInRegex) {
EXPECT_FALSE(MatchRegexAtHead("$", "a"));
EXPECT_TRUE(MatchRegexAtHead("$", ""));
EXPECT_TRUE(MatchRegexAtHead("a$", "a"));
}
TEST(MatchRegexAtHeadTest, WorksWhenRegexStartsWithEscapeSequence) {
EXPECT_FALSE(MatchRegexAtHead("\\w", "+"));
EXPECT_FALSE(MatchRegexAtHead("\\W", "ab"));
EXPECT_TRUE(MatchRegexAtHead("\\sa", "\nab"));
EXPECT_TRUE(MatchRegexAtHead("\\d", "1a"));
}
TEST(MatchRegexAtHeadTest, WorksWhenRegexStartsWithRepetition) {
EXPECT_FALSE(MatchRegexAtHead(".+a", "abc"));
EXPECT_FALSE(MatchRegexAtHead("a?b", "aab"));
EXPECT_TRUE(MatchRegexAtHead(".*a", "bc12-ab"));
EXPECT_TRUE(MatchRegexAtHead("a?b", "b"));
EXPECT_TRUE(MatchRegexAtHead("a?b", "ab"));
}
TEST(MatchRegexAtHeadTest,
WorksWhenRegexStartsWithRepetionOfEscapeSequence) {
EXPECT_FALSE(MatchRegexAtHead("\\.+a", "abc"));
EXPECT_FALSE(MatchRegexAtHead("\\s?b", " b"));
EXPECT_TRUE(MatchRegexAtHead("\\(*a", "((((ab"));
EXPECT_TRUE(MatchRegexAtHead("\\^?b", "^b"));
EXPECT_TRUE(MatchRegexAtHead("\\\\?b", "b"));
EXPECT_TRUE(MatchRegexAtHead("\\\\?b", "\\b"));
}
TEST(MatchRegexAtHeadTest, MatchesSequentially) {
EXPECT_FALSE(MatchRegexAtHead("ab.*c", "acabc"));
EXPECT_TRUE(MatchRegexAtHead("ab.*c", "ab-fsc"));
}
TEST(MatchRegexAnywhereTest, ReturnsFalseWhenStringIsNull) {
EXPECT_FALSE(MatchRegexAnywhere("", NULL));
}
TEST(MatchRegexAnywhereTest, WorksWhenRegexStartsWithCaret) {
EXPECT_FALSE(MatchRegexAnywhere("^a", "ba"));
EXPECT_FALSE(MatchRegexAnywhere("^$", "a"));
EXPECT_TRUE(MatchRegexAnywhere("^a", "ab"));
EXPECT_TRUE(MatchRegexAnywhere("^", "ab"));
EXPECT_TRUE(MatchRegexAnywhere("^$", ""));
}
TEST(MatchRegexAnywhereTest, ReturnsFalseWhenNoMatch) {
EXPECT_FALSE(MatchRegexAnywhere("a", "bcde123"));
EXPECT_FALSE(MatchRegexAnywhere("a.+a", "--aa88888888"));
}
TEST(MatchRegexAnywhereTest, ReturnsTrueWhenMatchingPrefix) {
EXPECT_TRUE(MatchRegexAnywhere("\\w+", "ab1_ - 5"));
EXPECT_TRUE(MatchRegexAnywhere(".*=", "="));
EXPECT_TRUE(MatchRegexAnywhere("x.*ab?.*bc", "xaaabc"));
}
TEST(MatchRegexAnywhereTest, ReturnsTrueWhenMatchingNonPrefix) {
EXPECT_TRUE(MatchRegexAnywhere("\\w+", "$$$ ab1_ - 5"));
EXPECT_TRUE(MatchRegexAnywhere("\\.+=", "= ...="));
}
// Tests RE's implicit constructors.
TEST(RETest, ImplicitConstructorWorks) {
const RE empty("");
EXPECT_STREQ("", empty.pattern());
const RE simple("hello");
EXPECT_STREQ("hello", simple.pattern());
}
// Tests that RE's constructors reject invalid regular expressions.
TEST(RETest, RejectsInvalidRegex) {
EXPECT_NONFATAL_FAILURE({
const RE normal(NULL);
}, "NULL is not a valid simple regular expression");
EXPECT_NONFATAL_FAILURE({
const RE normal(".*(\\w+");
}, "'(' is unsupported");
EXPECT_NONFATAL_FAILURE({
const RE invalid("^?");
}, "'?' can only follow a repeatable token");
}
// Tests RE::FullMatch().
TEST(RETest, FullMatchWorks) {
const RE empty("");
EXPECT_TRUE(RE::FullMatch("", empty));
EXPECT_FALSE(RE::FullMatch("a", empty));
const RE re1("a");
EXPECT_TRUE(RE::FullMatch("a", re1));
const RE re("a.*z");
EXPECT_TRUE(RE::FullMatch("az", re));
EXPECT_TRUE(RE::FullMatch("axyz", re));
EXPECT_FALSE(RE::FullMatch("baz", re));
EXPECT_FALSE(RE::FullMatch("azy", re));
}
// Tests RE::PartialMatch().
TEST(RETest, PartialMatchWorks) {
const RE empty("");
EXPECT_TRUE(RE::PartialMatch("", empty));
EXPECT_TRUE(RE::PartialMatch("a", empty));
const RE re("a.*z");
EXPECT_TRUE(RE::PartialMatch("az", re));
EXPECT_TRUE(RE::PartialMatch("axyz", re));
EXPECT_TRUE(RE::PartialMatch("baz", re));
EXPECT_TRUE(RE::PartialMatch("azy", re));
EXPECT_FALSE(RE::PartialMatch("zza", re));
}
#endif // GTEST_USES_POSIX_RE
#if !GTEST_OS_WINDOWS_MOBILE
TEST(CaptureTest, CapturesStdout) {
CaptureStdout();
fprintf(stdout, "abc");
EXPECT_STREQ("abc", GetCapturedStdout().c_str());
CaptureStdout();
fprintf(stdout, "def%cghi", '\0');
EXPECT_EQ(::std::string("def\0ghi", 7), ::std::string(GetCapturedStdout()));
}
TEST(CaptureTest, CapturesStderr) {
CaptureStderr();
fprintf(stderr, "jkl");
EXPECT_STREQ("jkl", GetCapturedStderr().c_str());
CaptureStderr();
fprintf(stderr, "jkl%cmno", '\0');
EXPECT_EQ(::std::string("jkl\0mno", 7), ::std::string(GetCapturedStderr()));
}
// Tests that stdout and stderr capture don't interfere with each other.
TEST(CaptureTest, CapturesStdoutAndStderr) {
CaptureStdout();
CaptureStderr();
fprintf(stdout, "pqr");
fprintf(stderr, "stu");
EXPECT_STREQ("pqr", GetCapturedStdout().c_str());
EXPECT_STREQ("stu", GetCapturedStderr().c_str());
}
TEST(CaptureDeathTest, CannotReenterStdoutCapture) {
CaptureStdout();
EXPECT_DEATH_IF_SUPPORTED(CaptureStdout(),
"Only one stdout capturer can exist at a time");
GetCapturedStdout();
// We cannot test stderr capturing using death tests as they use it
// themselves.
}
#endif // !GTEST_OS_WINDOWS_MOBILE
TEST(ThreadLocalTest, DefaultConstructorInitializesToDefaultValues) {
ThreadLocal<int> t1;
EXPECT_EQ(0, t1.get());
ThreadLocal<void*> t2;
EXPECT_TRUE(t2.get() == NULL);
}
TEST(ThreadLocalTest, SingleParamConstructorInitializesToParam) {
ThreadLocal<int> t1(123);
EXPECT_EQ(123, t1.get());
int i = 0;
ThreadLocal<int*> t2(&i);
EXPECT_EQ(&i, t2.get());
}
class NoDefaultContructor {
public:
explicit NoDefaultContructor(const char*) {}
NoDefaultContructor(const NoDefaultContructor&) {}
};
TEST(ThreadLocalTest, ValueDefaultContructorIsNotRequiredForParamVersion) {
ThreadLocal<NoDefaultContructor> bar(NoDefaultContructor("foo"));
bar.pointer();
}
TEST(ThreadLocalTest, GetAndPointerReturnSameValue) {
ThreadLocal<std::string> thread_local_string;
EXPECT_EQ(thread_local_string.pointer(), &(thread_local_string.get()));
// Verifies the condition still holds after calling set.
thread_local_string.set("foo");
EXPECT_EQ(thread_local_string.pointer(), &(thread_local_string.get()));
}
TEST(ThreadLocalTest, PointerAndConstPointerReturnSameValue) {
ThreadLocal<std::string> thread_local_string;
const ThreadLocal<std::string>& const_thread_local_string =
thread_local_string;
EXPECT_EQ(thread_local_string.pointer(), const_thread_local_string.pointer());
thread_local_string.set("foo");
EXPECT_EQ(thread_local_string.pointer(), const_thread_local_string.pointer());
}
#if GTEST_IS_THREADSAFE
void AddTwo(int* param) { *param += 2; }
TEST(ThreadWithParamTest, ConstructorExecutesThreadFunc) {
int i = 40;
ThreadWithParam<int*> thread(&AddTwo, &i, NULL);
thread.Join();
EXPECT_EQ(42, i);
}
TEST(MutexDeathTest, AssertHeldShouldAssertWhenNotLocked) {
// AssertHeld() is flaky only in the presence of multiple threads accessing
// the lock. In this case, the test is robust.
EXPECT_DEATH_IF_SUPPORTED({
Mutex m;
{ MutexLock lock(&m); }
m.AssertHeld();
},
"thread .*hold");
}
TEST(MutexTest, AssertHeldShouldNotAssertWhenLocked) {
Mutex m;
MutexLock lock(&m);
m.AssertHeld();
}
class AtomicCounterWithMutex {
public:
explicit AtomicCounterWithMutex(Mutex* mutex) :
value_(0), mutex_(mutex), random_(42) {}
void Increment() {
MutexLock lock(mutex_);
int temp = value_;
{
// We need to put up a memory barrier to prevent reads and writes to
// value_ rearranged with the call to SleepMilliseconds when observed
// from other threads.
#if GTEST_HAS_PTHREAD
// On POSIX, locking a mutex puts up a memory barrier. We cannot use
// Mutex and MutexLock here or rely on their memory barrier
// functionality as we are testing them here.
pthread_mutex_t memory_barrier_mutex;
GTEST_CHECK_POSIX_SUCCESS_(
pthread_mutex_init(&memory_barrier_mutex, NULL));
GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&memory_barrier_mutex));
SleepMilliseconds(random_.Generate(30));
GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&memory_barrier_mutex));
GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&memory_barrier_mutex));
#elif GTEST_OS_WINDOWS
// On Windows, performing an interlocked access puts up a memory barrier.
volatile LONG dummy = 0;
::InterlockedIncrement(&dummy);
SleepMilliseconds(random_.Generate(30));
::InterlockedIncrement(&dummy);
#else
# error "Memory barrier not implemented on this platform."
#endif // GTEST_HAS_PTHREAD
}
value_ = temp + 1;
}
int value() const { return value_; }
private:
volatile int value_;
Mutex* const mutex_; // Protects value_.
Random random_;
};
void CountingThreadFunc(pair<AtomicCounterWithMutex*, int> param) {
for (int i = 0; i < param.second; ++i)
param.first->Increment();
}
// Tests that the mutex only lets one thread at a time to lock it.
TEST(MutexTest, OnlyOneThreadCanLockAtATime) {
Mutex mutex;
AtomicCounterWithMutex locked_counter(&mutex);
typedef ThreadWithParam<pair<AtomicCounterWithMutex*, int> > ThreadType;
const int kCycleCount = 20;
const int kThreadCount = 7;
scoped_ptr<ThreadType> counting_threads[kThreadCount];
Notification threads_can_start;
// Creates and runs kThreadCount threads that increment locked_counter
// kCycleCount times each.
for (int i = 0; i < kThreadCount; ++i) {
counting_threads[i].reset(new ThreadType(&CountingThreadFunc,
make_pair(&locked_counter,
kCycleCount),
&threads_can_start));
}
threads_can_start.Notify();
for (int i = 0; i < kThreadCount; ++i)
counting_threads[i]->Join();
// If the mutex lets more than one thread to increment the counter at a
// time, they are likely to encounter a race condition and have some
// increments overwritten, resulting in the lower then expected counter
// value.
EXPECT_EQ(kCycleCount * kThreadCount, locked_counter.value());
}
template <typename T>
void RunFromThread(void (func)(T), T param) {
ThreadWithParam<T> thread(func, param, NULL);
thread.Join();
}
void RetrieveThreadLocalValue(
pair<ThreadLocal<std::string>*, std::string*> param) {
*param.second = param.first->get();
}
TEST(ThreadLocalTest, ParameterizedConstructorSetsDefault) {
ThreadLocal<std::string> thread_local_string("foo");
EXPECT_STREQ("foo", thread_local_string.get().c_str());
thread_local_string.set("bar");
EXPECT_STREQ("bar", thread_local_string.get().c_str());
std::string result;
RunFromThread(&RetrieveThreadLocalValue,
make_pair(&thread_local_string, &result));
EXPECT_STREQ("foo", result.c_str());
}
// Keeps track of whether of destructors being called on instances of
// DestructorTracker. On Windows, waits for the destructor call reports.
class DestructorCall {
public:
DestructorCall() {
invoked_ = false;
#if GTEST_OS_WINDOWS
wait_event_.Reset(::CreateEvent(NULL, TRUE, FALSE, NULL));
GTEST_CHECK_(wait_event_.Get() != NULL);
#endif
}
bool CheckDestroyed() const {
#if GTEST_OS_WINDOWS
if (::WaitForSingleObject(wait_event_.Get(), 1000) != WAIT_OBJECT_0)
return false;
#endif
return invoked_;
}
void ReportDestroyed() {
invoked_ = true;
#if GTEST_OS_WINDOWS
::SetEvent(wait_event_.Get());
#endif
}
static std::vector<DestructorCall*>& List() { return *list_; }
static void ResetList() {
for (size_t i = 0; i < list_->size(); ++i) {
delete list_->at(i);
}
list_->clear();
}
private:
bool invoked_;
#if GTEST_OS_WINDOWS
AutoHandle wait_event_;
#endif
static std::vector<DestructorCall*>* const list_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(DestructorCall);
};
std::vector<DestructorCall*>* const DestructorCall::list_ =
new std::vector<DestructorCall*>;
// DestructorTracker keeps track of whether its instances have been
// destroyed.
class DestructorTracker {
public:
DestructorTracker() : index_(GetNewIndex()) {}
DestructorTracker(const DestructorTracker& /* rhs */)
: index_(GetNewIndex()) {}
~DestructorTracker() {
// We never access DestructorCall::List() concurrently, so we don't need
// to protect this acccess with a mutex.
DestructorCall::List()[index_]->ReportDestroyed();
}
private:
static size_t GetNewIndex() {
DestructorCall::List().push_back(new DestructorCall);
return DestructorCall::List().size() - 1;
}
const size_t index_;
GTEST_DISALLOW_ASSIGN_(DestructorTracker);
};
typedef ThreadLocal<DestructorTracker>* ThreadParam;
void CallThreadLocalGet(ThreadParam thread_local_param) {
thread_local_param->get();
}
// Tests that when a ThreadLocal object dies in a thread, it destroys
// the managed object for that thread.
TEST(ThreadLocalTest, DestroysManagedObjectForOwnThreadWhenDying) {
DestructorCall::ResetList();
{
ThreadLocal<DestructorTracker> thread_local_tracker;
ASSERT_EQ(0U, DestructorCall::List().size());
// This creates another DestructorTracker object for the main thread.
thread_local_tracker.get();
ASSERT_EQ(1U, DestructorCall::List().size());
ASSERT_FALSE(DestructorCall::List()[0]->CheckDestroyed());
}
// Now thread_local_tracker has died.
ASSERT_EQ(1U, DestructorCall::List().size());
EXPECT_TRUE(DestructorCall::List()[0]->CheckDestroyed());
DestructorCall::ResetList();
}
// Tests that when a thread exits, the thread-local object for that
// thread is destroyed.
TEST(ThreadLocalTest, DestroysManagedObjectAtThreadExit) {
DestructorCall::ResetList();
{
ThreadLocal<DestructorTracker> thread_local_tracker;
ASSERT_EQ(0U, DestructorCall::List().size());
// This creates another DestructorTracker object in the new thread.
ThreadWithParam<ThreadParam> thread(
&CallThreadLocalGet, &thread_local_tracker, NULL);
thread.Join();
// The thread has exited, and we should have a DestroyedTracker
// instance created for it. But it may not have been destroyed yet.
ASSERT_EQ(1U, DestructorCall::List().size());
}
// The thread has exited and thread_local_tracker has died.
ASSERT_EQ(1U, DestructorCall::List().size());
EXPECT_TRUE(DestructorCall::List()[0]->CheckDestroyed());
DestructorCall::ResetList();
}
TEST(ThreadLocalTest, ThreadLocalMutationsAffectOnlyCurrentThread) {
ThreadLocal<std::string> thread_local_string;
thread_local_string.set("Foo");
EXPECT_STREQ("Foo", thread_local_string.get().c_str());
std::string result;
RunFromThread(&RetrieveThreadLocalValue,
make_pair(&thread_local_string, &result));
EXPECT_TRUE(result.empty());
}
#endif // GTEST_IS_THREADSAFE
#if GTEST_OS_WINDOWS
TEST(WindowsTypesTest, HANDLEIsVoidStar) {
StaticAssertTypeEq<HANDLE, void*>();
}
TEST(WindowsTypesTest, CRITICAL_SECTIONIs_RTL_CRITICAL_SECTION) {
StaticAssertTypeEq<CRITICAL_SECTION, _RTL_CRITICAL_SECTION>();
}
#endif // GTEST_OS_WINDOWS
} // namespace internal
} // namespace testing
| [
"sujay.yadalam@gmail.com"
] | sujay.yadalam@gmail.com |
07477b7170432a60aab3aae30163475797497036 | 06b8560f4dd04b3e585cee03e536172020145f56 | /libraries/blockchain/include/bts/blockchain/edge_operations.hpp | 44fc9c0ad6c0feca5b27740a68b272658c11fc17 | [
"Unlicense",
"LicenseRef-scancode-public-domain"
] | permissive | testzcrypto/bitshares | 95394bfa516b27b2b89d8529ed6a476b6e592ddb | 2e82bd9a8acc0111f3cafc51c68d84e8abc15304 | refs/heads/master | 2020-12-25T22:19:13.259222 | 2014-12-12T16:24:51 | 2014-12-12T16:40:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 676 | hpp | #pragma once
#include <bts/blockchain/operations.hpp>
#include <bts/blockchain/edge_record.hpp>
#include <fc/io/enum_type.hpp>
#include <fc/io/raw.hpp>
#include <fc/io/raw_fwd.hpp>
#include <fc/reflect/reflect.hpp>
namespace bts { namespace blockchain {
/**
* Defines or updates an edge.
*/
struct set_edge_operation
{
static const operation_type_enum type;
set_edge_operation(){}
set_edge_operation( const edge_record& edge )
:edge(edge)
{}
edge_record edge;
void evaluate( transaction_evaluation_state& eval_state );
};
}} // bts::blockchain
FC_REFLECT( bts::blockchain::set_edge_operation, (edge) )
| [
"nikolai.mushegian@gmail.com"
] | nikolai.mushegian@gmail.com |
0b6c8b2cbc10f0a09e99abea1d90293ca64479db | 62d122e8514b42001bea934c81ca9f11ac728773 | /amd_openvx_extensions/amd_rpp/source/SaturationbatchPD.cpp | ee71a596e3d139208c7b1ed23835206325586d7e | [
"MIT"
] | permissive | barathum000/MIVisionX | 586ad634999d79e777387245fa8d9737a67185ee | 7667d7b98cd141e144a0dbd56b54c3c161671637 | refs/heads/master | 2023-05-13T04:52:03.932208 | 2021-05-20T17:02:09 | 2021-05-20T17:02:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,274 | cpp | /*
Copyright (c) 2019 - 2020 Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "internal_publishKernels.h"
struct SaturationbatchPDLocalData {
RPPCommonHandle handle;
rppHandle_t rppHandle;
Rpp32u device_type;
Rpp32u nbatchSize;
RppiSize *srcDimensions;
RppiSize maxSrcDimensions;
RppPtr_t pSrc;
RppPtr_t pDst;
vx_float32 *saturationFactor;
#if ENABLE_OPENCL
cl_mem cl_pSrc;
cl_mem cl_pDst;
#endif
};
static vx_status VX_CALLBACK refreshSaturationbatchPD(vx_node node, const vx_reference *parameters, vx_uint32 num, SaturationbatchPDLocalData *data)
{
vx_status status = VX_SUCCESS;
size_t arr_size;
vx_status copy_status;
STATUS_ERROR_CHECK(vxQueryArray((vx_array)parameters[4], VX_ARRAY_ATTRIBUTE_NUMITEMS, &arr_size, sizeof(arr_size)));
data->saturationFactor = (vx_float32 *)malloc(sizeof(vx_float32) * arr_size);
copy_status = vxCopyArrayRange((vx_array)parameters[4], 0, arr_size, sizeof(vx_float32),data->saturationFactor, VX_READ_ONLY, VX_MEMORY_TYPE_HOST);
STATUS_ERROR_CHECK(vxReadScalarValue((vx_scalar)parameters[5], &data->nbatchSize));
STATUS_ERROR_CHECK(vxQueryImage((vx_image)parameters[0], VX_IMAGE_HEIGHT, &data->maxSrcDimensions.height, sizeof(data->maxSrcDimensions.height)));
STATUS_ERROR_CHECK(vxQueryImage((vx_image)parameters[0], VX_IMAGE_WIDTH, &data->maxSrcDimensions.width, sizeof(data->maxSrcDimensions.width)));
data->maxSrcDimensions.height = data->maxSrcDimensions.height / data->nbatchSize;
data->srcDimensions = (RppiSize *)malloc(sizeof(RppiSize) * data->nbatchSize);
Rpp32u *srcBatch_width = (Rpp32u *)malloc(sizeof(Rpp32u) * data->nbatchSize);
Rpp32u *srcBatch_height = (Rpp32u *)malloc(sizeof(Rpp32u) * data->nbatchSize);
copy_status = vxCopyArrayRange((vx_array)parameters[1], 0, data->nbatchSize, sizeof(Rpp32u),srcBatch_width, VX_READ_ONLY, VX_MEMORY_TYPE_HOST);
copy_status = vxCopyArrayRange((vx_array)parameters[2], 0, data->nbatchSize, sizeof(Rpp32u),srcBatch_height, VX_READ_ONLY, VX_MEMORY_TYPE_HOST);
for(int i = 0; i < data->nbatchSize; i++){
data->srcDimensions[i].width = srcBatch_width[i];
data->srcDimensions[i].height = srcBatch_height[i];
}
if(data->device_type == AGO_TARGET_AFFINITY_GPU) {
#if ENABLE_OPENCL
STATUS_ERROR_CHECK(vxQueryImage((vx_image)parameters[0], VX_IMAGE_ATTRIBUTE_AMD_OPENCL_BUFFER, &data->cl_pSrc, sizeof(data->cl_pSrc)));
STATUS_ERROR_CHECK(vxQueryImage((vx_image)parameters[3], VX_IMAGE_ATTRIBUTE_AMD_OPENCL_BUFFER, &data->cl_pDst, sizeof(data->cl_pDst)));
#endif
}
if(data->device_type == AGO_TARGET_AFFINITY_CPU) {
STATUS_ERROR_CHECK(vxQueryImage((vx_image)parameters[0], VX_IMAGE_ATTRIBUTE_AMD_HOST_BUFFER, &data->pSrc, sizeof(vx_uint8)));
STATUS_ERROR_CHECK(vxQueryImage((vx_image)parameters[3], VX_IMAGE_ATTRIBUTE_AMD_HOST_BUFFER, &data->pDst, sizeof(vx_uint8)));
}
return status;
}
static vx_status VX_CALLBACK validateSaturationbatchPD(vx_node node, const vx_reference parameters[], vx_uint32 num, vx_meta_format metas[])
{
vx_status status = VX_SUCCESS;
vx_enum scalar_type;
STATUS_ERROR_CHECK(vxQueryScalar((vx_scalar)parameters[5], VX_SCALAR_TYPE, &scalar_type, sizeof(scalar_type)));
if(scalar_type != VX_TYPE_UINT32) return ERRMSG(VX_ERROR_INVALID_TYPE, "validate: Paramter: #5 type=%d (must be size)\n", scalar_type);
STATUS_ERROR_CHECK(vxQueryScalar((vx_scalar)parameters[6], VX_SCALAR_TYPE, &scalar_type, sizeof(scalar_type)));
if(scalar_type != VX_TYPE_UINT32) return ERRMSG(VX_ERROR_INVALID_TYPE, "validate: Paramter: #6 type=%d (must be size)\n", scalar_type);
// Check for input parameters
vx_parameter input_param;
vx_image input;
vx_df_image df_image;
input_param = vxGetParameterByIndex(node,0);
STATUS_ERROR_CHECK(vxQueryParameter(input_param, VX_PARAMETER_ATTRIBUTE_REF, &input, sizeof(vx_image)));
STATUS_ERROR_CHECK(vxQueryImage(input, VX_IMAGE_ATTRIBUTE_FORMAT, &df_image, sizeof(df_image)));
if(df_image != VX_DF_IMAGE_U8 && df_image != VX_DF_IMAGE_RGB)
{
return ERRMSG(VX_ERROR_INVALID_FORMAT, "validate: SaturationbatchPD: image: #0 format=%4.4s (must be RGB2 or U008)\n", (char *)&df_image);
}
// Check for output parameters
vx_image output;
vx_df_image format;
vx_parameter output_param;
vx_uint32 height, width;
output_param = vxGetParameterByIndex(node,3);
STATUS_ERROR_CHECK(vxQueryParameter(output_param, VX_PARAMETER_ATTRIBUTE_REF, &output, sizeof(vx_image)));
STATUS_ERROR_CHECK(vxQueryImage(output, VX_IMAGE_ATTRIBUTE_WIDTH, &width, sizeof(width)));
STATUS_ERROR_CHECK(vxQueryImage(output, VX_IMAGE_ATTRIBUTE_HEIGHT, &height, sizeof(height)));
STATUS_ERROR_CHECK(vxSetMetaFormatAttribute(metas[3], VX_IMAGE_ATTRIBUTE_WIDTH, &width, sizeof(width)));
STATUS_ERROR_CHECK(vxSetMetaFormatAttribute(metas[3], VX_IMAGE_ATTRIBUTE_HEIGHT, &height, sizeof(height)));
STATUS_ERROR_CHECK(vxSetMetaFormatAttribute(metas[3], VX_IMAGE_ATTRIBUTE_FORMAT, &df_image, sizeof(df_image)));
vxReleaseImage(&input);
vxReleaseImage(&output);
vxReleaseParameter(&output_param);
vxReleaseParameter(&input_param);
return status;
}
static vx_status VX_CALLBACK processSaturationbatchPD(vx_node node, const vx_reference * parameters, vx_uint32 num)
{
RppStatus rpp_status = RPP_SUCCESS;
vx_status return_status = VX_SUCCESS;
SaturationbatchPDLocalData * data = NULL;
STATUS_ERROR_CHECK(vxQueryNode(node, VX_NODE_LOCAL_DATA_PTR, &data, sizeof(data)));
vx_df_image df_image = VX_DF_IMAGE_VIRT;
STATUS_ERROR_CHECK(vxQueryImage((vx_image)parameters[0], VX_IMAGE_ATTRIBUTE_FORMAT, &df_image, sizeof(df_image)));
if(data->device_type == AGO_TARGET_AFFINITY_GPU) {
#if ENABLE_OPENCL
cl_command_queue handle = data->handle.cmdq;
refreshSaturationbatchPD(node, parameters, num, data);
if (df_image == VX_DF_IMAGE_U8 ){
rpp_status = rppi_saturationRGB_u8_pln1_batchPD_gpu((void *)data->cl_pSrc,data->srcDimensions,data->maxSrcDimensions,(void *)data->cl_pDst,data->saturationFactor,data->nbatchSize,data->rppHandle);
}
else if(df_image == VX_DF_IMAGE_RGB) {
rpp_status = rppi_saturationRGB_u8_pkd3_batchPD_gpu((void *)data->cl_pSrc,data->srcDimensions,data->maxSrcDimensions,(void *)data->cl_pDst,data->saturationFactor,data->nbatchSize,data->rppHandle);
}
return_status = (rpp_status == RPP_SUCCESS) ? VX_SUCCESS : VX_FAILURE;
#endif
}
if(data->device_type == AGO_TARGET_AFFINITY_CPU) {
refreshSaturationbatchPD(node, parameters, num, data);
if (df_image == VX_DF_IMAGE_U8 ){
rpp_status = rppi_saturationRGB_u8_pln1_batchPD_host(data->pSrc,data->srcDimensions,data->maxSrcDimensions,data->pDst,data->saturationFactor,data->nbatchSize,data->rppHandle);
}
else if(df_image == VX_DF_IMAGE_RGB) {
rpp_status = rppi_saturationRGB_u8_pkd3_batchPD_host(data->pSrc,data->srcDimensions,data->maxSrcDimensions,data->pDst,data->saturationFactor,data->nbatchSize,data->rppHandle);
}
return_status = (rpp_status == RPP_SUCCESS) ? VX_SUCCESS : VX_FAILURE;
}
return return_status;
}
static vx_status VX_CALLBACK initializeSaturationbatchPD(vx_node node, const vx_reference *parameters, vx_uint32 num)
{
SaturationbatchPDLocalData * data = new SaturationbatchPDLocalData;
memset(data, 0, sizeof(*data));
#if ENABLE_OPENCL
STATUS_ERROR_CHECK(vxQueryNode(node, VX_NODE_ATTRIBUTE_AMD_OPENCL_COMMAND_QUEUE, &data->handle.cmdq, sizeof(data->handle.cmdq)));
#endif
STATUS_ERROR_CHECK(vxCopyScalar((vx_scalar)parameters[6], &data->device_type, VX_READ_ONLY, VX_MEMORY_TYPE_HOST));
refreshSaturationbatchPD(node, parameters, num, data);
#if ENABLE_OPENCL
if(data->device_type == AGO_TARGET_AFFINITY_GPU)
rppCreateWithStreamAndBatchSize(&data->rppHandle, data->handle.cmdq, data->nbatchSize);
#endif
if(data->device_type == AGO_TARGET_AFFINITY_CPU)
rppCreateWithBatchSize(&data->rppHandle, data->nbatchSize);
STATUS_ERROR_CHECK(vxSetNodeAttribute(node, VX_NODE_LOCAL_DATA_PTR, &data, sizeof(data)));
return VX_SUCCESS;
}
static vx_status VX_CALLBACK uninitializeSaturationbatchPD(vx_node node, const vx_reference *parameters, vx_uint32 num)
{
SaturationbatchPDLocalData * data;
STATUS_ERROR_CHECK(vxQueryNode(node, VX_NODE_LOCAL_DATA_PTR, &data, sizeof(data)));
#if ENABLE_OPENCL
if(data->device_type == AGO_TARGET_AFFINITY_GPU)
rppDestroyGPU(data->rppHandle);
#endif
if(data->device_type == AGO_TARGET_AFFINITY_CPU)
rppDestroyHost(data->rppHandle);
delete(data);
return VX_SUCCESS;
}
vx_status SaturationbatchPD_Register(vx_context context)
{
vx_status status = VX_SUCCESS;
// Add kernel to the context with callbacks
vx_kernel kernel = vxAddUserKernel(context, "org.rpp.SaturationbatchPD",
VX_KERNEL_RPP_SATURATIONBATCHPD,
processSaturationbatchPD,
7,
validateSaturationbatchPD,
initializeSaturationbatchPD,
uninitializeSaturationbatchPD);
ERROR_CHECK_OBJECT(kernel);
AgoTargetAffinityInfo affinity;
vxQueryContext(context, VX_CONTEXT_ATTRIBUTE_AMD_AFFINITY,&affinity, sizeof(affinity));
#if ENABLE_OPENCL
// enable OpenCL buffer access since the kernel_f callback uses OpenCL buffers instead of host accessible buffers
vx_bool enableBufferAccess = vx_true_e;
if(affinity.device_type == AGO_TARGET_AFFINITY_GPU)
STATUS_ERROR_CHECK(vxSetKernelAttribute(kernel, VX_KERNEL_ATTRIBUTE_AMD_OPENCL_BUFFER_ACCESS_ENABLE, &enableBufferAccess, sizeof(enableBufferAccess)));
#else
vx_bool enableBufferAccess = vx_false_e;
#endif
if (kernel)
{
PARAM_ERROR_CHECK(vxAddParameterToKernel(kernel, 0, VX_INPUT, VX_TYPE_IMAGE, VX_PARAMETER_STATE_REQUIRED));
PARAM_ERROR_CHECK(vxAddParameterToKernel(kernel, 1, VX_INPUT, VX_TYPE_ARRAY, VX_PARAMETER_STATE_REQUIRED));
PARAM_ERROR_CHECK(vxAddParameterToKernel(kernel, 2, VX_INPUT, VX_TYPE_ARRAY, VX_PARAMETER_STATE_REQUIRED));
PARAM_ERROR_CHECK(vxAddParameterToKernel(kernel, 3, VX_OUTPUT, VX_TYPE_IMAGE, VX_PARAMETER_STATE_REQUIRED));
PARAM_ERROR_CHECK(vxAddParameterToKernel(kernel, 4, VX_INPUT, VX_TYPE_ARRAY, VX_PARAMETER_STATE_REQUIRED));
PARAM_ERROR_CHECK(vxAddParameterToKernel(kernel, 5, VX_INPUT, VX_TYPE_SCALAR, VX_PARAMETER_STATE_REQUIRED));
PARAM_ERROR_CHECK(vxAddParameterToKernel(kernel, 6, VX_INPUT, VX_TYPE_SCALAR, VX_PARAMETER_STATE_REQUIRED));
PARAM_ERROR_CHECK(vxFinalizeKernel(kernel));
}
if (status != VX_SUCCESS)
{
exit: vxRemoveKernel(kernel); return VX_FAILURE;
}
return status;
}
| [
"noreply@github.com"
] | barathum000.noreply@github.com |
61b88a3193bd94793b03cf7b6642517a4a8e723f | 87cf63a0b7fb80402e018a1788803537b25d921f | /Tapeciarnia/Providers/TapeciarniaProvider.cpp | b02c594d48198d995669c18d8496c3dc6c4553c9 | [
"Unlicense"
] | permissive | marek-g/Tapeciarnia | dbb7cb89a441d08f91c8ded583743db8e630e44c | 1437bbfd0ce917ecb682963629153cf1d75f9c3a | refs/heads/master | 2021-06-03T03:44:27.343599 | 2018-02-24T16:36:56 | 2018-02-24T16:36:56 | 13,448,422 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,528 | cpp | #include "TapeciarniaProvider.h"
#include "Utils.h"
#include <QRegExp>
#include <QTextCodec>
QString TapeciarniaProvider::GetMainPageUrl()
{
return "http://www.tapeciarnia.pl/";
}
bool TapeciarniaProvider::IsAddressSupported(const QString &url)
{
if (url.startsWith("http://www.tapeciarnia.pl/") || url.startsWith("https://www.tapeciarnia.pl/"))
{
return true;
}
return false;
}
WallpaperResult TapeciarniaProvider::DownloadRandomImage(WallpaperParameters parameters)
{
QString url = parameters.url + "?st=los";
// download page
QByteArray page1 = Utils::GetDataFromUrl(url, "www.tapeciarnia.pl", "http://www.tapeciarnia.pl");
QTextCodec *codec = QTextCodec::codecForName("iso-8859-2");
QString strPage1 = codec->toUnicode(page1);
// find address of the first image
//QRegExp rxImageLink("<a href='([^.]*)\\.html' title='([^']*)'><img +tresc='");
QRegExp rxImageLink("<img +tresc='[^']*' src='tapety/srednie/([^.]*)\\.jpg' alt='([^']*)'");
if (rxImageLink.indexIn(strPage1, 0) == -1)
{
// not found
return WallpaperResult();
}
WallpaperResult result;
result.name = Utils::UnescapeHtml(rxImageLink.cap(2));
result.url = QString("http://www.tapeciarnia.pl/") + rxImageLink.cap(1) + ".html";
result.image = Utils::GetDataFromUrl("http://www.tapeciarnia.pl/tapety/normalne/" + rxImageLink.cap(1) + ".jpg",
"www.tapeciarnia.pl", "http://www.tapeciarnia.pl");
return result;
}
| [
"user@mail.com"
] | user@mail.com |
94d3d11a0acfb76c7bba1d32b386ab36f80edef0 | 21553f6afd6b81ae8403549467230cdc378f32c9 | /arm/cortex/Freescale/MKL24Z4/include/arch/reg/mcm.hpp | b5d069f53b31ac4c99360cc8d26839358db63a6f | [] | no_license | digint/openmptl-reg-arm-cortex | 3246b68dcb60d4f7c95a46423563cab68cb02b5e | 88e105766edc9299348ccc8d2ff7a9c34cddacd3 | refs/heads/master | 2021-07-18T19:56:42.569685 | 2017-10-26T11:11:35 | 2017-10-26T11:11:35 | 108,407,162 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,606 | hpp | /*
* OpenMPTL - C++ Microprocessor Template Library
*
* This program is a derivative representation of a CMSIS System View
* Description (SVD) file, and is subject to the corresponding license
* (see "Freescale CMSIS-SVD License Agreement.pdf" in the parent directory).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
////////////////////////////////////////////////////////////////////////
//
// Import from CMSIS-SVD: "Freescale/MKL24Z4.svd"
//
// vendor: Freescale Semiconductor, Inc.
// vendorID: Freescale
// name: MKL24Z4
// series: Kinetis_L
// version: 1.6
// description: MKL24Z4 Freescale Microcontroller
// --------------------------------------------------------------------
//
// C++ Header file, containing architecture specific register
// declarations for use in OpenMPTL. It has been converted directly
// from a CMSIS-SVD file.
//
// https://digint.ch/openmptl
// https://github.com/posborne/cmsis-svd
//
#ifndef ARCH_REG_MCM_HPP_INCLUDED
#define ARCH_REG_MCM_HPP_INCLUDED
#warning "using untested register declarations"
#include <register.hpp>
namespace mptl {
/**
* Core Platform Miscellaneous Control Module
*/
struct MCM
{
static constexpr reg_addr_t base_addr = 0xf0003000;
/**
* Crossbar Switch (AXBS) Slave Configuration
*/
struct PLASC
: public reg< uint16_t, base_addr + 0x8, ro, 0x7 >
{
using type = reg< uint16_t, base_addr + 0x8, ro, 0x7 >;
using ASC = regbits< type, 0, 8 >; /**< Each bit in the ASC field indicates whether there is a corresponding connection to the crossbar switch's slave input port. */
};
/**
* Crossbar Switch (AXBS) Master Configuration
*/
struct PLAMC
: public reg< uint16_t, base_addr + 0xa, ro, 0xD >
{
using type = reg< uint16_t, base_addr + 0xa, ro, 0xD >;
using AMC = regbits< type, 0, 8 >; /**< Each bit in the AMC field indicates whether there is a corresponding connection to the AXBS master input port. */
};
/**
* Platform Control Register
*/
struct PLACR
: public reg< uint32_t, base_addr + 0xc, rw, 0 >
{
using type = reg< uint32_t, base_addr + 0xc, rw, 0 >;
using ARB = regbits< type, 9, 1 >; /**< Arbitration select */
using CFCC = regbits< type, 10, 1 >; /**< Clear Flash Controller Cache */
using DFCDA = regbits< type, 11, 1 >; /**< Disable Flash Controller Data Caching */
using DFCIC = regbits< type, 12, 1 >; /**< Disable Flash Controller Instruction Caching */
using DFCC = regbits< type, 13, 1 >; /**< Disable Flash Controller Cache */
using EFDS = regbits< type, 14, 1 >; /**< Enable Flash Data Speculation */
using DFCS = regbits< type, 15, 1 >; /**< Disable Flash Controller Speculation */
using ESFC = regbits< type, 16, 1 >; /**< Enable Stalling Flash Controller */
};
/**
* Compute Operation Control Register
*/
struct CPO
: public reg< uint32_t, base_addr + 0x40, rw, 0 >
{
using type = reg< uint32_t, base_addr + 0x40, rw, 0 >;
using CPOREQ = regbits< type, 0, 1 >; /**< Compute Operation request */
using CPOACK = regbits< type, 1, 1 >; /**< Compute Operation acknowledge */
using CPOWOI = regbits< type, 2, 1 >; /**< Compute Operation wakeup on interrupt */
};
};
} // namespace mptl
#endif // ARCH_REG_MCM_HPP_INCLUDED
| [
"axel@tty0.ch"
] | axel@tty0.ch |
1bc5d3bb4b84ebbdaa923de8c29ea3928f69730c | a3e3a049361f69cb3647b8014fbba44bc4a7b49f | /winApi/winApi/singletonBase.h | e3bfff1b7c4a697d2b484b6aa00cdf2c69691f5f | [] | no_license | UnripeBird/2DGame | ced2039ff2455668e95467773fe2d0a2f6b20382 | c0ed7bab4cd2745f53bbabe8b347b637bae13e53 | refs/heads/master | 2021-09-09T10:05:48.235828 | 2018-01-01T13:22:05 | 2018-01-01T13:22:05 | 114,519,786 | 1 | 1 | null | null | null | null | UHC | C++ | false | false | 929 | h | #pragma once
//===================================
// ## singletonBase ## (싱글톤 패턴)
//===================================
//template<typename T>
template <class T>
class singletonBase
{
protected:
//싱글톤 인스턴스 선언
static T* singleton;
singletonBase() {}
~singletonBase() {}
public:
//싱글톤 가져오기
static T* getSingleton(void);
//싱글톤 메모리에서 해제하기
void releaseSingleton(void);
};
//싱글톤 초기화
template <typename T>
T* singletonBase<T>::singleton = 0;
//싱글톤 가져오기
template <typename T>
T* singletonBase<T>::getSingleton(void)
{
//싱글톤이 없으면 새로 생성
if (!singleton) singleton = new T;
return singleton;
}
//싱글톤 메모리에서 해제
template <typename T>
void singletonBase<T>::releaseSingleton(void)
{
//싱글톤이 있다면 메모리에서 해제
if (singleton)
{
delete singleton;
singleton = 0;
}
} | [
"hotcoll@naver.com"
] | hotcoll@naver.com |
1078c8e51a6f1c23b159943a32a1fd3d7604bbdb | 2822dcf0ccf6497f1a17184c6f504e070b904c80 | /Graph/Medium/Bellman-Ford-Graph-Shortest-path.cpp | 458df835e99771061a607ba4e138d6c30cf4d143 | [] | no_license | DangZhonghua/CodingPractice | a57893a9ed03f48ac8193dff05d1e002abf1b198 | 2ca27e153ba844f6b82a4de274821743b797ddd2 | refs/heads/master | 2021-01-24T04:30:04.091210 | 2019-11-10T11:27:34 | 2019-11-10T11:27:34 | 122,940,460 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,799 | cpp | #include<climits>
#include<unordered_map>
#include<vector>
#include<iostream>
using namespace std;
int Init_Single_Source(unordered_map<int,int>& mapD, int V, int s)
{
for(int v = 0; v<V; ++v)
{
mapD.insert(std::make_pair(v, INT_MAX));
}
mapD[s] = 0;
return 0;
}
int Relax(unordered_map<int,int>& mapD, int u, int v, vector<vector<int> >& G, bool& bRelax)
{
auto itu = mapD.find(u);
auto itv = mapD.find(v);
if(INT_MAX != itu->second && INT_MAX != G[u][v])
{
if(itv->second>itu->second+G[u][v])
{
mapD[v] = (itu->second + G[u][v]);
bRelax = true;
}
}
return 0;
}
int Bellman_Ford( vector<vector<int> >& G, int V, int s)
{
unordered_map<int,int> mapD;
Init_Single_Source(mapD,V,s);
bool bRelax = false;
for(int i = 1; i<V; ++i)
{
for(int u = 0; u<V; ++u)
{
for(int v = 0; v<V; ++v)
{
bRelax = false;
Relax(mapD,u,v,G,bRelax);
}
}
}
//Detect negative weight Cycle.
for(int u = 0; u<V; ++u)
{
for(int v = 0; v<V; ++v)
{
bRelax = false;
Relax(mapD,u,v,G,bRelax);
if(bRelax)
{
break;
}
}
}
if(!bRelax)
{
for(int i = 0; i <V; ++i)
{
cout<<"["<<s<<":"<<i<<":"<<mapD[i]<<"].\n";
}
}
return 0;
}
int main()
{
int t = 0;
int V = 0;
cin >> t;
while (t)
{
--t;
cin >> V;
vector< vector<int> > D;
for (int u = 0; u < V; ++u)
{
D.push_back(vector<int>());
for (int v = 0; v < V; ++v)
{
int e;
cin >> e;
D[u].push_back(e);
}
}
Bellman_Ford(D, V,V-1);
}
return 0;
} | [
"richard.dang@arcserve.com"
] | richard.dang@arcserve.com |
be804180e6af8a2de3b239a5a9599224cd368468 | 9fa292d97ceb374068d355bd41097d0407d68bd3 | /3rdParty/include/gpstk/Axis.hpp | d204e1c85d5ddfd96b468504f5c1d67a097484f1 | [
"MIT",
"Zlib",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | mfkiwl/rspf_v2.0 | 4d90153b92cc416663c798e05f87e348ad8792ef | f22d2707b775a4776fc8359a255f39c26ecc96a3 | refs/heads/master | 2021-05-27T04:36:34.132569 | 2013-07-16T04:04:12 | 2013-07-16T04:04:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,913 | hpp | #pragma ident "$Id: Axis.hpp 2091 2009-08-21 14:24:47Z afarris $"
/// @file Axis.hpp Used to draw an axis. Class declarations.
//============================================================================
//
// This file is part of GPSTk, the GPS Toolkit.
//
// The GPSTk is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 2.1 of the License, or
// any later version.
//
// The GPSTk is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with GPSTk; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Copyright 2004, The University of Texas at Austin
//
//============================================================================
#ifndef VPLOT_AXIS_H
#define VPLOT_AXIS_H
#include <cmath>
#include <cstdio>
#include "AxisStyle.hpp"
#include "GraphicsConstants.hpp"
#include "Frame.hpp"
/**
* Drawing basic plots using the classes in the vdraw library.
*/
namespace vplot
{
/*
* I probably need a class for the following things:
* - Direction for axis
* - Bounds!
* - Bound generation from min/max (with buffer area? round?)
* - If this is a seperate class it needs a set of COPY commands
* that copy to a different orientation. Or a mirror setting that
* does so automagically.
*/
/**
* This class is used to draw a simple axis. It can be configured mostly
* by using an AxisStyle but specific things as to this particular axis are
* modified in this class.
*/
class Axis
{
public:
static const double RIGHT; // = 0;
static const double UP ; // = RIGHT+vdraw::HALF_PI;
static const double LEFT ; // = UP+vdraw::HALF_PI;
static const double DOWN ; // = LEFT+vdraw::HALF_PI;
static const double N ; // = UP;
static const double E ; // = RIGHT;
static const double S ; // = DOWN;
static const double W ; // = LEFT;
static const double NORTH; // = N;
static const double EAST ; // = E;
static const double SOUTH; // = S;
static const double WEST ; // = W;
/*
* Constructor/Destructor
*/
/**
* Constructor.
* @param ix Start x position
* @param iy Start y position
* @param ex End x position
* @param ey End y position
* @param length Length of the axis (in frame space)
* @param imin Minimum of the axis
* @param imax Maximum of the axis
* @param style Style of the axis
*/
Axis(double ix, double iy, double ex, double ey, double length, double imin, double imax, const AxisStyle &style=AxisStyle())
{
//Calculate direction
/*
* tan(dir) = opposite / adjacent;
* arctan(opposite/adjacent) = dir;
* opposite = (ey-iy);
* adjacent = (ex-ix);
*/
double direction;
if(ex==ix)
{
if(ey < iy) direction=vdraw::PI;
else direction=0;
}
else if(ey==iy)
{
if(ex < ix) direction=vdraw::PI+vdraw::HALF_PI;
else direction=vdraw::HALF_PI;
}
else
{
direction=atan((ey-iy)/(ex-ix));
if(direction < 0) direction=vdraw::TWO_PI+direction;
}
init(ix,iy,direction,length,imin,imax,style);
}
/**
* Constructor.
* @param ix Start x position
* @param iy Start y position
* @param direction Direction the axis moves toward
* @param length Length of the axis (in frame space)
* @param imin Minimum of the axis
* @param imax Maximum of the axis
* @param style Style of the axis
*/
Axis(double ix, double iy, double direction, double length, double imin, double imax, const AxisStyle &style=AxisStyle())
{
init(ix,iy,direction,length,imin,imax,style);
}
/**
*
*/
~Axis()
{
}
/*
* Accessors/Modifiers
*/
/// Set the x and y position
inline void setPosition(double ix, double iy) { x=ix; y=iy; }
/// Set the length
inline void setLength(double length) { line_length=length; }
/// Set the range
inline void setRange(double imin, double imax) { min=imin; max=imax; axesMin=min; axesMax=max; }
/// Set the gap (distance in plot space between ticks)
inline void setGap(double igap) { gap=igap; }
/// Set the angle for the axis
void setAngle(double angle);
/*
* Methods
*/
/**
* Draw this zxis to this frame
* @param ff Pointer to frame to draw to
*/
void drawToFrame(const vdraw::Frame &ff);
/**
* Finds out the x, y point given a value.
* @param[out] x
* @param[out] y
* @param[in] value
* @return
*/
bool pointFromValue(double &x, double &y, double value);
/**
* Finds out the x, y point for a label above the axis given a value.
* @param[out] x
* @param[out] y
* @param[out] rotation
* @param[in] value
* @return
*/
inline bool labelPointAbove(double &x, double &y, double &rotation, double value)
{
return labelPoint(x,y,rotation,value,AxisStyle::ABOVE);
}
/**
* Finds out the x, y point for a label below the axis given a value.
* @param[out] x
* @param[out] y
* @param[out] rotation
* @param[in] value
* @return
*/
inline bool labelPointBelow(double &x, double &y, double &rotation, double value)
{
return labelPoint(x,y,rotation,value,AxisStyle::BELOW);
}
/// Axis style
AxisStyle axis_style;
protected:
/*
* Funtions
*/
/**
* Initializer (the real constructor).
* @param ix Start x position
* @param iy Start y position
* @param direction Direction the axis moves toward
* @param length Length of the axis (in frame space)
* @param imin Minimum of the axis
* @param imax Maximum of the axis
* @param style Style of the axis
*/
void init(double ix, double iy, double direction, double length, double imin, double imax, const AxisStyle &style);
/*
* Old idea for a helper to draw ticks. I like my ascii art too much to
* delete it for now :)
*
* For example:
* sr=.5 sv=0 |--1--|=fd
* |-------50%-------| |--5--|=rd
* |-----|-----|-----|-----|-----|-----| <-- Actual Line
* -3 -2 -1 0 1 2 3 <-- Actual labels
* Would call as follows:
* axisHelper(f,0.5,0,5,1)
*
* sr Start ratio (% of length to begin point)
* sv Start value (in plot space)
* rd Real distance (in page space)
* fd Fake distance (in plot space)
*/
/**
* Finds out the point for the ratio along the axis line.
* @param[out] x
* @param[out] y
* @param[in] ratio
*/
inline void fromRatio(double &x, double &y, double ratio)
{
x = this->x+cosdir*line_length*ratio;
y = this->y+sindir*line_length*ratio;
}
/**
* Helper to start the recursive method.
* @param ratio Ratio on axis line where tick is.
* @param dist Distance between major ticks
*/
inline void axisTick(double ratio, double dist)
{
axisTickRecursive(
true,
axis_style.tick_recursion_depth,
ratio,
dist,
axis_style.major_tick_length);
}
/**
* Recursively draw the axis ticks.
* @param draw Whether or not to draw this tick
* @param depth Depth that this tick is (used in recursion)
* @param ratio Ratio on axis line where tick is. 0 <= ratio <= 1
* @param dist Ratio distance between this tick and the next one with same depth
* @param length Length of the tick
*/
void axisTickRecursive(bool draw, int depth, double ratio, double dist, double length);
/**
* Draw a tick at this ratio with this length
* @param ratio Where the tick is. 0 <= ratio <= 1
* @param length Length of the tick
*/
void drawTick(double ratio, double length);
/**
* Get the endpoints of a tick at ratio
* @param[out] x1 Upper x output
* @param[out] y1 Upper y output
* @param[out] x2 Lower x output
* @param[out] y2 Lower y output
* @param[in] distratio Distance up axis line, ratio to length
* @param[in] length Length of tick mark
*/
void fromTic(double &x1, double &y1, double &x2, double &y2,
double distratio, double length);
/**
* The major axis ticks will start at the the startpos ratio with value
* startval and at every increment of distpos there will be the previous
* value + distval.
* The *pos are RATIOS of the full width/height.
* The *val are values of the data.
* Note that positions that are less than 0 or greater than 1 are not
* themselves drawn on the axis, but can be important as the recursively
* smaller sub-ticks might be within the 0-1 range.
* @param[out] startpos ratio position (can be <0) of start position
* @param[out] startval value at the start position
* @param[out] distpos ratio distance between positions
* @param[out] distval value distance between each major tick
*/
void guessTickInfo(double &startpos, double &startval, double &distpos, double &distval);
/**
* Put a label at this position.
* @param value The value at which the label will go
* @param direction Direction where the label is AxisStyle::(ABOVE|BELOW)
* @param style TextStyle of the label
*/
bool label(double value, int direction, const vdraw::TextStyle &style);
/**
* Put a label at this position.
* @param str The string for the label
* @param value The value at which the label will go
* @param direction Direction where the label is AxisStyle::(ABOVE|BELOW)
* @param style TextStyle of the label
*/
bool label(const char *str, double value, int direction, const vdraw::TextStyle &style);
/**
* Put a label at this position.
* @param t Text object for this label (will be modified)
* @param value The value at which the label will go
* @param direction Direction where the label is AxisStyle::(ABOVE|BELOW)
* @param style TextStyle of the label
*/
bool label(vdraw::Text &t, double value, int direction, const vdraw::TextStyle &style);
/**
* Get the x,y position for a label and its rotation
* Note that rotation needs to be corrected to be right-side up
*/
bool labelPoint(double &x, double &y, double &rotation, double value, int direction);
/*
* This stuff is specific to the axis in its own right.
*/
/// Temporary frame pointer (so we don't have to pass it to every
/// function)
vdraw::Frame f;
/// X coordinate of this axis
double x;
/// Y coordinate of this axis
double y;
/// Length of this axis
double line_length;
/// Direction is an angle in radians (for use with sin, cos)
double line_direction;
/// Sin(line_direction)
double sindir;
/// Cos(line_direction)
double cosdir;
/// Sin(line_direction+PI/2)
double sintic;
/// Cos(line_direction+PI/2)
double costic;
/*
* This stuff is related to the data.
*/
/// For the axis, this is the data's maximum for the axis to show.
double max;
/// For the axis, this is the data's maximum from which to draw tics.
/// This is not necessarily within the bounds if the plot is tight.
double axesMax;
/// For the axis, this is the data's minimum for the axis to show.
double min;
/// For the axis, this is the data's minimum from which to draw tics.
/// This is not necessarily within the bounds if the plot is tight.
double axesMin;
/// For the axis, this is the gap between tick marks. This is 0 if
/// this is to be determined by the Axis.
double gap;
};
}
#endif //VPLOT_AXIS_H
| [
"loongfee@gmail.com"
] | loongfee@gmail.com |
d5eadf7878df64bf3b467a32da159735d5dffe70 | 501b36fada85d9e378c265815cd71ec13ccea537 | /05-ScenceManager/Koopas.h | 5725a95893ffd3c964b69d933313b04fcefa59c9 | [] | no_license | tranhuywin/gamedev-Mario-bros3 | 1918c6aa58a951d0d4b18d63681fdffbf11059b0 | b486ada1ffecc8e74f67d51e454fa37ddc81299a | refs/heads/master | 2023-06-25T23:10:56.401034 | 2021-07-23T13:20:53 | 2021-07-23T13:20:53 | 307,398,450 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,094 | h | #pragma once
#include "GameObject.h"
#include "Effect.h"
#include "ObjCheckFalling.h"
#define KOOPAS_WALKING_SPEED 0.001f
#define KOOPAS_PARATROOPA_GREEN_WALKING_SPEED 0.0022f
#define KOOPAS_PARATROOPA_WALKING_SPEED 0.01f
#define KOOPAS_ROTATORY_SPEED 0.2f
#define KOOPAS_DIE_DEFLECT_SPEED 0.02f
#define KOOPAS_SHIEL_DEFLECT_SPEED_VY 0.013f
#define KOOPAS_SHIEL_DEFLECT_SPEED_VX 0.003f
#define KOOPAS_GRAVITY 0.001f //0.0019f
#define KOOPAS_PARATROOPA_GREEN_DEFLECT_SPEED 0.017f //
#define KOOPAS_PARATROOPA_GREEN_FALL_SPEED 0.01f
#define KOOPAS_DIE 0.1f
#define KOOPAS_BBOX_WIDTH 15
#define KOOPAS_BBOX_HEIGHT 26
#define KOOPAS_BBOX_HEIGHT_SHELL 16
#define KOOPA_PARATROOPA_RED_FLY_X_MIN 32
#define KOOPA_PARATROOPA_RED_FLY_X_MAX 128
#define KOOPA_PARATROOPA_RED_FLY_VY 0.005f
#define KOOPAS_STATE_WALKING 100
#define KOOPAS_STATE_SHELL 200
#define KOOPAS_STATE_ROTATORY 300
#define KOOPAS_STATE_PREPARE_WAKE_UP 400
#define KOOPAS_STATE_FLYING_UP 500
#define KOOPAS_STATE_FLYING_DOWN 600
#define KOOPAS_STATE_DIE 9999
#define KOOPAS_ANI_WALKING_RIGHT_RED 0
#define KOOPAS_ANI_WALKING_LEFT_RED 1
#define KOOPAS_ANI_ROTATORY_RIGHT_RED 2
#define KOOPAS_ANI_ROTATORY_LEFT_RED 3
#define KOOPAS_ANI_SHELL_RED 4
#define KOOPAS_ANI_SHELL_TAIL_ATTACK_RED 5
#define KOOPAS_ANI_SHELL_TAIL_ATTACK_ROTATORY_RED 6
#define KOOPAS_ANI_SHELL_TAIL_ATTACK_PREPARE_WAKE_UP_RED 7
#define KOOPAS_ANI_WALKING_RIGHT_GREEN 8
#define KOOPAS_ANI_WALKING_LEFT_GREEN 9
#define KOOPAS_ANI_ROTATORY_RIGHT_GREEN 10
#define KOOPAS_ANI_ROTATORY_LEFT_GREEN 11
#define KOOPAS_ANI_SHELL_GREEN 12
#define KOOPAS_ANI_SHELL_TAIL_ATTACK_GREEN 13
#define KOOPAS_ANI_SHELL_TAIL_ATTACK_ROTATORY_GREEN 14
#define KOOPAS_ANI_SHELL_TAIL_ATTACK_PREPARE_WAKE_UP_GREEN 15
#define KOOPA_PARATROOPA_GREEN_ANI_WING_RIGHT 16
#define KOOPA_PARATROOPA_GREEN_ANI_JUMP_RIGHT 17
#define KOOPA_PARATROOPA_GREEN_ANI_WING_LEFT 18
#define KOOPA_PARATROOPA_GREEN_ANI_JUMP_LEFT 19
#define KOOPA_PARATROOPA_RED_ANI_FLYING_LEFT 20
#define KOOPAS_TIME_WAKE_UP 2000
#define KOOPAS_TIME_SLEEP 5000
#define KOOPAS_TYPE_KOOPA_TROOPA_RED 0
#define KOOPAS_TYPE_KOOPA_TROOPA_GREEN 1
#define KOOPAS_TYPE_KOOPA_PARATROOPA_GREEN 2
#define KOOPAS_TYPE_KOOPA_PARATROOPA_RED 3
class CKoopas : public CGameObject
{
virtual void GetBoundingBox(float &left, float &top, float &right, float &bottom);
virtual void Update(ULONGLONG dt, vector<LPGAMEOBJECT> *coObjects);
virtual void Render();
bool ShakingLeft;
int Sleep, PrepareWakeUp;
float XLeftBrick = 0, XRightBrick = 0;
ULONGLONG Sleep_start, PrepareWakeUp_start;
public:
bool TailAttack, IsCatching;
int TypeKoopas;
Effect* effect = NULL;
CKoopas(int TypeKoopas);
ObjCheckFalling* objCheckFalling = new ObjCheckFalling();
virtual void SetState(int state);
void BeCatch(LPGAMEOBJECT mario, float YShell);
void StartSleep() { Sleep = 1; Sleep_start = GetTickCount64(); }
void StartPrepareWakeUp() { PrepareWakeUp = 1; PrepareWakeUp_start = GetTickCount64(); }
}; | [
"57520628+tranhuywin@users.noreply.github.com"
] | 57520628+tranhuywin@users.noreply.github.com |
21a8b425e8d4ae6b9a2d83fa3cd694deadb64c8e | dbef9fa1e78187bf06df4f9b25f3e19fc28638b5 | /src/FuncLib/Compile/FuncsDefReader.cpp | 1dbc2c0e236323ecb8244f0eee8b1aa71f82533b | [] | no_license | YigaoFan/RPC | dd9001bb59669c0dacd0fea413e2b3fb0616d777 | dd8dea093fc1c5e7907f27d74bd61fb96deafd62 | refs/heads/master | 2023-03-20T04:52:46.911602 | 2021-03-11T07:00:43 | 2021-03-11T07:00:43 | 158,654,698 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 498 | cpp | #include "FuncsDefReader.hpp"
namespace FuncLib::Compile
{
using ::std::getline;
FuncsDefReader::FuncsDefReader(decltype(_istream) istream)
: _istream(move(istream))
{ }
void FuncsDefReader::ResetReadPos()
{
_istream->clear();
_istream->seekg(0, istream::beg);
}
Generator<string> FuncsDefReader::GetLineCodeGenerator()
{
while (not _istream->eof())
{
string line;
getline(*_istream, line);
line.push_back('\n');
co_yield move(line);
line.clear();
}
}
}
| [
"fanyigao@qq.com"
] | fanyigao@qq.com |
3a612d49d2cb25889974d2f0e351409fb513149f | 56cbbba9bfe7d7b1b54ec52bd221741c5c73b749 | /link/MissionSyncer.h | 1660092c6774555f4be1a624fea7d7251b8ce160 | [] | no_license | pragsmike/xbm3pi-ugv | 954dc55e32d8c460a2f8fb8c0bc98110424a5b18 | dd98865f43a57f27e8a4ce5e9da7fbab296ceba2 | refs/heads/master | 2021-01-25T00:28:21.131608 | 2012-01-01T17:08:25 | 2012-01-01T17:08:25 | 123,296,242 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 694 | h | /*
* MissionSyncer.h
*
* Created on: Dec 31, 2011
* Author: mg
*/
#ifndef MISSIONSYNCER_H_
#define MISSIONSYNCER_H_
#include "mavlink.h"
#include "../TelemetryData.h"
#include "IMsgSource.h"
class MissionSyncer : public IMsgSource {
public:
MissionSyncer(TelemetryData &data);
virtual ~MissionSyncer();
int available(void);
mavlink_message_t *nextMessage();
void sendMissionList();
void sendMissionRequest(uint8_t system, uint8_t component, uint8_t index);
private:
int pending;
TelemetryData *telemetryData;
mavlink_mission_count_t param;
mavlink_mission_request_t mission_request;
mavlink_message_t msg;
};
#endif /* MISSIONSYNCER_H_ */
| [
"pragsmike@gmail.com"
] | pragsmike@gmail.com |
1ceeb4c05f1d5af09ecf1ffa341d16d77acc457a | 1d928c3f90d4a0a9a3919a804597aa0a4aab19a3 | /c++/libtorrent/2016/8/announce_entry.cpp | 3f3d7e8d55bfc71f88f22c353e6171273a949c54 | [] | no_license | rosoareslv/SED99 | d8b2ff5811e7f0ffc59be066a5a0349a92cbb845 | a062c118f12b93172e31e8ca115ce3f871b64461 | refs/heads/main | 2023-02-22T21:59:02.703005 | 2021-01-28T19:40:51 | 2021-01-28T19:40:51 | 306,497,459 | 1 | 1 | null | 2020-11-24T20:56:18 | 2020-10-23T01:18:07 | null | UTF-8 | C++ | false | false | 4,220 | cpp | /*
Copyright (c) 2015-2016, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/config.hpp"
#include "libtorrent/announce_entry.hpp"
#include "libtorrent/string_util.hpp" // for is_space
#include "libtorrent/aux_/time.hpp"
#include "libtorrent/aux_/session_settings.hpp"
namespace libtorrent
{
enum
{
// wait at least 5 seconds before retrying a failed tracker
tracker_retry_delay_min = 5,
// when tracker_failed_max trackers
// has failed, wait 60 minutes instead
tracker_retry_delay_max = 60 * 60
};
announce_entry::announce_entry(std::string const& u)
: url(u)
, next_announce(min_time())
, min_announce(min_time())
, scrape_incomplete(-1)
, scrape_complete(-1)
, scrape_downloaded(-1)
, tier(0)
, fail_limit(0)
, fails(0)
, updating(false)
, source(0)
, verified(false)
, start_sent(false)
, complete_sent(false)
, send_stats(true)
, triggered_manually(false)
{}
announce_entry::announce_entry()
: next_announce(min_time())
, min_announce(min_time())
, scrape_incomplete(-1)
, scrape_complete(-1)
, scrape_downloaded(-1)
, tier(0)
, fail_limit(0)
, fails(0)
, updating(false)
, source(0)
, verified(false)
, start_sent(false)
, complete_sent(false)
, send_stats(true)
, triggered_manually(false)
{}
announce_entry::~announce_entry() = default;
int announce_entry::next_announce_in() const
{ return total_seconds(next_announce - aux::time_now()); }
int announce_entry::min_announce_in() const
{ return total_seconds(min_announce - aux::time_now()); }
void announce_entry::reset()
{
start_sent = false;
next_announce = min_time();
min_announce = min_time();
}
void announce_entry::failed(time_duration const tracker_backoff, int const retry_interval)
{
++fails;
// the exponential back-off ends up being:
// 7, 15, 27, 45, 95, 127, 165, ... seconds
// with the default tracker_backoff of 250
int const tracker_backoff_seconds = total_seconds(tracker_backoff);
int delay = (std::min)(tracker_retry_delay_min + int(fails) * int(fails)
* tracker_retry_delay_min * tracker_backoff_seconds / 100
, int(tracker_retry_delay_max));
delay = (std::max)(delay, retry_interval);
next_announce = aux::time_now() + seconds(delay);
updating = false;
}
bool announce_entry::can_announce(time_point now, bool is_seed) const
{
// if we're a seed and we haven't sent a completed
// event, we need to let this announce through
bool need_send_complete = is_seed && !complete_sent;
return now >= next_announce
&& (now >= min_announce || need_send_complete)
&& (fails < fail_limit || fail_limit == 0)
&& !updating;
}
void announce_entry::trim()
{
while (!url.empty() && is_space(url[0]))
url.erase(url.begin());
}
}
| [
"rodrigosoaresilva@gmail.com"
] | rodrigosoaresilva@gmail.com |
59bae573358fead577fdd2d8ee8b8dd03a065f84 | ea3719ca6418482df5d1bbe38851114684794e9f | /Algorithms/168. Excel Sheet Column Title/168. Excel Sheet Column Title.cpp | f0640da3bfc65864a63028fa45c2c623f9d613e5 | [] | no_license | JokerLbz/Leetcode | 131335a48b1607df31c1e1b23b81b3acb1eaad38 | 26f0e97c5168c45929dac5d7d41c78eef8321a56 | refs/heads/master | 2020-04-25T08:59:41.535235 | 2019-04-20T12:58:07 | 2019-04-20T12:58:07 | 172,664,045 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 639 | cpp | //Question : 168. Excel Sheet Column Title
//URL : https://leetcode.com/problems/excel-sheet-column-title/
//Approach : Intuition
//Runtime : 4 ms (100%)
//Memory Usage : 8 MB (73.83%)
//Time complexity : O(log(26) n)
//Space complexity : O(1)
//P.S. : There is a one line solution on https://leetcode.com/problems/excel-sheet-column-title/discuss/51398/My-1-lines-code-in-Java-C%2B%2B-and-Python
class Solution {
public:
string convertToTitle(int n) {
string res = "";
while(n)
{
res.insert(res.begin(), 1, (char)((n - 1) % 26 + 'A'));
--n /= 26;
}
return res;
}
}; | [
"lbz1996@hotmail.com"
] | lbz1996@hotmail.com |
8488ade966703065c95d04f79c02b6d878629971 | 6358dcc674849b0cc83b33922147f7fc3eeea1ff | /BookSample_CPP/07/StrList/MyString.h | f5c97a0c8d732d190b06c4760f76983daedf44a8 | [] | no_license | calla987/Book_CPP_KNOU | e34e3414aefaf59701ba37e936bdc68951469bd2 | e8f91f032052762012ea35644d365677e97c3d1e | refs/heads/master | 2021-05-29T18:30:16.518251 | 2015-10-03T09:20:32 | 2015-10-03T09:20:32 | null | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 1,266 | h | #ifndef MY_STRING_H_INCLUDED
#define MY_STRING_H_INCLUDED
#include <iostream>
class MyString
{
int len; // 문자열의 길이
int bufSize; // 저장 가능한 문자열의 길이
char* buf;
public:
MyString(); // 생성자
MyString(const char* str); // 생성자
MyString(const MyString& mstr); // 복사 생성자
virtual ~MyString(); // 소멸자
int length() const; // 문자열 길이 반환 메소드
// 대입 연산자
const MyString& operator=(const MyString& mstr);
// 문자열 연결 연산자
MyString operator+(const MyString& mstr) const;
MyString operator+=(const MyString& mstr);
bool operator==(const MyString& mstr) const; // 관계연산자 ==
bool operator>(const MyString& mstr) const; // 관계연산자 >
bool operator<(const MyString& mstr) const; // 관계연산자 <
char& operator[](int i);
friend std::ostream& operator<<(std::ostream& os,
const MyString& mstr);
};
// 스트림 출력 연산자
inline std::ostream& operator<<(std::ostream& os, const MyString& mstr)
{
os << mstr.buf;
return os;
}
#endif // #ifndef MY_STRING_H_INCLUDED
| [
"calla987@gmail.com"
] | calla987@gmail.com |
128c9e8cd10b119c9dfcd27f21c7ba4b01176553 | 79611230a3138b0f0c31bdc46bad2eae7a077861 | /result_samecapital.cpp | 4e6a9d59c63a14535ea159717e9f5eee9a8d10d4 | [] | no_license | AustinNicholasNoah/fangdaijisuan | 74888eab922093b87830f86971ca6b1b453600ac | 24c2326afd12cdb3bf6108f63daa2e81236aa624 | refs/heads/master | 2022-11-05T11:23:46.037186 | 2020-06-21T08:21:02 | 2020-06-21T08:21:02 | 273,861,597 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,243 | cpp | #include "result_samecapital.h"
#include "ui_result_samecapital.h"
Result_sameCapital::Result_sameCapital(QWidget *parent) :
QDialog(parent),
ui(new Ui::Result_sameCapital)
{
ui->setupUi(this);
}
Result_sameCapital::~Result_sameCapital()
{
delete ui;
}
void Result_sameCapital::setValue(bool hasFirstPay, long long firstMonthPay, long long decrease, long long loanTotalMoney,
long long interset, long long refundMoney, int months, long long firstPay){
//如果为按贷款总额计算,不需要首付,则禁用文本
ui->label_firstPay->setEnabled(hasFirstPay);
ui->label_firstPay_front->setEnabled(hasFirstPay);
ui->label_firstPay_back->setEnabled(hasFirstPay);
ui->label_firstPay->setText(QString::number(firstPay));
ui->label_firstMonthPay->setText(QString::number(firstMonthPay));
ui->label_loanMoney->setText(QString::number(loanTotalMoney));
ui->label_decreaseMoney->setText(QString::number(decrease));
ui->label_interest->setText(QString::number(interset));
ui->label_refundMoney->setText(QString::number(refundMoney));
ui->label_months->setText(QString::number(months));
ui->label_firstPay->setText(QString::number(firstPay));
}
| [
"1239754456@qq.com"
] | 1239754456@qq.com |
15bec3c4e2c442f6be319b8e65d2216d57199647 | d38bd5737e0de480cba23f139d3fe542dbd4de95 | /ThirdParty/Bullet/src/BulletCollision/CollisionShapes/btCompoundShape.cpp | 8d380828cfeb35526767baba9e3aa27882d0985f | [] | no_license | bmjoy/GameEngine | 56ddc007e0d22cc1fa50d3a56000929c1b6f54bc | 39b59b0e382d0010526b1a40487120e4a143f3c7 | refs/heads/master | 2020-11-23T22:21:51.998221 | 2019-12-16T05:17:22 | 2019-12-16T05:17:22 | 227,844,666 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 11,194 | cpp | /*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "BulletCollision/CollisionShapes/btCompoundShape.h"
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
#include "BulletCollision/BroadphaseCollision/btDbvt.h"
#include "LinearMath/btSerializer.h"
btCompoundShape::btCompoundShape(bool enableDynamicAabbTree, const int initialChildCapacity)
: m_localAabbMin(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT)),
m_localAabbMax(btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT)),
m_dynamicAabbTree(0),
m_updateRevision(1),
m_collisionMargin(btScalar(0.)),
m_localScaling(btScalar(1.),btScalar(1.),btScalar(1.))
{
m_shapeType = COMPOUND_SHAPE_PROXYTYPE;
if (enableDynamicAabbTree)
{
void* mem = btAlignedAlloc(sizeof(btDbvt),16);
m_dynamicAabbTree = new(mem) btDbvt();
btAssert(mem==m_dynamicAabbTree);
}
m_children.reserve(initialChildCapacity);
}
btCompoundShape::~btCompoundShape()
{
if (m_dynamicAabbTree)
{
m_dynamicAabbTree->~btDbvt();
btAlignedFree(m_dynamicAabbTree);
}
}
void btCompoundShape::addChildShape(const btTransform& localTransform,btCollisionShape* shape)
{
m_updateRevision++;
//m_childTransforms.push_back(localTransform);
//m_childShapes.push_back(shape);
btCompoundShapeChild child;
child.m_node = 0;
child.m_transform = localTransform;
child.m_childShape = shape;
child.m_childShapeType = shape->getShapeType();
child.m_childMargin = shape->getMargin();
//extend the local aabbMin/aabbMax
btVector3 localAabbMin,localAabbMax;
shape->getAabb(localTransform,localAabbMin,localAabbMax);
for (int i=0;i<3;i++)
{
if (m_localAabbMin[i] > localAabbMin[i])
{
m_localAabbMin[i] = localAabbMin[i];
}
if (m_localAabbMax[i] < localAabbMax[i])
{
m_localAabbMax[i] = localAabbMax[i];
}
}
if (m_dynamicAabbTree)
{
const btDbvtVolume bounds=btDbvtVolume::FromMM(localAabbMin,localAabbMax);
size_t index = m_children.size();
child.m_node = m_dynamicAabbTree->insert(bounds,reinterpret_cast<void*>(index) );
}
m_children.push_back(child);
}
void btCompoundShape::updateChildTransform(int childIndex, const btTransform& newChildTransform,bool shouldRecalculateLocalAabb)
{
m_children[childIndex].m_transform = newChildTransform;
if (m_dynamicAabbTree)
{
///update the dynamic aabb tree
btVector3 localAabbMin,localAabbMax;
m_children[childIndex].m_childShape->getAabb(newChildTransform,localAabbMin,localAabbMax);
ATTRIBUTE_ALIGNED16(btDbvtVolume) bounds=btDbvtVolume::FromMM(localAabbMin,localAabbMax);
//int index = m_children.size()-1;
m_dynamicAabbTree->update(m_children[childIndex].m_node,bounds);
}
if (shouldRecalculateLocalAabb)
{
recalculateLocalAabb();
}
}
void btCompoundShape::removeChildShapeByIndex(int childShapeIndex)
{
m_updateRevision++;
btAssert(childShapeIndex >=0 && childShapeIndex < m_children.size());
if (m_dynamicAabbTree)
{
m_dynamicAabbTree->remove(m_children[childShapeIndex].m_node);
}
m_children.swap(childShapeIndex,m_children.size()-1);
if (m_dynamicAabbTree)
m_children[childShapeIndex].m_node->dataAsInt = childShapeIndex;
m_children.pop_back();
}
void btCompoundShape::removeChildShape(btCollisionShape* shape)
{
m_updateRevision++;
// Find the children containing the shape specified, and remove those children.
//note: there might be multiple children using the same shape!
for(int i = m_children.size()-1; i >= 0 ; i--)
{
if(m_children[i].m_childShape == shape)
{
removeChildShapeByIndex(i);
}
}
recalculateLocalAabb();
}
void btCompoundShape::recalculateLocalAabb()
{
// Recalculate the local aabb
// Brute force, it iterates over all the shapes left.
m_localAabbMin = btVector3(btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT),btScalar(BT_LARGE_FLOAT));
m_localAabbMax = btVector3(btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT),btScalar(-BT_LARGE_FLOAT));
//extend the local aabbMin/aabbMax
for (int j = 0; j < m_children.size(); j++)
{
btVector3 localAabbMin,localAabbMax;
m_children[j].m_childShape->getAabb(m_children[j].m_transform, localAabbMin, localAabbMax);
for (int i=0;i<3;i++)
{
if (m_localAabbMin[i] > localAabbMin[i])
m_localAabbMin[i] = localAabbMin[i];
if (m_localAabbMax[i] < localAabbMax[i])
m_localAabbMax[i] = localAabbMax[i];
}
}
}
///getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
void btCompoundShape::getAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax) const
{
btVector3 localHalfExtents = btScalar(0.5)*(m_localAabbMax-m_localAabbMin);
btVector3 localCenter = btScalar(0.5)*(m_localAabbMax+m_localAabbMin);
//avoid an illegal AABB when there are no children
if (!m_children.size())
{
localHalfExtents.setValue(0,0,0);
localCenter.setValue(0,0,0);
}
localHalfExtents += btVector3(getMargin(),getMargin(),getMargin());
btMatrix3x3 abs_b = trans.getBasis().absolute();
btVector3 center = trans(localCenter);
btVector3 extent = localHalfExtents.dot3(abs_b[0], abs_b[1], abs_b[2]);
aabbMin = center-extent;
aabbMax = center+extent;
}
void btCompoundShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
{
//approximation: take the inertia from the aabb for now
btTransform ident;
ident.setIdentity();
btVector3 aabbMin,aabbMax;
getAabb(ident,aabbMin,aabbMax);
btVector3 halfExtents = (aabbMax-aabbMin)*btScalar(0.5);
btScalar lx=btScalar(2.)*(halfExtents.x());
btScalar ly=btScalar(2.)*(halfExtents.y());
btScalar lz=btScalar(2.)*(halfExtents.z());
inertia[0] = mass/(btScalar(12.0)) * (ly*ly + lz*lz);
inertia[1] = mass/(btScalar(12.0)) * (lx*lx + lz*lz);
inertia[2] = mass/(btScalar(12.0)) * (lx*lx + ly*ly);
}
void btCompoundShape::calculatePrincipalAxisTransform(btScalar* masses, btTransform& principal, btVector3& inertia) const
{
int n = m_children.size();
btScalar totalMass = 0;
btVector3 center(0, 0, 0);
int k;
for (k = 0; k < n; k++)
{
btAssert(masses[k]>0);
center += m_children[k].m_transform.getOrigin() * masses[k];
totalMass += masses[k];
}
btAssert(totalMass>0);
center /= totalMass;
principal.setOrigin(center);
btMatrix3x3 tensor(0, 0, 0, 0, 0, 0, 0, 0, 0);
for ( k = 0; k < n; k++)
{
btVector3 i;
m_children[k].m_childShape->calculateLocalInertia(masses[k], i);
const btTransform& t = m_children[k].m_transform;
btVector3 o = t.getOrigin() - center;
//compute inertia tensor in coordinate system of compound shape
btMatrix3x3 j = t.getBasis().transpose();
j[0] *= i[0];
j[1] *= i[1];
j[2] *= i[2];
j = t.getBasis() * j;
//add inertia tensor
tensor[0] += j[0];
tensor[1] += j[1];
tensor[2] += j[2];
//compute inertia tensor of pointmass at o
btScalar o2 = o.length2();
j[0].setValue(o2, 0, 0);
j[1].setValue(0, o2, 0);
j[2].setValue(0, 0, o2);
j[0] += o * -o.x();
j[1] += o * -o.y();
j[2] += o * -o.z();
//add inertia tensor of pointmass
tensor[0] += masses[k] * j[0];
tensor[1] += masses[k] * j[1];
tensor[2] += masses[k] * j[2];
}
tensor.diagonalize(principal.getBasis(), btScalar(0.00001), 20);
inertia.setValue(tensor[0][0], tensor[1][1], tensor[2][2]);
}
void btCompoundShape::setLocalScaling(const btVector3& scaling)
{
for(int i = 0; i < m_children.size(); i++)
{
btTransform childTrans = getChildTransform(i);
btVector3 childScale = m_children[i].m_childShape->getLocalScaling();
// childScale = childScale * (childTrans.getBasis() * scaling);
childScale = childScale * scaling / m_localScaling;
m_children[i].m_childShape->setLocalScaling(childScale);
childTrans.setOrigin((childTrans.getOrigin()) * scaling / m_localScaling);
updateChildTransform(i, childTrans,false);
}
m_localScaling = scaling;
recalculateLocalAabb();
}
void btCompoundShape::createAabbTreeFromChildren()
{
if ( !m_dynamicAabbTree )
{
void* mem = btAlignedAlloc(sizeof(btDbvt),16);
m_dynamicAabbTree = new(mem) btDbvt();
btAssert(mem==m_dynamicAabbTree);
for ( int index = 0; index < m_children.size(); index++ )
{
btCompoundShapeChild &child = m_children[index];
//extend the local aabbMin/aabbMax
btVector3 localAabbMin,localAabbMax;
child.m_childShape->getAabb(child.m_transform,localAabbMin,localAabbMax);
const btDbvtVolume bounds=btDbvtVolume::FromMM(localAabbMin,localAabbMax);
size_t index2 = index;
child.m_node = m_dynamicAabbTree->insert(bounds, reinterpret_cast<void*>(index2) );
}
}
}
///fills the dataBuffer and returns the struct name (and 0 on failure)
const char* btCompoundShape::serialize(void* dataBuffer, btSerializer* serializer) const
{
btCompoundShapeData* shapeData = (btCompoundShapeData*) dataBuffer;
btCollisionShape::serialize(&shapeData->m_collisionShapeData, serializer);
shapeData->m_collisionMargin = float(m_collisionMargin);
shapeData->m_numChildShapes = m_children.size();
shapeData->m_childShapePtr = 0;
if (shapeData->m_numChildShapes)
{
btChunk* chunk = serializer->allocate(sizeof(btCompoundShapeChildData),shapeData->m_numChildShapes);
btCompoundShapeChildData* memPtr = (btCompoundShapeChildData*)chunk->m_oldPtr;
shapeData->m_childShapePtr = (btCompoundShapeChildData*)serializer->getUniquePointer(memPtr);
for (int i=0;i<shapeData->m_numChildShapes;i++,memPtr++)
{
memPtr->m_childMargin = float(m_children[i].m_childMargin);
memPtr->m_childShape = (btCollisionShapeData*)serializer->getUniquePointer(m_children[i].m_childShape);
//don't serialize shapes that already have been serialized
if (!serializer->findPointer(m_children[i].m_childShape))
{
btChunk* chunk = serializer->allocate(m_children[i].m_childShape->calculateSerializeBufferSize(),1);
const char* structType = m_children[i].m_childShape->serialize(chunk->m_oldPtr,serializer);
serializer->finalizeChunk(chunk,structType,BT_SHAPE_CODE,m_children[i].m_childShape);
}
memPtr->m_childShapeType = m_children[i].m_childShapeType;
m_children[i].m_transform.serializeFloat(memPtr->m_transform);
}
serializer->finalizeChunk(chunk,"btCompoundShapeChildData",BT_ARRAY_CODE,chunk->m_oldPtr);
}
return "btCompoundShapeData";
}
| [
"ironmandev@gmail.com"
] | ironmandev@gmail.com |
c8ec3a644f59d7758e3c8190f8ef383683678f7d | be97427079b290a4cb1ecda04f3072355d078fd7 | /day 10/part1.cpp | 32a9f67c7119f62a65fd4e9738f41c90a167806b | [] | no_license | RonakNisher/AdventOfCode2018 | 68777c1a68a1760fe53dfe81514f4f46f96a33db | a953e30c2d5f4fc1310458d14392c2044f7bc1bb | refs/heads/master | 2020-04-08T20:37:39.044370 | 2019-06-12T02:22:14 | 2019-06-12T02:22:14 | 159,707,337 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,982 | cpp | // #include "../helper.h"
#include <string>
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <climits>
#include <utility>
#include <algorithm> // std::find
using namespace std;
vector<string> split(string input, const string& delimiters)
{
vector<string> res;
string val = "";
for (auto i : input) {
if(!isspace(i) && delimiters.find(i) == -1)
{
val.push_back(i);
}
else
{
if (val != "")
{
res.push_back(val);
val = "";
}
}
}
if(val != "")
res.push_back(val);
return res;
}
void print(vector<vector<int>>& sky)
{
int colStart = 100;
int colCutOff = 200;
int noOfPoints = 0;
for (const vector<int>& skyRow : sky)
{
if (find(skyRow.begin(), skyRow.end(), 1) != skyRow.end())
{
for (int j = colStart; j < colCutOff; j++)
{
if (skyRow[j] == 1)
cout<<skyRow[j];
else
cout<<" ";
if (skyRow[j] == 1)
noOfPoints++;
}
cout<<endl;
// cout<<"((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((("<<endl;
}
}
cout<<"Total no of points "<<noOfPoints<<endl;
}
int main()
{
string line;
string delimiters = " ,=><";
ifstream myfile ("input.txt");
vector<pair<long, long>> positions;
vector<pair<int, int>> velocities;
vector<string> words;
long minX = INT_MAX, minY = INT_MAX;
long maxX = INT_MIN, maxY = INT_MIN;
if (myfile.is_open())
{
while ( getline(myfile,line) )
{
words = split(line, delimiters);
int x = stoi(words[1]);
int y = stoi(words[2]);
// cout<<x<<", "<<y<<endl;
if (x < minX)
minX = x;
else if (x > maxX)
maxX = x;
if (y < minY)
minY = y;
else if (y > maxY)
maxY = y;
positions.emplace_back(make_pair(x, y));
velocities.emplace_back(make_pair(stoi(words[4]), stoi(words[5])));
}
myfile.close();
}
cout<<"bounds are "<<minX<<", "<<maxX<<" for Y "<<minY<<", "<<maxY<<endl;
int boundSize = 450;
const int rows = boundSize;
const int cols = boundSize;
// std::vector<std::vector<int> > sky(
// rows,
// std::vector<int>(cols)); // Defaults to zero initial value
// for (int i = 0; i < rows; i++)
// {
// cout<<i<<endl;
// for (int j = 0; j < cols; j++)
// sky[i][j] = 0;
// }
// std::vector<std::vector<long> > sky;
std::vector<std::vector<int> > sky(
rows,
std::vector<int>(cols)); // Defaults to zero initial value
cout<<"start "<<endl;
for (int i = 0; i < 50000; i++)
{
minX = INT_MAX, minY = INT_MAX;
maxX = INT_MIN, maxY = INT_MIN;
// cout<<"positions size "<<positions.size()<<endl;
for (int j = 0; j < positions.size(); j++)
{
// cout<<"pos "<<j<<endl;
long newX = int((positions[j].first + velocities[j].first));
long newY = int((positions[j].second + velocities[j].second));
pair<long, long> newPos = make_pair(newX, newY);
// cout<<positions[j].first<<", "<<positions[j].second<<" -> "<<newX<<", "<<newY<<" with vel "<<velocities[j].first<<", "<<velocities[j].second<<endl;
positions[j] = newPos;
// sky[25 + newPos.first][25 + newPos.second] = 1;
if (newX < minX)
minX = newX;
else if (newX > maxX)
maxX = newX;
if (newY < minY)
minY = newY;
else if (newY > maxY)
maxY = newY;
}
// cout<<"bounds are "<<minX<<", "<<maxX<<" for Y "<<minY<<", "<<maxY<<endl;
// cout<<"size rough "<<maxX - minX<<", "<<maxY - minY<<endl;
long xSize = (abs(minX) + abs(maxX) + 1);
long ySize = (abs(minY) + abs(maxY) + 1);
// std::vector<std::vector<long> > sky;
if (xSize < boundSize)
{
cout<<"found at iteration "<<i<<endl;
// for (int i = 0; i <xSize; i++)
// {
// for (int j = 0; j < ySize; j++)
// sky.emplace_back(0);
// }
cout<<xSize<<", "<<ySize<<endl;
cout<<"working..."<<endl;
for (const pair<long, long>& p : positions)
{
int x = ((p.first+abs(minX)));
int y = ((p.second+abs(minY)));
// cout<<x<<", "<<y<<endl;
// cout<<p.first<<", "<<p.second<<endl;
// cout<<"pos is "<<p.first<<" "<<p.first + minX<<endl;
// sky[p.first + abs(minX)][p.second + abs(minY)] = 1;
sky[y][x] = 1;
// sky.at(p.first + abs(minX));
// .at(p.second + abs(minY)) = 1;
}
cout<<"Printing"<<endl;
print(sky);
break;
cout<<"found stuff"<<endl;
}
// sort(positions.begin(), positions.end());
// for (const pair<long, long>& p : positions)
// {
// int x = ((p.first+minX)/10) + minX;
// int y = ((p.second+minY)/10) + minY;
// cout<<x<<", "<<y<<endl;
// // cout<<p.first<<", "<<p.second<<endl;
// // cout<<"pos is "<<p.first<<" "<<p.first + minX<<endl;
// // sky[p.first + abs(minX)][p.second + abs(minY)] = 1;
// sky[y][x] = 1;
// // sky.at(p.first + abs(minX));
// // .at(p.second + abs(minY)) = 1;
// }
// cout<<"Printing"<<endl;
// print(sky);
// cout<<endl;
// cout<<endl;
// cout<<endl;
// for (vector<long> skyRow : sky)
// {
// skyRow.clear();
// }
// sky.clear();
}
cout<<"Done"<<endl;
return 0;
} | [
"rpnisher@ncsu.edu"
] | rpnisher@ncsu.edu |
ff5ec6f7cbada074a47d3956b8f6a8c4d858a895 | 2f822fee325948783f3d83bc462219a8819e488d | /c++App/Plotroc/qcpdocumentobject.h | 85c982cf0c5e678d7e6f562967cc9bc21f5c3489 | [] | no_license | aliakbarRashidi/pipewrap | c6719f9f6d3b725f980b07352ce1e95b0e7ba3d5 | aba704d31896d1ccd63b75a634a37d75b6d80f72 | refs/heads/master | 2020-05-09T21:08:50.111061 | 2016-01-11T16:25:07 | 2016-01-11T16:25:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,794 | h | /***************************************************************************
** **
** QCustomPlot, an easy to use, modern plotting widget for Qt **
** Copyright (C) 2011, 2012, 2013, 2014 Emanuel Eichhammer **
** **
** This program is free software: you can redistribute it and/or modify **
** it under the terms of the GNU General Public License as published by **
** the Free Software Foundation, either version 3 of the License, or **
** (at your option) any later version. **
** **
** This program is distributed in the hope that it will be useful, **
** but WITHOUT ANY WARRANTY; without even the implied warranty of **
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
** GNU General Public License for more details. **
** **
** You should have received a copy of the GNU General Public License **
** along with this program. If not, see http://www.gnu.org/licenses/. **
** **
****************************************************************************
** Author: Emanuel Eichhammer **
** Website/Contact: http://www.qcustomplot.com/ **
** Date: 07.04.14 **
** Version: 1.2.1 **
****************************************************************************/
#ifndef QCPDOCUMENTOBJECT_H
#define QCPDOCUMENTOBJECT_H
#include <QObject>
#include <QTextObjectInterface>
#include <QPicture>
#include <QVariant>
#include <QPainter>
#include "qcustomplot.h"
class QCPDocumentObject : public QObject, public QTextObjectInterface
{
Q_OBJECT
Q_INTERFACES(QTextObjectInterface)
public:
enum { PlotTextFormat = QTextFormat::UserObject + 3902 }; // if your application already uses the id (QTextFormat::UserObject + 3902), just change the id here
enum { PicturePropertyId = 1 };
explicit QCPDocumentObject(QObject *parent = 0);
QSizeF intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format);
void drawObject(QPainter *painter, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format);
static QTextCharFormat generatePlotFormat(QCustomPlot *plot, int width=0, int height=0);
};
Q_DECLARE_METATYPE(QPicture)
#endif // QCPDOCUMENTOBJECT_H
| [
"piers.shepperson@btinternet.com"
] | piers.shepperson@btinternet.com |
074b1f5ff26cc8e24f11d3521b765a6ecc2ea8ad | 3f01176c2037087ca68d19cadb016dc4b4ead932 | /modules/assimp/ext/assimp/code/TargetAnimation.h | 9e517cd631d4a8bf3ba3bfb6faa618bfa3aeaa4c | [
"BSD-3-Clause",
"BSD-2-Clause",
"LGPL-2.0-or-later"
] | permissive | liu3xing3long/inviwo | 02bdad1c6c9838893b736959318e3bc6c6b3c8a1 | 69cca9b6ecd58037bda0ed9e6f53d02f189f19a7 | refs/heads/master | 2020-03-09T02:15:39.355938 | 2018-04-06T13:04:25 | 2018-04-06T13:04:25 | 128,535,802 | 1 | 0 | BSD-2-Clause | 2018-04-07T14:24:21 | 2018-04-07T14:24:21 | null | UTF-8 | C++ | false | false | 5,821 | h | /*
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2012, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the assimp team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------
*/
/** @file Defines a helper class for the ASE and 3DS loaders to
help them compute camera and spot light animation channels */
#ifndef AI_TARGET_ANIMATION_H_INC
#define AI_TARGET_ANIMATION_H_INC
namespace Assimp {
// ---------------------------------------------------------------------------
/** Helper class to iterate through all keys in an animation channel.
*
* Missing tracks are interpolated. This is a helper class for
* TargetAnimationHelper, but it can be freely used for other purposes.
*/
class KeyIterator
{
public:
// ------------------------------------------------------------------
/** Constructs a new key iterator
*
* @param _objPos Object position track. May be NULL.
* @param _targetObjPos Target object position track. May be NULL.
* @param defaultObjectPos Default object position to be used if
* no animated track is available. May be NULL.
* @param defaultTargetPos Default target position to be used if
* no animated track is available. May be NULL.
*/
KeyIterator(const std::vector<aiVectorKey>* _objPos,
const std::vector<aiVectorKey>* _targetObjPos,
const aiVector3D* defaultObjectPos = NULL,
const aiVector3D* defaultTargetPos = NULL);
// ------------------------------------------------------------------
/** Returns true if all keys have been processed
*/
bool Finished() const
{return reachedEnd;}
// ------------------------------------------------------------------
/** Increment the iterator
*/
void operator++();
inline void operator++(int)
{return ++(*this);}
// ------------------------------------------------------------------
/** Getters to retrieve the current state of the iterator
*/
inline const aiVector3D& GetCurPosition() const
{return curPosition;}
inline const aiVector3D& GetCurTargetPosition() const
{return curTargetPosition;}
inline double GetCurTime() const
{return curTime;}
private:
//! Did we reach the end?
bool reachedEnd;
//! Represents the current position of the iterator
aiVector3D curPosition, curTargetPosition;
double curTime;
//! Input tracks and the next key to process
const std::vector<aiVectorKey>* objPos,*targetObjPos;
unsigned int nextObjPos, nextTargetObjPos;
std::vector<aiVectorKey> defaultObjPos,defaultTargetObjPos;
};
// ---------------------------------------------------------------------------
/** Helper class for the 3DS and ASE loaders to compute camera and spot light
* animations.
*
* 3DS and ASE store the differently to Assimp - there is an animation
* channel for the camera/spot light itself and a separate position
* animation channels specifying the position of the camera/spot light
* look-at target */
class TargetAnimationHelper
{
public:
TargetAnimationHelper()
: targetPositions (NULL)
, objectPositions (NULL)
{}
// ------------------------------------------------------------------
/** Sets the target animation channel
*
* This channel specifies the position of the camera/spot light
* target at a specific position.
*
* @param targetPositions Translation channel*/
void SetTargetAnimationChannel (const
std::vector<aiVectorKey>* targetPositions);
// ------------------------------------------------------------------
/** Sets the main animation channel
*
* @param objectPositions Translation channel */
void SetMainAnimationChannel ( const
std::vector<aiVectorKey>* objectPositions);
// ------------------------------------------------------------------
/** Sets the main animation channel to a fixed value
*
* @param fixed Fixed value for the main animation channel*/
void SetFixedMainAnimationChannel(const aiVector3D& fixed);
// ------------------------------------------------------------------
/** Computes final animation channels
* @param distanceTrack Receive camera translation keys ... != NULL. */
void Process( std::vector<aiVectorKey>* distanceTrack );
private:
const std::vector<aiVectorKey>* targetPositions,*objectPositions;
aiVector3D fixedMain;
};
} // ! end namespace Assimp
#endif // include guard
| [
"peter@steneteg.se"
] | peter@steneteg.se |
00bbb3ff981fb0808b1cfa1bc18d22f39490b5e4 | 11ef4bbb8086ba3b9678a2037d0c28baaf8c010e | /Source Code/server/binaries/chromium/gen/services/viz/public/interfaces/compositing/frame_timing_details.mojom-blink-forward.h | 8a787c8e5bbc84d945b6771647d4a5c8d22c34f7 | [] | no_license | lineCode/wasmview.github.io | 8f845ec6ba8a1ec85272d734efc80d2416a6e15b | eac4c69ea1cf0e9af9da5a500219236470541f9b | refs/heads/master | 2020-09-22T21:05:53.766548 | 2019-08-24T05:34:04 | 2019-08-24T05:34:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 941 | h | // Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SERVICES_VIZ_PUBLIC_INTERFACES_COMPOSITING_FRAME_TIMING_DETAILS_MOJOM_BLINK_FORWARD_H_
#define SERVICES_VIZ_PUBLIC_INTERFACES_COMPOSITING_FRAME_TIMING_DETAILS_MOJOM_BLINK_FORWARD_H_
#include "mojo/public/cpp/bindings/struct_ptr.h"
#include "mojo/public/cpp/bindings/lib/native_enum_serialization.h"
#include "mojo/public/cpp/bindings/lib/native_struct_serialization.h"
namespace viz {
namespace mojom {
} // namespace viz
} // namespace mojom
namespace viz {
namespace mojom {
namespace blink {
class FrameTimingDetails;
using FrameTimingDetailsPtr = mojo::StructPtr<FrameTimingDetails>;
} // namespace blink
} // namespace mojom
} // namespace viz
#endif // SERVICES_VIZ_PUBLIC_INTERFACES_COMPOSITING_FRAME_TIMING_DETAILS_MOJOM_BLINK_FORWARD_H_ | [
"wasmview@gmail.com"
] | wasmview@gmail.com |
d904c864286850887e23bdc1a8f3bf9c5f433376 | 5712a01bc06416cf32fb637e10b21b34b938961c | /Zerojudge/b331 NOIP2013 2.表达式求值.cpp | 662a56c928f0b28bb6f7cff75513df3c75392ec3 | [] | no_license | WenShihKen/uva | 654a9f5f3e56935625e061795f152609899b79e5 | 03a3d603941dd9b9ec13e76fb99d24da6749a81b | refs/heads/master | 2021-01-10T14:34:29.580527 | 2020-06-25T15:34:23 | 2020-06-25T15:34:23 | 48,536,090 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 803 | cpp | #include <iostream>
#include <cmath>
#include<iostream>
#include<algorithm>
#include<stack>
#include<string>
using namespace std;
typedef unsigned long long int LL;
#define mod 10000
int main()
{
string in1;
while (getline(cin, in1)) {
stack<LL>temp;
bool oper = false;
LL ans = 0;
for (int i = 0; i < in1.length();) {
if (in1[i] == '+') {
oper = false;
i++;
}
else if (in1[i] == '*') {
oper = true;
i++;
}
else {
LL t = 0;
while (in1[i] >= '0'&&in1[i] <= '9') {
t = t * 10 + in1[i] - '0';
i++;
}
if (!oper) {
temp.push(t);
}
else {
t = (t*temp.top()) % mod;
temp.pop();
temp.push(t);
}
}
}
while (!temp.empty()) {
ans = (ans + temp.top()) % mod;
temp.pop();
}
cout << ans << endl;
}
} | [
"00257142@ntou.edu.tw"
] | 00257142@ntou.edu.tw |
57377b9b517202ebfe4650e8ed460817f7fd347f | e17ef9fd9a8092961bffaef3e9df2d2b3d11c0ce | /lstd/src/lstd/fmt/debug.h | 5cf605a52034a853a1116fdccd6dade122abe6c4 | [] | no_license | Repertoi-e/DataFlow | 510561260506022332a57a63c7e5496e06f010ac | 03ced1e05c898b4b3e7d54e0f583c9bcb04b2ad2 | refs/heads/main | 2023-02-24T17:25:26.571790 | 2021-01-23T00:23:27 | 2021-01-23T00:23:27 | 331,096,922 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,623 | h | #pragma once
#include "../memory/array.h"
#include "arg.h"
LSTD_BEGIN_NAMESPACE
namespace fmt {
struct format_struct_helper {
struct field_entry {
string Name;
arg Arg;
};
format_context *F;
string Name;
array<field_entry> Fields;
bool NoSpecs; // Write the result without taking into account specs for individual arguments
format_struct_helper(format_context *f, const string &name, bool noSpecs) : F(f), Name(name), NoSpecs(noSpecs) {}
// I know we are against hidden freeing but having this destructor is actually really fine.
// Things would be a whole more ugly and complicated without it.
~format_struct_helper() { free(Fields); }
template <typename T>
format_struct_helper *field(const string &name, const T &value) {
append(Fields, {name, make_arg(value)});
return this;
}
void finish();
private:
void write_field(field_entry *entry);
};
struct format_tuple_helper {
format_context *F;
string Name;
array<arg> Fields;
bool NoSpecs; // Write the result without taking into account specs for individual arguments
format_tuple_helper(format_context *f, const string &name, bool noSpecs) : F(f), Name(name), NoSpecs(noSpecs) {}
// I know we are against hidden freeing but having this destructor is actually really fine.
// Things would be a whole more ugly and complicated without it.
~format_tuple_helper() { free(Fields); }
template <typename T>
format_tuple_helper *field(const T &value) {
append(Fields, make_arg(value));
return this;
}
void finish();
};
struct format_list_helper {
format_context *F;
array<arg> Fields;
bool NoSpecs; // Write the result without taking into account specs for individual arguments
format_list_helper(format_context *f, bool noSpecs) : F(f), NoSpecs(noSpecs) {}
// I know we are against hidden freeing but having this destructor is actually really fine.
// Things would be a whole more ugly and complicated without it.
~format_list_helper() { free(Fields); }
template <typename T>
format_list_helper *entries(const array_view<T> &values) {
For(values) append(Fields, make_arg(it));
return this;
}
template <typename T>
format_list_helper *entries(T *begin, T *end) {
return entries(array_view<T>(begin, end - begin));
}
template <typename T>
format_list_helper *entries(T *begin, s64 count) {
return entries(array_view<T>(begin, count));
}
void finish();
};
} // namespace fmt
LSTD_END_NAMESPACE
| [
"dsotirov@windowslive.com"
] | dsotirov@windowslive.com |
0affe148498b99cea8792aad1bfd8503396ae31d | 7ab6bde6f8fdf371921201ca5a0b75c458cd6e7d | /src/dsnotificationinterface.cpp | 1ca28a84984c3fe8f823a549a42d875e0896f45d | [
"MIT"
] | permissive | curiumofficial/Curium-old | 154f5c347d5084f0c3868ae534b63d4b407d7a02 | 2e82cd62875c41e98d26a264bec6be3d50118d21 | refs/heads/master | 2021-09-13T08:14:08.236555 | 2018-04-27T04:33:17 | 2018-04-27T04:33:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,036 | cpp | // Copyright (c) 2014-2017 The Curium Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "chainparams.h"
#include "dsnotificationinterface.h"
#include "instantx.h"
#include "governance.h"
#include "masternodeman.h"
#include "masternode-payments.h"
#include "masternode-sync.h"
#include "privatesend.h"
#ifdef ENABLE_WALLET
#include "privatesend-client.h"
#endif // ENABLE_WALLET
void CDSNotificationInterface::InitializeCurrentBlockTip()
{
LOCK(cs_main);
UpdatedBlockTip(chainActive.Tip(), NULL, IsInitialBlockDownload());
}
void CDSNotificationInterface::AcceptedBlockHeader(const CBlockIndex *pindexNew)
{
masternodeSync.AcceptedBlockHeader(pindexNew);
}
void CDSNotificationInterface::NotifyHeaderTip(const CBlockIndex *pindexNew, bool fInitialDownload)
{
masternodeSync.NotifyHeaderTip(pindexNew, fInitialDownload, connman);
}
void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload)
{
if (pindexNew == pindexFork) // blocks were disconnected without any new ones
return;
masternodeSync.UpdatedBlockTip(pindexNew, fInitialDownload, connman);
// Update global DIP0001 activation status
fDIP0001ActiveAtTip = (VersionBitsState(pindexNew, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0001, versionbitscache) == THRESHOLD_ACTIVE);
if (fInitialDownload)
return;
mnodeman.UpdatedBlockTip(pindexNew);
CPrivateSend::UpdatedBlockTip(pindexNew);
#ifdef ENABLE_WALLET
privateSendClient.UpdatedBlockTip(pindexNew);
#endif // ENABLE_WALLET
instantsend.UpdatedBlockTip(pindexNew);
mnpayments.UpdatedBlockTip(pindexNew, connman);
governance.UpdatedBlockTip(pindexNew, connman);
}
void CDSNotificationInterface::SyncTransaction(const CTransaction &tx, const CBlock *pblock)
{
instantsend.SyncTransaction(tx, pblock);
CPrivateSend::SyncTransaction(tx, pblock);
}
| [
"31669092+mrmetech@users.noreply.github.com"
] | 31669092+mrmetech@users.noreply.github.com |
8135b486c6aacec19ce1d35e8b493406c66dc4fc | 084006eb442b60b82b3d85d61a3b53d21c5c8855 | /shared/Bullet/BulletCollision/CollisionShapes/btTriangleCallback.h | b99adbd636fe1dfa4b39da70268e05287fbd4944 | [
"Zlib",
"LicenseRef-scancode-unknown-license-reference",
"XFree86-1.1",
"BSD-3-Clause"
] | permissive | SethRobinson/proton | 7aadcb38bc676c136dce01b8f6773fd75fa33d55 | 6b1474e75a2acf48d848c70fcb043ce8223001a9 | refs/heads/master | 2023-08-31T11:04:21.575522 | 2023-08-29T07:44:50 | 2023-08-29T07:44:50 | 142,253,855 | 81 | 31 | NOASSERTION | 2023-08-07T22:02:41 | 2018-07-25T05:55:38 | C++ | UTF-8 | C++ | false | false | 1,740 | h | /*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef TRIANGLE_CALLBACK_H
#define TRIANGLE_CALLBACK_H
#include "LinearMath/btVector3.h"
///The btTriangleCallback provides a callback for each overlapping triangle when calling processAllTriangles.
///This callback is called by processAllTriangles for all btConcaveShape derived class, such as btBvhTriangleMeshShape, btStaticPlaneShape and btHeightfieldTerrainShape.
class btTriangleCallback
{
public:
virtual ~btTriangleCallback();
virtual void processTriangle(btVector3* triangle, int partId, int triangleIndex) = 0;
};
class btInternalTriangleIndexCallback
{
public:
virtual ~btInternalTriangleIndexCallback();
virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex) = 0;
};
#endif //TRIANGLE_CALLBACK_H
| [
"seth@rtsoft.com"
] | seth@rtsoft.com |
5892d58b5ba6e9e0501ac5b578d697a92d8a57e5 | 4f164694e147e2caee539395c4bf1a16b0e7ac7b | /ompi/contrib/vt/vt/tools/vtunify/vt_unify_defs_recs.h | 49796bdb9ed01deb0dbc6a04b41d4aad59c620fa | [
"BSD-3-Clause-Open-MPI",
"BSD-3-Clause"
] | permissive | hoyoho/cce-mpi-openmpi-1.7.1 | ad2c120880fa62e86b5a34300bb9de5c9298287b | 808f3378084a5c2a2d3e235c6605b2273673bfd3 | refs/heads/master | 2020-08-16T13:31:54.264871 | 2013-04-29T17:57:37 | 2013-04-29T17:57:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 23,614 | h | /**
* VampirTrace
* http://www.tu-dresden.de/zih/vampirtrace
*
* Copyright (c) 2005-2013, ZIH, TU Dresden, Federal Republic of Germany
*
* Copyright (c) 1998-2005, Forschungszentrum Juelich, Juelich Supercomputing
* Centre, Federal Republic of Germany
*
* See the file COPYING in the package base directory for details
**/
#ifndef _VT_UNIFY_DEFS_RECS_H_
#define _VT_UNIFY_DEFS_RECS_H_
#include "vt_unify_config.h"
#include "vt_defs.h"
#include "vt_inttypes.h"
#include "util/hash.h"
#include "otf.h"
#include <algorithm>
#include <set>
#include <string>
//
// definition record types
//
typedef enum
{
DEF_REC_TYPE__DefCreator,
DEF_REC_TYPE__DefTimerResolution,
DEF_REC_TYPE__DefTimeRange,
DEF_REC_TYPE__DefProcess,
DEF_REC_TYPE__DefProcessGroup,
DEF_REC_TYPE__DefProcessGroupAttributes,
DEF_REC_TYPE__DefSclFile,
DEF_REC_TYPE__DefScl,
DEF_REC_TYPE__DefFileGroup,
DEF_REC_TYPE__DefFile,
DEF_REC_TYPE__DefFunctionGroup,
DEF_REC_TYPE__DefFunction,
DEF_REC_TYPE__DefCollOp,
DEF_REC_TYPE__DefCounterGroup,
DEF_REC_TYPE__DefCounter,
DEF_REC_TYPE__DefCounterAssignments,
DEF_REC_TYPE__DefKeyValue,
DEF_REC_TYPE__DefMarker,
DEF_REC_TYPE__DefComment,
DEF_REC_TYPE__Num
} DefRecTypeT;
//
// DefRec_BaseS
//
struct DefRec_BaseS
{
//
// compare structure for final sort
//
struct SortS
{
bool operator()( const DefRec_BaseS * a, const DefRec_BaseS * b ) const
{
return a->deftoken < b->deftoken;
}
};
DefRec_BaseS( DefRecTypeT _dtype )
: dtype( _dtype ), loccpuid( 0 ), deftoken( 0 ) {}
DefRec_BaseS( const DefRecTypeT & _dtype, const uint32_t & _loccpuid,
const uint32_t & _deftoken )
: dtype( _dtype ), loccpuid( _loccpuid ), deftoken( _deftoken ) {}
virtual ~DefRec_BaseS() {}
#ifdef VT_MPI
virtual VT_MPI_INT getPackSize();
virtual void pack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
virtual void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
#endif // VT_MPI
// NOTE: this operator is actually not used but necessary to work around
// a build error with the Clang++ compiler
// (see http://www.open-mpi.org/community/lists/devel/2012/02/10419.php)
bool operator<( const DefRec_BaseS & a ) const
{
return dtype < a.dtype;
}
DefRecTypeT dtype;
uint32_t loccpuid;
uint32_t deftoken;
};
//
// DefRec_DefCommentS
//
struct DefRec_DefCommentS : DefRec_BaseS
{
//
// compare structure for final sort
//
struct SortS
{
bool operator()( const DefRec_DefCommentS * a,
const DefRec_DefCommentS * b ) const
{
if( a->type == b->type )
return a->deftoken < b->deftoken; // order index
else
return a->type < b->type;
}
};
typedef enum
{
TYPE_START_TIME, TYPE_STOP_TIME, TYPE_VT, TYPE_USER,
TYPE_USRCOM_SEND, TYPE_USRCOM_RECV, TYPE_UNKNOWN
} CommentTypeT;
DefRec_DefCommentS()
: DefRec_BaseS( DEF_REC_TYPE__DefComment ), type( TYPE_UNKNOWN ) {}
DefRec_DefCommentS( const uint32_t & _loccpuid, const uint32_t _orderidx,
const CommentTypeT & _type, const std::string & _comment )
: DefRec_BaseS( DEF_REC_TYPE__DefComment, _loccpuid, _orderidx ),
type( _type ), comment( _comment ) {}
#ifdef VT_MPI
VT_MPI_INT getPackSize();
void pack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
#endif // VT_MPI
// operator for searching
bool operator<( const DefRec_DefCommentS & a ) const
{
if( type == a.type )
return comment < a.comment;
else
return type < a.type;
}
CommentTypeT type;
std::string comment;
};
//
// DefRec_DefCreatorS
//
struct DefRec_DefCreatorS : DefRec_BaseS
{
DefRec_DefCreatorS()
: DefRec_BaseS( DEF_REC_TYPE__DefCreator ) {}
DefRec_DefCreatorS( const std::string & _creator )
: DefRec_BaseS( DEF_REC_TYPE__DefCreator ),
creator( _creator ) {}
#ifdef VT_MPI
VT_MPI_INT getPackSize();
void pack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
#endif // VT_MPI
std::string creator;
};
//
// DefRec_DefTimerResolutionS
//
struct DefRec_DefTimerResolutionS : DefRec_BaseS
{
DefRec_DefTimerResolutionS()
: DefRec_BaseS( DEF_REC_TYPE__DefTimerResolution ),
ticksPerSecond( 0 ) {}
DefRec_DefTimerResolutionS( const uint64_t & _ticksPerSecond )
: DefRec_BaseS( DEF_REC_TYPE__DefTimerResolution ),
ticksPerSecond( _ticksPerSecond ) {}
#ifdef VT_MPI
VT_MPI_INT getPackSize();
void pack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
#endif // VT_MPI
uint64_t ticksPerSecond;
};
//
// DefRec_DefTimeRangeS
//
struct DefRec_DefTimeRangeS : DefRec_BaseS
{
DefRec_DefTimeRangeS()
: DefRec_BaseS( DEF_REC_TYPE__DefTimeRange ),
minTime( 0 ), maxTime( 0 ) {}
DefRec_DefTimeRangeS( const uint32_t & _loccpuid, const uint64_t & _minTime,
const uint64_t & _maxTime )
: DefRec_BaseS( DEF_REC_TYPE__DefTimeRange, _loccpuid, 0 ),
minTime( _minTime ), maxTime( _maxTime ) {}
#ifdef VT_MPI
VT_MPI_INT getPackSize();
void pack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
#endif // VT_MPI
uint64_t minTime;
uint64_t maxTime;
};
//
// DefRec_DefProcessS
//
struct DefRec_DefProcessS : DefRec_BaseS
{
//
// compare structure for final sort
//
struct SortS
{
bool operator()( const DefRec_DefProcessS * a,
const DefRec_DefProcessS * b ) const
{
if( ( a->deftoken & VT_TRACEID_BITMASK ) ==
( b->deftoken & VT_TRACEID_BITMASK ) )
return a->deftoken < b->deftoken;
else
return ( a->deftoken & VT_TRACEID_BITMASK ) <
( b->deftoken & VT_TRACEID_BITMASK );
}
};
DefRec_DefProcessS()
: DefRec_BaseS( DEF_REC_TYPE__DefProcess ),
parent( 0 ) {}
DefRec_DefProcessS( const uint32_t & _deftoken, const std::string & _name,
const uint32_t & _parent )
: DefRec_BaseS( DEF_REC_TYPE__DefProcess, 0, _deftoken ),
name( _name ), parent( _parent ) {}
#ifdef VT_MPI
VT_MPI_INT getPackSize();
void pack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
#endif // VT_MPI
// operator for searching
bool operator<( const DefRec_DefProcessS & a ) const
{
if( parent == a.parent )
return name < a.name;
else
return parent < a.parent;
}
std::string name;
uint32_t parent;
};
//
// DefRec_DefProcessGroupS
//
struct DefRec_DefProcessGroupS : DefRec_BaseS
{
typedef enum
{
TYPE_ALL, TYPE_NODE, TYPE_MPI_COMM_WORLD, TYPE_MPI_COMM_SELF,
TYPE_MPI_COMM_OTHER, TYPE_MPI_GROUP, TYPE_USER_COMM, TYPE_OTHER,
TYPE_UNKNOWN
} ProcessGroupTypeT;
DefRec_DefProcessGroupS()
: DefRec_BaseS( DEF_REC_TYPE__DefProcessGroup ), type( TYPE_UNKNOWN ),
members_hash( 0 ), nmembers( 0 ), members( 0 ) {}
DefRec_DefProcessGroupS( const uint32_t & _loccpuid,
const uint32_t & _deftoken, const ProcessGroupTypeT & _type,
const std::string & _name, const uint32_t & _nmembers,
const uint32_t * _members )
: DefRec_BaseS( DEF_REC_TYPE__DefProcessGroup, _loccpuid, _deftoken ),
type( _type ), name( _name ), members_hash( 0 ), nmembers( 0 ),
members( 0 )
{
assignMembers( _nmembers, _members, _members + _nmembers );
if( nmembers > 0 &&
( type == TYPE_MPI_COMM_WORLD || type == TYPE_MPI_COMM_OTHER ||
type == TYPE_MPI_GROUP ) )
{
members_hash = vt_hashword( members, nmembers, 0 );
}
}
DefRec_DefProcessGroupS( const DefRec_DefProcessGroupS & a )
: DefRec_BaseS( DEF_REC_TYPE__DefProcessGroup, a.loccpuid, a.deftoken ),
type( a.type ), name( a.name ), members_hash( a.members_hash ),
nmembers( 0 ), members( 0 )
{
assignMembers( a.nmembers, a.members, a.members + a.nmembers );
}
~DefRec_DefProcessGroupS()
{
if( nmembers > 0 )
delete [] members;
}
template <class InputIterator>
void assignMembers( uint32_t n, InputIterator first, InputIterator last )
{
if( nmembers > 0 )
delete [] members;
nmembers = n;
members = 0;
if( nmembers > 0 )
{
members = new uint32_t[nmembers];
assert( members );
std::copy( first, last, members );
}
}
#ifdef VT_MPI
VT_MPI_INT getPackSize();
void pack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
#endif // VT_MPI
// operator for searching
bool operator<( const DefRec_DefProcessGroupS & a ) const
{
if( type == a.type )
{
if( nmembers == a.nmembers )
{
if( name == a.name )
{
return
memcmp( members, a.members,
nmembers * sizeof( uint32_t ) ) < 0;
}
else
{
return name < a.name;
}
}
else
{
return nmembers < a.nmembers;
}
}
else
{
return type < a.type;
}
}
ProcessGroupTypeT type;
std::string name;
uint32_t members_hash;
uint32_t nmembers;
uint32_t * members;
};
//
// DefRec_DefProcessGroupAttributesS
//
struct DefRec_DefProcessGroupAttributesS : DefRec_BaseS
{
DefRec_DefProcessGroupAttributesS()
: DefRec_BaseS( DEF_REC_TYPE__DefProcessGroupAttributes ),
attributes( 0 ) {}
DefRec_DefProcessGroupAttributesS( const uint32_t & _loccpuid,
const uint32_t & _deftoken, const uint32_t & _attributes )
: DefRec_BaseS( DEF_REC_TYPE__DefProcessGroupAttributes, _loccpuid,
_deftoken ), attributes( _attributes ) {}
#ifdef VT_MPI
VT_MPI_INT getPackSize();
void pack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
#endif // VT_MPI
// operator for searching
bool operator<( const DefRec_DefProcessGroupAttributesS & a ) const
{
return attributes < a.attributes;
}
uint32_t attributes;
};
//
// DefRec_DefSclFileS
//
struct DefRec_DefSclFileS : DefRec_BaseS
{
DefRec_DefSclFileS()
: DefRec_BaseS( DEF_REC_TYPE__DefSclFile ) {}
DefRec_DefSclFileS( const uint32_t & _loccpuid, const uint32_t & _deftoken,
std::string _filename)
: DefRec_BaseS( DEF_REC_TYPE__DefSclFile, _loccpuid, _deftoken ),
filename( _filename ) {}
#ifdef VT_MPI
VT_MPI_INT getPackSize();
void pack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
#endif // VT_MPI
// operator for searching
bool operator<( const DefRec_DefSclFileS & a ) const
{
return filename < a.filename;
}
std::string filename;
};
//
// DefRec_DefSclS
//
struct DefRec_DefSclS : DefRec_BaseS
{
DefRec_DefSclS()
: DefRec_BaseS( DEF_REC_TYPE__DefScl ),
sclfile( 0 ), sclline( 0 ) {}
DefRec_DefSclS( const uint32_t & _loccpuid, const uint32_t & _deftoken,
const uint32_t & _sclfile, const uint32_t & _sclline )
: DefRec_BaseS( DEF_REC_TYPE__DefScl, _loccpuid, _deftoken ),
sclfile( _sclfile ), sclline( _sclline ) {}
#ifdef VT_MPI
VT_MPI_INT getPackSize();
void pack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
#endif // VT_MPI
// operator for searching
bool operator<( const DefRec_DefSclS & a ) const
{
if( sclfile == a.sclfile )
return sclline < a.sclline;
else
return sclfile < a.sclfile;
}
uint32_t sclfile;
uint32_t sclline;
};
//
// DefRec_DefFileGroupS
//
struct DefRec_DefFileGroupS : DefRec_BaseS
{
DefRec_DefFileGroupS()
: DefRec_BaseS( DEF_REC_TYPE__DefFileGroup ) {}
DefRec_DefFileGroupS( const uint32_t & _loccpuid, const uint32_t & _deftoken,
const std::string & _name)
: DefRec_BaseS( DEF_REC_TYPE__DefFileGroup, _loccpuid, _deftoken ),
name( _name ) {}
#ifdef VT_MPI
VT_MPI_INT getPackSize();
void pack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
#endif // VT_MPI
// operator for searching
bool operator<( const DefRec_DefFileGroupS & a ) const
{
return name < a.name;
}
std::string name;
};
//
// DefRec_DefFileS
//
struct DefRec_DefFileS : DefRec_BaseS
{
DefRec_DefFileS()
: DefRec_BaseS( DEF_REC_TYPE__DefFile ),
group( 0 ) {}
DefRec_DefFileS( const uint32_t & _loccpuid, const uint32_t & _deftoken,
const std::string & _name, const uint32_t & _group )
: DefRec_BaseS( DEF_REC_TYPE__DefFile, _loccpuid, _deftoken ),
name( _name ), group( _group ) {}
#ifdef VT_MPI
VT_MPI_INT getPackSize();
void pack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
#endif // VT_MPI
// operator for searching
bool operator<( const DefRec_DefFileS & a ) const
{
if( group == a.group )
return name < a.name;
else
return group < a.group;
}
std::string name;
uint32_t group;
};
//
// DefRec_DefFunctionGroupS
//
struct DefRec_DefFunctionGroupS : DefRec_BaseS
{
DefRec_DefFunctionGroupS()
: DefRec_BaseS( DEF_REC_TYPE__DefFunctionGroup ) {}
DefRec_DefFunctionGroupS( const uint32_t & _loccpuid,
const uint32_t & _deftoken, const std::string & _name )
: DefRec_BaseS( DEF_REC_TYPE__DefFunctionGroup, _loccpuid, _deftoken ),
name( _name ) {}
#ifdef VT_MPI
VT_MPI_INT getPackSize();
void pack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
#endif // VT_MPI
// operator for searching
bool operator<( const DefRec_DefFunctionGroupS & a ) const
{
return name < a.name;
}
std::string name;
};
//
// DefRec_DefFunctionS
//
struct DefRec_DefFunctionS : DefRec_BaseS
{
DefRec_DefFunctionS()
: DefRec_BaseS( DEF_REC_TYPE__DefFunction ),
group( 0 ), scltoken( 0 ) {}
DefRec_DefFunctionS(const uint32_t & _loccpuid, const uint32_t & _deftoken,
const std::string & _name, const uint32_t & _group,
const uint32_t & _scltoken )
: DefRec_BaseS( DEF_REC_TYPE__DefFunction, _loccpuid, _deftoken ),
name( _name ), group( _group ), scltoken( _scltoken ) {}
#ifdef VT_MPI
VT_MPI_INT getPackSize();
void pack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
#endif // VT_MPI
// operator for searching
bool operator<( const DefRec_DefFunctionS & a ) const
{
if( group == a.group )
{
if( scltoken == a.scltoken )
{
return name < a.name;
}
else
{
return scltoken < a.scltoken;
}
}
else
{
return group < a.group;
}
}
std::string name;
uint32_t group;
uint32_t scltoken;
};
//
// DefRec_DefCollOpS
//
struct DefRec_DefCollOpS : DefRec_BaseS
{
DefRec_DefCollOpS()
: DefRec_BaseS( DEF_REC_TYPE__DefCollOp ),
type( 0 ) {}
DefRec_DefCollOpS( const uint32_t & _loccpuid, const uint32_t & _deftoken,
const std::string & _name, const uint32_t & _type)
: DefRec_BaseS( DEF_REC_TYPE__DefCollOp, _loccpuid, _deftoken ),
name( _name ), type( _type ) {}
#ifdef VT_MPI
VT_MPI_INT getPackSize();
void pack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
#endif // VT_MPI
// operator for searching
bool operator<( const DefRec_DefCollOpS & a ) const
{
if( type == a.type )
return name < a.name;
else
return type < a.type;
}
std::string name;
uint32_t type;
};
//
// DefRec_DefCounterGroupS
//
struct DefRec_DefCounterGroupS : DefRec_BaseS
{
DefRec_DefCounterGroupS()
: DefRec_BaseS( DEF_REC_TYPE__DefCounterGroup ) {}
DefRec_DefCounterGroupS( const uint32_t & _loccpuid,
const uint32_t & _deftoken, const std::string & _name)
: DefRec_BaseS( DEF_REC_TYPE__DefCounterGroup, _loccpuid, _deftoken ),
name( _name ) {}
#ifdef VT_MPI
VT_MPI_INT getPackSize();
void pack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
#endif // VT_MPI
// operator for searching
bool operator<( const DefRec_DefCounterGroupS & a ) const
{
return name < a.name;
}
std::string name;
};
//
// DefRec_DefCounterS
//
struct DefRec_DefCounterS : DefRec_BaseS
{
DefRec_DefCounterS()
: DefRec_BaseS( DEF_REC_TYPE__DefCounter ),
properties( 0 ), group( 0 ) {}
DefRec_DefCounterS( const uint32_t & _loccpuid, const uint32_t & _deftoken,
const std::string & _name, const uint32_t & _properties,
const uint32_t & _group, const std::string & _unit)
: DefRec_BaseS( DEF_REC_TYPE__DefCounter, _loccpuid, _deftoken ),
name( _name ), properties( _properties ), group( _group ),
unit( _unit ) {}
#ifdef VT_MPI
VT_MPI_INT getPackSize();
void pack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
#endif // VT_MPI
// operator for searching
bool operator<( const DefRec_DefCounterS & a ) const
{
if( properties == a.properties )
{
if( group == a.group )
{
if( name == a.name )
{
return unit < a.unit;
}
else
{
return name < a.name;
}
}
else
{
return group < a.group;
}
}
else
{
return properties < a.properties;
}
}
std::string name;
uint32_t properties;
uint32_t group;
std::string unit;
};
//
// DefRec_DefCounterAssignmentsS
//
struct DefRec_DefCounterAssignmentsS : DefRec_BaseS
{
DefRec_DefCounterAssignmentsS()
: DefRec_BaseS( DEF_REC_TYPE__DefCounterAssignments ) {}
DefRec_DefCounterAssignmentsS( const uint32_t & _loccpuid,
const uint32_t & _counter, const uint32_t & _group )
: DefRec_BaseS( DEF_REC_TYPE__DefCounterAssignments, _loccpuid, _counter )
{
groups.insert( _group );
}
DefRec_DefCounterAssignmentsS( const uint32_t & _loccpuid,
const uint32_t & _counter, const std::set<uint32_t> & _groups )
: DefRec_BaseS( DEF_REC_TYPE__DefCounterAssignments, _loccpuid,
_counter ), groups( _groups ) {}
#ifdef VT_MPI
VT_MPI_INT getPackSize();
void pack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
#endif // VT_MPI
std::set<uint32_t> groups;
};
//
// DefRec_DefKeyValueS
//
struct DefRec_DefKeyValueS : DefRec_BaseS
{
DefRec_DefKeyValueS()
: DefRec_BaseS( DEF_REC_TYPE__DefKeyValue ),
type( OTF_UNKNOWN ) {}
DefRec_DefKeyValueS( const uint32_t & _loccpuid, const uint32_t & _deftoken,
const OTF_Type & _type, const std::string & _name )
: DefRec_BaseS( DEF_REC_TYPE__DefKeyValue, _loccpuid, _deftoken ),
type( _type ), name( _name ) {}
#ifdef VT_MPI
VT_MPI_INT getPackSize();
void pack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
#endif // VT_MPI
// operator for searching
bool operator<( const DefRec_DefKeyValueS & a ) const
{
if( type == a.type )
return name < a.name;
else
return type < a.type;
}
OTF_Type type;
std::string name;
};
//
// DefRec_DefMarkerS
//
struct DefRec_DefMarkerS: DefRec_BaseS
{
//
// compare structure for final sort
//
struct SortS
{
bool operator()( const DefRec_DefMarkerS * a,
const DefRec_DefMarkerS * b ) const
{
if( a->type == b->type )
return a->deftoken < b->deftoken;
else
return a->type < b->type;
}
};
DefRec_DefMarkerS()
: DefRec_BaseS( DEF_REC_TYPE__DefMarker ),
type( 0 ) {}
DefRec_DefMarkerS( const uint32_t & _loccpuid, const uint32_t & _deftoken,
const uint32_t & _type, const std::string & _name)
: DefRec_BaseS( DEF_REC_TYPE__DefMarker, _loccpuid, _deftoken ),
type( _type ), name( _name ) {}
#ifdef VT_MPI
VT_MPI_INT getPackSize();
void pack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
VT_MPI_INT & bufferPos );
#endif // VT_MPI
// operator for searching
bool operator<( const DefRec_DefMarkerS & a ) const
{
if( type == a.type )
return name < a.name;
else
return type < a.type;
}
uint32_t type;
std::string name;
};
// compare function for pre-sorting local definitions
inline bool DefRec_LocCmp( const DefRec_BaseS * a, const DefRec_BaseS * b )
{
// if both are process group definitions (i.e. user created MPI comms.),
// sort by its local token to preserve the order of creation
if( a->dtype == DEF_REC_TYPE__DefProcessGroup &&
b->dtype == DEF_REC_TYPE__DefProcessGroup )
return a->deftoken < b->deftoken;
// otherwise, sort by definition type
else
return a->dtype < b->dtype;
}
#endif // _VT_UNIFY_DEFS_RECS_H_
| [
"samuel@lanl.gov"
] | samuel@lanl.gov |
efa563efc2c0224eefd28f5f7e101069bb466214 | dfac93f878e0328bf441c669678fadbab663de79 | /q18deleteListNode.cpp | e91e6e550a3eaefb4c3ef0848824c693c8107b86 | [] | no_license | zhbei/offer_code | 2d5bc78ca3474e5d39ec59ad0cf3bb533e8af181 | 0d2725fb01e9e1fb0ad2fe1e1d6e516332bbfe15 | refs/heads/master | 2020-03-11T11:56:38.194305 | 2018-04-18T01:03:45 | 2018-04-18T01:03:45 | 129,982,183 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,971 | cpp | #include <iostream>
#include <cstdio>
using namespace std;
struct ListNode
{
int val;
ListNode *next;
ListNode(int v){
val = v;
}
};
void PrintList(ListNode* head){
while(head != NULL){
cout << head->val << " ";
head = head->next;
}
cout << endl;
}
void PrintListNode(ListNode * head){
if(head != NULL)
cout << head->val << endl;
}
void ConnectListNodes(ListNode* &l,ListNode*& s){
l->next = s;
}
void DeleteNode(ListNode** head,ListNode *cur){
if(*head == NULL || cur == NULL)
return ;
if(*head == cur){
*head = cur->next;
cur->next = NULL;
delete cur;
return;
}
if(cur->next != NULL){
ListNode* nextNode = cur->next;
cur->val = nextNode->val;
cur->next = nextNode->next;
nextNode->next = NULL;
delete nextNode;
}else{
ListNode* last = *head;
while(last->next != NULL && last->next != cur){
last = last->next;
}
if(last->next == cur){
last->next = cur->next;
cur->next = NULL;
delete cur;
}
}
}
// ====================测试代码====================
void Test(ListNode* pListHead, ListNode* pNode)
{
printf("The original list is: \n");
PrintList(pListHead);
printf("The node to be deleted is: \n");
PrintListNode(pNode);
DeleteNode(&pListHead, pNode);
printf("The result list is: \n");
PrintList(pListHead);
}
// 链表中有多个结点,删除中间的结点
void Test1()
{
ListNode* pNode1 = new ListNode(1);
ListNode* pNode2 = new ListNode(2);
ListNode* pNode3 = new ListNode(3);
ListNode* pNode4 = new ListNode(4);
ListNode* pNode5 = new ListNode(5);
ConnectListNodes(pNode1, pNode2);
ConnectListNodes(pNode2, pNode3);
ConnectListNodes(pNode3, pNode4);
ConnectListNodes(pNode4, pNode5);
Test(pNode1, pNode3);
}
// 链表中有多个结点,删除尾结点
void Test2()
{
ListNode* pNode1 = new ListNode(1);
ListNode* pNode2 = new ListNode(2);
ListNode* pNode3 = new ListNode(3);
ListNode* pNode4 = new ListNode(4);
ListNode* pNode5 = new ListNode(5);
ConnectListNodes(pNode1, pNode2);
ConnectListNodes(pNode2, pNode3);
ConnectListNodes(pNode3, pNode4);
ConnectListNodes(pNode4, pNode5);
Test(pNode1, pNode5);
}
// 链表中有多个结点,删除头结点
void Test3()
{
ListNode* pNode1 = new ListNode(1);
ListNode* pNode2 = new ListNode(2);
ListNode* pNode3 = new ListNode(3);
ListNode* pNode4 = new ListNode(4);
ListNode* pNode5 = new ListNode(5);
ConnectListNodes(pNode1, pNode2);
ConnectListNodes(pNode2, pNode3);
ConnectListNodes(pNode3, pNode4);
ConnectListNodes(pNode4, pNode5);
Test(pNode1, pNode1);
}
// 链表中只有一个结点,删除头结点
void Test4()
{
ListNode* pNode1 = new ListNode(1);
Test(pNode1, pNode1);
}
// 链表为空
void Test5()
{
Test(nullptr, nullptr);
}
int main(int argc, char* argv[])
{
Test1();
Test2();
Test3();
Test4();
Test5();
return 0;
} | [
"zhangbeibei@ict.ac.cn"
] | zhangbeibei@ict.ac.cn |
b36e784ca6f1846fca708a3c1d7a8b77265753d1 | 746a87a8afc64b355207d334b4bb4f2d8a04bf17 | /C03/char_repl.cc | 0eaaba9cd5be777393ef9625f8e872a1cc6572b6 | [] | no_license | JallenKwong/CPlusPlusPrimer | 9c0f82448258fba8591ce61ac8b744c4062c1a05 | 8d4c4d42d96ed9267560e8c8fd2339d058c968d4 | refs/heads/master | 2020-05-19T17:27:56.849514 | 2019-05-29T03:13:12 | 2019-05-29T03:13:12 | 185,134,776 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,321 | cc |
#include <string>
using std::string;
#include <iostream>
using std::cout; using std::endl;
int main()
{
string str("some string"), orig = str;
if (!str.empty()) // make sure there's a character to print
cout << str[0] << endl;// print the first character in str
if (!str.empty()) // make sure there's a character in str[0]
// assign a new value to the first character in str
str[0] = toupper(str[0]);
cout << str << endl;
str = orig; // restore str to its original value
// equivalent code using iterators instead of subscripts
if (str.begin() != str.end()) { // make sure str is not empty
auto it = str.begin(); // it denotes the first character in str
*it = toupper(*it); // make that character uppercase
}
cout << str << endl;
str = orig; // restore str to its original value
// four wasy to capitalize first word in str:
// 1. for loop with subscripts
for (decltype(str.size()) index = 0;
index != str.size() && !isspace(str[index]); ++index)
str[index] = toupper(str[index]); // capitalize the current character
cout << str << endl;
str = orig; // restore str to its original value
// 2. for loop with iterators instead of subscripts
for (auto it = str.begin(); it != str.end() && !isspace(*it); ++it)
*it = toupper(*it); // capitalize the current character
cout << str << endl;
str = orig; // restore str to its original value
// 3. while instead of a for with subscripts
decltype(str.size()) index = 0; // subscript to look at characters in str
while (index != str.size() && !isspace(str[index])) {
str[index] = toupper(str[index]); // capitalize the current character
++index; // advance the index to get the next character
}
cout << str << endl;
// 4. while loop with iterators
auto beg = str.begin();
while (beg != str.end() && !isspace(*beg)) {
*beg = toupper(*beg);
++beg;
}
cout << str << endl;
str = orig; // restore str to its original value
// range for loop to process every character
// first a loop to print the characters in str one character to a line
for (auto c : str) // for every char in str
cout << c << endl; // print the current character followed by a newline
// next change every character in str
for (auto &c : str) // note: c is a reference
c = '*'; // assign a new value to the underlying char in str
cout << str << endl;
str = orig; // restore str to its original value
// equivalent code using traditional for loops
// first print the characters in str
for (decltype(str.size()) ix = 0; ix != str.size(); ++ix)
cout << str[ix] << endl; // print current character followd by a newline
// next change every character in str
for (decltype(str.size()) ix = 0; ix != str.size(); ++ix)
str[ix] = '*'; // assigns a new value to the character in str
cout << str << endl;
str = orig; // restore str to its original value
// equivalent code using traditional for loops and iterators
// first print the characters in str
for (auto beg = str.begin(); beg != str.end(); ++beg)
cout << *beg << endl; // print current character followd by a newline
// next change every character in str
for (auto beg = str.begin(); beg != str.end(); ++beg)
*beg = '*'; // assigns a new value to the character in str
cout << str << endl;
return 0;
}
| [
"jallenkwong@163.com"
] | jallenkwong@163.com |
4c96b801a96520533607d2ea741eae5545ca2a64 | f279fa731406c5214b958e8070ee5664ea92c81f | /14889_StartLink/Main.cpp | 9a17029ebe2f417122a62f0355b2c8c00cbaf863 | [] | no_license | 93Hong/Algorithms | 14a7ea2c8f402aaea6c76d7a83f795434bea26cc | b56512912131dc0149d4960b88aa76df6926119d | refs/heads/master | 2020-12-31T00:02:12.959480 | 2017-12-05T13:02:59 | 2017-12-05T13:02:59 | 86,582,927 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 518 | cpp | #include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
#define INF 10000
#pragma warning(disable:4996)
using namespace std;
int arr[21][21], ans = INF;
vector<int> v;
void solve() {
}
int main() {
int N;
scanf("%d", &N);
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
scanf("%d", &arr[i][j]);
}
}
for (int i = 0; i < N; i++)
v.push_back(i);
do {
int a = 0, b = 0;
for (int i = 0; i<)
} while (next_permutation(v.begin(), v.end()));
printf("%d\n", ans);
} | [
"sk2rldnr@gmail.com"
] | sk2rldnr@gmail.com |
fc1f4d0e909d82c9e8950292f749d9df719250ef | 2d9909133b6d2f5b50fd58d8a04f451a7247aba0 | /Cliente/src/common/Socket/Socket.cpp | e353194659386c756f514ac0ab32a2277f442d54 | [] | no_license | ldtg/tallerZ | e6f82bc45e36414a97ce3bdbc032c2d43d04151f | 3fa17ec2cec77f2625b8811e9dc00d50fdf30c8b | refs/heads/master | 2021-01-20T13:21:34.969423 | 2017-07-05T23:13:29 | 2017-07-05T23:13:29 | 90,473,475 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,020 | cpp | #include "Socket.h"
#include <string>
#include <sys/socket.h>
#include <netdb.h>
#include <unistd.h>
#include <cstring>
Socket::Socket(int fd) : socketfd(fd) {}
Socket::Socket() {
this->socketfd = INVALID_SOCKET;
}
void Socket::connectToServer(const std::string &host, const std::string
&service) {
bool seConecto = false;
struct addrinfo *result = generarResultCliente(host, service);
struct addrinfo *ptr = NULL;
for (ptr = result; ptr != NULL && !seConecto; ptr = ptr->ai_next) {
crearSocket(ptr);
conectarSocket(ptr);
seConecto = true;
}
freeaddrinfo(result);
if (!seConecto) {
throw SocketException("No se pudo conectar");
}
}
void Socket::bindandlisten(const std::string &service) {
struct addrinfo *result = generar_result_server(service);
crearSocket(result);
bindSocket(result);
freeaddrinfo(result);
listenSocket();
}
Socket Socket::acceptConnection() {
int aux = accept(this->socketfd, NULL, NULL);
if (aux == INVALID_SOCKET) {
std::stringstream auxstr;
auxstr << "Error en accept " << strerror(errno) << std::endl;
throw SocketException(auxstr.str());
}
return Socket(aux);
}
void Socket::shutdownConnection(ShutdownMode mode) {
shutdown(this->socketfd, mode);//si ya estaba cerrado ok
}
void Socket::send_tcp(const char *data, size_t data_len) {
size_t bytes_eviados = 0;
while (bytes_eviados < data_len) {
ssize_t s = send(this->socketfd,
data + bytes_eviados,
data_len - bytes_eviados,
MSG_NOSIGNAL);
if (s <= 0) {
std::stringstream auxstr;
auxstr << "Error send " << strerror(errno) << std::endl;
throw SocketException(auxstr.str(), s);
} else {
bytes_eviados += s;
}
}
}
void Socket::receive_tcp(char *data, size_t data_len) const {
size_t bytes_recibidos = 0;
while (bytes_recibidos < data_len) {
ssize_t s = recv(this->socketfd,
data + bytes_recibidos,
data_len - bytes_recibidos,
MSG_NOSIGNAL);
if (s <= 0) {
std::stringstream auxstr;
auxstr << "Error recv " << strerror(errno) << std::endl;
throw SocketException(auxstr.str(), s);
} else {
bytes_recibidos += s;
}
}
}
void Socket::send_str_preconcatenated(const std::string &str_snd) {
std::string str(str_snd);
uint32_t size = (uint32_t) str.size();
if (size > MAX_MSG_LEN)
throw SocketException("ERROR SEND STR");
uint32_t sizets = htonl(size);
send_tcp((char *) &sizets, sizeof(uint32_t));
send_tcp(str.c_str(), size);
}
std::string Socket::rcv_str_preconcatenated() {
char buff[MAX_MSG_LEN] = "";
uint32_t sizercv;
receive_tcp((char *) &sizercv, sizeof(uint32_t));
uint32_t size = ntohl(sizercv);
if (size > MAX_MSG_LEN)
throw SocketException("ERROR RCV STR");
receive_tcp(buff, size);
std::string aux(buff, size);
return aux;
}
struct addrinfo *Socket::generarResultCliente(std::string host,
std::string service) {
struct addrinfo hints;
struct addrinfo *result;
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = 0;
int s = getaddrinfo(host.c_str(), service.c_str(), &hints, &result);
if (s != 0) {
std::stringstream aux;
aux << "Error en getaddrinfo " << gai_strerror(s) << std::endl;
throw SocketException(aux.str());
}
return result;
}
void Socket::crearSocket(addrinfo *pAddrinfo) {
int enable = 1;
this->socketfd = socket(pAddrinfo->ai_family, pAddrinfo->ai_socktype,
pAddrinfo->ai_protocol);
if (this->socketfd == -1) {
std::stringstream aux;
aux << "Error al crear " << strerror(errno) << std::endl;
throw SocketException(aux.str());
}
if (setsockopt(this->socketfd,
SOL_SOCKET,
SO_REUSEPORT,
&enable,
sizeof(int)) < 0) {
close(this->socketfd);
freeaddrinfo(pAddrinfo);
std::stringstream aux;
aux << "Error en setsockop " << strerror(errno) << std::endl;
throw SocketException(aux.str());
}
}
void Socket::conectarSocket(addrinfo *pAddrinfo) {
if (connect(this->socketfd, pAddrinfo->ai_addr, pAddrinfo->ai_addrlen)
== -1) {
close(this->socketfd);
std::stringstream aux;
aux << "Error en connect " << strerror(errno) << std::endl;
throw SocketException(aux.str());
}
}
addrinfo *Socket::generar_result_server(std::string service) {
struct addrinfo hints;
struct addrinfo *result;
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE;
int s = getaddrinfo(NULL,
service.c_str(),
&hints,
&result);
if (s != 0) {
std::stringstream aux;
aux << "Error en getaddrinfo " << gai_strerror(s) << std::endl;
throw SocketException(aux.str());
}
return result;
}
void Socket::bindSocket(addrinfo *pAddrinfo) {
if (bind(this->socketfd, pAddrinfo->ai_addr, pAddrinfo->ai_addrlen) == -1) {
std::stringstream aux;
aux << "Error en bind " << strerror(errno) << std::endl;
throw SocketException(aux.str());
}
}
void Socket::listenSocket() {
if (listen(this->socketfd, MAX_CLIENTES_ESPERA) == -1) {
std::stringstream aux;
aux << "Error en listen " << strerror(errno) << std::endl;
throw SocketException(aux.str());
}
}
Socket::Socket(Socket &&otro) {
this->socketfd = otro.socketfd;
otro.socketfd = INVALID_SOCKET;
}
Socket &Socket::operator=(Socket &&otro) {
this->socketfd = otro.socketfd;
otro.socketfd = INVALID_SOCKET;
return *this;
}
bool Socket::isValid() {
return this->socketfd != INVALID_SOCKET;
}
void Socket::closeSocket() {
if (this->isValid())
close(this->socketfd);
this->socketfd = INVALID_SOCKET;
}
Socket::~Socket() {
this->closeSocket();
}
| [
"lteje11@gmail.com"
] | lteje11@gmail.com |
9d967e88cd0e1a12f5d38fd713f6260279fb244c | 8ab8c8e650ec40d6edcdae7c5339b838cc61be80 | /CPlusPlus/Adapter/src/CenterTranslator.cpp | c29792c2fd148ebe6f59eff6fcfc8c64af1d88bb | [] | no_license | yuhsh24/Design-Pattern | 36d8c6a1554b4ec6159f41e57adea99ee3da3851 | 4c1d5ade419c628009381f6d8205d1a66680add8 | refs/heads/master | 2021-01-19T13:55:56.283904 | 2017-04-09T03:26:47 | 2017-04-09T03:26:47 | 82,429,025 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 591 | cpp | /*************************************************************************
> File Name: CenterTranslator.cpp
> Author: ma6174
> Mail: ma6174@163.com
> Created Time: 2017年02月28日 星期二 14时41分31秒
************************************************************************/
#include"CenterTranslator.h"
#include<string>
using namespace std;
CenterTranslator::CenterTranslator(const string& str):Center(str),chiCenter(str)
{
;
}
void CenterTranslator::Attack()
{
chiCenter.ChineseAttack();
}
void CenterTranslator::Defence()
{
chiCenter.ChineseDefence();
}
| [
"yhshzju@163.com"
] | yhshzju@163.com |
10a7738acab7047792256a1ee1f4e847c1dc90af | 3b97b786b99c3e4e72bf8fe211bb710ecb674f2b | /TClient/TClient/TMainUI.h | 351ea51861deac69e401695a5e11ba498e4bc99e | [] | no_license | moooncloud/4s | 930384e065d5172cd690c3d858fdaaa6c7fdcb34 | a36a5785cc20da19cd460afa92a3f96e18ecd026 | refs/heads/master | 2023-03-17T10:47:28.154021 | 2017-04-20T21:42:01 | 2017-04-20T21:42:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,081 | h | #pragma once
class CTMainUI : public CTClientUIBase
{
public:
static LPTEXTURESET m_pNOTIFYMAIL;
public:
TComponent *m_pTMAINBTN[TMAINBUTTON_COUNT];
TComponent *m_pTMSGBTN[TMSGBUTTON_COUNT];
TComponent *m_pTTCASHMENU[TCASHMENU_COUNT];
TComponent *m_pTPARTYITEM;
TComponent *m_pTCHAPTERMSG;
TComponent *m_pTREGIONMSG;
TComponent *m_pTQUESTMSG;
TButton *m_pMESSENGER;
TButton *m_pMAIL;
BOOL m_bNotifyNewMsg;
BOOL m_bNotifyNewMail;
BOOL m_bNotifyNewCashCabinet;
BYTE m_bInvenSlot;
BYTE m_bMainMenu;
BYTE m_bCashMenu;
CTClientUIBase* m_pCENTER;
CTClientUIBase* m_pRIGHT;
DWORD m_dwNotifyMailTick;
D3DXVECTOR2 m_vNotifyMailStart;
D3DXVECTOR2 m_vNotifyMailEnd;
TButton* m_pCashShopButton;
TButton* m_pCabinetButton;
public:
static BYTE MakeSlotID(TMAINSLOTID_TYPE eSlotType, BYTE bSlotNumber);
static TMAINSLOTID_TYPE ToSlotType(BYTE bSlotID);
static BYTE ToSlotNumber(BYTE bSlotID);
public:
void ResetCashMenu();
void ResetChapterMSG( CString& strTEXT);
void ResetRegionMSG( CString& strTEXT);
void ResetQuestMSG( CString& strTITLE, CString& strRESULT);
void CheckMSGCTRL();
void SetNewMessengerMsg(BOOL bNew) { m_bNotifyNewMsg = bNew; }
void SetNewMail(BOOL bNew) { m_bNotifyNewMail = bNew; if( bNew ) m_dwNotifyMailTick = NOTIFYMAIL_TICK; }
void SetNewCashCabinet(BOOL bNew) { m_bNotifyNewCashCabinet = bNew; }
void AdjustOtherCompByTREECALLSLOT( BOOL bShow );
public:
virtual void ShowComponent( BOOL bVisible = TRUE);
virtual void OnLButtonDown(UINT nFlags, CPoint pt);
virtual ITDetailInfoPtr GetTInfoKey( const CPoint& point );
virtual BOOL CanWithItemUI();
virtual void ResetPosition();
virtual void DefaultPosition( CPoint* vBASIS, BOOL bRestore );
virtual void SwitchFocus(TComponent *pCandidate);
virtual HRESULT Render( DWORD dwTickCount );
protected:
ITDetailInfoPtr GetTInfoKey_MainBtn(const CPoint& point, INT nID);
ITDetailInfoPtr GetTInfoKey_MsgBtn(const CPoint& point, INT nID);
public:
CTMainUI( TComponent *pParent, LP_FRAMEDESC pDesc, TCMLParser *pParser, CTClientChar *pHost);
virtual ~CTMainUI();
};
| [
"great.mafia2010@gmail.com"
] | great.mafia2010@gmail.com |
761037c52df522ce2070629dd47a31923389d6d0 | 358668370a91ea6dbefc52fac818677af78f7669 | /homework/Week05_trig_particles/src/testApp.h | d52e04811b576336cceb7f36e6d30fe00a1aacbf | [] | no_license | jmatthewgriffis/griffis_algo2013 | 73efb45b53f5a76e617d1e46257acebcec07bcbb | 4cd17cff9481a6c845683a0da6b531ebb6b0d049 | refs/heads/master | 2016-09-07T23:56:35.770684 | 2015-01-05T21:32:51 | 2015-01-05T21:32:51 | 12,420,109 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 629 | h | #pragma once
#include "ofMain.h"
#include "Particle.h"
#define numParticles 10
class testApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
float angle; // Store the angle of the vector of motion.
vector<Particle> particleList;
};
| [
"grifj153@newschool.edu"
] | grifj153@newschool.edu |
ecbf787ab8b059dc1f1eff8cfa4d129c936c98aa | a5a99f646e371b45974a6fb6ccc06b0a674818f2 | /Geometry/HGCalCommonData/plugins/DDHGCalWaferF.cc | 2bb2c6051a0bfa5d642ceff2edeb2d09f58dabd7 | [
"Apache-2.0"
] | permissive | cms-sw/cmssw | 4ecd2c1105d59c66d385551230542c6615b9ab58 | 19c178740257eb48367778593da55dcad08b7a4f | refs/heads/master | 2023-08-23T21:57:42.491143 | 2023-08-22T20:22:40 | 2023-08-22T20:22:40 | 10,969,551 | 1,006 | 3,696 | Apache-2.0 | 2023-09-14T19:14:28 | 2013-06-26T14:09:07 | C++ | UTF-8 | C++ | false | false | 11,015 | cc | ///////////////////////////////////////////////////////////////////////////////
// File: DDHGCalWaferF.cc
// Description: Geometry factory class for a full silicon Wafer
// Created by Sunanda Banerjee
// Extended for rotated wafer by Pruthvi Suryadevara
///////////////////////////////////////////////////////////////////////////////
#include "DetectorDescription/Core/interface/DDAlgorithm.h"
#include "DetectorDescription/Core/interface/DDAlgorithmFactory.h"
#include "DetectorDescription/Core/interface/DDCurrentNamespace.h"
#include "DetectorDescription/Core/interface/DDLogicalPart.h"
#include "DetectorDescription/Core/interface/DDMaterial.h"
#include "DetectorDescription/Core/interface/DDSolid.h"
#include "DetectorDescription/Core/interface/DDSplit.h"
#include "DetectorDescription/Core/interface/DDTypes.h"
#include "DetectorDescription/Core/interface/DDutils.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/PluginManager/interface/PluginFactory.h"
#include "Geometry/HGCalCommonData/interface/HGCalTypes.h"
#include <string>
#include <vector>
#include <sstream>
//#define EDM_ML_DEBUG
class DDHGCalWaferF : public DDAlgorithm {
public:
// Constructor and Destructor
DDHGCalWaferF() {}
~DDHGCalWaferF() override = default;
void initialize(const DDNumericArguments& nArgs,
const DDVectorArguments& vArgs,
const DDMapArguments& mArgs,
const DDStringArguments& sArgs,
const DDStringVectorArguments& vsArgs) override;
void execute(DDCompactView& cpv) override;
private:
std::string material_; // Material name for module with gap
double thick_; // Module thickness
double waferSize_; // Wafer size
double waferSepar_; // Sensor separation
double waferThick_; // Wafer thickness
std::vector<std::string> layerNames_; // Names of the layers
std::vector<std::string> materials_; // Materials of the layers
std::vector<double> layerThick_; // Thickness of layers
std::vector<int> layerType_; // Layer types
std::vector<int> copyNumber_; // Initial copy numbers
std::vector<int> layers_; // Number of layers in a section
int nCells_; // Half number of cells along u-v axis
int cellType_; // Cell Type (0,1,2: Fine, Course 2/3)
std::vector<std::string> cellNames_; // Name of the cells
std::string nameSpace_; // Namespace to be used
};
void DDHGCalWaferF::initialize(const DDNumericArguments& nArgs,
const DDVectorArguments& vArgs,
const DDMapArguments&,
const DDStringArguments& sArgs,
const DDStringVectorArguments& vsArgs) {
material_ = sArgs["ModuleMaterial"];
thick_ = nArgs["ModuleThickness"];
waferSize_ = nArgs["WaferSize"];
waferSepar_ = nArgs["SensorSeparation"];
waferThick_ = nArgs["WaferThickness"];
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferF: Module " << parent().name() << " made of " << material_ << " T "
<< thick_ << " Wafer 2r " << waferSize_ << " Half Separation " << waferSepar_ << " T "
<< waferThick_;
#endif
layerNames_ = vsArgs["LayerNames"];
materials_ = vsArgs["LayerMaterials"];
layerThick_ = vArgs["LayerThickness"];
layerType_ = dbl_to_int(vArgs["LayerTypes"]);
copyNumber_.resize(materials_.size(), 1);
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferF: " << layerNames_.size() << " types of volumes";
for (unsigned int i = 0; i < layerNames_.size(); ++i)
edm::LogVerbatim("HGCalGeom") << "Volume [" << i << "] " << layerNames_[i] << " of thickness " << layerThick_[i]
<< " filled with " << materials_[i] << " type " << layerType_[i];
#endif
layers_ = dbl_to_int(vArgs["Layers"]);
#ifdef EDM_ML_DEBUG
std::ostringstream st1;
for (unsigned int i = 0; i < layers_.size(); ++i)
st1 << " [" << i << "] " << layers_[i];
edm::LogVerbatim("HGCalGeom") << "There are " << layers_.size() << " blocks" << st1.str();
#endif
nCells_ = (int)(nArgs["NCells"]);
cellType_ = (int)(nArgs["CellType"]);
cellNames_ = vsArgs["CellNames"];
nameSpace_ = DDCurrentNamespace::ns();
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferF: Cells/Wafer " << nCells_ << " Cell Type " << cellType_
<< " NameSpace " << nameSpace_ << ": # of cells " << cellNames_.size();
for (unsigned int k = 0; k < cellNames_.size(); ++k)
edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferF: Cell[" << k << "] " << cellNames_[k];
#endif
}
void DDHGCalWaferF::execute(DDCompactView& cpv) {
#ifdef EDM_ML_DEBUG
int counter(0);
#endif
static constexpr double tol = 0.00001;
static const double sqrt3 = std::sqrt(3.0);
double rM = 0.5 * waferSize_;
double RM2 = rM / sqrt3;
double R = waferSize_ / (3.0 * nCells_);
double r = 0.5 * R * sqrt3;
double r2 = 0.5 * waferSize_;
double R2 = r2 / sqrt3;
// First the mother
std::vector<double> xM = {rM, 0, -rM, -rM, 0, rM};
std::vector<double> yM = {RM2, 2 * RM2, RM2, -RM2, -2 * RM2, -RM2};
std::vector<double> zw = {-0.5 * thick_, 0.5 * thick_};
std::vector<double> zx(2, 0), zy(2, 0), scale(2, 1.0);
DDName parentName = parent().name();
DDSolid solid = DDSolidFactory::extrudedpolygon(parentName, xM, yM, zw, zx, zy, scale);
DDName matName(DDSplit(material_).first, DDSplit(material_).second);
DDMaterial matter(matName);
DDLogicalPart glogM = DDLogicalPart(solid.ddname(), matter, solid);
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferF: " << solid.name() << " extruded polygon made of " << matName
<< " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
<< " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
<< " and " << xM.size() << " edges";
for (unsigned int k = 0; k < xM.size(); ++k)
edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xM[k] << ":" << yM[k];
#endif
// Then the layers
std::vector<double> xL = {r2, 0, -r2, -r2, 0, r2};
std::vector<double> yL = {R2, 2 * R2, R2, -R2, -2 * R2, -R2};
std::vector<DDLogicalPart> glogs(materials_.size());
double zi(-0.5 * thick_), thickTot(0.0);
for (unsigned int l = 0; l < layers_.size(); l++) {
unsigned int i = layers_[l];
if (copyNumber_[i] == 1) {
if (layerType_[i] > 0) {
zw[0] = -0.5 * waferThick_;
zw[1] = 0.5 * waferThick_;
} else {
zw[0] = -0.5 * layerThick_[i];
zw[1] = 0.5 * layerThick_[i];
}
solid = DDSolidFactory::extrudedpolygon(layerNames_[i], xL, yL, zw, zx, zy, scale);
DDName matN(DDSplit(materials_[i]).first, DDSplit(materials_[i]).second);
DDMaterial matter(matN);
glogs[i] = DDLogicalPart(solid.ddname(), matter, solid);
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferF: " << solid.name() << " extruded polygon made of " << matN
<< " z|x|y|s (0) " << zw[0] << ":" << zx[0] << ":" << zy[0] << ":" << scale[0]
<< " z|x|y|s (1) " << zw[1] << ":" << zx[1] << ":" << zy[1] << ":" << scale[1]
<< " and " << xL.size() << " edges";
for (unsigned int k = 0; k < xL.size(); ++k)
edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << xL[k] << ":" << yL[k];
#endif
}
DDTranslation tran0(0, 0, (zi + 0.5 * layerThick_[i]));
DDRotation rot;
cpv.position(glogs[i], glogM, copyNumber_[i], tran0, rot);
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferF: " << glogs[i].name() << " number " << copyNumber_[i]
<< " positioned in " << glogM.name() << " at " << tran0 << " with no rotation";
#endif
++copyNumber_[i];
zi += layerThick_[i];
thickTot += layerThick_[i];
if (layerType_[i] > 0) {
int n2 = nCells_ / 2;
double y0 = (cellType_ >= 3) ? 0.5 : 0.0;
double x0 = (cellType_ >= 3) ? 0.5 : 1.0;
int voff = (cellType_ >= 3) ? 0 : 1;
int uoff = 1 - voff;
int cellType = (cellType_ >= 3) ? (cellType_ - 3) : cellType_;
for (int u = 0; u < 2 * nCells_; ++u) {
for (int v = 0; v < 2 * nCells_; ++v) {
if (((v - u) < (nCells_ + uoff)) && (u - v) < (nCells_ + voff)) {
#ifdef EDM_ML_DEBUG
counter++;
#endif
double yp = (u - 0.5 * v - n2 + y0) * 2 * r;
double xp = (1.5 * (v - nCells_) + x0) * R;
int cell(0);
if ((u == 0) && (v == 0))
cell = 7;
else if ((u == 0) && (v == nCells_ - voff))
cell = 8;
else if ((u == nCells_ - uoff) && (v == 2 * nCells_ - 1))
cell = 9;
else if ((u == (2 * nCells_ - 1)) && (v == 2 * nCells_ - 1))
cell = 10;
else if ((u == 2 * nCells_ - 1) && (v == (nCells_ - voff)))
cell = 11;
else if ((u == (nCells_ - uoff)) && (v == 0))
cell = 12;
else if (u == 0)
cell = 1;
else if ((v - u) == (nCells_ - voff))
cell = 4;
else if (v == (2 * nCells_ - 1))
cell = 2;
else if (u == (2 * nCells_ - 1))
cell = 5;
else if ((u - v) == (nCells_ - uoff))
cell = 3;
else if (v == 0)
cell = 6;
if ((cellType_ >= 3) && (cell != 0))
cell += 12;
DDTranslation tran(xp, yp, 0);
int copy = HGCalTypes::packCellTypeUV(cellType, u, v);
cpv.position(DDName(cellNames_[cell]), glogs[i], copy, tran, rot);
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom")
<< "DDHGCalWaferF: " << cellNames_[cell] << " number " << copy << " positioned in " << glogs[i].name()
<< " at " << tran << " with no rotation";
#endif
}
}
}
}
}
#ifdef EDM_ML_DEBUG
edm::LogVerbatim("HGCalGeom") << "\nDDHGCalWaferF::Counter : " << counter << "\n===============================\n";
#endif
if (std::abs(thickTot - thick_) >= tol) {
if (thickTot > thick_) {
edm::LogError("HGCalGeom") << "Thickness of the partition " << thick_ << " is smaller than " << thickTot
<< ": thickness of all its components **** ERROR ****";
} else {
edm::LogWarning("HGCalGeom") << "Thickness of the partition " << thick_ << " does not match with " << thickTot
<< " of the components";
}
}
}
DEFINE_EDM_PLUGIN(DDAlgorithmFactory, DDHGCalWaferF, "hgcal:DDHGCalWaferF");
| [
"sunanda.banerjee@cern.ch"
] | sunanda.banerjee@cern.ch |
33c9a7c3fa130f2bec11640733dee057ee124a2b | a6ead881ba8aaa3d4e7b327c876df4fb28b81135 | /chapter5/lcm.cpp | 4a4dd2f0592b03df03b9a7cd4756d1868b1e41c5 | [] | no_license | middleprince/AlgorithmNotes | 11eff6e6f9f1ea93ffe8e88e8dc01587ac15736c | f587d977adf38de4a6d5736c94168cd4171949b9 | refs/heads/master | 2021-06-24T16:23:40.333101 | 2021-01-17T15:24:26 | 2021-01-17T15:24:26 | 189,587,442 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 425 | cpp | #include <cstdio>
int gcd(int a, int b)
{
if(b == 0)
return a;
return gcd(b, a%b);
}
void swap(int* &a, int* &b)
{
int *temp = a;
a = b;
b = temp;
}
int main(void)
{
int a, b, d;
while(scanf("%d %d", &a, &b) != EOF){
if(a<b){
int *x = &a, *y = &b;
swap(x, y);
printf("%d\n", a*(b/gcd(a, b))); //避免溢出
}
}
return 0;
}
| [
"hellangel.ah+github@gmail.com"
] | hellangel.ah+github@gmail.com |
f8e7c722f2be1c274096c5121ce9fa14d064c04b | ff4bb3896343840cc488492e4e4d50efe5270d11 | /src/canon.h | f6a7df137728739fbf57a0c47cae7942e8910636 | [
"MIT"
] | permissive | obliviateandsurrender/LegendofZelda | 4d2dee0a51816f7dacb9c047de7438564e5f6fb3 | 9c9e01cb8b68fb5c88027802f46454e84f47178e | refs/heads/master | 2020-03-20T14:43:42.623513 | 2018-06-15T14:04:15 | 2018-06-15T14:04:15 | 137,493,848 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 485 | h | #include "main.h"
#ifndef Canon_H
#define Canon_H
class Canon {
public:
Canon() {}
Canon(float x, float y, float z);
glm::vec3 position;
void draw(glm::mat4 VP);
void set_position(float x, float y, float z);
void tick();
void fire(float angle);
float rotation;
float angle;
int lives;
float speed_x;
float speed_y;
float gravity;
int release;
bounding_box_t bounding_box();
private:
VAO *object;
};
#endif // Canon_H
| [
"utkarshazad98@gmail.com"
] | utkarshazad98@gmail.com |
2e9560e562fc574a8fc63cbdfd99b3ac9cd17604 | e11d62362decf103d16b5469a09f0d575bb5ccce | /ash/login/ui/parent_access_view_unittest.cc | 3313a300b5a273b3e8fba274f85f09cc394cdd87 | [
"BSD-3-Clause"
] | permissive | nhiroki/chromium | 1e35fd8511c52e66f62e810c2f0aee54a20215c9 | e65402bb161a854e42c0140ac1ab3217f39c134e | refs/heads/master | 2023-03-13T18:09:40.765227 | 2019-09-10T06:06:31 | 2019-09-10T06:06:31 | 207,478,927 | 0 | 0 | BSD-3-Clause | 2019-09-10T06:12:21 | 2019-09-10T06:12:20 | null | UTF-8 | C++ | false | false | 26,089 | cc | // Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/login/ui/parent_access_view.h"
#include <memory>
#include <string>
#include "ash/accessibility/accessibility_controller_impl.h"
#include "ash/keyboard/keyboard_controller_impl.h"
#include "ash/login/mock_login_screen_client.h"
#include "ash/login/ui/arrow_button_view.h"
#include "ash/login/ui/login_button.h"
#include "ash/login/ui/login_pin_view.h"
#include "ash/login/ui/login_test_base.h"
#include "ash/login/ui/login_test_utils.h"
#include "ash/login/ui/parent_access_widget.h"
#include "ash/session/test_session_controller_client.h"
#include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "ash/wm/work_area_insets.h"
#include "base/bind.h"
#include "base/macros.h"
#include "base/optional.h"
#include "base/test/bind_test_util.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/time/time.h"
#include "components/account_id/account_id.h"
#include "components/session_manager/session_manager_types.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/window.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/event.h"
#include "ui/events/test/event_generator.h"
#include "ui/gfx/geometry/point.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/widget/widget.h"
namespace ash {
namespace {
// Struct containing the correct title and description that are displayed when
// the dialog is instantiated with a given ParentAccessRequestReason.
struct ViewModifiersTestData {
ParentAccessRequestReason reason;
// The title string id.
int title;
// The description string id.
int description;
};
const ViewModifiersTestData kViewModifiersTestData[] = {
{ParentAccessRequestReason::kUnlockTimeLimits,
IDS_ASH_LOGIN_PARENT_ACCESS_TITLE,
IDS_ASH_LOGIN_PARENT_ACCESS_DESCRIPTION},
{ParentAccessRequestReason::kChangeTime,
IDS_ASH_LOGIN_PARENT_ACCESS_TITLE_CHANGE_TIME,
IDS_ASH_LOGIN_PARENT_ACCESS_GENERIC_DESCRIPTION},
{ParentAccessRequestReason::kChangeTimezone,
IDS_ASH_LOGIN_PARENT_ACCESS_TITLE_CHANGE_TIMEZONE,
IDS_ASH_LOGIN_PARENT_ACCESS_GENERIC_DESCRIPTION}};
// TODO(crbug.com/996828): Make (at least some of) the tests use
// ParentAccessWidget.
class ParentAccessViewTest : public LoginTestBase {
protected:
ParentAccessViewTest()
: account_id_(AccountId::FromUserEmail("child@gmail.com")) {}
~ParentAccessViewTest() override = default;
// LoginScreenTest:
void SetUp() override {
LoginTestBase::SetUp();
login_client_ = std::make_unique<MockLoginScreenClient>();
}
void TearDown() override {
LoginTestBase::TearDown();
// If the test did not explicitly dismissed the widget, destroy it now.
if (ParentAccessWidget::Get())
ParentAccessWidget::Get()->Destroy();
}
// Simulates mouse press event on a |button|.
void SimulateButtonPress(views::Button* button) {
ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
ui::EventTimeForNow(), 0, 0);
view_->ButtonPressed(button, event);
}
// Simulates mouse press event on pin keyboard |button|.
void SimulatePinKeyboardPress(views::View* button) {
ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
ui::EventTimeForNow(), 0, 0);
button->OnEvent(&event);
}
// Called when ParentAccessView finished processing.
void OnFinished(bool access_granted) {
access_granted ? ++successful_validation_ : ++back_action_;
}
void StartView(ParentAccessRequestReason reason =
ParentAccessRequestReason::kUnlockTimeLimits) {
ParentAccessView::Callbacks callbacks;
callbacks.on_finished = base::BindRepeating(
&ParentAccessViewTest::OnFinished, base::Unretained(this));
validation_time_ = base::Time::Now();
view_ =
new ParentAccessView(account_id_, callbacks, reason, validation_time_);
SetWidget(CreateWidgetWithContent(view_));
}
// Shows parent access widget with the specified |reason|.
void ShowWidget(ParentAccessRequestReason reason) {
ParentAccessWidget::Show(
account_id_,
base::BindRepeating(&ParentAccessViewTest::OnFinished,
base::Unretained(this)),
reason);
ParentAccessWidget* widget = ParentAccessWidget::Get();
ASSERT_TRUE(widget);
}
// Dismisses existing parent access widget with back button click. Should be
// only called when the widget is shown.
void DismissWidget() {
ParentAccessWidget* widget = ParentAccessWidget::Get();
ASSERT_TRUE(widget);
ParentAccessView* view =
ParentAccessWidget::TestApi(widget).parent_access_view();
ParentAccessView::TestApi test_api(view);
ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
ui::EventTimeForNow(), 0, 0);
view->ButtonPressed(test_api.back_button(), event);
}
// Verifies expectation that UMA |action| was logged.
void ExpectUMAActionReported(ParentAccessView::UMAAction action,
int bucket_count,
int total_count) {
histogram_tester_.ExpectBucketCount(
ParentAccessView::kUMAParentAccessCodeAction, action, bucket_count);
histogram_tester_.ExpectTotalCount(
ParentAccessView::kUMAParentAccessCodeAction, total_count);
}
void SimulateFailedValidation() {
login_client_->set_validate_parent_access_code_result(false);
EXPECT_CALL(*login_client_, ValidateParentAccessCode_(account_id_, "012345",
validation_time_))
.Times(1);
ui::test::EventGenerator* generator = GetEventGenerator();
for (int i = 0; i < 6; ++i) {
generator->PressKey(ui::KeyboardCode(ui::KeyboardCode::VKEY_0 + i),
ui::EF_NONE);
base::RunLoop().RunUntilIdle();
}
}
const AccountId account_id_;
std::unique_ptr<MockLoginScreenClient> login_client_;
// Number of times the view was dismissed with back button.
int back_action_ = 0;
// Number of times the view was dismissed after successful validation.
int successful_validation_ = 0;
// Time that will be used on the code validation.
base::Time validation_time_;
base::HistogramTester histogram_tester_;
ParentAccessView* view_ = nullptr; // Owned by test widget view hierarchy.
private:
DISALLOW_COPY_AND_ASSIGN(ParentAccessViewTest);
};
class ParentAccessViewModifiersTest
: public ParentAccessViewTest,
public ::testing::WithParamInterface<ViewModifiersTestData> {};
} // namespace
// Tests that title and description are correctly set.
TEST_P(ParentAccessViewModifiersTest, CheckStrings) {
const ViewModifiersTestData& test_data = GetParam();
StartView(test_data.reason);
ParentAccessView::TestApi test_api(view_);
EXPECT_EQ(l10n_util::GetStringUTF16(test_data.title),
test_api.title_label()->GetText());
EXPECT_EQ(l10n_util::GetStringUTF16(test_data.description),
test_api.description_label()->GetText());
}
INSTANTIATE_TEST_SUITE_P(,
ParentAccessViewModifiersTest,
testing::ValuesIn(kViewModifiersTestData));
// Tests that back button works.
TEST_F(ParentAccessViewTest, BackButton) {
StartView();
ParentAccessView::TestApi test_api(view_);
EXPECT_TRUE(test_api.back_button()->GetEnabled());
EXPECT_EQ(0, back_action_);
SimulateButtonPress(test_api.back_button());
EXPECT_EQ(1, back_action_);
EXPECT_EQ(0, successful_validation_);
ExpectUMAActionReported(ParentAccessView::UMAAction::kCanceledByUser, 1, 1);
}
// Tests that the code is autosubmitted when input is complete.
TEST_F(ParentAccessViewTest, Autosubmit) {
StartView();
ParentAccessView::TestApi test_api(view_);
EXPECT_FALSE(test_api.submit_button()->GetEnabled());
login_client_->set_validate_parent_access_code_result(true);
EXPECT_CALL(*login_client_, ValidateParentAccessCode_(account_id_, "012345",
validation_time_))
.Times(1);
ui::test::EventGenerator* generator = GetEventGenerator();
for (int i = 0; i < 6; ++i) {
generator->PressKey(ui::KeyboardCode(ui::KeyboardCode::VKEY_0 + i),
ui::EF_NONE);
base::RunLoop().RunUntilIdle();
}
EXPECT_EQ(1, successful_validation_);
ExpectUMAActionReported(ParentAccessView::UMAAction::kValidationSuccess, 1,
1);
}
// Tests that submit button submits code from code input.
TEST_F(ParentAccessViewTest, SubmitButton) {
StartView();
ParentAccessView::TestApi test_api(view_);
EXPECT_FALSE(test_api.submit_button()->GetEnabled());
SimulateFailedValidation();
auto* generator = GetEventGenerator();
// Updating input code (here last digit) should clear error state.
generator->PressKey(ui::KeyboardCode::VKEY_6, ui::EF_NONE);
EXPECT_EQ(ParentAccessView::State::kNormal, test_api.state());
EXPECT_TRUE(test_api.submit_button()->GetEnabled());
login_client_->set_validate_parent_access_code_result(true);
EXPECT_CALL(*login_client_, ValidateParentAccessCode_(account_id_, "012346",
validation_time_))
.Times(1);
SimulateButtonPress(test_api.submit_button());
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, successful_validation_);
ExpectUMAActionReported(ParentAccessView::UMAAction::kValidationSuccess, 1,
2);
}
// Tests that help button opens help app.
TEST_F(ParentAccessViewTest, HelpButton) {
auto client = std::make_unique<MockLoginScreenClient>();
StartView();
ParentAccessView::TestApi test_api(view_);
EXPECT_TRUE(test_api.help_button()->GetEnabled());
EXPECT_CALL(*client, ShowParentAccessHelpApp()).Times(1);
SimulateButtonPress(test_api.help_button());
ExpectUMAActionReported(ParentAccessView::UMAAction::kGetHelp, 1, 1);
}
// Tests that access code can be entered with numpad.
TEST_F(ParentAccessViewTest, Numpad) {
StartView();
ParentAccessView::TestApi test_api(view_);
login_client_->set_validate_parent_access_code_result(true);
EXPECT_CALL(*login_client_, ValidateParentAccessCode_(account_id_, "012345",
validation_time_))
.Times(1);
ui::test::EventGenerator* generator = GetEventGenerator();
for (int i = 0; i < 6; ++i) {
generator->PressKey(ui::KeyboardCode(ui::VKEY_NUMPAD0 + i), ui::EF_NONE);
base::RunLoop().RunUntilIdle();
}
EXPECT_TRUE(test_api.submit_button()->GetEnabled());
EXPECT_EQ(1, successful_validation_);
ExpectUMAActionReported(ParentAccessView::UMAAction::kValidationSuccess, 1,
1);
}
// Tests that access code can be submitted with press of 'enter' key.
TEST_F(ParentAccessViewTest, SubmitWithEnter) {
StartView();
ParentAccessView::TestApi test_api(view_);
EXPECT_FALSE(test_api.submit_button()->GetEnabled());
SimulateFailedValidation();
// Updating input code (here last digit) should clear error state.
auto* generator = GetEventGenerator();
generator->PressKey(ui::KeyboardCode::VKEY_6, ui::EF_NONE);
EXPECT_EQ(ParentAccessView::State::kNormal, test_api.state());
login_client_->set_validate_parent_access_code_result(true);
EXPECT_CALL(*login_client_, ValidateParentAccessCode_(account_id_, "012346",
validation_time_))
.Times(1);
generator->PressKey(ui::KeyboardCode::VKEY_RETURN, ui::EF_NONE);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, successful_validation_);
ExpectUMAActionReported(ParentAccessView::UMAAction::kValidationSuccess, 1,
2);
}
// Tests that 'enter' key does not submit incomplete code.
TEST_F(ParentAccessViewTest, PressEnterOnIncompleteCode) {
StartView();
ParentAccessView::TestApi test_api(view_);
EXPECT_FALSE(test_api.submit_button()->GetEnabled());
// Enter incomplete code.
ui::test::EventGenerator* generator = GetEventGenerator();
for (int i = 0; i < 5; ++i) {
generator->PressKey(ui::KeyboardCode(ui::KeyboardCode::VKEY_0 + i),
ui::EF_NONE);
base::RunLoop().RunUntilIdle();
}
EXPECT_FALSE(test_api.submit_button()->GetEnabled());
login_client_->set_validate_parent_access_code_result(true);
EXPECT_CALL(*login_client_, ValidateParentAccessCode_).Times(0);
// Pressing enter should not submit incomplete code.
generator->PressKey(ui::KeyboardCode::VKEY_RETURN, ui::EF_NONE);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(0, successful_validation_);
login_client_->set_validate_parent_access_code_result(false);
EXPECT_CALL(*login_client_, ValidateParentAccessCode_(account_id_, "012349",
validation_time_))
.Times(1);
// Fill in last digit of the code.
generator->PressKey(ui::KeyboardCode(ui::KeyboardCode::VKEY_9), ui::EF_NONE);
base::RunLoop().RunUntilIdle();
// Updating input code (here last digit) should clear error state.
generator->PressKey(ui::KeyboardCode::VKEY_6, ui::EF_NONE);
EXPECT_EQ(ParentAccessView::State::kNormal, test_api.state());
login_client_->set_validate_parent_access_code_result(true);
EXPECT_CALL(*login_client_, ValidateParentAccessCode_(account_id_, "012346",
validation_time_))
.Times(1);
// Now the code should be submitted with enter key.
generator->PressKey(ui::KeyboardCode::VKEY_RETURN, ui::EF_NONE);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, successful_validation_);
ExpectUMAActionReported(ParentAccessView::UMAAction::kValidationSuccess, 1,
2);
}
// Tests that backspace button works.
TEST_F(ParentAccessViewTest, Backspace) {
StartView();
ParentAccessView::TestApi test_api(view_);
EXPECT_FALSE(test_api.submit_button()->GetEnabled());
SimulateFailedValidation();
EXPECT_EQ(ParentAccessView::State::kError, test_api.state());
ui::test::EventGenerator* generator = GetEventGenerator();
// Active field has content - backspace clears the content, but does not move
// focus.
generator->PressKey(ui::KeyboardCode::VKEY_BACK, ui::EF_NONE);
EXPECT_FALSE(test_api.submit_button()->GetEnabled());
// Active Field is empty - backspace moves focus to before last field.
generator->PressKey(ui::KeyboardCode::VKEY_BACK, ui::EF_NONE);
EXPECT_FALSE(test_api.submit_button()->GetEnabled());
// Change value in before last field.
generator->PressKey(ui::KeyboardCode::VKEY_2, ui::EF_NONE);
base::RunLoop().RunUntilIdle();
EXPECT_FALSE(test_api.submit_button()->GetEnabled());
// Fill in value in last field.
generator->PressKey(ui::KeyboardCode::VKEY_3, ui::EF_NONE);
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(test_api.submit_button()->GetEnabled());
login_client_->set_validate_parent_access_code_result(true);
EXPECT_CALL(*login_client_, ValidateParentAccessCode_(account_id_, "012323",
validation_time_))
.Times(1);
SimulateButtonPress(test_api.submit_button());
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, successful_validation_);
ExpectUMAActionReported(ParentAccessView::UMAAction::kValidationSuccess, 1,
2);
}
// Tests input with virtual pin keyboard.
TEST_F(ParentAccessViewTest, PinKeyboard) {
StartView();
Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true);
ParentAccessView::TestApi test_api(view_);
LoginPinView::TestApi test_pin_keyboard(test_api.pin_keyboard_view());
EXPECT_FALSE(test_api.submit_button()->GetEnabled());
login_client_->set_validate_parent_access_code_result(true);
EXPECT_CALL(*login_client_, ValidateParentAccessCode_(account_id_, "012345",
validation_time_))
.Times(1);
for (int i = 0; i < 6; ++i) {
SimulatePinKeyboardPress(test_pin_keyboard.GetButton(i));
base::RunLoop().RunUntilIdle();
}
EXPECT_TRUE(test_api.submit_button()->GetEnabled());
EXPECT_EQ(1, successful_validation_);
ExpectUMAActionReported(ParentAccessView::UMAAction::kValidationSuccess, 1,
1);
}
// Tests that pin keyboard visibility changes upon tablet mode changes.
TEST_F(ParentAccessViewTest, PinKeyboardVisibilityChange) {
StartView();
ParentAccessView::TestApi test_api(view_);
LoginPinView::TestApi test_pin_keyboard(test_api.pin_keyboard_view());
EXPECT_FALSE(test_api.pin_keyboard_view()->GetVisible());
Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true);
EXPECT_TRUE(test_api.pin_keyboard_view()->GetVisible());
Shell::Get()->tablet_mode_controller()->SetEnabledForTest(false);
EXPECT_FALSE(test_api.pin_keyboard_view()->GetVisible());
}
// Tests that error state is shown and cleared when neccesary.
TEST_F(ParentAccessViewTest, ErrorState) {
StartView();
ParentAccessView::TestApi test_api(view_);
EXPECT_EQ(ParentAccessView::State::kNormal, test_api.state());
// Error should be shown after unsuccessful validation.
SimulateFailedValidation();
EXPECT_EQ(ParentAccessView::State::kError, test_api.state());
EXPECT_EQ(0, successful_validation_);
ExpectUMAActionReported(ParentAccessView::UMAAction::kValidationError, 1, 1);
// Updating input code (here last digit) should clear error state.
auto* generator = GetEventGenerator();
generator->PressKey(ui::KeyboardCode::VKEY_6, ui::EF_NONE);
EXPECT_EQ(ParentAccessView::State::kNormal, test_api.state());
login_client_->set_validate_parent_access_code_result(true);
EXPECT_CALL(*login_client_, ValidateParentAccessCode_(account_id_, "012346",
validation_time_))
.Times(1);
SimulateButtonPress(test_api.submit_button());
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, successful_validation_);
ExpectUMAActionReported(ParentAccessView::UMAAction::kValidationError, 1, 2);
}
// Tests children views traversal with tab key.
TEST_F(ParentAccessViewTest, TabKeyTraversal) {
StartView();
ParentAccessView::TestApi test_api(view_);
EXPECT_TRUE(HasFocusInAnyChildView(test_api.access_code_view()));
SimulateFailedValidation();
// Updating input code (here last digit) should clear error state.
auto* generator = GetEventGenerator();
generator->PressKey(ui::KeyboardCode::VKEY_6, ui::EF_NONE);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(ParentAccessView::State::kNormal, test_api.state());
EXPECT_TRUE(test_api.submit_button()->HasFocus());
generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_NONE);
EXPECT_TRUE(test_api.back_button()->HasFocus());
generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_NONE);
EXPECT_TRUE(test_api.title_label()->HasFocus());
generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_NONE);
EXPECT_TRUE(test_api.description_label()->HasFocus());
generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_NONE);
EXPECT_TRUE(HasFocusInAnyChildView(test_api.access_code_view()));
generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_NONE);
EXPECT_TRUE(test_api.help_button()->HasFocus());
}
// Tests children views backwards traversal with tab key.
TEST_F(ParentAccessViewTest, BackwardTabKeyTraversal) {
StartView();
ParentAccessView::TestApi test_api(view_);
EXPECT_TRUE(HasFocusInAnyChildView(test_api.access_code_view()));
SimulateFailedValidation();
auto* generator = GetEventGenerator();
generator->PressKey(ui::KeyboardCode::VKEY_6, ui::EF_NONE);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(ParentAccessView::State::kNormal, test_api.state());
EXPECT_TRUE(test_api.submit_button()->HasFocus());
generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_SHIFT_DOWN);
EXPECT_TRUE(test_api.help_button()->HasFocus());
generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_SHIFT_DOWN);
EXPECT_TRUE(HasFocusInAnyChildView(test_api.access_code_view()));
generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_SHIFT_DOWN);
EXPECT_TRUE(test_api.description_label()->HasFocus());
generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_SHIFT_DOWN);
EXPECT_TRUE(test_api.title_label()->HasFocus());
generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_SHIFT_DOWN);
EXPECT_TRUE(test_api.back_button()->HasFocus());
generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_SHIFT_DOWN);
EXPECT_TRUE(test_api.submit_button()->HasFocus());
generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_SHIFT_DOWN);
EXPECT_TRUE(test_api.help_button()->HasFocus());
generator->PressKey(ui::KeyboardCode::VKEY_TAB, ui::EF_SHIFT_DOWN);
EXPECT_TRUE(HasFocusInAnyChildView(test_api.access_code_view()));
}
using ParentAccessWidgetTest = ParentAccessViewTest;
// Tests that correct usage metric is reported.
TEST_F(ParentAccessWidgetTest, UMAUsageMetric) {
ShowWidget(ParentAccessRequestReason::kUnlockTimeLimits);
DismissWidget();
histogram_tester_.ExpectBucketCount(
ParentAccessView::kUMAParentAccessCodeUsage,
ParentAccessView::UMAUsage::kTimeLimits, 1);
ShowWidget(ParentAccessRequestReason::kChangeTimezone);
DismissWidget();
histogram_tester_.ExpectBucketCount(
ParentAccessView::kUMAParentAccessCodeUsage,
ParentAccessView::UMAUsage::kTimezoneChange, 1);
// The below usage depends on the session state.
GetSessionControllerClient()->SetSessionState(
session_manager::SessionState::ACTIVE);
ShowWidget(ParentAccessRequestReason::kChangeTime);
DismissWidget();
histogram_tester_.ExpectBucketCount(
ParentAccessView::kUMAParentAccessCodeUsage,
ParentAccessView::UMAUsage::kTimeChangeInSession, 1);
GetSessionControllerClient()->SetSessionState(
session_manager::SessionState::LOGIN_PRIMARY);
ShowWidget(ParentAccessRequestReason::kChangeTime);
DismissWidget();
histogram_tester_.ExpectBucketCount(
ParentAccessView::kUMAParentAccessCodeUsage,
ParentAccessView::UMAUsage::kTimeChangeLoginScreen, 1);
GetSessionControllerClient()->SetSessionState(
session_manager::SessionState::ACTIVE);
ShowWidget(ParentAccessRequestReason::kChangeTime);
DismissWidget();
histogram_tester_.ExpectBucketCount(
ParentAccessView::kUMAParentAccessCodeUsage,
ParentAccessView::UMAUsage::kTimeChangeInSession, 2);
histogram_tester_.ExpectTotalCount(
ParentAccessView::kUMAParentAccessCodeUsage, 5);
}
// Tests that the widget is properly resized when tablet mode changes.
TEST_F(ParentAccessWidgetTest, WidgetResizingInTabletMode) {
// Set display large enough to fit preferred view sizes.
UpdateDisplay("1200x800");
ShowWidget(ParentAccessRequestReason::kUnlockTimeLimits);
ParentAccessWidget* widget = ParentAccessWidget::Get();
ASSERT_TRUE(widget);
ParentAccessView* view =
ParentAccessWidget::TestApi(widget).parent_access_view();
constexpr auto kClamshellModeSize = gfx::Size(340, 340);
constexpr auto kTabletModeSize = gfx::Size(340, 580);
const auto widget_size = [&view]() -> gfx::Size {
return view->GetWidget()->GetWindowBoundsInScreen().size();
};
const auto widget_center = [&view]() -> gfx::Point {
return view->GetWidget()->GetWindowBoundsInScreen().CenterPoint();
};
const auto user_work_area_center = [&view]() -> gfx::Point {
return WorkAreaInsets::ForWindow(view->GetWidget()->GetNativeWindow())
->user_work_area_bounds()
.CenterPoint();
};
EXPECT_EQ(kClamshellModeSize, view->size());
EXPECT_EQ(kClamshellModeSize, widget_size());
EXPECT_EQ(user_work_area_center(), widget_center());
Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true);
EXPECT_EQ(kTabletModeSize, view->size());
EXPECT_EQ(kTabletModeSize, widget_size());
EXPECT_EQ(user_work_area_center(), widget_center());
Shell::Get()->tablet_mode_controller()->SetEnabledForTest(false);
EXPECT_EQ(kClamshellModeSize, view->size());
EXPECT_EQ(kClamshellModeSize, widget_size());
EXPECT_EQ(user_work_area_center(), widget_center());
widget->Destroy();
}
TEST_F(ParentAccessViewTest, VirtualKeyboardHidden) {
// Enable and show virtual keyboard.
auto* keyboard_controller = Shell::Get()->keyboard_controller();
ASSERT_NE(keyboard_controller, nullptr);
keyboard_controller->SetEnableFlag(
keyboard::KeyboardEnableFlag::kCommandLineEnabled);
// Show widget.
ShowWidget(ParentAccessRequestReason::kUnlockTimeLimits);
auto* view = ParentAccessWidget::TestApi(ParentAccessWidget::Get())
.parent_access_view();
ParentAccessView::TestApi test_api(view);
views::Textfield* text_field = test_api.GetInputTextField(0);
ui::GestureEvent event(
text_field->x(), text_field->y(), 0, base::TimeTicks::Now(),
ui::GestureEventDetails(ui::EventType::ET_GESTURE_TAP_DOWN));
text_field->OnGestureEvent(&event);
base::RunLoop().RunUntilIdle();
// Even if we have pressed the text input field, virtual keyboard shouldn't
// show.
EXPECT_FALSE(keyboard_controller->IsKeyboardVisible());
DismissWidget();
}
// Tests that spoken feedback keycombo starts screen reader.
TEST_F(ParentAccessWidgetTest, SpokenFeedbackKeyCombo) {
ShowWidget(ParentAccessRequestReason::kUnlockTimeLimits);
AccessibilityControllerImpl* controller =
Shell::Get()->accessibility_controller();
EXPECT_FALSE(controller->spoken_feedback_enabled());
ui::test::EventGenerator* generator = GetEventGenerator();
generator->PressKey(ui::KeyboardCode(ui::KeyboardCode::VKEY_Z),
ui::EF_ALT_DOWN | ui::EF_CONTROL_DOWN);
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(controller->spoken_feedback_enabled());
}
} // namespace ash
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
8df800ed548d0923bbca70f315ce8dc50b551258 | 182681892a79c02bab76c9a96ccced8b587119b2 | /App/MainView/MainView.h | e391ab10a897ff0bfc6dd283de11fdaeef11cf8e | [] | no_license | MarcinFilipek/HomCenter | 71fdc7ab9e8b98c93334c565cd7776743e576031 | 15ab5fcc57b9f07a12780869b61119ec76d24cbf | refs/heads/master | 2020-06-18T05:51:10.933122 | 2019-07-10T10:42:34 | 2019-07-10T10:42:34 | 196,185,538 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,087 | h | /*
* MainView.h
*
* Created on: 5 maj 2017
* Author: Uzume
*/
#ifndef MAINVIEW_MAINVIEW_H_
#define MAINVIEW_MAINVIEW_H_
#include "../Touch/View/View.h"
#include "../TestPresenter/TestPresenter.h"
#include "../Touch/Image/Image.h"
#include "../Touch/Button/Button.h"
#include "../Touch/TextArea/TextArea.h"
#include "../Touch/TextAreaWithWildcard/TextAreaWithWildcard.h"
class MainView: public View<TestPresenter> {
public:
MainView() :
buttonClicedCallback(this, &MainView::buttonClicked) {
}
virtual ~MainView() {
}
void setupScreen(void);
void tearDownScreen(void);
void buttonClicked(const AbstractButton& source);
private:
Image m_imageBackground;
Image m_imageExit;
Image m_imageKafelek;
Image m_imageKreska;
Image m_imageKreska2;
Button m_buttonPower;
Button m_buttonPower2;
TextArea m_textCzesc;
TextArea m_textDlugi;
TextArea m_textDlugiLF;
Unicode::UnicodeChar m_buffer[10];
TextAreaWithOneWildcard m_textWildcard;
Container m_kontener;
Callback<MainView, const AbstractButton&> buttonClicedCallback;
};
#endif /* MAINVIEW_MAINVIEW_H_ */
| [
"filipekmarcin180@gmail.com"
] | filipekmarcin180@gmail.com |
a678c05d15fb2fe591f76fc5a9709c67fe26509f | ce2f15108184c3f3b374c022d5abea4854892e93 | /IBox.hpp | ade1577128ac356e6bc06a55ef5d1f2314477210 | [] | no_license | mstfzbn/October-2019-Refresh | 84ccc093a1f6da0c967df73ff3e9d00a9f94cb9c | 0b46becdcddc343db0fe43aeb308ef487e24b00a | refs/heads/master | 2023-08-22T02:36:46.852347 | 2023-08-10T14:46:11 | 2023-08-10T14:46:11 | 215,539,363 | 1 | 0 | null | 2023-08-10T14:46:13 | 2019-10-16T12:10:45 | C++ | UTF-8 | C++ | false | false | 3,702 | hpp | #include "includes.hpp"
#include "defines.hpp"
namespace Geometry
{
//interface class, wich gave properties to hyper-dimensional box objects
class ITopology
{
//an interface class has no implementation
//it contaions only a virtual destructor and pure virtual functions
public:
virtual ~ITopology() = default;
//even pure virtual functions must know ther argument list
virtual void SetDimensions(const size_t &) = 0;
virtual size_t GetDimensions() = 0;
};
//length of each dimension
//vector with all og them
//set function with for loop for their length
class NBox: public ITopology
{
public:
NBox()
{
#ifdef DEBUG
std::cout << "\033[0;31m\n NBox Constructor called.\n\033[0m";
// std::cout << "\n\n NBox Constructor called.\n";
#endif
}; //need implemntation
virtual ~NBox()
{
#ifdef DEBUG
std::cout << "\033[0;31m\n NBox Destructor called.\n\033[0m";
// std::cout << "\n\n NBox Destructor called.\n";
#endif
m_nbox_lengths.clear();
};
virtual void SetDimensions( const size_t &dimension )
{
m_nbox_dimensions = dimension;
}
virtual size_t GetDimensions()
{
return m_nbox_dimensions;
}
//vector<double> with lengths
virtual void SetLengthOfAllDimensions( const std::vector<double> &lengths )
{
m_nbox_lengths = lengths;
}
virtual std::vector<double>* GetSizeOfAllDimensions()
{
return &m_nbox_lengths;
}
//pure virtual, wich will be derivated and described,
//used to show polymorphism
virtual void ShowName() = 0;
//CalculateVolume
protected:
size_t m_nbox_dimensions;
std::vector<double> m_nbox_lengths;
};
class ThreeDimensionalBox: public NBox
{
public:
ThreeDimensionalBox():NBox()
{
#ifdef DEBUG
std::cout << "\033[0;31m\n ThreeDimensionalBox Constructor called.\n\033[0m";
//std::cout << "\n\n ThreeDimensionalBox Constructor called.\n";
#endif
this->SetDimensions( THREE );
};
~ThreeDimensionalBox()
{
#ifdef DEBUG
std::cout << "\033[0;31m\n ThreeDimensionalBox Constructor called.\n\033[0m";
//std::cout << "\n\n ThreeDimensionalBox Destructor called.\n";
#endif
};
virtual void ShowName()
{
std::cout << "\033[0;36m\n3D box\n\033[0m";
//std::cout << "\n3D box\n";
}
};
class FourDimensionalBox: public NBox
{
public:
FourDimensionalBox():NBox()
{
#ifdef DEBUG
std::cout << "\033[0;31m\n FourDimensionalBox Constructor called.\n\033[0m";
//std::cout << "\n\n FourDimensionalBox Constructor called.\n";
#endif
this->SetDimensions( FOUR );
};
~FourDimensionalBox()
{
#ifdef DEBUG
std::cout << "\033[0;31m\n FourDimensionalBox Destructor called\n\033[0m";
//std::cout << "\n\n FourDimensionalBox Destructor called.\n";
#endif
};
virtual void ShowName()
{
std::cout << "\033[0;35m\n4D box\n\033[0m";
//std::cout << "\n4D box\n";
}
};
};//end of namespace Geometry
| [
"noreply@github.com"
] | mstfzbn.noreply@github.com |
f1cb677ba2a3451f2f9837a8b5bedaf792fca9b0 | 9240ceb15f7b5abb1e4e4644f59d209b83d70066 | /sp/src/game/client/c_te_basebeam.h | b96a59a8658b946e66aa06deb3f1c1d9fa106274 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Margen67/blamod | 13e5cd9f7f94d1612eb3f44a2803bf2f02a3dcbe | d59b5f968264121d013a81ae1ba1f51432030170 | refs/heads/master | 2023-04-16T12:05:12.130933 | 2019-02-20T10:23:04 | 2019-02-20T10:23:04 | 264,556,156 | 2 | 0 | NOASSERTION | 2020-05-17T00:47:56 | 2020-05-17T00:47:55 | null | UTF-8 | C++ | false | false | 1,262 | h | //========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $Workfile: $
// $Date: $
// $NoKeywords: $
//=============================================================================//
#if !defined( C_TE_BASEBEAM_H )
#define C_TE_BASEBEAM_H
#ifdef _WIN32
#pragma once
#endif
#include "c_basetempentity.h"
//-----------------------------------------------------------------------------
// Purpose: Base entity for beam te's
//-----------------------------------------------------------------------------
class C_TEBaseBeam : public C_BaseTempEntity
{
public:
DECLARE_CLASS( C_TEBaseBeam, C_BaseTempEntity );
DECLARE_CLIENTCLASS();
private:
public:
C_TEBaseBeam( void );
virtual ~C_TEBaseBeam( void );
virtual void PreDataUpdate( DataUpdateType_t updateType );
virtual void PostDataUpdate( DataUpdateType_t updateType );
public:
int m_nModelIndex;
int m_nHaloIndex;
int m_nStartFrame;
int m_nFrameRate;
float m_fLife;
float m_fWidth;
float m_fEndWidth;
int m_nFadeLength;
float m_fAmplitude;
int r, g, b, a;
int m_nSpeed;
int m_nFlags;
};
EXTERN_RECV_TABLE(DT_BaseBeam);
#endif // C_TE_BASEBEAM_H | [
"joe@valvesoftware.com"
] | joe@valvesoftware.com |
73cd4cb1786e70c415e7e65cd2226f0430613164 | 634120df190b6262fccf699ac02538360fd9012d | /Develop/mdk/cml2/MOBox.cpp | 581fd12d058752599e02f559a12ba0057ed5ed49 | [] | no_license | ktj007/Raiderz_Public | c906830cca5c644be384e68da205ee8abeb31369 | a71421614ef5711740d154c961cbb3ba2a03f266 | refs/heads/master | 2021-06-08T03:37:10.065320 | 2016-11-28T07:50:57 | 2016-11-28T07:50:57 | 74,959,309 | 6 | 4 | null | 2016-11-28T09:53:49 | 2016-11-28T09:53:49 | null | UHC | C++ | false | false | 5,343 | cpp | #include "stdafx.h"
#include "MMath.h"
#include "MBox.h"
#include "MObox.h"
#include "MMatrix3.h"
MOBox::MOBox(const MMatrix &_transform)
{
MVector3 axisX(_transform._11, _transform._21, _transform._31);
MVector3 axisY(_transform._12, _transform._22, _transform._32);
MVector3 axisZ(_transform._13, _transform._23, _transform._33);
vRange.x = axisX.Length();
vRange.y = axisY.Length();
vRange.z = axisZ.Length();
vAxis[0] = axisX / vRange.x;
vAxis[1] = axisY / vRange.y;
vAxis[2] = axisZ / vRange.z;
vPosition = MVector3(_transform._41, _transform._42, _transform._43);
}
MOBox::MOBox(const MVector3 &_xaxis, const MVector3 &_yaxis, const MVector3 &_zaxis, const MVector3 &_range, const MVector3 &_position)
: vRange(_range)
, vPosition(_position)
{
_ASSERT(MMath::Equals(_xaxis.Length(), 1.0f));
_ASSERT(MMath::Equals(_yaxis.Length(), 1.0f));
_ASSERT(MMath::Equals(_zaxis.Length(), 1.0f));
vAxis[0] = _xaxis;
vAxis[1] = _yaxis;
vAxis[2] = _zaxis;
}
bool MOBox::Intersect( const MBox &aabb )
{
MOBox obb;
//AABB정보 obb형태로 변환
obb.vPosition = (aabb.vmax + aabb.vmin) * 0.5f;
obb.vAxis[0] = MVector3(1,0,0);
obb.vAxis[1] = MVector3(0,1,0);
obb.vAxis[2] = MVector3(0,0,1);
obb.vRange[0] = (aabb.maxx - aabb.minx) * 0.5f;
obb.vRange[1] = (aabb.maxy - aabb.miny) * 0.5f;
obb.vRange[2] = (aabb.maxz - aabb.minz) * 0.5f;
return intersect(*this,obb);
}
bool MOBox::Intersect( MOBox &rhs )
{
return intersect(*this,rhs);
}
bool MOBox::intersect(MOBox &a, MOBox &b)
{
float ra, rb;
MMatrix3 R, AbsR;
// Compute rotation matrix expressing b in a's coordinate frame
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
R._m[i][j] = DotProduct(a.vAxis[i], b.vAxis[j]);
// Compute translation vector t
MVector3 t = b.vPosition - a.vPosition;
// Bring translation into a's coordinate frame
t = MVector3(DotProduct(t, a.vAxis[0]), DotProduct(t, a.vAxis[1]), DotProduct(t, a.vAxis[2]));
// Compute common subexpressions. Add in an epsilon term to
// counteract arithmetic errors when two edges are parallel and
// their cross product is (near) null (see text for details)
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
AbsR._m[i][j] = fabs(R._m[i][j]) + MMath::EPSILON;
// Test axes L = A0, L = A1, L = A2
for (int i = 0; i < 3; i++) {
ra = a.vRange[i];
rb = b.vRange[0] * AbsR._m[i][0] + b.vRange[1] * AbsR._m[i][1] + b.vRange[2] * AbsR._m[i][2];
if (fabs(t[i]) > ra + rb) return 0;
}
// Test axes L = B0, L = B1, L = B2
for (int i = 0; i < 3; i++) {
ra = a.vRange[0] * AbsR._m[0][i] + a.vRange[1] * AbsR._m[1][i] + a.vRange[2] * AbsR._m[2][i];
rb = b.vRange[i];
if (fabs(t[0] * R._m[0][i] + t[1] * R._m[1][i] + t[2] * R._m[2][i]) > ra + rb) return 0;
}
// Test axis L = A0 x B0
ra = a.vRange[1] * AbsR._m[2][0] + a.vRange[2] * AbsR._m[1][0];
rb = b.vRange[1] * AbsR._m[0][2] + b.vRange[2] * AbsR._m[0][1];
if (fabs(t[2] * R._m[1][0] - t[1] * R._m[2][0]) > ra + rb) return 0;
// Test axis L = A0 x B1
ra = a.vRange[1] * AbsR._m[2][1] + a.vRange[2] * AbsR._m[1][1];
rb = b.vRange[0] * AbsR._m[0][2] + b.vRange[2] * AbsR._m[0][0];
if (fabs(t[2] * R._m[1][1] - t[1] * R._m[2][1]) > ra + rb) return 0;
// Test axis L = A0 x B2
ra = a.vRange[1] * AbsR._m[2][2] + a.vRange[2] * AbsR._m[1][2];
rb = b.vRange[0] * AbsR._m[0][1] + b.vRange[1] * AbsR._m[0][0];
if (fabs(t[2] * R._m[1][2] - t[1] * R._m[2][2]) > ra + rb) return 0;
// Test axis L = A1 x B0
ra = a.vRange[0] * AbsR._m[2][0] + a.vRange[2] * AbsR._m[0][0];
rb = b.vRange[1] * AbsR._m[1][2] + b.vRange[2] * AbsR._m[1][1];
if (fabs(t[0] * R._m[2][0] - t[2] * R._m[0][0]) > ra + rb) return 0;
// Test axis L = A1 x B1
ra = a.vRange[0] * AbsR._m[2][1] + a.vRange[2] * AbsR._m[0][1];
rb = b.vRange[0] * AbsR._m[1][2] + b.vRange[2] * AbsR._m[1][0];
if (fabs(t[0] * R._m[2][1] - t[2] * R._m[0][1]) > ra + rb) return 0;
// Test axis L = A1 x B2
ra = a.vRange[0] * AbsR._m[2][2] + a.vRange[2] * AbsR._m[0][2];
rb = b.vRange[0] * AbsR._m[1][1] + b.vRange[1] * AbsR._m[1][0];
if (fabs(t[0] * R._m[2][2] - t[2] * R._m[0][2]) > ra + rb) return 0;
// Test axis L = A2 x B0
ra = a.vRange[0] * AbsR._m[1][0] + a.vRange[1] * AbsR._m[0][0];
rb = b.vRange[1] * AbsR._m[2][2] + b.vRange[2] * AbsR._m[2][1];
if (fabs(t[1] * R._m[0][0] - t[0] * R._m[1][0]) > ra + rb) return 0;
// Test axis L = A2 x B1
ra = a.vRange[0] * AbsR._m[1][1] + a.vRange[1] * AbsR._m[0][1];
rb = b.vRange[0] * AbsR._m[2][2] + b.vRange[2] * AbsR._m[2][0];
if (fabs(t[1] * R._m[0][1] - t[0] * R._m[1][1]) > ra + rb) return 0;
// Test axis L = A2 x B2
ra = a.vRange[0] * AbsR._m[1][2] + a.vRange[1] * AbsR._m[0][2];
rb = b.vRange[0] * AbsR._m[2][1] + b.vRange[1] * AbsR._m[2][0];
if (fabs(t[1] * R._m[0][2] - t[0] * R._m[1][2]) > ra + rb) return 0;
// Since no separating axis found, the OBBs must be intersecting
return true;
}
bool MOBox::IsOut( MVector3& v )
{
//v를 obb좌표계로
MVector3 k = v - this->vPosition;
MVector3 p (DotProduct(this->vAxis[0],k ) , DotProduct(this->vAxis[1],k ) , DotProduct(this->vAxis[2],k) );
float absx = fabs(this->vRange.x);
float absy = fabs(this->vRange.y);
float absz = fabs(this->vRange.z);
if( p.x < -absx || absx < p.x ) return true;
if( p.y < -absy || absy < p.y ) return true;
if( p.z < -absz || absz < p.z ) return true;
return false;
} | [
"espause0703@gmail.com"
] | espause0703@gmail.com |
b322245bd485fb6477338b075f8827b7d2d01dd6 | b502b3502883e06b44ee84f255c7632340235744 | /Inc/incHalcon71/HSemImage.h | 61004631cb38699b7fb4e8e9e6b8c9994fb2651b | [] | no_license | datiacfl/GlasswareDetectSystem-VEXI | 162396ae1bf084f3d25b852a753751b9e07b811a | da0884984aebc9abd00ae00f5541e97431738747 | refs/heads/master | 2020-12-03T12:29:10.207260 | 2020-01-02T05:59:07 | 2020-01-02T06:04:24 | 231,316,025 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 31,653 | h | /*****************************************************************************
* HSemImage.h
*****************************************************************************
*
* Project: Halcon/C++
* Description: Types for semantic images
*
* (c) 1996-2005 by MVTec Software GmbH
* www.mvtec.com
*
*****************************************************************************
*
* $Revision: 1.12 $
* $Date: 2005/05/06 07:36:05 $
*
*/
#ifndef S_IMAGE_H
#define S_IMAGE_H
namespace Halcon {
/****************************************************************************/
/* HSemAbstractPixVal */
/****************************************************************************/
class LIntExport HSemAbstractPixVal: public HBasePixVal {
public:
virtual operator HByte(void) const = 0;
virtual operator int(void) const = 0;
virtual operator Hlong(void) const = 0;
virtual operator double(void) const = 0;
virtual operator HPixVal(void) const = 0;
virtual int Num(void) const = 0;
virtual HPixVal GetPixVal(int index) const = 0;
virtual HSemAbstractPixVal *Copy(void) const = 0;
virtual const char *ClassName(void) const = 0;
};
/****************************************************************************/
/* HSemPixVal */
/****************************************************************************/
class LIntExport HSemPixVal: public HBasePixVal {
public:
HSemPixVal(void);
HSemPixVal(HSemAbstractPixVal *Val);
HSemPixVal(const HSemAbstractPixVal &Val); // Wert wird kopiert
operator HByte(void) const;
operator int(void) const;
operator Hlong(void) const;
operator double(void) const;
operator HPixVal(void) const;
int Num(void) const;
HPixVal GetPixVal(int index) const;
const char *ClassName(void) const;
private:
HSemAbstractPixVal *val;
};
/****************************************************************************/
/* HLUTVal */
/****************************************************************************/
class LIntExport HLUTPixVal: public HSemAbstractPixVal {
public:
HLUTVal(void);
HLUTVal(HByte val);
operator HByte(void) const;
operator int(void) const;
operator Hlong(void) const;
operator double(void) const;
operator HComplex(void) const;
const char *ClassName(void) const { return "HLUTPixVal"; }
HSemAbstractPixVal *Copy(void) const;
void Delete(void);
private:
HByte val;
};
/****************************************************************************/
/* HColorPixVal */
/****************************************************************************/
class LIntExport HColorPixVal: public HSemAbstractPixVal {
public:
virtual HPixVal Red(void) const = 0;
virtual HPixVal Green(void) const = 0;
virtual HPixVal Blue(void) const = 0;
virtual operator HByte(void) const = 0;
virtual operator int(void) const = 0;
virtual operator Hlong(void) const = 0;
virtual operator double(void) const = 0;
virtual operator HPixVal(void) const = 0;
virtual int Num(void) const = 0;
virtual HPixVal GetPixVal(int index) const = 0;
virtual HSemAbstractPixVal *Copy(void) const = 0;
virtual const char *ClassName(void) const = 0;
};
/****************************************************************************/
/* HRGBPixVal */
/****************************************************************************/
class LIntExport HRGBPixVal: public HColorPixVal {
public:
HRGBPixVal(void): red(0), green(0), blue(0) {}
HRGBPixVal(HPixVal red, HPixVal green, HPixVal blue):
red(red), green(green), blue(blue) {}
HPixVal Red(void) const { return red; }
HPixVal Green(void) const { return green; }
HPixVal Blue(void) const { return blue; }
operator int(void) const;
operator HByte(void) const;
operator Hlong(void) const;
operator double(void) const;
operator HPixVal(void) const;
int Num(void) const { return 3; }
HPixVal GetPixVal(int index) const;
const char *ClassName(void) const { return "HRGBPixVal"; }
HSemAbstractPixVal *Copy(void) const;
private:
HPixVal red, green, blue;
};
/****************************************************************************/
/* HCIELabPixVal */
/****************************************************************************/
class LIntExport HCIELabPixVal: public HColorPixVal {
public:
HCIELabPixVal(void);
HCIELabPixVal(HPixVal c, HPixVal i, HPixVal e);
HPixVal Red(void) const;
HPixVal Green(void) const;
HPixVal Blue(void) const;
HPixVal C(void) const { return c; }
HPixVal I(void) const { return i; }
HPixVal E(void) const { return e; }
operator int(void) const;
operator HByte(void) const;
operator Hlong(void) const;
operator double(void) const;
operator HPixVal(void) const;
int Num(void) const;
HPixVal GetPixVal(int index) const;
const char *ClassName(void) const { return "HCIELabPixVal"; }
HSemAbstractPixVal *Copy(void) const;
private:
HPixVal c,i,e;
};
/****************************************************************************/
/* HHSIPixVal */
/****************************************************************************/
class LIntExport HHSIPixVal: public HColorPixVal {
public:
HHSIPixVal(void);
HHSIPixVal(HPixVal h, HPixVal s, HPixVal i);
HPixVal Red(void) const;
HPixVal Green(void) const;
HPixVal Blue(void) const;
HPixVal H(void) const { return h; }
HPixVal S(void) const { return s; }
HPixVal I(void) const { return i; }
operator int(void) const;
operator Hlong(void) const;
operator HByte(void) const;
operator double(void) const;
operator HPixVal(void) const;
int Num(void) const;
HPixVal GetPixVal(int index) const;
const char *ClassName(void) const { return "HHSIPixVal"; }
HSemAbstractPixVal *Copy(void) const;
private:
HPixVal h,s,i;
};
/****************************************************************************/
/* HHSVPixVal */
/****************************************************************************/
class LIntExport HHSVPixVal: public HColorPixVal {
public:
HHSVPixVal(void);
HHSVPixVal(HPixVal h, HPixVal s, HPixVal v);
HPixVal Red(void) const;
HPixVal Green(void) const;
HPixVal Blue(void) const;
HPixVal H(void) const { return h; }
HPixVal S(void) const { return s; }
HPixVal V(void) const { return v; }
operator int(void) const;
operator Hlong(void) const;
operator HByte(void) const;
operator double(void) const;
operator HPixVal(void) const;
int Num(void) const;
HPixVal GetPixVal(int index) const;
const char *ClassName(void) const { return "HHSVPixVal"; }
HSemAbstractPixVal *Copy(void) const;
private:
HPixVal h,s,v;
};
/****************************************************************************/
/* HEdgePixVal */
/****************************************************************************/
class LIntExport HEdgePixVal: public HSemAbstractPixVal {
public:
HEdgePixVal(void): amp(0), dir(0) {}
HEdgePixVal(HPixVal amp, HPixVal dir): amp(amp), dir(dir) {}
operator int(void) const;
operator Hlong(void) const;
operator double(void) const;
operator HPixVal(void) const;
operator HAngleDeg(void) const;
operator HAngleRad(void) const;
HAngleDeg DirGrd(void) const;
HAngleRad DirRad(void) const;
HPixVal Amp(void) const;
int Num(void) const { return 2; }
HPixVal GetPixVal(int index) const { return HPixVal(0); }
const char *ClassName(void) const { return "HEdgePixVal"; }
HSemAbstractPixVal *Copy(void) const;
private:
HPixVal amp, dir;
};
/****************************************************************************/
/* HDVFPixVal */
/****************************************************************************/
class LIntExport HDVFPixVal: public HSemAbstractPixVal {
public:
HDVFPixVal(void);
HDVFPixVal(HPixVal x, HPixVal y);
HPixVal X(void) const { return x; }
HPixVal Y(void) const { return x; }
operator int(void) const;
operator HByte(void) const;
operator Hlong(void) const;
operator double(void) const;
operator HPixVal(void) const;
HAngleDeg DirGrd(void) const;
HAngleRad DirRad(void) const;
double Length(void) const;
int Num(void) const;
HPixVal GetPixVal(int index) const;
const char *ClassName(void) const { return "HDVFPixVal"; }
HSemAbstractPixVal *Copy(void) const;
private:
HPixVal x, y;
};
/****************************************************************************/
/* HSemSimplePixVal */
/****************************************************************************/
class LIntExport HSemSimplePixVal: public HSemAbstractPixVal {
public:
HSemSimplePixVal(void): val(0) {}
HSemSimplePixVal(HPixVal val): val(val) {}
HSemSimplePixVal &operator = (const HSemSimplePixVal &Val)
{ val = Val.val; return *this; }
virtual ~HSemSimplePixVal(void);
virtual operator HByte(void) const;
virtual operator int(void) const;
virtual operator Hlong(void) const;
virtual operator double(void) const;
virtual operator HPixVal(void) const;
virtual const char *ClassName(void) const;
int Num(void) const { return 1; }
HPixVal GetPixVal(int index) const
{ if (index != 1) H_EXCEPTION("HPixVal GetPixVal(int index) const","index != 1");
return val; }
HSemAbstractPixVal *Copy(void) const;
protected:
HPixVal val;
};
/****************************************************************************/
/* HCoocMatrixPixVal */
/****************************************************************************/
class LIntExport HCoocMatrixPixVal: public HSemSimplePixVal {
public:
HCoocMatrixPixVal(void): HSemSimplePixVal() {}
HCoocMatrixPixVal(HPixVal val): HSemSimplePixVal(val) {}
const char *ClassName(void) const { return "HCoocMatrixPixVal"; }
};
/****************************************************************************/
/* HDepthPixVal */
/****************************************************************************/
class LIntExport HDepthPixVal: public HSemSimplePixVal {
public:
HDepthPixVal(void): HSemSimplePixVal(0) {}
HDepthPixVal(HPixVal val): HSemSimplePixVal(val) {}
const char *ClassName(void) const { return "CoocPixVal"; }
};
/****************************************************************************/
/* HEdgeAmpPixVal */
/****************************************************************************/
class LIntExport HEdgeAmpPixVal: public HSemSimplePixVal {
public:
HEdgeAmpPixVal(void): HSemSimplePixVal(0) {}
HEdgeAmpPixVal(HPixVal val): HSemSimplePixVal(val) {}
HPixVal Amp(void) const;
const char *ClassName(void) const { return "HEdgeAmpPixVal"; }
};
/****************************************************************************/
/* HEdgeDirPixVal */
/****************************************************************************/
class LIntExport HEdgeDirPixVal: public HSemSimplePixVal {
public:
HEdgeDirPixVal(void): HSemSimplePixVal(0) {}
HEdgeDirPixVal(HPixVal val): HSemSimplePixVal(val) {}
operator HAngleDeg(void) const;
operator HAngleRad(void) const;
HAngleDeg DirGrd(void) const;
HAngleRad DirRad(void) const;
const char *ClassName(void) const { return "HEdgeDirPixVal"; }
};
/****************************************************************************/
/* HFFTPixVal */
/****************************************************************************/
class LIntExport HFFTPixVal: public HSemSimplePixVal {
public:
HFFTPixVal(void): HSemSimplePixVal(0) {}
HFFTPixVal(HPixVal val): HSemSimplePixVal(val) {}
operator HComplex(void) const{ return HComplex(val); }
const char *ClassName(void) const { return "HFFTPixVal"; }
};
/****************************************************************************/
/* HGreyPixVal */
/****************************************************************************/
class LIntExport HGreyPixVal: public HSemSimplePixVal {
public:
HGreyPixVal(void): HSemSimplePixVal(0) {}
HGreyPixVal(HPixVal val): HSemSimplePixVal(val) {}
operator HByte(void) const { return HClipByte((Hlong)val); }
operator int(void) const { return (int)val; }
const char *ClassName(void) const { return "HGreyPixVal"; }
};
/****************************************************************************/
/* HHist2DimPixVal */
/****************************************************************************/
class LIntExport HHist2DimPixVal: public HSemSimplePixVal {
public:
HHist2DimPixVal(void): HSemSimplePixVal(0) {}
HHist2DimPixVal(HPixVal val): HSemSimplePixVal(val) {}
operator Hlong(void) const { return (Hlong)val; }
const char *ClassName(void) const { return "HHist2DimPixVal"; }
};
/****************************************************************************/
/* HLabelPixVal */
/****************************************************************************/
class LIntExport HLabelPixVal: public HSemSimplePixVal {
public:
HLabelPixVal(void): HSemSimplePixVal(0) {}
HLabelPixVal(HPixVal val): HSemSimplePixVal(val) {}
operator Hlong(void) const { return (Hlong)val; }
const char *ClassName(void) const { return "HLabelPixVal"; }
};
/****************************************************************************/
/* HLaplacePixVal */
/****************************************************************************/
class LIntExport HLaplacePixVal: public HSemSimplePixVal {
public:
HLaplacePixVal(void): HSemSimplePixVal(0) {}
HLaplacePixVal(HPixVal val): HSemSimplePixVal(val) {}
operator Hlong(void) const { return (Hlong)val; }
const char *ClassName(void) const { return "HLaplacePixVal"; }
};
/****************************************************************************/
/* HStrElGreyPixVal */
/****************************************************************************/
class LIntExport HStrElGreyPixVal: public HSemSimplePixVal {
public:
HStrElGreyPixVal(void): HSemSimplePixVal(0) {}
HStrElGreyPixVal(HPixVal val): HSemSimplePixVal(val) {}
operator HByte(void) const { return (HByte)val; }
const char *ClassName(void) const { return "HStrElGreyPixVal"; }
};
/****************************************************************************/
/* HSemAbstractImage */
/****************************************************************************/
class LIntExport HSemAbstractImage: public HBaseImage {
public:
HSemAbstractImage(void);
virtual ~HSemAbstractImage(void);
// Pixelzugriff
virtual HSemPixVal GetPixVal(int x, int y) = 0;
virtual HSemPixVal GetPixVal(Hlong k) = 0;
virtual void SetPixVal(int x, int y, const HSemPixVal &val) = 0;
virtual void SetPixVal(Hlong k, const HSemPixVal &val) = 0;
virtual const char *ClassName(void) const = 0;
virtual int Width(void) const = 0;
virtual int Height(void) const = 0;
virtual void Transform(const HAffineTrans &transform, int mode) = 0;
virtual void Display(const HWindow &w) const = 0;
virtual HSemAbstractImage *CopyAbstractSImage(void) const = 0;
// Klassenoperationen
static Hlong NumInst(void) { return num_images; }
protected:
private:
static Hlong num_images;
};
/****************************************************************************/
/* HSemImage */
/****************************************************************************/
class LIntExport HSemImage: public HBaseImage {
public:
HSemImage(void);
HSemImage(const HSemImage &r);
~HSemImage(void);
HSemImage &operator = (const HSemImage &arr);
// Tools
int NumChannels(void) { return 1; }
HSemImage GetChannel(int index)
{ if (index > 0) H_EXCEPTION("HSemImage GetChannel(int index)","index > 0");
return *this; }
// Pixelzugriff
HSemPixVal GetPixVal(int x, int y);
HSemPixVal GetPixVal(Hlong k);
void SetPixVal(int x, int y, const HSemPixVal &val);
void SetPixVal(Hlong k, const HSemPixVal &val);
const char *ClassName(void) const;
int Width(void) const;
int Height(void) const;
void Transform(const HAffineTrans &transform, int mode);
void Display(const HWindow &w) const;
// Klassenoperationen
static Hlong NumInst(void) { return num_images; }
protected:
HSemAbstractImage *image;
private:
static Hlong num_images;
};
/****************************************************************************/
/* HStrElGrey */
/****************************************************************************/
class LIntExport HStrElGrey: public HSemAbstractImage {
public:
HSemAbstractImage* CopyAbstractSImage(void) const;
void Display(const HWindow &w) const {}
HSemPixVal GetPixVal(int x, int y);
HSemPixVal GetPixVal(Hlong k);
void SetPixVal(int x, int y, const HSemPixVal &val) {}
void SetPixVal(Hlong k, const HSemPixVal &val) {}
void Transform(const HAffineTrans &transform, int mode);
const char* ClassName(void) const { return "HStrElGrey"; }
int Width(void) const { return image.Width(); }
int Height(void) const { return image.Height(); }
private:
HImage image;
};
/****************************************************************************/
/* HGreyImage */
/****************************************************************************/
class LIntExport HGreyImage: public HSemAbstractImage {
public:
HSemAbstractImage* CopyAbstractSImage(void) const;
void Display(const HWindow &w) const;
HSemPixVal GetPixVal(int x, int y);
HSemPixVal GetPixVal(Hlong k);
void SetPixVal(int x, int y, const HSemPixVal &val);
void SetPixVal(Hlong k, const HSemPixVal &val);
void Transform(const HAffineTrans &transform, int mode);
const char* ClassName(void) const { return "HGreyImage"; }
int Width(void) const { return image.Width(); }
int Height(void) const { return image.Height(); }
private:
HImage image;
};
/****************************************************************************/
/* HDVFImage */
/****************************************************************************/
class LIntExport HDVFImage: public HSemAbstractImage {
public:
HSemAbstractImage* CopyAbstractSImage(void) const;
void Display(const HWindow &w) const;
HSemPixVal GetPixVal(int x, int y);
HSemPixVal GetPixVal(Hlong k);
void SetPixVal(int x, int y, const HSemPixVal &val);
void SetPixVal(Hlong k, const HSemPixVal &val);
void Transform(const HAffineTrans &transform, int mode);
const char* ClassName(void) const { return "HDVFImage"; }
int Width(void) const { return image_x.Width(); }
int Height(void) const { return image_x.Height(); }
private:
HImage image_x;
HImage image_y;
};
/****************************************************************************/
/* HEdgeDirImage */
/****************************************************************************/
class LIntExport HEdgeDirImage: public HSemAbstractImage {
public:
HSemAbstractImage* CopyAbstractSImage(void) const;
void Display(const HWindow &w) const;
HSemPixVal GetPixVal(int x, int y);
HSemPixVal GetPixVal(Hlong k);
void SetPixVal(int x, int y, const HSemPixVal &val);
void SetPixVal(Hlong k, const HSemPixVal &val);
void Transform(const HAffineTrans &transform, int mode);
const char* ClassName(void) const { return "HEdgeDirImage"; }
int Width(void) const { return image_dir.Width(); }
int Height(void) const { return image_dir.Height(); }
protected:
HImage image_dir;
};
/****************************************************************************/
/* HEdgeAmpImage */
/****************************************************************************/
class LIntExport HEdgeAmpImage: public HSemAbstractImage {
public:
HSemAbstractImage* CopyAbstractSImage(void) const;
void Display(const HWindow &w) const;
HSemPixVal GetPixVal(int x, int y);
HSemPixVal GetPixVal(Hlong k);
void SetPixVal(int x, int y, const HSemPixVal &val);
void SetPixVal(Hlong k, const HSemPixVal &val);
void Transform(const HAffineTrans &transform, int mode);
const char* ClassName(void) const { return "HEdgeAmpImage"; }
int Width(void) const { return image_amp.Width(); }
int Height(void) const { return image_amp.Height(); }
protected:
HImage image_amp;
};
/****************************************************************************/
/* HEdgeImage */
/****************************************************************************/
class LIntExport HEdgeImage: public HEdgeAmpImage, public HEdgeDirImage {
};
/****************************************************************************/
/* HLaplaceImage */
/****************************************************************************/
class LIntExport HLaplaceImage: public HSemAbstractImage {
public:
HSemAbstractImage* CopyAbstractSImage(void) const;
void Display(const HWindow &w) const;
HSemPixVal GetPixVal(int x, int y);
HSemPixVal GetPixVal(Hlong k);
void SetPixVal(int x, int y, const HSemPixVal &val) {}
void SetPixVal(Hlong k, const HSemPixVal &val) {}
void Transform(const HAffineTrans &transform, int mode);
const char* ClassName(void) const { return "HLaplaceImage"; }
int Width(void) const { return image.Width(); }
int Height(void) const { return image.Height(); }
private:
HImage image;
};
/****************************************************************************/
/* HHisto2Dim */
/****************************************************************************/
class LIntExport HHisto2Dim: public HSemAbstractImage {
public:
HSemAbstractImage* CopyAbstractSImage(void) const;
void Display(const HWindow &w) const;
HSemPixVal GetPixVal(int x, int y);
HSemPixVal GetPixVal(Hlong k);
void SetPixVal(int x, int y, const HSemPixVal &val) {}
void SetPixVal(Hlong k, const HSemPixVal &val) {}
void Transform(const HAffineTrans &transform, int mode);
const char* ClassName(void) const { return "HHisto2Dim"; }
int Width(void) const { return image.Width(); }
int Height(void) const { return image.Height(); }
private:
HImage image;
};
/****************************************************************************/
/* HFourierImage */
/****************************************************************************/
class LIntExport HFourierImage: public HSemAbstractImage {
public:
HSemAbstractImage* CopyAbstractSImage(void) const;
void Display(const HWindow &w) const {}
HSemPixVal GetPixVal(int x, int y);
HSemPixVal GetPixVal(Hlong k);
void SetPixVal(int x, int y, const HSemPixVal &val);
void SetPixVal(Hlong k, const HSemPixVal &val);
void Transform(const HAffineTrans &transform, int mode);
const char* ClassName(void) const { return "HFourierImage"; }
int Width(void) const { return image.Width(); }
int Height(void) const { return image.Height(); }
private:
HImage image;
};
/****************************************************************************/
/* HDepthImage */
/****************************************************************************/
class LIntExport HDepthImage: public HSemAbstractImage {
public:
HSemAbstractImage* CopyAbstractSImage(void) const;
void Display(const HWindow &w) const;
HSemPixVal GetPixVal(int x, int y) { return HSemPixVal(0); }
HSemPixVal GetPixVal(Hlong k) { return HSemPixVal(0); }
void SetPixVal(int x, int y, const HSemPixVal &val);
void SetPixVal(Hlong k, const HSemPixVal &val);
void Transform(const HAffineTrans &transform, int mode);
const char* ClassName(void) const { return "HDepthImage"; }
int Width(void) const { return image.Width(); }
int Height(void) const { return image.Height(); }
private:
HImage image;
};
/****************************************************************************/
/* HColourImage */
/****************************************************************************/
class LIntExport HColourImage: public HSemAbstractImage {
public:
virtual HSemAbstractImage* CopyAbstractSImage(void) const = 0;
virtual void Display(const HWindow &w) const = 0;
virtual HSemPixVal GetPixVal(int x, int y) = 0;
virtual HSemPixVal GetPixVal(Hlong k) = 0;
virtual void SetPixVal(int x, int y, const HSemPixVal &val) = 0;
virtual void SetPixVal(Hlong k, const HSemPixVal &val) = 0;
virtual void Transform(const HAffineTrans &transform, int mode) = 0;
virtual const char* ClassName(void) const = 0;
virtual int Width(void) const = 0;
virtual int Height(void) const = 0;
};
/****************************************************************************/
/* HRGBImage */
/****************************************************************************/
class LIntExport HRGBImage: public HColourImage {
public:
HRGBImage(const HByteImage &image);
HRGBImage(const HRGBImage &image);
HRGBImage(const HByteImage &image, const HRGBLUT &lut);
HRGBImage(const HByteImage &red, const HByteImage &green, const HByteImage &blue);
HSemAbstractImage* CopyAbstractSImage(void) const;
void Display(const HWindow &w) const;
HSemPixVal GetPixVal(int x, int y);
HSemPixVal GetPixVal(Hlong k);
void SetPixVal(int x, int y, const HSemPixVal &val);
void SetPixVal(Hlong k, const HSemPixVal &val);
void Transform(const HAffineTrans &transform, int mode);
const char* ClassName(void) const { return "HRGBImage"; }
HByteImage Red(void) const;
HByteImage Green(void) const;
HByteImage Blue(void) const;
int Width(void) const { return red.Width(); }
int Height(void) const { return red.Height(); }
private:
HByteImage red;
HByteImage green;
HByteImage blue;
};
/****************************************************************************/
/* HHSIImage */
/****************************************************************************/
class LIntExport HHSIImage: public HColourImage {
};
/****************************************************************************/
/* HHSVImage */
/****************************************************************************/
class LIntExport HHSVImage: public HColourImage {
};
/****************************************************************************/
/* HCIELabImage */
/****************************************************************************/
class LIntExport HCIELabImage: public HColourImage {
};
enum HCoocDirections { Dir0 = 0, Dir45 = 45, Dir90 = 90, Dir135 = 135 };
/****************************************************************************/
/* HCoocMatrix */
/****************************************************************************/
class LIntExport HCoocMatrix: public HSemAbstractImage {
public:
HCoocMatrix(void);
HCoocMatrix(const HRegion ®, const HByteImage &grey,
int num_bits = 8, int Direction = Dir0);
HCoocMatrix(const HByteImage &grey,
int num_bits = 8, int Direction = Dir0);
HCoocMatrix(const char *file);
HCoocMatrix(const HCoocMatrix &cooc);
~HCoocMatrix(void);
HCoocMatrix &operator = (const HCoocMatrix &cooc);
// spezielle Operationen
int Direction(void) const { return direction; }
int NumBits(void) const { return bits; }
Hlong NumPoints(void) const { return num_points; }
void Write(const char *file) const;
Hlong operator () (int x, int y) const { return (Hlong)image.GetPixVal(x,y); }
// Merkmale
// virtuelle Operationen
HSemAbstractImage *CopyAbstractSImage(void) const;
void Display(const HWindow &w) const;
HSemPixVal GetPixVal(int x, int y);
HSemPixVal GetPixVal(Hlong k);
void SetPixVal(int x, int y, const HSemPixVal &val);
void SetPixVal(Hlong k, const HSemPixVal &val);
void Transform(const HAffineTrans &transform, int mode);
const char *ClassName(void) const { return "HCoocMatrix"; }
int Width(void) const { return image.Width(); }
int Height(void) const { return image.Height(); }
private:
HImage image; // Nachbarschafts Matrix
int bits; // Anzahl signifikante Bits
int direction; // Richtung der Nachbarschaft
Hlong num_points; // Anzahl Punkte die untersucht wurden
};
/****************************************************************************/
/* HLabelImage */
/****************************************************************************/
class LIntExport HLabelImage: public HSemAbstractImage {
public:
HLabelImage(void);
HLabelImage(const HRegion ®);
HLabelImage(const HRegionArray ®s);
HLabelImage(const HLabelImage &Image);
~HLabelImage(void);
HLabelImage &operator = (const HLabelImage &Image);
HSemAbstractImage *CopyAbstractSImage(void) const;
void Display(const HWindow &w) const;
Hlong operator () (int x, int y) { return (Hlong)image.GetPixVal(x,y); }
Hlong operator [] (Hlong k) { return (Hlong)image.GetPixVal(k); }
HSemPixVal GetPixVal(int x, int y);
HSemPixVal GetPixVal(Hlong k);
void SetPixVal(int x, int y, const HSemPixVal &val);
void SetPixVal(Hlong k, const HSemPixVal &val);
void Transform(const HAffineTrans &transform, int mode);
const char *ClassName(void) const { return "HLabelImage"; }
int Width(void) const { return image.Width(); }
int Height(void) const { return image.Height(); }
private:
HImage image;
};
}
#endif
| [
"cflchenfulin@163.com"
] | cflchenfulin@163.com |
08560d1453bb9b9d328232eb24d01f205e465622 | 03277a6fc47da4c3ea98bb21cfe7efd6cd7ed343 | /arm_compute/streamingClassifier_data.cpp | 40ce00675e0f63b28cb37cd829f6f51bfcec49ef | [
"BSD-2-Clause"
] | permissive | matlab-deep-learning/Fault-Detection-Using-Deep-Learning-Classification | 869382d3960c372d192db5f627a2b3b5418a3cba | 539670f3868fbf66c51762fff8dc3843f7880242 | refs/heads/master | 2022-09-09T17:25:23.360209 | 2022-09-06T19:43:24 | 2022-09-06T19:43:24 | 248,592,738 | 64 | 25 | NOASSERTION | 2020-05-21T21:03:49 | 2020-03-19T19:56:02 | C++ | UTF-8 | C++ | false | false | 388 | cpp | //
// File: streamingClassifier_data.cpp
//
// MATLAB Coder version : 5.2
// C/C++ source code generated on : 19-Mar-2021 15:00:36
//
// Include Files
#include "streamingClassifier_data.h"
#include "rt_nonfinite.h"
// Variable Definitions
c_struct_T config;
bool isInitialized_streamingClassifier{false};
//
// File trailer for streamingClassifier_data.cpp
//
// [EOF]
//
| [
"dwilling@mathworks.com"
] | dwilling@mathworks.com |
03062fee331d71514edacd4406134ace65c53898 | da9eda23163d01209bf6b158dd504cb22cced271 | /src/search.h | 5e4ced4a11bdf4523838112861d72e30fb2921b4 | [
"BSD-2-Clause"
] | permissive | meisterT/katarakt | 5051941e69558463e18212b6f82c1ff5d3df7eb7 | a4e4b4840e49845fd6df82ce047f7be9b9ac199a | refs/heads/master | 2021-01-10T07:33:06.578392 | 2015-11-13T14:11:54 | 2015-11-13T14:11:54 | 46,125,435 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,646 | h | #ifndef SEARCH_H
#define SEARCH_H
#include <poppler/qt4/poppler-qt4.h>
#include <QString>
#include <QThread>
#include <QMutex>
#include <QWidget>
#include <QLineEdit>
#include <QLabel>
#include <QHBoxLayout>
#include <QRect>
#include <QEvent>
#include <QList>
class SearchBar;
class Canvas;
class Viewer;
class SearchWorker : public QThread {
Q_OBJECT
public:
SearchWorker(SearchBar *_bar);
void run();
volatile bool stop;
volatile bool die;
signals:
void update_label_text(const QString &text);
void search_done(int page, QList<QRectF> *hits);
void clear_hits();
private:
SearchBar *bar;
bool forward;
};
class SearchBar : public QWidget {
Q_OBJECT
public:
SearchBar(const QString &file, Viewer *v, QWidget *parent = 0);
~SearchBar();
void load(const QString &file, const QByteArray &password);
bool is_valid() const;
void focus(bool forward = true);
const std::map<int,QList<QRectF> *> *get_hits() const;
bool is_search_forward() const;
signals:
void search_updated(int page);
protected:
// QT event handling
bool event(QEvent *event);
public slots:
void reset_search();
private slots:
void insert_hits(int page, QList<QRectF> *hits);
void clear_hits();
void set_text();
private:
void initialize(const QString &file, const QByteArray &password);
void join_threads();
void shutdown();
QLineEdit *line;
QLabel *progress;
QHBoxLayout *layout;
Poppler::Document *doc;
Viewer *viewer;
std::map<int,QList<QRectF> *> hits;
QMutex search_mutex;
QMutex term_mutex;
SearchWorker *worker;
QString term;
int start_page;
bool forward_tmp;
bool forward;
friend class SearchWorker;
};
#endif
| [
"Philipp.Erhardt@informatik.stud.uni-erlangen.de"
] | Philipp.Erhardt@informatik.stud.uni-erlangen.de |
f5d4be1992165142ba8af9ab2010acd7bd9ca679 | 986964448a8813d5b9116b4f984543db043b6224 | /src/core/lib/song.cpp | 0483936e22e3ba851bd831834a73692d8c4d17aa | [] | no_license | Lenium37/SigLight | 3c34c25a3ab673012685b3d535467049bed90bcf | cdc639f7667a3ee082446925fd7c4b9c9e7315df | refs/heads/master | 2021-07-12T04:16:35.385565 | 2020-10-15T12:01:50 | 2020-10-15T12:01:50 | 213,935,458 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,574 | cpp | //
// Created by Jan on 20.06.2019.
//
#include "song.h"
#include "logger.h"
#include <ghc/filesystem.hpp>
Song::Song(const std::string &file_path) : file_path(file_path) {}
const std::string Song::get_file_path() const {
return file_path;
}
void Song::set_file_path(std::string _file_path)
{
this->file_path = _file_path;
}
bool Song::operator==(const Song &rhs) const {
return file_path == rhs.file_path;
}
bool Song::operator!=(const Song &rhs) const {
return !(rhs == *this);
}
Song::Song(const std::string &file_path, const int duration_in_sec)
: file_path(file_path), duration_in_sec(duration_in_sec) {
Logger::debug("new Song with fila path: {}", file_path);
int minutes = duration_in_sec / 60;
int secs = duration_in_sec % 60;
this->formatted_duration = std::to_string(minutes) + ":" + std::to_string(secs);
}
const std::string Song::get_song_name() {
return ghc::filesystem::path(file_path).filename().string();
}
std::ostream &operator<<(std::ostream &os, const Song &song) {
os << "file_path: " << song.file_path;
return os;
}
Song::Song() {
file_path = "";
}
bool Song::is_empty() {
return file_path.empty();
}
const int Song::get_duration() {
return this->duration_in_sec;
}
std::string Song::get_formatted_duration() {
return this->formatted_duration;
}
void Song::set_title(std::string title) {
this->title = title;
}
std::string Song::get_title() {
return this->title;
}
void Song::set_artist(std::string artist) {
this->artist = artist;
}
std::string Song::get_artist() {
return this->artist;
}
| [
"hirth.johannes@gmx.de"
] | hirth.johannes@gmx.de |
12adda6e3a8ca03d62057e14593b3a56e7d45b4d | e3b5d138ae885b847b1df8cbbe7e3e872a13152b | /main/Ir_driver/ir_protocol_cpp/IRutils.cpp | 1ff9e2f821753e803709dee569e1cecbaa4f7ba9 | [
"MIT"
] | permissive | ductuanhoang/Smart_Ir_Blaster | 89287275c7d719ef2a587059f4ba4b52f8e79b06 | 404f8545ce0f28a5c6cac87e1767264a2a019ddf | refs/heads/main | 2023-04-28T13:07:22.163308 | 2021-05-01T00:27:12 | 2021-05-01T00:27:12 | 363,290,287 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 16,234 | cpp | // Copyright 2017 David Conran
#include "IRutils.h"
#include <stdint.h>
#include <string.h>
#include <algorithm>
#include "IrSend.h"
/// Reverse the order of the requested least significant nr. of bits.
/// @param[in] input Bit pattern/integer to reverse.
/// @param[in] nbits Nr. of bits to reverse. (LSB -> MSB)
/// @return The reversed bit pattern.
uint64_t reverseBits(uint64_t input, uint16_t nbits)
{
if (nbits <= 1)
return input; // Reversing <= 1 bits makes no change at all.
// Cap the nr. of bits to rotate to the max nr. of bits in the input.
nbits = min(nbits, (uint16_t)(sizeof(input) * 8));
uint64_t output = 0;
for (uint16_t i = 0; i < nbits; i++)
{
output <<= 1;
output |= (input & 1);
input >>= 1;
}
// Merge any remaining unreversed bits back to the top of the reversed bits.
return (input << nbits) | output;
}
/// Sum all the bytes of an array and return the least significant 8-bits of
/// the result.
/// @param[in] start A ptr to the start of the byte array to calculate over.
/// @param[in] length How many bytes to use in the calculation.
/// @param[in] init Starting value of the calculation to use. (Default is 0)
/// @return The 8-bit calculated result of all the bytes and init value.
uint8_t sumBytes(const uint8_t *const start, const uint16_t length,
const uint8_t init)
{
uint8_t checksum = init;
const uint8_t *ptr;
for (ptr = start; ptr - start < length; ptr++)
checksum += *ptr;
return checksum;
}
/// Calculate a rolling XOR of all the bytes of an array.
/// @param[in] start A ptr to the start of the byte array to calculate over.
/// @param[in] length How many bytes to use in the calculation.
/// @param[in] init Starting value of the calculation to use. (Default is 0)
/// @return The 8-bit calculated result of all the bytes and init value.
uint8_t xorBytes(const uint8_t *const start, const uint16_t length,
const uint8_t init)
{
uint8_t checksum = init;
const uint8_t *ptr;
for (ptr = start; ptr - start < length; ptr++)
checksum ^= *ptr;
return checksum;
}
/// Count the number of bits of a certain type in an array.
/// @param[in] start A ptr to the start of the byte array to calculate over.
/// @param[in] length How many bytes to use in the calculation.
/// @param[in] ones Count the binary nr of `1` bits. False is count the `0`s.
/// @param[in] init Starting value of the calculation to use. (Default is 0)
/// @return The nr. of bits found of the given type found in the array.
uint16_t countBits(const uint8_t *const start, const uint16_t length,
const bool ones, const uint16_t init)
{
uint16_t count = init;
for (uint16_t offset = 0; offset < length; offset++)
for (uint8_t currentbyte = *(start + offset);
currentbyte;
currentbyte >>= 1)
if (currentbyte & 1)
count++;
if (ones || length == 0)
return count;
else
return (length * 8) - count;
}
/// Count the number of bits of a certain type in an Integer.
/// @param[in] data The value you want bits counted for. Starting from the LSB.
/// @param[in] length How many bits to use in the calculation? Starts at the LSB
/// @param[in] ones Count the binary nr of `1` bits. False is count the `0`s.
/// @param[in] init Starting value of the calculation to use. (Default is 0)
/// @return The nr. of bits found of the given type found in the Integer.
uint16_t countBits(const uint64_t data, const uint8_t length, const bool ones,
const uint16_t init)
{
uint16_t count = init;
uint8_t bitsSoFar = length;
for (uint64_t remainder = data; remainder && bitsSoFar;
remainder >>= 1, bitsSoFar--)
if (remainder & 1)
count++;
if (ones || length == 0)
return count;
else
return length - count;
}
/// Invert/Flip the bits in an Integer.
/// @param[in] data The Integer that will be inverted.
/// @param[in] nbits How many bits are to be inverted. Starting from the LSB.
/// @return An Integer with the appropriate bits inverted/flipped.
uint64_t invertBits(const uint64_t data, const uint16_t nbits)
{
// No change if we are asked to invert no bits.
if (nbits == 0)
return data;
uint64_t result = ~data;
// If we are asked to invert all the bits or more than we have, it's simple.
if (nbits >= sizeof(data) * 8)
return result;
// Mask off any unwanted bits and return the result.
return (result & ((1ULL << nbits) - 1));
}
/// Convert degrees Celsius to degrees Fahrenheit.
float celsiusToFahrenheit(const float deg) { return (deg * 9.0) / 5.0 + 32.0; }
/// Convert degrees Fahrenheit to degrees Celsius.
float fahrenheitToCelsius(const float deg) { return (deg - 32.0) * 5.0 / 9.0; }
namespace irutils
{
/// Sum all the nibbles together in a series of bytes.
/// @param[in] start A ptr to the start of the byte array to calculate over.
/// @param[in] length How many bytes to use in the calculation.
/// @param[in] init Starting value of the calculation to use. (Default is 0)
/// @return The 8-bit calculated result of all the bytes and init value.
uint8_t sumNibbles(const uint8_t *const start, const uint16_t length,
const uint8_t init)
{
uint8_t sum = init;
const uint8_t *ptr;
for (ptr = start; ptr - start < length; ptr++)
sum += (*ptr >> 4) + (*ptr & 0xF);
return sum;
}
/// Sum all the nibbles together in an integer.
/// @param[in] data The integer to be summed.
/// @param[in] count The number of nibbles to sum. Starts from LSB. Max of 16.
/// @param[in] init Starting value of the calculation to use. (Default is 0)
/// @param[in] nibbleonly true, the result is 4 bits. false, it's 8 bits.
/// @return The 4/8-bit calculated result of all the nibbles and init value.
uint8_t sumNibbles(const uint64_t data, const uint8_t count,
const uint8_t init, const bool nibbleonly)
{
uint8_t sum = init;
uint64_t copy = data;
const uint8_t nrofnibbles = (count < 16) ? count : (64 / 4);
for (uint8_t i = 0; i < nrofnibbles; i++, copy >>= 4)
sum += copy & 0xF;
return nibbleonly ? sum & 0xF : sum;
}
/// Convert a byte of Binary Coded Decimal(BCD) into an Integer.
/// @param[in] bcd The BCD value.
/// @return A normal Integer value.
uint8_t bcdToUint8(const uint8_t bcd)
{
if (bcd > 0x99)
return 255; // Too big.
return (bcd >> 4) * 10 + (bcd & 0xF);
}
/// Convert an Integer into a byte of Binary Coded Decimal(BCD).
/// @param[in] integer The number to convert.
/// @return An 8-bit BCD value.
uint8_t uint8ToBcd(const uint8_t integer)
{
if (integer > 99)
return 255; // Too big.
return ((integer / 10) << 4) + (integer % 10);
}
/// Return the value of `position`th bit of an Integer.
/// @param[in] data Value to be examined.
/// @param[in] position Nr. of the Nth bit to be examined. `0` is the LSB.
/// @param[in] size Nr. of bits in data.
/// @return The bit's value.
bool getBit(const uint64_t data, const uint8_t position, const uint8_t size)
{
if (position >= size)
return false; // Outside of range.
return data & (1ULL << position);
}
/// Return the value of `position`th bit of an Integer.
/// @param[in] data Value to be examined.
/// @param[in] position Nr. of the Nth bit to be examined. `0` is the LSB.
/// @return The bit's value.
bool getBit(const uint8_t data, const uint8_t position)
{
if (position >= 8)
return false; // Outside of range.
return data & (1 << position);
}
/// Return the value of an Integer with the `position`th bit changed.
/// @param[in] data Value to be changed.
/// @param[in] position Nr. of the bit to be changed. `0` is the LSB.
/// @param[in] on Value to set the position'th bit to.
/// @param[in] size Nr. of bits in data.
/// @return A suitably modified integer.
uint64_t setBit(const uint64_t data, const uint8_t position, const bool on,
const uint8_t size)
{
if (position >= size)
return data; // Outside of range.
uint64_t mask = 1ULL << position;
if (on)
return data | mask;
else
return data & ~mask;
}
/// Return the value of an Integer with the `position`th bit changed.
/// @param[in] data Value to be changed.
/// @param[in] position Nr. of the bit to be changed. `0` is the LSB.
/// @param[in] on Value to set the position'th bit to.
/// @return A suitably modified integer.
uint8_t setBit(const uint8_t data, const uint8_t position, const bool on)
{
if (position >= 8)
return data; // Outside of range.
uint8_t mask = 1 << position;
if (on)
return data | mask;
else
return data & ~mask;
}
/// Alter the value of an Integer with the `position`th bit changed.
/// @param[in,out] data A pointer to the 8-bit integer to be changed.
/// @param[in] position Nr. of the bit to be changed. `0` is the LSB.
/// @param[in] on Value to set the position'th bit to.
void setBit(uint8_t *const data, const uint8_t position, const bool on)
{
uint8_t mask = 1 << position;
if (on)
*data |= mask;
else
*data &= ~mask;
}
/// Alter the value of an Integer with the `position`th bit changed.
/// @param[in,out] data A pointer to the 32-bit integer to be changed.
/// @param[in] position Nr. of the bit to be changed. `0` is the LSB.
/// @param[in] on Value to set the position'th bit to.
void setBit(uint32_t *const data, const uint8_t position, const bool on)
{
uint32_t mask = (uint32_t)1 << position;
if (on)
*data |= mask;
else
*data &= ~mask;
}
/// Alter the value of an Integer with the `position`th bit changed.
/// @param[in,out] data A pointer to the 64-bit integer to be changed.
/// @param[in] position Nr. of the bit to be changed. `0` is the LSB.
/// @param[in] on Value to set the position'th bit to.
void setBit(uint64_t *const data, const uint8_t position, const bool on)
{
uint64_t mask = (uint64_t)1 << position;
if (on)
*data |= mask;
else
*data &= ~mask;
}
/// Alter an uint8_t value by overwriting an arbitrary given number of bits.
/// @param[in,out] dst A pointer to the value to be changed.
/// @param[in] offset Nr. of bits from the Least Significant Bit to be ignored
/// @param[in] nbits Nr of bits of data to be placed into the destination.
/// @param[in] data The value to be placed.
void setBits(uint8_t *const dst, const uint8_t offset, const uint8_t nbits,
const uint8_t data)
{
if (offset >= 8 || !nbits)
return; // Short circuit as it won't change.
// Calculate the mask for the supplied value.
uint8_t mask = UINT8_MAX >> (8 - ((nbits > 8) ? 8 : nbits));
// Calculate the mask & clear the space for the data.
// Clear the destination bits.
*dst &= ~(uint8_t)(mask << offset);
// Merge in the data.
*dst |= ((data & mask) << offset);
}
/// Alter an uint32_t value by overwriting an arbitrary given number of bits.
/// @param[in,out] dst A pointer to the value to be changed.
/// @param[in] offset Nr. of bits from the Least Significant Bit to be ignored
/// @param[in] nbits Nr of bits of data to be placed into the destination.
/// @param[in] data The value to be placed.
void setBits(uint32_t *const dst, const uint8_t offset, const uint8_t nbits,
const uint32_t data)
{
if (offset >= 32 || !nbits)
return; // Short circuit as it won't change.
// Calculate the mask for the supplied value.
uint32_t mask = UINT32_MAX >> (32 - ((nbits > 32) ? 32 : nbits));
// Calculate the mask & clear the space for the data.
// Clear the destination bits.
*dst &= ~(mask << offset);
// Merge in the data.
*dst |= ((data & mask) << offset);
}
/// Alter an uint64_t value by overwriting an arbitrary given number of bits.
/// @param[in,out] dst A pointer to the value to be changed.
/// @param[in] offset Nr. of bits from the Least Significant Bit to be ignored
/// @param[in] nbits Nr of bits of data to be placed into the destination.
/// @param[in] data The value to be placed.
void setBits(uint64_t *const dst, const uint8_t offset, const uint8_t nbits,
const uint64_t data)
{
if (offset >= 64 || !nbits)
return; // Short circuit as it won't change.
// Calculate the mask for the supplied value.
uint64_t mask = UINT64_MAX >> (64 - ((nbits > 64) ? 64 : nbits));
// Calculate the mask & clear the space for the data.
// Clear the destination bits.
*dst &= ~(mask << offset);
// Merge in the data.
*dst |= ((data & mask) << offset);
}
/// Create byte pairs where the second byte of the pair is a bit
/// inverted/flipped copy of the first/previous byte of the pair.
/// @param[in,out] ptr A pointer to the start of array to modify.
/// @param[in] length The byte size of the array.
/// @note A length of `<= 1` will do nothing.
/// @return A ptr to the modified array.
uint8_t *invertBytePairs(uint8_t *ptr, const uint16_t length)
{
for (uint16_t i = 1; i < length; i += 2)
{
// Code done this way to avoid a compiler warning bug.
uint8_t inv = ~*(ptr + i - 1);
*(ptr + i) = inv;
}
return ptr;
}
/// Check an array to see if every second byte of a pair is a bit
/// inverted/flipped copy of the first/previous byte of the pair.
/// @param[in] ptr A pointer to the start of array to check.
/// @param[in] length The byte size of the array.
/// @note A length of `<= 1` will always return true.
/// @return true, if every second byte is inverted. Otherwise false.
bool checkInvertedBytePairs(const uint8_t *const ptr,
const uint16_t length)
{
for (uint16_t i = 1; i < length; i += 2)
{
// Code done this way to avoid a compiler warning bug.
uint8_t inv = ~*(ptr + i - 1);
if (*(ptr + i) != inv)
return false;
}
return true;
}
/// Perform a low level bit manipulation sanity check for the given cpu
/// architecture and the compiler operation. Calls to this should return
/// 0 if everything is as expected, anything else means the library won't work
/// as expected.
/// @return A bit mask value of potential issues.
/// 0: (e.g. 0b00000000) Everything appears okay.
/// 0th bit set: (0b1) Unexpected bit field/packing encountered.
/// Try a different compiler.
/// 1st bit set: (0b10) Unexpected Endianness. Try a different compiler flag
/// or use a CPU different architecture.
/// e.g. A result of 3 (0b11) would mean both a bit field and an Endianness
/// issue has been found.
uint8_t lowLevelSanityCheck(void)
{
const uint64_t kExpectedBitFieldResult = 0x8000012340000039ULL;
volatile uint32_t EndianTest = 0x12345678;
const uint8_t kBitFieldError = 0b01;
const uint8_t kEndiannessError = 0b10;
uint8_t result = 0;
union bitpackdata
{
struct
{
uint64_t lowestbit : 1; // 0th bit
uint64_t next7bits : 7; // 1-7th bits
uint64_t _unused_1 : 20; // 8-27th bits
// Cross the 32 bit boundary.
uint64_t crossbits : 16; // 28-43rd bits
uint64_t _usused_2 : 18; // 44-61st bits
uint64_t highest2bits : 2; // 62-63rd bits
};
uint64_t all;
};
bitpackdata data;
data.lowestbit = true;
data.next7bits = 0b0011100; // 0x1C
data._unused_1 = 0;
data.crossbits = 0x1234;
data._usused_2 = 0;
data.highest2bits = 0b10; // 2
if (data.all != kExpectedBitFieldResult)
result |= kBitFieldError;
// Check that we are using Little Endian for integers
#if defined(BYTE_ORDER) && defined(LITTLE_ENDIAN)
if (BYTE_ORDER != LITTLE_ENDIAN)
result |= kEndiannessError;
#endif
#if defined(__IEEE_BIG_ENDIAN) || defined(__IEEE_BYTES_BIG_ENDIAN)
result |= kEndiannessError;
#endif
// Brute force check for little endian.
if (*((uint8_t *)(&EndianTest)) != 0x78) // NOLINT(readability/casting)
result |= kEndiannessError;
return result;
}
} // namespace irutils
| [
"ductuanhoang820@gmail.com"
] | ductuanhoang820@gmail.com |
f0b585ffc22168ed669940ee4189f587e0cd685b | 85d71de186845d23cba8bcd22a816adfbc1d3c2a | /src/multipolygon_handler_wrap.cpp | e715bfea3b243432ec950e0b4dc2005ecdf8406f | [
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | mpmckenna8/node-osmium | 07e851c8bbf27e4e83fbffdb9bbf00b2eaa30042 | e0e235e8406b9cbbdca27c0240fc97a7c3fb8e91 | refs/heads/master | 2020-12-26T21:39:25.629792 | 2015-05-06T09:16:06 | 2015-05-06T09:16:06 | 37,078,625 | 1 | 0 | null | 2015-06-08T16:25:34 | 2015-06-08T16:25:34 | null | UTF-8 | C++ | false | false | 1,233 | cpp |
// node
#include <node_buffer.h>
// node-osmium
#include "node_osmium.hpp"
#include "multipolygon_handler_wrap.hpp"
#include "utils.hpp"
namespace node_osmium {
v8::Persistent<v8::FunctionTemplate> MultipolygonHandlerWrap::constructor;
void MultipolygonHandlerWrap::Initialize(v8::Handle<v8::Object> target) {
v8::HandleScope scope;
constructor = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(MultipolygonHandlerWrap::New));
constructor->InstanceTemplate()->SetInternalFieldCount(1);
constructor->SetClassName(symbol_MultipolygonHandler);
target->Set(symbol_MultipolygonHandler, constructor->GetFunction());
}
v8::Handle<v8::Value> MultipolygonHandlerWrap::New(const v8::Arguments& args) {
if (args.Length() == 1 && args[0]->IsExternal()) {
v8::Local<v8::External> ext = v8::Local<v8::External>::Cast(args[0]);
static_cast<MultipolygonHandlerWrap*>(ext->Value())->Wrap(args.This());
return args.This();
} else {
return ThrowException(v8::Exception::TypeError(v8::String::New("osmium.MultipolygonHandler cannot be created in Javascript")));
}
}
} // namespace node_osmium
| [
"jochen@topf.org"
] | jochen@topf.org |
abf00e5eb3ec524e833326a1a1b64cd367d02e5e | b2fd3ad09b5986a45f4752ac9d2dd38e515b84e4 | /MoravaEngine/src/Scene/SceneDeferredOGL.cpp | a28f04e12d27eef4e016599c1dcee0769efdc24b | [
"Apache-2.0"
] | permissive | HoogDooo/MoravaEngine | 3778e33e55246e24dcfdd95903e51bc0ddbbb8ba | bddbcd572b600c9be6eaf3a059b81bd770b821ed | refs/heads/master | 2023-05-06T00:41:39.075091 | 2021-05-25T02:34:04 | 2021-05-25T02:34:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,873 | cpp | #include "Scene/SceneDeferredOGL.h"
SceneDeferredOGL::SceneDeferredOGL()
{
sceneSettings.cameraPosition = glm::vec3(0.0f, 0.0f, 2.0f);
sceneSettings.cameraStartYaw = -90.0f;
sceneSettings.cameraStartPitch = 0.0f;
sceneSettings.cameraMoveSpeed = 1.0f;
// directional light
sceneSettings.directionalLight.base.enabled = true;
sceneSettings.directionalLight.base.ambientIntensity = 0.6f;
sceneSettings.directionalLight.base.diffuseIntensity = 0.4f;
ResourceManager::Init();
SetCamera();
SetLightManager();
m_RenderTarget = (int)RenderTarget::Forward;
}
SceneDeferredOGL::~SceneDeferredOGL()
{
}
void SceneDeferredOGL::Update(float timestep, Window* mainWindow)
{
Scene::Update(timestep, mainWindow);
}
void SceneDeferredOGL::UpdateImGui(float timestep, Window* mainWindow)
{
bool p_open = true;
ShowExampleAppDockSpace(&p_open, mainWindow);
ImGui::Begin("Render Targets");
{
ImGui::Text("Forward Rendering");
ImGui::RadioButton("Forward Rendering", &m_RenderTarget, (int)RenderTarget::Forward);
ImGui::Separator();
ImGui::Text("Deferred Rendering");
ImGui::RadioButton("Deferred - Position", &m_RenderTarget, (int)RenderTarget::Deferred_Position);
ImGui::RadioButton("Deferred - Diffuse", &m_RenderTarget, (int)RenderTarget::Deferred_Diffuse);
ImGui::RadioButton("Deferred - Normal", &m_RenderTarget, (int)RenderTarget::Deferred_Normal);
ImGui::RadioButton("Deferred - TexCoord", &m_RenderTarget, (int)RenderTarget::Deferred_TexCoord);
ImGui::RadioButton("Deferred - SSAO", &m_RenderTarget, (int)RenderTarget::Deferred_SSAO);
}
ImGui::End();
}
void SceneDeferredOGL::Render(Window* mainWindow, glm::mat4 projectionMatrix, std::string passType,
std::map<std::string, Shader*> shaders, std::map<std::string, int> uniforms)
{
}
| [
"dtrajko@gmail.com"
] | dtrajko@gmail.com |
b4c0d92db095897ed74671cd07b491da543cffde | a5388f88eb3d0f26794e709e6a5c07c1a2ce1f79 | /choose_me_D.cpp | 08159ab0e5f5eeca6fc95f166740702e831a7ef6 | [] | no_license | CP-lands/Atcoder | cb8013ee93d47f93d866822ef4fe4911baf5e3b6 | e37b2030687f5ca873287ff550ca1681c78ad79d | refs/heads/main | 2023-06-29T01:56:02.007745 | 2021-01-17T17:57:18 | 2021-01-17T17:57:18 | 394,058,583 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 813 | cpp | //--------my brain isn't at home right now------------------
#include<bits/stdc++.h>
//https://atcoder.jp/contests/abc187/tasks/abc187_d
using namespace std;
#define pb push_back
#define fi first
#define se second
#define nl '\n'
typedef long long ll;
void Solve(){
int n;
cin>>n;
vector<tuple<ll, int, int>> v;
ll a = 0, b = 0;
for(int i = 0; i < n; i++){
ll x, y;
cin>>x>>y;
v.emplace_back(2 * x + y, x, y);
b += x;
}
sort(v.rbegin(), v.rend());
int res = 0;
for(auto &x: v){
if(a > b) break;
res++;
a += get<1>(x) + get<2>(x);
b -= get<1>(x);
}
cout<<res<<nl;
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
Solve();
} | [
"noreply@github.com"
] | CP-lands.noreply@github.com |
7b1adcdf2c1ca26ac0730ce2a9c62aa33cefa597 | f9fa279de2294ff483f3d0c9bc08bb052fc5eda2 | /lbshell/src/platform/linux/lb_shell/lb_web_view_host.cc | bd9baa5965e4b77bc481f498e70c52ca4140c629 | [
"Apache-2.0"
] | permissive | rajeshvv/h5vcc | 964d1c2d6ea308413dae1527525f8937ac58808f | 1e0b8ac00d494d3ed56513d1e1725a063add7f31 | refs/heads/master | 2021-01-15T09:38:25.999021 | 2013-07-22T22:53:30 | 2013-07-22T22:53:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 18,499 | cc | /*
* Copyright 2012 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Owns the primary run loop for LBPS3. Updates I/O, sets up graphics, and in
// general is the primary contact object between ps3 system SDK and WebKit.
#include "lb_web_view_host.h"
#include "external/chromium/base/bind.h"
#include "external/chromium/base/logging.h"
#include "external/chromium/base/stringprintf.h"
#include "external/chromium/base/utf_string_conversions.h"
#include "external/chromium/third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h"
#include "external/chromium/third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "external/chromium/third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "external/chromium/third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h"
#include "external/chromium/third_party/WebKit/Source/WebKit/chromium/public/WebSettings.h"
#include "external/chromium/third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
#include "external/chromium/ui/base/keycodes/keyboard_code_conversion_x.h"
#include "external/chromium/webkit/glue/webkit_glue.h"
// This head file has a weird dependency and it has to be here after the others
#include "external/chromium/third_party/WebKit/Source/WebCore/platform/chromium/KeyboardCodes.h"
#include "lb_debug_console.h"
#include "lb_http_handler.h"
#include "lb_memory_manager.h"
#include "lb_network_console.h"
#include "lb_platform.h"
#include "lb_graphics_linux.h"
#include "lb_shell.h"
#include "lb_shell_constants.h"
#include "lb_shell_platform_delegate.h"
#include "lb_web_media_player_delegate.h"
#include "lb_web_view_delegate.h"
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysymdef.h>
using base::StringPrintf;
using namespace WebKit;
using webkit_media::LBWebMediaPlayerDelegate;
#if defined(__LB_SHELL__ENABLE_CONSOLE__)
// for open()
#include <fcntl.h>
extern const char *global_screenshot_output_path;
#endif
static void NavTaskStartupURL(LBWebViewHost *view_host, LBShell *shell);
static void NavTask(LBWebViewHost *view_host, LBShell *shell, const GURL& url);
LBWebViewHost* LBWebViewHost::web_view_host_ = NULL;
// static
LBWebViewHost* LBWebViewHost::Create(LBShell* shell,
LBWebViewDelegate* delegate,
const webkit_glue::WebPreferences& prefs) {
DCHECK(!web_view_host_);
LBWebViewHost* host = LB_NEW LBWebViewHost(shell);
host->webwidget_ = WebView::create(delegate);
prefs.Apply(host->webview());
host->webview()->initializeMainFrame(delegate);
host->webview()->setFocus(true);
// resize WebKit to device dimensions
host->webwidget()->resize(WebSize(
LBGraphics::GetPtr()->GetDeviceWidth(),
LBGraphics::GetPtr()->GetDeviceHeight()));
// force accelerated rendering in all cases
host->webview()->settings()->setForceCompositingMode(true);
// we'd like to composite directly to the screen, please
// TODO: the function is not available any more. we need to find it and
// double check we need to reimplement or remove this line.
//host->webview()->settings()->setCompositeToTextureEnabled(false);
host->webview()->settings()->setAccelerated2dCanvasEnabled(true);
host->webview()->settings()->setAcceleratedCompositingEnabled(true);
host->webview()->settings()->setAcceleratedCompositingFor3DTransformsEnabled(
true);
host->webview()->settings()->setAcceleratedCompositingForAnimationEnabled(
true);
host->webview()->settings()->setAcceleratedCompositingForCanvasEnabled(true);
host->webview()->settings()->setAcceleratedCompositingForVideoEnabled(true);
host->webview()->setCompositorSurfaceReady();
LBGraphics::GetPtr()->SetWebViewHost(host);
web_view_host_ = host;
return host;
}
void LBWebViewHost::Destroy() {
#if defined(__LB_SHELL__ENABLE_CONSOLE__)
console_->Shutdown();
delete console_;
#endif
if (webwidget_) {
webwidget_->close();
webwidget_ = NULL;
}
web_view_host_ = NULL;
}
LBWebViewHost::LBWebViewHost(LBShell* shell)
: base::SimpleThread("LBWebViewHost Thread",
base::SimpleThread::Options(kViewHostThreadStackSize,
kViewHostThreadPriority))
, exit_(false)
, shell_(shell)
#if defined(__LB_SHELL__ENABLE_CONSOLE__)
, console_(NULL)
, telnet_connection_(NULL)
, webkit_wedged_(false)
#endif
{
main_message_loop_ = MessageLoop::current();
DCHECK(main_message_loop_);
#if SHUTDOWN_APPLICATION_AFTER
NOTIMPLEMENTED();
#endif
}
#if defined(__LB_SHELL__ENABLE_CONSOLE__)
void LBWebViewHost::output(std::string data) {
// trim trailing newlines, if present.
// the console library will start a new line for every output.
while (data.length() && data[data.length() - 1] == '\n') {
data.erase(data.length() - 1);
}
if (telnet_connection_) {
data.append("\n");
telnet_connection_->Output(data);
} else {
DLOG(INFO) << data;
}
}
void LBWebViewHost::output_popup(std::string data) {
output(data);
}
void LBWebViewHost::clearInput() {
console_buffer_.clear();
}
bool LBWebViewHost::toggleWebKitWedged() {
webkit_wedged_ = !webkit_wedged_;
SetWebKitPaused(webkit_wedged_);
return webkit_wedged_;
}
// static
void LBWebViewHost::MouseEventTask(WebKit::WebInputEvent::Type type,
WebKit::WebMouseEvent::Button button,
int x,
int y,
LBWebViewHost* host) {
WebKit::WebMouseEvent mouse_event;
mouse_event.type = type;
mouse_event.button = button;
mouse_event.x = x;
mouse_event.y = y;
if (host->IsExiting()) return;
host->webwidget()->handleInputEvent(mouse_event);
}
void LBWebViewHost::SendMouseClick(WebKit::WebMouseEvent::Button button,
int x,
int y) {
// post a MouseDown event followed by a MouseUp event 100 ms later.
main_message_loop_->PostTask(FROM_HERE,
base::Bind(MouseEventTask, WebKit::WebInputEvent::MouseDown, button, x, y, this));
main_message_loop_->PostDelayedTask(FROM_HERE,
base::Bind(MouseEventTask, WebKit::WebInputEvent::MouseUp, button, x, y, this),
base::TimeDelta::FromMilliseconds(100));
}
#endif
// The owner will be reponsible for deinit therefore Join() is not implemented
// in this class (the function from the base class will be called).
void LBWebViewHost::Start() {
base::SimpleThread::Start();
}
// the main graphics thread runs here. this is pretty much the
// "game loop" of LB_SHELL, that is the code responsible for calling
// the system callback, rendering and swapping buffers, polling and
// sending IO off, etc
void LBWebViewHost::Run() {
#if defined(__LB_SHELL__ENABLE_CONSOLE__)
console_ = LB_NEW LBDebugConsole();
console_->Init(shell_);
LBNetworkConsole::Initialize(console_);
// Create http server for WebInspector
scoped_refptr<LBHttpHandler> http_handler = LB_NEW LBHttpHandler(this);
#endif
// Start loading the main page.
main_message_loop_->PostTask(FROM_HERE,
base::Bind(NavTaskStartupURL, this, shell_));
while (!exit_) {
// set up render of current frame
LBGraphics::GetPtr()->UpdateAndDrawFrame();
// update IO
UpdateIO();
#if defined(__LB_SHELL__ENABLE_CONSOLE__)
LBNetworkConsole::GetInstance()->Poll();
#endif
// wait until frame we drew flips to be displayed
LBGraphics::GetPtr()->BlockUntilFlip();
}
#if defined(__LB_SHELL__ENABLE_CONSOLE__)
LBNetworkConsole::Teardown();
#endif
}
bool LBWebViewHost::FilterKeyEvent(
WebKit::WebKeyboardEvent::Type type, int key_code,
wchar_t char_code,
WebKit::WebKeyboardEvent::Modifiers modifiers,
bool is_console_eligible) {
#if defined(__LB_SHELL__ENABLE_CONSOLE__)
if (is_console_eligible
&& type == WebKit::WebKeyboardEvent::KeyUp
&& modifiers == WebKit::WebKeyboardEvent::ControlKey) {
// this is a release event for a control-key-combo.
switch (key_code) {
case 'C': // control-C schedules a JS pause.
console_->ParseAndExecuteCommand("js pause");
break;
case 'R': // control-R reloads the page
console_->ParseAndExecuteCommand("reload");
break;
#if defined(__LB_SHELL__ENABLE_SCREENSHOT__)
case 'S': // control-S takes a screenshot
LBGraphics::GetPtr()->TakeScreenshot("");
break;
#endif
case 'W': // control-W pauses/unpauses ("wedges") the WebKit thread
console_->ParseAndExecuteCommand("wedge");
break;
}
// do not pass these intercepted keys to the browser.
return false;
}
#endif
if (modifiers & ~WebKit::WebKeyboardEvent::ShiftKey) {
// We do not pass control and alt combos to the browser so that we don't
// activate some unsupported or non-functional (for us) chromium feature.
return false;
}
// the browser may consume this event.
return true;
}
#if defined(__LB_SHELL__ENABLE_CONSOLE__)
void LBWebViewHost::RecordKeyInput(const char* file_name) {
NOTIMPLEMENTED();
}
void LBWebViewHost::PlaybackKeyInput(const char* file_name, bool repeat) {
NOTIMPLEMENTED();
}
#endif
static void KeyInputTask(WebKit::WebKeyboardEvent event, LBWebViewHost *host) {
if (host->IsExiting()) return;
host->webwidget()->handleInputEvent(event);
}
void LBWebViewHost::SendKeyEvent(
WebKit::WebInputEvent::Type type,
int key_code,
wchar_t char_code,
WebKit::WebInputEvent::Modifiers modifiers,
bool is_console_eligible) {
#if defined(__LB_SHELL_DEBUG_TASKS__)
// This keystroke info is extremely useful in debugging task-related issues.
if (!char_code) printf("Sending keycode %d\n", key_code);
#endif
if (FilterKeyEvent(type, key_code, char_code, modifiers,
is_console_eligible) == false) {
// caught by filter, do not pass on.
return;
}
WebKit::WebKeyboardEvent key_event;
key_event.type = type;
key_event.windowsKeyCode = key_code;
key_event.text[0] = char_code;
key_event.text[1] = 0;
key_event.unmodifiedText[0] = char_code;
key_event.unmodifiedText[1] = 0;
key_event.modifiers = modifiers;
key_event.setKeyIdentifierFromWindowsKeyCode();
main_message_loop_->PostTask(FROM_HERE,
base::Bind(KeyInputTask, key_event, this));
}
void LBWebViewHost::InjectKeystroke(
int key_code,
wchar_t char_code,
WebKit::WebKeyboardEvent::Modifiers modifiers,
bool is_console_eligible) {
SendKeyEvent(WebKit::WebInputEvent::RawKeyDown, key_code, 0,
modifiers, is_console_eligible);
if (char_code != 0) {
SendKeyEvent(WebKit::WebInputEvent::Char, char_code, char_code,
modifiers, is_console_eligible);
}
SendKeyEvent(WebKit::WebInputEvent::KeyUp, key_code, 0, modifiers,
is_console_eligible);
}
static void InjectJSTask(WebCString codeString, LBWebViewHost *host) {
if (host->IsExiting()) return;
WebScriptSource source(codeString.utf16());
host->webview()->mainFrame()->executeScript(source);
}
// NOTE: This is NOT debug functionality!
// Invalid or exception-causing JavaScript is neither detected nor handled.
void LBWebViewHost::InjectJS(const char * code) {
WebCString codeString(code);
main_message_loop_->PostTask(FROM_HERE,
base::Bind(InjectJSTask, codeString, this));
}
static void QuitTask(LBWebViewHost *host) {
host->Join();
MessageLoop::current()->Quit();
}
void LBWebViewHost::RequestQuit() {
// disable WebKit compositing
LBGraphics::GetPtr()->SetWebKitCompositeEnable(false);
// setup exit flag. viewhost thread exits according to this flag.
exit_ = true;
// Sync webkit and viewhost threads.
main_message_loop_->PostTask(FROM_HERE, base::Bind(QuitTask, this));
}
static int XKeyEventToWindowsKeyCode(XKeyEvent* event) {
int windows_key_code =
ui::KeyboardCodeFromXKeyEvent(reinterpret_cast<XEvent*>(event));
if (windows_key_code == ui::VKEY_SHIFT ||
windows_key_code == ui::VKEY_CONTROL ||
windows_key_code == ui::VKEY_MENU) {
// To support DOM3 'location' attribute, we need to lookup an X KeySym and
// set ui::VKEY_[LR]XXX instead of ui::VKEY_XXX.
KeySym keysym = XK_VoidSymbol;
XLookupString(event, NULL, 0, &keysym, NULL);
switch (keysym) {
case XK_Shift_L:
return ui::VKEY_LSHIFT;
case XK_Shift_R:
return ui::VKEY_RSHIFT;
case XK_Control_L:
return ui::VKEY_LCONTROL;
case XK_Control_R:
return ui::VKEY_RCONTROL;
case XK_Meta_L:
case XK_Alt_L:
return ui::VKEY_LMENU;
case XK_Meta_R:
case XK_Alt_R:
return ui::VKEY_RMENU;
}
}
return windows_key_code;
}
// Converts a WebInputEvent::Modifiers bitfield into a
// corresponding X modifier state.
static WebKit::WebInputEvent::Modifiers
EventModifiersFromXState(XKeyEvent* keyEvent) {
unsigned int modifiers = keyEvent->state;
unsigned int webkit_modifiers = 0;
if (modifiers & ControlMask) {
webkit_modifiers |= WebKit::WebInputEvent::ControlKey;
}
if (modifiers & ShiftMask) {
webkit_modifiers |= WebKit::WebInputEvent::ShiftKey;
}
if (modifiers & Mod1Mask) {
webkit_modifiers |= WebKit::WebInputEvent::AltKey;
}
if (modifiers & Button1Mask) {
webkit_modifiers |= WebKit::WebInputEvent::LeftButtonDown;
}
if (modifiers & Button2Mask) {
webkit_modifiers |= WebKit::WebInputEvent::MiddleButtonDown;
}
if (modifiers & Button3Mask) {
webkit_modifiers |= WebKit::WebInputEvent::RightButtonDown;
}
return static_cast<WebKit::WebInputEvent::Modifiers>(webkit_modifiers);
}
void LBWebViewHost::UpdateIO() {
Display* display = LBGraphicsLinux::GetPtr()->GetXDisplay();
while (XPending(display)) {
XEvent event;
XNextEvent(display, &event);
switch (event.type) {
case ButtonPress:
{
}
break;
case KeyPress:
{
WebKit::WebInputEvent::Modifiers modifiers =
EventModifiersFromXState(reinterpret_cast<XKeyEvent*>(&event));
int windows_key_code =
XKeyEventToWindowsKeyCode(reinterpret_cast<XKeyEvent*>(&event));
SendKeyEvent(WebKit::WebInputEvent::RawKeyDown,
windows_key_code, 0, modifiers, true);
}
break;
case KeyRelease:
{
WebKit::WebInputEvent::Modifiers modifiers =
EventModifiersFromXState(reinterpret_cast<XKeyEvent*>(&event));
int windows_key_code =
XKeyEventToWindowsKeyCode(reinterpret_cast<XKeyEvent*>(&event));
SendKeyEvent(WebKit::WebInputEvent::KeyUp,
windows_key_code, 0, modifiers, true);
}
break;
default:
break;
}
}
}
// TODO: Consider moving this method outside of platform-specific code.
// It's here because we create this type in the Create() method
// so we have the specific domain knowledge to know that
// we can cast this thing. For a simple embedded setup
// like LB we may be able to move this into a centralized spot
// down the road.
WebView* LBWebViewHost::webview() const {
return static_cast<WebView*>(webwidget_);
}
WebWidget* LBWebViewHost::webwidget() const {
return webwidget_;
}
MessageLoop* LBWebViewHost::main_message_loop() const {
return main_message_loop_;
}
static bool PauseApplicationTaskDone = false;
static void PauseApplicationTask(LBWebViewHost *host) {
if (host->IsExiting()) return;
// The purpose of this task is to pause the entire application,
// including media players, WebKit, and JavaScriptCore.
DCHECK(MessageLoop::current() == host->main_message_loop());
DLOG(INFO) << StringPrintf("Pausing, main loop has %d items in queue.\n",
host->main_message_loop()->Size());
// First we pause all media player instances.
LBWebMediaPlayerDelegate::Instance()->PauseActivePlayers();
// Poll for unpause or quit while blocking JavaScriptCore and
// the rest of WebKit.
while (!PauseApplicationTaskDone && !host->IsExiting()) {
// sleep for 100 ms and then poll again
base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100));
}
// Finally, we unpause all media player instances
// and return from the task so that WebKit can continue.
if (!host->IsExiting()) {
LBWebMediaPlayerDelegate::Instance()->ResumeActivePlayers();
}
DLOG(INFO) << StringPrintf(
"Unpausing, main loop has %d items in queue.\n",
host->main_message_loop()->Size());
}
void LBWebViewHost::SetWebKitPaused(bool paused) {
if (paused) {
PauseApplicationTaskDone = false;
main_message_loop()->PostTask(FROM_HERE,
base::Bind(PauseApplicationTask, this));
} else {
PauseApplicationTaskDone = true;
}
}
void LBWebViewHost::SetPlayersPaused(bool paused) {
if (paused) {
main_message_loop()->PostTask(FROM_HERE,
base::Bind(&LBWebMediaPlayerDelegate::PauseActivePlayers,
base::Unretained(LBWebMediaPlayerDelegate::Instance())));
} else {
main_message_loop()->PostTask(FROM_HERE,
base::Bind(&LBWebMediaPlayerDelegate::ResumeActivePlayers,
base::Unretained(LBWebMediaPlayerDelegate::Instance())));
}
}
void LBWebViewHost::TextInputFocusEvent() {
}
void LBWebViewHost::TextInputBlurEvent() {
}
static void NavTaskStartupURL(LBWebViewHost *view_host, LBShell *shell) {
if (view_host->IsExiting()) {
return;
}
shell->Navigate(GURL(shell->GetStartupURL()));
}
static void NavTask(LBWebViewHost *view_host, LBShell *shell, const GURL& url) {
if (view_host->IsExiting()) {
return;
}
shell->Navigate(url);
}
void LBWebViewHost::SendNavigateTask(const GURL& url) {
main_message_loop_->PostTask(FROM_HERE,
base::Bind(NavTask, this, shell_, url));
}
void LBWebViewHost::ShowNetworkFailure() {
// TODO: Needs to setup Linux local://.
SendNavigateTask(GURL("local://network_failure.html"));
}
| [
"rjogrady@google.com"
] | rjogrady@google.com |
490a1aa84342652ba85916a39a35bc97fae2d283 | 5d83739af703fb400857cecc69aadaf02e07f8d1 | /Archive2/b6/6bd1ecbe89a25d/main.cpp | 35ab9e999e60c1b59e4b9a962dddfede6c1f4b48 | [] | no_license | WhiZTiM/coliru | 3a6c4c0bdac566d1aa1c21818118ba70479b0f40 | 2c72c048846c082f943e6c7f9fa8d94aee76979f | refs/heads/master | 2021-01-01T05:10:33.812560 | 2015-08-24T19:09:22 | 2015-08-24T19:09:22 | 56,789,706 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,205 | cpp | #include <memory>
#include <iostream>
#include <vector>
struct dynamic_release {
template <typename F> dynamic_release(F&& f) : _f(std::forward<F>(f)) { }
template <typename F> dynamic_release& operator=(F&& f)
{ _f = std::forward<F>(f); return *this; }
~dynamic_release() { _f(); }
private:
std::function<void()> _f;
};
void do_foo() { std::cout << "Foo\n"; }
void do_bar() { std::cout << "Bar\n"; }
int main(void) {
using InterfaceWrapper = std::shared_ptr<dynamic_release>;
using Thing = InterfaceWrapper::element_type;
{
std::vector<InterfaceWrapper> thing_vector;
auto thing = std::make_shared<Thing>(do_foo);
thing_vector.push_back(thing);
thing_vector.push_back(thing);
thing_vector.push_back(thing);
thing_vector.push_back(thing);
} // prints "Foo" once
{
std::vector<InterfaceWrapper> thing_vector;
auto thing = std::make_shared<Thing>(do_foo);
thing_vector.push_back(thing);
thing_vector.push_back(thing);
thing_vector.push_back(thing);
*thing = do_bar; // Prints nothing
thing_vector.push_back(thing);
} // prints "Bar" once
}
| [
"francis.rammeloo@36614edc-3e3a-acb8-9062-c8ae0e4185df"
] | francis.rammeloo@36614edc-3e3a-acb8-9062-c8ae0e4185df |
2355a0e7c21499e231d1b3636d3ffa3a6f8a358e | bef2903ba91cecaeb75a960a8538a769496a40df | /.history/frontend/src/Screens/ass1_20200803122358.cpp | 01d5c11d2367c71a942249fa9b0e7d436f63cf2d | [] | no_license | Prrajainn/Project-YourCart | bf83962b3d43604e2803025621aa6ccd64a4771c | d4baaba9c1ebf3d568708c2026f3890fef8ddd2a | refs/heads/master | 2022-11-24T22:16:20.738803 | 2020-08-08T06:27:44 | 2020-08-08T06:27:44 | 285,985,671 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 104 | cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int k , m;
cin>>k; cin>>m;
while
} | [
"prrakharjainn@gmail.com"
] | prrakharjainn@gmail.com |
b5cad8b244222208ff2f67b136649f5584517c8e | 33931acd25591d1066ec27b5453e01f66856c8f7 | /Camera.h | abd6d0356eaf44ce541dec53f3e400e9d2fcc167 | [] | no_license | AlfieEducation/OpenGL | 87aea6509b3af2f86ceec52c942f2f602701238f | 618a1e80a7f75ac909141a0bef9e5943b748dcdd | refs/heads/master | 2020-11-28T19:28:24.888137 | 2020-01-30T14:24:58 | 2020-01-30T14:24:58 | 229,902,948 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 716 | h | #pragma once
#include <GL\glew.h>
#include <glm\glm.hpp>
#include <glm\gtc\matrix_transform.hpp>
#include <GLFW\glfw3.h>
class Camera
{
public:
Camera();
Camera(glm::vec3 startPosition, glm::vec3 startUp, GLfloat startYaw, GLfloat startPitch, GLfloat startMoveSpeed, GLfloat startTurnSpeed);
void keyControl(bool* keys, GLfloat deltaTime);
void mouseControl(GLfloat xChange, GLfloat yChange);
glm::vec3 getCameraPosition();
glm::vec3 getCameraDirection();
glm::mat4 calculateViewMatrix();
~Camera();
private:
glm::vec3 position;
glm::vec3 front;
glm::vec3 up;
glm::vec3 right;
glm::vec3 worldUp;
GLfloat yaw;
GLfloat pitch;
GLfloat moveSpeed;
GLfloat turnSpeed;
void update();
};
| [
"alfie.developer@gmail.com"
] | alfie.developer@gmail.com |
6264c856b2fff0c244132f83942c037b05e0338d | f3648c911bddea84b6db0922dbc85cca26e812cb | /Match3/src/system/states/BootState.h | 439268dd4c64ce75af03092bcef4f8c3dadef6e9 | [] | no_license | bismyc/Match3 | ebea1717ee794290c7f9dc1e913ef9e447ebb6da | d74b9222a0dbecf164ea28898803a43c8cb1380c | refs/heads/master | 2023-01-23T01:14:53.156678 | 2019-05-09T20:25:45 | 2019-05-09T20:25:45 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 296 | h | #pragma once
#include "IState.h"
class BootState : public IState
{
public:
BootState();
~BootState();
virtual void Activate() override;
virtual void Update(float deltaTime) override {}
virtual void Render(Graphics* graphics) override {}
virtual void Deactivate() override;
private:
};
| [
"bismyc@9tailstudios.com"
] | bismyc@9tailstudios.com |
e0c41d9c394fb8fa9f515b239e107e5efd73f0eb | b69a01706f3d1b9f691d7069fa43f0d0b74ba506 | /C++ CODING/C++ ASSIGNMENT QUESTION 3.cpp | 4433bb0a273c1b3f499257b8451242c0e85a17bf | [] | no_license | naipunya-naik/lockdown-coding | 5a29a73106ec161638f8d1b777b43616f42cc23d | 8c389639558cf4fc836d1650a3b38e4f0908fa63 | refs/heads/master | 2022-11-24T13:57:05.722654 | 2020-07-29T17:15:11 | 2020-07-29T17:15:11 | 264,948,009 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 809 | cpp | #include <iostream>
using namespace std;
struct Student
{
private:
int USN;
char name[50];
public:
void read(void)
{
cout<<"Enter Student's name: ";
cin>>name;
cout<<"Enter USN: ";
cin>>USN;
}
void print(void)
{
cout<<endl;
cout<<"name: "<<name<<endl;
cout<<"USN: "<<USN<<endl;
}
};
int main()
{
struct Student std;
int n,l,i;
cout << "Enter total number of students: ";
cin >> n;
for(l=0;l< n; l++)
{
cout << "Enter details of student " << l+1 << ":\n";
std.read();
}
cout << endl;
for(i=0;i< n; i++)
{
cout << "Details of student " << (i+1) << ":\n";
std.print();
}
return 0;
}
| [
"noreply@github.com"
] | naipunya-naik.noreply@github.com |
8b0eac24aff2f85e78c4f529100cbc1b400779d6 | aa00f813e321e4b26aaf9d888c8aff0e09c5db51 | /1 программа комбинаторика/main.cpp | aa57f741db34387d0b88d244f7412bfca42484b2 | [] | no_license | kiselyyovaalina/c- | 4dd61a4b0f7a6c34c29e05f509b6f9a5223d77bc | a84cbe10e8aa33fb626cdfab17f787c8e6348331 | refs/heads/master | 2023-01-03T22:07:43.217357 | 2020-11-01T13:14:03 | 2020-11-01T13:14:03 | 257,879,062 | 0 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 955 | cpp | #include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
setlocale(LC_ALL,"rus");
ofstream file;
fstream text;
text.open("INPUT.txt");
file.open("OUTPUT.txt");
int kol;
text>>kol;
string word;
text>>word;
int sum = 0;
for (int i=0;i<word.size()-1;i++)
{
for (int j=i+1;j<word.size();j++)
{
if (word[i]==word[j])
{
word[j]='0';
}
}
}
for (int i=0;i<word.size();i++)
{
if(word[i]!='0')
{
sum++;
}
}
int otv=0;
if (sum>=kol){
otv=1;
for (int i=0;i<kol;i++)
{
otv=otv*(sum);
sum=sum-1;
}
}
file<<otv;
cout<<"посмотрите результат в файле OUTPUT"<<endl;
text.close();
file.close();
return 0;
}
| [
"noreply@github.com"
] | kiselyyovaalina.noreply@github.com |
49455fcd0d0009c562ea985639bdbdd955864931 | 921c689451ff3b6e472cc6ae6a34774c4f57e68b | /llvm-2.8/tools/clang/include/clang/Basic/TargetInfo.h | 40df9ba11da4cdf36a0ee8f71a502ece69704474 | [
"NCSA"
] | permissive | xpic-toolchain/xpic_toolchain | 36cae905bbf675d26481bee19b420283eff90a79 | 9e6d4276cc8145a934c31b0d3292a382fc2e5e92 | refs/heads/master | 2021-01-21T04:37:18.963215 | 2016-05-19T12:34:11 | 2016-05-19T12:34:11 | 29,474,690 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 20,403 | h | //===--- TargetInfo.h - Expose information about the target -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the TargetInfo interface.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_BASIC_TARGETINFO_H
#define LLVM_CLANG_BASIC_TARGETINFO_H
// FIXME: Daniel isn't smart enough to use a prototype for this.
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Triple.h"
#include "llvm/System/DataTypes.h"
#include <cassert>
#include <vector>
#include <string>
namespace llvm {
struct fltSemantics;
class StringRef;
}
namespace clang {
class Diagnostic;
class LangOptions;
class MacroBuilder;
class SourceLocation;
class SourceManager;
class TargetOptions;
namespace Builtin { struct Info; }
/// TargetCXXABI - The types of C++ ABIs for which we can generate code.
enum TargetCXXABI {
/// The generic ("Itanium") C++ ABI, documented at:
/// http://www.codesourcery.com/public/cxx-abi/
CXXABI_Itanium,
/// The ARM C++ ABI, based largely on the Itanium ABI but with
/// significant differences.
/// http://infocenter.arm.com
/// /help/topic/com.arm.doc.ihi0041c/IHI0041C_cppabi.pdf
CXXABI_ARM,
/// The Visual Studio ABI. Only scattered official documentation exists.
CXXABI_Microsoft
};
/// TargetInfo - This class exposes information about the current target.
///
class TargetInfo {
llvm::Triple Triple;
protected:
// Target values set by the ctor of the actual target implementation. Default
// values are specified by the TargetInfo constructor.
bool TLSSupported;
bool NoAsmVariants; // True if {|} are normal characters.
unsigned char PointerWidth, PointerAlign;
unsigned char IntWidth, IntAlign;
unsigned char FloatWidth, FloatAlign;
unsigned char DoubleWidth, DoubleAlign;
unsigned char LongDoubleWidth, LongDoubleAlign;
unsigned char LargeArrayMinWidth, LargeArrayAlign;
unsigned char LongWidth, LongAlign;
unsigned char LongLongWidth, LongLongAlign;
const char *DescriptionString;
const char *UserLabelPrefix;
const llvm::fltSemantics *FloatFormat, *DoubleFormat, *LongDoubleFormat;
unsigned char RegParmMax, SSERegParmMax;
TargetCXXABI CXXABI;
unsigned HasAlignMac68kSupport : 1;
unsigned RealTypeUsesObjCFPRet : 3;
// TargetInfo Constructor. Default initializes all fields.
TargetInfo(const std::string &T);
public:
/// CreateTargetInfo - Construct a target for the given options.
///
/// \param Opts - The options to use to initialize the target. The target may
/// modify the options to canonicalize the target feature information to match
/// what the backend expects.
static TargetInfo* CreateTargetInfo(Diagnostic &Diags, TargetOptions &Opts);
virtual ~TargetInfo();
///===---- Target Data Type Query Methods -------------------------------===//
enum IntType {
NoInt = 0,
SignedShort,
UnsignedShort,
SignedInt,
UnsignedInt,
SignedLong,
UnsignedLong,
SignedLongLong,
UnsignedLongLong
};
enum RealType {
Float = 0,
Double,
LongDouble
};
protected:
IntType SizeType, IntMaxType, UIntMaxType, PtrDiffType, IntPtrType, WCharType,
WIntType, Char16Type, Char32Type, Int64Type, SigAtomicType;
/// Control whether the alignment of bit-field types is respected when laying
/// out structures. If true, then the alignment of the bit-field type will be
/// used to (a) impact the alignment of the containing structure, and (b)
/// ensure that the individual bit-field will not straddle an alignment
/// boundary.
unsigned UseBitFieldTypeAlignment : 1;
public:
IntType getSizeType() const { return SizeType; }
IntType getIntMaxType() const { return IntMaxType; }
IntType getUIntMaxType() const { return UIntMaxType; }
IntType getPtrDiffType(unsigned AddrSpace) const {
return AddrSpace == 0 ? PtrDiffType : getPtrDiffTypeV(AddrSpace);
}
IntType getIntPtrType() const { return IntPtrType; }
IntType getWCharType() const { return WCharType; }
IntType getWIntType() const { return WIntType; }
IntType getChar16Type() const { return Char16Type; }
IntType getChar32Type() const { return Char32Type; }
IntType getInt64Type() const { return Int64Type; }
IntType getSigAtomicType() const { return SigAtomicType; }
/// getTypeWidth - Return the width (in bits) of the specified integer type
/// enum. For example, SignedInt -> getIntWidth().
unsigned getTypeWidth(IntType T) const;
/// getTypeAlign - Return the alignment (in bits) of the specified integer
/// type enum. For example, SignedInt -> getIntAlign().
unsigned getTypeAlign(IntType T) const;
/// isTypeSigned - Return whether an integer types is signed. Returns true if
/// the type is signed; false otherwise.
bool isTypeSigned(IntType T) const;
/// getPointerWidth - Return the width of pointers on this target, for the
/// specified address space.
uint64_t getPointerWidth(unsigned AddrSpace) const {
return AddrSpace == 0 ? PointerWidth : getPointerWidthV(AddrSpace);
}
uint64_t getPointerAlign(unsigned AddrSpace) const {
return AddrSpace == 0 ? PointerAlign : getPointerAlignV(AddrSpace);
}
/// getBoolWidth/Align - Return the size of '_Bool' and C++ 'bool' for this
/// target, in bits.
unsigned getBoolWidth(bool isWide = false) const { return 8; } // FIXME
unsigned getBoolAlign(bool isWide = false) const { return 8; } // FIXME
unsigned getCharWidth() const { return 8; } // FIXME
unsigned getCharAlign() const { return 8; } // FIXME
/// getShortWidth/Align - Return the size of 'signed short' and
/// 'unsigned short' for this target, in bits.
unsigned getShortWidth() const { return 16; } // FIXME
unsigned getShortAlign() const { return 16; } // FIXME
/// getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for
/// this target, in bits.
unsigned getIntWidth() const { return IntWidth; }
unsigned getIntAlign() const { return IntAlign; }
/// getLongWidth/Align - Return the size of 'signed long' and 'unsigned long'
/// for this target, in bits.
unsigned getLongWidth() const { return LongWidth; }
unsigned getLongAlign() const { return LongAlign; }
/// getLongLongWidth/Align - Return the size of 'signed long long' and
/// 'unsigned long long' for this target, in bits.
unsigned getLongLongWidth() const { return LongLongWidth; }
unsigned getLongLongAlign() const { return LongLongAlign; }
/// getWCharWidth/Align - Return the size of 'wchar_t' for this target, in
/// bits.
unsigned getWCharWidth() const { return getTypeWidth(WCharType); }
unsigned getWCharAlign() const { return getTypeAlign(WCharType); }
/// getChar16Width/Align - Return the size of 'char16_t' for this target, in
/// bits.
unsigned getChar16Width() const { return getTypeWidth(Char16Type); }
unsigned getChar16Align() const { return getTypeAlign(Char16Type); }
/// getChar32Width/Align - Return the size of 'char32_t' for this target, in
/// bits.
unsigned getChar32Width() const { return getTypeWidth(Char32Type); }
unsigned getChar32Align() const { return getTypeAlign(Char32Type); }
/// getFloatWidth/Align/Format - Return the size/align/format of 'float'.
unsigned getFloatWidth() const { return FloatWidth; }
unsigned getFloatAlign() const { return FloatAlign; }
const llvm::fltSemantics &getFloatFormat() const { return *FloatFormat; }
/// getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
unsigned getDoubleWidth() const { return DoubleWidth; }
unsigned getDoubleAlign() const { return DoubleAlign; }
const llvm::fltSemantics &getDoubleFormat() const { return *DoubleFormat; }
/// getLongDoubleWidth/Align/Format - Return the size/align/format of 'long
/// double'.
unsigned getLongDoubleWidth() const { return LongDoubleWidth; }
unsigned getLongDoubleAlign() const { return LongDoubleAlign; }
const llvm::fltSemantics &getLongDoubleFormat() const {
return *LongDoubleFormat;
}
// getLargeArrayMinWidth/Align - Return the minimum array size that is
// 'large' and its alignment.
unsigned getLargeArrayMinWidth() const { return LargeArrayMinWidth; }
unsigned getLargeArrayAlign() const { return LargeArrayAlign; }
/// getIntMaxTWidth - Return the size of intmax_t and uintmax_t for this
/// target, in bits.
unsigned getIntMaxTWidth() const {
return getTypeWidth(IntMaxType);
}
/// getUserLabelPrefix - This returns the default value of the
/// __USER_LABEL_PREFIX__ macro, which is the prefix given to user symbols by
/// default. On most platforms this is "_", but it is "" on some, and "." on
/// others.
const char *getUserLabelPrefix() const {
return UserLabelPrefix;
}
bool useBitFieldTypeAlignment() const {
return UseBitFieldTypeAlignment;
}
/// hasAlignMac68kSupport - Check whether this target support '#pragma options
/// align=mac68k'.
bool hasAlignMac68kSupport() const {
return HasAlignMac68kSupport;
}
/// getTypeName - Return the user string for the specified integer type enum.
/// For example, SignedShort -> "short".
static const char *getTypeName(IntType T);
/// getTypeConstantSuffix - Return the constant suffix for the specified
/// integer type enum. For example, SignedLong -> "L".
static const char *getTypeConstantSuffix(IntType T);
/// \brief Check whether the given real type should use the "fpret" flavor of
/// Obj-C message passing on this target.
bool useObjCFPRetForRealType(RealType T) const {
return RealTypeUsesObjCFPRet & (1 << T);
}
///===---- Other target property query methods --------------------------===//
/// getTargetDefines - Appends the target-specific #define values for this
/// target set to the specified buffer.
virtual void getTargetDefines(const LangOptions &Opts,
MacroBuilder &Builder) const = 0;
/// getTargetBuiltins - Return information about target-specific builtins for
/// the current primary target, and info about which builtins are non-portable
/// across the current set of primary and secondary targets.
virtual void getTargetBuiltins(const Builtin::Info *&Records,
unsigned &NumRecords) const = 0;
/// getVAListDeclaration - Return the declaration to use for
/// __builtin_va_list, which is target-specific.
virtual const char *getVAListDeclaration() const = 0;
/// isValidGCCRegisterName - Returns whether the passed in string
/// is a valid register name according to GCC. This is used by Sema for
/// inline asm statements.
bool isValidGCCRegisterName(llvm::StringRef Name) const;
// getNormalizedGCCRegisterName - Returns the "normalized" GCC register name.
// For example, on x86 it will return "ax" when "eax" is passed in.
llvm::StringRef getNormalizedGCCRegisterName(llvm::StringRef Name) const;
struct ConstraintInfo {
enum {
CI_None = 0x00,
CI_AllowsMemory = 0x01,
CI_AllowsRegister = 0x02,
CI_ReadWrite = 0x04, // "+r" output constraint (read and write).
CI_HasMatchingInput = 0x08 // This output operand has a matching input.
};
unsigned Flags;
int TiedOperand;
std::string ConstraintStr; // constraint: "=rm"
std::string Name; // Operand name: [foo] with no []'s.
public:
ConstraintInfo(llvm::StringRef ConstraintStr, llvm::StringRef Name)
: Flags(0), TiedOperand(-1), ConstraintStr(ConstraintStr.str()),
Name(Name.str()) {}
const std::string &getConstraintStr() const { return ConstraintStr; }
const std::string &getName() const { return Name; }
bool isReadWrite() const { return (Flags & CI_ReadWrite) != 0; }
bool allowsRegister() const { return (Flags & CI_AllowsRegister) != 0; }
bool allowsMemory() const { return (Flags & CI_AllowsMemory) != 0; }
/// hasMatchingInput - Return true if this output operand has a matching
/// (tied) input operand.
bool hasMatchingInput() const { return (Flags & CI_HasMatchingInput) != 0; }
/// hasTiedOperand() - Return true if this input operand is a matching
/// constraint that ties it to an output operand. If this returns true,
/// then getTiedOperand will indicate which output operand this is tied to.
bool hasTiedOperand() const { return TiedOperand != -1; }
unsigned getTiedOperand() const {
assert(hasTiedOperand() && "Has no tied operand!");
return (unsigned)TiedOperand;
}
void setIsReadWrite() { Flags |= CI_ReadWrite; }
void setAllowsMemory() { Flags |= CI_AllowsMemory; }
void setAllowsRegister() { Flags |= CI_AllowsRegister; }
void setHasMatchingInput() { Flags |= CI_HasMatchingInput; }
/// setTiedOperand - Indicate that this is an input operand that is tied to
/// the specified output operand. Copy over the various constraint
/// information from the output.
void setTiedOperand(unsigned N, ConstraintInfo &Output) {
Output.setHasMatchingInput();
Flags = Output.Flags;
TiedOperand = N;
// Don't copy Name or constraint string.
}
};
// validateOutputConstraint, validateInputConstraint - Checks that
// a constraint is valid and provides information about it.
// FIXME: These should return a real error instead of just true/false.
bool validateOutputConstraint(ConstraintInfo &Info) const;
bool validateInputConstraint(ConstraintInfo *OutputConstraints,
unsigned NumOutputs,
ConstraintInfo &info) const;
bool resolveSymbolicName(const char *&Name,
ConstraintInfo *OutputConstraints,
unsigned NumOutputs, unsigned &Index) const;
virtual std::string convertConstraint(const char Constraint) const {
return std::string(1, Constraint);
}
// Returns a string of target-specific clobbers, in LLVM format.
virtual const char *getClobbers() const = 0;
/// getTriple - Return the target triple of the primary target.
const llvm::Triple &getTriple() const {
return Triple;
}
const char *getTargetDescription() const {
return DescriptionString;
}
struct GCCRegAlias {
const char * const Aliases[5];
const char * const Register;
};
virtual bool useGlobalsForAutomaticVariables() const { return false; }
/// getCFStringSection - Return the section to use for CFString
/// literals, or 0 if no special section is used.
virtual const char *getCFStringSection() const {
return "__DATA,__cfstring";
}
/// getNSStringSection - Return the section to use for NSString
/// literals, or 0 if no special section is used.
virtual const char *getNSStringSection() const {
return "__OBJC,__cstring_object,regular,no_dead_strip";
}
/// getNSStringNonFragileABISection - Return the section to use for
/// NSString literals, or 0 if no special section is used (NonFragile ABI).
virtual const char *getNSStringNonFragileABISection() const {
return "__DATA, __objc_stringobj, regular, no_dead_strip";
}
/// isValidSectionSpecifier - This is an optional hook that targets can
/// implement to perform semantic checking on attribute((section("foo")))
/// specifiers. In this case, "foo" is passed in to be checked. If the
/// section specifier is invalid, the backend should return a non-empty string
/// that indicates the problem.
///
/// This hook is a simple quality of implementation feature to catch errors
/// and give good diagnostics in cases when the assembler or code generator
/// would otherwise reject the section specifier.
///
virtual std::string isValidSectionSpecifier(llvm::StringRef SR) const {
return "";
}
/// setForcedLangOptions - Set forced language options.
/// Apply changes to the target information with respect to certain
/// language options which change the target configuration.
virtual void setForcedLangOptions(LangOptions &Opts);
/// getDefaultFeatures - Get the default set of target features for
/// the \args CPU; this should include all legal feature strings on
/// the target.
virtual void getDefaultFeatures(const std::string &CPU,
llvm::StringMap<bool> &Features) const {
}
/// getABI - Get the ABI in use.
virtual const char *getABI() const {
return "";
}
/// getCXXABI - Get the C++ ABI in use.
virtual TargetCXXABI getCXXABI() const {
return CXXABI;
}
/// setCPU - Target the specific CPU.
///
/// \return - False on error (invalid CPU name).
//
// FIXME: Remove this.
virtual bool setCPU(const std::string &Name) {
return true;
}
/// setABI - Use the specific ABI.
///
/// \return - False on error (invalid ABI name).
virtual bool setABI(const std::string &Name) {
return false;
}
/// setCXXABI - Use this specific C++ ABI.
///
/// \return - False on error (invalid C++ ABI name).
bool setCXXABI(const std::string &Name) {
static const TargetCXXABI Unknown = static_cast<TargetCXXABI>(-1);
TargetCXXABI ABI = llvm::StringSwitch<TargetCXXABI>(Name)
.Case("arm", CXXABI_ARM)
.Case("itanium", CXXABI_Itanium)
.Case("microsoft", CXXABI_Microsoft)
.Default(Unknown);
if (ABI == Unknown) return false;
return setCXXABI(ABI);
}
/// setCXXABI - Set the C++ ABI to be used by this implementation.
///
/// \return - False on error (ABI not valid on this target)
virtual bool setCXXABI(TargetCXXABI ABI) {
CXXABI = ABI;
return true;
}
/// setFeatureEnabled - Enable or disable a specific target feature,
/// the feature name must be valid.
///
/// \return - False on error (invalid feature name).
virtual bool setFeatureEnabled(llvm::StringMap<bool> &Features,
const std::string &Name,
bool Enabled) const {
return false;
}
/// HandleTargetOptions - Perform initialization based on the user configured
/// set of features (e.g., +sse4). The list is guaranteed to have at most one
/// entry per feature.
///
/// The target may modify the features list, to change which options are
/// passed onwards to the backend.
virtual void HandleTargetFeatures(std::vector<std::string> &Features) {
}
// getRegParmMax - Returns maximal number of args passed in registers.
unsigned getRegParmMax() const {
return RegParmMax;
}
/// isTLSSupported - Whether the target supports thread-local storage.
bool isTLSSupported() const {
return TLSSupported;
}
/// hasNoAsmVariants - Return true if {|} are normal characters in the
/// asm string. If this returns false (the default), then {abc|xyz} is syntax
/// that says that when compiling for asm variant #0, "abc" should be
/// generated, but when compiling for asm variant #1, "xyz" should be
/// generated.
bool hasNoAsmVariants() const {
return NoAsmVariants;
}
/// getEHDataRegisterNumber - Return the register number that
/// __builtin_eh_return_regno would return with the specified argument.
virtual int getEHDataRegisterNumber(unsigned RegNo) const {
return -1;
}
/// getStaticInitSectionSpecifier - Return the section to use for C++ static
/// initialization functions.
virtual const char *getStaticInitSectionSpecifier() const {
return 0;
}
protected:
virtual uint64_t getPointerWidthV(unsigned AddrSpace) const {
return PointerWidth;
}
virtual uint64_t getPointerAlignV(unsigned AddrSpace) const {
return PointerAlign;
}
virtual enum IntType getPtrDiffTypeV(unsigned AddrSpace) const {
return PtrDiffType;
}
virtual void getGCCRegNames(const char * const *&Names,
unsigned &NumNames) const = 0;
virtual void getGCCRegAliases(const GCCRegAlias *&Aliases,
unsigned &NumAliases) const = 0;
virtual bool validateAsmConstraint(const char *&Name,
TargetInfo::ConstraintInfo &info) const= 0;
};
} // end namespace clang
#endif
| [
"helmutmanck@5227c84a-046b-4545-895e-fca5577db8e1"
] | helmutmanck@5227c84a-046b-4545-895e-fca5577db8e1 |
5425cf253d4bec716f86b165ff7917adbce34450 | 992b75408838c2bd6dfc32e274682b44d61f54d8 | /math/main.cpp | 9f54e28b4240df46c38eb56536e5a8307cd9cad5 | [] | no_license | romandion/Lab | 35064447be0a8889729110d51da952855fa63f3d | 13f3ce1d1f848c3c3d88719d04c00b80cfc08ecc | refs/heads/master | 2020-03-07T09:53:00.539709 | 2018-08-29T03:02:38 | 2018-08-29T03:02:38 | 127,418,080 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 245 | cpp |
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(int argc , char * argv[])
{
BOOL v = FALSE;
::printf("__LINE__ = %d \n" , __LINE__) ;
return 0 ;
}
| [
"romandion@163.com"
] | romandion@163.com |
929243d51a7f0716022507a886f9a1b025fa4127 | fb4ce7ecd3f60a7f3e5abb902a943abc26b12849 | /src/template.hpp | 97650be941351bd967a6471c30c03a40310ff9dd | [] | no_license | shijieliu/snake | 6763483a24bd1a536519a91e068832dcc5f350ee | 96a4447a4b199b82e84f6355c40dde5d113056a3 | refs/heads/master | 2021-06-24T19:20:42.987465 | 2017-09-16T08:22:05 | 2017-09-16T08:22:05 | 103,082,495 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 647 | hpp | #ifndef TEMPLATE_H
#define TEMPLATE_H
#include <memory>
namespace snake{
class snake;
class apple;
template <typename T>
class initial_trait{//trait出shared_ptr的原有类型
public:
typedef T value;
};
template <>
class initial_trait<std::shared_ptr<snake>>{
public:
typedef snake value;
};
template <>
class initial_trait<std::shared_ptr<apple>>{
public:
typedef apple value;
};
struct score_t{
int _value;
score_t(int _x):_value(_x){}
int value() const {return _value;}
};
struct level_t{
int _value;
level_t(int x):_value(x){}
int value() const {return _value;}
};
}
#endif
| [
"13146012964@163.com"
] | 13146012964@163.com |
5f4d0ff5caed593c9d3718887fa7bf72806b0a52 | a590f039107aaab0980d7ded36b6f79cd47e541d | /OpenFOAM/elliot-7/Dissertation/NOTCH/H/Initial Cases/scalarTransportH/0.065/T | 00c8afdfba10f11c6d7378bba0b311645599d258 | [] | no_license | etenno/uni | 3f85179768ae5a5d77dd21879f84323278a7a2f6 | bb62570182ea239c123df954eb0893e2d681fe8d | refs/heads/master | 2023-03-04T08:30:00.034753 | 2021-02-14T12:54:03 | 2021-02-14T12:54:03 | 338,678,729 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 72,469 | /*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 6
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0.065";
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField nonuniform List<scalar>
7000
(
97.6992
97.6991
97.699
97.6989
97.6989
97.6989
97.6989
97.6989
97.699
97.6991
97.6991
97.6989
97.6988
97.6987
97.6987
97.6987
97.6987
97.6988
97.6988
97.6989
97.699
97.6988
97.6987
97.6986
97.6986
97.6986
97.6986
97.6987
97.6987
97.6988
97.6989
97.6987
97.6986
97.6985
97.6985
97.6985
97.6985
97.6986
97.6987
97.6988
97.6989
97.6987
97.6986
97.6985
97.6985
97.6985
97.6985
97.6986
97.6987
97.6988
97.6989
97.6987
97.6986
97.6985
97.6985
97.6985
97.6985
97.6986
97.6987
97.6988
97.6989
97.6987
97.6986
97.6985
97.6985
97.6985
97.6986
97.6986
97.6987
97.6988
97.6989
97.6988
97.6987
97.6986
97.6986
97.6986
97.6986
97.6987
97.6988
97.6989
97.699
97.6988
97.6987
97.6987
97.6987
97.6987
97.6987
97.6988
97.6989
97.699
97.6991
97.6989
97.6988
97.6988
97.6988
97.6988
97.6988
97.6989
97.699
97.6991
74.0659
74.0655
74.0652
74.0651
74.065
74.065
74.0651
74.0652
74.0654
74.0656
74.0655
74.0651
74.0648
74.0647
74.0646
74.0646
74.0647
74.0648
74.065
74.0653
74.0652
74.0648
74.0645
74.0644
74.0643
74.0643
74.0644
74.0645
74.0648
74.0651
74.0651
74.0647
74.0644
74.0642
74.0642
74.0642
74.0642
74.0644
74.0646
74.0649
74.065
74.0646
74.0643
74.0642
74.0641
74.0641
74.0642
74.0643
74.0646
74.0649
74.065
74.0646
74.0643
74.0642
74.0641
74.0641
74.0642
74.0644
74.0646
74.0649
74.0651
74.0647
74.0644
74.0642
74.0642
74.0642
74.0643
74.0645
74.0647
74.065
74.0652
74.0648
74.0645
74.0644
74.0643
74.0644
74.0645
74.0646
74.0649
74.0652
74.0654
74.065
74.0648
74.0646
74.0646
74.0646
74.0647
74.0649
74.0651
74.0654
74.0656
74.0653
74.0651
74.0649
74.0649
74.0649
74.065
74.0652
74.0654
74.0657
53.1081
53.1075
53.1071
53.1069
53.1068
53.1068
53.1069
53.1071
53.1074
53.1077
53.1075
53.107
53.1066
53.1064
53.1063
53.1063
53.1064
53.1066
53.1069
53.1073
53.1071
53.1066
53.1062
53.106
53.1059
53.1059
53.106
53.1063
53.1066
53.1071
53.1069
53.1064
53.106
53.1058
53.1057
53.1057
53.1058
53.1061
53.1064
53.1069
53.1068
53.1063
53.1059
53.1057
53.1056
53.1056
53.1058
53.106
53.1064
53.1068
53.1068
53.1063
53.1059
53.1057
53.1056
53.1057
53.1058
53.106
53.1064
53.1069
53.1069
53.1064
53.106
53.1058
53.1058
53.1058
53.1059
53.1062
53.1065
53.107
53.1071
53.1066
53.1063
53.1061
53.106
53.106
53.1062
53.1064
53.1068
53.1073
53.1074
53.1069
53.1066
53.1064
53.1064
53.1064
53.1065
53.1068
53.1072
53.1077
53.1077
53.1074
53.1071
53.1069
53.1069
53.1069
53.107
53.1073
53.1077
53.1081
35.936
35.9354
35.935
35.9348
35.9347
35.9347
35.9348
35.9351
35.9354
35.9358
35.9354
35.9349
35.9345
35.9342
35.9341
35.9342
35.9343
35.9345
35.9349
35.9354
35.935
35.9345
35.9341
35.9339
35.9338
35.9338
35.9339
35.9342
35.9346
35.9351
35.9348
35.9342
35.9339
35.9336
35.9336
35.9336
35.9337
35.934
35.9344
35.935
35.9347
35.9342
35.9338
35.9336
35.9335
35.9335
35.9336
35.9339
35.9343
35.9349
35.9347
35.9342
35.9338
35.9336
35.9335
35.9335
35.9337
35.934
35.9344
35.9349
35.9348
35.9343
35.9339
35.9337
35.9336
35.9337
35.9338
35.9341
35.9345
35.9351
35.9351
35.9345
35.9342
35.934
35.9339
35.934
35.9341
35.9344
35.9348
35.9354
35.9354
35.9349
35.9346
35.9344
35.9343
35.9344
35.9346
35.9348
35.9353
35.9358
35.9358
35.9354
35.9352
35.935
35.9349
35.935
35.9351
35.9354
35.9358
35.9364
22.917
22.9165
22.9161
22.9159
22.9159
22.9159
22.916
22.9162
22.9165
22.9169
22.9165
22.916
22.9157
22.9155
22.9154
22.9154
22.9155
22.9157
22.9161
22.9166
22.9161
22.9157
22.9153
22.9151
22.915
22.9151
22.9152
22.9154
22.9158
22.9163
22.9159
22.9155
22.9151
22.9149
22.9148
22.9149
22.915
22.9152
22.9156
22.9162
22.9159
22.9154
22.915
22.9148
22.9148
22.9148
22.9149
22.9152
22.9156
22.9161
22.9159
22.9154
22.9151
22.9149
22.9148
22.9148
22.915
22.9152
22.9156
22.9162
22.916
22.9155
22.9152
22.915
22.9149
22.915
22.9151
22.9154
22.9158
22.9163
22.9162
22.9158
22.9155
22.9153
22.9152
22.9153
22.9154
22.9157
22.9161
22.9166
22.9166
22.9161
22.9159
22.9157
22.9156
22.9157
22.9158
22.9161
22.9165
22.9171
22.917
22.9167
22.9164
22.9163
22.9162
22.9163
22.9164
22.9167
22.9171
22.9176
13.7668
13.7664
13.7662
13.766
13.7659
13.7659
13.766
13.7661
13.7663
13.7666
13.7664
13.766
13.7658
13.7656
13.7655
13.7655
13.7656
13.7657
13.766
13.7663
13.7662
13.7658
13.7655
13.7653
13.7653
13.7653
13.7654
13.7655
13.7657
13.7661
13.766
13.7656
13.7654
13.7652
13.7651
13.7651
13.7652
13.7654
13.7656
13.766
13.7659
13.7655
13.7653
13.7651
13.7651
13.7651
13.7652
13.7653
13.7656
13.766
13.766
13.7656
13.7653
13.7652
13.7651
13.7651
13.7652
13.7654
13.7656
13.7661
13.7661
13.7657
13.7654
13.7653
13.7652
13.7653
13.7653
13.7655
13.7658
13.7662
13.7663
13.7659
13.7657
13.7655
13.7655
13.7655
13.7656
13.7658
13.766
13.7664
13.7666
13.7662
13.766
13.7659
13.7658
13.7659
13.766
13.7661
13.7664
13.7668
13.7669
13.7667
13.7665
13.7664
13.7663
13.7664
13.7665
13.7666
13.7669
13.7673
7.79177
7.79149
7.7913
7.79118
7.79112
7.79108
7.79104
7.79096
7.79085
7.79082
7.7915
7.79122
7.79103
7.79091
7.79084
7.79081
7.79078
7.79071
7.79061
7.79065
7.79131
7.79103
7.79084
7.79073
7.79066
7.79063
7.7906
7.79054
7.79046
7.79052
7.7912
7.79092
7.79073
7.79062
7.79055
7.79052
7.7905
7.79044
7.79037
7.79044
7.79115
7.79088
7.79069
7.79058
7.79052
7.79049
7.79047
7.79041
7.79035
7.79042
7.79117
7.7909
7.79072
7.79061
7.79055
7.79052
7.7905
7.79045
7.79039
7.79046
7.79126
7.791
7.79082
7.79071
7.79065
7.79063
7.79061
7.79056
7.7905
7.79057
7.79142
7.79117
7.79099
7.79089
7.79084
7.79082
7.7908
7.79076
7.7907
7.79077
7.79166
7.79142
7.79127
7.79117
7.79112
7.79111
7.79109
7.79105
7.79099
7.79106
7.79196
7.79179
7.79165
7.79157
7.79152
7.79151
7.79149
7.79145
7.79139
7.79146
4.15786
4.15768
4.15755
4.15746
4.15738
4.15726
4.15701
4.15645
4.15551
4.15453
4.15768
4.1575
4.15737
4.15728
4.15721
4.15709
4.15683
4.15629
4.15536
4.15443
4.15756
4.15738
4.15725
4.15717
4.15709
4.15697
4.15672
4.15618
4.15526
4.15434
4.15749
4.15731
4.15718
4.1571
4.15702
4.15691
4.15666
4.15612
4.1552
4.15429
4.15746
4.15728
4.15716
4.15707
4.157
4.15689
4.15664
4.1561
4.15519
4.15428
4.15748
4.1573
4.15718
4.15709
4.15702
4.15691
4.15666
4.15613
4.15522
4.15432
4.15754
4.15737
4.15725
4.15717
4.1571
4.15699
4.15674
4.15621
4.1553
4.1544
4.15766
4.15749
4.15738
4.1573
4.15723
4.15712
4.15688
4.15635
4.15544
4.15453
4.15783
4.15767
4.15757
4.1575
4.15743
4.15733
4.15708
4.15655
4.15565
4.15474
4.15804
4.15793
4.15784
4.15778
4.15771
4.15761
4.15737
4.15684
4.15593
4.15503
2.09414
2.09403
2.09394
2.09387
2.09375
2.09348
2.09279
2.09116
2.08796
2.08372
2.09403
2.09392
2.09384
2.09376
2.09365
2.09338
2.09269
2.09107
2.08787
2.08366
2.09396
2.09385
2.09377
2.09369
2.09358
2.09331
2.09262
2.091
2.08781
2.08361
2.09391
2.09381
2.09372
2.09365
2.09354
2.09327
2.09259
2.09097
2.08778
2.08358
2.0939
2.09379
2.09371
2.09364
2.09352
2.09326
2.09258
2.09096
2.08777
2.08358
2.09391
2.09381
2.09373
2.09365
2.09354
2.09328
2.0926
2.09098
2.08779
2.0836
2.09396
2.09385
2.09377
2.0937
2.09359
2.09333
2.09265
2.09103
2.08784
2.08365
2.09403
2.09393
2.09385
2.09379
2.09368
2.09342
2.09273
2.09112
2.08793
2.08374
2.09414
2.09405
2.09398
2.09391
2.09381
2.09355
2.09287
2.09125
2.08807
2.08387
2.09428
2.09422
2.09416
2.0941
2.09399
2.09373
2.09305
2.09144
2.08825
2.08406
0.996848
0.996785
0.99673
0.996656
0.996487
0.996007
0.994631
0.99092
0.981974
0.965535
0.99679
0.996727
0.996672
0.996598
0.996429
0.99595
0.994575
0.990867
0.981926
0.965504
0.99675
0.996687
0.996632
0.996559
0.99639
0.995912
0.994538
0.990832
0.981896
0.965478
0.996727
0.996664
0.99661
0.996536
0.996368
0.99589
0.994518
0.990813
0.981879
0.965464
0.996719
0.996657
0.996603
0.99653
0.996362
0.995885
0.994514
0.990809
0.981876
0.965462
0.996728
0.996667
0.996613
0.99654
0.996373
0.995896
0.994525
0.990822
0.981889
0.965475
0.996754
0.996693
0.996641
0.996569
0.996403
0.995926
0.994556
0.990852
0.98192
0.965505
0.9968
0.996741
0.99669
0.99662
0.996455
0.995979
0.994609
0.990905
0.981972
0.965556
0.996866
0.996813
0.996766
0.996698
0.996533
0.996058
0.994688
0.990984
0.98205
0.965633
0.996952
0.996914
0.996872
0.996806
0.996642
0.996167
0.994797
0.991093
0.982158
0.96574
0.449169
0.449133
0.449095
0.44902
0.448812
0.448165
0.446145
0.439873
0.420176
0.355558
0.449138
0.449103
0.449065
0.44899
0.448783
0.448136
0.446116
0.439846
0.420154
0.355544
0.449118
0.449083
0.449044
0.44897
0.448763
0.448116
0.446097
0.439829
0.420139
0.355533
0.449106
0.449071
0.449033
0.448959
0.448752
0.448106
0.446087
0.43982
0.420131
0.355527
0.449103
0.449068
0.44903
0.448956
0.448749
0.448103
0.446085
0.439818
0.42013
0.355527
0.449108
0.449074
0.449036
0.448962
0.448755
0.44811
0.446092
0.439825
0.420137
0.355533
0.449123
0.449089
0.449051
0.448979
0.448772
0.448127
0.446109
0.439842
0.420153
0.355546
0.449148
0.449115
0.449079
0.449007
0.448801
0.448156
0.446138
0.439871
0.42018
0.355569
0.449186
0.449155
0.449121
0.44905
0.448844
0.4482
0.446182
0.439914
0.420221
0.355604
0.449234
0.449212
0.44918
0.44911
0.448905
0.44826
0.446242
0.439973
0.420279
0.355655
0.191893
0.191874
0.191847
0.191783
0.191594
0.191012
0.189267
0.184243
0.170522
0.136167
0.191879
0.191859
0.191832
0.191769
0.191579
0.190998
0.189254
0.18423
0.170512
0.136161
0.191869
0.19185
0.191823
0.191759
0.19157
0.190989
0.189245
0.184222
0.170505
0.136156
0.191863
0.191844
0.191817
0.191754
0.191565
0.190983
0.18924
0.184218
0.170502
0.136153
0.191862
0.191843
0.191816
0.191753
0.191564
0.190983
0.189239
0.184217
0.170502
0.136153
0.191865
0.191846
0.191819
0.191756
0.191567
0.190986
0.189243
0.184221
0.170505
0.136156
0.191872
0.191854
0.191827
0.191764
0.191576
0.190995
0.189252
0.18423
0.170513
0.136163
0.191886
0.191868
0.191842
0.191779
0.191591
0.19101
0.189267
0.184244
0.170526
0.136173
0.191905
0.191888
0.191863
0.191801
0.191613
0.191032
0.189289
0.184266
0.170547
0.13619
0.19193
0.191917
0.191894
0.191832
0.191644
0.191064
0.18932
0.184296
0.170575
0.136213
0.0778603
0.0778501
0.0778326
0.0777872
0.0776529
0.0772574
0.076148
0.0732399
0.0662928
0.0519318
0.0778537
0.0778436
0.0778261
0.0777807
0.0776464
0.0772511
0.076142
0.0732344
0.0662884
0.0519287
0.0778493
0.0778392
0.0778217
0.0777764
0.0776422
0.0772469
0.0761381
0.0732308
0.0662854
0.0519266
0.0778468
0.0778368
0.0778193
0.077774
0.0776399
0.0772447
0.076136
0.073229
0.0662839
0.0519256
0.0778463
0.0778363
0.0778189
0.0777736
0.0776395
0.0772444
0.0761358
0.0732289
0.0662839
0.0519256
0.0778478
0.0778378
0.0778205
0.0777753
0.0776412
0.0772462
0.0761376
0.0732307
0.0662856
0.051927
0.0778516
0.0778417
0.0778245
0.0777795
0.0776455
0.0772505
0.0761418
0.0732347
0.0662893
0.05193
0.0778581
0.0778484
0.0778315
0.0777866
0.0776527
0.0772577
0.076149
0.0732417
0.0662955
0.051935
0.0778675
0.0778585
0.077842
0.0777973
0.0776635
0.0772686
0.0761597
0.073252
0.066305
0.0519425
0.0778798
0.0778726
0.0778567
0.0778122
0.0776785
0.0772836
0.0761745
0.0732663
0.0663182
0.0519533
0.0300555
0.0300504
0.0300401
0.0300127
0.0299336
0.0297123
0.0291315
0.0277332
0.0247342
0.0193046
0.0300527
0.0300476
0.0300374
0.03001
0.0299309
0.0297096
0.029129
0.0277309
0.0247323
0.0193033
0.0300508
0.0300457
0.0300355
0.0300081
0.0299291
0.0297079
0.0291273
0.0277294
0.0247311
0.0193025
0.0300498
0.0300447
0.0300345
0.0300071
0.0299281
0.029707
0.0291265
0.0277287
0.0247305
0.0193021
0.0300496
0.0300445
0.0300344
0.030007
0.029928
0.0297069
0.0291264
0.0277287
0.0247305
0.0193021
0.0300503
0.0300453
0.0300351
0.0300078
0.0299288
0.0297077
0.0291273
0.0277295
0.0247313
0.0193027
0.0300521
0.0300471
0.030037
0.0300097
0.0299308
0.0297097
0.0291292
0.0277313
0.0247329
0.0193041
0.030055
0.0300501
0.0300402
0.0300129
0.0299341
0.0297129
0.0291324
0.0277344
0.0247357
0.0193063
0.0300594
0.0300547
0.0300449
0.0300178
0.029939
0.0297178
0.0291372
0.027739
0.0247398
0.0193096
0.030065
0.0300611
0.0300516
0.0300246
0.0299458
0.0297246
0.0291439
0.0277454
0.0247456
0.0193143
0.0110566
0.0110541
0.0110488
0.0110343
0.010994
0.0108867
0.0106215
0.0100276
0.00885737
0.00692794
0.0110555
0.011053
0.0110477
0.0110332
0.0109929
0.0108856
0.0106205
0.0100267
0.00885664
0.00692742
0.0110547
0.0110523
0.0110469
0.0110325
0.0109922
0.0108849
0.0106198
0.0100261
0.00885617
0.00692708
0.0110543
0.0110519
0.0110465
0.0110321
0.0109918
0.0108845
0.0106195
0.0100258
0.00885594
0.00692691
0.0110542
0.0110518
0.0110465
0.0110321
0.0109918
0.0108845
0.0106195
0.0100258
0.00885596
0.00692695
0.0110546
0.0110521
0.0110468
0.0110324
0.0109922
0.0108849
0.0106198
0.0100262
0.00885629
0.00692721
0.0110553
0.0110529
0.0110476
0.0110332
0.010993
0.0108857
0.0106207
0.0100269
0.00885698
0.00692777
0.0110566
0.0110542
0.011049
0.0110346
0.0109944
0.0108871
0.010622
0.0100282
0.00885814
0.0069287
0.0110585
0.0110562
0.011051
0.0110367
0.0109965
0.0108892
0.0106241
0.0100302
0.00885987
0.00693009
0.0110609
0.011059
0.0110539
0.0110396
0.0109994
0.0108921
0.0106269
0.0100329
0.00886229
0.00693205
0.00388267
0.00388158
0.00387904
0.00387225
0.00385394
0.00380734
0.0036982
0.00346818
0.00304429
0.00239096
0.00388224
0.00388115
0.00387862
0.00387183
0.00385353
0.00380694
0.00369783
0.00346784
0.00304402
0.00239076
0.00388196
0.00388087
0.00387834
0.00387155
0.00385325
0.00380667
0.00369758
0.00346763
0.00304384
0.00239063
0.00388181
0.00388072
0.00387819
0.0038714
0.00385311
0.00380654
0.00369746
0.00346752
0.00304376
0.00239057
0.00388179
0.00388071
0.00387818
0.0038714
0.00385311
0.00380654
0.00369747
0.00346753
0.00304377
0.00239059
0.00388193
0.00388084
0.00387833
0.00387155
0.00385326
0.0038067
0.00369762
0.00346768
0.0030439
0.0023907
0.00388224
0.00388116
0.00387865
0.00387188
0.0038536
0.00380703
0.00369795
0.00346799
0.00304418
0.00239092
0.00388276
0.0038817
0.0038792
0.00387244
0.00385417
0.0038076
0.0036985
0.00346851
0.00304464
0.00239129
0.00388351
0.0038825
0.00388003
0.00387329
0.00385502
0.00380844
0.00369932
0.00346928
0.00304533
0.00239185
0.0038845
0.00388361
0.00388119
0.00387446
0.00385619
0.00380961
0.00370046
0.00347036
0.00304629
0.00239262
0.00130363
0.00130318
0.00130208
0.00129918
0.00129162
0.00127315
0.00123185
0.0011491
0.00100453
0.000792559
0.00130348
0.00130302
0.00130193
0.00129903
0.00129147
0.001273
0.00123171
0.00114898
0.00100444
0.000792488
0.00130338
0.00130292
0.00130182
0.00129893
0.00129137
0.00127291
0.00123162
0.00114891
0.00100437
0.000792442
0.00130332
0.00130287
0.00130177
0.00129888
0.00129132
0.00127286
0.00123158
0.00114887
0.00100434
0.000792421
0.00130332
0.00130287
0.00130177
0.00129888
0.00129132
0.00127287
0.00123159
0.00114888
0.00100435
0.000792429
0.00130337
0.00130292
0.00130183
0.00129893
0.00129138
0.00127293
0.00123165
0.00114893
0.0010044
0.000792471
0.00130349
0.00130304
0.00130196
0.00129906
0.00129151
0.00127306
0.00123177
0.00114905
0.00100451
0.000792556
0.00130369
0.00130325
0.00130217
0.00129928
0.00129173
0.00127327
0.00123198
0.00114925
0.00100468
0.000792697
0.00130399
0.00130356
0.00130249
0.0012996
0.00129206
0.00127359
0.0012323
0.00114954
0.00100494
0.000792908
0.00130437
0.00130399
0.00130293
0.00130005
0.00129251
0.00127404
0.00123273
0.00114995
0.0010053
0.000793201
0.000419155
0.000418976
0.000418538
0.000417399
0.000414521
0.000407741
0.000393176
0.000365218
0.000318431
0.0002524
0.000419101
0.000418923
0.000418485
0.000417346
0.000414469
0.000407691
0.00039313
0.000365177
0.000318398
0.000252375
0.000419066
0.000418888
0.00041845
0.000417312
0.000414436
0.000407659
0.0003931
0.000365151
0.000318377
0.000252359
0.000419048
0.00041887
0.000418432
0.000417295
0.000414419
0.000407643
0.000393086
0.000365139
0.000318368
0.000252353
0.000419048
0.00041887
0.000418433
0.000417296
0.000414421
0.000407645
0.000393089
0.000365142
0.000318371
0.000252356
0.000419068
0.000418891
0.000418454
0.000417318
0.000414443
0.000407668
0.000393111
0.000365163
0.00031839
0.000252371
0.000419113
0.000418936
0.000418501
0.000417365
0.000414491
0.000407715
0.000393157
0.000365206
0.000318428
0.000252402
0.000419186
0.000419012
0.000418578
0.000417444
0.00041457
0.000407794
0.000393233
0.000365277
0.00031849
0.000252453
0.000419293
0.000419124
0.000418694
0.000417562
0.000414688
0.00040791
0.000393346
0.000365383
0.000318584
0.000252529
0.000419433
0.00041928
0.000418856
0.000417725
0.000414851
0.000408072
0.000393502
0.000365529
0.000318713
0.000252635
0.000129253
0.000129187
0.000129024
0.000128608
0.000127587
0.00012526
0.000120433
0.000111503
9.71037e-05
7.7477e-05
0.000129235
0.000129169
0.000129006
0.000128591
0.000127571
0.000125244
0.000120418
0.00011149
9.70929e-05
7.74688e-05
0.000129223
0.000129158
0.000128995
0.00012858
0.00012756
0.000125233
0.000120408
0.000111481
9.7086e-05
7.74637e-05
0.000129217
0.000129152
0.000128989
0.000128574
0.000127554
0.000125228
0.000120404
0.000111477
9.7083e-05
7.74616e-05
0.000129218
0.000129152
0.00012899
0.000128575
0.000127555
0.000125229
0.000120405
0.000111479
9.70843e-05
7.74629e-05
0.000129225
0.00012916
0.000128997
0.000128583
0.000127563
0.000125237
0.000120413
0.000111486
9.70909e-05
7.74683e-05
0.000129241
0.000129176
0.000129014
0.000128599
0.00012758
0.000125254
0.000120429
0.000111501
9.7104e-05
7.74791e-05
0.000129266
0.000129202
0.000129041
0.000128626
0.000127607
0.000125281
0.000120455
0.000111525
9.71256e-05
7.74967e-05
0.000129303
0.000129241
0.000129081
0.000128667
0.000127648
0.000125321
0.000120494
0.000111562
9.71577e-05
7.7523e-05
0.000129352
0.000129295
0.000129137
0.000128724
0.000127704
0.000125377
0.000120548
0.000111612
9.72021e-05
7.75593e-05
3.828e-05
3.82573e-05
3.82005e-05
3.80585e-05
3.77187e-05
3.69665e-05
3.54564e-05
3.2762e-05
2.86153e-05
2.34628e-05
3.82744e-05
3.82518e-05
3.8195e-05
3.8053e-05
3.77134e-05
3.69614e-05
3.54517e-05
3.27579e-05
2.86119e-05
2.34601e-05
3.82708e-05
3.82481e-05
3.81914e-05
3.80495e-05
3.77099e-05
3.69582e-05
3.54487e-05
3.27552e-05
2.86097e-05
2.34585e-05
3.82691e-05
3.82464e-05
3.81897e-05
3.80478e-05
3.77083e-05
3.69567e-05
3.54474e-05
3.27541e-05
2.86089e-05
2.34578e-05
3.82693e-05
3.82466e-05
3.819e-05
3.80482e-05
3.77087e-05
3.69571e-05
3.54478e-05
3.27546e-05
2.86094e-05
2.34583e-05
3.82717e-05
3.82491e-05
3.81926e-05
3.80508e-05
3.77114e-05
3.69598e-05
3.54504e-05
3.2757e-05
2.86116e-05
2.34602e-05
3.82769e-05
3.82544e-05
3.8198e-05
3.80563e-05
3.77169e-05
3.69652e-05
3.54557e-05
3.2762e-05
2.86159e-05
2.34639e-05
3.82854e-05
3.82632e-05
3.82069e-05
3.80653e-05
3.7726e-05
3.69742e-05
3.54644e-05
3.277e-05
2.86231e-05
2.34699e-05
3.82978e-05
3.82761e-05
3.82203e-05
3.80789e-05
3.77395e-05
3.69875e-05
3.54772e-05
3.2782e-05
2.86336e-05
2.34788e-05
3.8314e-05
3.82941e-05
3.82388e-05
3.80976e-05
3.77582e-05
3.70059e-05
3.54949e-05
3.27985e-05
2.86482e-05
2.3491e-05
0.125096
0.0439502
0.0153381
0.0057203
0.00368352
0.00689736
0.0196481
0.057911
0.167608
0.477542
0.12509
0.0439477
0.0153371
0.00571974
0.00368279
0.00689567
0.0196438
0.0579002
0.167582
0.477482
0.125086
0.0439462
0.0153365
0.00571939
0.00368235
0.00689467
0.0196412
0.057894
0.167568
0.477448
0.125084
0.0439454
0.0153362
0.00571923
0.00368212
0.00689414
0.0196399
0.0578908
0.16756
0.477431
0.125084
0.0439455
0.0153362
0.00571924
0.00368207
0.00689398
0.0196395
0.0578899
0.167558
0.477426
0.125087
0.0439467
0.0153367
0.00571945
0.00368218
0.0068941
0.0196398
0.0578907
0.16756
0.477432
0.125093
0.0439491
0.0153377
0.00571988
0.00368244
0.00689449
0.0196408
0.0578933
0.167567
0.477449
0.125103
0.0439532
0.0153394
0.00572058
0.00368286
0.0068951
0.0196423
0.0578974
0.167578
0.477478
0.125117
0.0439592
0.0153418
0.00572158
0.00368342
0.00689585
0.0196442
0.0579026
0.167592
0.477515
0.125137
0.0439671
0.015345
0.00572284
0.00368406
0.0068966
0.0196459
0.0579074
0.167606
0.477554
0.0663291
0.0276091
0.0106604
0.00426929
0.00288462
0.00532499
0.0145182
0.0401565
0.10523
0.253137
0.0663257
0.0276076
0.0106597
0.00426886
0.00288405
0.00532371
0.0145151
0.0401492
0.105214
0.253106
0.0663233
0.0276065
0.0106593
0.0042686
0.0028837
0.00532292
0.0145132
0.0401447
0.105204
0.253087
0.0663221
0.027606
0.0106591
0.00426847
0.00288352
0.00532251
0.0145122
0.0401424
0.105199
0.253076
0.0663222
0.0276061
0.0106591
0.00426848
0.00288348
0.00532238
0.0145119
0.0401417
0.105198
0.253074
0.0663238
0.0276069
0.0106595
0.00426864
0.00288357
0.00532248
0.0145121
0.0401423
0.105199
0.253077
0.0663274
0.0276086
0.0106602
0.00426899
0.00288379
0.0053228
0.0145129
0.0401443
0.105204
0.253087
0.0663334
0.0276115
0.0106615
0.00426955
0.00288413
0.00532331
0.0145141
0.0401474
0.105211
0.253105
0.0663424
0.0276158
0.0106634
0.00427037
0.00288462
0.00532399
0.0145157
0.0401516
0.105222
0.253128
0.0663552
0.0276218
0.010666
0.0042715
0.00288526
0.00532481
0.0145176
0.0401566
0.105235
0.253158
0.0294597
0.0139241
0.00593057
0.00258225
0.00185522
0.00335645
0.00865097
0.0222608
0.0530292
0.112402
0.029458
0.0139233
0.00593015
0.00258198
0.00185485
0.00335564
0.00864909
0.0222567
0.0530209
0.112387
0.0294568
0.0139227
0.00592989
0.00258181
0.00185462
0.00335514
0.00864792
0.0222541
0.0530158
0.112378
0.0294563
0.0139225
0.00592976
0.00258173
0.0018545
0.00335487
0.00864729
0.0222527
0.053013
0.112373
0.0294564
0.0139225
0.0059298
0.00258174
0.00185447
0.00335479
0.0086471
0.0222523
0.0530122
0.112371
0.0294572
0.013923
0.00593003
0.00258185
0.00185453
0.00335486
0.00864726
0.0222527
0.0530131
0.112373
0.0294591
0.013924
0.00593051
0.00258207
0.00185468
0.00335508
0.00864776
0.0222539
0.0530158
0.112379
0.0294622
0.0139256
0.00593129
0.00258245
0.00185493
0.00335544
0.00864858
0.0222559
0.0530202
0.112387
0.0294669
0.0139281
0.00593247
0.002583
0.00185528
0.00335593
0.00864972
0.0222586
0.0530265
0.1124
0.0294735
0.0139316
0.00593414
0.00258378
0.00185576
0.00335657
0.00865118
0.0222622
0.0530347
0.112418
0.0119034
0.00615727
0.00284606
0.00134101
0.00102268
0.001811
0.00441557
0.0106359
0.0234264
0.0454035
0.0119027
0.00615685
0.00284585
0.00134086
0.00102248
0.00181056
0.00441459
0.0106338
0.0234226
0.0453974
0.0119021
0.00615659
0.00284571
0.00134076
0.00102234
0.00181028
0.00441397
0.0106326
0.0234202
0.0453933
0.0119019
0.00615646
0.00284565
0.00134072
0.00102228
0.00181013
0.00441364
0.0106319
0.0234188
0.0453911
0.011902
0.00615651
0.00284567
0.00134072
0.00102226
0.00181008
0.00441353
0.0106317
0.0234184
0.0453904
0.0119024
0.00615675
0.0028458
0.00134079
0.0010223
0.00181012
0.00441362
0.0106319
0.0234189
0.0453913
0.0119032
0.00615725
0.00284605
0.00134092
0.00102239
0.00181026
0.00441391
0.0106325
0.0234203
0.0453938
0.0119047
0.00615808
0.00284648
0.00134113
0.00102254
0.00181047
0.00441439
0.0106336
0.0234225
0.045398
0.0119069
0.00615933
0.00284712
0.00134145
0.00102276
0.00181078
0.00441507
0.0106352
0.0234258
0.0454043
0.01191
0.00616111
0.00284802
0.0013419
0.00102305
0.0018112
0.00441597
0.0106372
0.0234303
0.0454129
0.00449552
0.00248195
0.00122612
0.00061973
0.000498399
0.000864475
0.00200373
0.00455892
0.00943174
0.0171414
0.0044952
0.00248177
0.00122602
0.000619657
0.000498295
0.000864261
0.00200328
0.00455803
0.00943016
0.0171389
0.00449499
0.00248166
0.00122596
0.00061961
0.000498228
0.000864124
0.00200299
0.00455745
0.00942912
0.0171373
0.00449489
0.00248161
0.00122593
0.000619588
0.000498193
0.000864049
0.00200283
0.00455713
0.00942855
0.0171364
0.00449492
0.00248163
0.00122594
0.000619592
0.000498186
0.000864026
0.00200278
0.00455703
0.00942838
0.0171361
0.00449511
0.00248174
0.00122601
0.000619624
0.000498206
0.00086405
0.00200283
0.00455714
0.00942861
0.0171365
0.00449549
0.00248197
0.00122613
0.000619691
0.000498255
0.00086412
0.00200297
0.00455746
0.00942923
0.0171376
0.00449613
0.00248236
0.00122634
0.000619802
0.000498337
0.000864238
0.00200322
0.00455799
0.00943028
0.0171395
0.0044971
0.00248293
0.00122665
0.000619967
0.000498456
0.000864408
0.00200358
0.00455877
0.00943184
0.0171422
0.00449845
0.00248374
0.00122708
0.000620198
0.000498619
0.000864637
0.00200406
0.00455983
0.009434
0.0171461
0.00160531
0.000930304
0.000485198
0.000260717
0.000219465
0.000373409
0.000827626
0.00179406
0.00353037
0.00611853
0.00160519
0.000930231
0.000485156
0.000260684
0.000219418
0.000373314
0.000827433
0.0017937
0.00352975
0.00611759
0.00160511
0.000930184
0.000485129
0.000260663
0.000219387
0.000373252
0.000827307
0.00179346
0.00352934
0.00611696
0.00160507
0.000930164
0.000485118
0.000260653
0.000219371
0.000373219
0.000827237
0.00179332
0.00352911
0.0061166
0.00160509
0.000930176
0.000485124
0.000260655
0.000219368
0.000373209
0.000827216
0.00179329
0.00352905
0.00611651
0.00160516
0.000930225
0.000485152
0.00026067
0.000219378
0.000373221
0.00082724
0.00179334
0.00352915
0.00611668
0.00160532
0.000930323
0.000485208
0.000260701
0.000219402
0.000373255
0.000827308
0.00179348
0.00352941
0.00611713
0.00160558
0.000930486
0.0004853
0.000260753
0.000219442
0.000373312
0.000827424
0.00179372
0.00352987
0.00611791
0.00160598
0.000930731
0.000485437
0.00026083
0.000219501
0.000373396
0.000827595
0.00179407
0.00353055
0.00611907
0.00160653
0.000931075
0.000485631
0.000260938
0.000219581
0.00037351
0.000827826
0.00179456
0.00353149
0.0061207
0.000545303
0.000327994
0.0001789
0.000101375
8.87028e-05
0.000148298
0.000316065
0.000657609
0.00124275
0.00207739
0.000545256
0.000327966
0.000178883
0.000101362
8.86829e-05
0.000148259
0.000315989
0.000657469
0.00124252
0.00207705
0.000545226
0.000327948
0.000178872
0.000101353
8.867e-05
0.000148234
0.000315938
0.000657377
0.00124237
0.00207682
0.000545213
0.000327941
0.000178868
0.000101349
8.86632e-05
0.00014822
0.000315911
0.000657326
0.00124228
0.00207669
0.00054522
0.000327946
0.000178871
0.00010135
8.86621e-05
0.000148216
0.000315903
0.000657312
0.00124226
0.00207666
0.000545251
0.000327966
0.000178883
0.000101356
8.86665e-05
0.000148222
0.000315913
0.000657333
0.0012423
0.00207673
0.000545312
0.000328005
0.000178906
0.00010137
8.86772e-05
0.000148237
0.000315942
0.000657391
0.00124241
0.0020769
0.000545414
0.00032807
0.000178944
0.000101392
8.86951e-05
0.000148262
0.000315993
0.000657491
0.00124259
0.00207721
0.000545566
0.000328168
0.000179
0.000101425
8.87215e-05
0.0001483
0.000316067
0.000657641
0.00124287
0.00207766
0.000545778
0.000328304
0.00017908
0.000101472
8.87578e-05
0.000148352
0.000316169
0.000657846
0.00124325
0.00207831
0.000176995
0.000109688
6.2137e-05
3.68867e-05
3.33554e-05
5.48809e-05
0.000113008
0.000227002
0.000414885
0.000673916
0.000176979
0.000109678
6.21306e-05
3.68813e-05
3.33476e-05
5.48661e-05
0.000112979
0.000226951
0.000414804
0.0006738
0.000176969
0.000109672
6.21267e-05
3.68779e-05
3.33425e-05
5.48564e-05
0.000112961
0.000226917
0.000414749
0.000673721
0.000176964
0.000109669
6.21252e-05
3.68764e-05
3.33399e-05
5.48511e-05
0.00011295
0.000226899
0.000414719
0.000673676
0.000176967
0.000109671
6.21263e-05
3.68768e-05
3.33395e-05
5.48497e-05
0.000112947
0.000226894
0.000414712
0.000673667
0.000176979
0.000109679
6.21309e-05
3.68794e-05
3.33414e-05
5.4852e-05
0.000112952
0.000226903
0.000414727
0.000673693
0.000177001
0.000109694
6.21399e-05
3.68849e-05
3.33458e-05
5.48582e-05
0.000112964
0.000226925
0.000414768
0.000673758
0.000177038
0.000109718
6.21546e-05
3.68939e-05
3.33533e-05
5.48689e-05
0.000112984
0.000226965
0.000414838
0.00067387
0.000177094
0.000109754
6.21766e-05
3.69073e-05
3.33643e-05
5.48847e-05
0.000113014
0.000227023
0.000414943
0.00067404
0.000177171
0.000109805
6.22071e-05
3.69258e-05
3.33795e-05
5.49062e-05
0.000113056
0.000227104
0.00041509
0.000674278
5.56506e-05
3.55167e-05
2.08437e-05
1.29192e-05
1.203e-05
1.94951e-05
3.88867e-05
7.56401e-05
0.000134073
0.000211755
5.5645e-05
3.55131e-05
2.08414e-05
1.29172e-05
1.20271e-05
1.94896e-05
3.88765e-05
7.56224e-05
0.000134045
0.000211716
5.56415e-05
3.55109e-05
2.084e-05
1.29159e-05
1.20252e-05
1.9486e-05
3.88698e-05
7.56106e-05
0.000134027
0.00021169
5.56402e-05
3.55101e-05
2.08395e-05
1.29153e-05
1.20242e-05
1.94841e-05
3.8866e-05
7.56041e-05
0.000134016
0.000211675
5.56413e-05
3.55109e-05
2.08399e-05
1.29155e-05
1.2024e-05
1.94836e-05
3.88651e-05
7.56025e-05
0.000134014
0.000211672
5.56454e-05
3.55137e-05
2.08417e-05
1.29165e-05
1.20248e-05
1.94845e-05
3.88668e-05
7.56058e-05
0.00013402
0.000211682
5.56535e-05
3.55192e-05
2.0845e-05
1.29187e-05
1.20266e-05
1.9487e-05
3.88714e-05
7.56145e-05
0.000134035
0.000211705
5.56666e-05
3.5528e-05
2.08505e-05
1.29222e-05
1.20296e-05
1.94913e-05
3.88793e-05
7.56293e-05
0.000134061
0.000211746
5.56863e-05
3.55412e-05
2.08587e-05
1.29273e-05
1.2034e-05
1.94976e-05
3.8891e-05
7.56514e-05
0.000134099
0.000211806
5.57134e-05
3.55595e-05
2.087e-05
1.29344e-05
1.204e-05
1.95061e-05
3.89071e-05
7.56819e-05
0.000134153
0.000211891
1.96816e-05
1.3334e-05
8.16816e-06
5.29106e-06
5.06506e-06
8.08676e-06
1.56354e-05
2.94184e-05
5.02122e-05
7.48256e-05
1.96797e-05
1.33327e-05
8.16728e-06
5.29023e-06
5.06383e-06
8.08451e-06
1.56313e-05
2.94116e-05
5.02019e-05
7.48119e-05
1.96784e-05
1.33319e-05
8.1667e-06
5.28968e-06
5.063e-06
8.08298e-06
1.56285e-05
2.94068e-05
5.01946e-05
7.48021e-05
1.96779e-05
1.33316e-05
8.16649e-06
5.28944e-06
5.06257e-06
8.08214e-06
1.5627e-05
2.94042e-05
5.01906e-05
7.47967e-05
1.96784e-05
1.33319e-05
8.16671e-06
5.28953e-06
5.06253e-06
8.08195e-06
1.56266e-05
2.94036e-05
5.01898e-05
7.47958e-05
1.968e-05
1.33331e-05
8.16748e-06
5.29001e-06
5.0629e-06
8.08241e-06
1.56274e-05
2.94051e-05
5.01924e-05
7.47996e-05
1.96833e-05
1.33354e-05
8.16896e-06
5.29097e-06
5.06373e-06
8.08357e-06
1.56295e-05
2.94089e-05
5.01988e-05
7.48091e-05
1.96885e-05
1.33392e-05
8.17137e-06
5.29255e-06
5.06513e-06
8.08555e-06
1.56331e-05
2.94154e-05
5.02097e-05
7.48252e-05
1.96962e-05
1.33446e-05
8.17489e-06
5.29487e-06
5.06716e-06
8.08844e-06
1.56383e-05
2.94251e-05
5.02259e-05
7.48493e-05
1.97066e-05
1.3352e-05
8.17962e-06
5.29796e-06
5.06986e-06
8.09225e-06
1.56453e-05
2.94379e-05
5.02478e-05
7.48823e-05
1.35744
1.60418
1.67942
1.7034
1.71115
1.71366
1.7145
1.71483
1.71503
1.71518
1.35731
1.60402
1.67926
1.70324
1.71099
1.7135
1.71434
1.71467
1.71488
1.71506
1.35723
1.60394
1.67917
1.70315
1.7109
1.71341
1.71425
1.71459
1.7148
1.715
1.3572
1.60389
1.67912
1.7031
1.71085
1.71336
1.71421
1.71455
1.71477
1.71497
1.35718
1.60388
1.67911
1.70309
1.71084
1.71335
1.7142
1.71454
1.71476
1.71496
1.3572
1.6039
1.67913
1.70311
1.71087
1.71338
1.71422
1.71457
1.71479
1.71499
1.35724
1.60395
1.67918
1.70317
1.71093
1.71344
1.71429
1.71463
1.71486
1.71506
1.35731
1.60404
1.67928
1.70327
1.71103
1.71355
1.71439
1.71474
1.71496
1.71517
1.35741
1.60417
1.67942
1.70342
1.71118
1.7137
1.71455
1.71489
1.71512
1.71532
1.35753
1.60432
1.67959
1.7036
1.71136
1.71388
1.71473
1.71508
1.7153
1.7155
0.519741
0.650913
0.703314
0.722517
0.729198
0.73144
0.732185
0.732454
0.732586
0.732684
0.519689
0.650851
0.703248
0.72245
0.72913
0.731372
0.732118
0.732389
0.732526
0.73264
0.519656
0.65081
0.703205
0.722406
0.729086
0.731329
0.732075
0.732348
0.732489
0.732608
0.519638
0.650789
0.703182
0.722382
0.729063
0.731306
0.732053
0.732327
0.73247
0.732591
0.519633
0.650783
0.703175
0.722376
0.729057
0.731301
0.732049
0.732324
0.732468
0.73259
0.51964
0.650792
0.703186
0.722388
0.729069
0.731313
0.732062
0.732338
0.732482
0.732604
0.519659
0.650817
0.703214
0.722418
0.729101
0.731345
0.732094
0.732371
0.732515
0.732638
0.519692
0.65086
0.703263
0.722469
0.729154
0.731399
0.732149
0.732425
0.73257
0.732693
0.519739
0.650923
0.703334
0.722544
0.729231
0.731477
0.732227
0.732504
0.732649
0.732772
0.519802
0.651007
0.70343
0.722645
0.729334
0.731581
0.732332
0.732609
0.732754
0.732878
0.198199
0.253033
0.279565
0.290678
0.294924
0.296444
0.296968
0.297154
0.297237
0.297293
0.198177
0.253007
0.279537
0.29065
0.294895
0.296415
0.296939
0.297127
0.297212
0.297275
0.198163
0.25299
0.279518
0.29063
0.294875
0.296396
0.29692
0.297109
0.297195
0.297261
0.198155
0.25298
0.279508
0.29062
0.294865
0.296385
0.29691
0.297099
0.297187
0.297253
0.198153
0.252978
0.279505
0.290617
0.294862
0.296383
0.296909
0.297098
0.297186
0.297253
0.198156
0.252982
0.27951
0.290623
0.294868
0.296389
0.296915
0.297105
0.297193
0.29726
0.198165
0.252994
0.279524
0.290637
0.294883
0.296404
0.296931
0.297121
0.297209
0.297276
0.19818
0.253013
0.279547
0.290661
0.294909
0.29643
0.296957
0.297147
0.297235
0.297302
0.198203
0.253043
0.279581
0.290698
0.294946
0.296468
0.296995
0.297185
0.297274
0.297341
0.198234
0.253085
0.279628
0.290749
0.294998
0.296521
0.297048
0.297239
0.297327
0.297395
0.073667
0.0943996
0.105854
0.111197
0.11342
0.114269
0.114577
0.114688
0.114735
0.114764
0.0736585
0.0943894
0.105843
0.111186
0.113408
0.114258
0.114565
0.114677
0.114725
0.114757
0.0736526
0.0943822
0.105835
0.111178
0.1134
0.11425
0.114557
0.114669
0.114718
0.114751
0.0736493
0.0943783
0.105831
0.111173
0.113395
0.114245
0.114553
0.114665
0.114714
0.114748
0.0736485
0.0943773
0.10583
0.111172
0.113394
0.114244
0.114552
0.114665
0.114714
0.114748
0.0736499
0.0943792
0.105832
0.111175
0.113397
0.114247
0.114555
0.114668
0.114717
0.114751
0.0736538
0.0943843
0.105838
0.111181
0.113404
0.114254
0.114562
0.114675
0.114724
0.114758
0.0736605
0.0943931
0.105848
0.111192
0.113415
0.114266
0.114574
0.114687
0.114736
0.11477
0.0736706
0.0944064
0.105864
0.111209
0.113432
0.114283
0.114592
0.114705
0.114754
0.114788
0.0736848
0.0944252
0.105885
0.111232
0.113457
0.114308
0.114617
0.114729
0.114779
0.114813
0.0264331
0.0338014
0.0382711
0.0405407
0.0415554
0.0419674
0.0421237
0.0421819
0.042206
0.0422199
0.0264298
0.0337975
0.0382668
0.0405362
0.0415508
0.0419629
0.0421192
0.0421775
0.0422021
0.0422172
0.0264275
0.0337947
0.0382637
0.040533
0.0415476
0.0419597
0.0421161
0.0421745
0.0421994
0.0422149
0.0264262
0.0337931
0.038262
0.0405313
0.0415458
0.0419579
0.0421144
0.042173
0.042198
0.0422137
0.0264259
0.0337928
0.0382616
0.0405309
0.0415454
0.0419576
0.0421142
0.0421728
0.0421979
0.0422137
0.0264265
0.0337936
0.0382626
0.040532
0.0415466
0.0419588
0.0421155
0.0421741
0.0421993
0.0422151
0.0264281
0.0337958
0.0382651
0.0405347
0.0415495
0.0419618
0.0421185
0.0421772
0.0422024
0.0422182
0.026431
0.0337995
0.0382694
0.0405394
0.0415544
0.0419668
0.0421235
0.0421823
0.0422075
0.0422234
0.0264353
0.0338051
0.038276
0.0405465
0.0415618
0.0419744
0.0421312
0.04219
0.0422152
0.0422311
0.0264414
0.0338131
0.0382853
0.0405566
0.0415723
0.041985
0.0421419
0.0422008
0.042226
0.042242
0.00912089
0.0116163
0.0132355
0.0141147
0.0145323
0.0147111
0.014782
0.0148092
0.0148205
0.0148267
0.00911965
0.0116148
0.0132339
0.014113
0.0145305
0.0147094
0.0147803
0.0148076
0.014819
0.0148257
0.00911879
0.0116138
0.0132328
0.0141118
0.0145293
0.0147082
0.0147791
0.0148065
0.014818
0.0148248
0.00911831
0.0116132
0.0132322
0.0141111
0.0145287
0.0147075
0.0147785
0.0148059
0.0148175
0.0148244
0.0091182
0.0116131
0.013232
0.014111
0.0145286
0.0147074
0.0147784
0.0148058
0.0148175
0.0148244
0.00911845
0.0116134
0.0132324
0.0141115
0.014529
0.0147079
0.014779
0.0148064
0.0148181
0.014825
0.00911912
0.0116143
0.0132334
0.0141126
0.0145302
0.0147091
0.0147802
0.0148076
0.0148193
0.0148263
0.00912027
0.0116158
0.0132352
0.0141145
0.0145322
0.0147112
0.0147822
0.0148097
0.0148214
0.0148284
0.00912201
0.011618
0.0132378
0.0141174
0.0145352
0.0147142
0.0147854
0.0148128
0.0148246
0.0148315
0.00912447
0.0116212
0.0132416
0.0141214
0.0145395
0.0147186
0.0147897
0.0148172
0.014829
0.0148359
0.00302278
0.00383258
0.00438489
0.00470118
0.00485923
0.00493011
0.00495938
0.00497096
0.00497582
0.00497838
0.00302234
0.00383205
0.00438432
0.00470057
0.00485861
0.0049295
0.00495877
0.00497038
0.00497529
0.00497803
0.00302204
0.00383169
0.00438392
0.00470015
0.00485818
0.00492907
0.00495835
0.00496998
0.00497494
0.00497774
0.00302187
0.00383149
0.00438369
0.00469992
0.00485795
0.00492884
0.00495813
0.00496978
0.00497476
0.00497758
0.00302183
0.00383145
0.00438365
0.00469988
0.00485791
0.00492881
0.00495812
0.00496977
0.00497476
0.0049776
0.00302193
0.00383158
0.00438381
0.00470006
0.0048581
0.00492901
0.00495832
0.00496999
0.00497498
0.00497782
0.00302218
0.00383191
0.0043842
0.00470048
0.00485855
0.00492947
0.00495879
0.00497046
0.00497547
0.00497831
0.00302262
0.00383247
0.00438486
0.00470121
0.00485932
0.00493025
0.00495959
0.00497127
0.00497627
0.00497912
0.00302329
0.00383334
0.00438587
0.00470231
0.00486047
0.00493144
0.00496079
0.00497247
0.00497748
0.00498033
0.00302423
0.00383456
0.0043873
0.00470387
0.0048621
0.0049331
0.00496247
0.00497416
0.00497918
0.00498204
0.000962413
0.00121473
0.00139351
0.00150039
0.00155613
0.00158215
0.0015933
0.00159784
0.00159977
0.00160077
0.000962263
0.00121456
0.00139331
0.00150018
0.00155592
0.00158194
0.00159309
0.00159764
0.00159959
0.00160065
0.000962159
0.00121443
0.00139317
0.00150004
0.00155577
0.0015818
0.00159295
0.00159751
0.00159947
0.00160055
0.000962102
0.00121436
0.0013931
0.00149996
0.00155569
0.00158172
0.00159287
0.00159744
0.00159941
0.0016005
0.00096209
0.00121435
0.00139309
0.00149995
0.00155569
0.00158171
0.00159287
0.00159744
0.00159942
0.00160051
0.000962128
0.0012144
0.00139315
0.00150002
0.00155576
0.00158179
0.00159295
0.00159752
0.0015995
0.00160059
0.000962221
0.00121452
0.00139329
0.00150017
0.00155592
0.00158196
0.00159312
0.00159769
0.00159968
0.00160077
0.000962382
0.00121473
0.00139353
0.00150044
0.0015562
0.00158224
0.00159341
0.00159799
0.00159997
0.00160107
0.000962625
0.00121504
0.00139389
0.00150084
0.00155662
0.00158268
0.00159385
0.00159843
0.00160041
0.00160151
0.000962969
0.00121548
0.00139441
0.0015014
0.00155721
0.00158328
0.00159446
0.00159905
0.00160103
0.00160214
0.000295343
0.000370366
0.000425396
0.000459541
0.000478019
0.000486956
0.000490909
0.000492567
0.000493281
0.000493647
0.000295294
0.000370308
0.000425332
0.000459474
0.000477951
0.000486887
0.000490841
0.000492501
0.000493223
0.000493609
0.00029526
0.000370269
0.000425288
0.000459428
0.000477903
0.000486839
0.000490795
0.000492458
0.000493184
0.000493578
0.000295241
0.000370247
0.000425264
0.000459402
0.000477878
0.000486814
0.000490771
0.000492436
0.000493165
0.000493561
0.000295238
0.000370243
0.000425261
0.0004594
0.000477876
0.000486814
0.000490771
0.000492437
0.000493168
0.000493565
0.000295251
0.000370261
0.000425282
0.000459423
0.000477901
0.00048684
0.000490798
0.000492465
0.000493197
0.000493595
0.000295284
0.000370302
0.000425331
0.000459477
0.000477958
0.000486899
0.000490858
0.000492526
0.000493259
0.000493657
0.00029534
0.000370374
0.000425414
0.000459569
0.000478055
0.000486998
0.00049096
0.000492628
0.000493361
0.00049376
0.000295425
0.000370482
0.00042554
0.000459708
0.000478201
0.000487149
0.000491112
0.000492782
0.000493516
0.000493915
0.000295544
0.000370634
0.000425718
0.000459903
0.000478407
0.00048736
0.000491326
0.000492997
0.000493732
0.000494133
8.94095e-05
0.000109123
0.000124975
0.00013528
0.000141062
0.000143951
0.000145268
0.000145835
0.000146083
0.00014621
8.93937e-05
0.000109105
0.000124956
0.000135259
0.000141041
0.00014393
0.000145246
0.000145814
0.000146065
0.000146198
8.93829e-05
0.000109092
0.000124942
0.000135245
0.000141026
0.000143915
0.000145232
0.0001458
0.000146053
0.000146188
8.93769e-05
0.000109085
0.000124934
0.000135237
0.000141018
0.000143907
0.000145225
0.000145794
0.000146047
0.000146183
8.93761e-05
0.000109085
0.000124934
0.000135237
0.000141018
0.000143907
0.000145225
0.000145795
0.000146048
0.000146185
8.93808e-05
0.000109091
0.000124941
0.000135244
0.000141027
0.000143916
0.000145234
0.000145804
0.000146058
0.000146195
8.9392e-05
0.000109104
0.000124957
0.000135262
0.000141046
0.000143936
0.000145255
0.000145824
0.000146079
0.000146216
8.94113e-05
0.000109128
0.000124985
0.000135293
0.000141078
0.000143969
0.000145288
0.000145858
0.000146113
0.00014625
8.94403e-05
0.000109164
0.000125026
0.000135339
0.000141126
0.000144019
0.000145339
0.000145909
0.000146164
0.000146301
8.9481e-05
0.000109214
0.000125085
0.000135403
0.000141194
0.000144089
0.00014541
0.000145981
0.000146236
0.000146374
373.033
373.033
373.032
373.032
373.032
373.032
373.032
373.032
373.033
373.033
373.033
373.032
373.032
373.031
373.031
373.031
373.031
373.032
373.032
373.032
373.032
373.032
373.031
373.031
373.031
373.031
373.031
373.031
373.032
373.032
373.032
373.031
373.031
373.031
373.031
373.031
373.031
373.031
373.031
373.032
373.032
373.031
373.031
373.031
373.031
373.031
373.031
373.031
373.031
373.032
373.032
373.031
373.031
373.031
373.031
373.031
373.031
373.031
373.031
373.032
373.032
373.031
373.031
373.031
373.031
373.031
373.031
373.031
373.031
373.032
373.032
373.032
373.031
373.031
373.031
373.031
373.031
373.031
373.032
373.032
373.033
373.032
373.032
373.031
373.031
373.031
373.031
373.032
373.032
373.032
373.033
373.032
373.032
373.032
373.032
373.032
373.032
373.032
373.032
373.033
282.797
282.796
282.795
282.794
282.794
282.794
282.794
282.794
282.795
282.796
282.796
282.794
282.793
282.792
282.792
282.792
282.792
282.793
282.794
282.795
282.795
282.793
282.792
282.791
282.791
282.791
282.791
282.792
282.793
282.794
282.794
282.792
282.791
282.791
282.79
282.79
282.791
282.791
282.792
282.793
282.794
282.792
282.791
282.79
282.79
282.79
282.791
282.791
282.792
282.793
282.794
282.792
282.791
282.79
282.79
282.79
282.791
282.791
282.792
282.793
282.794
282.792
282.791
282.791
282.791
282.791
282.791
282.792
282.792
282.794
282.794
282.793
282.792
282.791
282.791
282.791
282.792
282.792
282.793
282.794
282.795
282.794
282.793
282.792
282.792
282.792
282.792
282.793
282.794
282.795
282.796
282.795
282.794
282.793
282.793
282.793
282.794
282.794
282.795
282.796
202.776
202.774
202.773
202.772
202.771
202.772
202.772
202.773
202.774
202.775
202.774
202.772
202.771
202.77
202.769
202.769
202.77
202.771
202.772
202.774
202.773
202.771
202.769
202.768
202.768
202.768
202.769
202.769
202.771
202.772
202.772
202.77
202.768
202.768
202.767
202.767
202.768
202.769
202.77
202.772
202.771
202.769
202.768
202.767
202.767
202.767
202.767
202.768
202.77
202.772
202.771
202.769
202.768
202.767
202.767
202.767
202.768
202.769
202.77
202.772
202.772
202.77
202.769
202.768
202.767
202.768
202.768
202.769
202.77
202.772
202.773
202.771
202.769
202.769
202.768
202.769
202.769
202.77
202.771
202.773
202.774
202.772
202.771
202.77
202.77
202.77
202.77
202.771
202.773
202.775
202.775
202.774
202.772
202.772
202.772
202.772
202.772
202.773
202.775
202.777
137.21
137.208
137.206
137.206
137.205
137.205
137.206
137.207
137.208
137.209
137.208
137.206
137.204
137.203
137.203
137.203
137.204
137.205
137.206
137.208
137.206
137.204
137.203
137.202
137.202
137.202
137.202
137.203
137.205
137.207
137.205
137.203
137.202
137.201
137.201
137.201
137.202
137.203
137.204
137.206
137.205
137.203
137.202
137.201
137.2
137.201
137.201
137.202
137.204
137.206
137.205
137.203
137.202
137.201
137.201
137.201
137.201
137.202
137.204
137.206
137.206
137.204
137.202
137.201
137.201
137.201
137.202
137.203
137.205
137.207
137.207
137.205
137.203
137.203
137.202
137.202
137.203
137.204
137.206
137.208
137.208
137.206
137.205
137.204
137.204
137.204
137.205
137.206
137.207
137.21
137.209
137.208
137.207
137.206
137.206
137.206
137.207
137.208
137.21
137.212
87.5008
87.499
87.4978
87.4971
87.4969
87.497
87.4975
87.4983
87.4996
87.5012
87.4989
87.4971
87.4959
87.4953
87.495
87.4951
87.4956
87.4966
87.498
87.5
87.4976
87.4958
87.4947
87.494
87.4937
87.4939
87.4944
87.4954
87.4969
87.4991
87.4968
87.495
87.4939
87.4932
87.493
87.4931
87.4937
87.4947
87.4963
87.4985
87.4965
87.4947
87.4936
87.4929
87.4927
87.4929
87.4934
87.4945
87.4961
87.4983
87.4966
87.4948
87.4937
87.493
87.4928
87.493
87.4936
87.4947
87.4963
87.4985
87.497
87.4953
87.4942
87.4936
87.4934
87.4936
87.4942
87.4953
87.4969
87.4992
87.4979
87.4962
87.4952
87.4946
87.4945
87.4947
87.4953
87.4964
87.498
87.5003
87.4992
87.4977
87.4967
87.4962
87.4961
87.4963
87.4969
87.498
87.4997
87.5019
87.5008
87.4997
87.4989
87.4984
87.4983
87.4985
87.4992
87.5003
87.5019
87.5042
52.5628
52.5617
52.5611
52.5608
52.5607
52.5609
52.5613
52.5621
52.5633
52.5647
52.5613
52.5602
52.5596
52.5593
52.5592
52.5594
52.5599
52.5607
52.562
52.5637
52.5603
52.5592
52.5586
52.5583
52.5582
52.5584
52.5589
52.5598
52.5612
52.563
52.5597
52.5586
52.558
52.5577
52.5576
52.5579
52.5584
52.5593
52.5607
52.5626
52.5595
52.5583
52.5578
52.5575
52.5574
52.5577
52.5582
52.5591
52.5605
52.5625
52.5595
52.5584
52.5579
52.5576
52.5576
52.5578
52.5584
52.5593
52.5607
52.5627
52.56
52.5589
52.5583
52.5581
52.5581
52.5583
52.5589
52.5598
52.5613
52.5632
52.5607
52.5597
52.5592
52.559
52.559
52.5592
52.5598
52.5608
52.5622
52.5642
52.5619
52.561
52.5605
52.5604
52.5604
52.5607
52.5612
52.5622
52.5636
52.5656
52.5633
52.5627
52.5624
52.5623
52.5623
52.5626
52.5632
52.5642
52.5656
52.5676
29.746
29.7462
29.7469
29.7474
29.7477
29.748
29.7484
29.7491
29.75
29.7511
29.745
29.7452
29.7458
29.7463
29.7466
29.7469
29.7474
29.7481
29.7491
29.7505
29.7443
29.7445
29.7451
29.7456
29.7459
29.7463
29.7467
29.7474
29.7485
29.75
29.7438
29.7441
29.7447
29.7452
29.7455
29.7459
29.7463
29.7471
29.7482
29.7497
29.7437
29.7439
29.7445
29.745
29.7454
29.7457
29.7462
29.747
29.7481
29.7496
29.7438
29.744
29.7446
29.7451
29.7455
29.7458
29.7463
29.7471
29.7482
29.7497
29.7441
29.7443
29.745
29.7455
29.7459
29.7463
29.7468
29.7475
29.7486
29.7502
29.7447
29.745
29.7457
29.7462
29.7466
29.747
29.7475
29.7483
29.7494
29.7509
29.7456
29.746
29.7467
29.7473
29.7477
29.7481
29.7486
29.7494
29.7505
29.752
29.7467
29.7474
29.7482
29.7488
29.7492
29.7496
29.7501
29.7509
29.752
29.7536
15.8621
15.8659
15.8697
15.872
15.8731
15.8737
15.8741
15.8747
15.8753
15.8761
15.8614
15.8652
15.869
15.8713
15.8724
15.873
15.8735
15.874
15.8747
15.8757
15.8609
15.8648
15.8686
15.8709
15.872
15.8726
15.8731
15.8736
15.8744
15.8754
15.8606
15.8645
15.8683
15.8706
15.8717
15.8723
15.8728
15.8734
15.8742
15.8752
15.8605
15.8644
15.8682
15.8705
15.8716
15.8723
15.8727
15.8733
15.8741
15.8752
15.8606
15.8645
15.8683
15.8706
15.8717
15.8724
15.8728
15.8734
15.8742
15.8753
15.8609
15.8647
15.8686
15.8709
15.872
15.8726
15.8731
15.8737
15.8745
15.8756
15.8613
15.8652
15.869
15.8714
15.8725
15.8732
15.8737
15.8743
15.8751
15.8761
15.8619
15.8659
15.8698
15.8721
15.8733
15.8739
15.8744
15.875
15.8758
15.8769
15.8628
15.8669
15.8708
15.8732
15.8744
15.875
15.8755
15.8761
15.8769
15.878
7.95544
7.97175
7.98414
7.99049
7.99323
7.99435
7.9949
7.99531
7.99577
7.99632
7.95504
7.97135
7.98375
7.99009
7.99283
7.99396
7.99451
7.99494
7.99543
7.99609
7.95477
7.97108
7.98347
7.98982
7.99256
7.99369
7.99425
7.99469
7.99521
7.9959
7.95461
7.97092
7.98332
7.98966
7.99241
7.99354
7.99411
7.99456
7.99509
7.9958
7.95455
7.97087
7.98326
7.98961
7.99236
7.9935
7.99407
7.99453
7.99507
7.99578
7.9546
7.97092
7.98332
7.98967
7.99242
7.99357
7.99414
7.9946
7.99515
7.99586
7.95476
7.97109
7.9835
7.98986
7.99261
7.99376
7.99433
7.9948
7.99535
7.99606
7.95505
7.97139
7.98381
7.99018
7.99294
7.99409
7.99467
7.99514
7.99569
7.9964
7.95546
7.97184
7.98429
7.99067
7.99344
7.9946
7.99518
7.99565
7.9962
7.99691
7.956
7.97248
7.98497
7.99136
7.99414
7.9953
7.99588
7.99635
7.9969
7.99762
3.68615
3.74902
3.78327
3.79752
3.80284
3.80473
3.80545
3.80582
3.80613
3.80648
3.68595
3.74882
3.78306
3.79731
3.80263
3.80453
3.80525
3.80562
3.80595
3.80637
3.6858
3.74867
3.78291
3.79716
3.80248
3.80438
3.8051
3.80549
3.80583
3.80627
3.68572
3.74858
3.78283
3.79707
3.8024
3.8043
3.80502
3.80541
3.80577
3.80621
3.68569
3.74855
3.7828
3.79705
3.80237
3.80428
3.80501
3.8054
3.80576
3.8062
3.68572
3.74859
3.78284
3.79709
3.80241
3.80432
3.80505
3.80545
3.80581
3.80625
3.68581
3.74869
3.78294
3.7972
3.80253
3.80443
3.80517
3.80556
3.80592
3.80637
3.68598
3.74886
3.78313
3.79739
3.80272
3.80463
3.80537
3.80576
3.80613
3.80657
3.68622
3.74913
3.78341
3.79768
3.80302
3.80493
3.80567
3.80607
3.80643
3.80688
3.68655
3.74952
3.78382
3.79811
3.80345
3.80536
3.8061
3.8065
3.80686
3.80731
1.09036e-05
1.08961e-05
1.08775e-05
1.08318e-05
1.07251e-05
1.04953e-05
1.00484e-05
9.28239e-06
8.17848e-06
7.03148e-06
1.09019e-05
1.08945e-05
1.08759e-05
1.08302e-05
1.07235e-05
1.04938e-05
1.0047e-05
9.28114e-06
8.17745e-06
7.03077e-06
1.09008e-05
1.08934e-05
1.08748e-05
1.08291e-05
1.07224e-05
1.04928e-05
1.00461e-05
9.28036e-06
8.1768e-06
7.03027e-06
1.09003e-05
1.08929e-05
1.08743e-05
1.08286e-05
1.0722e-05
1.04924e-05
1.00457e-05
9.28003e-06
8.17654e-06
7.03007e-06
1.09004e-05
1.0893e-05
1.08744e-05
1.08287e-05
1.07221e-05
1.04925e-05
1.00459e-05
9.28021e-06
8.17672e-06
7.03025e-06
1.09012e-05
1.08938e-05
1.08752e-05
1.08296e-05
1.0723e-05
1.04934e-05
1.00467e-05
9.28099e-06
8.17743e-06
7.03088e-06
1.09029e-05
1.08955e-05
1.0877e-05
1.08313e-05
1.07247e-05
1.04951e-05
1.00484e-05
9.28255e-06
8.17883e-06
7.03211e-06
1.09056e-05
1.08983e-05
1.08798e-05
1.08342e-05
1.07276e-05
1.04979e-05
1.00511e-05
9.2851e-06
8.1811e-06
7.03411e-06
1.09095e-05
1.09024e-05
1.0884e-05
1.08385e-05
1.07319e-05
1.05021e-05
1.00552e-05
9.28886e-06
8.18447e-06
7.03705e-06
1.09147e-05
1.09081e-05
1.08899e-05
1.08444e-05
1.07378e-05
1.05079e-05
1.00607e-05
9.29405e-06
8.18908e-06
7.04107e-06
2.99088e-06
2.98856e-06
2.98279e-06
2.96885e-06
2.93708e-06
2.87048e-06
2.74496e-06
2.53847e-06
2.25942e-06
2.00358e-06
2.99039e-06
2.98808e-06
2.98231e-06
2.96838e-06
2.93662e-06
2.87004e-06
2.74455e-06
2.53811e-06
2.25912e-06
2.00339e-06
2.99007e-06
2.98777e-06
2.982e-06
2.96808e-06
2.93632e-06
2.86976e-06
2.74429e-06
2.53788e-06
2.25894e-06
2.00325e-06
2.98993e-06
2.98762e-06
2.98186e-06
2.96794e-06
2.93619e-06
2.86964e-06
2.74419e-06
2.53779e-06
2.25887e-06
2.00319e-06
2.98997e-06
2.98766e-06
2.9819e-06
2.96799e-06
2.93624e-06
2.86969e-06
2.74424e-06
2.53785e-06
2.25893e-06
2.00325e-06
2.99021e-06
2.98791e-06
2.98216e-06
2.96825e-06
2.93651e-06
2.86995e-06
2.7445e-06
2.53809e-06
2.25915e-06
2.00345e-06
2.99072e-06
2.98843e-06
2.98269e-06
2.96878e-06
2.93704e-06
2.87048e-06
2.74501e-06
2.53857e-06
2.25957e-06
2.00384e-06
2.99154e-06
2.98927e-06
2.98355e-06
2.96965e-06
2.93791e-06
2.87134e-06
2.74583e-06
2.53934e-06
2.26027e-06
2.00447e-06
2.99274e-06
2.99052e-06
2.98483e-06
2.97095e-06
2.93921e-06
2.87261e-06
2.74706e-06
2.54048e-06
2.2613e-06
2.00539e-06
2.99432e-06
2.99226e-06
2.98662e-06
2.97275e-06
2.94099e-06
2.87436e-06
2.74874e-06
2.54205e-06
2.26271e-06
2.00665e-06
7.9104e-07
7.90356e-07
7.88655e-07
7.8462e-07
7.75623e-07
7.57242e-07
7.23646e-07
6.70527e-07
6.02732e-07
5.45925e-07
7.90904e-07
7.90222e-07
7.88522e-07
7.84489e-07
7.75495e-07
7.57119e-07
7.23533e-07
6.70427e-07
6.02649e-07
5.45874e-07
7.90817e-07
7.90135e-07
7.88437e-07
7.84405e-07
7.75413e-07
7.57042e-07
7.23462e-07
6.70365e-07
6.02598e-07
5.45835e-07
7.90778e-07
7.90097e-07
7.88399e-07
7.84369e-07
7.75379e-07
7.5701e-07
7.23433e-07
6.70341e-07
6.02579e-07
5.45821e-07
7.90791e-07
7.9011e-07
7.88414e-07
7.84384e-07
7.75395e-07
7.57028e-07
7.23452e-07
6.7036e-07
6.02598e-07
5.45839e-07
7.90864e-07
7.90185e-07
7.8849e-07
7.84462e-07
7.75473e-07
7.57105e-07
7.23527e-07
6.70431e-07
6.02664e-07
5.459e-07
7.91013e-07
7.90336e-07
7.88643e-07
7.84617e-07
7.75629e-07
7.57258e-07
7.23675e-07
6.70569e-07
6.0279e-07
5.46017e-07
7.91254e-07
7.90582e-07
7.88895e-07
7.84872e-07
7.75883e-07
7.57509e-07
7.23915e-07
6.70794e-07
6.02995e-07
5.46205e-07
7.91604e-07
7.90947e-07
7.89269e-07
7.8525e-07
7.7626e-07
7.57878e-07
7.2427e-07
6.71126e-07
6.03296e-07
5.46481e-07
7.92065e-07
7.91452e-07
7.89788e-07
7.85772e-07
7.76779e-07
7.58387e-07
7.24758e-07
6.71581e-07
6.03708e-07
5.46857e-07
2.01968e-07
2.01775e-07
2.01298e-07
2.00184e-07
1.97753e-07
1.92907e-07
1.84305e-07
1.71198e-07
1.55272e-07
1.42786e-07
2.01932e-07
2.01739e-07
2.01262e-07
2.00149e-07
1.97719e-07
1.92874e-07
1.84275e-07
1.71171e-07
1.55249e-07
1.42772e-07
2.01909e-07
2.01716e-07
2.0124e-07
2.00127e-07
1.97697e-07
1.92854e-07
1.84256e-07
1.71154e-07
1.55236e-07
1.42762e-07
2.01899e-07
2.01706e-07
2.0123e-07
2.00118e-07
1.97688e-07
1.92846e-07
1.84249e-07
1.71148e-07
1.55231e-07
1.42758e-07
2.01903e-07
2.01711e-07
2.01235e-07
2.00122e-07
1.97693e-07
1.92851e-07
1.84254e-07
1.71154e-07
1.55237e-07
1.42764e-07
2.01924e-07
2.01732e-07
2.01256e-07
2.00144e-07
1.97716e-07
1.92873e-07
1.84276e-07
1.71174e-07
1.55256e-07
1.42782e-07
2.01966e-07
2.01774e-07
2.01299e-07
2.00188e-07
1.97759e-07
1.92916e-07
1.84317e-07
1.71213e-07
1.55291e-07
1.42815e-07
2.02033e-07
2.01844e-07
2.0137e-07
2.00259e-07
1.97831e-07
1.92986e-07
1.84384e-07
1.71276e-07
1.55349e-07
1.42869e-07
2.02132e-07
2.01946e-07
2.01475e-07
2.00365e-07
1.97936e-07
1.93089e-07
1.84484e-07
1.71369e-07
1.55434e-07
1.42948e-07
2.02261e-07
2.02087e-07
2.0162e-07
2.00511e-07
1.98081e-07
1.93231e-07
1.8462e-07
1.71496e-07
1.5555e-07
1.43056e-07
4.98358e-08
4.97837e-08
4.96557e-08
4.93618e-08
4.87331e-08
4.75089e-08
4.53951e-08
4.22804e-08
3.86514e-08
3.5946e-08
4.98264e-08
4.97744e-08
4.96465e-08
4.93527e-08
4.87243e-08
4.75005e-08
4.53873e-08
4.22735e-08
3.86456e-08
3.59426e-08
4.98204e-08
4.97685e-08
4.96407e-08
4.9347e-08
4.87187e-08
4.74952e-08
4.53825e-08
4.22693e-08
3.86422e-08
3.594e-08
4.98179e-08
4.9766e-08
4.96382e-08
4.93447e-08
4.87165e-08
4.74932e-08
4.53807e-08
4.22678e-08
3.8641e-08
3.59391e-08
4.98192e-08
4.97673e-08
4.96396e-08
4.93461e-08
4.8718e-08
4.74948e-08
4.53823e-08
4.22694e-08
3.86427e-08
3.59408e-08
4.98249e-08
4.97731e-08
4.96455e-08
4.93521e-08
4.87241e-08
4.75008e-08
4.53881e-08
4.2275e-08
3.86478e-08
3.59457e-08
4.98362e-08
4.97846e-08
4.96572e-08
4.9364e-08
4.87359e-08
4.75124e-08
4.53993e-08
4.22855e-08
3.86576e-08
3.59549e-08
4.98545e-08
4.98034e-08
4.96763e-08
4.93832e-08
4.8755e-08
4.75312e-08
4.54174e-08
4.23025e-08
3.86733e-08
3.59697e-08
4.98811e-08
4.98309e-08
4.97045e-08
4.94117e-08
4.87834e-08
4.7559e-08
4.54441e-08
4.23275e-08
3.86964e-08
3.59913e-08
4.99161e-08
4.98691e-08
4.97436e-08
4.9451e-08
4.88224e-08
4.75971e-08
4.54806e-08
4.23617e-08
3.87279e-08
3.60208e-08
1.1897e-08
1.18835e-08
1.18506e-08
1.17763e-08
1.16203e-08
1.13232e-08
1.08232e-08
1.01084e-08
9.3048e-09
8.72868e-09
1.18946e-08
1.18812e-08
1.18483e-08
1.1774e-08
1.16181e-08
1.13211e-08
1.08212e-08
1.01067e-08
9.30336e-09
8.72784e-09
1.18931e-08
1.18797e-08
1.18469e-08
1.17726e-08
1.16167e-08
1.13198e-08
1.08201e-08
1.01057e-08
9.3025e-09
8.7272e-09
1.18925e-08
1.18791e-08
1.18463e-08
1.1772e-08
1.16162e-08
1.13193e-08
1.08196e-08
1.01053e-08
9.30225e-09
8.72702e-09
1.18929e-08
1.18795e-08
1.18467e-08
1.17724e-08
1.16166e-08
1.13197e-08
1.08201e-08
1.01058e-08
9.3027e-09
8.72747e-09
1.18944e-08
1.1881e-08
1.18482e-08
1.1774e-08
1.16182e-08
1.13213e-08
1.08216e-08
1.01072e-08
9.30406e-09
8.72878e-09
1.18974e-08
1.1884e-08
1.18513e-08
1.17771e-08
1.16213e-08
1.13243e-08
1.08245e-08
1.011e-08
9.30663e-09
8.73121e-09
1.19021e-08
1.18889e-08
1.18562e-08
1.17821e-08
1.16262e-08
1.13292e-08
1.08292e-08
1.01144e-08
9.31075e-09
8.73511e-09
1.19091e-08
1.18961e-08
1.18636e-08
1.17895e-08
1.16336e-08
1.13364e-08
1.08361e-08
1.01209e-08
9.31678e-09
8.74082e-09
1.19182e-08
1.1906e-08
1.18737e-08
1.17997e-08
1.16437e-08
1.13463e-08
1.08456e-08
1.01298e-08
9.32501e-09
8.74859e-09
2.75052e-09
2.74717e-09
2.73906e-09
2.72099e-09
2.68377e-09
2.61434e-09
2.50023e-09
2.34149e-09
2.16834e-09
2.04801e-09
2.74996e-09
2.74662e-09
2.73851e-09
2.72045e-09
2.68324e-09
2.61383e-09
2.49976e-09
2.34107e-09
2.16799e-09
2.04781e-09
2.7496e-09
2.74627e-09
2.73816e-09
2.72011e-09
2.68291e-09
2.61353e-09
2.49948e-09
2.34082e-09
2.16778e-09
2.04766e-09
2.74946e-09
2.74613e-09
2.73803e-09
2.71998e-09
2.68279e-09
2.61342e-09
2.49938e-09
2.34074e-09
2.16773e-09
2.04762e-09
2.74956e-09
2.74623e-09
2.73813e-09
2.72009e-09
2.68291e-09
2.61353e-09
2.4995e-09
2.34086e-09
2.16785e-09
2.04774e-09
2.74995e-09
2.74662e-09
2.73853e-09
2.72049e-09
2.68331e-09
2.61393e-09
2.49989e-09
2.34123e-09
2.1682e-09
2.04807e-09
2.75069e-09
2.74738e-09
2.7393e-09
2.72127e-09
2.68408e-09
2.61469e-09
2.50062e-09
2.34192e-09
2.16885e-09
2.0487e-09
2.75189e-09
2.7486e-09
2.74054e-09
2.72252e-09
2.68533e-09
2.61591e-09
2.5018e-09
2.34304e-09
2.16989e-09
2.04969e-09
2.75363e-09
2.7504e-09
2.74238e-09
2.72437e-09
2.68717e-09
2.61771e-09
2.50353e-09
2.34467e-09
2.17141e-09
2.05113e-09
2.75593e-09
2.75289e-09
2.74492e-09
2.72693e-09
2.6897e-09
2.62019e-09
2.5059e-09
2.3469e-09
2.17349e-09
2.05311e-09
6.16647e-10
6.15846e-10
6.13919e-10
6.0969e-10
6.01127e-10
5.85465e-10
5.60282e-10
5.26089e-10
4.89755e-10
4.65136e-10
6.16515e-10
6.15716e-10
6.1379e-10
6.09564e-10
6.01004e-10
5.85348e-10
5.60173e-10
5.25991e-10
4.89673e-10
4.6509e-10
6.16433e-10
6.15635e-10
6.13711e-10
6.09486e-10
6.00929e-10
5.85276e-10
5.60107e-10
5.25934e-10
4.89626e-10
4.65055e-10
6.16402e-10
6.15604e-10
6.13681e-10
6.09457e-10
6.00902e-10
5.85252e-10
5.60086e-10
5.25917e-10
4.89614e-10
4.65048e-10
6.16428e-10
6.15631e-10
6.13708e-10
6.09485e-10
6.00931e-10
5.85282e-10
5.60116e-10
5.25948e-10
4.89645e-10
4.65078e-10
6.16522e-10
6.15726e-10
6.13805e-10
6.09583e-10
6.01029e-10
5.85379e-10
5.60211e-10
5.26038e-10
4.8973e-10
4.65161e-10
6.16704e-10
6.1591e-10
6.13992e-10
6.09772e-10
6.01217e-10
5.85563e-10
5.60389e-10
5.26207e-10
4.89889e-10
4.65314e-10
6.16996e-10
6.16207e-10
6.14294e-10
6.10076e-10
6.0152e-10
5.8586e-10
5.60674e-10
5.26477e-10
4.90144e-10
4.65557e-10
6.17417e-10
6.16644e-10
6.14739e-10
6.10524e-10
6.01965e-10
5.86296e-10
5.61094e-10
5.26873e-10
4.90515e-10
4.65912e-10
6.17976e-10
6.17247e-10
6.15356e-10
6.11142e-10
6.02577e-10
5.86894e-10
5.61668e-10
5.27414e-10
4.91021e-10
4.66395e-10
1.35204e-10
1.35017e-10
1.34572e-10
1.33609e-10
1.31692e-10
1.28249e-10
1.22827e-10
1.15625e-10
1.08146e-10
1.03185e-10
1.35174e-10
1.34987e-10
1.34543e-10
1.3358e-10
1.31664e-10
1.28223e-10
1.22802e-10
1.15603e-10
1.08127e-10
1.03175e-10
1.35155e-10
1.34969e-10
1.34525e-10
1.33563e-10
1.31647e-10
1.28206e-10
1.22787e-10
1.1559e-10
1.08117e-10
1.03167e-10
1.35148e-10
1.34963e-10
1.34518e-10
1.33557e-10
1.31641e-10
1.28201e-10
1.22782e-10
1.15586e-10
1.08114e-10
1.03166e-10
1.35155e-10
1.34969e-10
1.34525e-10
1.33564e-10
1.31648e-10
1.28209e-10
1.2279e-10
1.15594e-10
1.08122e-10
1.03173e-10
1.35178e-10
1.34992e-10
1.34548e-10
1.33587e-10
1.31672e-10
1.28232e-10
1.22812e-10
1.15616e-10
1.08143e-10
1.03193e-10
1.35221e-10
1.35036e-10
1.34593e-10
1.33632e-10
1.31716e-10
1.28276e-10
1.22855e-10
1.15656e-10
1.08181e-10
1.0323e-10
1.3529e-10
1.35106e-10
1.34664e-10
1.33704e-10
1.31788e-10
1.28346e-10
1.22922e-10
1.1572e-10
1.08241e-10
1.03288e-10
1.3539e-10
1.3521e-10
1.3477e-10
1.3381e-10
1.31893e-10
1.28449e-10
1.23021e-10
1.15814e-10
1.08329e-10
1.03373e-10
1.35522e-10
1.35352e-10
1.34915e-10
1.33955e-10
1.32037e-10
1.2859e-10
1.23157e-10
1.15942e-10
1.0845e-10
1.03488e-10
3.41204e-11
3.40708e-11
3.39526e-11
3.37007e-11
3.32078e-11
3.23398e-11
3.10008e-11
2.92614e-11
2.74943e-11
2.63446e-11
3.41128e-11
3.40633e-11
3.39452e-11
3.36934e-11
3.32007e-11
3.23331e-11
3.09945e-11
2.92558e-11
2.74896e-11
2.63421e-11
3.41081e-11
3.40586e-11
3.39406e-11
3.36889e-11
3.31963e-11
3.23289e-11
3.09907e-11
2.92524e-11
2.74869e-11
2.63401e-11
3.41064e-11
3.40569e-11
3.3939e-11
3.36873e-11
3.31949e-11
3.23276e-11
3.09896e-11
2.92516e-11
2.74863e-11
2.63399e-11
3.41083e-11
3.40588e-11
3.3941e-11
3.36894e-11
3.3197e-11
3.23298e-11
3.09918e-11
2.92538e-11
2.74885e-11
2.63421e-11
3.41146e-11
3.40652e-11
3.39474e-11
3.36959e-11
3.32035e-11
3.23362e-11
3.0998e-11
2.92598e-11
2.74942e-11
2.63476e-11
3.41265e-11
3.40772e-11
3.39596e-11
3.37082e-11
3.32157e-11
3.23482e-11
3.10096e-11
2.92708e-11
2.75047e-11
2.63578e-11
3.41455e-11
3.40965e-11
3.39792e-11
3.37279e-11
3.32353e-11
3.23674e-11
3.10281e-11
2.92884e-11
2.75214e-11
2.63739e-11
3.41727e-11
3.41247e-11
3.40079e-11
3.37567e-11
3.32639e-11
3.23954e-11
3.10551e-11
2.9314e-11
2.75456e-11
2.63971e-11
3.42077e-11
3.41624e-11
3.40464e-11
3.37953e-11
3.33022e-11
3.24328e-11
3.1091e-11
2.93481e-11
2.75777e-11
2.64281e-11
2.67979e-05
3.11838e-05
3.54045e-05
3.83348e-05
4.00465e-05
4.09293e-05
4.13432e-05
4.15258e-05
4.16072e-05
4.16487e-05
2.67929e-05
3.11783e-05
3.53985e-05
3.83285e-05
4.004e-05
4.09228e-05
4.13367e-05
4.15196e-05
4.16017e-05
4.16452e-05
2.67895e-05
3.11746e-05
3.53945e-05
3.83242e-05
4.00356e-05
4.09184e-05
4.13325e-05
4.15156e-05
4.15982e-05
4.16424e-05
2.67877e-05
3.11725e-05
3.53923e-05
3.83219e-05
4.00333e-05
4.09162e-05
4.13303e-05
4.15136e-05
4.15965e-05
4.1641e-05
2.67875e-05
3.11724e-05
3.53922e-05
3.83219e-05
4.00334e-05
4.09163e-05
4.13306e-05
4.1514e-05
4.1597e-05
4.16416e-05
2.67892e-05
3.11743e-05
3.53945e-05
3.83244e-05
4.00361e-05
4.09192e-05
4.13335e-05
4.1517e-05
4.16002e-05
4.16448e-05
2.6793e-05
3.11788e-05
3.53996e-05
3.83301e-05
4.00421e-05
4.09254e-05
4.13399e-05
4.15235e-05
4.16067e-05
4.16514e-05
2.67994e-05
3.11864e-05
3.54083e-05
3.83397e-05
4.00523e-05
4.09359e-05
4.13506e-05
4.15343e-05
4.16176e-05
4.16623e-05
2.68091e-05
3.11978e-05
3.54216e-05
3.83542e-05
4.00676e-05
4.09517e-05
4.13667e-05
4.15505e-05
4.16339e-05
4.16787e-05
2.68221e-05
3.12139e-05
3.54401e-05
3.83746e-05
4.00891e-05
4.09738e-05
4.13891e-05
4.15731e-05
4.16566e-05
4.17015e-05
7.63507e-06
8.61372e-06
9.68085e-06
1.04709e-05
1.09519e-05
1.12079e-05
1.13312e-05
1.13869e-05
1.14122e-05
1.14251e-05
7.63361e-06
8.61213e-06
9.67913e-06
1.04691e-05
1.095e-05
1.1206e-05
1.13293e-05
1.13851e-05
1.14106e-05
1.14241e-05
7.63261e-06
8.61105e-06
9.67795e-06
1.04679e-05
1.09487e-05
1.12048e-05
1.13281e-05
1.1384e-05
1.14096e-05
1.14233e-05
7.63207e-06
8.61047e-06
9.67734e-06
1.04672e-05
1.09481e-05
1.12041e-05
1.13275e-05
1.13834e-05
1.14091e-05
1.14229e-05
7.63204e-06
8.61045e-06
9.67733e-06
1.04673e-05
1.09481e-05
1.12042e-05
1.13276e-05
1.13836e-05
1.14093e-05
1.14231e-05
7.63257e-06
8.61106e-06
9.67804e-06
1.04681e-05
1.0949e-05
1.12051e-05
1.13285e-05
1.13845e-05
1.14103e-05
1.14241e-05
7.63379e-06
8.61244e-06
9.67961e-06
1.04698e-05
1.09508e-05
1.1207e-05
1.13305e-05
1.13865e-05
1.14123e-05
1.14262e-05
7.63584e-06
8.61478e-06
9.68227e-06
1.04727e-05
1.09539e-05
1.12102e-05
1.13337e-05
1.13898e-05
1.14156e-05
1.14295e-05
7.63888e-06
8.61829e-06
9.68629e-06
1.04771e-05
1.09586e-05
1.1215e-05
1.13386e-05
1.13947e-05
1.14206e-05
1.14344e-05
7.64292e-06
8.62318e-06
9.69189e-06
1.04832e-05
1.09651e-05
1.12217e-05
1.13454e-05
1.14016e-05
1.14274e-05
1.14414e-05
2.08003e-06
2.29747e-06
2.55681e-06
2.76011e-06
2.88889e-06
2.95959e-06
2.99454e-06
3.01069e-06
3.01816e-06
3.02199e-06
2.07962e-06
2.29703e-06
2.55633e-06
2.75961e-06
2.88837e-06
2.95907e-06
2.99403e-06
3.0102e-06
3.01772e-06
3.02172e-06
2.07933e-06
2.29672e-06
2.556e-06
2.75927e-06
2.88803e-06
2.95872e-06
2.99369e-06
3.00988e-06
3.01744e-06
3.0215e-06
2.07918e-06
2.29657e-06
2.55584e-06
2.7591e-06
2.88785e-06
2.95855e-06
2.99353e-06
3.00974e-06
3.01732e-06
3.0214e-06
2.07918e-06
2.29657e-06
2.55584e-06
2.75911e-06
2.88787e-06
2.95858e-06
2.99356e-06
3.00978e-06
3.01738e-06
3.02147e-06
2.07935e-06
2.29675e-06
2.55605e-06
2.75935e-06
2.88812e-06
2.95885e-06
2.99384e-06
3.01006e-06
3.01767e-06
3.02177e-06
2.07971e-06
2.29716e-06
2.55652e-06
2.75985e-06
2.88866e-06
2.9594e-06
2.99441e-06
3.01064e-06
3.01825e-06
3.02235e-06
2.08033e-06
2.29785e-06
2.55729e-06
2.7607e-06
2.88956e-06
2.96034e-06
2.99536e-06
3.0116e-06
3.01922e-06
3.02332e-06
2.08124e-06
2.29889e-06
2.55846e-06
2.76198e-06
2.89091e-06
2.96173e-06
2.99678e-06
3.01304e-06
3.02066e-06
3.02477e-06
2.08245e-06
2.30032e-06
2.5601e-06
2.76377e-06
2.8928e-06
2.96368e-06
2.99876e-06
3.01503e-06
3.02267e-06
3.0268e-06
5.43921e-07
5.91758e-07
6.52703e-07
7.0289e-07
7.35876e-07
7.54528e-07
7.63982e-07
7.68448e-07
7.7055e-07
7.71638e-07
5.43808e-07
5.91638e-07
6.52575e-07
7.02755e-07
7.35738e-07
7.54389e-07
7.63844e-07
7.68316e-07
7.70433e-07
7.71567e-07
5.43731e-07
5.91557e-07
6.52489e-07
7.02665e-07
7.35645e-07
7.54297e-07
7.63755e-07
7.68232e-07
7.7036e-07
7.71509e-07
5.43692e-07
5.91515e-07
6.52445e-07
7.0262e-07
7.356e-07
7.54253e-07
7.63713e-07
7.68195e-07
7.70328e-07
7.71483e-07
5.43693e-07
5.91518e-07
6.52449e-07
7.02626e-07
7.35608e-07
7.54263e-07
7.63725e-07
7.6821e-07
7.70347e-07
7.71504e-07
5.43741e-07
5.91571e-07
6.5251e-07
7.02693e-07
7.3568e-07
7.54338e-07
7.63803e-07
7.6829e-07
7.70429e-07
7.71588e-07
5.43848e-07
5.91688e-07
6.5264e-07
7.02835e-07
7.35831e-07
7.54495e-07
7.63964e-07
7.68453e-07
7.70594e-07
7.71754e-07
5.44025e-07
5.91883e-07
6.52858e-07
7.03073e-07
7.36083e-07
7.54756e-07
7.6423e-07
7.68722e-07
7.70865e-07
7.72026e-07
5.44286e-07
5.92176e-07
6.53187e-07
7.03431e-07
7.36462e-07
7.55147e-07
7.64628e-07
7.69124e-07
7.7127e-07
7.72433e-07
5.44632e-07
5.92582e-07
6.53645e-07
7.0393e-07
7.36989e-07
7.55691e-07
7.65181e-07
7.69683e-07
7.71832e-07
7.72999e-07
1.369e-07
1.47277e-07
1.61172e-07
1.73103e-07
1.81213e-07
1.85928e-07
1.88376e-07
1.89557e-07
1.90123e-07
1.90418e-07
1.36871e-07
1.47246e-07
1.61139e-07
1.73068e-07
1.81177e-07
1.85892e-07
1.8834e-07
1.89523e-07
1.90093e-07
1.904e-07
1.36851e-07
1.47225e-07
1.61117e-07
1.73045e-07
1.81154e-07
1.85869e-07
1.88317e-07
1.89501e-07
1.90074e-07
1.90385e-07
1.36841e-07
1.47215e-07
1.61106e-07
1.73034e-07
1.81142e-07
1.85858e-07
1.88307e-07
1.89492e-07
1.90066e-07
1.90379e-07
1.36841e-07
1.47216e-07
1.61108e-07
1.73036e-07
1.81145e-07
1.85861e-07
1.88311e-07
1.89497e-07
1.90072e-07
1.90386e-07
1.36855e-07
1.47231e-07
1.61124e-07
1.73054e-07
1.81165e-07
1.85881e-07
1.88332e-07
1.89519e-07
1.90094e-07
1.90408e-07
1.36885e-07
1.47263e-07
1.6116e-07
1.73093e-07
1.81206e-07
1.85924e-07
1.88376e-07
1.89563e-07
1.90139e-07
1.90453e-07
1.36933e-07
1.47316e-07
1.61219e-07
1.73157e-07
1.81274e-07
1.85994e-07
1.88447e-07
1.89636e-07
1.90212e-07
1.90527e-07
1.37005e-07
1.47396e-07
1.61308e-07
1.73253e-07
1.81376e-07
1.861e-07
1.88555e-07
1.89744e-07
1.90321e-07
1.90637e-07
1.371e-07
1.47506e-07
1.61431e-07
1.73388e-07
1.81517e-07
1.86246e-07
1.88704e-07
1.89894e-07
1.90473e-07
1.90789e-07
3.32349e-08
3.5448e-08
3.8527e-08
4.12661e-08
4.31855e-08
4.43307e-08
4.49388e-08
4.52384e-08
4.53843e-08
4.54614e-08
3.32275e-08
3.54402e-08
3.85187e-08
4.12575e-08
4.31766e-08
4.43218e-08
4.493e-08
4.52299e-08
4.53769e-08
4.5457e-08
3.32225e-08
3.5435e-08
3.85132e-08
4.12517e-08
4.31708e-08
4.4316e-08
4.49244e-08
4.52246e-08
4.53723e-08
4.54534e-08
3.322e-08
3.54324e-08
3.85106e-08
4.1249e-08
4.31681e-08
4.43133e-08
4.49219e-08
4.52224e-08
4.53705e-08
4.5452e-08
3.32204e-08
3.54328e-08
3.85111e-08
4.12497e-08
4.31689e-08
4.43143e-08
4.4923e-08
4.52237e-08
4.5372e-08
4.54537e-08
3.3224e-08
3.54368e-08
3.85155e-08
4.12545e-08
4.31741e-08
4.43197e-08
4.49286e-08
4.52295e-08
4.5378e-08
4.54597e-08
3.32319e-08
3.54452e-08
3.85248e-08
4.12646e-08
4.31847e-08
4.43308e-08
4.494e-08
4.5241e-08
4.53896e-08
4.54714e-08
3.32448e-08
3.54593e-08
3.85402e-08
4.12813e-08
4.32024e-08
4.43491e-08
4.49587e-08
4.52599e-08
4.54087e-08
4.54906e-08
3.32638e-08
3.54801e-08
3.85634e-08
4.13064e-08
4.32289e-08
4.43765e-08
4.49865e-08
4.52881e-08
4.5437e-08
4.55191e-08
3.3289e-08
3.55091e-08
3.85956e-08
4.13413e-08
4.32657e-08
4.44145e-08
4.50252e-08
4.53272e-08
4.54763e-08
4.55587e-08
7.79583e-09
8.25884e-09
8.92273e-09
9.53144e-09
9.96975e-09
1.02376e-08
1.0383e-08
1.04559e-08
1.04921e-08
1.05115e-08
7.79403e-09
8.25696e-09
8.92074e-09
9.52937e-09
9.96763e-09
1.02355e-08
1.03808e-08
1.04539e-08
1.04904e-08
1.05104e-08
7.79282e-09
8.2557e-09
8.91942e-09
9.528e-09
9.96623e-09
1.02341e-08
1.03795e-08
1.04526e-08
1.04893e-08
1.05096e-08
7.79223e-09
8.2551e-09
8.9188e-09
9.52736e-09
9.9656e-09
1.02335e-08
1.03789e-08
1.04521e-08
1.04888e-08
1.05093e-08
7.79234e-09
8.25523e-09
8.91896e-09
9.52756e-09
9.96584e-09
1.02338e-08
1.03792e-08
1.04525e-08
1.04893e-08
1.05097e-08
7.7933e-09
8.25625e-09
8.92009e-09
9.52879e-09
9.96715e-09
1.02351e-08
1.03807e-08
1.0454e-08
1.04908e-08
1.05112e-08
7.7953e-09
8.2584e-09
8.92243e-09
9.53133e-09
9.96984e-09
1.02379e-08
1.03835e-08
1.04569e-08
1.04937e-08
1.05142e-08
7.79861e-09
8.26195e-09
8.92633e-09
9.53554e-09
9.97428e-09
1.02425e-08
1.03882e-08
1.04616e-08
1.04985e-08
1.0519e-08
7.80344e-09
8.26723e-09
8.93214e-09
9.54182e-09
9.98091e-09
1.02494e-08
1.03952e-08
1.04687e-08
1.05056e-08
1.05262e-08
7.80986e-09
8.27457e-09
8.94024e-09
9.55056e-09
9.99012e-09
1.02589e-08
1.04049e-08
1.04785e-08
1.05155e-08
1.05361e-08
1.77006e-09
1.86497e-09
2.00441e-09
2.13561e-09
2.23241e-09
2.2929e-09
2.32638e-09
2.34352e-09
2.35216e-09
2.35684e-09
1.76963e-09
1.86454e-09
2.00395e-09
2.13513e-09
2.23192e-09
2.2924e-09
2.32589e-09
2.34305e-09
2.35175e-09
2.35659e-09
1.76935e-09
1.86424e-09
2.00364e-09
2.13481e-09
2.23159e-09
2.29208e-09
2.32558e-09
2.34275e-09
2.35149e-09
2.3564e-09
1.76922e-09
1.8641e-09
2.0035e-09
2.13467e-09
2.23145e-09
2.29194e-09
2.32545e-09
2.34264e-09
2.3514e-09
2.35633e-09
1.76925e-09
1.86414e-09
2.00355e-09
2.13472e-09
2.23152e-09
2.29201e-09
2.32553e-09
2.34274e-09
2.35151e-09
2.35645e-09
1.76949e-09
1.8644e-09
2.00383e-09
2.13502e-09
2.23184e-09
2.29235e-09
2.32588e-09
2.3431e-09
2.35188e-09
2.35682e-09
1.76998e-09
1.86492e-09
2.0044e-09
2.13564e-09
2.23249e-09
2.29303e-09
2.32658e-09
2.3438e-09
2.35259e-09
2.35754e-09
1.7708e-09
1.86579e-09
2.00535e-09
2.13666e-09
2.23357e-09
2.29415e-09
2.32772e-09
2.34496e-09
2.35376e-09
2.35871e-09
1.77199e-09
1.86709e-09
2.00676e-09
2.13819e-09
2.23518e-09
2.29581e-09
2.32941e-09
2.34667e-09
2.35548e-09
2.36045e-09
1.77357e-09
1.86888e-09
2.00873e-09
2.14031e-09
2.23741e-09
2.29811e-09
2.33176e-09
2.34904e-09
2.35787e-09
2.36285e-09
3.9255e-10
4.11719e-10
4.4045e-10
4.68103e-10
4.88964e-10
5.02272e-10
5.09784e-10
5.13698e-10
5.15706e-10
5.16806e-10
3.92452e-10
4.11618e-10
4.40344e-10
4.67992e-10
4.88851e-10
5.02158e-10
5.09671e-10
5.1359e-10
5.15611e-10
5.1675e-10
3.92388e-10
4.11551e-10
4.40274e-10
4.6792e-10
4.88778e-10
5.02085e-10
5.096e-10
5.13524e-10
5.15554e-10
5.16707e-10
3.92358e-10
4.11521e-10
4.40243e-10
4.67889e-10
4.88746e-10
5.02055e-10
5.09572e-10
5.135e-10
5.15535e-10
5.16693e-10
3.92367e-10
4.11531e-10
4.40256e-10
4.67904e-10
4.88763e-10
5.02074e-10
5.09593e-10
5.13524e-10
5.15563e-10
5.16722e-10
3.92426e-10
4.11593e-10
4.40323e-10
4.67976e-10
4.88841e-10
5.02156e-10
5.09677e-10
5.1361e-10
5.15651e-10
5.16812e-10
3.92545e-10
4.11719e-10
4.4046e-10
4.68123e-10
4.88996e-10
5.02317e-10
5.09842e-10
5.13778e-10
5.1582e-10
5.16983e-10
3.9274e-10
4.11927e-10
4.40685e-10
4.68366e-10
4.89252e-10
5.02581e-10
5.10112e-10
5.14051e-10
5.16096e-10
5.1726e-10
3.93025e-10
4.12235e-10
4.41021e-10
4.68727e-10
4.89632e-10
5.02974e-10
5.10513e-10
5.14457e-10
5.16505e-10
5.17671e-10
3.93403e-10
4.12662e-10
4.41487e-10
4.69227e-10
4.90158e-10
5.03517e-10
5.11067e-10
5.15016e-10
5.17068e-10
5.18239e-10
1.0019e-10
1.04643e-10
1.1144e-10
1.18126e-10
1.23282e-10
1.26642e-10
1.28576e-10
1.29605e-10
1.30141e-10
1.30435e-10
1.00165e-10
1.04618e-10
1.11413e-10
1.18098e-10
1.23253e-10
1.26613e-10
1.28548e-10
1.29577e-10
1.30117e-10
1.30422e-10
1.00149e-10
1.046e-10
1.11395e-10
1.18079e-10
1.23234e-10
1.26594e-10
1.2853e-10
1.2956e-10
1.30103e-10
1.30411e-10
1.00141e-10
1.04593e-10
1.11388e-10
1.18071e-10
1.23226e-10
1.26586e-10
1.28523e-10
1.29554e-10
1.30098e-10
1.30408e-10
1.00144e-10
1.04596e-10
1.11392e-10
1.18076e-10
1.23232e-10
1.26592e-10
1.28529e-10
1.29562e-10
1.30106e-10
1.30416e-10
1.00161e-10
1.04613e-10
1.1141e-10
1.18096e-10
1.23253e-10
1.26615e-10
1.28553e-10
1.29586e-10
1.30131e-10
1.30441e-10
1.00194e-10
1.04648e-10
1.11448e-10
1.18137e-10
1.23296e-10
1.26659e-10
1.28598e-10
1.29632e-10
1.30177e-10
1.30488e-10
1.00248e-10
1.04706e-10
1.1151e-10
1.18203e-10
1.23366e-10
1.26731e-10
1.28672e-10
1.29707e-10
1.30253e-10
1.30564e-10
1.00326e-10
1.0479e-10
1.11602e-10
1.18301e-10
1.23469e-10
1.26838e-10
1.28781e-10
1.29817e-10
1.30364e-10
1.30676e-10
1.00428e-10
1.04904e-10
1.11726e-10
1.18434e-10
1.23609e-10
1.26982e-10
1.28928e-10
1.29965e-10
1.30513e-10
1.30827e-10
)
;
boundaryField
{
inlet1
{
type fixedValue;
value uniform 10;
}
inlet2
{
type fixedValue;
value uniform 20;
}
outlet1
{
type zeroGradient;
}
outlet2
{
type zeroGradient;
}
fixedWalls
{
type zeroGradient;
}
}
// ************************************************************************* //
| [
"elliot.s.tennison@gmail.com"
] | elliot.s.tennison@gmail.com | |
6ede67d366e5620f5f25f442cf8c244dab62c4ca | 388053b5097864119fa84eb0ecac00b88e21334d | /improved/src/ins-gnss/ins-pnp.cc | 50750a4b6747534a4b2d1aeefafd9bfac40bd518 | [] | no_license | Erensu/ignav | dffc4a334d15e51307dabd08ca23dcd237803ec1 | c27110b267ae9ff19865d38eec4c5e71f5e73389 | refs/heads/master | 2021-12-10T02:50:52.151418 | 2021-12-07T02:09:44 | 2021-12-07T02:09:44 | 146,999,557 | 272 | 154 | null | null | null | null | UTF-8 | C++ | false | false | 17,558 | cc | /*------------------------------------------------------------------------------
* ins-pnp.cc : PnP pose estimation algorithm
*
* reference :
* [1] Lepetit V,Moreno-Noguer F,Fua P. EPnP: An AccurateO(n) Solution
* to the PnP Problem[J]. International Journal of Computer Vision,2009,
* 81(2):155-166.
*
* version : $Revision: 1.1 $ $Date: 2008/09/05 01:32:44 $
* history : 2018/11/27 1.0 new
*-----------------------------------------------------------------------------*/
#include "carvig.h"
/*-----------------------------------------------------------------------------*/
static int solve_deg2(double a, double b, double c, double &x1, double &x2)
{
double delta=b*b-4*a*c;
if (delta<0) return 0;
double inv_2a=0.5/a;
if (delta==0) {
x1=-b*inv_2a; x2=x1; return 1;
}
double sqrt_delta=sqrt(delta);
x1=(-b+sqrt_delta)*inv_2a;
x2=(-b-sqrt_delta)*inv_2a;
return 2;
}
/* ----------------------------------------------------------------------------
* Reference : Eric W. Weisstein. "Cubic Equation." From MathWorld--A Wolfram
* Web Resource.
* http://mathworld.wolfram.com/CubicEquation.html
* \return Number of real roots found.
* ---------------------------------------------------------------------------*/
static int solve_deg3(double a, double b, double c, double d,
double &x0, double &x1, double &x2)
{
if (a==0) {
if (b==0) {
if (c==0) return 0;
x0=-d/c; return 1;
}
x2=0;
return solve_deg2(b,c,d,x0,x1);
}
double inv_a=1.0/a;
double b_a=inv_a*b,b_a2=b_a*b_a;
double c_a=inv_a*c;
double d_a=inv_a*d;
double Q =(3*c_a-b_a2)/9;
double R =(9*b_a*c_a-27*d_a-2*b_a*b_a2)/54;
double Q3=Q*Q*Q;
double D =Q3+R*R;
double b_a_3=(1.0/3.0)*b_a;
if (Q==0) {
if (R==0) {
x0=x1=x2=-b_a_3; return 3;
}
else {
x0=pow(2*R,1.0/3.0)-b_a_3;
return 1;
}
}
if (D<=0) {
double theta =acos(R/sqrt(-Q3));
double sqrt_Q=sqrt(-Q);
x0=2*sqrt_Q*cos( theta /3.0)-b_a_3;
x1=2*sqrt_Q*cos((theta+2*PI)/3.0)-b_a_3;
x2=2*sqrt_Q*cos((theta+4*PI)/3.0)-b_a_3;
return 3;
}
double AD=pow(fabs(R)+sqrt(D),1.0/3.0)*(R>0?1:(R<0?-1:0));
double BD=(AD==0)?0:-Q/AD;
x0=AD+BD-b_a_3;
return 1;
}
/* ----------------------------------------------------------------------------
* Reference : Eric W. Weisstein. "Quartic Equation." From MathWorld--A Wolfram
* Web Resource.
* http://mathworld.wolfram.com/QuarticEquation.html
* \return Number of real roots found.
* ---------------------------------------------------------------------------*/
static int solve_deg4(double a, double b, double c, double d, double e,
double &x0, double &x1, double &x2, double &x3)
{
if (a==0) {
x3=0; return solve_deg3(b,c,d,e,x0,x1,x2);
}
double inv_a=1.0/a;
b*=inv_a; c*=inv_a; d*=inv_a; e*=inv_a;
double b2=b*b,bc=b*c,b3=b2*b;
double r0,r1,r2;
int n=solve_deg3(1,-c,d*b-4*e,4*c*e-d*d-b2*e,r0,r1,r2);
if (n==0) return 0;
double R2=0.25*b2-c+r0,R;
if (R2<0) return 0;
R=sqrt(R2);
double inv_R=1.0/R;
int nb_real_roots=0;
double D2,E2;
if (R<10E-12) {
double temp=r0*r0-4*e; if (temp<0) D2=E2=-1;
else {
double sqrt_temp=sqrt(temp);
D2=0.75*b2-2*c+2*sqrt_temp; E2=D2-4*sqrt_temp;
}
}
else {
double u=0.75*b2-2*c-R2,
v=0.25*inv_R*(4*bc-8*d-b3);
D2=u+v;
E2=u-v;
}
double b_4=0.25*b,R_2=0.5*R;
if (D2>=0) {
double D=sqrt(D2);
nb_real_roots=2;
double D_2=0.5*D;
x0=R_2+D_2-b_4; x1=x0-D;
}
if (E2>=0) {
double E =sqrt(E2);
double E_2=0.5*E;
if (nb_real_roots==0) {
x0=-R_2+E_2-b_4; x1=x0-E; nb_real_roots=2;
}
else {
x2=-R_2+E_2-b_4; x3=x2-E;
nb_real_roots=4;
}
}
return nb_real_roots;
}
/*----------------------------------------------------------------------------*/
static int jacobi_4x4(double *A, double *D, double *U)
{
static double Id[16]={1.0,0.0,0.0,0.0,
0.0,1.0,0.0,0.0,
0.0,0.0,1.0,0.0,
0.0,0.0,0.0,1.0
};
double B[4],Z[4],g,h,sum;
int i,j,k;
memcpy(U,Id,16*sizeof(double));
B[0]=A[0]; B[1]=A[5]; B[2]=A[10]; B[3]=A[15];
memcpy(D,B,4*sizeof(double));
memset(Z,0,4*sizeof(double));
for (int iter=0;iter<50;iter++) {
sum=fabs(A[1])+fabs(A[2])+fabs(A[3])+fabs(A[6])+fabs(A[7])+fabs(A[11]);
if (sum==0.0) return 1;
double tresh=(iter<3)?0.2*sum/16.0:0.0;
for (i=0;i<3;i++) {
double *pAij=A+5*i+1;
for (j=i+1;j<4;j++) {
double Aij=*pAij,eps_machine=100.0*fabs(Aij);
if (iter>3&&fabs(D[i])+eps_machine==fabs(D[i])
&&fabs(D[j])+eps_machine==fabs(D[j])) {
*pAij=0.0;
}
else if (fabs(Aij)>tresh) {
double hh=D[j]-D[i],t;
if (fabs(hh)+eps_machine==fabs(hh)) t=Aij/hh;
else {
double theta=0.5*hh/Aij;
t=1.0/(fabs(theta)+sqrt(1.0+theta*theta));
if (theta<0.0) t=-t;
}
hh=t*Aij;
Z[i]-=hh; Z[j]+=hh;
D[i]-=hh; D[j]+=hh; *pAij=0.0;
double c=1.0/sqrt(1+t*t),s=t*c,tau=s/(1.0+c);
for (k=0;k<=i-1;k++) {
g=A[k*4+i]; h=A[k*4+j];
A[k*4+i]=g-s*(h+g*tau); A[k*4+j]=h+s*(g-h*tau);
}
for (k=i+1; k<=j-1;k++) {
g=A[i*4+k]; h=A[k*4+j];
A[i*4+k]=g-s*(h+g*tau); A[k*4+j]=h+s*(g-h*tau);
}
for (k=j+1;k<4;k++) {
g=A[i*4+k]; h=A[j*4+k];
A[i*4+k]=g-s*(h+g*tau); A[j*4+k]=h+s*(g-h*tau);
}
for (k=0;k<4;k++) {
g=U[k*4+i]; h=U[k*4+j];
U[k*4+i]=g-s*(h+g*tau);
U[k*4+j]=h+s*(g-h*tau);
}
}
pAij++;
}
}
for (i=0;i<4;i++) B[i]+=Z[i];
memcpy(D,B,4*sizeof(double));
memset(Z,0,4*sizeof(double));
}
return 0;
}
/* pnp align------------------------------------------------------------------*/
static int pnpalign(double M_end[3][3],
double X0,double Y0,double Z0,double X1,double Y1,double Z1,
double X2,double Y2,double Z2,double R[3][3],double T[3])
{
double Cs[3],Ce[3],s[3*3],Qs[16],evs[4],U[16];
double q[4],ev_max,q02,q0_1,q1_2,q2_3;
double q12,q0_2,q1_3,q22,q0_3,q32;
int i,j,i_ev;
for (i=0;i<3;i++) {
Ce[i]=(M_end[0][i]+M_end[1][i]+M_end[2][i])/3;
}
Cs[0]=(X0+X1+X2)/3;
Cs[1]=(Y0+Y1+Y2)/3;
Cs[2]=(Z0+Z1+Z2)/3;
/* Covariance matrix s: */
for (j=0;j<3;j++) {
s[0*3+j]=(X0*M_end[0][j]+X1*M_end[1][j]+X2*M_end[2][j])/3-Ce[j]*Cs[0];
s[1*3+j]=(Y0*M_end[0][j]+Y1*M_end[1][j]+Y2*M_end[2][j])/3-Ce[j]*Cs[1];
s[2*3+j]=(Z0*M_end[0][j]+Z1*M_end[1][j]+Z2*M_end[2][j])/3-Ce[j]*Cs[2];
}
Qs[0*4+0]=s[0*3+0]+s[1*3+1]+s[2*3+2];
Qs[1*4+1]=s[0*3+0]-s[1*3+1]-s[2*3+2];
Qs[2*4+2]=s[1*3+1]-s[2*3+2]-s[0*3+0];
Qs[3*4+3]=s[2*3+2]-s[0*3+0]-s[1*3+1];
Qs[1*4+0]=Qs[0*4+1]=s[1*3+2]-s[2*3+1];
Qs[2*4+0]=Qs[0*4+2]=s[2*3+0]-s[0*3+2];
Qs[3*4+0]=Qs[0*4+3]=s[0*3+1]-s[1*3+0];
Qs[2*4+1]=Qs[1*4+2]=s[1*3+0]+s[0*3+1];
Qs[3*4+1]=Qs[1*4+3]=s[2*3+0]+s[0*3+2];
Qs[3*4+2]=Qs[2*4+3]=s[2*3+1]+s[1*3+2];
jacobi_4x4(Qs,evs,U);
/* Looking for the largest eigen value: */
i_ev=0;
ev_max=evs[i_ev];
for (i=1;i<4;i++) if (evs[i]>ev_max) ev_max=evs[i_ev=i];
/* Quaternion: */
for (i=0;i<4;i++) q[i]=U[i*4+i_ev];
q02 =q[0]*q[0],q12 =q[1]*q[1],q22 =q[2]*q[2],q32=q[3]*q[3];
q0_1=q[0]*q[1],q0_2=q[0]*q[2],q0_3=q[0]*q[3];
q1_2=q[1]*q[2],q1_3=q[1]*q[3];
q2_3=q[2]*q[3];
R[0][0]=q02+q12-q22-q32;
R[0][1]=2.0*(q1_2-q0_3);
R[0][2]=2.0*(q1_3+q0_2);
R[1][0]=2.0*(q1_2+q0_3);
R[1][1]=q02+q22-q12-q32;
R[1][2]=2.0*(q2_3-q0_1);
R[2][0]=2.0*(q1_3-q0_2);
R[2][1]=2.0*(q2_3+q0_1);
R[2][2]=q02+q32-q12-q22;
for (i=0;i<3;i++) {
T[i]=Ce[i]-(R[i][0]*Cs[0]+R[i][1]*Cs[1]+R[i][2]*Cs[2]);
}
return 1;
}
/* ----------------------------------------------------------------------------
* Given 3D distances between three points and cosines of 3 angles at the apex,
* calculates. the lentghs of the line segments connecting projection center (P)
* and the three 3D points (A, B, C).
* Returned distances are for |PA|, |PB|, |PC| respectively.
* Only the solution to the main branch.
* Reference : X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang; "Complete Solution
* Classification for the Perspective-Three-Point Problem"
* IEEE Trans. on PAMI, vol. 25, No. 8, August 2003
* \param lengths3D Lengths of line segments up to four solutions.
* \param dist3D Distance between 3D points in pairs |BC|, |AC|, |AB|.
* \param cosines Cosine of the angles /_BPC, /_APC, /_APB.
* \returns Number of solutions.
* WARNING: NOT ALL THE DEGENERATE CASES ARE IMPLEMENTED
* ----------------------------------------------------------------------------*/
static int solve_for_lengths(double lengths[4][3],double distances[3],
double cosines[3])
{
double p=cosines[0]*2;
double q=cosines[1]*2;
double r=cosines[2]*2;
double inv_d22=1.0/(distances[2]*distances[2]);
double a=inv_d22*(distances[0]*distances[0]);
double b=inv_d22*(distances[1]*distances[1]);
double a2=a*a,b2=b*b,p2=p*p,q2=q*q,r2=r*r;
double pr=p*r,pqr=q*pr;
/* check reality condition (the four points should not be coplanar) */
if (p2+q2+r2-pqr-1==0) {
return 0;
}
double ab=a*b,a_2=2*a;
double A=-2*b+b2+a2+1+ab*(2-r2)-a_2;
/* check reality condition */
if (A==0) return 0;
double a_4=4*a;
double B=q*(-2*(ab+a2+1-b)+r2*ab+a_4)+pr*(b-b2+ab);
double C=q2+b2*(r2+p2-2)-b*(p2+pqr)-ab*(r2+pqr)+(a2-a_2)*(2+q2)+2;
double D=pr*(ab-b2+b)+q*((p2-2)*b+2*(ab-a2)+a_4-2);
double E=1+2*(b-a-ab)+b2-b*p2+a2;
double temp=(p2*(a-1+b)+r2*(a-1-b)+pqr-a*pqr);
double b0=b*temp*temp;
/* check reality condition */
if (b0==0) return 0;
double real_roots[4];
int n=solve_deg4(A,B,C,D,E,real_roots[0],real_roots[1],real_roots[2],real_roots[3]);
if (n==0) return 0;
int nb_solutions=0;
double r3=r2*r,pr2=p*r2,r3q=r3*q;
double inv_b0=1.0/b0;
/* for each solution of x */
for(int i=0;i<n;i++) {
double x=real_roots[i];
/* check reality condition */
if (x<=0) continue;
double x2=x*x;
double b1=
((1-a-b)*x2+(q*a-q)*x+1-a+b)*(((r3*(a2+ab*(2-r2)-a_2+b2-2*b+1))*x+
(r3q*(2*(b-a2)+a_4+ab*(r2-2) -2)+pr2*(1+a2 +2*(ab-a-b) +r2*(b-b2) +b2)))*x2 +
(r3*(q2*(1-2*a+a2)+r2*(b2-ab)-a_4+2*(a2-b2)+2)+r*p2*(b2+2*(ab-b-a)+1+a2)+pr2*q*(a_4+2*(b-ab-a2)-2-r2*b))*x+
2*r3q*(a_2-b-a2+ab-1)+pr2*(q2-a_4+2*(a2-b2)+r2*b+q2*(a2-a_2)+2)+
p2*(p*(2*(ab-a-b)+a2+b2+1)+2*q*r*(b+a_2-a2-ab-1)));
/* check reality condition */
if (b1<=0) continue;
double y=inv_b0*b1;
double v=x2+y*y-x*y*r;
if (v<=0) continue;
double Z=distances[2]/sqrt(v);
double X=x*Z;
double Y=y*Z;
lengths[nb_solutions][0]=X;
lengths[nb_solutions][1]=Y;
lengths[nb_solutions][2]=Z;
nb_solutions++;
}
return nb_solutions;
}
/* internal solve for p3p ----------------------------------------------------*/
static int p3pinternal(double R[4][3][3], double t[4][3], const voopt_t *opt,
double mu0, double mv0, double X0, double Y0, double Z0,
double mu1, double mv1, double X1, double Y1, double Z1,
double mu2, double mv2, double X2, double Y2, double Z2)
{
double mk0,mk1,mk2;
double norm,cx_fx,cy_fy;
double inv_fx,inv_fy,M_orig[3][3];;
double distances[3],cosines[3],lengths[4][3];
int n,i,nsols=0;
cx_fx=opt->cam.K[6]/opt->cam.K[0];
cy_fy=opt->cam.K[7]/opt->cam.K[4];
inv_fx=1.0/opt->cam.K[0]; inv_fy=1.0/opt->cam.K[4];
mu0=inv_fx*mu0-cx_fx;
mv0=inv_fy*mv0-cy_fy;
norm=sqrt(mu0*mu0+mv0*mv0+1);
mk0 =1.0/norm; mu0*=mk0; mv0*=mk0;
mu1=inv_fx*mu1-cx_fx;
mv1=inv_fy*mv1-cy_fy;
norm=sqrt(mu1*mu1+mv1*mv1+1);
mk1 =1.0/norm; mu1*=mk1; mv1*=mk1;
mu2=inv_fx*mu2-cx_fx;
mv2=inv_fy*mv2-cy_fy;
norm=sqrt(mu2*mu2+mv2*mv2+1);
mk2 =1.0/norm; mu2*=mk2; mv2*=mk2;
distances[0]=sqrt((X1-X2)*(X1-X2)+(Y1-Y2)*(Y1-Y2)+(Z1-Z2)*(Z1-Z2));
distances[1]=sqrt((X0-X2)*(X0-X2)+(Y0-Y2)*(Y0-Y2)+(Z0-Z2)*(Z0-Z2));
distances[2]=sqrt((X0-X1)*(X0-X1)+(Y0-Y1)*(Y0-Y1)+(Z0-Z1)*(Z0-Z1));
/* calculate angles */
cosines[0]=mu1*mu2+mv1*mv2+mk1*mk2;
cosines[1]=mu0*mu2+mv0*mv2+mk0*mk2;
cosines[2]=mu0*mu1+mv0*mv1+mk0*mk1;
n=solve_for_lengths(lengths,distances,cosines);
for (i=0;i<n;i++) {
M_orig[0][0]=lengths[i][0]*mu0;
M_orig[0][1]=lengths[i][0]*mv0;
M_orig[0][2]=lengths[i][0]*mk0;
M_orig[1][0]=lengths[i][1]*mu1;
M_orig[1][1]=lengths[i][1]*mv1;
M_orig[1][2]=lengths[i][1]*mk1;
M_orig[2][0]=lengths[i][2]*mu2;
M_orig[2][1]=lengths[i][2]*mv2;
M_orig[2][2]=lengths[i][2]*mk2;
if (!pnpalign(M_orig,X0,Y0,Z0,X1,Y1,Z1,X2,Y2,Z2,R[nsols],t[nsols])) {
continue;
}
nsols++;
}
return nsols;
}
/* p3p solver-----------------------------------------------------------------*/
static int p3psolve(double R[3][3], double t[3], const voopt_t *opt,
double mu0, double mv0, double X0, double Y0, double Z0,
double mu1, double mv1, double X1, double Y1, double Z1,
double mu2, double mv2, double X2, double Y2, double Z2,
double mu3, double mv3, double X3, double Y3, double Z3)
{
double Rs[4][3][3],ts[4][3];
int ns=0,i,j,n;
double min_reproj=0;
n=p3pinternal(Rs,ts,opt,mu0,mv0,X0,Y0,Z0,mu1,mv1,X1,Y1,Z1,mu2,mv2,X2,Y2,Z2);
if (n==0) return 0;
for (i=0;i<n;i++) {
double X3p=Rs[i][0][0]*X3+Rs[i][0][1]*Y3+Rs[i][0][2]*Z3+ts[i][0];
double Y3p=Rs[i][1][0]*X3+Rs[i][1][1]*Y3+Rs[i][1][2]*Z3+ts[i][1];
double Z3p=Rs[i][2][0]*X3+Rs[i][2][1]*Y3+Rs[i][2][2]*Z3+ts[i][2];
double mu3p=opt->cam.K[6]+opt->cam.K[0]*X3p/Z3p;
double mv3p=opt->cam.K[7]+opt->cam.K[4]*Y3p/Z3p;
double reproj=(mu3p-mu3)*(mu3p-mu3)+(mv3p-mv3)*(mv3p-mv3);
if (i==0||min_reproj>reproj) {
ns=i; min_reproj=reproj;
}
}
for (i=0;i<3;i++) {
for (j=0;j<3;j++) R[i][j]=Rs[ns][i][j];
t[i]=ts[ns][i];
}
return 1;
}
/* p3p pose estimation use only three points----------------------------------
* args: feature *feats I feature points
* int nf I number of feature points
* double *xp I points of world frame
* int np I number of points in world frame
* voopt_t *opt I options
* double *R,*t O rotation matrix and translation vector
* return: status (1: ok,0: fail)
* note: input more than four points, use three to solve, use others to validate
* ---------------------------------------------------------------------------*/
extern int p3pthree(const feature *feats,int nf,double *xp,int np,
const voopt_t *opt,double *R,double *t)
{
double Rot[3][3],trans[3];
trace(3,"p3pthree:\n");
if (nf<4||np<4) {
trace(2,"need more than four feature points\n");
return 0;
}
double mp[2*4];
int i,j;
for (i=0;i<4;i++) {
mp[2*i+0]=feats[i].u; mp[2*i+1]=feats[i].v;
}
if (!p3psolve(Rot,trans,opt,mp[0],mp[1],xp[0],xp[1],xp[2],
mp[2],mp[3],xp[3],xp[ 4],xp[ 5],
mp[4],mp[5],xp[6],xp[ 7],xp[ 8],
mp[6],mp[7],xp[9],xp[10],xp[11])) {
trace(2,"p3pthree solve fail\n");
seteye(R,3); setzero(t,1,3);
return 0;
}
for (i=0;i<3;i++) {
for (j=0;j<3;j++) R[i+3*j]=Rot[i][j];
t[i]=trans[i];
}
return 1;
}
/* p3p pose estimation--------------------------------------------------------
* args: feature *feats I feature points
* int nf I number of feature points
* double *xp I points of world frame
* int np I number of points in world frame
* voopt_t *opt I options
* double *R,*t O rotation matrix and translation vector
* return: status (1: ok,0: fail)
* ---------------------------------------------------------------------------*/
extern int p3p(const feature *feats,int nf,const double *xp,int np,
const voopt_t *opt,double *R,double *t)
{
trace(3,"p3p:\n");
} | [
"1971129844@qq.com"
] | 1971129844@qq.com |
c462da1dc851b235af7309eb933bbc89a6f55e36 | 3482e6df74b3b47854adfe6050c60f7d206ed86b | /c++/studium/numerik/vonMises.cpp | 1b482dd8d7d4a87f74e6b9c86e1836e218e3ca32 | [] | no_license | acpanna/coding | 8bef9275dc8a6606cc9d687bb3683ead79dacb7c | a0c9a6023c91c5a6f220b9b9f7170f7cb0b12c72 | refs/heads/master | 2020-12-03T08:13:17.116743 | 2013-10-01T08:02:47 | 2013-10-01T08:02:47 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 4,041 | cpp | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <fstream.h>
int main(void)
{
char enter, datei[256];
double **matrix;
double *vektor1;
double *vektor2;
double norm;
unsigned int zeilen, iterationen;
unsigned int i, j, k;
printf("Von - Mises - Eigenwert/Eigenvektor - Iteration\n");
printf("===============================================\n\n");
printf("\nBitte geben Sie die Dimension der quadrat. Matrix an : ");
scanf("%u",&zeilen);
if (zeilen == 0)
exit(1);
/* Speicherreservierung für Matrix, vektor1 und vektor2 */
matrix = (double **) calloc(zeilen, sizeof(double));
vektor1 = (double *) calloc(zeilen, sizeof(double));
vektor2 = (double *) calloc(zeilen, sizeof(double));
if (matrix == NULL || vektor1 == NULL || vektor2 == NULL)
{
printf("\n\nEs konnte nicht genügend freier Speicherplatz bereitgestellt");
printf("\nwerden, Sie müssen die Dimensionen kleiner wählen");
exit(1);
}
else
{
for (i=0; i<zeilen; i++)
{
matrix[i] = (double *) calloc(zeilen, sizeof(double));
if (matrix[i] == NULL)
{
printf("\n\nEs konnte nicht genügend freier Speicherplatz bereitgestellt");
printf("\nwerden, Sie müssen die Dimensionen kleiner wählen");
exit(1);
}
}
}
printf("\nWollen Sie die Matrix aus einer Datei einlesen (j/n) : ");
scanf(" %c",&enter);
if (enter == 'j' || enter == 'J')
{
printf("Dateiname : ");
scanf("%s",&datei);
ifstream fin(datei); /* Einlesen der Matrix */
for (i=0; i<zeilen; i++)
for (j=0; j<zeilen; j++)
{
if (fin.eof())
{
printf("\nEinlesefehler !!! Programmabbruch !!!");
exit(1);
}
fin >> matrix[i][j];
}
fin.close();
}
else /* Eingabe der Matrix */
{
printf("\nBitte geben Sie nun die Matrixeinträge ein :\n");
for (i=0; i<zeilen; i++)
for (j=0; j<zeilen; j++)
{
printf("Eintrag (%u,%u) : ",i+1,j+1);
cin >> matrix[i][j];
}
}
printf("\nWollen Sie den Startvektor aus einer Datei einlesen (j/n) : ");
scanf(" %c",&enter);
if (enter == 'j' || enter == 'J')
{
printf("Dateiname : ");
scanf("%s",&datei);
ifstream fin(datei); /* Einlesen des Startvektors */
for (i=0; i<zeilen; i++)
{
if (fin.eof())
{
printf("\nEinlesefehler !!! Programmabbruch !!!");
exit(1);
}
fin >> vektor1[i];
}
fin.close();
}
else /* Eingabe des Startvektors */
{
printf("\nBitte geben Sie nun den Startvektor ein :\n");
for (i=0; i<zeilen; i++)
{
printf("Eintrag (%u) : ",i+1);
cin >> vektor1[i];
}
}
printf("\nBitte geben Sie die maximale Iterationszahl ein : ");
scanf("%u",&iterationen);
/* ///// Beginn der Iteration ///// */
for (k=0; k<iterationen; k++)
{
norm = 0.0;
for (i=0; i<zeilen; i++)
norm += pow(vektor1[i],2); // Normierung des (Start-) Vektors
norm = sqrt(norm);
for (i=0; i<zeilen; i++)
vektor1[i] /= norm;
for (i=0; i<zeilen; i++) // Multiplikation A * x(i)
{
vektor2[i] = 0.0;
for(j=0; j<zeilen;j++)
vektor2[i] += matrix[i][j] * vektor1[j];
}
for (i=0; i<zeilen; i++) // Kopiere gewonne Iterierte in vektor1
{
double temp;
temp = vektor1[i];
vektor1[i] = vektor2[i];
vektor2[i] = temp;
}
/* // Ausgabeanfang // */
printf("\n\nEigenvektor : (%lg",vektor2[0]);
for (i=1; i<zeilen; i++)
printf(", %lg",vektor2[i]);
printf(")");
printf("\nKomponentenweise Eigenwerte : ");
for (i=0; i<zeilen; i++)
printf("%lg ",vektor1[i]/vektor2[i]);
/* // Ausgabeende // */
}
/* ///// Ende der Iteration ///// */
printf("\n\n");
for (i=0; i<zeilen; i++)
delete matrix[i];
delete matrix;
delete vektor1;
delete vektor2;
return 0;
}
| [
"heiko.vogel@birdworx.de"
] | heiko.vogel@birdworx.de |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.