blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
247
content_id
stringlengths
40
40
detected_licenses
listlengths
0
57
license_type
stringclasses
2 values
repo_name
stringlengths
4
111
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
58
visit_date
timestamp[ns]date
2015-07-25 18:16:41
2023-09-06 10:45:08
revision_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
committer_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
github_id
int64
3.89k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
25 values
gha_event_created_at
timestamp[ns]date
2012-06-07 00:51:45
2023-09-14 21:58:52
gha_created_at
timestamp[ns]date
2008-03-27 23:40:48
2023-08-24 19:49:39
gha_language
stringclasses
159 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
10.5M
extension
stringclasses
111 values
filename
stringlengths
1
195
text
stringlengths
7
10.5M
eea41ddfc407988df773276b1253e2f528d87086
e5091c3a8477fa12e1adfdb1f3d826eb6e9bb2be
/Kattis/implementation_irregularities.cpp
b0353feaf36ee7040538c17bbddabef5282eba41
[]
no_license
leonardoAnjos16/Competitive-Programming
1db3793bfaa7b16fc9a2854c502b788a47f1bbe1
4c9390da44b2fa3c9ec4298783bfb3258b34574d
refs/heads/master
2023-08-14T02:25:31.178582
2023-08-06T06:54:52
2023-08-06T06:54:52
230,381,501
7
0
null
null
null
null
UTF-8
C++
false
false
644
cpp
implementation_irregularities.cpp
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector<pair<int, int>> problems(n); for (int i = 0; i < n; i++) cin >> problems[i].second; for (int i = 0; i < n; i++) cin >> problems[i].first; sort(problems.begin(), problems.end()); int idx = 0; while (idx < n && problems[idx].first == -1) idx++; int need = 0, ans = 1; for (int i = idx; i < n; i++) { need += problems[i].second; ans = max(ans, (need + problems[i].first - 1) / problems[i].first); } cout << ans << "\n"; }
dda08f5df0ba8302a09ecaf72725dd9c8f0cd73e
52346de88a47f70ed63335b21ff12748bbbb5cba
/modules/canbus/vehicle/lincoln/protocol/gps_6f.cc
d06a413e782fbe5b8fa7bcd82404288841b180b6
[ "Apache-2.0" ]
permissive
lgsvl/apollo-5.0
064537e31c5d229c0712bfcd4109af71dbf1d09d
105f7fd19220dc4c04be1e075b1a5d932eaa2f3f
refs/heads/simulator
2022-03-08T09:18:02.378176
2021-10-01T22:07:57
2021-10-01T22:07:57
203,249,539
86
115
Apache-2.0
2022-02-11T02:55:46
2019-08-19T21:00:15
C++
UTF-8
C++
false
false
3,515
cc
gps_6f.cc
/****************************************************************************** * Copyright 2017 The Apollo Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *****************************************************************************/ #include "modules/canbus/vehicle/lincoln/protocol/gps_6f.h" #include "modules/drivers/canbus/common/byte.h" namespace apollo { namespace canbus { namespace lincoln { using ::apollo::drivers::canbus::Byte; const int32_t Gps6f::ID = 0x6F; void Gps6f::Parse(const std::uint8_t *bytes, int32_t length, ChassisDetail *chassis_detail) const { chassis_detail->mutable_basic()->set_altitude(altitude(bytes, length)); chassis_detail->mutable_basic()->set_heading(heading(bytes, length)); // speed mph -> mps chassis_detail->mutable_basic()->set_gps_speed(speed(bytes, length) * 0.44704); chassis_detail->mutable_basic()->set_hdop(hdop(bytes, length)); chassis_detail->mutable_basic()->set_vdop(vdop(bytes, length)); switch (fix_quality(bytes, length)) { case 0: chassis_detail->mutable_basic()->set_quality(FIX_NO); break; case 1: chassis_detail->mutable_basic()->set_quality(FIX_2D); break; case 2: chassis_detail->mutable_basic()->set_quality(FIX_3D); break; default: chassis_detail->mutable_basic()->set_quality(FIX_INVALID); break; } chassis_detail->mutable_basic()->set_num_satellites( num_satellites(bytes, length)); } double Gps6f::altitude(const std::uint8_t *bytes, int32_t length) const { Byte high_frame(bytes + 1); int32_t high = high_frame.get_byte(0, 8); Byte low_frame(bytes + 0); int32_t low = low_frame.get_byte(0, 8); int32_t value = (high << 8) | low; if (value > 0x7FFF) { value -= 0x10000; } return value * 0.250000; } double Gps6f::heading(const std::uint8_t *bytes, int32_t length) const { Byte high_frame(bytes + 3); int32_t high = high_frame.get_byte(0, 8); Byte low_frame(bytes + 2); int32_t low = low_frame.get_byte(0, 8); int32_t value = (high << 8) | low; return value * 0.010000; } int32_t Gps6f::speed(const std::uint8_t *bytes, int32_t length) const { Byte frame(bytes + 4); int32_t x = frame.get_byte(0, 8); return x; } double Gps6f::hdop(const std::uint8_t *bytes, int32_t length) const { Byte frame(bytes + 5); int32_t x = frame.get_byte(0, 5); return x * 0.200000; } double Gps6f::vdop(const std::uint8_t *bytes, int32_t length) const { Byte frame(bytes + 6); int32_t x = frame.get_byte(0, 5); return x * 0.200000; } int32_t Gps6f::fix_quality(const std::uint8_t *bytes, int32_t length) const { Byte frame(bytes + 7); int32_t x = frame.get_byte(0, 3); return x; } int32_t Gps6f::num_satellites(const std::uint8_t *bytes, int32_t length) const { Byte frame(bytes + 7); int32_t x = frame.get_byte(3, 5); return x; } } // namespace lincoln } // namespace canbus } // namespace apollo
e466f59e876df98d26e6e81051a3804d346aa1fa
3cdd3db4e683b2b080124f0014307c080db1972d
/DeusExMachina/DeusExMachina/Color.hpp
e1e11b113e7b200794652a9d68e83bca2cb50c3a
[]
no_license
jamalbouizem/Deus-Ex-Machina
fa4b4cc9b68916db8deba4c8c0166828006d17a6
8f5127b4981ab533b3b59bbabc64ce3d0f45ed88
refs/heads/master
2021-05-31T04:08:36.736489
2016-04-27T09:09:20
2016-04-27T09:09:20
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,411
hpp
Color.hpp
#ifndef COLOR_HPP #define COLOR_HPP #include <iostream> #include <cmath> namespace DEM { namespace Math { class Color { public: float r, g, b, a; Color(); Color(float r, float g, float b, float a); Color(const Color& v); virtual ~Color(); void set(float r, float g, float b, float a); float length() const; float distance(const Color& v) const; Color& normalize(); Color normalized(); float dot(const Color& v); Color cross(const Color& v) const; friend std::ostream& operator<<(std::ostream& out, const Color& v); Color& operator+=(const Color& v); Color operator+(const Color& v); Color& operator-=(const Color& v); Color operator-(const Color& v); Color& operator*=(const Color& v); Color operator*(const Color& v); Color& operator/=(const Color& v); Color operator/(const Color& v); Color operator-(); bool operator==(const Color& v); bool operator<(const Color& v); bool operator!=(const Color& v); bool operator>(const Color& v); bool operator>=(const Color& v); bool operator<=(const Color& v); Color& operator+=(float v); Color operator+(float v); Color& operator-=(float v); Color operator-(float v); Color& operator*=(float v); Color operator*(float v); Color& operator/=(float v); Color operator/(float v); }; }; }; #endif
fbfd329bad98b09c77045731da48d5423c2614d2
8533cf7eafdcd9608003beb9beb0a12a802f21ac
/RPG-PK4/SkillTreeWarrior.cpp
fde53c4ec6605546eff0665239820d518b8d0ce0
[]
no_license
namzil/RPG-PK4
4c42e785b12373c55348892572c79f6f2bb05d28
395d56a1cc21ecf3f91a456477d6c874e6739847
refs/heads/Player
2021-01-17T12:56:49.809901
2016-06-13T21:29:41
2016-06-13T21:29:41
56,842,501
0
0
null
null
null
null
UTF-8
C++
false
false
235
cpp
SkillTreeWarrior.cpp
#include "SkillTreeWarrior.h" SkillTreeWarrior::SkillTreeWarrior() { } SkillTreeWarrior::~SkillTreeWarrior() { } void SkillTreeWarrior::showSkills() { SkillTree::showSkills(); heroicStrike.isAvalible(); bloodlust.isAvalible(); }
2e8be8aac0408614fbfd6edc8af6076b8598299e
95b8976fd25d5f9241a10b862b909b0286059591
/ActivityScanning/CPU.cpp
09eb1be78f642744988a0ea04d269d6413e0811d
[]
no_license
JedrzejKieruj/ProjektSymulacyjny
e217788279eda256d2ff938e2899ccdbb13fc604
ba066bbaa7e4f655da447d018503b99320ca397f
refs/heads/master
2020-05-14T19:32:52.897025
2019-05-12T19:12:17
2019-05-12T19:12:17
181,928,866
0
0
null
null
null
null
UTF-8
C++
false
false
852
cpp
CPU.cpp
#include "CPU.h" CPU::CPU() { process_cpu = nullptr; workingTime = 0; serviceStart = -1; serviceEnd = -1; } CPU::~CPU() { } Process * CPU::get_process_cpu() { return process_cpu; } void CPU::assign_process_to_cpu(Process * _p, long time) { if (process_cpu == nullptr) { process_cpu = _p; if (_p->get_IOT() > 0) { serviceEnd = time + fmin(_p->get_IOT(), _p->get_CET()); } else { serviceEnd = time + _p->get_CET(); serviceStart = time; } workingTime = serviceEnd - time; } } long CPU::getWorkingTime() { return workingTime; } void CPU::take_out_process_from_CPU() { if (process_cpu != nullptr) { process_cpu->uptade_CET_ICT(); process_cpu = nullptr; serviceEnd = -1; serviceStart = -1; } } long CPU::getServiceEnd() { return serviceEnd; } long CPU::getServiceStart() { return serviceStart; }
b4204f65f14148815ca8ca7b2df16bb6acddfef0
67c2e1ce81b343952e96b09e2eaf1ddc7f3888fc
/Rendering/RDepthStencilState.cpp
04eae121d4413924a9d562666245c62fa42d4d6c
[]
no_license
aclysma/Helium
806c5a3954ecd162a1a7137562bd0f71e084423a
a009248596b2e537ccb8e7c3e587628b8bda8b7a
refs/heads/master
2021-01-18T05:31:57.004647
2011-06-07T04:49:10
2011-06-07T04:49:10
1,301,697
1
0
null
null
null
null
UTF-8
C++
false
false
685
cpp
RDepthStencilState.cpp
//---------------------------------------------------------------------------------------------------------------------- // RDepthStencilState.cpp // // Copyright (C) 2010 WhiteMoon Dreams, Inc. // All Rights Reserved //---------------------------------------------------------------------------------------------------------------------- #include "RenderingPch.h" #include "Rendering/RDepthStencilState.h" using namespace Lunar; /// Destructor. RDepthStencilState::~RDepthStencilState() { } /// @fn void RDepthStencilState::GetDescription( Description& rDescription ) const /// Get the engine description of this state object. /// /// @param[out] rDescription State description.
cd3c51299e992e819f4fd565512a601b2414e63b
f8bba7fcdfc0423ee6a292289d25dc7d778ab30f
/coding_test_techgig2021/djiktra_optimized.cpp
d0503315b8528530930aa3aec89fc2976e9652ec
[]
no_license
gnsendhil/Programming_practice
936e4ad4a21d9cf417bdacc1d7fc0872be336733
5d11640184239fb054e6d2128c7e4d07b36c422c
refs/heads/main
2023-08-31T15:58:33.354102
2021-10-14T02:21:00
2021-10-14T02:21:00
382,007,270
0
0
null
null
null
null
UTF-8
C++
false
false
1,928
cpp
djiktra_optimized.cpp
#include <bits/stdc++.h> using namespace std; void shortest_path(int num, vector<pair<int,int>> Graph[]) { int inf = (int)1e8; vector<int> Distance(num+1, inf); Distance[1] = 0; set<pair<int, int>> Queue; Queue.insert({0,1}); while(!Queue.empty()) { auto top = Queue.begin(); //cout<<top->second<<endl; int index = top->second; //cout<<"index_pointer:"<<index<<endl; Queue.erase(top); for(auto next: Graph[index]){ int v = next.first, cost = next.second; //cout<<"index:"<<next.first<<"cost:"<<cost<<"min_dist"<<Distance[index]<<endl; if (cost < Distance[index]) { cost = 0; } else { cost = cost - Distance[index]; } if( Distance[index] + cost < Distance[v] ) { if(Queue.find( {Distance[v],v})!=Queue.end()) Queue.erase(Queue.find( {Distance[v], v} )); Distance[v] = Distance[index] + cost; Queue.insert( {Distance[v], v} ); } } //cout<<"index_pointer:"<<index<<endl; /*for(int i=0; i<=num; i++) { cout<<Distance[i]<<" "; } cout<<endl;*/ } if(Distance[num] != inf) cout<<Distance[num]; else cout<<"NOT POSSIBLE"; } int main(){ int num, R, Hi, Hj, C; cin >>num>>R; vector<pair<int, int> > *Graph = new vector<pair<int, int> > [num+1]; for(int i=0; i<R; i++) { cin>>Hi>>Hj>>C; Graph[Hi].push_back(make_pair(Hj, C)); Graph[Hj].push_back(make_pair(Hi, C)); } /*for(int i=1; i<=num; i++ ) { for(auto next: Graph[i]) { cout<<i<<"->"<<next.first<<":"<<next.second; cout<<" "; } cout<<endl; }*/ shortest_path(num, Graph); }
f7cce0c6968d1f11b5190c327bacab2d36443dbf
6c4b9816db3f93e09ffc8f85606da3b9a927bd05
/Source/UR_FPS_Shooter/UR_FPS_ShooterGameMode.h
e52a44f0a371dcff06ae3224605d21d52fe89ebb
[]
no_license
Balaji-Ganesh-AK/FPS_Shooter_Udemy
a1a4c1ad2d63ec33076ba836204ea54225d9ceff
ab3232f7d3e9d53b822ba14dbeb6ba220a8f63cf
refs/heads/master
2020-05-31T06:56:02.752714
2019-07-03T14:33:42
2019-07-03T14:33:42
null
0
0
null
null
null
null
UTF-8
C++
false
false
323
h
UR_FPS_ShooterGameMode.h
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "GameFramework/GameModeBase.h" #include "UR_FPS_ShooterGameMode.generated.h" UCLASS(minimalapi) class AUR_FPS_ShooterGameMode : public AGameModeBase { GENERATED_BODY() public: AUR_FPS_ShooterGameMode(); };
8d521d3b072381f4223ae3c3760d2bfe5406edbf
1519b3d0957ca2a6a3c42719c07813a438b8e5d4
/dialog.cpp
829c5617a44dbc810fc67392c2bb929eb6fc95b5
[]
no_license
zhhelical/zhjsfile
6f2d3a820b9149113cb2fb17238fdcdaa609ed49
d206581d810e6d715ca1764b4b139c1da476e853
refs/heads/master
2021-01-11T08:49:15.285792
2018-01-07T10:42:27
2018-01-07T10:42:27
76,761,403
0
0
null
null
null
null
UTF-8
C++
false
false
28,001
cpp
dialog.cpp
#include <QtGui> #include "dialog.h" #include "mainwindow.h" #include "tablemanagement.h" #include "dataestableview.h" #include "relatedtreeview.h" #include "littlewidgetsview.h" #include "littlewidgetitem.h" #include "spcdatabase.h" DiaLog::DiaLog(QWidget * parent) :QDialog(parent, Qt::FramelessWindowHint), r_chk(false), sure(false), unsure(false), dialog_animation(0), w_inspector(0) { setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_TranslucentBackground, true); setModal(true); } DiaLog::~DiaLog() {} void DiaLog::initWinDialog(MainWindow * guider, const QString & information, int type) { w_inspector = guider; if (information.contains("hint:")) initHintDialog(information); else if (information.contains("warning:")) initWarningDialog(information, type); else initErrorDialog(information); } void DiaLog::initSaveStrDefineDialog(MainWindow * guider, SpcDataBase * db, const QString & passwd) { inputor = passwd; w_inspector = guider; search_db = db; QVBoxLayout * v_layout = new QVBoxLayout(this); QLabel * input_label = new QLabel; input_label -> setFont(QFont("宋体", 10)); input_label -> setStyleSheet("QLabel{color: black; background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #88d, stop: 0.1 #99e, stop: 0.49 #77c, stop: 0.5 #66b, stop: 1 #77c); border-width: 1px; border-color: #339; border-style: solid; border-radius: 7; padding: 3px; font-size: 10px; padding-left: 5px; padding-right: 5px; min-height: 13px; max-height: 13px;}"); if (passwd == tr("导出图片")) input_label -> setText(tr("请输入图片名")); else input_label -> setText(tr("请输入文件名")); QTextEdit * editor = new QTextEdit; connect(editor, SIGNAL(cursorPositionChanged()), this, SLOT(resetLabelColor())); editor -> setStyleSheet("color: white; border: 1px solid rgb(50, 50, 50); border-radius: 3; background: rgb(50, 50, 50)"); QFontMetrics fm(input_label->font()); int width = fm.width(input_label->text()); input_label -> setFixedWidth(width); editor -> setFixedWidth(width*2); editor -> setFixedHeight(60); QHBoxLayout * h_layout = new QHBoxLayout; QPushButton * ok_button = new QPushButton(tr("确定")); ok_button -> setFocusPolicy(Qt::NoFocus); ok_button -> setStyleSheet("QPushButton,QToolButton{color: black; background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #88d, stop: 0.1 #99e, stop: 0.49 #77c, stop: 0.5 #66b, stop: 1 #77c); border-width: 1px; border-color: #339; border-style: solid; border-radius: 7; padding: 3px; font-size: 10px; padding-left: 5px; padding-right: 5px; min-width: 50px; max-width: 50px; min-height: 13px; max-height: 13px;} QPushButton::pressed,QToolButton::pressed{background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #969B9C, stop: 0.5 #16354B, stop: 1.0 #244F76); border-color: #11505C;}"); if (passwd!=tr("导出文件") && passwd!=tr("导出图片")) connect(ok_button, SIGNAL(clicked()), this, SLOT(judgeInputTextForSave())); else connect(ok_button, SIGNAL(clicked()), this, SLOT(judgeInputTextForExport())); QPushButton * cancel_button = new QPushButton(tr("取消")); cancel_button -> setFocusPolicy(Qt::NoFocus); cancel_button -> setStyleSheet("QPushButton,QToolButton{color: black; background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #88d, stop: 0.1 #99e, stop: 0.49 #77c, stop: 0.5 #66b, stop: 1 #77c); border-width: 1px; border-color: #339; border-style: solid; border-radius: 7; padding: 3px; font-size: 10px; padding-left: 5px; padding-right: 5px; min-width: 50px; max-width: 50px; min-height: 13px; max-height: 13px;} QPushButton::pressed,QToolButton::pressed{background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #969B9C, stop: 0.5 #16354B, stop: 1.0 #244F76); border-color: #11505C;}"); connect(cancel_button, SIGNAL(clicked()), this, SLOT(onCancel())); h_layout -> addWidget(ok_button); h_layout -> addWidget(cancel_button); v_layout -> addWidget(input_label); v_layout -> setAlignment(input_label, Qt::AlignCenter); v_layout -> addWidget(editor); v_layout -> setAlignment(editor, Qt::AlignCenter); v_layout -> addLayout(h_layout); v_layout->setSpacing(5); v_layout->setContentsMargins(0, 0, 0, 0); show(); openMeOnAnimation(); } void DiaLog::showForCollisionDbsDataes(const QHash<QString, QString> & projs, const QHash<QString, QString> & managers, MainWindow * p_mw) { w_inspector = p_mw; search_db = w_inspector->curBackGuider(); QVBoxLayout * v_layout = new QVBoxLayout(this); QLabel * warn_label = new QLabel; warn_label -> setFixedHeight(30); warn_label -> setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); QPixmap pixmap(":/images/warn.png"); QPixmap w_pix = pixmap.scaled(warn_label->frameSize(), Qt::KeepAspectRatio); warn_label -> setPixmap(w_pix); QString n_info(tr("两个数据库内工程名称、人员密码冲突\n请在如下的表格中修改冲突的工程名称、人员密码\n修改规则:\nA 修改内容不能为空\nB 工程名称不能包含标点符号\nC 人员密码不能包含标点符号")); QLabel * info_label = new QLabel(n_info); info_label -> setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); info_label -> setFont(QFont("Microsoft YaHei", 8)); defineDialogLabelSize(info_label); QString style_sheet("color: white; border: 1px solid rgb(50, 50, 50); border-radius: 5px; background: rgb(50, 50, 50)"); info_label -> setStyleSheet(style_sheet); QStandardItemModel * d_model = new QStandardItemModel(this); d_model -> setColumnCount(4); DataesTableView * collide_view = new DataesTableView(0, 5, search_db); collide_view -> setStyleSheet("font-family: Microsoft YaHei; font-size:12px; border: 0px groove gray; border-radius: 4px;"); collide_view -> setModel(d_model); QModelIndex projs_title; if (!projs.isEmpty()) { d_model -> insertRows(0, 2+projs.size()); d_model -> setData(d_model->index(0, 0), tr("冲突的工程")); d_model -> setData(d_model->index(0, 1), tr("工程名称相同")); projs_title = d_model->index(0, 1); d_model -> setData(d_model->index(1, 0), tr("工程原名称")); d_model -> setData(d_model->index(1, 1), tr("修改后名称")); foreach (QString n_proj, projs.keys()) { QStringList real_proj = n_proj.split(tr(",,。")); d_model -> setData(d_model->index(2+projs.keys().indexOf(n_proj), 0), real_proj.at(1)); } } QModelIndex mngs_title; if (!managers.isEmpty()) { int bottomn = d_model->rowCount(); d_model -> insertRows(bottomn, 2+managers.size()); d_model -> setData(d_model->index(bottomn, 0), tr("冲突的密码")); d_model -> setData(d_model->index(bottomn, 1), tr("人员密码相同")); mngs_title = d_model->index(bottomn, 1); d_model -> setData(d_model->index(bottomn+1, 0), tr("人员姓名")); d_model -> setData(d_model->index(bottomn+1, 1), tr("人员密码")); d_model -> setData(d_model->index(bottomn+1, 2), tr("修改后密码")); d_model -> setData(d_model->index(bottomn+1, 3), tr("同一人?")); foreach (QString n_manager, managers.keys()) { QStringList real_mng = n_manager.split(tr(",,。")); d_model -> setData(d_model->index(bottomn+2+managers.keys().indexOf(n_manager), 0), real_mng.at(1)); d_model -> setData(d_model->index(bottomn+2+managers.keys().indexOf(n_manager), 1), real_mng.at(2)); } } collide_view -> resizeColumnsToContents(); collide_view -> setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); collide_view -> setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); collide_view->verticalHeader()->close(); collide_view->horizontalHeader()->close(); collide_view -> changeViewStateForNewModel(); if (projs_title.isValid()) collide_view -> setSpan(projs_title.row(), projs_title.column(), 1, 3); if (mngs_title.isValid()) collide_view -> setSpan(mngs_title.row(), mngs_title.column(), 1, 3); LittleWidgetsView * dec_view = new LittleWidgetsView(this); dec_view -> setMainQmlFile("/home/dapang/workstation/spc-tablet/spc_qml/tablesviewer.qml"); QRect v_rect(0, 0, info_label->width(), info_label->height()*2); dec_view -> initMarginForParent(v_rect); dec_view -> setViewForRelatedTable(collide_view); QHBoxLayout * h_layout = new QHBoxLayout; QPushButton * ok_button = new QPushButton(tr("确定")); ok_button -> setFocusPolicy(Qt::NoFocus); ok_button -> setStyleSheet("QPushButton,QToolButton{color: black; background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #88d, stop: 0.1 #99e, stop: 0.49 #77c, stop: 0.5 #66b, stop: 1 #77c); border-width: 1px; border-color: #339; border-style: solid; border-radius: 7; padding: 3px; font-size: 10px; padding-left: 5px; padding-right: 5px; min-width: 50px; max-width: 50px; min-height: 13px; max-height: 13px;} QPushButton::pressed,QToolButton::pressed{background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #969B9C, stop: 0.5 #16354B, stop: 1.0 #244F76); border-color: #11505C;}"); connect(ok_button, SIGNAL(clicked()), this, SLOT(chkSaveDbsCollideDataes())); QPushButton * cancel_button = new QPushButton(tr("取消")); cancel_button -> setFocusPolicy(Qt::NoFocus); cancel_button -> setStyleSheet("QPushButton,QToolButton{color: black; background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #88d, stop: 0.1 #99e, stop: 0.49 #77c, stop: 0.5 #66b, stop: 1 #77c); border-width: 1px; border-color: #339; border-style: solid; border-radius: 7; padding: 3px; font-size: 10px; padding-left: 5px; padding-right: 5px; min-width: 50px; max-width: 50px; min-height: 13px; max-height: 13px;} QPushButton::pressed,QToolButton::pressed{background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #969B9C, stop: 0.5 #16354B, stop: 1.0 #244F76); border-color: #11505C;}"); connect(cancel_button, SIGNAL(clicked()), this, SLOT(onCancel())); h_layout -> addWidget(ok_button); h_layout -> addWidget(cancel_button); v_layout -> addWidget(warn_label); v_layout -> addWidget(info_label); v_layout -> addWidget(dec_view); v_layout -> addLayout(h_layout); v_layout -> setContentsMargins(0, 0, 0, 0); v_layout -> setSpacing(2); show(); openMeOnAnimation(); } bool DiaLog::chkCollideDbsState() { return r_chk; } void DiaLog::initHintDialog(const QString & info) { QVBoxLayout * v_layout = new QVBoxLayout(this); QLabel * error_label = new QLabel; error_label -> setFixedHeight(30); error_label -> setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); QPixmap pixmap(":/images/lamp.png"); QPixmap e_pix = pixmap.scaled(error_label->frameSize(), Qt::KeepAspectRatio); error_label -> setPixmap(e_pix); QString n_info = info; QStringList info_list = n_info.split(":"); QLabel * info_label = new QLabel(info_list[1]); info_label -> setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); info_label -> setFont(QFont("Microsoft YaHei", 10)); defineDialogLabelSize(info_label); /* QFontMetrics fm(info_label->font()); int width = fm.width(info_label->text()); info_label -> setFixedWidth(width); int height = fm.height()*(info_list[1].count("\n")+1); info_label -> setFixedHeight(height);*/ QString radius; if (!info_list[1].contains("\n")) radius = "3px"; else radius = "10px"; QString style_sheet = QString("color: white; border: 1px solid rgb(50, 50, 50); border-radius: %1; background: rgb(50, 50, 50)").arg(radius); info_label -> setStyleSheet(style_sheet); QPushButton * ok_button = new QPushButton(tr("知道了")); ok_button -> setFocusPolicy(Qt::NoFocus); ok_button -> setStyleSheet("QPushButton,QToolButton{color: black; background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #88d, stop: 0.1 #99e, stop: 0.49 #77c, stop: 0.5 #66b, stop: 1 #77c); border-width: 1px; border-color: #339; border-style: solid; border-radius: 7; padding: 3px; font-size: 10px; padding-left: 5px; padding-right: 5px; min-width: 50px; max-width: 50px; min-height: 13px; max-height: 13px;} QPushButton::pressed,QToolButton::pressed{background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #969B9C, stop: 0.5 #16354B, stop: 1.0 #244F76); border-color: #11505C;}"); connect(ok_button, SIGNAL(clicked()), this, SLOT(onSure())); ok_button -> setFixedHeight(15); ok_button -> setFixedWidth(30); v_layout -> addWidget(error_label); v_layout -> addWidget(info_label); v_layout -> addWidget(ok_button); v_layout -> setAlignment(ok_button, Qt::AlignCenter); v_layout->setSpacing(5); v_layout->setContentsMargins(0, 0, 0, 0); show(); openMeOnAnimation(); } void DiaLog::initWarningDialog(const QString & info, int type) { QHBoxLayout * h_layout = new QHBoxLayout; QVBoxLayout * v_layout = new QVBoxLayout(this); QLabel * warn_label = new QLabel; warn_label -> setFixedHeight(30); warn_label -> setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); QPixmap pixmap(":/images/warn.png"); QPixmap w_pix = pixmap.scaled(warn_label->frameSize(), Qt::KeepAspectRatio); warn_label -> setPixmap(w_pix); QString n_info = info; QStringList info_list = n_info.split(":"); QLabel * info_label = new QLabel(info_list[1]); info_label -> setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); info_label -> setFont(QFont("宋体", 10)); defineDialogLabelSize(info_label); QString radius; if (!info_list[1].contains("\n")) radius = "3px"; else radius = "10px"; QString style_sheet = QString("color: white; border: 1px solid rgb(50, 50, 50); border-radius: %1; background: rgb(50, 50, 50)").arg(radius); info_label -> setStyleSheet(style_sheet); QPushButton * ok_button = new QPushButton(tr("确定")); ok_button -> setFocusPolicy(Qt::NoFocus); ok_button -> setStyleSheet("QPushButton,QToolButton{color: black; background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #88d, stop: 0.1 #99e, stop: 0.49 #77c, stop: 0.5 #66b, stop: 1 #77c); border-width: 1px; border-color: #339; border-style: solid; border-radius: 7; padding: 3px; font-size: 10px; padding-left: 5px; padding-right: 5px; min-width: 50px; max-width: 50px; min-height: 13px; max-height: 13px;} QPushButton::pressed,QToolButton::pressed{background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #969B9C, stop: 0.5 #16354B, stop: 1.0 #244F76); border-color: #11505C;}"); QPushButton * cancel_button = new QPushButton(tr("取消")); if (type == 1) { delete cancel_button; delete h_layout; } else if (type == 2) connect(ok_button, SIGNAL(clicked()), w_inspector, SLOT(returnLastMenu())); else { cancel_button -> setFocusPolicy(Qt::NoFocus); cancel_button -> setStyleSheet("QPushButton,QToolButton{color: black; background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #88d, stop: 0.1 #99e, stop: 0.49 #77c, stop: 0.5 #66b, stop: 1 #77c); border-width: 1px; border-color: #339; border-style: solid; border-radius: 7; padding: 3px; font-size: 10px; padding-left: 5px; padding-right: 5px; min-width: 50px; max-width: 50px; min-height: 13px; max-height: 13px;} QPushButton::pressed,QToolButton::pressed{background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #969B9C, stop: 0.5 #16354B, stop: 1.0 #244F76); border-color: #11505C;}"); connect(cancel_button, SIGNAL(clicked()), this, SLOT(onCancel())); } connect(ok_button, SIGNAL(clicked()), this, SLOT(onSure())); v_layout -> addWidget(warn_label); v_layout -> addWidget(info_label); if (info.contains(tr("输入姓名密码"))) { QLabel * name_label = new QLabel(tr("姓名:")); name_label -> setStyleSheet("QLabel{color: black; background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #88d, stop: 0.1 #99e, stop: 0.49 #77c, stop: 0.5 #66b, stop: 1 #77c); border-width: 1px; border-color: #339; border-style: solid; border-radius: 7; padding: 3px; font-size: 10px; padding-left: 5px; padding-right: 5px; min-width: 50px; max-width: 50px; min-height: 13px; max-height: 13px;} QPushButton::pressed,QToolButton::pressed{background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #969B9C, stop: 0.5 #16354B, stop: 1.0 #244F76); border-color: #11505C;}"); QLabel * pwd_label = new QLabel(tr("密码:")); pwd_label -> setStyleSheet("QLabel{color: black; background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #88d, stop: 0.1 #99e, stop: 0.49 #77c, stop: 0.5 #66b, stop: 1 #77c); border-width: 1px; border-color: #339; border-style: solid; border-radius: 7; padding: 3px; font-size: 10px; padding-left: 5px; padding-right: 5px; min-width: 50px; max-width: 50px; min-height: 13px; max-height: 13px;} QPushButton::pressed,QToolButton::pressed{background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #969B9C, stop: 0.5 #16354B, stop: 1.0 #244F76); border-color: #11505C;}"); name_label -> setFixedHeight(30); pwd_label -> setFixedHeight(30); QLineEdit * name_line = new QLineEdit; connect (name_line, SIGNAL(textEdited(const QString &)), w_inspector, SLOT(dbEditorName(const QString &))); QLineEdit * pwd_line = new QLineEdit; connect (pwd_line, SIGNAL(textEdited(const QString &)), w_inspector, SLOT(dbEditorPassword(const QString &))); name_line -> setFixedHeight(30); pwd_line -> setFixedHeight(30); QGridLayout * gnpl_layout = new QGridLayout; gnpl_layout -> addWidget(name_label, 0, 0, 1, 1, Qt::AlignJustify); gnpl_layout -> addWidget(name_line, 0, 1, 1, 2, Qt::AlignJustify); gnpl_layout -> addWidget(pwd_label, 1, 0, 1, 1, Qt::AlignJustify); gnpl_layout -> addWidget(pwd_line, 1, 1, 1, 2, Qt::AlignJustify); v_layout -> addLayout(gnpl_layout); } if (type != 1) { h_layout -> addWidget(ok_button); h_layout -> addWidget(cancel_button); v_layout -> addLayout(h_layout); } else { v_layout -> addWidget(ok_button); v_layout -> setAlignment(ok_button, Qt::AlignCenter); } v_layout -> setContentsMargins(0, 0, 0, 0); v_layout -> setSpacing(2); show(); openMeOnAnimation(); } void DiaLog::initErrorDialog(const QString & info) { QVBoxLayout * v_layout = new QVBoxLayout(this); QLabel * error_label = new QLabel; error_label -> setFixedHeight(30); error_label -> setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); QPixmap pixmap(":/images/error.png"); QPixmap e_pix = pixmap.scaled(error_label->frameSize(), Qt::KeepAspectRatio); error_label -> setPixmap(e_pix); QString n_info = info; QStringList info_list = n_info.split(":"); QLabel * info_label = new QLabel(info_list[1]); info_label -> setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); info_label -> setFont(QFont("宋体", 10)); defineDialogLabelSize(info_label); QString radius; if (!info_list[1].contains("\n")) radius = "3px"; else radius = "10px"; QString style_sheet = QString("color: white; border: 1px solid rgb(50, 50, 50); border-radius: %1; background: rgb(50, 50, 50)").arg(radius); info_label -> setStyleSheet(style_sheet); QHBoxLayout * h_layout = 0; QPushButton * ok_button = 0; QPushButton * cancel_button = 0; if (info.contains(tr("您可以按确定继续或\n按取消结束此次操作"))) { ok_button = new QPushButton(tr("确定")); cancel_button = new QPushButton(tr("取消")); connect(cancel_button, SIGNAL(clicked()), this, SLOT(onCancel())); cancel_button -> setFocusPolicy(Qt::NoFocus); cancel_button -> setStyleSheet("QPushButton,QToolButton{color: black; background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #88d, stop: 0.1 #99e, stop: 0.49 #77c, stop: 0.5 #66b, stop: 1 #77c); border-width: 1px; border-color: #339; border-style: solid; border-radius: 7; padding: 3px; font-size: 10px; padding-left: 5px; padding-right: 5px; min-width: 50px; max-width: 50px; min-height: 13px; max-height: 13px;} QPushButton::pressed,QToolButton::pressed{background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #969B9C, stop: 0.5 #16354B, stop: 1.0 #244F76); border-color: #11505C;}"); h_layout = new QHBoxLayout; } else { ok_button = new QPushButton(tr("知道了")); ok_button -> setFixedHeight(15); ok_button -> setFixedWidth(30); } connect(ok_button, SIGNAL(clicked()), this, SLOT(onSure())); ok_button -> setFocusPolicy(Qt::NoFocus); ok_button -> setStyleSheet("QPushButton,QToolButton{color: black; background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #88d, stop: 0.1 #99e, stop: 0.49 #77c, stop: 0.5 #66b, stop: 1 #77c); border-width: 1px; border-color: #339; border-style: solid; border-radius: 7; padding: 3px; font-size: 10px; padding-left: 5px; padding-right: 5px; min-width: 50px; max-width: 50px; min-height: 13px; max-height: 13px;} QPushButton::pressed,QToolButton::pressed{background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #969B9C, stop: 0.5 #16354B, stop: 1.0 #244F76); border-color: #11505C;}"); v_layout -> addWidget(error_label); v_layout -> addWidget(info_label); if (cancel_button) { h_layout -> addWidget(ok_button); h_layout -> addWidget(cancel_button); v_layout -> addLayout(h_layout); } else { v_layout -> addWidget(ok_button); v_layout -> setAlignment(ok_button, Qt::AlignCenter); } v_layout->setSpacing(5); v_layout->setContentsMargins(0, 0, 0, 0); show(); openMeOnAnimation(); } void DiaLog::defineDialogLabelSize(QLabel * dest_label) { QString text = dest_label->text(); if (!text.contains("\n")) return; QFontMetrics fm(dest_label->font()); QStringList text_list = text.split("\n"); int max_width = 0; for (int i = 0; i < text_list.size(); i++) { if (fm.width(text_list.at(i)) > max_width) max_width = fm.width(text_list.at(i)); } dest_label -> setFixedWidth(max_width+fm.height()); int height = fm.height()*(text_list.size()+1); dest_label -> setFixedHeight(height); } void DiaLog::openMeOnAnimation() { dialog_animation = new QPropertyAnimation(this); connect(dialog_animation, SIGNAL(finished()), this, SLOT(killAnimation())); dialog_animation -> setTargetObject(this); dialog_animation -> setPropertyName("geometry"); dialog_animation -> setDuration(500); QRect d_startRect(0, 0, 0, 0); QRect d_endRect; d_endRect.setRect(w_inspector->geometry().topRight().x()/2-width()/2, w_inspector->geometry().bottomRight().y()/2-height(), width(), height()); dialog_animation -> setStartValue(d_startRect); dialog_animation -> setEndValue(d_endRect); connect(dialog_animation, SIGNAL(valueChanged(const QVariant &)), this, SLOT(animatedSize(const QVariant &))); dialog_animation -> start(); } void DiaLog::closeMeOnAnimation() { dialog_animation = new QPropertyAnimation(this); connect(dialog_animation, SIGNAL(valueChanged(const QVariant &)), this, SLOT(animatedSize(const QVariant &))); connect(dialog_animation, SIGNAL(finished()), this, SLOT(killMyself())); dialog_animation -> setTargetObject(this); dialog_animation -> setPropertyName("geometry"); dialog_animation -> setDuration(500); QRect d_startRect; d_startRect.setRect(w_inspector->geometry().topRight().x()/2-width()/2, w_inspector->geometry().bottomRight().y()/2-height(), width(), height()); QRect d_endRect(0, 0, 0, 0); dialog_animation -> setStartValue(d_startRect); dialog_animation -> setEndValue(d_endRect); dialog_animation -> start(); } void DiaLog::onSure() { QVBoxLayout * chk_layout = qobject_cast<QVBoxLayout *>(layout()); QLabel * info_label = qobject_cast<QLabel *>(chk_layout->itemAt(1)->widget()); if (info_label && info_label->text().contains(tr("输入姓名密码"))) { QGridLayout * g_layout = qobject_cast<QGridLayout *>(chk_layout->itemAt(2)->layout()); QLineEdit * n_edit = qobject_cast<QLineEdit *>(g_layout->itemAtPosition(0, 1)->widget()); QLineEdit * pw_edit = qobject_cast<QLineEdit *>(g_layout->itemAtPosition(1, 1)->widget()); if (n_edit->text().isEmpty() || pw_edit->text().isEmpty()) return; } sure = true; closeMeOnAnimation(); } void DiaLog::onCancel() { unsure = true; closeMeOnAnimation(); } void DiaLog::judgeInputTextForSave() { QLayout * cur_layout = layout(); QTextEdit * editor = qobject_cast<QTextEdit *>(cur_layout->itemAt(1)->widget()); QString save_text = editor->toPlainText(); if (save_text.isEmpty()) return; QStringList tables = search_db->allTables(); bool found = false; foreach (QString str, tables) { if (str.contains(inputor)) { QStringList infoes = str.split(tr(",,。")); if (infoes.size()>2 && infoes.at(2)==save_text) { found = true; break; } } } if (found) { QLabel * label = qobject_cast<QLabel *>(cur_layout->itemAt(0)->widget()); label -> setText(tr("文件名与数据库中重名")); label -> setStyleSheet("QLabel{color: black; background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FF0000, stop: 0.1 #EE0000, stop: 0.49 #CD0000, stop: 0.5 #CD0000, stop: 1 #FF0000); border-width: 1px; border-color: #339; border-style: solid; border-radius: 7; padding: 3px; font-size: 10px; padding-left: 5px; padding-right: 5px; min-height: 13px; max-height: 13px;}"); QFontMetrics fm(label->font()); int width = fm.width(label->text()); label -> setFixedWidth(width+20); return; } emit sendSaveFileName(save_text); onSure(); } void DiaLog::judgeInputTextForExport() { QLayout * cur_layout = layout(); QTextEdit * editor = qobject_cast<QTextEdit *>(cur_layout->itemAt(1)->widget()); QString save_text = editor->toPlainText(); if (save_text.isEmpty()) return; QLabel * file_lbl = qobject_cast<QLabel *>(cur_layout->itemAt(0)->widget()); QFileInfoList qfi_list; QString tol_fname; if (file_lbl->text().contains(tr("图片"))) { QDir image_dir(tr("/home/dapang/workstation/image文件")); qfi_list = image_dir.entryInfoList(QDir::Dirs | QDir::Files); tol_fname = save_text+".png"; } else { QDir pdf_dir(tr("/home/dapang/workstation/pdf文件")); qfi_list = pdf_dir.entryInfoList(QDir::Dirs | QDir::Files); tol_fname = save_text+".pdf"; } foreach (QFileInfo fi, qfi_list) { if (fi.fileName() == tol_fname) { if (file_lbl->text().contains(tr("图片"))) file_lbl -> setText(tr("图片名与目标文件夹中重名")); else file_lbl -> setText(tr("文件名与目标文件夹中重名")); file_lbl -> setStyleSheet("QLabel{color: black; background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FF0000, stop: 0.1 #EE0000, stop: 0.49 #CD0000, stop: 0.5 #CD0000, stop: 1 #FF0000); border-width: 1px; border-color: #339; border-style: solid; border-radius: 7; padding: 3px; font-size: 10px; padding-left: 5px; padding-right: 5px; min-height: 13px; max-height: 13px;}"); QFontMetrics fm(file_lbl->font()); int width = fm.width(file_lbl->text()); file_lbl -> setFixedWidth(width+20); return; } } emit sendSaveFileName(save_text); onSure(); } void DiaLog::chkSaveDbsCollideDataes() { QLayout * cur_layout = layout(); LittleWidgetsView * qml_view = qobject_cast<LittleWidgetsView *>(cur_layout->itemAt(2)->widget()); DataesTableView * save_collides = qobject_cast<DataesTableView *>(qml_view->qmlAgent()->widget()); QString chk_str; r_chk = save_collides->checkInputState(chk_str); if (!r_chk) return; closeMeOnAnimation(); } void DiaLog::animatedSize(const QVariant & v_size) { setFixedSize(v_size.toRect().size()); } void DiaLog::resetLabelColor() { QLayout * cur_layout = layout(); QLabel * label = qobject_cast<QLabel *>(cur_layout->itemAt(0)->widget()); label -> setStyleSheet("QLabel{color: black; background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #88d, stop: 0.1 #99e, stop: 0.49 #77c, stop: 0.5 #66b, stop: 1 #77c); border-width: 1px; border-color: #339; border-style: solid; border-radius: 7; padding: 3px; font-size: 10px; padding-left: 5px; padding-right: 5px; min-height: 13px; max-height: 13px;}"); if (label->text().contains(tr("图片"))) label -> setText(tr("请输入图片名")); else label -> setText(tr("请输入文件名")); QFontMetrics fm(label->font()); int width = fm.width(label->text()); label -> setFixedWidth(width+20); } void DiaLog::killAnimation() { delete dialog_animation; dialog_animation = 0; } void DiaLog::killMyself() { delete dialog_animation; if (sure) done(sure); if (unsure) done(!unsure); }
ae13f35ab6bb7574790c5c127b88feb8e8b0ccf5
92e3ae093fa28c32e88701ed73c581f372c05f89
/instrumentor/NaiveCoverageSet.cpp
baaf3d471602bef82b871a11f4b1cb3c235983ca
[ "NCSA", "Apache-2.0" ]
permissive
liblit/csi-cc
702f220c50a9254eebcb837269333765b1a26b32
257da44de3f5ef43ff5957fe4774d9d14869668d
refs/heads/master
2023-05-30T06:33:54.246656
2023-05-18T21:02:06
2023-05-18T21:02:06
33,838,706
5
5
null
null
null
null
UTF-8
C++
false
false
10,236
cpp
NaiveCoverageSet.cpp
//===----------------------- NaiveCoverageSet.cpp -------------------------===// // // A very naive implementation of checking coverage sets. // //===----------------------------------------------------------------------===// // // Copyright (c) 2023 Peter J. Ohmann and Benjamin R. Liblit // // 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. //===----------------------------------------------------------------------===// #define DEBUG_TYPE "coverage-optimization" #include "NaiveCoverageSet.h" #include "Utils.hpp" #include <llvm/Support/Debug.h> #include "llvm_proxy/CFG.h" #include <queue> #include <stack> using namespace csi_inst; using namespace llvm; using namespace std; bool csi_inst::isCoverageSet(const set<BasicBlock*>& S, const set<BasicBlock*>& D, BasicBlock* e, const set<BasicBlock*>& X){ set<BasicBlock*> alphas = S; alphas.insert(e); set<BasicBlock*> betas = S; betas.insert(X.begin(), X.end()); // current version: iterating over "d" first reduces alphas and betas to use for(set<BasicBlock*>::const_iterator d = D.begin(), de = D.end(); d != de; ++d){ BasicBlock* thisD = *d; if(S.count(thisD)) continue; set<BasicBlock*> beforeD = connectedExcluding(set<BasicBlock*>(&e, &e+1), set<BasicBlock*>(&thisD, &thisD+1), set<BasicBlock*>()); set<BasicBlock*> thisAlphas; set_intersection(beforeD.begin(), beforeD.end(), alphas.begin(), alphas.end(), std::inserter(thisAlphas, thisAlphas.begin())); set<BasicBlock*> afterD = connectedExcluding(set<BasicBlock*>(&thisD, &thisD+1), betas, set<BasicBlock*>()); set<BasicBlock*> thisBetas; set_intersection(afterD.begin(), afterD.end(), betas.begin(), betas.end(), std::inserter(thisBetas, thisBetas.begin())); for(set<BasicBlock*>::const_iterator alpha = thisAlphas.begin(), ae = thisAlphas.end(); alpha != ae; ++alpha){ if(*d == *alpha) continue; for(set<BasicBlock*>::const_iterator beta = thisBetas.begin(), be = thisBetas.end(); beta != be; ++beta){ if(*d == *beta) continue; else if(hasAmbiguousTriangle(*alpha, *beta, *d, e, X, S)){ return(false); } } } } return(true); } bool csi_inst::isCoverageSetClose(const set<BasicBlock*>& S, const set<BasicBlock*>& D, BasicBlock* e, const set<BasicBlock*>& X){ set<BasicBlock*> alphas = S; alphas.insert(e); set<BasicBlock*> betas = S; betas.insert(X.begin(), X.end()); for(set<BasicBlock*>::const_iterator d = D.begin(), de = D.end(); d != de; ++d){ BasicBlock* thisD = *d; if(S.count(thisD)) continue; set<BasicBlock*> firstAlphas = firstTwoEncountered(thisD, alphas, false); set<BasicBlock*> firstBetas = firstTwoEncountered(thisD, betas, true); for(set<BasicBlock*>::const_iterator alpha = firstAlphas.begin(), ae = firstAlphas.end(); alpha != ae; ++alpha){ if(*d == *alpha) continue; for(set<BasicBlock*>::const_iterator beta = firstBetas.begin(), be = firstBetas.end(); beta != be; ++beta){ if(*d == *beta) continue; else if(hasAmbiguousTriangle(*alpha, *beta, *d, e, X, S)){ return(false); } } } } return(true); } set<BasicBlock*> csi_inst::firstEncountered( BasicBlock* from, const set<BasicBlock*>& to, bool forward){ set<BasicBlock*> result; oneHop(from, to, forward, result); return(result); } set<BasicBlock*> csi_inst::firstTwoEncountered( BasicBlock* from, const set<BasicBlock*>& to, bool forward){ set<BasicBlock*> result; oneHop(from, to, forward, result); set<BasicBlock*> secondResult = result; for(set<BasicBlock*>::iterator i = result.begin(), e = result.end(); i != e; ++i) oneHop(*i, to, forward, secondResult); return(secondResult); } void csi_inst::oneHop( BasicBlock* from, const set<BasicBlock*>& to, bool forward, set<BasicBlock*>& result){ set<BasicBlock*> visited = to; // search forward/backward from "from" queue<BasicBlock*> worklist; worklist.push(from); if(forward){ for(succ_iterator i = succ_begin(from), e = succ_end(from); i != e; ++i) worklist.push(*i); } else{ for(pred_iterator i = pred_begin(from), e = pred_end(from); i != e; ++i) worklist.push(*i); } while(!worklist.empty()){ BasicBlock* n = worklist.front(); worklist.pop(); if(to.count(n)) result.insert(n); if(visited.count(n)) continue; else visited.insert(n); if(forward){ for(succ_iterator i = succ_begin(n), e = succ_end(n); i != e; ++i) worklist.push(*i); } else{ for(pred_iterator i = pred_begin(n), e = pred_end(n); i != e; ++i) worklist.push(*i); } } } bool csi_inst::hasAmbiguousTriangle(BasicBlock* alpha, BasicBlock* beta, BasicBlock* d, BasicBlock* e, const set<BasicBlock*>& X, const set<BasicBlock*>& S){ set<BasicBlock*> X_minus_d = X; X_minus_d.erase(d); set<BasicBlock*> Y1 = connectedExcluding(set<BasicBlock*>(&e, &e+1), set<BasicBlock*>(&alpha, &alpha+1), set<BasicBlock*>(&d, &d+1)); set<BasicBlock*> Y2 = connectedExcluding(set<BasicBlock*>(&beta, &beta+1), X_minus_d, set<BasicBlock*>(&d, &d+1)); if(Y1.empty() || Y2.empty()) return(false); // here, we would compute the Y set, but all we actually care about is S\Y set<BasicBlock*> S_minus_Y = S; for(set<BasicBlock*>::iterator i = Y1.begin(), ie = Y1.end(); i != ie; ++i) S_minus_Y.erase(*i); for(set<BasicBlock*>::iterator i = Y2.begin(), ie = Y2.end(); i != ie; ++i) S_minus_Y.erase(*i); if(!isConnectedExcluding(set<BasicBlock*>(&alpha, &alpha+1), set<BasicBlock*>(&d, &d+1), S_minus_Y)) return(false); else if(!isConnectedExcluding(set<BasicBlock*>(&d, &d+1), set<BasicBlock*>(&beta, &beta+1), S_minus_Y)) return(false); S_minus_Y.insert(d); if(!isConnectedExcluding(set<BasicBlock*>(&alpha, &alpha+1), set<BasicBlock*>(&beta, &beta+1), S_minus_Y)) return(false); DEBUG(dbgs() << "Found triangle: (" << alpha->getName().str() << ", " << beta->getName().str() << "," << d->getName().str() << ")\n"); DEBUG(dbgs() << "With S = " << setBB_asstring(S) << "\nand S\\Y = " << setBB_asstring(S_minus_Y) << "\n"); return(true); } bool csi_inst::isConnectedExcluding(const set<BasicBlock*>& from, const set<BasicBlock*>& to, const set<BasicBlock*>& excluding){ // check for disjointness of "from" and "to" for(set<BasicBlock*>::const_iterator i = from.begin(), e = from.end(); i != e; ++i){ if(to.count(*i)) return(true); } set<BasicBlock*> visited = from; queue<BasicBlock*> worklist; for(set<BasicBlock*>::const_iterator i = from.begin(), e = from.end(); i != e; ++i){ for(succ_iterator j = succ_begin(*i), je = succ_end(*i); j != je; ++j) worklist.push(*j); } while(!worklist.empty()){ BasicBlock* n = worklist.front(); worklist.pop(); if(visited.count(n) || excluding.count(n)) continue; else if(to.count(n)) return(true); else visited.insert(n); for(succ_iterator i = succ_begin(n), e = succ_end(n); i != e; ++i) worklist.push(*i); } return(false); } set<BasicBlock*> csi_inst::connectedExcluding( const set<BasicBlock*>& from, const set<BasicBlock*>& to, const set<BasicBlock*>& excluding){ set<BasicBlock*> visitedFW = from; set<BasicBlock*> visitedBW = to; // search forward from "from" queue<BasicBlock*> worklist; for(set<BasicBlock*>::const_iterator i = from.begin(), e = from.end(); i != e; ++i){ for(succ_iterator j = succ_begin(*i), je = succ_end(*i); j != je; ++j) worklist.push(*j); } while(!worklist.empty()){ BasicBlock* n = worklist.front(); worklist.pop(); if(visitedFW.count(n) || excluding.count(n)) continue; else visitedFW.insert(n); for(succ_iterator i = succ_begin(n), e = succ_end(n); i != e; ++i) worklist.push(*i); } // search backward from "to" for(set<BasicBlock*>::const_iterator i = to.begin(), e = to.end(); i != e; ++i){ for(pred_iterator j = pred_begin(*i), je = pred_end(*i); j != je; ++j) worklist.push(*j); } while(!worklist.empty()){ BasicBlock* n = worklist.front(); worklist.pop(); if(visitedBW.count(n) || excluding.count(n)) continue; else visitedBW.insert(n); for(pred_iterator i = pred_begin(n), e = pred_end(n); i != e; ++i) worklist.push(*i); } set<BasicBlock*> result; set_intersection(visitedFW.begin(), visitedFW.end(), visitedBW.begin(), visitedBW.end(), std::inserter(result, result.begin())); return(result); }
c82812655d2446ffa8ee92f30190c65c123342f0
56a77194fc0cd6087b0c2ca1fb6dc0de64b8a58a
/applications/FSIApplication/custom_utilities/shared_points_mapper.h
b64d6c57027eb6f35745b50cfafa90c6d04c8cef
[ "BSD-3-Clause" ]
permissive
KratosMultiphysics/Kratos
82b902a2266625b25f17239b42da958611a4b9c5
366949ec4e3651702edc6ac3061d2988f10dd271
refs/heads/master
2023-08-30T20:31:37.818693
2023-08-30T18:01:01
2023-08-30T18:01:01
81,815,495
994
285
NOASSERTION
2023-09-14T13:22:43
2017-02-13T10:58:24
C++
UTF-8
C++
false
false
7,594
h
shared_points_mapper.h
// // Project Name: Kratos // Last Modified by: $Author: pooyan $ // Date: $Date: 2006-11-27 16:07:42 $ // Revision: $Revision: 1.1.1.1 $ // // #if !defined(KRATOS_SHARED_POINTS_MAPPER_H_INCLUDED ) #define KRATOS_SHARED_POINTS_MAPPER_H_INCLUDED // System includes #include <set> // External includes #include "boost/smart_ptr.hpp" // Project includes #include "includes/define.h" #include "includes/model_part.h" #include "containers/pointer_vector.h" #include "includes/node.h" namespace Kratos { ///@name Kratos Globals ///@{ ///@} ///@name Type Definitions ///@{ ///@} ///@name Enum's ///@{ ///@} ///@name Functions ///@{ ///@} ///@name Kratos Classes ///@{ /// Short class definition. /** Detail class definition. */ class SharedPointsMapper { public: ///@name Type Definitions ///@{ /// Counted pointer of SharedPointsMapper KRATOS_CLASS_POINTER_DEFINITION(SharedPointsMapper); ///@} ///@name Life Cycle ///@{ /// Constructor with given array of Nodes. //************************************************************************************************** //************************************************************************************************** SharedPointsMapper( const ModelPart::NodesContainerType& OriginNodes, const ModelPart::NodesContainerType& DestinationNodes, double tol = 1e-9) { KRATOS_TRY if( OriginNodes.size()!=0 && DestinationNodes.size()!=0) { //if( OriginNodes.size() != DestinationNodes.size() ) // KRATOS_THROW_ERROR(std::logic_error,"wrong number of nodes",""); mOriginNodes.reserve( OriginNodes.size() ); mDestinationNodes.reserve( DestinationNodes.size() ); for(ModelPart::NodesContainerType::const_iterator origin_it = OriginNodes.begin(); origin_it != OriginNodes.end(); origin_it++) { for(ModelPart::NodesContainerType::const_iterator destination_it = DestinationNodes.begin(); destination_it != DestinationNodes.end(); destination_it++) { if ( fabs(origin_it->X() - destination_it->X() ) < tol && fabs(origin_it->Y() - destination_it->Y() ) < tol && fabs(origin_it->Z() - destination_it->Z() ) < tol ) { mOriginNodes.push_back( *(origin_it.base() ) ); mDestinationNodes.push_back( *(destination_it.base() ) ); } } } } KRATOS_CATCH("") } /// Destructor. virtual ~SharedPointsMapper() {} ///@} ///@name Operators ///@{ ///@} ///@name Operations ///@{ //************************************************************************************************** //************************************************************************************************** void ScalarMap( const Variable<double>& rOriginVariable, const Variable<double>& rDestinationVariable) { KRATOS_TRY PointerVector< Node >::iterator it_origin = mOriginNodes.begin(); PointerVector< Node >::iterator it_destination = mDestinationNodes.begin(); for(unsigned int i = 0 ; i < mOriginNodes.size() ; ++i) { (it_destination++ )->FastGetSolutionStepValue(rDestinationVariable) = (it_origin++ )->FastGetSolutionStepValue(rOriginVariable); } KRATOS_CATCH("") } void InverseScalarMap( const Variable<double>& rOriginVariable, const Variable<double>& rDestinationVariable) { KRATOS_TRY PointerVector< Node >::iterator it_origin = mOriginNodes.begin(); PointerVector< Node >::iterator it_destination = mDestinationNodes.begin(); for(unsigned int i = 0 ; i < mOriginNodes.size() ; ++i) { (it_origin++ )->FastGetSolutionStepValue(rOriginVariable) = (it_destination++ )->FastGetSolutionStepValue(rDestinationVariable); } KRATOS_CATCH("") } //************************************************************************************************** //************************************************************************************************** void VectorMap( const Variable<array_1d<double,3> >& rOriginVariable, const Variable<array_1d<double,3> >& rDestinationVariable) { KRATOS_TRY PointerVector< Node >::iterator it_origin = mOriginNodes.begin(); PointerVector< Node >::iterator it_destination = mDestinationNodes.begin(); for(unsigned int i = 0 ; i < mOriginNodes.size() ; ++i) { (it_destination++ )->FastGetSolutionStepValue(rDestinationVariable) = (it_origin++ )->FastGetSolutionStepValue(rOriginVariable); } KRATOS_CATCH("") } //************************************************************************************************** //************************************************************************************************** void InverseVectorMap( const Variable<array_1d<double,3> >& rOriginVariable, const Variable<array_1d<double,3> >& rDestinationVariable) { KRATOS_TRY PointerVector< Node >::iterator it_origin = mOriginNodes.begin(); PointerVector< Node >::iterator it_destination = mDestinationNodes.begin(); for(unsigned int i = 0 ; i < mOriginNodes.size() ; ++i) { noalias((it_origin++ )->FastGetSolutionStepValue(rOriginVariable)) = (it_destination++ )->FastGetSolutionStepValue(rDestinationVariable); } KRATOS_CATCH("") } ///@} ///@name Access ///@{ ///@} ///@name Inquiry ///@{ ///@} ///@name Input and output ///@{ /// Print information about this object. virtual void PrintInfo(std::ostream& OStream) const { } /// Print object's data. virtual void PrintData(std::ostream& OStream) const { } ///@} ///@name Friends ///@{ ///@} protected: ///@name Protected static Member Variables ///@{ ///@} ///@name Protected member Variables ///@{ PointerVector< Node > mOriginNodes; PointerVector< Node > mDestinationNodes; ///@} ///@name Protected Operators ///@{ ///@} ///@name Protected Operations ///@{ ///@} ///@name Protected Access ///@{ ///@} ///@name Protected Inquiry ///@{ ///@} ///@name Protected LifeCycle ///@{ ///@} private: ///@name Static Member Variables ///@{ ///@} ///@name Member Variables ///@{ ///@} ///@name Private Operators ///@{ ///@} ///@name Private Operations ///@{ ///@} ///@name Private Access ///@{ ///@} ///@name Private Inquiry ///@{ ///@} ///@name Un accessible methods ///@{ /// Assignment operator. SharedPointsMapper& operator=(const SharedPointsMapper& Other); /// Copy constructor. //SharedPointsMapper(const SharedPointsMapper& Other); ///@} }; // Class SharedPointsMapper ///@} ///@name Type Definitions ///@{ ///@} ///@name Input and output ///@{ ///@} } // namespace Kratos. #endif // KRATOS_SHARED_POINTS_MAPPER_H_INCLUDED defined
9692dbd4362f32b45d1182ed9b6201d4bae21be1
ac9513327fd895d25efb846eee8bba0824052877
/app/src/server/Server.cpp
9027955063aba33e6d180ddab9b3ce3d182a2ec1
[ "MIT" ]
permissive
DarkMaguz/HAC
16eaf93458fbe04ebeb365b5d1f937e8d114b2f9
271741412a41b6d363fe67c48a6c4097780732c5
refs/heads/master
2021-01-24T01:01:16.735311
2018-03-29T22:19:29
2018-03-29T22:19:29
122,792,510
0
0
null
null
null
null
UTF-8
C++
false
false
936
cpp
Server.cpp
/* * Server.cpp * * Created on: 25. feb. 2018 * Author: Peter S. Balling */ #include "Server.h" Server::Server() : ServerSocket( DEFAULT_SERVER_PORT ), log( "log" ), mutex_user( (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER ), mutex_workunit( (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER ), mutex_collision( (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER ), mutex_wubank( (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER ) { log.AddFile( "main.log" ); // 0 log.AddFile( "new.log" ); // 1 log.AddFile( "activate.log" ); // 2 log.AddFile( "auth.log" ); // 3 log.AddFile( "get.log" ); // 4 log.AddFile( "send.log" ); // 5 log.AddFile( "free.log" ); // 6 log.AddFile( "collision.log" ); // 7 log.AddFile( "mysql.log" ); // 8 } Server::~Server() { pthread_mutex_destroy( &mutex_user ); pthread_mutex_destroy( &mutex_workunit ); pthread_mutex_destroy( &mutex_collision ); pthread_mutex_destroy( &mutex_wubank ); }
d6cf25f7a8e44e93304b9e6c4833ac8417f7d633
07c856e147c6b3f0fa607ecb632a573c02165f4f
/Ch08_Algorithm/ex50_includes.cpp
173f4a6825ed31aab9b1f953d9f60b3af731cbe6
[]
no_license
choisb/Study-Cpp-STL
46359db3783767b1ef6099761f67164ab637e579
e5b12b6da744f37713983ef6f61d4f0e10a4eb13
refs/heads/master
2023-06-25T04:13:40.960447
2021-07-19T01:38:59
2021-07-19T01:38:59
329,786,891
0
0
null
null
null
null
UHC
C++
false
false
1,484
cpp
ex50_includes.cpp
// includes() 알고리즘 예제 // 한 순차열이 다른 순차열의 부분 집합인지 판단하려면 includes() 알고리즘을 사용 // includes(b,e,b2,e2) 알고리즘은 구간 [b2,e2)의 원소가 구간 [b,e)의 원소에 포함되면 true, 아니면 false 반환 // 조건자 버전은 f를 비교에 사용. // [출력 결과] // vec1: 10 20 30 40 50 // vec2: 10 20 30 // vec3: 10 20 60 // vec2는 vec1의 부분 집합 // vec3는 vec1의 부분 집합이 아님 #include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { vector<int> vec1; vec1.push_back(10); vec1.push_back(20); vec1.push_back(30); vec1.push_back(40); vec1.push_back(50); cout << "vec1: "; for (auto v : vec1) cout << v << " "; cout << endl; vector<int> vec2; vec2.push_back(10); vec2.push_back(20); vec2.push_back(30); cout << "vec2: "; for (auto v : vec2) cout << v << " "; cout << endl; vector<int> vec3; vec3.push_back(10); vec3.push_back(20); vec3.push_back(60); cout << "vec3: "; for (auto v : vec3) cout << v << " "; cout << endl; if (includes(vec1.begin(), vec1.end(), vec2.begin(), vec2.end())) cout << "vec2는 vec1의 부분 집합" << endl; else cout << "vec2는 vec1의 부분 집합이 아님" << endl; if (includes(vec1.begin(), vec1.end(), vec3.begin(), vec3.end())) cout << "vec3는 vec1의 부분 집합" << endl; else cout << "vec3는 vec1의 부분 집합이 아님" << endl; return 0; }
83dbe66ef6ccfac81f7496355c589586ac6319b1
92bc5f2f3f49609f1e7e9f55748d0419e3b30660
/host/MiddleMan.cpp
f97c806d2c2297023835797cc03891de6e211d81
[]
no_license
smallka/MiddleMan
77e376c8a78f8973351a9a9789031c5cfb9f5af6
4740247a97fa77097637b71dbc775aca14f3cc3e
refs/heads/master
2016-09-09T18:37:54.160920
2012-08-30T16:31:43
2012-08-30T16:31:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,023
cpp
MiddleMan.cpp
//--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop #include "Defines.h" #include "Log4Me.h" #include "DllInjecter.h" #include "CommProxy.h" #include "MiddleMan.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TMiddleManFrm *MiddleManFrm; #define MAX_DEBUG_LINE_COUNT 100000 //--------------------------------------------------------------------------- __fastcall TMiddleManFrm::TMiddleManFrm(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TMiddleManFrm::WndProc(TMessage &Msg) { if (Msg.Msg == WM_COPYDATA) { COPYDATASTRUCT * sendData = (COPYDATASTRUCT *)Msg.LParam; String msg = String((TCHAR *)sendData->lpData, sendData->cbData / sizeof(TCHAR)); this->ShowMsg(msg); if(sendData->dwData == MSG_CONNECT) { GetLog()->Info("MSG_CONNECT Set Dest Address: %s", msg); GetCommProxy()->SetDestAddress(msg); } } TForm::WndProc(Msg); } void TMiddleManFrm::ShowMsg(const String &Msg) { if(msgMemo->Lines->Count >= MAX_DEBUG_LINE_COUNT) { msgMemo->Clear(); } msgMemo->Lines->Add(Msg); } void __fastcall TMiddleManFrm::FormCreate(TObject *Sender) { String filePath = ExtractFilePath(Application->ExeName) + "Log\\"; GetLog()->SetEnableLog(true); GetLog()->SetPath(filePath); GetLog()->SetFileName(filePath + "MiddleMan.log"); GetLog()->Info("Log Init"); GetLog()->SetGUIWindow(this->Handle); String iniName = ExtractFilePath(Application->ExeName)+"config.ini"; if(!FileExists(iniName)) { ShowMessage("config.ini missing!"); return; } m_MemIniFile = new TMemIniFile(iniName); String dllName = ExtractFilePath(Application->ExeName) + "wowgo.dll"; String userDefineClassName = m_MemIniFile->ReadString("SET", "UserDefineClassName", ""); GetDllInjecter()->InjectDll(dllName, userDefineClassName); String remoteIP = m_MemIniFile->ReadString("SET", "RemoteIP", ""); int redirectPort = m_MemIniFile->ReadString("SET", "RedirectPort", "").ToIntDef(0); if (remoteIP == "") { int listenPort = m_MemIniFile->ReadString("SET", "ViewerPort", "").ToIntDef(0); if (listenPort != 0) { if (!GetCommProxy()->StartListenPort(listenPort, redirectPort)) { ShowMessage("fail to start listen port!"); return; } } else { if (!GetCommProxy()->StartRedirectPort(redirectPort)) { ShowMessage("fail to start redirect port!"); return; } } GetThreadManager()->StartAll(); } // TODO: GetThreadManager()->FreeAll(); on FormDestroy } //--------------------------------------------------------------------------- void __fastcall TMiddleManFrm::FormDestroy(TObject *Sender) { GetLog()->Warn("TMiddleManFrm::FormDestroy"); GetLog()->SetEnableLog(false); GetCommProxy()->Close(); GetThreadManager()->FreeAll(); } //---------------------------------------------------------------------------
609febac8412e5d176fc6a0b69e69f0723cc6e84
6990b0b5e1d4c5d38f5e4ec74551a82962d916e3
/ANR/Gordian/Tests/main.cpp
fef94246f57eb5d09172ad7b5330a35140985ac5
[]
no_license
danieljluna/ANR
f832c11cd6036235262fb5e3cea41b610e10808d
ce7fcc2dcba4c10a176c04ac10703577c496a7d6
refs/heads/master
2022-12-16T07:52:37.044123
2022-07-24T06:13:47
2022-07-24T06:13:47
119,308,824
0
0
null
2022-11-22T02:14:08
2018-01-28T23:48:05
C
UTF-8
C++
false
false
566
cpp
main.cpp
#define CATCH_CONFIG_RUNNER #include "catch.hpp" #include "GordianEngine/Debug/Public/Exceptions.h" #include "GordianEngine/Debug/Public/Asserts.h" #include "GordianEngine/Debug/Public/LogOutputManager.h" int main(int argc, char* argv[]) { // global setup... Gordian::GLogOutputManager.SetIsEnabled(false); Gordian::FAssert::OnAnyFailure = [](const char* InLogText, const char* InFileName, int InLineNumber) { throw Gordian::AssertionFailure(InLogText); }; int result = Catch::Session().run(argc, argv); // global clean-up... return result; }
0e0986a4b9548b56c0f0e5d3242d23ccd15673dd
b0df09b397384c149877cebfdfd9f88db077edc4
/disciplinas/cmp134/jpeg/TonyJpegLib_src/J2kDemo/QualityDlg.cpp
e5ffee196da17e2cdc96a5ccd65cce50274dbde5
[]
no_license
kdubezerra/kdubezerra
95f8b4285c7460b1f3fb4ac1a1593545e2a13dcd
f3054a15d74d2047c751070f5720ea933f9b73fe
refs/heads/master
2020-05-18T15:12:28.546476
2015-09-16T13:55:36
2015-09-16T13:55:36
32,155,920
1
0
null
null
null
null
UTF-8
C++
false
false
1,897
cpp
QualityDlg.cpp
// QualityDlg.cpp : implementation file // #include "stdafx.h" #include "J2kDemo.h" #include "QualityDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CQualityDlg dialog CQualityDlg::CQualityDlg(CWnd* pParent /*=NULL*/) : CDialog(CQualityDlg::IDD, pParent) { m_nTrackbar1 = 75;//default quality //{{AFX_DATA_INIT(CQualityDlg) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } void CQualityDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CQualityDlg) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP if (pDX->m_bSaveAndValidate) { TRACE("updating trackbar data members\n"); CSliderCtrl* pSlide1 = (CSliderCtrl*) GetDlgItem(IDC_TRACKBAR1); m_nTrackbar1 = pSlide1->GetPos(); } } BEGIN_MESSAGE_MAP(CQualityDlg, CDialog) //{{AFX_MSG_MAP(CQualityDlg) ON_WM_HSCROLL() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CQualityDlg message handlers BOOL CQualityDlg::OnInitDialog() { CString strText1; CSliderCtrl* pSlide1 = (CSliderCtrl*) GetDlgItem(IDC_TRACKBAR1); pSlide1->SetRange(1, 100); pSlide1->SetPos(m_nTrackbar1); strText1.Format("%d", pSlide1->GetPos()); SetDlgItemText(IDC_STATIC_TRACK1, strText1); return CDialog::OnInitDialog(); } void CQualityDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { CSliderCtrl* pSlide = (CSliderCtrl*) pScrollBar; CString strText; switch(pScrollBar->GetDlgCtrlID()) { case IDC_TRACKBAR1: strText.Format("%d", pSlide->GetPos()); SetDlgItemText(IDC_STATIC_TRACK1, strText); break; } }
ad41a8bf4fcd3084555d5f34cf90f97040a24c41
308f5596f1c7d382520cfce13ceaa5dff6f4f783
/third-party/fizz/src/fizz/crypto/signature/test/EdSignatureTest.cpp
2b28f21d64cc4b809ec9cc75dc88f23fe0073caf
[ "MIT", "PHP-3.01", "Zend-2.0", "BSD-3-Clause" ]
permissive
facebook/hhvm
7e200a309a1cad5304621b0516f781c689d07a13
d8203129dc7e7bf8639a2b99db596baad3d56b46
refs/heads/master
2023-09-04T04:44:12.892628
2023-09-04T00:43:05
2023-09-04T00:43:05
455,600
10,335
2,326
NOASSERTION
2023-09-14T21:24:04
2010-01-02T01:17:06
C++
UTF-8
C++
false
false
4,747
cpp
EdSignatureTest.cpp
/* * Copyright (c) 2018-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ #include <folly/portability/GTest.h> #include <fizz/crypto/signature/Signature.h> #include <fizz/crypto/signature/test/EdSignatureTest.h> #include <fizz/crypto/test/TestUtil.h> #include <folly/String.h> #define ED25519_FIXTURE(num) \ Params { \ kEd25519PrivateKey##num, kEd25519PublicKey##num, kEd25519Message##num, \ kEd25519Signature##num \ } using namespace folly; namespace fizz { namespace testing { #if FIZZ_OPENSSL_HAS_ED25519 TEST_P(EdDSATest, TestSignature) { auto privateKey = fizz::test::getPrivateKey(GetParam().privateKey); auto message = unhexlify(GetParam().hexMessage); auto generatedSignature = detail::edSign(IOBuf::copyBuffer(message)->coalesce(), privateKey); EXPECT_EQ(hexlify(generatedSignature->coalesce()), GetParam().hexSignature); } TEST_P(EdDSATest, TestVerify) { auto publicKey = fizz::test::getPublicKey(GetParam().publicKey); auto message = unhexlify(GetParam().hexMessage); auto signature = unhexlify(GetParam().hexSignature); // 1. Verification should pass for the message-signature pair in our fixtures detail::edVerify( IOBuf::copyBuffer(message)->coalesce(), folly::ByteRange(folly::StringPiece(signature)), publicKey); // 2. Verification should fail if the message is modified auto modifiedMessage = modifyMessage(message); EXPECT_THROW( detail::edVerify( IOBuf::copyBuffer(modifiedMessage)->coalesce(), folly::ByteRange(folly::StringPiece(signature)), publicKey), std::runtime_error); // 3. Verification should fail if the signature is modified auto modifiedSignature = modifySignature(signature); EXPECT_THROW( detail::edVerify( IOBuf::copyBuffer(message)->coalesce(), folly::ByteRange(folly::StringPiece(modifiedSignature)), publicKey), std::runtime_error); } TEST_P(Ed25519Test, TestOpenSSLSignature) { auto privateKey = fizz::test::getPrivateKey(GetParam().privateKey); auto message = unhexlify(GetParam().hexMessage); auto signature = unhexlify(GetParam().hexSignature); // 1. Test instantiation of OpenSSLSignature for Ed25519 OpenSSLSignature<KeyType::ED25519> eddsa; // 2. Test setting key eddsa.setKey(std::move(privateKey)); // 3. Test sign method auto generatedSignature = eddsa.sign<SignatureScheme::ed25519>( IOBuf::copyBuffer(message)->coalesce()); EXPECT_EQ(hexlify(generatedSignature->coalesce()), GetParam().hexSignature); // 4. Test verify method succeeds when it should eddsa.verify<SignatureScheme::ed25519>( IOBuf::copyBuffer(message)->coalesce(), folly::ByteRange(folly::StringPiece(signature))); // 5. Test verify method fails if the message is modified auto modifiedMessage = modifyMessage(message); EXPECT_THROW( eddsa.verify<SignatureScheme::ed25519>( IOBuf::copyBuffer(modifiedMessage)->coalesce(), folly::ByteRange(folly::StringPiece(signature))), std::runtime_error); // 6. Test verify method fails if the signature is modified auto modifiedSignature = modifySignature(signature); EXPECT_THROW( eddsa.verify<SignatureScheme::ed25519>( IOBuf::copyBuffer(message)->coalesce(), folly::ByteRange(folly::StringPiece(modifiedSignature))), std::runtime_error); } // Test vectors from RFC8032 INSTANTIATE_TEST_SUITE_P( TestVectors, EdDSATest, ::testing::Values( ED25519_FIXTURE(1), ED25519_FIXTURE(2), ED25519_FIXTURE(3), ED25519_FIXTURE(4), ED25519_FIXTURE(5))); // Test vectors from RFC8032 INSTANTIATE_TEST_SUITE_P( TestVectors, Ed25519Test, ::testing::Values( ED25519_FIXTURE(1), ED25519_FIXTURE(2), ED25519_FIXTURE(3), ED25519_FIXTURE(4), ED25519_FIXTURE(5))); #endif std::string modifyMessage(const std::string& input) { if (input.size() == 0) { return "a"; } auto modifiedMessage = std::string(input); modifiedMessage[0] ^= 1; // Flip a bit in the first character return modifiedMessage; } std::string modifySignature(const std::string& input) { CHECK_GT(input.size(), 0) << "Signatures should have positive length"; auto modifiedMessage = std::string(input); modifiedMessage[0] ^= 1; // Flip a bit in the first character return modifiedMessage; } } // namespace testing } // namespace fizz
2e486453b540eeaf768669c1b9691713f6e37732
9901f2b7cc143c4dc15d6207885bdbac9eae3310
/src/gfxl/gfxl_common.cpp
d9225e1579afede9c885006b94f6bf6daa225b70
[]
no_license
ruicaridade/gfxl
adc9dd012f094f9720d0ddd662576aabd8811794
9b6cebee5db200689acee9cfe07edf06dce8c269
refs/heads/master
2021-07-22T02:17:12.310469
2017-10-31T13:00:28
2017-10-31T13:00:28
108,600,089
0
0
null
null
null
null
UTF-8
C++
false
false
379
cpp
gfxl_common.cpp
#include <gfxl_common.h> #include <cstdarg> namespace gfxl { static int(*messageCallback)(const char*, va_list); void SetMessageCallback(int(*callback)(const char*, va_list)) { messageCallback = callback; } void Message(const char* msg, ...) { if (messageCallback) { va_list args; va_start(args, msg); messageCallback(msg, args); va_end(args); } } }
683bc9c860f3176f26d8f2c3b579278f597634bc
cc890d3a085d949d48b75485bec915ef2132f647
/rfid_test/src/arduino_fakes/ArduinoGlobals.h
56e9ef6c3f3a1d00bf4954f94abdefd8c099b7fa
[]
no_license
sytsereitsma/DiscFinder
b668d1bb41d4b63b272b15a76bdaf41c72935ddb
b6641ee01944afe2f34a232d5b0cc290a2f9ae3e
refs/heads/master
2023-07-04T09:41:54.592429
2021-07-30T20:09:27
2021-07-30T20:09:27
391,177,948
0
0
null
null
null
null
UTF-8
C++
false
false
1,043
h
ArduinoGlobals.h
#pragma once #include <functional> #include "Stream.h" #include "fakeit.hpp" enum Pins { A0, }; enum PinMode { INPUT, OUTPUT, }; enum PinLevel { LOW, HIGH }; void pinMode (int pin, int mode); void digitalWrite (int pin, int level); void delay(unsigned long); unsigned long millis (); void tone (int pin, unsigned int frequency, unsigned long duration); void noTone (int pin); extern UartClass Serial; extern UartClass Serial1; namespace ArduinoTest { struct MockInterface { virtual ~MockInterface () = default; virtual void pinMode (int pin, int mode) = 0; virtual void digitalWrite (int pin, int level) = 0; virtual unsigned long millis () = 0; virtual void delay (unsigned long) = 0; virtual void tone (int pin, unsigned int frequency, unsigned long duration) = 0; virtual void noTone (int pin) = 0; }; extern fakeit::Mock<MockInterface> sArduinoMock; void Reset (); void SetMillisFunction (std::function <unsigned long ()> fn); }
754019e709fa62f571a31b2d79c1e68a27e26253
a4de7672f460babe084d08afe08a6453a9d4c64a
/Degree of an Array.cpp
74588c60939bc4768b6b8ada419407f9581cf43b
[]
no_license
sulemanrai/leetcode
3db0dd328ceb44bb43e15b00231c69b1aa437898
72ecdee5c6b7326eea90ddac6bb73959fce13020
refs/heads/master
2020-03-16T17:29:04.025572
2018-09-07T05:43:32
2018-09-07T05:43:32
132,834,334
0
0
null
null
null
null
UTF-8
C++
false
false
1,042
cpp
Degree of an Array.cpp
#include <stdio.h> #include <stdlib.h> #include <iostream> #include <vector> #include <algorithm> #include <map> #include <unordered_map> #include <functional> #include <string> using namespace std; class Solution { public: int findShortestSubArray(vector<int>& nums) { int ans = nums.size(); map<int, int> left; map<int, int> right; map<int, int> count; map<int, int>::iterator itr; for(int i = 0; i < nums.size(); i++) { int x = nums[i]; itr = left.find(x); if(itr == left.end()) { left[x] = i; } right[x] = i; count[x]++; } int degree = 0; int res = -1; for (auto i : count) { if (degree < i.second) { //res = i.first; degree = i.second; } } //cout << max_count << endl; for(auto x : count) { if(x.second == degree) { ans = min(ans, right[x.first] - left[x.first] + 1); } } return ans; } }; int main() { vector<int> matrix = { { 1,2,2,3,1,4,2 } }; Solution s; int ans = s.findShortestSubArray(matrix); cout << ans << endl; return 0; }
e4423a7f9536e85d9bd887c7dc83f689be0473db
cf666bc4e7759b846e9461c39a0ad5c63c7386ba
/src/heightfield.h
03d88defa98b5d63381e2b5c938aec3c75c8d2c0
[]
no_license
AntonHakansson/procedural-terrain
b12e61cfdb60cb3d37d76e09851702c74a2a9be7
70998ce7ff04147d1dc2867e786129de1f9f4595
refs/heads/main
2023-08-11T04:10:28.874775
2021-09-23T13:16:28
2021-09-23T13:16:52
365,261,106
1
0
null
null
null
null
UTF-8
C++
false
false
658
h
heightfield.h
#include <glad/glad.h> #include <string> class HeightField { public: int m_meshResolution; // triangles edges per quad side GLuint m_texid_hf; GLuint m_texid_diffuse; GLuint m_vao; GLuint m_positionBuffer; GLuint m_uvBuffer; GLuint m_indexBuffer; GLuint m_numIndices; std::string m_heightFieldPath; std::string m_diffuseTexturePath; HeightField(void); // load height field void loadHeightField(const std::string &heigtFieldPath); // load diffuse map void loadDiffuseTexture(const std::string &diffusePath); // generate mesh void generateMesh(int tesselation); // render height map void submitTriangles(void); };
29555141d8ea4e6899e0139df31a6bd9c32c0200
956fc12c1b23a3e016d15f102d4dd5208f6fc353
/QSerialPort/main.cpp
a1ab4b55b0f87569b920c482cc820ca13409be7a
[]
no_license
qq447799/SerialPort
9caa5a36c341149e38246b2c50179e0a5e2be919
e9ed80276394a5bc45136064e19c351cc4955100
refs/heads/main
2023-02-10T11:00:37.186214
2021-01-02T15:08:55
2021-01-02T15:08:55
314,288,093
0
0
null
null
null
null
UTF-8
C++
false
false
735
cpp
main.cpp
#include "mainwindow.h" #include <QApplication> #include "headfile.h" #include "QTextCodec" int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; PortObj port; FileObj file; QObject::connect(&w,SIGNAL(m_portinfo_sig(int)),&port,SLOT(p_portinfo_slot(int)),Qt::QueuedConnection); QObject::connect(&port,SIGNAL(p_portinfo_sig(int)),&w,SLOT(m_portinfo_slot(int)),Qt::QueuedConnection); QObject::connect(&w,SIGNAL(m_fileinfo_sig(int)),&file,SLOT(f_fileinfo_slot(int)),Qt::QueuedConnection); QObject::connect(&file,SIGNAL(f_fileinfo_sig(int)),&w,SLOT(m_fileinfo_slot(int)),Qt::QueuedConnection); w.setWindowTitle(QString("qq4477-v0.04")); w.show(); return a.exec(); }
c8592b46f963589eba4e8a4b1b3d586bfd15389a
aa4baaa54fe0081eb26743575e8de4b529f8d693
/title.cpp
aef98bfa129fef3158f5f9b7212688650f2d04da
[]
no_license
ritakuu/StarProtector
f5105c2a18b04ca1b4d305193becf3d20c7d4252
8969ec219af82a61e37b514a6f156977e57dc010
refs/heads/master
2020-05-29T20:17:31.061964
2019-05-30T05:38:52
2019-05-30T05:38:52
188,394,049
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
14,224
cpp
title.cpp
//============================================================================= // // タイトル画面処理 [title.cpp] // Author : AKIRA TANAKA // //============================================================================= #include "title.h" #include "input.h" #include "fade.h" //***************************************************************************** // マクロ定義 //***************************************************************************** #define TEXTURE_TITLE "data/TEXTURE/bg000.jpg" // 読み込むテクスチャファイル名 #define TEXTURE_TITLE_LOGO "data/TEXTURE/title_logo.png" // 読み込むテクスチャファイル名 #define TEXTURE_LOGO_START "data/TEXTURE/press_enter.png" // 読み込むテクスチャファイル名 #define TITLE_LOGO_POS_X (320) // タイトルロゴの位置(X座標) #define TITLE_LOGO_POS_Y (40) // タイトルロゴの位置(Y座標) #define TITLE_LOGO_WIDTH (640) // タイトルロゴの幅 #define TITLE_LOGO_HEIGHT (640) // タイトルロゴの高さ #define START_POS_X (400) // スタートボタンの位置(X座標) #define START_POS_Y (720) // スタートボタンの位置(Y座標) #define START_WIDTH (480) // スタートボタンの幅 #define START_HEIGHT (120) // スタートボタンの高さ #define COUNT_APPERA_START (60) // スタートボタン出現までの時間 #define INTERVAL_DISP_START (60) // スタートボタン点滅の時間 #define COUNT_WAIT_DEMO (60 * 5) // デモまでの待ち時間 //***************************************************************************** // プロトタイプ宣言 //***************************************************************************** HRESULT MakeVertexTitle(LPDIRECT3DDEVICE9 pDevice); void SetColorTitleLogo(void); //***************************************************************************** // グローバル変数 //***************************************************************************** LPDIRECT3DTEXTURE9 g_pD3DTextureTitle = NULL; // テクスチャへのポインタ LPDIRECT3DVERTEXBUFFER9 g_pD3DVtxBuffTitle = NULL; // 頂点バッファインターフェースへのポインタ LPDIRECT3DTEXTURE9 g_pD3DTextureTitleLogo = NULL; // テクスチャへのポインタ LPDIRECT3DVERTEXBUFFER9 g_pD3DVtxBuffTitleLogo = NULL; // 頂点バッファインターフェースへのポインタ LPDIRECT3DTEXTURE9 g_pD3DTextureStart = NULL; // テクスチャへのポインタ LPDIRECT3DVERTEXBUFFER9 g_pD3DVtxBuffStart = NULL; // 頂点バッファインターフェースへのポインタ int g_nCountAppearStart = 0; // float g_fAlphaLogo = 0.0f; // int g_nCountDisp = 0; // bool g_bDispStart = false; // int g_nConutDemo = 0; // //============================================================================= // 初期化処理 //============================================================================= HRESULT InitTitle(void) { LPDIRECT3DDEVICE9 pDevice = GetDevice(); g_nCountAppearStart = 0; g_fAlphaLogo = 0.0f; g_nCountDisp = 0; g_bDispStart = false; g_nConutDemo = 0; // 頂点情報の作成 MakeVertexTitle(pDevice); // テクスチャの読み込み D3DXCreateTextureFromFile(pDevice, // デバイスへのポインタ TEXTURE_TITLE, // ファイルの名前 &g_pD3DTextureTitle); // 読み込むメモリー D3DXCreateTextureFromFile(pDevice, // デバイスへのポインタ TEXTURE_TITLE_LOGO, // ファイルの名前 &g_pD3DTextureTitleLogo); // 読み込むメモリー D3DXCreateTextureFromFile(pDevice, // デバイスへのポインタ TEXTURE_LOGO_START, // ファイルの名前 &g_pD3DTextureStart); // 読み込むメモリー return S_OK; } //============================================================================= // 終了処理 //============================================================================= void UninitTitle(void) { if(g_pD3DTextureTitle != NULL) {// テクスチャの開放 g_pD3DTextureTitle->Release(); g_pD3DTextureTitle = NULL; } if(g_pD3DVtxBuffTitle != NULL) {// 頂点バッファの開放 g_pD3DVtxBuffTitle->Release(); g_pD3DVtxBuffTitle = NULL; } if(g_pD3DTextureTitleLogo != NULL) {// テクスチャの開放 g_pD3DTextureTitleLogo->Release(); g_pD3DTextureTitleLogo = NULL; } if(g_pD3DVtxBuffTitleLogo != NULL) {// 頂点バッファの開放 g_pD3DVtxBuffTitleLogo->Release(); g_pD3DVtxBuffTitleLogo = NULL; } if(g_pD3DTextureStart != NULL) {// テクスチャの開放 g_pD3DTextureStart->Release(); g_pD3DTextureStart = NULL; } if(g_pD3DVtxBuffStart != NULL) {// 頂点バッファの開放 g_pD3DVtxBuffStart->Release(); g_pD3DVtxBuffStart = NULL; } } //============================================================================= // 更新処理 //============================================================================= void UpdateTitle(void) { #if 0 if(g_nCountAppearStart >= COUNT_APPERA_START) { g_nConutDemo++; if(g_nConutDemo > COUNT_WAIT_DEMO) { SetFade(FADE_OUT, MODE_TITLE); } } #endif if(g_fAlphaLogo < 1.0f) { g_fAlphaLogo += 0.005f; if(g_fAlphaLogo >= 1.0f) { g_fAlphaLogo = 1.0f; } SetColorTitleLogo(); } else { g_nCountAppearStart++; if(g_nCountAppearStart > COUNT_APPERA_START) { g_nCountDisp = (g_nCountDisp + 1) % 80; if(g_nCountDisp > INTERVAL_DISP_START) { g_bDispStart = false; } else { g_bDispStart = true; } } } if(GetKeyboardTrigger(DIK_RETURN)) { if(g_nCountAppearStart == 0) {// タイトル登場スキップ g_fAlphaLogo = 1.0f; SetColorTitleLogo(); g_nCountAppearStart = COUNT_APPERA_START; } else {// ゲームへ SetFade(FADE_OUT); } } } //============================================================================= // 描画処理 //============================================================================= void DrawTitle(void) { LPDIRECT3DDEVICE9 pDevice = GetDevice(); // 頂点バッファをデバイスのデータストリームにバインド pDevice->SetStreamSource(0, g_pD3DVtxBuffTitle, 0, sizeof(VERTEX_2D)); // 頂点フォーマットの設定 pDevice->SetFVF(FVF_VERTEX_2D); // テクスチャの設定 pDevice->SetTexture(0, g_pD3DTextureTitle); // ポリゴンの描画 pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, NUM_POLYGON); // 頂点バッファをデバイスのデータストリームにバインド pDevice->SetStreamSource(0, g_pD3DVtxBuffTitleLogo, 0, sizeof(VERTEX_2D)); // 頂点フォーマットの設定 pDevice->SetFVF(FVF_VERTEX_2D); // テクスチャの設定 pDevice->SetTexture(0, g_pD3DTextureTitleLogo); // ポリゴンの描画 pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, NUM_POLYGON); if(g_bDispStart == true) { // 頂点バッファをデバイスのデータストリームにバインド pDevice->SetStreamSource(0, g_pD3DVtxBuffStart, 0, sizeof(VERTEX_2D)); // 頂点フォーマットの設定 pDevice->SetFVF(FVF_VERTEX_2D); // テクスチャの設定 pDevice->SetTexture(0, g_pD3DTextureStart); // ポリゴンの描画 pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, NUM_POLYGON); } } //============================================================================= // 頂点の作成 //============================================================================= HRESULT MakeVertexTitle(LPDIRECT3DDEVICE9 pDevice) { // オブジェクトの頂点バッファを生成 if(FAILED(pDevice->CreateVertexBuffer(sizeof(VERTEX_2D) * NUM_VERTEX, // 頂点データ用に確保するバッファサイズ(バイト単位) D3DUSAGE_WRITEONLY, // 頂点バッファの使用法  FVF_VERTEX_2D, // 使用する頂点フォーマット D3DPOOL_MANAGED, // リソースのバッファを保持するメモリクラスを指定 &g_pD3DVtxBuffTitle, // 頂点バッファインターフェースへのポインタ NULL))) // NULLに設定 { return E_FAIL; } {//頂点バッファの中身を埋める VERTEX_2D *pVtx; // 頂点データの範囲をロックし、頂点バッファへのポインタを取得 g_pD3DVtxBuffTitle->Lock(0, 0, (void**)&pVtx, 0); // 頂点座標の設定 pVtx[0].vtx = D3DXVECTOR3(0.0f, 0.0f, 0.0f); pVtx[1].vtx = D3DXVECTOR3(SCREEN_WIDTH, 0.0f, 0.0f); pVtx[2].vtx = D3DXVECTOR3(0.0f, SCREEN_HEIGHT, 0.0f); pVtx[3].vtx = D3DXVECTOR3(SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f); // テクスチャのパースペクティブコレクト用 pVtx[0].rhw = pVtx[1].rhw = pVtx[2].rhw = pVtx[3].rhw = 1.0f; // 反射光の設定 pVtx[0].diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f); pVtx[1].diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f); pVtx[2].diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f); pVtx[3].diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f); // テクスチャ座標の設定 pVtx[0].tex = D3DXVECTOR2(0.0f, 0.0f); pVtx[1].tex = D3DXVECTOR2(1.0f, 0.0f); pVtx[2].tex = D3DXVECTOR2(0.0f, 1.0f); pVtx[3].tex = D3DXVECTOR2(1.0f, 1.0f); // 頂点データをアンロックする g_pD3DVtxBuffTitle->Unlock(); } // オブジェクトの頂点バッファを生成 if(FAILED(pDevice->CreateVertexBuffer(sizeof(VERTEX_2D) * NUM_VERTEX, // 頂点データ用に確保するバッファサイズ(バイト単位) D3DUSAGE_WRITEONLY, // 頂点バッファの使用法  FVF_VERTEX_2D, // 使用する頂点フォーマット D3DPOOL_MANAGED, // リソースのバッファを保持するメモリクラスを指定 &g_pD3DVtxBuffTitleLogo, // 頂点バッファインターフェースへのポインタ NULL))) // NULLに設定 { return E_FAIL; } {//頂点バッファの中身を埋める VERTEX_2D *pVtx; // 頂点データの範囲をロックし、頂点バッファへのポインタを取得 g_pD3DVtxBuffTitleLogo->Lock(0, 0, (void**)&pVtx, 0); // 頂点座標の設定 pVtx[0].vtx = D3DXVECTOR3(TITLE_LOGO_POS_X, TITLE_LOGO_POS_Y, 0.0f); pVtx[1].vtx = D3DXVECTOR3(TITLE_LOGO_POS_X + TITLE_LOGO_WIDTH, TITLE_LOGO_POS_Y, 0.0f); pVtx[2].vtx = D3DXVECTOR3(TITLE_LOGO_POS_X, TITLE_LOGO_POS_Y + TITLE_LOGO_HEIGHT, 0.0f); pVtx[3].vtx = D3DXVECTOR3(TITLE_LOGO_POS_X + TITLE_LOGO_WIDTH, TITLE_LOGO_POS_Y + TITLE_LOGO_HEIGHT, 0.0f); // テクスチャのパースペクティブコレクト用 pVtx[0].rhw = pVtx[1].rhw = pVtx[2].rhw = pVtx[3].rhw = 1.0f; // 反射光の設定 pVtx[0].diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, g_fAlphaLogo); pVtx[1].diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, g_fAlphaLogo); pVtx[2].diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, g_fAlphaLogo); pVtx[3].diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, g_fAlphaLogo); // テクスチャ座標の設定 pVtx[0].tex = D3DXVECTOR2(0.0f, 0.0f); pVtx[1].tex = D3DXVECTOR2(1.0f, 0.0f); pVtx[2].tex = D3DXVECTOR2(0.0f, 1.0f); pVtx[3].tex = D3DXVECTOR2(1.0f, 1.0f); // 頂点データをアンロックする g_pD3DVtxBuffTitleLogo->Unlock(); } // オブジェクトの頂点バッファを生成 if(FAILED(pDevice->CreateVertexBuffer(sizeof(VERTEX_2D) * NUM_VERTEX, // 頂点データ用に確保するバッファサイズ(バイト単位) D3DUSAGE_WRITEONLY, // 頂点バッファの使用法  FVF_VERTEX_2D, // 使用する頂点フォーマット D3DPOOL_MANAGED, // リソースのバッファを保持するメモリクラスを指定 &g_pD3DVtxBuffStart, // 頂点バッファインターフェースへのポインタ NULL))) // NULLに設定 { return E_FAIL; } {//頂点バッファの中身を埋める VERTEX_2D *pVtx; // 頂点データの範囲をロックし、頂点バッファへのポインタを取得 g_pD3DVtxBuffStart->Lock(0, 0, (void**)&pVtx, 0); // 頂点座標の設定 pVtx[0].vtx = D3DXVECTOR3(START_POS_X, START_POS_Y, 0.0f); pVtx[1].vtx = D3DXVECTOR3(START_POS_X + START_WIDTH, START_POS_Y, 0.0f); pVtx[2].vtx = D3DXVECTOR3(START_POS_X, START_POS_Y + START_HEIGHT, 0.0f); pVtx[3].vtx = D3DXVECTOR3(START_POS_X + START_WIDTH, START_POS_Y + START_HEIGHT, 0.0f); // テクスチャのパースペクティブコレクト用 pVtx[0].rhw = pVtx[1].rhw = pVtx[2].rhw = pVtx[3].rhw = 1.0f; // 反射光の設定 pVtx[0].diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f); pVtx[1].diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f); pVtx[2].diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f); pVtx[3].diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f); // テクスチャ座標の設定 pVtx[0].tex = D3DXVECTOR2(0.0f, 0.0f); pVtx[1].tex = D3DXVECTOR2(1.0f, 0.0f); pVtx[2].tex = D3DXVECTOR2(0.0f, 1.0f); pVtx[3].tex = D3DXVECTOR2(1.0f, 1.0f); // 頂点データをアンロックする g_pD3DVtxBuffStart->Unlock(); } return S_OK; } //============================================================================= // 頂点の作成 //============================================================================= void SetColorTitleLogo(void) { {//頂点バッファの中身を埋める VERTEX_2D *pVtx; // 頂点データの範囲をロックし、頂点バッファへのポインタを取得 g_pD3DVtxBuffTitleLogo->Lock(0, 0, (void**)&pVtx, 0); // 反射光の設定 pVtx[0].diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, g_fAlphaLogo); pVtx[1].diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, g_fAlphaLogo); pVtx[2].diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, g_fAlphaLogo); pVtx[3].diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, g_fAlphaLogo); // 頂点データをアンロックする g_pD3DVtxBuffTitleLogo->Unlock(); } }
418669f3504a91536f138b1d3aee3eae00a7f047
97a1161535e466cd5400ad675ead7dcb35e5fc10
/util/Buffer.h
5763d8e57e1dbdf0b7133ffc166ed74a2af971f5
[ "MIT" ]
permissive
jfern2011/chess
2de4b543ad34a4d50db1942d1e89f94b46bc468d
33e7a43b2c15b4ecc8eee58d15bdefa9c3b31a69
refs/heads/master
2023-04-27T19:26:40.241219
2023-04-23T18:24:34
2023-04-23T18:24:34
96,244,462
0
0
null
null
null
null
UTF-8
C++
false
false
6,658
h
Buffer.h
/** * \file Buffer.h * \author Jason Fernandez * \date 3/17/2018 * * https://github.com/jfern2011/util */ #ifndef __BUFFER_H__ #define __BUFFER_H__ #include <cstddef> #include <cstring> #include "abort/abort.h" /** ********************************************************************** * * A wrapper for a C++ multi-dimensional array. This implements bounds * checking to make it easier to catch buffer overflows at runtime. * This class is kept as simple as possible to match the complexity of * accessing raw arrays * * @tparam T The type of each element * @tparam N1 Number of elements along the 1st dimension * @tparam N2 Number of elements along higher dimensions * ********************************************************************** */ template <typename T, size_t N1, size_t... N2> class Buffer { static_assert(N1 > 0, "Dimensions must be greater than zero."); public: /** * Default constructor */ Buffer() { } /** * Constructor * * @param[in] src Initialize with these elements. See \ref fill() */ Buffer(const T* src) { fill(src); } /** * Destructor */ ~Buffer() { } /** * Indexing operator. This call produces a Buffer whose number of * dimensions is reduced by 1 * * For example, if we have a Buffer<int,2,3>, then we'll get * back a Buffer<int,3> * * @param [in] index The index to look up. An out of bounds value * produces a warning message * * @return The element at \a index */ Buffer<T,N2...>& operator[](size_t index) { AbortIf(N1 <= index, data[index]); return data[index]; } /** * Indexing operator. This call produces a Buffer whose number of * dimensions is reduced by 1 * * For example, if we have a Buffer<int,2,3>, then we'll get * back a Buffer<int,3> * * @param [in] index The index to look up. An out of bounds value * produces a warning message * * @return A *const* reference to the element at \a index */ const Buffer<T,N2...>& operator[](size_t index) const { AbortIf(N1 <= index, data[index]); return data[index]; } /** * Fill in this buffer with elements from \a src * * @param[in] src Buffer from which to copy. Copying is performed * element-wise. For example, if A is a 2x2x2 * array, then the first element is copied to * A[0][0][0], the second to A[0][0][1], the third * to A[0][1][0], and so on */ void fill(const T* src) { const size_t offset = data[0].size(); for (size_t i = 0; i < N1; i++) { const T* _src = &src[ i*offset ]; data[i].fill(_src); } } /** * Get the total number of elements in the buffer * * @return The number of elements */ size_t size() { return N1 * data[0].size(); } private: Buffer<T,N2...> data[N1]; }; /** ********************************************************************** * * A wrapper for a simple C++ array. Aside from behaving like a normal * array, this performs bounds checking to make it easier to catch * buffer overflows at runtime. The implementation is kept simple with * the goal of matching runtime performance with raw arrays * * @tparam T The type of each buffer element * @tparam N The number of elements * ********************************************************************** */ template <typename T, size_t N> class Buffer<T,N> { static_assert(N > 0, "Buffer must contain at least 1 item."); public: /** * Constructor */ Buffer() { } /** * Destructor */ ~Buffer() { } /** * Grab the element at the specified index. This is equivalent to * the indexing operator [] * * @param [in] index The index to look up. An out of bounds value * produces a warning message * * @return The element at \a index */ T& at(size_t index) { AbortIf(N <= index, data[index]); return data[index]; } /** * Indexing operator. This will return a reference to the element * at the specified index * * @param [in] index The index to look up. An out of bounds value * produces a warning message * * @return The element at \a index */ T& operator[](size_t index) { AbortIf(N <= index, data[index]); return data[index]; } /** * Indexing operator. This will return a *const* reference to the * element at the specified index * * @param [in] index The index to look up. An out of bounds value * produces a warning message * * @return The element at \a index */ const T& operator[](size_t index) const { AbortIf(N <= index, data[index]); return data[index]; } /** * Deference operator * * @return The first element in this Buffer */ T& operator*() { return data[0]; } /** * Type conversion to a pointer. Allows passing a Buffer to stuff * like std::memcpy() * * @return A pointer to the data */ operator T*() { return data; } /** * Type conversion to a pointer. Allows passing a Buffer to stuff * like std::memcpy() * * @return A const pointer to the data */ operator const T*() const { return data; } /** * Pointer arithmetic (addition) * * @param[in] offset The offset to add to the start of the buffer * * @return A pointer to the address at offset \a offset from the * buffer start, or nullptr on error */ T* operator+(size_t offset) { AbortIf(N <= offset, nullptr); return data + offset; } /** * Fill in this buffer with elements from \a src, copying exactly * N elements * * @param[in] src Buffer from which to copy */ void fill(const T* src) { std::memcpy(data, src, N * sizeof(T)); } /** * Get the number of elements in the buffer * * @return The number of elements */ size_t size() { return N; } /** * Sets all elements in this buffer to zero */ void zero() { std::memset( data, 0, N * sizeof(T) ); } private: T data[N]; }; #endif
017cd7d8b9e9da1569d968116bf1cc9b32e32e07
cce6ec5dc84b1b2d27bdf44e54ea75cfe9b4379f
/tests/basic_tests/matrix_tests.cpp
32bbef366e1b361c587a75e92d81c26efd78101d
[ "CC0-1.0" ]
permissive
gguyver/model-endemic-fmd
7e472945ef3ce0df8834aa701e9f2d26ad4a6107
49a8aae9256f80e6738e10be0b0c494fb7edae93
refs/heads/master
2023-04-06T18:38:10.311884
2021-06-10T16:28:20
2021-06-10T16:28:20
373,546,373
0
0
null
null
null
null
UTF-8
C++
false
false
868
cpp
matrix_tests.cpp
// // Created by Glen on 30/03/2020. // #include "gtest/gtest.h" #include "Matrix.h" /* Area to test: * - That the data is stored correctly, * - That the data are accessed correctly, * - That the data are modified correctly */ struct matrix_test : testing::Test { Matrix<int> m{20, 3, 4}; }; TEST_F(matrix_test, matrix_dimensions_correct) { EXPECT_EQ(m.getNumRows(), 3); EXPECT_EQ(m.getNumCols(), 4); EXPECT_EQ(m.getNumData(), 12); // row * col } TEST_F(matrix_test, matrix_values_correct) { for (int i = 0; i < 3; ++i) { for (int j = 0; j < 4; ++j) { EXPECT_EQ(m(i, j), 20); } } } TEST_F(matrix_test, matrix_values_change_correctly) { m(0, 2) = 9; EXPECT_EQ(m(0, 2), 9); EXPECT_NE(m(2, 0), 9); } TEST_F(matrix_test, matrix_throws_out_of_range) { EXPECT_THROW(m(3, 4), std::out_of_range); }
e83ced7d8378f2380d81c0aea74a2ebd2c25cc7e
ebd1648fe56988d059f57a42e129f327d75e8f06
/Classes/LayerGameDesk.cpp
cfa813b8b492e36b5c0d98c0361068075d30edd2
[]
no_license
mrktj/OX-poker-good-cocos2dx2.2.5
f345bacac5d2e72982d9941e123ba7cacfc3f064
957b59ccd532071e6fc43bd66b3bc5751eb84716
refs/heads/master
2020-04-14T21:08:40.811135
2014-02-22T07:54:40
2014-02-22T07:54:40
22,573,844
1
0
null
null
null
null
UTF-8
C++
false
false
24,963
cpp
LayerGameDesk.cpp
#include "LayerGameDesk.h" #include "Controls.h" #include "GameLogic.h" #include "Tools.h" #include "SceneWelcome.h" #include "SceneHall.h" #include <string> #include "MyAudioEngine.h" #include "SceneShop.h" #include "VisibleRect.h" using namespace cocos2d; MyGoldBoxByAmount* box_amount; // on "init" you need to initialize your instance bool LayerGameDesk::init() { bool bRet = false; do { m_GameStat = eGameStatStandBy; m_whoIsBoss = -1; size = CCDirector::sharedDirector()->getVisibleSize(); point = CCDirector::sharedDirector()->getVisibleOrigin(); logic = GameLogic::sharedGameLogic(); CCSprite* pSprite = CCSprite::create("scene_game_bg_desk.png"); CC_BREAK_IF(! pSprite); pSprite->setPosition(ccp(VisibleRect::center().x, VisibleRect::center().y)); this->addChild(pSprite); MyGameTopBar* bar = new MyGameTopBar(); CC_BREAK_IF(! bar); // bar->setPositionY(point.y+size.height - 35 + 200); bar->setPositionY(VisibleRect::top().y - 35 + 200); bar->setAnchorPoint(ccp(0.5,0.5)); this->addChild(bar,500); bar->autorelease(); CCActionInterval* actionBar = CCMoveBy::create(0.6f, ccp(0, -200)); // CCActionInterval* actionTo = CCMoveTo::create(1.0f, ccp(size.width /2, point.y+size.height - 35)); bar->runAction(actionBar); //back CCMenuItemImage *pItem3 = CCMenuItemImage::create( "scene_game_btn_back0.png", "scene_game_btn_back1.png", this, menu_selector(LayerGameDesk::menuCloseCallback)); CC_BREAK_IF(! pItem3); pItem3->setPosition(point); pItem3->setAnchorPoint(ccp(0,0)); CCMenu* pMenu3 = CCMenu::create(pItem3, NULL); pMenu3->setPosition(CCPointZero); pMenu3->setAnchorPoint(CCPointZero); CC_BREAK_IF(! pMenu3); addChild(pMenu3); pItem3->setRotation(-180); CCActionInterval* act1 = CCRotateTo::create(0.2f, 0); pItem3->runAction(act1); //shop // CCMenuItemImage *pItem_chat = CCMenuItemImage::create( // "scene_game_btn_shop0.png", // "scene_game_btn_shop1.png", // this, // menu_selector(LayerGameDesk::menuShopCallback)); // CC_BREAK_IF(! pItem_chat); // pItem_chat->setPosition(ccp(point.x+size.width,point.y)); // pItem_chat->setAnchorPoint(ccp(1,0)); // CCMenu* pMenu3_chat = CCMenu::create(pItem_chat, NULL); // pMenu3_chat->setPosition(CCPointZero); // pMenu3_chat->setAnchorPoint(CCPointZero); // CC_BREAK_IF(! pMenu3_chat); // this->addChild(pMenu3_chat); // pItem_chat->setRotation(180); // CCActionInterval* act2 = CCRotateTo::create(0.2f, 0); // pItem_chat->runAction(act2); //牌堆 CCSprite *sprite_heap = CCSprite::create("scene_game_cards_heap.png"); addChild(sprite_heap,TAG_CARD_HEAP,TAG_CARD_HEAP); sprite_heap->setPosition(ccp(size.width/2,size.height*0.85f)); sprite_heap->setVisible(false); //Boss图标icon CCSprite *sprite_rob_icon = CCSprite::create("scene_game_boss.png"); addChild(sprite_rob_icon,TAG_BOSS_ICON,TAG_BOSS_ICON); sprite_rob_icon->setPosition(ccp(VisibleRect::center().x,size.height*0.65f)); sprite_rob_icon->setVisible(false); //schedule(schedule_selector(LayerGameDesk::updateGameStat),0.5); schedule(schedule_selector(LayerGameDesk::updateGameStat), 1.0f); m_flag_for_start=0; m_delay_set_stat=2; //延时进入下一阶段,保证流程连贯性 schedule(schedule_selector(LayerGameDesk::startGameDelayed),10 / 60.0f); setTouchEnabled(true); bRet = true; } while (0); return bRet; } void LayerGameDesk::setRoomKind(short kind_id){ m_room_kind=kind_id; } void LayerGameDesk::startGameDelayed(float dt){ m_flag_for_start++; if(m_flag_for_start==2){ initPlayer(0); }else if(m_flag_for_start ==3){ initPlayer(1); }else if(m_flag_for_start ==4){ initPlayer(2); }else if(m_flag_for_start ==5){ initPlayer(3); }else if(m_flag_for_start ==6){ initPlayer(4); }else if(m_flag_for_start ==7){ setGameStat(eGameStatStandBy); m_flag_for_start=0; unschedule(schedule_selector(LayerGameDesk::startGameDelayed)); } } void LayerGameDesk::updateGameStat(float dt){ // CCLog("LayerGameDesk::updateGameStat"); GameStat stat = couldChangeGameStat(); if(m_GameStat != stat){ //延时调用setGameStat,为了优化操作体验,-1表示还未达到set条件,倒计时到0说明该执行了,正值为倒计时 if(m_delay_set_stat>0){ m_delay_set_stat--; } if(m_delay_set_stat==0){ setGameStat(stat); m_delay_set_stat=2; } } } void LayerGameDesk::toStandBy(float dt){ setGameStat(eGameStatStandBy); } void LayerGameDesk::setRobotsStat(GameStat gameStat){ for(int i = 0 ;i<4;i++){ if(m_robot_alive[i]!=-1){ m_managersRobot[i]->setGameStat(gameStat); } } } void LayerGameDesk::setPlayerStat(GameStat gameStat){ m_managerPlayer->setGameStat(gameStat); } GameStat LayerGameDesk::whoIsBoss(){ //特殊情况:都不抢庄时 bool noneRob=true; for(short i =0;i< 5;i++){ if(i==0){ if(m_managerPlayer->m_isRobed==1){ noneRob =false; break; } }else{ if(m_managersRobot[i-1]->m_isRobed==1){ noneRob =false; break; } } } //有人抢庄时 if(!noneRob){ //抢庄时读取玩家银币信息,不抢时赋值0 unsigned int moneys[5]; if(m_managerPlayer->m_isRobed==1){ //m_isRobed是否抢庄,-1未表态,0不抢,1抢 moneys[0] = m_managerPlayer->m_board->m_money; }else{ moneys[0] = 0; } //读取机器人信息 for(short i =1;i<5;i++){ if(m_managersRobot[i-1]->m_isRobed==1){ moneys[i] = m_managersRobot[i-1]->m_board->m_money; }else{ moneys[i] = 0; } } short whoIsBoss = 0; for(int i=1;i<5;i++){ if(moneys[i] > moneys[whoIsBoss]){ whoIsBoss = i; } } m_boss_flag = whoIsBoss; }else{ //无人抢庄时,随机抢庄 Tools::sharedTools()->showToast(eToastNoneRobBoss,this); short temp = rand() % 5; m_boss_flag = temp; } //赋值 if(m_boss_flag == 0){ m_managerPlayer->m_isBoss=true; }else{ m_managersRobot[m_boss_flag-1]->m_isBoss =true; } CCPoint point ; if(m_boss_flag==0){ point = m_managerPlayer->getPosition(); point = ccp(point.x-45,point.y+65); }else{ point = m_managersRobot[m_boss_flag-1]->getPosition(); point = ccp(point.x-38,point.y+50); } CCActionInterval* leftToRight = CCMoveTo::create(2.0f, point); CCActionInterval* rotate = CCRotateBy::create(2.0f,-360*4); CCActionInterval* spawn = CCSpawn::createWithTwoActions(leftToRight,rotate); CCActionInterval* ease = CCEaseBackOut::create(spawn); getChildByTag(TAG_BOSS_ICON)->runAction(ease); // getChildByTag(TAG_BOSS_ICON)->runAction(rotate); //把庄家的钱赋给闲家,用于决定押注金额 //1.若庄是自己,就把自己的钱赋给机器人们 if(m_boss_flag==0){ for(short i=0;i<4;i++){ m_managersRobot[i]->m_bossMoney =m_managerPlayer->m_board->m_money; } m_managerPlayer->m_bossMoney =0; }else{ //2.若庄是机器人,就把庄的钱赋给自己和其他机器人 m_managerPlayer->m_bossMoney = m_managersRobot[m_boss_flag-1]->m_board->m_money; for(short i=0;i<4;i++){ if(i!=m_boss_flag-1){ m_managersRobot[i]->m_bossMoney =m_managersRobot[m_boss_flag-1]->m_board->m_money; }else{ m_managersRobot[i]->m_bossMoney =0; } } } return eGameStatShowMoney; } GameStat LayerGameDesk::couldChangeGameStat(){ switch(m_GameStat){ case eGameStatStandBy: if(!m_managerPlayer->m_isStandBy){ return m_GameStat; } for(short i=0;i<4;i++){ if(!m_managersRobot[i]->m_isStandBy){ return m_GameStat; } } return eGameStatRobBoss; case eGameStatRobBoss: if(m_managerPlayer->m_isRobed==-1){ return m_GameStat; } for(short i=0;i<4;i++){ if(m_managersRobot[i]->m_isRobed==-1){ return m_GameStat; } } if(m_boss_flag==-1){ return whoIsBoss(); }else{ return eGameStatShowMoney; } case eGameStatShowMoney: if(!m_managerPlayer->m_isShowMoney){ return m_GameStat; } for(short i=0;i<4;i++){ if(!m_managersRobot[i]->m_isShowMoney){ return m_GameStat; } } return eGameStatGaming; case eGameStatGaming: if(!m_managerPlayer->m_isShowOx){ return m_GameStat; } for(short i=0;i<4;i++){ if(!m_managersRobot[i]->m_isShowOx){ return m_GameStat; } } return eGameStatCalcResult; case eGameStatCalcResult: if(!m_managerPlayer->m_isCalcResult){ return m_GameStat; } for(short i=0;i<4;i++){ if(!m_managersRobot[i]->m_isCalcResult){ return m_GameStat; } } return eGameStatStandBy; } return m_GameStat; } void LayerGameDesk::setGameStat(GameStat gameState){ std::string s1_before,s1_after; std::string s2_before,s2_after; bool shouldCreate = true; m_GameStat = gameState; setRobotsStat(gameState); /* if(m_managerPlayer->m_gameStat != gameState){ setPlayerStat(gameState); }*/ switch(gameState){ case eGameStatStandBy: GameLogic::sharedGameLogic()->refreshAllCards(); s1_before="scene_game_btn_start0.png"; s1_after="scene_game_btn_start1.png"; s2_before="scene_game_btn_change0.png"; s2_after ="scene_game_btn_change1.png"; getChildByTag(TAG_BOSS_ICON)->setVisible(false); m_isOxShowed=false; m_boss_flag=-1; m_isHandOx=false; break; case eGameStatRobBoss: s1_before="scene_game_btn_rob0.png"; s1_after="scene_game_btn_rob1.png"; s2_before="scene_game_btn_unrob0.png"; s2_after ="scene_game_btn_unrob1.png"; m_managerPlayer -> removeStandBy(); getChildByTag(TAG_BOSS_ICON)->setVisible(true); getChildByTag(TAG_BOSS_ICON)->setPosition(ccp(VisibleRect::center().x,size.height * 0.65f)); break; case eGameStatShowMoney: shouldCreate=false; m_managerPlayer -> removeRobChat(); setPlayerStat(m_GameStat); break; case eGameStatGaming: s1_before="scene_game_btn_tip0.png"; s1_after="scene_game_btn_tip1.png"; s2_before="scene_game_btn_open0.png"; s2_after ="scene_game_btn_open1.png"; setPlayerStat(m_GameStat); break; case eGameStatCalcResult: setPlayerStat(m_GameStat); shouldCreate=false; showCalcBoard(); scheduleOnce(schedule_selector(LayerGameDesk::toStandBy),2.0); // setGameStat(eGameStatStandBy); break; } if(shouldCreate){ removeChildByTag(TAG_BTN_UP); removeChildByTag(TAG_BTN_DOWN); // 上方按钮 -- 开始,抢庄,自动摊牌 CCMenuItemImage *pItem_up = CCMenuItemImage::create( s1_before.c_str(), s1_after.c_str(), this, menu_selector(LayerGameDesk::menuUpCallback)); pItem_up->setAnchorPoint(ccp(0,0)); pItem_up->setPosition(ccp(750+482,175)); CCMenu* pMenu3_up = CCMenu::create(pItem_up, NULL); pMenu3_up->setAnchorPoint(CCPointZero); pMenu3_up->setPosition(CCPointZero); this->addChild(pMenu3_up,TAG_BTN_UP,TAG_BTN_UP); // 下方按钮 -- 换桌,不抢,提示 CCMenuItemImage *pItem_down = CCMenuItemImage::create( s2_before.c_str(), s2_after.c_str(), this, menu_selector(LayerGameDesk::menuDownCallback)); pItem_down->setAnchorPoint(ccp(0,0)); pItem_down->setPosition(ccp(750+450,105)); CCMenu* pMenu_down = CCMenu::create(pItem_down, NULL); pMenu_down->setAnchorPoint(CCPointZero); pMenu_down->setPosition(CCPointZero); this->addChild(pMenu_down,TAG_BTN_DOWN,TAG_BTN_DOWN); moveIn(pMenu3_up,0.1); moveIn(pMenu_down,0.15); }else{ if(m_GameStat!=eGameStatCalcResult && m_GameStat!=eGameStatShowMoney){ moveOutMenus(); } } } void LayerGameDesk::initPlayer(int flag){ float x1,y1; //玩家信息和牌组管理器控件 //尚未添加是否存在,若存在还得销毁 switch(flag){ case 0: x1=220+VisibleRect::leftBottom().x; y1=170+VisibleRect::leftBottom().y; break; case 1: x1=113+VisibleRect::leftBottom().x; y1=310+VisibleRect::leftBottom().y; break; case 2: x1=113+VisibleRect::leftBottom().x; y1=445+VisibleRect::leftBottom().y; break; case 3: x1=VisibleRect::right().x-115; y1=445+VisibleRect::leftBottom().y; break; case 4: x1=VisibleRect::right().x-115; y1=310+VisibleRect::leftBottom().y; break; } if(flag!=0){ RobotManager* robot = new RobotManager(flag,m_room_kind); addChild(robot,TAG_PLAYERS+flag,TAG_PLAYERS+flag); robot->setPosition(ccp(x1,y1)); robot->setScale(0.8); robot->autorelease(); m_managersRobot[flag-1]=robot; m_robot_alive[flag-1]=1; short offset1 = 0; short offset2 = 0; if(flag>=3){ robot->setPosition(ccp(x1+300,y1)); offset1 = -315; offset2 = 15; }else{ robot->setPosition(ccp(x1-300,y1)); offset1 = 315; offset2 = -15; } //CCActionInterval* action1 = CCMoveTo::create(0.1f,ccp(point.x+x1+45+offset,point.y+y1+64)); //CCActionInterval* action2 = CCMoveTo::create(0.05f,ccp(point.x+x1+45,point.y+y1+64)); CCActionInterval* action1 = CCMoveBy::create(0.1f,ccp(offset1,0)); CCActionInterval* action2 = CCMoveBy::create(0.05,ccp(offset2,0)); CCActionInterval* seq = CCSequence::create(action1,action2,NULL); getChildByTag(TAG_PLAYERS+flag)->runAction(seq); }else{ m_managerPlayer=new PlayerManager(m_room_kind); addChild(m_managerPlayer,TAG_PLAYERS+flag,TAG_PLAYERS+flag); m_managerPlayer->setPosition(ccp(x1,y1)); m_managerPlayer->autorelease(); m_managerPlayer->setScale(0.1); CCActionInterval* action1 = CCScaleTo::create(0.1f,1.25f,1.25f); CCActionInterval* action2 = CCScaleTo::create(0.05f,1,1); CCActionInterval* seq = CCSequence::create(action1,action2,NULL); m_managerPlayer->runAction(seq); MACRO_CREATE_GOLDBOX_TIMER //局数宝箱 if(Tools::sharedTools()->couldCreateGoldBoxOfAmount()){ box_amount = new MyGoldBoxByAmount(); addChild(box_amount,999,998); box_amount->setPosition(ccpAdd(VisibleRect::rightTop(), ccp(-30+200,-100))); box_amount->autorelease(); CCActionInterval* actionForGoldBoxAmount = CCMoveBy::create(1.0f, ccp(-200,0)); box_amount->runAction(actionForGoldBoxAmount); } if(m_room_kind!=4){ //除了银锭场,其他的都要更新宝箱送的银币的信息 MACRO_GOLDBOX_TIMER_IN_DESK if(Tools::sharedTools()->couldCreateGoldBoxOfAmount()){ box_amount->setUserBoard(m_managerPlayer->m_board); } } } } void LayerGameDesk::moveOutMenus(){ moveOut(getChildByTag(TAG_BTN_UP),0.1); moveOut(getChildByTag(TAG_BTN_DOWN),0.2); } void LayerGameDesk::changeTable(){ for(short i = 1;i<5;i++){ removeChildByTag(TAG_PLAYERS+i); initPlayer(i); } } void LayerGameDesk::showCalcBoard(){ //处理局数宝箱 if(Tools::sharedTools()->couldCreateGoldBoxOfAmount()){ box_amount->updateData(); } //结算框 MyCalcBoard* board; if(m_room_kind==4){ //银锭场 board = new MyCalcBoard(false); }else{ //银币场 board = new MyCalcBoard(true); } addChild(board,TAG_CALC_BOARD,TAG_CALC_BOARD); board->autorelease(); board->setPosition(ccp(512,350+576)); board->setBoss(m_boss_flag); board->runAction(Tools::sharedTools()->getActionMoveDown()); //处理本局输赢数据 GameLogic* logic = GameLogic::sharedGameLogic(); bool bossWinOrNot[5]={true,true,true,true,true}; short ox[5]={-1,-1,-1,-1,-1}; unsigned moneys_chip[5]={0,0,0,0,0}; unsigned moneys_total[5]={0,0,0,0,0}; for(short i = 0 ; i < 5 ; i++){ if(i==0){ ox[i]=m_managerPlayer->m_cards->m_ox; if(m_boss_flag!=i){ moneys_chip[i]=m_managerPlayer->m_money->m_money; } moneys_total[i]=m_managerPlayer->m_board->m_money; }else{ ox[i]=m_managersRobot[i-1]->m_cards->m_ox; if(m_boss_flag!=i){ moneys_chip[i]=m_managersRobot[i-1]->m_money->m_money; } moneys_total[i]=m_managersRobot[i-1]->m_board->m_money; } bossWinOrNot[i]=getCompareResultBossWith(i); } moneys_chip[m_boss_flag]=0; int moneys[5]={-1,-1,-1,-1,-1}; //此数组表示各个玩家金钱改变量,不是总量哦 logic->getChipsResult(moneys,m_boss_flag,bossWinOrNot,ox,moneys_chip,moneys_total); for(short i = 0 ; i < 5 ; i++){ if(i!=m_boss_flag){ if(i==0){ board->setInfo(i,m_managerPlayer->m_board->m_pLabel_name->getString(),ox[i],moneys_chip[i],!bossWinOrNot[i],abs(moneys[i])); }else{ board->setInfo(i,m_managersRobot[i-1]->m_board->m_pLabel_name->getString(),ox[i],moneys_chip[i],!bossWinOrNot[i],abs(moneys[i])); } }else{ if(i==0){ board->setInfo(i,m_managerPlayer->m_board->m_pLabel_name->getString(),ox[i],moneys_chip[i],moneys[i]>=0,abs(moneys[i])); }else{ board->setInfo(i,m_managersRobot[i-1]->m_board->m_pLabel_name->getString(),ox[i],moneys_chip[i],moneys[i]>=0,abs(moneys[i])); } } } //播放音效 if(moneys[0]>=0){ MyAudioEngine::sharedMyAudioEngine()->playEffect(eAudioWin); }else{ MyAudioEngine::sharedMyAudioEngine()->playEffect(eAudioLose); } //基础经验,手动摆牛,vip,房间 short exps[4] = {10,0,0,0}; short exp_total=10; if(m_isHandOx){ exps[1]=rand()%3+1; exp_total+=exps[1]; } short higsetVip =Tools::sharedTools()->getVipHighest(); if(higsetVip!=-1){ if(higsetVip==0){ exps[2]=3; }else if(higsetVip==1){ exps[2]=5; }else if(higsetVip==2){ exps[2]=10; } exp_total+=exps[2]; } if(m_room_kind==5){ exps[3]=exps[2]; exp_total+=exps[3]; } board->setExperience(exps); //更新所有数据库数据 m_managerPlayer->updateGameData(moneys[0],exp_total,this); //检测输家 for(short i = 0 ; i < 5 ; i++){ if(i==0){ if(m_room_kind!=4){ //银币场 m_managerPlayer->m_board->updateMoney(Tools::sharedTools()->getCoin()); }else{ m_managerPlayer->m_board->updateMoney(Tools::sharedTools()->getIngot()); } unsigned min = logic->getMinMoneyToEnterRoom(m_room_kind); if((moneys_total[i]+moneys[i])<min){ //输到下限了,出场 Tools::sharedTools()->showToast(eToastMoneyNotEnough,this); scheduleOnce(schedule_selector(LayerGameDesk::exitGameDelay),2.5f); break; } //VIP场时效用光 if(m_room_kind>=4){ if(Tools::sharedTools()->getVipHighest()==-1){ //VIP场时效用光,出场 Tools::sharedTools()->showToast(eToastNeedVip,this); scheduleOnce(schedule_selector(LayerGameDesk::exitGameDelay),2.5f); break; } } }else{ //机器人输光 m_managersRobot[i-1]->m_board->updateMoney(moneys_total[i]+moneys[i]); unsigned min = logic->getMinMoneyToEnterRoom(m_room_kind); if((moneys_total[i]+moneys[i])<min){ removeChildByTag(TAG_PLAYERS+i); initPlayer(i); } } } } void LayerGameDesk::exitGameDelay(float dt){ exitGame(); } void LayerGameDesk::removeCalcBoard(){ removeChildByTag(TAG_CALC_BOARD); } bool LayerGameDesk::getCompareResultBossWith(short flag){ // return true:boss win // return false:boss lose //庄家自己跟自己比较 if(flag==m_boss_flag){ return true; } short ox_boss; short ox_player; //虽然下面这些值可能不用,但是先取出来,不然再取就很麻烦,因为每次都要判断flag是0还是非0 short value_boss; short value_player; short kind_boss; short kind_player; //得到庄家的数据 if(m_boss_flag==0){ ox_boss=m_managerPlayer->m_cards->m_ox; //得到boss牛 value_boss=m_managerPlayer->m_cards->getBigestValue(); kind_boss=m_managerPlayer->m_cards->getBigestKind(); }else{ ox_boss=m_managersRobot[m_boss_flag-1]->m_cards->m_ox; value_boss=m_managersRobot[m_boss_flag-1]->m_cards->getBigestValue(); kind_boss=m_managersRobot[m_boss_flag-1]->m_cards->getBigestKind(); } //得到要和庄家比的玩家的数据 if(flag==0){ ox_player=m_managerPlayer->m_cards->m_ox; value_player=m_managerPlayer->m_cards->getBigestValue(); kind_player=m_managerPlayer->m_cards->getBigestKind(); }else{ ox_player=m_managersRobot[flag-1]->m_cards->m_ox; value_player=m_managersRobot[flag-1]->m_cards->getBigestValue(); kind_player=m_managersRobot[flag-1]->m_cards->getBigestKind(); } //第一次比较:比牛 if(ox_boss>ox_player){ //boss win return true; }else if(ox_boss<ox_player){ return false; } //第二次比较:比单牌的数值 //若value为1,则把它变为14,因为A比K大 value_boss= value_boss==1?14:value_boss; value_player= value_player==1?14:value_player; if(value_boss>value_player){ return true; }else if(value_boss<value_player){ return false; } //第三次比较:比单牌的花色 //花色值越小,代表越大。 0:黑桃 if(kind_boss<kind_player){ return true; }else{ return false; } return true; } unsigned int LayerGameDesk::getCalcResultBossWith(short flag,bool isBossWin){ return 0; } void LayerGameDesk::menuUpCallback(CCObject* pSender) { // 上方按钮 -- 开始,抢庄,自动摊牌 switch(m_GameStat){ case eGameStatStandBy: // m_GameStat = eGameStatRobBoss; // setGameStat(m_GameStat); removeCalcBoard(); setPlayerStat(m_GameStat); moveOutMenus(); break; case eGameStatRobBoss: // m_GameStat = eGameStatShowMoney; // setGameStat(m_GameStat); MyAudioEngine::sharedMyAudioEngine()->playEffect(eAudioRob); m_managerPlayer->m_isRobed=1; setPlayerStat(m_GameStat); moveOutMenus(); break; case eGameStatShowMoney: // m_GameStat = eGameStatGaming; // setGameStat(m_GameStat); break; case eGameStatGaming: if(m_managerPlayer->m_cards->m_isWashingDone){ m_managerPlayer ->showOxAuto(); m_isOxShowed=true; moveOutMenus(); } break; case eGameStatCalcResult: // m_GameStat = eGameStatStandBy; // setGameStat(m_GameStat); m_managerPlayer->m_isCalcResult=true; break; } } void LayerGameDesk::menuDownCallback(CCObject* pSender) { // 下方按钮 -- 换桌,不抢,手动摆牛 switch(m_GameStat){ case eGameStatStandBy: changeTable(); removeCalcBoard(); setGameStat(eGameStatStandBy); break; case eGameStatRobBoss: // m_GameStat = eGameStatShowMoney; // setGameStat(m_GameStat); MyAudioEngine::sharedMyAudioEngine()->playEffect(eAudioUnrob); m_managerPlayer->m_isRobed=0; setPlayerStat(m_GameStat); moveOutMenus(); break; case eGameStatShowMoney: // m_GameStat = eGameStatGaming; // setGameStat(m_GameStat); // m_managerPlayer->m_isRobed=false; break; case eGameStatGaming: if(m_managerPlayer->m_cards->m_isWashingDone){ if(!m_isOxShowed){ if(m_managerPlayer ->showOxHand()){ m_isOxShowed=true; m_isHandOx=true; moveOutMenus(); }else{ Tools::sharedTools()->showToast(eToastOxError,this); } } } break; case eGameStatCalcResult: // m_GameStat = eGameStatStandBy; // setGameStat(m_GameStat); break; } } void LayerGameDesk::moveIn(CCNode* node,float time){ if(node!=NULL){ // CCActionInterval* rightToLeft = CCMoveTo::create(0.05, ccp(Tools::sharedTools()->X(580),node->getPositionY())); CCActionInterval* rightToLeft = CCMoveBy::create(time, ccp(-500,0)); node->runAction(rightToLeft); } } void LayerGameDesk::moveOut(CCNode* node,float time){ if(node!=NULL){ CCActionInterval* leftToRight = CCMoveBy::create(time, ccp(500,0)); node->runAction(leftToRight); } } bool LayerGameDesk::ccTouchBegan(CCTouch *pTouches,CCEvent *pEvent) { return false; } void LayerGameDesk::onEnter() { CCDirector* pDirector = CCDirector::sharedDirector(); pDirector->getTouchDispatcher()->addTargetedDelegate(this, 0, true); CCLayer::onEnter(); } void LayerGameDesk::onExit() { CCDirector* pDirector = CCDirector::sharedDirector(); pDirector->getTouchDispatcher()->removeDelegate(this); CCLayer::onExit(); } void LayerGameDesk::menuShopCallback(CCObject* pSender) { CCScene *scene =LayerShop::scene(2); //CCDirector::sharedDirector()->replaceScene(CCTransitionFadeDown::create(0.5f,scene ) ); //CCDirector::sharedDirector()->replaceScene(scene); CCDirector::sharedDirector()->pushScene(scene); } void LayerGameDesk::menuCloseCallback(CCObject* pSender) { if(m_GameStat==eGameStatGaming || m_GameStat == eGameStatCalcResult){ //游戏中禁止退出toast Tools::sharedTools()->showToast(eToastCantExitGaming,this); }else{ exitGame(); } } void LayerGameDesk::exitGame(){ this->unscheduleAllSelectors(); this->removeAllChildrenWithCleanup(true); GameLogic::deleteSharedGameLogic(); Tools::sharedTools()->saveAllData(); CCScene *scene =LayerHall::scene(); // CCDirector::sharedDirector()->replaceScene(CCTransitionFadeUp::create(0.5f,scene ) ); CCDirector::sharedDirector()->replaceScene(scene); }
faac64b663f3f0610f9c19a6b2f620542922e51d
2c69dc13ba6b6269abd04b602c58827d2e098d07
/Fifteens/main.cpp
89f73b40b979dd4259c2d01e2d05fb9133437105
[]
no_license
AVKdeveloper/Fifteens
7a92099564056a6741fe37a2b4a95deb47b3f039
741e067e129d164024335684e79beedf97bc35c2
refs/heads/master
2020-12-24T09:22:26.790982
2016-11-09T16:13:55
2016-11-09T16:13:55
73,298,758
0
0
null
null
null
null
UTF-8
C++
false
false
669
cpp
main.cpp
// This code solves game fifteens (for any FieldSize , which defined in Position.h). // We use A* algorithm ( O(E2) ). // #include <fstream> #include <array> #include <algorithm> #include "Position.h" int main() { std::fstream file; file.open("puzzle.in", std::fstream::in); std::array<int, FieldSize*FieldSize> startPosition; for (int i = 0; i < FieldSize*FieldSize; ++i) { file >> startPosition[i]; } Position P(startPosition); file.close(); file.open("puzzle.out", std::fstream::out); if (P.is_solvable()) { std::string result(P.AStar()); file << result.size() << std::endl; file << result << std::endl; } else file << "-1"; file.close(); }
7b59d12d2e81e766939cee563a132bfdca4d7dbd
a3d6556180e74af7b555f8d47d3fea55b94bcbda
/chrome/browser/win/conflicts/module_inspector.cc
ea0c7120491b10221b83868344b1a961cef036d6
[ "BSD-3-Clause" ]
permissive
chromium/chromium
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
refs/heads/main
2023-08-24T00:35:12.585945
2023-08-23T22:01:11
2023-08-23T22:01:11
120,360,765
17,408
7,102
BSD-3-Clause
2023-09-10T23:44:27
2018-02-05T20:55:32
null
UTF-8
C++
false
false
8,842
cc
module_inspector.cc
// Copyright 2017 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/win/conflicts/module_inspector.h" #include <utility> #include "base/functional/bind.h" #include "base/path_service.h" #include "base/task/sequenced_task_runner.h" #include "base/task/thread_pool.h" #include "base/time/time.h" #include "chrome/browser/win/conflicts/module_info_util.h" #include "chrome/browser/win/util_win_service.h" #include "chrome/common/chrome_paths.h" #include "content/public/browser/browser_thread.h" namespace { // The maximum amount of time a stale entry is kept in the cache before it is // deleted. constexpr base::TimeDelta kMaxEntryAge = base::Days(30); constexpr int kConnectionErrorRetryCount = 10; StringMapping GetPathMapping() { return GetEnvironmentVariablesMapping({ L"LOCALAPPDATA", L"ProgramFiles", L"ProgramData", L"USERPROFILE", L"SystemRoot", L"TEMP", L"TMP", L"CommonProgramFiles", }); } // Reads the inspection results cache. InspectionResultsCache ReadInspectionResultsCacheOnBackgroundSequence( const base::FilePath& file_path) { InspectionResultsCache inspection_results_cache; uint32_t min_time_stamp = CalculateTimeStamp(base::Time::Now() - kMaxEntryAge); ReadInspectionResultsCache(file_path, min_time_stamp, &inspection_results_cache); return inspection_results_cache; } // Writes the inspection results cache to disk. void WriteInspectionResultCacheOnBackgroundSequence( const base::FilePath& file_path, const InspectionResultsCache& inspection_results_cache) { WriteInspectionResultsCache(file_path, inspection_results_cache); } } // namespace // static constexpr base::TimeDelta ModuleInspector::kFlushInspectionResultsTimerTimeout; ModuleInspector::ModuleInspector( const OnModuleInspectedCallback& on_module_inspected_callback) : on_module_inspected_callback_(on_module_inspected_callback), is_started_(false), util_win_factory_callback_( base::BindRepeating(&LaunchUtilWinServiceInstance)), path_mapping_(GetPathMapping()), cache_task_runner_(base::ThreadPool::CreateSequencedTaskRunner( {base::MayBlock(), base::TaskPriority::BEST_EFFORT, base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN})), inspection_results_cache_read_(false), flush_inspection_results_timer_( FROM_HERE, kFlushInspectionResultsTimerTimeout, base::BindRepeating( &ModuleInspector::MaybeUpdateInspectionResultsCache, base::Unretained(this))), has_new_inspection_results_(false), connection_error_retry_count_(kConnectionErrorRetryCount), is_waiting_on_util_win_service_(false) {} ModuleInspector::~ModuleInspector() = default; void ModuleInspector::StartInspection() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // This function can be invoked multiple times. if (is_started_) { return; } is_started_ = true; // Read the inspection cache now that it is needed. cache_task_runner_->PostTaskAndReplyWithResult( FROM_HERE, base::BindOnce(&ReadInspectionResultsCacheOnBackgroundSequence, GetInspectionResultsCachePath()), base::BindOnce(&ModuleInspector::OnInspectionResultsCacheRead, weak_ptr_factory_.GetWeakPtr())); } void ModuleInspector::AddModule(const ModuleInfoKey& module_key) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); bool was_queue_empty = queue_.empty(); queue_.push(module_key); // If the queue was empty before adding the current module, then the // inspection must be started. if (inspection_results_cache_read_ && was_queue_empty) StartInspectingModule(); } bool ModuleInspector::IsIdle() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return queue_.empty(); } void ModuleInspector::OnModuleDatabaseIdle() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); MaybeUpdateInspectionResultsCache(); } // static base::FilePath ModuleInspector::GetInspectionResultsCachePath() { base::FilePath user_data_dir; if (!base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) return base::FilePath(); return user_data_dir.Append(L"Module Info Cache"); } void ModuleInspector::SetUtilWinFactoryCallbackForTesting( UtilWinFactoryCallback util_win_factory_callback) { util_win_factory_callback_ = std::move(util_win_factory_callback); } void ModuleInspector::EnsureUtilWinServiceBound() { if (remote_util_win_) return; remote_util_win_ = util_win_factory_callback_.Run(); remote_util_win_.reset_on_idle_timeout(base::Seconds(5)); remote_util_win_.set_disconnect_handler( base::BindOnce(&ModuleInspector::OnUtilWinServiceConnectionError, base::Unretained(this))); } void ModuleInspector::OnInspectionResultsCacheRead( InspectionResultsCache inspection_results_cache) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(is_started_); DCHECK(!inspection_results_cache_read_); inspection_results_cache_read_ = true; inspection_results_cache_ = std::move(inspection_results_cache); if (!queue_.empty()) StartInspectingModule(); } void ModuleInspector::OnUtilWinServiceConnectionError() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // Disconnect from the service. remote_util_win_.reset(); // If the retry limit was reached, give up. if (connection_error_retry_count_ == 0) return; --connection_error_retry_count_; bool was_waiting_on_util_win_service = is_waiting_on_util_win_service_; is_waiting_on_util_win_service_ = false; // If this connection error happened while the ModuleInspector was waiting on // the service, restart the inspection process. if (was_waiting_on_util_win_service) StartInspectingModule(); } void ModuleInspector::StartInspectingModule() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(inspection_results_cache_read_); DCHECK(!queue_.empty()); const ModuleInfoKey& module_key = queue_.front(); // First check if the cache already contains the inspection result. auto inspection_result = GetInspectionResultFromCache(module_key, &inspection_results_cache_); if (inspection_result) { // Send asynchronously or this might cause a stack overflow. base::SequencedTaskRunner::GetCurrentDefault()->PostTask( FROM_HERE, base::BindOnce(&ModuleInspector::OnInspectionFinished, weak_ptr_factory_.GetWeakPtr(), module_key, std::move(*inspection_result))); return; } EnsureUtilWinServiceBound(); is_waiting_on_util_win_service_ = true; remote_util_win_->InspectModule( module_key.module_path, base::BindOnce(&ModuleInspector::OnModuleNewlyInspected, weak_ptr_factory_.GetWeakPtr(), module_key)); } void ModuleInspector::OnModuleNewlyInspected( const ModuleInfoKey& module_key, ModuleInspectionResult inspection_result) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); is_waiting_on_util_win_service_ = false; // Convert the prefix of known Windows directories to their environment // variable mappings (ie, %systemroot$). This makes i18n localized paths // easily comparable. CollapseMatchingPrefixInPath(path_mapping_, &inspection_result.location); has_new_inspection_results_ = true; if (!flush_inspection_results_timer_.IsRunning()) flush_inspection_results_timer_.Reset(); AddInspectionResultToCache(module_key, inspection_result, &inspection_results_cache_); OnInspectionFinished(module_key, std::move(inspection_result)); } void ModuleInspector::OnInspectionFinished( const ModuleInfoKey& module_key, ModuleInspectionResult inspection_result) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(!queue_.empty()); DCHECK(queue_.front() == module_key); // Pop first, because the callback may want to know if there is any work left // to be done, which is caracterized by a non-empty queue. queue_.pop(); on_module_inspected_callback_.Run(module_key, std::move(inspection_result)); // Continue the work. if (!queue_.empty()) StartInspectingModule(); } void ModuleInspector::MaybeUpdateInspectionResultsCache() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!has_new_inspection_results_) return; has_new_inspection_results_ = false; cache_task_runner_->PostTask( FROM_HERE, base::BindOnce(&WriteInspectionResultCacheOnBackgroundSequence, GetInspectionResultsCachePath(), inspection_results_cache_)); }
dd40eff270085c3b9400c720c916ad19c3fe1b4a
3ea34c23f90326359c3c64281680a7ee237ff0f2
/Data/4011/H
6ad795fcf8cc68b8ed6e423bfff329a74f645a5b
[]
no_license
lcnbr/EM
c6b90c02ba08422809e94882917c87ae81b501a2
aec19cb6e07e6659786e92db0ccbe4f3d0b6c317
refs/heads/master
2023-04-28T20:25:40.955518
2020-02-16T23:14:07
2020-02-16T23:14:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
92,419
H
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | foam-extend: Open Source Cstd::filesystem::create_directory();FD | | \\ / O peration | Version: 4.0 | | \\ / A nd | Web: http://www.foam-extend.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volVectorField; location "Data/4011"; object H; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 -1 0 0 0 0]; internalField nonuniform List<vector> 4096 ( (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (3.81181416997608e-13,-7.45597280272286e-12,7.30665040354852e-12) (-3.04403954723005e-13,-1.82891229365554e-11,7.11933247961587e-12) (-1.07642294266659e-12,-3.29228461104593e-11,6.66225310365366e-12) (-1.66338967843591e-12,-5.33091312071542e-11,5.51131614545013e-12) (-1.26192643925747e-12,-8.57275674914408e-11,3.74360667523837e-12) (-9.76188889771592e-13,-1.38122546159659e-10,2.23062642397554e-12) (2.46716339464487e-13,-2.22194806204644e-10,1.10309683715491e-12) (1.57069666754742e-12,-3.61451150884677e-10,6.53816332038502e-13) (1.66151624137068e-12,-5.94756117268487e-10,7.29689047042913e-13) (2.35293488164949e-12,-9.21118908847737e-10,1.94575297671161e-13) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (8.82384783233705e-13,-7.47918460403572e-12,1.71850535320213e-11) (9.88787292964792e-14,-1.77491067547333e-11,1.64398025987871e-11) (-1.10835161351606e-12,-3.15043847065932e-11,1.53129753642931e-11) (-2.09676874733888e-12,-5.10941924374553e-11,1.32420671208243e-11) (-1.71391153683959e-12,-8.35832890318088e-11,1.03011377653328e-11) (-1.65693608244121e-12,-1.36207202350859e-10,7.32649415559833e-12) (-8.60008147015539e-13,-2.212881920865e-10,4.68013878740024e-12) (1.37488526206004e-12,-3.61806906315319e-10,2.98624680296076e-12) (2.012630411625e-12,-5.95153677824859e-10,2.25167930100723e-12) (2.60454334305951e-12,-9.21446741105817e-10,1.13909546155212e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (1.23380919799427e-12,-6.90814963912402e-12,3.19216854616382e-11) (2.08751308099319e-13,-1.65121195547864e-11,3.07477708022718e-11) (-1.46925599894114e-12,-2.92001895541835e-11,2.87422222127159e-11) (-2.60477450243863e-12,-4.75904427095353e-11,2.59080704717367e-11) (-2.42258803839282e-12,-7.98256362897833e-11,2.24958106638596e-11) (-2.79604972150103e-12,-1.327987720269e-10,1.83235658433255e-11) (-2.31581038608764e-12,-2.19506287476522e-10,1.35847686145136e-11) (4.74050137923292e-13,-3.61832059259319e-10,9.70559130399422e-12) (1.47640784480804e-12,-5.95550160766257e-10,6.96060002990839e-12) (2.21295649584168e-12,-9.2172841839493e-10,3.98885558872194e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1.40744374778748e-14,-5.48273948595082e-12,5.42458130344167e-11) (-1.59614676156842e-12,-1.40862427698458e-11,5.35086996334412e-11) (-3.86652470980665e-12,-2.59685845181709e-11,5.12300096675281e-11) (-4.69387722035566e-12,-4.33556146031779e-11,4.77512889020864e-11) (-4.49247640028228e-12,-7.41227671958523e-11,4.34014316785188e-11) (-4.49227381371503e-12,-1.26296386717126e-10,3.78851267289729e-11) (-2.78788840992557e-12,-2.14851958503356e-10,3.11875380633434e-11) (-4.54324124787586e-14,-3.59783174532282e-10,2.4526649267817e-11) (7.49843729801551e-13,-5.94159017926684e-10,1.76664598927427e-11) (8.10285605031748e-13,-9.19723353783447e-10,9.69804728253399e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1.27863614284744e-12,-4.4356738677933e-12,8.82044663983322e-11) (-3.39227750248091e-12,-1.1356055168812e-11,8.77738493998178e-11) (-5.70674730905729e-12,-2.1676376756896e-11,8.58846866137922e-11) (-6.21747923363468e-12,-3.73950579508367e-11,8.23803756798784e-11) (-6.05290692071191e-12,-6.58044539693893e-11,7.76515239347407e-11) (-5.5341680801984e-12,-1.16278450747469e-10,7.18351576590143e-11) (-2.863201262835e-12,-2.06414553293826e-10,6.45017898506861e-11) (-4.47785438323566e-13,-3.54148494552914e-10,5.22907887682701e-11) (1.05626858391835e-12,-5.88505117380285e-10,3.69823183770547e-11) (1.01381171042971e-12,-9.12906736858221e-10,1.93848172591174e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2.0504182016195e-12,-3.63656617133445e-12,1.40410690793505e-10) (-4.09721739308812e-12,-8.59898972910958e-12,1.39640504463102e-10) (-6.28281137494585e-12,-1.66275601794519e-11,1.37743569834127e-10) (-6.02822900603249e-12,-3.01433953615749e-11,1.34742449318673e-10) (-5.76455390167614e-12,-5.61399317910565e-11,1.30915834376768e-10) (-5.61029108042374e-12,-1.05241403355698e-10,1.25155183709519e-10) (-3.09120176859165e-12,-1.96028926880603e-10,1.15309387897327e-10) (-1.46042857500938e-13,-3.42683566739271e-10,9.67144655491384e-11) (2.49379007199937e-12,-5.74878113874178e-10,6.98562844095562e-11) (3.62343300713095e-12,-8.97540999784777e-10,3.66900982230638e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2.63227746311262e-12,-2.54538764716596e-12,2.23165574131864e-10) (-4.05388313059869e-12,-5.85728808884101e-12,2.22455594358793e-10) (-6.46369057106407e-12,-1.19789479423507e-11,2.21324108282464e-10) (-6.69281698375665e-12,-2.33078473800351e-11,2.19085592120582e-10) (-6.27200553957086e-12,-4.62685625612183e-11,2.1544990036792e-10) (-4.48919208666279e-12,-9.21170537783845e-11,2.08288623447487e-10) (-2.62428673145226e-12,-1.7908489056292e-10,1.93456619441574e-10) (-1.94821030850941e-13,-3.19635300861255e-10,1.67292888635196e-10) (2.77558656595792e-12,-5.45516828346976e-10,1.24841993452574e-10) (4.89213914386436e-12,-8.64267114498213e-10,6.76608898836233e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-3.94351534937156e-12,-1.33937061235299e-12,3.61205455067009e-10) (-4.73751096317279e-12,-3.7504038012542e-12,3.60836596935197e-10) (-6.54598818239692e-12,-8.79893748410698e-12,3.60543421814845e-10) (-7.11727598383403e-12,-1.8299320598109e-11,3.58700612888717e-10) (-6.62749935321944e-12,-3.79341158307297e-11,3.54632054729859e-10) (-4.69659279828072e-12,-7.85756506874633e-11,3.45552806368584e-10) (-2.35113230383815e-12,-1.54128706905171e-10,3.25482725874387e-10) (-3.250630480742e-14,-2.79287728176358e-10,2.86576488291122e-10) (1.79689945046929e-12,-4.90297844437082e-10,2.21719142387094e-10) (4.0688250911898e-12,-7.97971327349911e-10,1.25483529410937e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-4.00155764577474e-12,-2.60838028922391e-13,5.92335345364469e-10) (-4.96447033016891e-12,-2.2496167995522e-12,5.92503310413419e-10) (-5.930868302284e-12,-6.2383261309322e-12,5.9254815209602e-10) (-6.22174537672553e-12,-1.32508015419253e-11,5.90140509924058e-10) (-6.4439628164199e-12,-2.76977240099878e-11,5.84544304404559e-10) (-5.64415325451798e-12,-5.82600701758054e-11,5.72737075144439e-10) (-3.73598503188452e-12,-1.15514411170405e-10,5.46365960444251e-10) (-1.64911009353025e-12,-2.1555724558501e-10,4.93448840384094e-10) (-2.56040995314671e-13,-3.95654032232187e-10,3.98996909023253e-10) (1.1923180474204e-12,-6.73639717917796e-10,2.39613396346077e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-4.31873715502091e-12,-4.02943921587294e-14,9.18125158546062e-10) (-5.79535570830771e-12,-1.35189404393346e-12,9.1814128367559e-10) (-7.08980898221032e-12,-3.30578166439897e-12,9.17342116498967e-10) (-6.91604796099169e-12,-6.70997872177281e-12,9.14304459957125e-10) (-7.55932334540978e-12,-1.46623557035473e-11,9.0798109131361e-10) (-6.97268166755563e-12,-3.12935400832751e-11,8.94072170254421e-10) (-5.37666662560708e-12,-6.30439689007357e-11,8.62965322051051e-10) (-3.41449054639066e-12,-1.22205462387752e-10,7.98937949338347e-10) (-2.34829031064978e-12,-2.37855084735175e-10,6.75660317766485e-10) (-1.48417787117561e-12,-4.35594147095393e-10,4.36745337031513e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (5.91711142240927e-13,-1.517833698168e-11,1.49545848767245e-11) (-3.87340760586141e-13,-3.43153695235855e-11,1.46203663155925e-11) (-1.34394738834603e-12,-6.04442430722078e-11,1.32120287975612e-11) (-2.11061897794113e-12,-9.69448209932416e-11,1.07430846752622e-11) (-1.89322464769089e-12,-1.54255740407148e-10,7.52854786094487e-12) (-1.76400311164011e-12,-2.4412174158474e-10,4.28005563350858e-12) (-2.10617273427493e-13,-3.87254449880526e-10,1.5747450298186e-12) (1.85057938306776e-12,-6.30822132975165e-10,2.31859960222328e-13) (2.59419054653727e-12,-1.09798498702191e-09,2.62424624449926e-13) (2.87534243715717e-12,-2.16818536508435e-09,1.46992156735271e-13) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (1.05660075155498e-12,-1.47978593059396e-11,3.47462398186837e-11) (-1.12812361405467e-14,-3.28916711184288e-11,3.33674561314795e-11) (-1.34163852247508e-12,-5.79220869561619e-11,3.03584309673687e-11) (-2.65958911973811e-12,-9.36599550701089e-11,2.57736107805668e-11) (-2.49692066911572e-12,-1.50807095245112e-10,1.95330246238398e-11) (-2.41901103822638e-12,-2.41279757433594e-10,1.22661085879979e-11) (-9.48020772702984e-13,-3.86498013936605e-10,5.72361242302672e-12) (2.13460570851673e-12,-6.3176406375029e-10,2.43685085130779e-12) (3.52169719281973e-12,-1.09882106118112e-09,1.72776252431931e-12) (4.02531609357108e-12,-2.16892459026794e-09,1.02935330515114e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (9.82313704187962e-13,-1.29927071062948e-11,6.29971216340527e-11) (-2.11576887282714e-13,-2.92258430668474e-11,6.06874247934168e-11) (-1.86670929393796e-12,-5.24289652053797e-11,5.6299078357804e-11) (-3.42734280093918e-12,-8.63653225758636e-11,4.99334593668417e-11) (-3.9532123118556e-12,-1.4244890757945e-10,4.1440870025888e-11) (-4.5596378024794e-12,-2.33937643869881e-10,3.01136700224966e-11) (-3.09096204864159e-12,-3.83876808148157e-10,1.81460722230057e-11) (1.17015668477652e-12,-6.33163878617815e-10,1.20159285783444e-11) (3.05700944641657e-12,-1.10055135241575e-09,9.03651054986384e-12) (4.19674747252417e-12,-2.17024140257503e-09,5.33255843316036e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-3.24026654658663e-13,-1.01640854843819e-11,1.03856789579059e-10) (-2.04764439668946e-12,-2.39840860781957e-11,1.01537753138292e-10) (-4.68001170565323e-12,-4.45520696333474e-11,9.65878507265451e-11) (-6.30457664912788e-12,-7.5544391387216e-11,8.90021211177088e-11) (-7.29448467719007e-12,-1.28234609463862e-10,7.88149692547645e-11) (-7.81262111774058e-12,-2.18893639262439e-10,6.47896607146179e-11) (-4.56440482395799e-12,-3.75963631742082e-10,4.84242172453382e-11) (1.18007698322501e-12,-6.33209291400437e-10,3.76107817557392e-11) (3.06435579441311e-12,-1.10132230515152e-09,2.78274087182515e-11) (3.69171596389444e-12,-2.16942987794503e-09,1.52455983438486e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1.64712684079364e-12,-7.75096964199187e-12,1.6274672234277e-10) (-4.26018015616094e-12,-1.85859184965461e-11,1.61127858562636e-10) (-7.25125295259219e-12,-3.52550175493121e-11,1.56851852804036e-10) (-8.74029007775792e-12,-6.17016659955728e-11,1.49453741642942e-10) (-9.90106282331672e-12,-1.0864350328685e-10,1.39766246017438e-10) (-9.23784766370969e-12,-1.94653282088961e-10,1.28405103333488e-10) (-1.03782659354311e-12,-3.57153640795949e-10,1.1842016079539e-10) (3.39575713948387e-12,-6.27897612760663e-10,9.28677408619243e-11) (5.02676619530181e-12,-1.09577481034522e-09,6.50213335841839e-11) (5.03289189593309e-12,-2.16110886562099e-09,3.38867875413337e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2.37141039538333e-12,-5.82561052678586e-12,2.51056676474792e-10) (-4.94198440438594e-12,-1.34433286811719e-11,2.49601512597033e-10) (-7.93030309660295e-12,-2.56787508787202e-11,2.46221319135462e-10) (-9.03716204566424e-12,-4.70561595404764e-11,2.40749954542732e-10) (-9.87527246425144e-12,-8.83509286414552e-11,2.33815720609514e-10) (-8.8888448455365e-12,-1.71715413371309e-10,2.24106141937163e-10) (-1.44031573817863e-12,-3.42681044304826e-10,2.09971576617498e-10) (3.66387240395857e-12,-6.11420466845472e-10,1.7501590672001e-10) (6.29869073121335e-12,-1.07401674316045e-09,1.25549252011338e-10) (7.03964594390143e-12,-2.13548045324268e-09,6.5707310259873e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-3.12831472485657e-12,-4.0137653755263e-12,3.90264394108078e-10) (-5.02928134185393e-12,-8.9241584703036e-12,3.88979216165503e-10) (-7.40518486741859e-12,-1.75475421295133e-11,3.87020288279433e-10) (-8.06565201302772e-12,-3.4377258745426e-11,3.84379149974572e-10) (-7.44517534957937e-12,-6.90217403019712e-11,3.80627184842088e-10) (-3.19859117168325e-12,-1.44734743038167e-10,3.71823197243637e-10) (-1.41673958279368e-12,-3.13995859739174e-10,3.44110219501103e-10) (1.90850146663753e-12,-5.71429709674159e-10,3.01758092640264e-10) (4.73770622544708e-12,-1.02227440048067e-09,2.22955623466495e-10) (6.25724188013491e-12,-2.07642254526753e-09,1.19972242833209e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-4.65318980098868e-12,-2.23680985109903e-12,6.28768006151446e-10) (-5.94512284452141e-12,-5.58970504016783e-12,6.27938175935039e-10) (-7.26379060943774e-12,-1.2567650011279e-11,6.27113855091175e-10) (-8.09723688116273e-12,-2.70928304638048e-11,6.25580030811546e-10) (-7.78464281271141e-12,-5.83817007178694e-11,6.21807059890738e-10) (-4.94209281565855e-12,-1.28647740826825e-10,6.10796033956864e-10) (-2.05919045527603e-12,-2.72265174985648e-10,5.79439213114681e-10) (1.09435700762469e-12,-4.96658112911321e-10,5.09668291452326e-10) (3.38870022184117e-12,-9.2401884477891e-10,3.92875388892581e-10) (5.2207450690449e-12,-1.96042565486561e-09,2.23318928450032e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-4.39006633148882e-12,-8.29096568127218e-13,1.09054877644273e-09) (-5.90703476838784e-12,-3.4169429700282e-12,1.09041341672313e-09) (-6.4557705968499e-12,-9.15457128553548e-12,1.08990940347579e-09) (-7.16636267737444e-12,-2.05900031561649e-11,1.08718047463903e-09) (-7.6721018627307e-12,-4.49775875601356e-11,1.07983067958586e-09) (-6.23956864690145e-12,-9.83503967819897e-11,1.06224818332577e-09) (-3.28930724136826e-12,-2.02288540834077e-10,1.01914326631229e-09) (-5.4896192993025e-13,-3.81428272419337e-10,9.27137460601468e-10) (1.32852418478014e-12,-7.57157878948609e-10,7.62116869828144e-10) (2.76014357107924e-12,-1.73950210792383e-09,4.76239412239492e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-4.37515667670677e-12,-3.68755861031426e-13,2.15965795796679e-09) (-6.34808257561886e-12,-2.06095741159334e-12,2.15951098706581e-09) (-7.35793410477143e-12,-4.97793551474116e-12,2.15780281226584e-09) (-7.30265803924831e-12,-1.08907799446409e-11,2.15367486318443e-09) (-8.31275798977898e-12,-2.46792037504845e-11,2.14434670814193e-09) (-7.15937354746851e-12,-5.37042309486386e-11,2.12177079879616e-09) (-4.39326281367299e-12,-1.09801723069084e-10,2.06932056281617e-09) (-2.34232136224643e-12,-2.17062766189386e-10,1.95933590049926e-09) (-1.28839431085616e-12,-4.72951666687884e-10,1.74132139600956e-09) (-3.32987934945702e-13,-1.26524893333464e-09,1.26693916597539e-09) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (5.45452027114654e-13,-2.16246820753193e-11,2.15679188165335e-11) (-4.02701647469012e-13,-4.68887925327291e-11,2.12968289929841e-11) (-1.39715938121897e-12,-8.03093010469763e-11,1.92727709955626e-11) (-2.18094808646462e-12,-1.26670220216819e-10,1.53385070096696e-11) (-2.0933775830216e-12,-1.95681077717042e-10,9.93064553817632e-12) (-1.90067665852551e-12,-2.99299595770215e-10,3.7436723014113e-12) (3.75831851331162e-13,-4.52997463010682e-10,-1.62277133844523e-12) (2.76194549379621e-12,-6.77631330330883e-10,-2.93678400425001e-12) (3.54569717414041e-12,-9.97710503569695e-10,-1.75564969660336e-12) (3.76155977639346e-12,-1.38624232242723e-09,-3.87640162866119e-13) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (6.30232239120908e-13,-2.07611596539922e-11,4.91014702055718e-11) (-6.6808412465605e-13,-4.44085361588584e-11,4.76109485796001e-11) (-2.24994008695106e-12,-7.64479184403523e-11,4.32616888389448e-11) (-3.71363545707639e-12,-1.21697051824147e-10,3.56018208023247e-11) (-3.58819229848199e-12,-1.90158323791711e-10,2.423837458833e-11) (-3.21862843745686e-12,-2.94780748375818e-10,9.66895566139344e-12) (-2.82464990278979e-13,-4.52811174087846e-10,-3.92562757130393e-12) (4.24350890381327e-12,-6.80263722615144e-10,-6.41528628240314e-12) (5.95039764706412e-12,-1.00030413357013e-09,-3.52622253947166e-12) (6.37148170651539e-12,-1.38826196562119e-09,-9.83604338809591e-13) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (4.63388920524748e-13,-1.84645339107117e-11,8.71423417648608e-11) (-1.06498743905458e-12,-3.91845076324498e-11,8.41806996582268e-11) (-3.3779858749041e-12,-6.81829365344016e-11,7.787972342235e-11) (-5.75568464858488e-12,-1.10072435509187e-10,6.69524798950392e-11) (-6.84031042436317e-12,-1.75734192345793e-10,4.98143214588816e-11) (-7.63604461074988e-12,-2.81911462170655e-10,2.49982764305012e-11) (-4.87399480975288e-12,-4.52282077059268e-10,-3.04213052961294e-12) (4.19498749607586e-12,-6.87410854111927e-10,-5.31264712244121e-12) (7.53191429932263e-12,-1.00707268124567e-09,6.97333777156807e-14) (8.71778127569299e-12,-1.3934701204655e-09,1.85103012770735e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-4.18106057462842e-13,-1.45360969188021e-11,1.39086907287157e-10) (-2.49590956536201e-12,-3.16515400345173e-11,1.35712237399419e-10) (-6.3913341811201e-12,-5.58802757687724e-11,1.28517282402455e-10) (-9.96015017923535e-12,-9.14771056307318e-11,1.15634952838898e-10) (-1.28602823148909e-11,-1.49513759856176e-10,9.49884865128073e-11) (-1.5687534820226e-11,-2.52592582392469e-10,6.30336745776499e-11) (-1.25609602803486e-11,-4.46944742763607e-10,1.88611072282853e-11) (5.65177138080366e-12,-7.00643904528223e-10,1.80733335998677e-11) (1.00986713633451e-11,-1.01707285341163e-09,1.965640116738e-11) (1.06163019819741e-11,-1.39859034293253e-09,1.25165023685844e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1.95362217546661e-12,-1.01057979874124e-11,2.11002524688677e-10) (-5.12676421246652e-12,-2.30958311054815e-11,2.0805752847582e-10) (-9.42940846377246e-12,-4.12878136632822e-11,2.01098952637535e-10) (-1.3698300907222e-11,-6.77682689242139e-11,1.89127712274167e-10) (-1.88324947829845e-11,-1.12113468561412e-10,1.71991584218998e-10) (-2.21907738440125e-11,-1.95638093898345e-10,1.52822363781645e-10) (1.00419968473982e-11,-3.95136319207473e-10,1.67303124939149e-10) (1.47650185014823e-11,-7.14674329466992e-10,1.08923387209711e-10) (1.44032450552191e-11,-1.02269918587752e-09,7.32793034107243e-11) (1.32912670584489e-11,-1.39556947241017e-09,3.78895211163191e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2.72809166894925e-12,-6.44030926570708e-12,3.11299992635534e-10) (-6.08096115388913e-12,-1.49040724424764e-11,3.0920134462078e-10) (-1.05901472532429e-11,-2.69219316992377e-11,3.04322792510104e-10) (-1.47818289068744e-11,-4.43619107249964e-11,2.96392519760445e-10) (-1.94948821315415e-11,-7.65314739919234e-11,2.86062151530614e-10) (-2.17349498593812e-11,-1.53861503419778e-10,2.73773593342145e-10) (4.83016959475004e-12,-4.04019558053467e-10,2.80793973513276e-10) (1.3139769939477e-11,-7.08244014365112e-10,2.2167911580118e-10) (1.4398289804797e-11,-1.00278936658249e-09,1.53761001096426e-10) (1.36890482281471e-11,-1.36784552336914e-09,7.88621451736762e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-3.6200923050266e-12,-4.02869162590659e-12,4.57461946074821e-10) (-6.40480688828396e-12,-8.73577866129141e-12,4.55892395308817e-10) (-9.74393868026681e-12,-1.55508228513075e-11,4.53644680888964e-10) (-1.15981151625927e-11,-2.53009695014933e-11,4.51942957973545e-10) (-9.28122733455395e-12,-4.2770142503871e-11,4.54124754743492e-10) (8.42738435946372e-12,-9.20049802805231e-11,4.61578792730708e-10) (-7.95297475779928e-13,-3.72881429803475e-10,4.06854819452467e-10) (5.93937387703989e-12,-6.63051831118108e-10,3.89491474221142e-10) (9.46553115764667e-12,-9.40462157698071e-10,2.70709981533548e-10) (1.02325943109776e-11,-1.29698302513949e-09,1.39289184499255e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-5.23107286623914e-12,-2.15737375860449e-12,6.73142502955772e-10) (-7.29356407109053e-12,-4.89361657792142e-12,6.72214638181371e-10) (-9.14304505555002e-12,-9.97957352266257e-12,6.71428043049743e-10) (-1.08270932678261e-11,-2.00213539435035e-11,6.71995272370589e-10) (-1.01777300364344e-11,-4.49572134559508e-11,6.75651597880805e-10) (-3.88261601821264e-12,-1.1970145702952e-10,6.80860877143392e-10) (-2.26490294486875e-12,-3.37344576876331e-10,6.65836093202943e-10) (2.6574190744056e-12,-5.49510300021156e-10,5.67420677864524e-10) (6.0841948339952e-12,-8.15170616033523e-10,4.14182551512367e-10) (7.61612657822645e-12,-1.16242689864214e-09,2.23590906666982e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-4.71504731947381e-12,-1.02761565764461e-12,9.84983674796024e-10) (-6.75900708022363e-12,-2.9399142130471e-12,9.84601002657369e-10) (-7.90347752991988e-12,-7.43703844456062e-12,9.84288489939842e-10) (-9.5157908357568e-12,-1.75641196070969e-11,9.8356411131134e-10) (-1.03879894118669e-11,-4.21208039677194e-11,9.80684168372471e-10) (-7.78081746662175e-12,-1.04393386855155e-10,9.69382340227262e-10) (-3.77031929538421e-12,-2.36548482229279e-10,9.28560730813411e-10) (1.06122611500296e-13,-3.97953402989217e-10,8.16501923243511e-10) (2.9997695142353e-12,-6.27137350919171e-10,6.32655428264609e-10) (4.74638122113003e-12,-9.40923046149427e-10,3.63473852651998e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-4.59694163778924e-12,-4.08914329864972e-13,1.37096502928506e-09) (-6.70086518738121e-12,-1.68072049955267e-12,1.37073313764497e-09) (-8.20792053815536e-12,-4.48440122085536e-12,1.36982727444613e-09) (-8.86528294184033e-12,-1.04598266794068e-11,1.36698314246554e-09) (-1.04160523934429e-11,-2.52343053293912e-11,1.3596108680449e-09) (-8.41336851718985e-12,-5.91050372433255e-11,1.33774162070619e-09) (-4.21032356459704e-12,-1.23276372522385e-10,1.28096900722553e-09) (-1.39058306335548e-12,-2.14837912474289e-10,1.15788309282732e-09) (1.42169035333638e-13,-3.59487189368548e-10,9.42026963154935e-10) (1.35724470662298e-12,-5.79063398287342e-10,5.80906651691406e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-4.69805706609863e-14,-2.53025039003863e-11,2.67667180685741e-11) (-8.58900023933961e-13,-5.36938990116201e-11,2.62176254937775e-11) (-1.32427800194155e-12,-9.13273510817374e-11,2.34923300499552e-11) (-1.74625500766894e-12,-1.42464503983232e-10,1.81564383371788e-11) (-1.42915827152744e-12,-2.12461039227574e-10,1.03008907986172e-11) (-1.05308041303416e-12,-3.12808210307817e-10,5.85902228874792e-13) (1.50355559431423e-12,-4.51446756984311e-10,-9.0470075128748e-12) (4.21320347033922e-12,-6.26508813558114e-10,-1.01925259163114e-11) (4.77131764088243e-12,-8.2480130962754e-10,-6.6641703487675e-12) (5.39356280728956e-12,-9.93585161235618e-10,-2.63995521142969e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1.75871878179691e-13,-2.40190240448561e-11,5.89118132306872e-11) (-1.54285291034665e-12,-5.09281794097323e-11,5.72852159296237e-11) (-2.85505395634879e-12,-8.66480741093366e-11,5.16387579256591e-11) (-3.97480555796959e-12,-1.35230421868542e-10,4.08360940593066e-11) (-3.44290481750297e-12,-2.03716415728256e-10,2.36853769731885e-11) (-2.49333140994807e-12,-3.0530248683831e-10,-2.36750674872591e-13) (1.67809669218418e-12,-4.52800157181418e-10,-2.68770759165058e-11) (8.50157665779736e-12,-6.32446527751145e-10,-2.64568665032581e-11) (1.01763271219775e-11,-8.3031900418436e-10,-1.54873552097459e-11) (1.05960322117926e-11,-9.97275654398712e-10,-6.1319374083827e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-5.03405964749528e-13,-2.16068895614513e-11,1.02060454060352e-10) (-2.29697880111037e-12,-4.51544291824873e-11,9.85577357486335e-11) (-4.75340311325899e-12,-7.61415513707032e-11,9.03651313834447e-11) (-7.21285609084377e-12,-1.18521643286225e-10,7.4842974835406e-11) (-8.24469788561031e-12,-1.81302325346332e-10,4.77483077146216e-11) (-8.91451742891684e-12,-2.83799546229379e-10,1.78681850794769e-12) (-7.94081251251158e-12,-4.62011120827153e-10,-6.95836585476537e-11) (1.20456574121246e-11,-6.51544114621521e-10,-5.22491583272459e-11) (1.57507897150869e-11,-8.44845215283516e-10,-2.3024260219395e-11) (1.56890338711119e-11,-1.00712504419186e-09,-6.90080330717677e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1.47373510106458e-12,-1.70606007220845e-11,1.58468616763438e-10) (-3.85666349743499e-12,-3.59471925896685e-11,1.5415188262029e-10) (-8.10146672302488e-12,-5.98804155680179e-11,1.44857494056442e-10) (-1.3022520559701e-11,-9.15895280690702e-11,1.2672405292769e-10) (-1.83057616745026e-11,-1.38616948094787e-10,9.25597992095994e-11) (-2.8469455964964e-11,-2.26315217990195e-10,2.17824664207314e-11) (-6.35816102080494e-11,-5.06547173686827e-10,-1.81126866121803e-10) (1.80991287518804e-11,-7.03511566901963e-10,-7.19416342660521e-11) (2.28649026281587e-11,-8.72307761154406e-10,-1.44943083711283e-11) (2.01119338282318e-11,-1.02090148020813e-09,1.4468180462059e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2.67411468433676e-12,-1.14710016212e-11,2.31938535700521e-10) (-6.3599470371965e-12,-2.49792161492167e-11,2.27651111543693e-10) (-1.1824050064439e-11,-4.06677084594744e-11,2.18425438508187e-10) (-1.99685310512476e-11,-5.76581861760264e-11,2.01668621576004e-10) (-3.52452689150544e-11,-7.47975154179373e-11,1.71402351212152e-10) (-7.8448125480157e-11,-6.90116025320773e-11,1.13699200148528e-10) (7.73049734228889e-11,-9.82508680623911e-10,-9.80982532686765e-18) (4.3978787198495e-11,-8.32170198431647e-10,8.04567453702533e-11) (2.98832080546446e-11,-9.09561544749127e-10,5.62800636153291e-11) (2.34568391340254e-11,-1.02953796139894e-09,3.1511595167791e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-3.04106129397282e-12,-6.35682666236443e-12,3.28174676444628e-10) (-7.37070282440343e-12,-1.41298980164921e-11,3.25117510022006e-10) (-1.40309833515023e-11,-2.21126708120998e-11,3.18650236463355e-10) (-2.35124019006428e-11,-2.53197157419237e-11,3.07590033252173e-10) (-4.09676554310877e-11,-1.80342245898e-11,2.88191933074349e-10) (-9.06118531697112e-11,1.53956077882388e-11,2.39486819180435e-10) (3.28068990568429e-11,-9.85660437128302e-10,-1.24762408266723e-16) (3.5865701397257e-11,-8.52357354994642e-10,2.21487351159753e-10) (2.69699368431326e-11,-9.01928249043753e-10,1.5151832481817e-10) (2.16886951718397e-11,-1.00664889308546e-09,7.73130096375274e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-3.92185940628431e-12,-2.77634040669903e-12,4.55256837297639e-10) (-7.99925455178605e-12,-5.94698782229221e-12,4.53450199902009e-10) (-1.36134650935032e-11,-7.62265736600784e-12,4.51262570642056e-10) (-1.90595274905043e-11,1.84535917698839e-12,4.51268192946146e-10) (-1.45481943698028e-11,4.94800972602523e-11,4.68272575920753e-10) (9.08478343867306e-11,2.81808099985676e-10,5.82340255661334e-10) (-1.89688051712783e-11,-1.1743410135627e-09,1.28637138875412e-09) (1.11793354674409e-11,-8.35606573331477e-10,5.66760404429591e-10) (1.55947865273154e-11,-8.42280472809557e-10,3.02561354557547e-10) (1.49656523131657e-11,-9.35546875102951e-10,1.41315764249069e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-5.43296619268332e-12,-8.4228453451407e-13,6.17656407094045e-10) (-8.46067130441144e-12,-2.01849250960461e-12,6.16984968917499e-10) (-1.22528094545093e-11,-2.43140219957116e-12,6.17401456451783e-10) (-1.69406531146683e-11,1.85635043832792e-12,6.2169124846694e-10) (-1.82234187871731e-11,1.03370623514911e-11,6.3976679324213e-10) (-4.16590225206999e-12,-1.22899633278436e-11,6.98491814465911e-10) (-4.6455822533678e-12,-4.73698854207508e-10,8.30051534112079e-10) (4.33864839437982e-12,-5.86729135790309e-10,6.08376878603238e-10) (8.6425745654446e-12,-6.8636504083565e-10,3.96808546654969e-10) (9.7031807522414e-12,-7.97115944100246e-10,1.99995040061195e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-4.95107650881807e-12,-5.2549435475113e-13,8.06220187974832e-10) (-7.70568807621313e-12,-1.06804434717836e-12,8.05912325207539e-10) (-1.01317361249686e-11,-2.52832450647569e-12,8.06792553266457e-10) (-1.37401408246819e-11,-5.61479460614539e-12,8.09525013540346e-10) (-1.59726599050579e-11,-1.88159469949663e-11,8.15289162937706e-10) (-1.2247557664628e-11,-7.47628819678788e-11,8.24959090682448e-10) (-4.98362143235127e-12,-2.5731826180857e-10,8.17845296771162e-10) (8.37127075595244e-13,-3.78628400140778e-10,6.84411976768756e-10) (4.53118357605558e-12,-4.91270306567914e-10,4.95662525783826e-10) (6.36058601109746e-12,-5.98060900888642e-10,2.65837435722405e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-4.77396432756237e-12,-1.89605035679673e-13,9.69876377744212e-10) (-7.47572248809186e-12,-4.49940750426676e-13,9.69914862067628e-10) (-9.84818977841418e-12,-2.25892807917943e-12,9.70974278034675e-10) (-1.19528352006335e-11,-6.09660002729755e-12,9.70997075499675e-10) (-1.37811103840869e-11,-1.77284791948548e-11,9.67825795570148e-10) (-1.07457922798288e-11,-5.09514162045714e-11,9.5470334093461e-10) (-4.40078168889519e-12,-1.22270792606971e-10,9.09483154080855e-10) (-3.72365865200441e-13,-1.90644221383322e-10,7.88798619276081e-10) (1.77529113018061e-12,-2.62468679165429e-10,5.97514439357227e-10) (3.20049811074076e-12,-3.32749551565568e-10,3.33688962225193e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-7.81367851362965e-13,-2.74978372958076e-11,2.97207488245933e-11) (-8.9932418199351e-13,-5.81867413728061e-11,2.81307533495835e-11) (-6.67663261547609e-13,-9.70669130075124e-11,2.46809014558686e-11) (-1.12478958379603e-12,-1.46830021328735e-10,1.90243310026686e-11) (-4.58793201120333e-13,-2.11408721221898e-10,1.00685713366943e-11) (1.07410585924011e-12,-3.00780845783739e-10,-2.36831561060026e-12) (4.00247419486377e-12,-4.18309936579763e-10,-1.60831868430087e-11) (6.62256209580784e-12,-5.4958576775685e-10,-1.76692209569314e-11) (6.26479706039292e-12,-6.75778934210092e-10,-1.19143466445993e-11) (6.44410075950331e-12,-7.64015859333935e-10,-5.34314704772328e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-9.61409060472568e-13,-2.57017456206734e-11,6.4393751592514e-11) (-1.67014513366336e-12,-5.48008422643815e-11,6.18229478060654e-11) (-2.55891282858325e-12,-9.12416345660947e-11,5.49943861087857e-11) (-3.53286705422805e-12,-1.37749289434887e-10,4.26847526558952e-11) (-1.93486755133132e-12,-1.99476806043482e-10,2.21954243335147e-11) (2.64405322279853e-12,-2.88852187100929e-10,-9.31185818242697e-12) (1.04688509246734e-11,-4.18954170458196e-10,-5.16446861027573e-11) (1.66296522346101e-11,-5.57044031560571e-10,-4.90623424031199e-11) (1.53471204198111e-11,-6.83379162057461e-10,-2.8541911085971e-11) (1.43134845963933e-11,-7.69614784617407e-10,-1.17408985110483e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1.54697649243273e-12,-2.27523129897005e-11,1.09172112730631e-10) (-3.31161102869518e-12,-4.78340502369218e-11,1.04860142409364e-10) (-5.49238236788732e-12,-7.82794291766027e-11,9.49082762516093e-11) (-7.05030418725802e-12,-1.1678418320517e-10,7.69102391141516e-11) (-4.96858593054579e-12,-1.68594178365882e-10,4.47388103081966e-11) (4.97163138760352e-12,-2.50170525706718e-10,-1.52996139733874e-11) (1.92607401267693e-11,-4.29676358674252e-10,-1.57053485635073e-10) (3.47882115846743e-11,-5.82281597777935e-10,-1.18822716364568e-10) (2.7089878673749e-11,-7.02294884710092e-10,-5.18162984004554e-11) (2.25646665803315e-11,-7.82045387256577e-10,-1.72288012086997e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2.74660005882538e-12,-1.78613972347352e-11,1.658108304957e-10) (-5.53025137399996e-12,-3.72131610593652e-11,1.60495598846913e-10) (-9.18073270284089e-12,-5.92459195282695e-11,1.49099294410137e-10) (-1.27896087346393e-11,-8.42954028042208e-11,1.28592795141315e-10) (-1.13478615624692e-11,-1.0941323152629e-10,9.30525693710339e-11) (1.71362611193212e-11,-1.12575704345498e-10,3.98477260145314e-11) (3.03194664873309e-10,-4.98931008102796e-10,3.72580184638646e-17) (8.93104343867768e-11,-6.60105055748837e-10,-2.84290810705998e-10) (4.41775598054348e-11,-7.41019495518835e-10,-7.025221952277e-11) (3.01952330652324e-11,-8.00990809827109e-10,-1.42526296107637e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-3.50086548632923e-12,-1.2089050748473e-11,2.3475751118436e-10) (-7.98359213445578e-12,-2.51834406698634e-11,2.29431526431224e-10) (-1.36222707795895e-11,-3.80137044419257e-11,2.17927663685506e-10) (-2.20407311215682e-11,-4.8876168377023e-11,1.97647773195316e-10) (-3.43054086795655e-11,-5.52627874742636e-11,1.61001452532502e-10) (-4.91561258420435e-11,-4.96467264571776e-11,9.72707583875604e-11) (-2.52528011791062e-17,1.54210406098549e-16,-6.26124966875231e-18) (8.83426255162997e-11,-8.8433807988207e-10,1.26858843838819e-17) (4.70183807968054e-11,-8.01635973020217e-10,1.85974317593852e-11) (3.20793659883021e-11,-8.1786683573308e-10,1.84229027706435e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-3.56438112702264e-12,-6.681026557545e-12,3.19548572890903e-10) (-9.08633945992779e-12,-1.33741188411239e-11,3.15273728334229e-10) (-1.74607935864276e-11,-1.75882918158895e-11,3.06153476995875e-10) (-3.12793766417405e-11,-1.4404696965653e-11,2.89641836785857e-10) (-5.97768633871957e-11,6.01625989550284e-13,2.56465252877543e-10) (-1.1753740142424e-10,3.02313539091475e-11,1.80662168192698e-10) (-4.30915101120637e-19,1.16785025344772e-16,-1.14573482809092e-17) (8.9083946075563e-11,-8.82432421145594e-10,-5.69059259681347e-17) (4.15274757896523e-11,-7.99060396927643e-10,9.99568429736143e-11) (2.78996868267719e-11,-7.99919671094061e-10,6.25718531940016e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-4.04927788280607e-12,-2.36998926206697e-12,4.21453020397998e-10) (-9.74012060455615e-12,-4.10535086986238e-12,4.18718992518514e-10) (-1.88103425640065e-11,-1.59558487692041e-12,4.14180949869694e-10) (-3.6074901726456e-11,1.4661533914906e-11,4.07165891575513e-10) (-8.94728392017302e-11,6.00262509960017e-11,3.935620481e-10) (-3.19085235392574e-10,1.5920973412917e-10,3.41539042856024e-10) (1.97980507165928e-17,1.6074122862416e-16,-1.98611754165492e-16) (2.65009477983445e-11,-9.54689492031444e-10,6.00776448067051e-10) (2.09249448619557e-11,-7.55082163908488e-10,2.88806717754907e-10) (1.78504855595639e-11,-7.35199402593905e-10,1.28787437696097e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-5.0783181959587e-12,-1.39223016628768e-13,5.37895643682839e-10) (-9.827607001055e-12,2.31327798763988e-13,5.3703694413012e-10) (-1.64456791627936e-11,4.651962075643e-12,5.3669637111153e-10) (-2.7545052845326e-11,2.3552445996834e-11,5.39553114234784e-10) (-4.77954306645364e-11,8.32198894170636e-11,5.56441157385146e-10) (-7.32527032581285e-11,3.00855540609902e-10,6.31365674503496e-10) (6.48480856631235e-13,-6.00776473477754e-10,9.7677751318043e-10) (7.80624469304812e-12,-5.94947084863593e-10,6.05107845486215e-10) (1.0361346891439e-11,-5.84320381295912e-10,3.59407669057258e-10) (1.06431776018281e-11,-6.02684754890332e-10,1.71942195548991e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-4.97910306055361e-12,-1.96004454173418e-13,6.54226638926975e-10) (-9.20401973196482e-12,4.36098617467321e-13,6.54136429971709e-10) (-1.31335928260746e-11,2.04672281747689e-12,6.54928674749606e-10) (-1.90224848009367e-11,7.17196820868513e-12,6.58377978351514e-10) (-2.67300554499097e-11,1.36183635025497e-11,6.67924735739866e-10) (-2.89452295165748e-11,-5.86223999217564e-12,6.91874410510044e-10) (-6.59777063160552e-12,-2.55865432075013e-10,7.27263153162444e-10) (1.60239930308846e-12,-3.45754839534013e-10,5.78373108951581e-10) (5.55464623494661e-12,-3.93941191942504e-10,3.95836260083174e-10) (6.88667241044712e-12,-4.28881380472748e-10,2.02536082637115e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-5.00205368665788e-12,-1.78053489622505e-13,7.36076695272375e-10) (-8.98507920556544e-12,2.48367786904083e-13,7.3629408013346e-10) (-1.21299153225945e-11,-2.63999165077545e-13,7.37490369277554e-10) (-1.48781552984042e-11,-1.24904530467087e-12,7.38783149631259e-10) (-1.83871349434054e-11,-6.87209432093858e-12,7.38893642961975e-10) (-1.64770216306463e-11,-3.26367406140869e-11,7.33467401132981e-10) (-5.98703949109152e-12,-1.10818597493499e-10,7.027032668801e-10) (2.67592670340831e-13,-1.63546096452034e-10,5.90857366290473e-10) (3.13208909680009e-12,-2.00147115120161e-10,4.26398893100084e-10) (4.13990877034688e-12,-2.25396208654543e-10,2.25608382074431e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-9.87464051486664e-13,-2.93136971994866e-11,3.08077582842058e-11) (-8.35371396694673e-13,-6.10939143438995e-11,2.91618297935115e-11) (-8.36371249779188e-13,-9.88598518845637e-11,2.554875083163e-11) (-1.24976181163524e-12,-1.44787206650854e-10,1.95116999317913e-11) (4.61785677325067e-14,-2.02748998369255e-10,1.00735784521888e-11) (2.86031840882013e-12,-2.79977323817197e-10,-2.59970176072607e-12) (6.23274218728251e-12,-3.76215625973678e-10,-1.61799381464553e-11) (8.32595158706213e-12,-4.7561382689157e-10,-1.88931821129408e-11) (7.29382531097779e-12,-5.61373551351571e-10,-1.34662519408162e-11) (6.69987899512901e-12,-6.15125436221502e-10,-6.39707394829394e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1.34003790498086e-12,-2.77045574321456e-11,6.63048827724026e-11) (-1.80837546387847e-12,-5.73286373702345e-11,6.31476121118812e-11) (-3.21148476515876e-12,-9.23196704108781e-11,5.61189925577405e-11) (-4.00864496157403e-12,-1.35044926870725e-10,4.33110589477298e-11) (-1.31021271300994e-12,-1.89667926277569e-10,2.22779065387605e-11) (6.2952197489442e-12,-2.65965883389165e-10,-9.4326683067299e-12) (1.86086954410559e-11,-3.72893046302852e-10,-5.09644156462614e-11) (2.13467871348831e-11,-4.80134260045334e-10,-5.16580014234399e-11) (1.74618304974285e-11,-5.67543383596381e-10,-3.14774758934663e-11) (1.5003188724385e-11,-6.20239340053163e-10,-1.3456770674706e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2.1259219261136e-12,-2.4259696085944e-11,1.11252858290571e-10) (-3.98063404848172e-12,-4.9654536911003e-11,1.06299787618203e-10) (-6.52785487876615e-12,-7.87102814594854e-11,9.61027474168615e-11) (-7.36765578226572e-12,-1.13639355201214e-10,7.74573906788012e-11) (-4.11110848858755e-12,-1.57357198777588e-10,4.49941718304261e-11) (9.13068168803651e-12,-2.23017220041234e-10,-1.33045202375127e-11) (5.02846202848351e-11,-3.69228843568459e-10,-1.44353187436535e-10) (4.56052515913737e-11,-4.96862455175159e-10,-1.22558098425763e-10) (3.12269922907572e-11,-5.82584802750792e-10,-5.73502901272809e-11) (2.42812879419704e-11,-6.30662019901469e-10,-2.02567682629e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-3.2037148962642e-12,-1.92460070659023e-11,1.65349128639887e-10) (-6.16366732675042e-12,-3.90020097823195e-11,1.5933934421834e-10) (-9.90644852030428e-12,-5.96687022570163e-11,1.46955849721686e-10) (-1.26686173915601e-11,-8.13102809165125e-11,1.25458366900261e-10) (-1.22934622579731e-11,-9.86688865837123e-11,9.04694508702882e-11) (-5.94502801248205e-12,-8.86978883772514e-11,4.14187411653662e-11) (8.85543505241248e-11,-3.82748993940704e-10,2.10547910538548e-17) (9.95048673367534e-11,-5.53362902359188e-10,-2.81916814381682e-10) (4.87944473948662e-11,-6.13856765236004e-10,-7.86097636978577e-11) (3.28186293604497e-11,-6.46403617694377e-10,-1.89250856735917e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-3.58290492414195e-12,-1.35539569212351e-11,2.28618366996818e-10) (-8.28905121747633e-12,-2.6835362197182e-11,2.22617636521855e-10) (-1.37677929153917e-11,-3.85622985857211e-11,2.09557561398712e-10) (-1.98658818701342e-11,-4.79206980306883e-11,1.87117293971237e-10) (-2.64391279984804e-11,-5.18430426514644e-11,1.4897586646414e-10) (-3.17634415595603e-11,-4.58648057237488e-11,8.72985613796439e-11) (-6.77455447796172e-18,7.76959911513301e-17,-5.86785909584762e-18) (6.78395477063254e-11,-7.39565950911971e-10,1.46465419052094e-17) (4.46173336929514e-11,-6.63677808163774e-10,7.75295973273357e-12) (3.25551041198635e-11,-6.59344420112002e-10,1.18296735746948e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-3.60057386583052e-12,-7.87248503696886e-12,3.01209768698818e-10) (-9.23485609284885e-12,-1.46820725252841e-11,2.96248713480847e-10) (-1.69418603153404e-11,-1.82406288670315e-11,2.85104672713696e-10) (-2.71690236140545e-11,-1.51639476024987e-11,2.64921761194954e-10) (-4.33984037088189e-11,-2.20687383374595e-12,2.26786161801543e-10) (-6.58536019941915e-11,2.02717976849645e-11,1.49736752303287e-10) (1.06145930671801e-18,4.59776792559188e-17,-9.72805940533383e-18) (6.13841170818756e-11,-7.18696077825746e-10,-4.20369006559209e-17) (3.49342325501363e-11,-6.55343413779486e-10,7.97442778050808e-11) (2.57512715207086e-11,-6.40966206126001e-10,5.14133222826384e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-3.54601624877319e-12,-3.11552065684709e-12,3.80740083525093e-10) (-9.53875662429443e-12,-4.86273174422389e-12,3.77216519807164e-10) (-1.80428312224076e-11,-2.0055622189666e-12,3.69987652246517e-10) (-3.13619703328931e-11,1.30169270560266e-11,3.57671871908463e-10) (-6.06434723787908e-11,5.05006548599799e-11,3.32945373363577e-10) (-1.19191800405573e-10,1.20324111395517e-10,2.62423564379964e-10) (7.3382299553847e-18,7.40119948762121e-17,-9.95491446365621e-17) (-2.12717290573475e-11,-7.68683258315948e-10,4.99920187447885e-10) (1.01824423081471e-11,-6.14482443652596e-10,2.42966972055766e-10) (1.41232755520995e-11,-5.82790129924355e-10,1.08725662801729e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-4.16283720569595e-12,-2.01946497623296e-13,4.63693236793053e-10) (-9.69180480117562e-12,4.64686564888316e-13,4.62169135736222e-10) (-1.66971830279426e-11,5.43180926336724e-12,4.59537253750926e-10) (-2.80526182075081e-11,2.5750019291893e-11,4.58184594324712e-10) (-5.31184218683783e-11,8.8779225903958e-11,4.66699590440488e-10) (-1.1194676133289e-10,3.02588339274537e-10,5.22714852172216e-10) (2.74071071480813e-11,-4.99920209779348e-10,8.17629525084991e-10) (4.31417579237726e-12,-4.94338324483678e-10,5.07346157135741e-10) (7.44763104637984e-12,-4.72470924066529e-10,2.98808085429713e-10) (8.78199873324179e-12,-4.69390571115979e-10,1.41458664138133e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-4.90684506982916e-12,-3.23164944329733e-14,5.39166247106741e-10) (-9.8085336792481e-12,1.05321857734209e-12,5.3841504576618e-10) (-1.42721744455084e-11,3.26781321168363e-12,5.3755631684526e-10) (-2.01482286759511e-11,1.00775416539474e-11,5.38423235387471e-10) (-3.0189272396615e-11,2.15505365455761e-11,5.44297356155625e-10) (-3.75594715471072e-11,1.29731637906977e-11,5.62950232012844e-10) (-2.75456100221897e-12,-2.12888028356147e-10,5.9431283989026e-10) (1.93050508953097e-12,-2.86025481420711e-10,4.67463076016007e-10) (5.06074685862878e-12,-3.12821187065669e-10,3.13953154358903e-10) (5.93758322944561e-12,-3.25762345016152e-10,1.57748227308725e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-5.39749203736602e-12,-2.22083443119604e-13,5.86015835133201e-10) (-9.93300056275633e-12,5.44327069791257e-13,5.85320197621891e-10) (-1.36866948413761e-11,7.04722999046659e-13,5.85129244981644e-10) (-1.62376939337903e-11,6.04499057750756e-13,5.8510269975256e-10) (-1.98329874353493e-11,-2.6747082400056e-12,5.8392681719248e-10) (-1.83496279918528e-11,-2.29195786329789e-11,5.78125790716519e-10) (-4.95973639496288e-12,-9.20542057660819e-11,5.51823574229196e-10) (1.17996940869616e-12,-1.33736858092216e-10,4.56796728429144e-10) (3.77548500227615e-12,-1.55932915793781e-10,3.22397290493712e-10) (4.35208219020963e-12,-1.66874554141009e-10,1.6672639353282e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-9.50675328063667e-13,-3.09534397922417e-11,3.16627661516841e-11) (-9.87569408513427e-13,-6.27850493478516e-11,2.99218153813134e-11) (-1.33950182360087e-12,-9.87660213479845e-11,2.62967447515253e-11) (-1.55392011216551e-12,-1.41193452706009e-10,2.05029199049701e-11) (-3.6161331106903e-13,-1.93480388312961e-10,1.16892958245353e-11) (2.42911436651626e-12,-2.59391456834367e-10,3.88486701419274e-13) (5.62340648296361e-12,-3.36810841838135e-10,-1.0988387145766e-11) (7.41945456863285e-12,-4.13561625998178e-10,-1.41091882354701e-11) (6.39447956324884e-12,-4.75890972718214e-10,-1.04651968931182e-11) (5.41670887853127e-12,-5.12765754021554e-10,-5.26571144487613e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1.62762859066327e-12,-2.9395718558741e-11,6.76530515513243e-11) (-2.45385636900273e-12,-5.92425120716887e-11,6.41160709781774e-11) (-4.01294010651947e-12,-9.28485583686202e-11,5.68745245912815e-11) (-4.38106422210251e-12,-1.32288725482671e-10,4.45529234069727e-11) (-1.91036536753494e-12,-1.81489417747254e-10,2.54849114417656e-11) (4.87830374053381e-12,-2.46215202770932e-10,-1.50389011928596e-12) (1.56380784838285e-11,-3.30639292379405e-10,-3.37900277877585e-11) (1.78944567347128e-11,-4.14224194708184e-10,-3.75795291141811e-11) (1.44825444331616e-11,-4.78726507617678e-10,-2.39525429599274e-11) (1.19690978978795e-11,-5.1526138952237e-10,-1.07331815221932e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2.18654027376911e-12,-2.5732532846297e-11,1.11191691186573e-10) (-4.43612097582381e-12,-5.17968523360538e-11,1.06088733388903e-10) (-6.92407734319841e-12,-8.04531726325131e-11,9.56686028404526e-11) (-7.23351121860949e-12,-1.13404806787509e-10,7.76603660895728e-11) (-4.50072861446388e-12,-1.53445159374877e-10,4.85684937368736e-11) (5.86001722305287e-12,-2.08844233311492e-10,1.28203724256978e-12) (4.20096816462926e-11,-3.14352853587091e-10,-8.9766900848193e-11) (3.68978904769169e-11,-4.18109942655156e-10,-8.53118047858761e-11) (2.54054329116875e-11,-4.85526658655954e-10,-4.19096402017119e-11) (1.97661174719387e-11,-5.20264628367518e-10,-1.52057719566386e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2.88598061939331e-12,-2.07656253359644e-11,1.6111798580395e-10) (-5.94682041519634e-12,-4.16970046630938e-11,1.55154297924501e-10) (-9.51536937022396e-12,-6.30565338331895e-11,1.42401259472447e-10) (-1.10692842473649e-11,-8.50827176475843e-11,1.21071647804721e-10) (-1.00685964853495e-11,-1.0473378267929e-10,8.86070662539941e-11) (-7.35939055541675e-12,-1.06485133942021e-10,4.40942097642437e-11) (-1.2277885676099e-11,-2.68941392785189e-10,5.2274045697615e-12) (8.24008652057036e-11,-4.33807857315728e-10,-1.8983335444858e-10) (3.89308122983366e-11,-4.99107260132902e-10,-5.33990131931998e-11) (2.68343461044358e-11,-5.27078630460804e-10,-1.25731976691895e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-3.26364633345133e-12,-1.54452374713012e-11,2.17914625664363e-10) (-7.3822657662214e-12,-3.01949170895284e-11,2.11759513829866e-10) (-1.16491952065854e-11,-4.35927742221027e-11,1.9831022509196e-10) (-1.44812047912475e-11,-5.50328389501474e-11,1.76122888856695e-10) (-1.43979917316902e-11,-6.14671137571725e-11,1.4108431663946e-10) (-1.06014777207299e-11,-5.83263153627926e-11,8.64109169654391e-11) (4.42935641639273e-18,7.86867734928108e-17,-2.14982668101802e-17) (3.92167295339149e-11,-4.92842708624832e-10,1.44043219838227e-11) (3.22062254667495e-11,-5.17018105602402e-10,1.414685749096e-11) (2.60065637087923e-11,-5.28596229299307e-10,1.23425061164167e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-3.39648302798637e-12,-9.92705590093284e-12,2.79033020469871e-10) (-7.91015610677467e-12,-1.86273558681619e-11,2.741215745961e-10) (-1.2994015444696e-11,-2.49945698948137e-11,2.62766709845542e-10) (-1.72142988791043e-11,-2.60747389371327e-11,2.42723432767006e-10) (-1.90565229043201e-11,-1.88201891490476e-11,2.07720659071442e-10) (-1.61691536734117e-11,-2.66177609512373e-12,1.41386848181662e-10) (5.33598493701083e-18,5.27915875459331e-17,-2.86999573890355e-17) (3.16269777300938e-11,-4.61714271917638e-10,5.70474513464777e-11) (2.24042179457368e-11,-4.98776318932344e-10,7.6045408362893e-11) (1.89885176015532e-11,-5.06426336430244e-10,4.45891779900886e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2.93602669006284e-12,-5.2143094854574e-12,3.41668579527987e-10) (-7.63730737276072e-12,-9.11586545560833e-12,3.38294708004095e-10) (-1.31644223666565e-11,-9.84033117624862e-12,3.30252443339803e-10) (-1.9368564023916e-11,-1.58739160917373e-12,3.16340087958513e-10) (-2.84002344391425e-11,2.23695199605734e-11,2.90855854585966e-10) (-3.9032364355484e-11,6.81198443056057e-11,2.27259061636128e-10) (4.13254006856348e-18,6.60275653755853e-17,-9.08298996662653e-17) (-3.86634474975403e-11,-4.47353913373933e-10,3.14255521830587e-10) (2.41223197608114e-12,-4.5471362298059e-10,1.8168836821732e-10) (9.44937954533573e-12,-4.53889513684147e-10,8.6043359399646e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2.80836615208827e-12,-2.11459569259812e-12,4.01530475111023e-10) (-7.64845482833852e-12,-3.36479299711217e-12,3.99898657682494e-10) (-1.31805275500186e-11,-1.72347483881184e-12,3.9537303230835e-10) (-2.08951366853437e-11,1.03772247795246e-11,3.89522942324177e-10) (-4.19049942417234e-11,4.86353111576845e-11,3.86159688168868e-10) (-1.17246258761844e-10,1.71805458556337e-10,3.95142646094874e-10) (5.06582936741768e-11,-3.03287783122346e-10,4.5999899657604e-10) (4.53940443545098e-12,-3.46298148457574e-10,3.55115683057446e-10) (5.14731533711914e-12,-3.60079819633839e-10,2.27339051779327e-10) (6.61243677145681e-12,-3.64858375400515e-10,1.10712446510658e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-3.96587678055922e-12,-1.25680141680006e-12,4.5375618436317e-10) (-8.44091325083574e-12,-1.34076505071872e-12,4.52243935129475e-10) (-1.25760027750641e-11,-8.6757429590743e-13,4.49149847541341e-10) (-1.65493068478956e-11,2.51731647796842e-12,4.4574749949587e-10) (-2.46169034682587e-11,7.80387710390722e-12,4.43661865469479e-10) (-3.30293370008448e-11,-3.8849605027119e-12,4.43316468636628e-10) (3.2613802818853e-12,-1.5501662844101e-10,4.36960711282602e-10) (3.15180341812455e-12,-2.16906386998222e-10,3.54968020483126e-10) (4.37740263689549e-12,-2.42445149820062e-10,2.42435403245941e-10) (4.79801966308361e-12,-2.52433835001264e-10,1.22324732465402e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-4.92393796917557e-12,-8.5931340124572e-13,4.84582211417827e-10) (-9.19772085271796e-12,-6.74339102469543e-13,4.82606319071602e-10) (-1.29554266132459e-11,-9.96270795927988e-13,4.79740690831502e-10) (-1.44573123159588e-11,-1.64712526586164e-12,4.7585181545801e-10) (-1.67066691993948e-11,-5.31020057499978e-12,4.70145081947387e-10) (-1.49669901375089e-11,-2.18855284113805e-11,4.58266291423416e-10) (-1.98709636099176e-12,-7.19700746382961e-11,4.28051733515098e-10) (1.84254925191635e-12,-1.04455797445211e-10,3.53144897383751e-10) (3.51346616938279e-12,-1.2139162711795e-10,2.48200884080295e-10) (4.20392158201033e-12,-1.28695958550043e-10,1.27588797853011e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-7.6744579110573e-13,-3.14586340274666e-11,3.31080328010398e-11) (-9.05036054948409e-13,-6.34723326071267e-11,3.12784626479791e-11) (-1.46313995638723e-12,-9.8363737224341e-11,2.75489772053977e-11) (-1.64502325506284e-12,-1.37550478379488e-10,2.19050323257668e-11) (-1.05177475367453e-12,-1.84816185553047e-10,1.4399681063505e-11) (6.29734150287354e-13,-2.42050787285472e-10,5.39844034843455e-12) (2.57265811391457e-12,-3.0587137643296e-10,-3.399206667664e-12) (4.43803193638588e-12,-3.66538017408962e-10,-6.72461070574867e-12) (4.0305290144326e-12,-4.14212326979443e-10,-5.20934565118121e-12) (2.64663293450797e-12,-4.40641237900257e-10,-2.70636588511733e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1.75383372995638e-12,-3.01327746504776e-11,6.97510093310148e-11) (-2.65796971772964e-12,-6.06431115531589e-11,6.59790606339696e-11) (-4.08672465831499e-12,-9.36807321469605e-11,5.85173297989105e-11) (-4.196970952076e-12,-1.30567480156176e-10,4.68773963148825e-11) (-2.96582217883624e-12,-1.75746039716813e-10,3.11179410981404e-11) (-2.06528050447806e-13,-2.32611382348382e-10,1.08203095094873e-11) (3.14114101793074e-12,-3.00936791762906e-10,-1.070288302679e-11) (8.15321852744272e-12,-3.65506780731134e-10,-1.63949563476226e-11) (8.06333403375951e-12,-4.1450333973361e-10,-1.10023633019769e-11) (6.23915522077451e-12,-4.41138258735297e-10,-5.07262962314946e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2.05048998644335e-12,-2.67921654067722e-11,1.11364119453024e-10) (-4.11583810031731e-12,-5.39774421991732e-11,1.06105814355474e-10) (-6.31247939163426e-12,-8.33187572036001e-11,9.56653654708974e-11) (-6.46372800580686e-12,-1.15928887260611e-10,7.91271013665564e-11) (-5.92564881579239e-12,-1.55897218175395e-10,5.51794205177051e-11) (-5.45014405567e-12,-2.10178730377617e-10,2.06874481592873e-11) (-7.85687521790678e-12,-2.921444509154e-10,-2.58700198458224e-11) (9.19364055336605e-12,-3.65610469015741e-10,-3.0005061013017e-11) (1.22821661434753e-11,-4.16131932040303e-10,-1.59674828412394e-11) (1.13743476084843e-11,-4.42163769751391e-10,-5.68348534568744e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2.24268060461171e-12,-2.18251221325622e-11,1.56738736412012e-10) (-4.69586953671421e-12,-4.43462827357309e-11,1.51060089571266e-10) (-7.64951731359191e-12,-6.83802797654585e-11,1.3897022988036e-10) (-8.65458139411245e-12,-9.36102928370423e-11,1.19249953386319e-10) (-8.8224089176786e-12,-1.22635928870317e-10,9.02395594766319e-11) (-1.66514039401574e-11,-1.64398955270529e-10,4.45276367475185e-11) (-8.61585981296398e-11,-2.90232974701571e-10,-5.8424320448491e-11) (5.00137525938314e-12,-3.72229743588209e-10,-3.84201960932549e-11) (1.60158422438744e-11,-4.19656433831956e-10,-1.08613448182294e-11) (1.57787472737615e-11,-4.4210038255965e-10,-5.4409471140423e-13) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2.62671606930444e-12,-1.68515571484226e-11,2.07512744373456e-10) (-5.50053824968742e-12,-3.36103476941524e-11,2.0145552364127e-10) (-8.06006329860998e-12,-5.12027002599519e-11,1.8910112467468e-10) (-8.40073258704286e-12,-6.74898590876741e-11,1.69423593094978e-10) (-2.3715166657885e-12,-7.96569074713066e-11,1.41535767085656e-10) (2.01449214753085e-11,-6.96754136414146e-11,1.06828122053551e-10) (-1.44043131575475e-11,-3.77425919709573e-10,8.19338100136641e-11) (8.34575731959441e-12,-3.94111814194992e-10,4.33268588763272e-11) (1.57687901711587e-11,-4.20564058562394e-10,3.03379159187282e-11) (1.61791769561359e-11,-4.34752239193e-10,1.72219595688414e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-3.19778356974964e-12,-1.18215397596366e-11,2.598456541049e-10) (-6.06678176873717e-12,-2.32069988534523e-11,2.54541162378655e-10) (-8.10497708470529e-12,-3.47739398486114e-11,2.44014968353463e-10) (-6.69887251150825e-12,-4.29275801296732e-11,2.26922232536299e-10) (6.08757887584534e-12,-4.44891393237146e-11,2.03194757868342e-10) (5.44361028074884e-11,-2.59547929753316e-11,1.77405610544733e-10) (-5.70474879464278e-11,-3.46092013369571e-10,1.69503226831188e-10) (-1.73133783007442e-12,-3.74067585137446e-10,1.16212021740354e-10) (9.79775236687159e-12,-3.98524472621714e-10,8.07335412986944e-11) (1.10408728455691e-11,-4.09459454623432e-10,4.18777870694482e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2.66186895898352e-12,-7.51282474437078e-12,3.11827525166201e-10) (-5.3461151670693e-12,-1.47184518776088e-11,3.07881859313486e-10) (-7.36892332270031e-12,-2.11688346953258e-11,2.99739750162854e-10) (-5.84894704013413e-12,-2.2696046150459e-11,2.87060277690332e-10) (8.93076731361618e-12,-1.51978989445358e-11,2.7274390256408e-10) (8.45411738598024e-11,2.51158412878249e-11,2.7208777790998e-10) (-1.09677593779741e-11,-3.40782249892156e-10,3.85381740683815e-10) (-7.15205880058866e-12,-3.39872252292959e-10,2.33821317121292e-10) (3.42343744695005e-12,-3.54651598166676e-10,1.43548985036156e-10) (6.46160066127021e-12,-3.61914991653671e-10,6.98696948583197e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2.03434299931836e-12,-4.47643910485682e-12,3.57950705352356e-10) (-5.14685740069199e-12,-8.77437484687545e-12,3.55521889318135e-10) (-8.18633810870619e-12,-1.21811456957215e-11,3.49590553785681e-10) (-9.67197422847409e-12,-1.21523432851026e-11,3.40771453313115e-10) (-1.00565181139632e-11,-1.03701866138054e-11,3.3274626335916e-10) (-6.41219018404295e-12,-2.19140342292412e-11,3.30582157411499e-10) (7.27045251142999e-12,-2.00585023584083e-10,3.40762575942443e-10) (2.92427425421896e-12,-2.56826899327001e-10,2.65776792588224e-10) (4.13925079204968e-12,-2.80771627353104e-10,1.76687202300606e-10) (4.90034288289703e-12,-2.89661946583001e-10,8.79050944775014e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2.85111556235606e-12,-2.58260350229707e-12,3.9528084243583e-10) (-6.01325161095937e-12,-4.82036571318499e-12,3.93156647661744e-10) (-9.04495822958372e-12,-7.19203804721684e-12,3.88414877430976e-10) (-1.02992310776573e-11,-9.57965492592218e-12,3.81112076333502e-10) (-1.11574289565198e-11,-1.63313815215867e-11,3.72625102926175e-10) (-8.67301173810067e-12,-4.14313437179579e-11,3.6119008134436e-10) (2.20751727870493e-12,-1.21546943085112e-10,3.38925851113042e-10) (3.23383110231856e-12,-1.67664745606957e-10,2.75953610341097e-10) (3.43455071532362e-12,-1.9114377016059e-10,1.9100786782611e-10) (3.38487567727654e-12,-2.0038056344022e-10,9.70871713698664e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-3.80735902419663e-12,-1.48387848126906e-12,4.17140269316151e-10) (-7.00643171508709e-12,-2.46095239521103e-12,4.1438360604586e-10) (-1.00628220356831e-11,-3.82008708431087e-12,4.09384395232035e-10) (-1.0397704071196e-11,-5.96441205728634e-12,4.01583960369414e-10) (-1.01380792504258e-11,-1.19130405569218e-11,3.91259733062006e-10) (-6.63796064057734e-12,-2.74479183646037e-11,3.74032881701539e-10) (9.49665132055085e-13,-5.91653121581376e-11,3.41120305445337e-10) (2.33076511014718e-12,-8.25630530946588e-11,2.80178825295769e-10) (2.73392527870334e-12,-9.63714367616167e-11,1.97303680258857e-10) (3.0967608849612e-12,-1.02276484556736e-10,1.01281658474399e-10) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2.63735015029118e-13,-3.18593748414796e-11,3.28602226725826e-11) (-4.77166632728668e-15,-6.36938416064138e-11,3.12888152676438e-11) (-5.02200154161193e-13,-9.82623008572772e-11,2.83101927205885e-11) (-1.12267021609658e-12,-1.35702421912398e-10,2.3540648486021e-11) (-1.12067987483257e-12,-1.79566830249999e-10,1.72582120792274e-11) (-1.20237706724652e-14,-2.30880188283586e-10,9.92327509342231e-12) (9.6347748189139e-13,-2.84626608758257e-10,3.29260258435699e-12) (1.8915302039496e-12,-3.35318051772981e-10,-3.14244797066234e-14) (1.81856200251776e-12,-3.74646977588071e-10,-4.98096282454892e-13) (4.3728788445184e-13,-3.94882796389709e-10,-2.89565909091129e-13) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1.32249427662397e-12,-3.03949608753919e-11,6.9972199219846e-11) (-1.86190823667572e-12,-6.09187053320201e-11,6.6408308435017e-11) (-2.80876611761857e-12,-9.39403871872756e-11,5.97435412778056e-11) (-3.07610863089066e-12,-1.29967096716416e-10,4.9558291289408e-11) (-2.5170121316022e-12,-1.72756588564459e-10,3.66434912318873e-11) (-1.11598748495455e-12,-2.242949086155e-10,2.14118479949102e-11) (4.08734913000867e-14,-2.80769801863281e-10,6.87510354273083e-12) (2.8643137664047e-12,-3.33476614559439e-10,7.06958045581986e-14) (3.76219266164869e-12,-3.73490311414518e-10,-5.1836155586708e-13) (2.19203661377643e-12,-3.94270716152516e-10,-1.40382276034258e-13) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1.75922816310768e-12,-2.75885393099297e-11,1.10241755168128e-10) (-3.30654867918371e-12,-5.54140437283315e-11,1.05147426019517e-10) (-4.71269272542697e-12,-8.53301767955216e-11,9.53335915071539e-11) (-4.83464158053043e-12,-1.18517032942673e-10,8.08676037931124e-11) (-4.69496576243521e-12,-1.5877886714484e-10,6.1971421516148e-11) (-4.67245115758971e-12,-2.10486116494974e-10,3.85118080971266e-11) (-5.63331026461922e-12,-2.73908917966871e-10,1.36393714239767e-11) (1.77533695402154e-12,-3.30822147372917e-10,3.45744021732349e-12) (5.52267043949729e-12,-3.71558340552168e-10,2.28359789746022e-12) (5.62747507106076e-12,-3.92516568192001e-10,1.89995640829471e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1.53759874804578e-12,-2.34575054553917e-11,1.52682210770227e-10) (-3.34194488735801e-12,-4.7339955389546e-11,1.47325221897232e-10) (-5.10682032503742e-12,-7.31667855006485e-11,1.36226074533997e-10) (-5.76462123379631e-12,-1.01688431127663e-10,1.19193826801299e-10) (-6.08950758757639e-12,-1.37429865563709e-10,9.63557398823916e-11) (-8.4229883732467e-12,-1.88243799739017e-10,6.6744612134776e-11) (-1.89697774768933e-11,-2.67429128418098e-10,2.98353085427328e-11) (-6.75405408875336e-13,-3.28246102694776e-10,1.71837731235306e-11) (6.60621686742142e-12,-3.67957982763013e-10,1.33704430426207e-11) (7.88650919571589e-12,-3.87271356348844e-10,8.00847392371787e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1.59951272593923e-12,-1.89150821689451e-11,1.9945853522457e-10) (-3.54948812378979e-12,-3.78026532016022e-11,1.93476499864458e-10) (-4.81129213024605e-12,-5.87315505046231e-11,1.82012252470841e-10) (-5.07518553575947e-12,-8.17119757191313e-11,1.64813031913318e-10) (-2.83163978123791e-12,-1.10807598965084e-10,1.42142609091794e-10) (1.31861284913515e-12,-1.56403022561141e-10,1.15136401925044e-10) (-7.13126836028372e-12,-2.69037232701211e-10,8.78418356373103e-11) (1.29047121971785e-12,-3.24514712106864e-10,6.11433094392635e-11) (6.84516058056e-12,-3.58308531425802e-10,4.09641264525368e-11) (8.10835195539645e-12,-3.74251049644592e-10,2.12657913466758e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2.20200685872672e-12,-1.39828692174589e-11,2.46533315927392e-10) (-4.02913471936142e-12,-2.81070005607731e-11,2.40492359256492e-10) (-4.61734642086403e-12,-4.41826968927726e-11,2.30138472833136e-10) (-3.20293182274052e-12,-6.16643736593862e-11,2.15142644576321e-10) (2.58548582029085e-12,-8.45391741867391e-11,1.95817362199103e-10) (1.12678522578974e-11,-1.26387581696694e-10,1.74469585161777e-10) (-9.06604633303681e-12,-2.46499943225682e-10,1.53551021518533e-10) (-4.48190233093543e-13,-3.02724132449449e-10,1.15373912962421e-10) (4.7806321410716e-12,-3.33901754173161e-10,7.76343772041622e-11) (5.37419694530126e-12,-3.47656465325681e-10,3.95847227419269e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1.75258874579806e-12,-9.32229770672247e-12,2.90802857047924e-10) (-3.14808304719805e-12,-1.96757707572168e-11,2.86300482053811e-10) (-3.67713984977874e-12,-3.16115404577465e-11,2.78123859145832e-10) (-2.07627477921833e-12,-4.40755358987444e-11,2.65629191621838e-10) (4.75917963700704e-12,-6.09860163926758e-11,2.50930048175664e-10) (1.82770866030309e-11,-9.60972707268682e-11,2.38893864195889e-10) (3.95437876537914e-13,-2.15516720465126e-10,2.35414601999241e-10) (7.49203186825846e-14,-2.65157090302873e-10,1.77603300531501e-10) (3.22275681123079e-12,-2.92666079736136e-10,1.17726774759032e-10) (4.07825044890914e-12,-3.04497431030077e-10,5.91444786627745e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1.49936256764147e-12,-5.85173363346315e-12,3.28429301678942e-10) (-3.16953100197697e-12,-1.30128393993529e-11,3.2553585303754e-10) (-4.35634528458094e-12,-2.11339472446579e-11,3.19246319875727e-10) (-4.21947263373066e-12,-3.05328215681268e-11,3.08682903868794e-10) (-1.93121725853331e-12,-4.56260759704014e-11,2.95676477391841e-10) (2.92470077383706e-12,-7.86864216169613e-11,2.81498807865623e-10) (3.2181553665818e-12,-1.58197885897948e-10,2.62729448192977e-10) (2.85171082176607e-12,-2.05787181305452e-10,2.10525345381008e-10) (3.29350142262532e-12,-2.32351640618018e-10,1.44414158025894e-10) (3.52405421762406e-12,-2.42892965892048e-10,7.32195479713854e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1.8256458093116e-12,-3.668181466243e-12,3.56840098537051e-10) (-3.63089469813189e-12,-8.22897007412271e-12,3.54144342395146e-10) (-5.11410809501517e-12,-1.31414675630747e-11,3.48302188229412e-10) (-5.42750053897082e-12,-2.01166578383957e-11,3.38732718929511e-10) (-4.14074833939375e-12,-3.30275953212779e-11,3.25522528795653e-10) (-3.92206860146182e-13,-5.89619522136271e-11,3.06955842286906e-10) (2.79812712370226e-12,-1.04562647636152e-10,2.78042766744267e-10) (3.07788110501783e-12,-1.38595257023373e-10,2.2667685324892e-10) (2.58291377263126e-12,-1.59623361358351e-10,1.58987177703859e-10) (2.36796816365369e-12,-1.67857698702713e-10,8.14427557358874e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-2.53457423517514e-12,-2.15586613044347e-12,3.73315144018212e-10) (-4.46817329647396e-12,-4.44663563112492e-12,3.69597257489258e-10) (-6.08247425737194e-12,-6.71388077942998e-12,3.62675250559396e-10) (-6.0378888210725e-12,-1.0253262379106e-11,3.52601767436794e-10) (-4.82426844688184e-12,-1.75390252075099e-11,3.3899231449068e-10) (-1.1733027489774e-12,-3.14529400119493e-11,3.18298148444406e-10) (2.72583312347945e-12,-5.22526203565882e-11,2.85315998960324e-10) (2.6428570523996e-12,-6.96478968108157e-11,2.33886424849148e-10) (2.38451030152551e-12,-8.10709962716821e-11,1.65210891159489e-10) (2.10193480260801e-12,-8.55155209759801e-11,8.4841769151253e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-1.56741576160274e-13,-3.19147961883667e-11,3.27656212550587e-11) (1.98714606319276e-13,-6.38539219125032e-11,3.10598562037058e-11) (-5.45695895668497e-14,-9.83024290457276e-11,2.83793934899716e-11) (-5.75559005287922e-13,-1.34485554375047e-10,2.41064402167994e-11) (-5.95984574595491e-13,-1.76227901662509e-10,1.85529382572383e-11) (3.33690703138435e-14,-2.24855684350288e-10,1.24040222778032e-11) (4.30697650967199e-13,-2.74526837932649e-10,7.08813669791579e-12) (5.16764793173495e-13,-3.19703732900663e-10,3.72126930646327e-12) (4.53365455596874e-13,-3.52402248604828e-10,1.81644816975559e-12) (-4.6435826184664e-13,-3.69044687288517e-10,7.74043482154446e-13) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-5.65025057266711e-13,-3.03657727131884e-11,6.90481096480756e-11) (-7.01802683130106e-13,-6.09747445924763e-11,6.59787965726063e-11) (-1.23372652093932e-12,-9.40840453621098e-11,6.04854865699629e-11) (-1.6113723471726e-12,-1.29507611420783e-10,5.14039737844187e-11) (-1.26309031424165e-12,-1.70674970257654e-10,3.98032165621809e-11) (-3.88035153298759e-13,-2.19506429700037e-10,2.72842207259317e-11) (-1.56026669543963e-14,-2.70729272890291e-10,1.62186324062147e-11) (7.98903940291924e-13,-3.17282146970751e-10,8.96677788649646e-12) (1.45224251946468e-12,-3.50906478461626e-10,4.728724928303e-12) (2.97506377220108e-13,-3.68735002068212e-10,2.47484923045933e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-7.95932868993622e-13,-2.78614846949773e-11,1.08221669581789e-10) (-1.56680250560953e-12,-5.61832372729444e-11,1.04006406628452e-10) (-2.41009630629358e-12,-8.62362590975208e-11,9.55775909236022e-11) (-2.76706111857392e-12,-1.19518226545714e-10,8.25683529367313e-11) (-2.58435392454904e-12,-1.59419064735641e-10,6.59141924875674e-11) (-2.0423312404167e-12,-2.08828876533626e-10,4.75102777475993e-11) (-1.93116860671926e-12,-2.63493021037536e-10,3.01073773727733e-11) (3.73134595715632e-13,-3.12245190072256e-10,1.84264158580887e-11) (2.30595413949052e-12,-3.47200360244315e-10,1.0791047191042e-11) (2.28221963620893e-12,-3.65962646460529e-10,5.76321931375896e-12) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-7.23033161478153e-13,-2.44421546106336e-11,1.50362379989026e-10) (-1.78009971209956e-12,-4.9321224073668e-11,1.45533117183494e-10) (-2.50980758832582e-12,-7.56371174169482e-11,1.35366407854541e-10) (-2.90298972343898e-12,-1.05631127215142e-10,1.20292213173227e-10) (-3.10064643856686e-12,-1.43599503920225e-10,1.00892656034593e-10) (-3.35446195907904e-12,-1.93468307399218e-10,7.78768546183588e-11) (-4.71013777446748e-12,-2.53743228129562e-10,5.35681047927956e-11) (-5.93465915939873e-13,-3.04236686809497e-10,3.60675733341293e-11) (2.31873464916456e-12,-3.39866578227536e-10,2.33409672428945e-11) (2.87467641523565e-12,-3.57917207510565e-10,1.20972089949527e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-5.49690317262071e-13,-2.03359249665881e-11,1.95492206046443e-10) (-1.780893370996e-12,-4.09346144568092e-11,1.90002570059363e-10) (-2.16092518461707e-12,-6.30727303240071e-11,1.78932743283247e-10) (-2.45236477400358e-12,-8.91345597999e-11,1.63287306173891e-10) (-2.09385739278219e-12,-1.23684348942538e-10,1.43447185934087e-10) (-1.40226172760839e-12,-1.72514019532782e-10,1.19474526457895e-10) (-2.97003163775538e-12,-2.40952834445378e-10,9.36525962544192e-11) (-3.2092545102603e-13,-2.92103546634145e-10,6.84019478950823e-11) (2.1367184338036e-12,-3.26304085330451e-10,4.57194398434709e-11) (2.77955898311884e-12,-3.42945322100386e-10,2.34433657449693e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-8.21621698561868e-13,-1.53959792967907e-11,2.40032790708564e-10) (-2.10647809954396e-12,-3.1645681051676e-11,2.34265914368326e-10) (-2.19267459909877e-12,-4.95882183993159e-11,2.23467215770656e-10) (-1.46648720615515e-12,-7.17468043340485e-11,2.09302280636435e-10) (3.80105063513325e-13,-1.01805546859134e-10,1.9168523671282e-10) (1.89610493124959e-12,-1.48094351056908e-10,1.70033181103961e-10) (-1.87216053732517e-12,-2.18672217723786e-10,1.44589160026914e-10) (-2.75696621422529e-13,-2.69741964033584e-10,1.11062872282422e-10) (1.59461216625875e-12,-3.01891292798112e-10,7.51153268055044e-11) (1.79988539157371e-12,-3.16722397372298e-10,3.83334037853065e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-7.20777824977232e-13,-1.04507246551106e-11,2.80146044092571e-10) (-1.63439149705511e-12,-2.29534605535537e-11,2.75813272913436e-10) (-1.66006553883453e-12,-3.76159578642052e-11,2.67186515877869e-10) (-9.19845663704547e-13,-5.55962476165949e-11,2.54402521268879e-10) (1.43542319450312e-12,-7.97733861867092e-11,2.38456027861563e-10) (4.3454996898429e-12,-1.20754225048665e-10,2.20225890178288e-10) (8.87904776974916e-13,-1.87018090516593e-10,1.97183345553501e-10) (5.81537093708925e-13,-2.34070115178102e-10,1.55295152904144e-10) (1.49061378936597e-12,-2.63514757611646e-10,1.05996356489505e-10) (1.61826397365458e-12,-2.76589108195411e-10,5.41888327972009e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-7.89466093430413e-13,-6.83873130091013e-12,3.13529888735979e-10) (-1.66386716540858e-12,-1.59610950150627e-11,3.10493385534797e-10) (-1.78540895923923e-12,-2.64920287940219e-11,3.03846595945862e-10) (-1.62920988650362e-12,-4.05695998729854e-11,2.92671539404584e-10) (-3.52028381427915e-13,-6.01078253089247e-11,2.76859353783596e-10) (1.96959104310901e-12,-9.33661807341084e-11,2.57110067184814e-10) (1.7870199168099e-12,-1.44241993090199e-10,2.30577106546864e-10) (1.7709738947803e-12,-1.84189781669761e-10,1.85870466252853e-10) (1.75983221748227e-12,-2.10216620129958e-10,1.29430951590244e-10) (1.70833499966173e-12,-2.20782011424565e-10,6.63978110193928e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-6.4220500317415e-13,-4.59169419314102e-12,3.3778809885782e-10) (-1.57107497541118e-12,-1.09781725915887e-11,3.34973260791323e-10) (-1.9722255787572e-12,-1.7102381211939e-11,3.28299865143002e-10) (-2.08070586441788e-12,-2.63866241385068e-11,3.17879579349772e-10) (-1.06263194439384e-12,-4.0710567091557e-11,3.02238825433513e-10) (1.01185648082325e-12,-6.48636290530468e-11,2.80683451028112e-10) (1.85401333948236e-12,-9.7748332879428e-11,2.49914004590679e-10) (1.82019643752759e-12,-1.25979293112348e-10,2.03437066723449e-10) (1.57497065392923e-12,-1.45423647341628e-10,1.43462157523699e-10) (1.46854617280933e-12,-1.52675865405508e-10,7.37933251503361e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (-9.72553836666341e-13,-2.41906112981002e-12,3.51270415504813e-10) (-1.99280199773903e-12,-5.87585191867888e-12,3.47878800538336e-10) (-2.72287191419766e-12,-8.65432099746792e-12,3.40010146621918e-10) (-2.68169825406486e-12,-1.28265760866703e-11,3.28632953710253e-10) (-1.66912760810337e-12,-2.0217824630564e-11,3.13124679369518e-10) (3.55906723137781e-13,-3.30823261347694e-11,2.9123772713085e-10) (1.90278687807315e-12,-4.9417381672732e-11,2.58511307719219e-10) (1.67049393124431e-12,-6.4184187475064e-11,2.1099671292456e-10) (1.68263603807784e-12,-7.41798443143322e-11,1.4848301938074e-10) (1.42818297787937e-12,-7.74139940823653e-11,7.59858111044859e-11) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) (0,0,0) ) ; boundaryField { fuel { type fixedValue; value uniform (0.1 0 0); } air { type fixedValue; value uniform (-0.1 0 0); } outlet { type zeroGradient; } frontAndBack { type empty; } } // ************************************************************************* //
2be74d9957ddaa3da1905f5c6177561008aea0fe
96b2ec27cc58dbe1491611f560f81d0d951710b5
/ABC164D.cpp
cc011913a252f9c1868f24b4865eb5a919a8cb86
[]
no_license
lake429c/AtCoder
68e9ffa2d23dca041301b53687ce9418d1df81b0
8db0dd90111cff3ff82000e56b3a10f5e78f3e48
refs/heads/master
2020-06-16T05:11:06.015144
2020-06-01T07:05:10
2020-06-01T07:05:10
195,487,567
0
0
null
null
null
null
UTF-8
C++
false
false
1,020
cpp
ABC164D.cpp
#include<bits/stdc++.h> using namespace std; using lint = long long int; using pint = pair<int, int>; using plint = pair<lint, lint>; struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_; #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((lint)(x).size()) #define POW2(n) (1LL << (n)) #define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++) #define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--) #define REP(i, n) FOR(i,0,n) #define IREP(i, n) IFOR(i,0,n) const lint mod=1e9+7; int main() { string s; cin >> s; map<int, set<int>> mods; mods[0].insert(-1); reverse(ALL(s)); lint num = 0; int keta = 1; REP(i,s.size()){ int x = s[i]-'0'; num = (num+x*keta)%2019; keta = keta*10%2019; //cout << num << endl; mods[num].insert(i); } lint sum = 0; for(auto p : mods){ sum += p.second.size()*(p.second.size()-1)/2; } cout << sum << "\n"; return 0; }
f235e85555b641fbf8a82692d591e4ad128632ce
d4ff5b85886d7dbd8fc2dd10334a553d5e0e7c5d
/src/core/lib/wg_pyscript/py_script_object.ipp
f150175ae5f544f4430ea755c9f1b652366d167e
[]
permissive
karajensen/wgtf
8737d41cd936e541554389a901c9fb0da4d3b9c4
740397bcfdbc02bc574231579d57d7c9cd5cc26d
refs/heads/master
2021-01-12T19:02:00.575154
2018-05-03T10:03:57
2018-05-03T10:03:57
127,282,403
1
0
BSD-3-Clause
2018-04-27T08:15:26
2018-03-29T11:32:36
C++
UTF-8
C++
false
false
6,698
ipp
py_script_object.ipp
// py_script_object.ipp /** * This method calls a method on a ScriptObject * * @param methodName The method to call * @param args The arguments to call the method with * @param errorHandler The type of error handling to use if this method * fails * @param allowNullMethod True if this method can not exist, false otherwise. * @return The resulting ScriptObject */ template <class ERROR_HANDLER> inline ScriptObject ScriptObject::callMethod( const char * methodName, const ScriptArgs & args, const ERROR_HANDLER & errorHandler, bool allowNullMethod /* = false */ ) const { PyErr_Clear(); ScriptObject method = this->getAttribute( methodName, ScriptErrorRetain() ); if (!method) { if (allowNullMethod) { Script::clearError(); } else { errorHandler.handleError(); } return ScriptObject(); } return method.callFunction( args, errorHandler ); } /** * This method calls a method on a ScriptObject * * @param methodName The method to call * @param errorHandler The type of error handling to use if this method * fails * @param allowNullMethod True if this method can not exist, false otherwise. * @return The resulting ScriptObject */ template <class ERROR_HANDLER> inline ScriptObject ScriptObject::callMethod( const char * methodName, const ERROR_HANDLER & errorHandler, bool allowNullMethod /* = false */ ) const { return this->callMethod( methodName, ScriptArgs::none(), errorHandler, allowNullMethod ); } /** * This method calls the ScriptObject function * * @param args The arguments to call the method with * @param kwargs The named arguments to call the method with * @param errorHandler The type of error handling to use if this method * fails * @return The resulting ScriptObject */ template <class ERROR_HANDLER> inline ScriptObject ScriptObject::callFunction( const ScriptArgs & args, const ScriptDict & kwargs, const ERROR_HANDLER & errorHandler ) const { PyObject * retval = NULL; if (!PyCallable_Check( this->get() )) { PyErr_Format( PyExc_TypeError, "Function is not callable" ); } else { const ScriptArgs & safeArgs = args ? args : ScriptArgs::none(); retval = PyObject_Call( this->get(), safeArgs.get(), kwargs.get() ); } errorHandler.checkPtrError( retval ); return ScriptObject( retval, ScriptObject::FROM_NEW_REFERENCE ); } /** * This method calls the ScriptObject function * * @param args The arguments to call the method with * @param errorHandler The type of error handling to use if this method * fails * @return The resulting ScriptObject */ template <class ERROR_HANDLER> inline ScriptObject ScriptObject::callFunction( const ScriptArgs & args, const ERROR_HANDLER & errorHandler ) const { return this->callFunction( args, ScriptDict(), errorHandler ); } /** * This method calls the ScriptObject function * * @param errorHandler The type of error handling to use if this method * fails * @return The resulting ScriptObject */ template <class ERROR_HANDLER> inline ScriptObject ScriptObject::callFunction( const ERROR_HANDLER & errorHandler ) const { return this->callFunction( ScriptArgs::none(), errorHandler ); } /** * This method gets the iterator for the object * * @param errorHandler The type of error handling to use if this method * fails * @return The resulting ScriptObject */ template <class ERROR_HANDLER> inline ScriptIter ScriptObject::getIter( const ERROR_HANDLER & errorHandler ) const { PyObject * pIter = PyObject_GetIter( this->get() ); errorHandler.checkPtrError( pIter ); return ScriptIter( pIter, ScriptObject::FROM_NEW_REFERENCE ); } /** * Equivalent to the Python expression dir(o), * * @param errorHandler The type of error handling to use if this method * fails * @return A (possibly empty) list of strings appropriate for the object * argument, or NULL if there was an error. */ template <class ERROR_HANDLER> inline ScriptObject ScriptObject::getDir( const ERROR_HANDLER & errorHandler ) const { if (this->get() == NULL) { // Do not call PyObject_Dir( NULL ) because it will get the names of // current locals not attached to this ScriptObject return ScriptObject( NULL ); } PyObject* result = PyObject_Dir( this->get() ); errorHandler.checkPtrError( result ); return ScriptObject( result, ScriptObject::FROM_NEW_REFERENCE ); } /** * This method gets string for the object * * @param errorHandler The type of error handling to use if this method * fails * @return The resulting ScriptObject */ template <class ERROR_HANDLER> inline ScriptString ScriptObject::str( const ERROR_HANDLER & errorHandler ) const { PyObject * pStr = PyObject_Str( this->get() ); errorHandler.checkPtrError( pStr ); return ScriptString( pStr, ScriptObject::FROM_NEW_REFERENCE ); } /** * Equivalent to Python built-in id( object ). * @see builtinmodule.c builtin_id(). * * @param errorHandler The type of error handling to use if this method. * fails * @return The id as a ScriptLong. */ inline ScriptLong ScriptObject::id() const { // PyLong_FromVoidPtr may return an integer or long integer PyObject * pLongOrInt = PyLong_FromVoidPtr( this->get() ); if (PyLong_CheckExact( pLongOrInt ) == 1) { return ScriptLong( pLongOrInt, ScriptObject::FROM_NEW_REFERENCE ); } assert( PyInt_CheckExact( pLongOrInt ) == 1 ); const ScriptInt intResult = ScriptInt( pLongOrInt, ScriptObject::FROM_NEW_REFERENCE ); const long intToLong = intResult.asLong(); return ScriptLong::create( intToLong ); } /** * This method creates a new ScriptObject from a given value * @return A new script object */ template <class TYPE> /* static */ inline ScriptObject ScriptObject::createFrom( TYPE val ) { return ScriptObject( Script::getData( val ), ScriptObject::FROM_NEW_REFERENCE ); } /** * This method converts a ScriptObject to a given type * @param rVal The value to populate with the script object * @return True on success, false otherwise */ template <class ERROR_HANDLER, class TYPE> inline bool ScriptObject::convertTo( TYPE & rVal, const ERROR_HANDLER & errorHandler ) const { return convertTo( rVal, "", errorHandler ); } /** * This method converts a ScriptObject to a given type * @param rVal The value to populate with the script object * @param varName The name of the script object (to be stored as an error) * @return True on success, false otherwise */ template <class ERROR_HANDLER, class TYPE> inline bool ScriptObject::convertTo( TYPE & rVal, const char * varName, const ERROR_HANDLER & errorHandler ) const { int ret = Script::setData( this->get(), rVal, varName ); errorHandler.checkMinusOne( ret ); return ret == 0; }
d1fa64a810d0bbd1f2d331d489de98b575ceffca
ec4711e5444c280fc4fcd6505d5c0acca0627d55
/hermit/gotodlg.cpp
76fec3426461f04bed5061b594868c27b4421771
[ "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-unknown-license-reference" ]
permissive
ancientlore/hermit
18f605d1cc8f145c6d936268c9139c92f6182590
0b6b5b3e364fe9a7080517a7f3ddb8cdb03f5b14
refs/heads/master
2020-05-16T21:02:57.517459
2012-01-26T00:17:12
2012-01-26T00:17:12
3,269,934
2
0
null
null
null
null
UTF-8
C++
false
false
725
cpp
gotodlg.cpp
// Goto Dialog // Copyright (C) 1996 Michael D. Lore All Rights Reserved #include "gotodlg.h" GotoDialog::GotoDialog (Screen& screen, char *pText, int length, History *pHist) : Popup (screen, 80, 6) { draw (); mpEdit = new Edit (screen, mX + 2, mY + 3, 76, pText, length, pHist); if (mpEdit == 0) throw AppException (WHERE, ERR_OUT_OF_MEMORY); } GotoDialog::~GotoDialog () { delete mpEdit; } void GotoDialog::draw () { drawBackground (); drawBorder ("Goto Location"); writeText (2, 2, "Type the directory name and press Enter, or press Esc to cancel."); } void GotoDialog::run () { mpEdit->run (); mExitKey = mpEdit->getExitCode (); } // End
f50d356b350559e548162184d4c45bd8b39d697b
08a67df6e57f84cd4fb0f18925433e03e3cf51ee
/PhoeVersion/Qt_Creator/projectPHOE/fundusexam.cpp
26bf1beba5c2e80bc26c0e3724227fd8ed41db22
[]
no_license
jdsalguer/senior_project
bee19cf43220c0d9e8f514e4e39c5134c9b188ea
15f612884ede684280ddee4f7d7d47276e72a1fe
refs/heads/master
2021-01-22T11:54:34.109996
2015-04-29T19:32:30
2015-04-29T19:32:30
24,651,090
0
0
null
null
null
null
UTF-8
C++
false
false
244
cpp
fundusexam.cpp
#include "fundusexam.h" #include "ui_fundusexam.h" fundusexam::fundusexam(QWidget *parent) : QDialog(parent), ui(new Ui::fundusexam) { ui->setupUi(this); this->showFullScreen(); } fundusexam::~fundusexam() { delete ui; }
1570575974a5a01fd3c927e89401680087f105ea
da1500e0d3040497614d5327d2461a22e934b4d8
/cobalt/updater/utils_test.cc
416586b8eb0630d63b9b841b586d40690b8c8864
[ "Apache-2.0", "BSD-3-Clause" ]
permissive
youtube/cobalt
34085fc93972ebe05b988b15410e99845efd1968
acefdaaadd3ef46f10f63d1acae2259e4024d383
refs/heads/main
2023-09-01T13:09:47.225174
2023-09-01T08:54:54
2023-09-01T08:54:54
50,049,789
169
80
BSD-3-Clause
2023-09-14T21:50:50
2016-01-20T18:11:34
null
UTF-8
C++
false
false
18,798
cc
utils_test.cc
// Copyright 2022 The Cobalt Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "cobalt/updater/utils.h" #include <vector> #include "base/files/file_path.h" #include "base/strings/strcat.h" #include "base/values.h" #include "gmock/gmock.h" #include "starboard/common/file.h" #include "starboard/directory.h" #include "starboard/extension/installation_manager.h" #include "starboard/file.h" #include "testing/gtest/include/gtest/gtest.h" namespace cobalt { namespace updater { namespace { const char kEvergreenManifestFilename[] = "manifest.json"; const char kEvergreenLibDirname[] = "lib"; // Based on the CobaltExtensionInstallationManagerApi struct typedef. class MockInstallationManagerApi { public: MOCK_METHOD0(GetCurrentInstallationIndex, int()); MOCK_METHOD3(GetInstallationPath, int(int installation_index, char* path, int path_length)); }; MockInstallationManagerApi* GetMockInstallationManagerApi() { static auto* const installation_manager_api = []() { auto* inner_installation_manager_api = new MockInstallationManagerApi; // Because the mocked methods are non-state-changing, this mock is really // just used as a stub. It's therefore ok for this mock object to be leaked // and not verified. testing::Mock::AllowLeak(inner_installation_manager_api); return inner_installation_manager_api; }(); return installation_manager_api; } // Stub definitions that delegate to the mock installation manager API. int StubGetCurrentInstallationIndex() { return GetMockInstallationManagerApi()->GetCurrentInstallationIndex(); } int StubGetInstallationPath(int installation_index, char* path, int path_length) { return GetMockInstallationManagerApi()->GetInstallationPath( installation_index, path, path_length); } // No-op stub definitions for functions that aren't exercised. int StubMarkInstallationSuccessful(int installation_index) { return IM_EXT_SUCCESS; } int StubRequestRollForwardToInstallation(int installation_index) { return IM_EXT_SUCCESS; } int StubSelectNewInstallationIndex() { return IM_EXT_SUCCESS; } int StubGetAppKey(char* app_key, int app_key_length) { return IM_EXT_SUCCESS; } int StubGetMaxNumberInstallations() { return IM_EXT_SUCCESS; } int StubResetInstallation(int installation_index) { return IM_EXT_SUCCESS; } int StubReset() { return IM_EXT_SUCCESS; } const CobaltExtensionInstallationManagerApi kStubInstallationManagerApi = { kCobaltExtensionInstallationManagerName, 1, &StubGetCurrentInstallationIndex, &StubMarkInstallationSuccessful, &StubRequestRollForwardToInstallation, &StubGetInstallationPath, &StubSelectNewInstallationIndex, &StubGetAppKey, &StubGetMaxNumberInstallations, &StubResetInstallation, &StubReset, }; class UtilsTest : public testing::Test { protected: void SetUp() override { temp_dir_path_.resize(kSbFileMaxPath); ASSERT_TRUE(SbSystemGetPath(kSbSystemPathTempDirectory, temp_dir_path_.data(), temp_dir_path_.size())); } void TearDown() override { ASSERT_TRUE(starboard::SbFileDeleteRecursive(temp_dir_path_.data(), true)); } void CreateManifest(const char* content, const std::string& directory) { std::string manifest_path = base::StrCat({directory, kSbFileSepString, kEvergreenManifestFilename}); SbFile sb_file = SbFileOpen(manifest_path.c_str(), kSbFileOpenAlways | kSbFileRead, nullptr, nullptr); ASSERT_TRUE(SbFileIsValid(sb_file)); ASSERT_TRUE(SbFileClose(sb_file)); ASSERT_TRUE( SbFileAtomicReplace(manifest_path.c_str(), content, strlen(content))); } void DeleteManifest(const std::string& directory) { std::string manifest_path = base::StrCat({directory, kSbFileSepString, kEvergreenManifestFilename}); ASSERT_TRUE(SbFileDelete(manifest_path.c_str())); } void CreateEmptyLibrary(const std::string& name, const std::string& installation_path) { std::string lib_path = base::StrCat( {installation_path, kSbFileSepString, kEvergreenLibDirname}); ASSERT_TRUE(SbDirectoryCreate(lib_path.c_str())); lib_path = base::StrCat({lib_path, kSbFileSepString, name}); SbFile sb_file = SbFileOpen( lib_path.c_str(), kSbFileOpenAlways | kSbFileRead, nullptr, nullptr); ASSERT_TRUE(SbFileIsValid(sb_file)); ASSERT_TRUE(SbFileClose(sb_file)); } void DeleteLibraryDirRecursively(const std::string& installation_path) { std::string lib_path = base::StrCat( {installation_path, kSbFileSepString, kEvergreenLibDirname}); ASSERT_TRUE(starboard::SbFileDeleteRecursive(lib_path.c_str(), false)); } std::vector<char> temp_dir_path_; }; TEST_F(UtilsTest, ReadEvergreenVersionReturnsVersionForValidManifest) { std::string installation_path = base::StrCat( {temp_dir_path_.data(), kSbFileSepString, "some_installation_path"}); ASSERT_TRUE(SbDirectoryCreate(installation_path.c_str())); char manifest_content[] = R"json( { "manifest_version": 2, "name": "Cobalt", "description": "Cobalt", "version": "1.2.0" })json"; CreateManifest(manifest_content, installation_path); base::Version version = ReadEvergreenVersion(base::FilePath(installation_path)); ASSERT_EQ(version.GetString(), "1.2.0"); DeleteManifest(installation_path); } TEST_F(UtilsTest, ReadEvergreenVersionReturnsInvalidVersionForVersionlessManifest) { std::string installation_path = base::StrCat( {temp_dir_path_.data(), kSbFileSepString, "some_installation_path"}); ASSERT_TRUE(SbDirectoryCreate(installation_path.c_str())); char versionless_manifest_content[] = R"json( { "manifest_version": 2, "name": "Cobalt", "description": "Cobalt", })json"; CreateManifest(versionless_manifest_content, installation_path); base::Version version = ReadEvergreenVersion(base::FilePath(installation_path)); ASSERT_FALSE(version.IsValid()); DeleteManifest(installation_path); } TEST_F(UtilsTest, ReadEvergreenVersionReturnsInvalidVersionForMissingManifest) { base::Version version = ReadEvergreenVersion(base::FilePath("nonexistent_manifest_path")); ASSERT_FALSE(version.IsValid()); } TEST_F(UtilsTest, ReturnsEvergreenVersionFromCurrentManagedInstallation) { std::string installation_path = base::StrCat( {temp_dir_path_.data(), kSbFileSepString, "some_installation_path"}); int installation_index = 1; MockInstallationManagerApi* mock_installation_manager_api = GetMockInstallationManagerApi(); EXPECT_CALL(*mock_installation_manager_api, GetCurrentInstallationIndex()) .Times(1) .WillOnce(testing::Return(installation_index)); EXPECT_CALL( *mock_installation_manager_api, GetInstallationPath(installation_index, testing::_, kSbFileMaxPath)) .Times(1) .WillOnce( testing::DoAll(testing::SetArrayArgument<1>(installation_path.begin(), installation_path.end()), testing::Return(IM_EXT_SUCCESS))); std::function<const void*(const char*)> stub_get_extension_fn = [](const char* name) { return &kStubInstallationManagerApi; }; ASSERT_TRUE(SbDirectoryCreate(installation_path.c_str())); char manifest_content[] = R"json( { "manifest_version": 2, "name": "Cobalt", "description": "Cobalt", "version": "1.2.0" })json"; CreateManifest(manifest_content, installation_path); std::string version = GetCurrentEvergreenVersion(stub_get_extension_fn); ASSERT_EQ(version, "1.2.0"); DeleteManifest(installation_path); } TEST_F(UtilsTest, ReturnsDefaultVersionWhenManifestMissingFromCurrentManagedInstallation) { std::string installation_path = base::StrCat( {temp_dir_path_.data(), kSbFileSepString, "some_installation_path"}); int installation_index = 1; MockInstallationManagerApi* mock_installation_manager_api = GetMockInstallationManagerApi(); EXPECT_CALL(*mock_installation_manager_api, GetCurrentInstallationIndex()) .Times(1) .WillOnce(testing::Return(installation_index)); EXPECT_CALL( *mock_installation_manager_api, GetInstallationPath(installation_index, testing::_, kSbFileMaxPath)) .Times(1) .WillOnce( testing::DoAll(testing::SetArrayArgument<1>(installation_path.begin(), installation_path.end()), testing::Return(IM_EXT_SUCCESS))); std::function<const void*(const char*)> stub_get_extension_fn = [](const char* name) { return &kStubInstallationManagerApi; }; ASSERT_TRUE(SbDirectoryCreate(installation_path.c_str())); // No manifest is created in the installation directory. std::string version = GetCurrentEvergreenVersion(stub_get_extension_fn); ASSERT_EQ(version, kDefaultManifestVersion); } TEST_F(UtilsTest, ReturnsVersionFromLoadedInstallationWhenErrorGettingInstallationPath) { int installation_index = 1; MockInstallationManagerApi* mock_installation_manager_api = GetMockInstallationManagerApi(); EXPECT_CALL(*mock_installation_manager_api, GetCurrentInstallationIndex()) .Times(1) .WillOnce(testing::Return(installation_index)); EXPECT_CALL( *mock_installation_manager_api, GetInstallationPath(installation_index, testing::_, kSbFileMaxPath)) .Times(1) .WillOnce(testing::Return(IM_EXT_ERROR)); std::function<const void*(const char*)> stub_get_extension_fn = [](const char* name) { return &kStubInstallationManagerApi; }; std::vector<char> system_path_content_dir(kSbFileMaxPath); SbSystemGetPath(kSbSystemPathContentDirectory, system_path_content_dir.data(), kSbFileMaxPath); // Since the libupdater_test.so library has already been loaded, // kSbSystemPathContentDirectory points to the content dir of the running // library and the installation dir is therefore its parent. std::string installation_path = base::FilePath(std::string(system_path_content_dir.begin(), system_path_content_dir.end())) .DirName() .value(); char manifest_content[] = R"json( { "manifest_version": 2, "name": "Cobalt", "description": "Cobalt", "version": "1.2.0" })json"; CreateManifest(manifest_content, installation_path); std::string version = GetCurrentEvergreenVersion(stub_get_extension_fn); ASSERT_EQ(version, "1.2.0"); DeleteManifest(installation_path); } TEST_F(UtilsTest, ReturnsVersionFromLoadedInstallationWhenErrorGettingInstallationIndex) { MockInstallationManagerApi* mock_installation_manager_api = GetMockInstallationManagerApi(); EXPECT_CALL(*mock_installation_manager_api, GetCurrentInstallationIndex()) .Times(1) .WillOnce(testing::Return(IM_EXT_ERROR)); std::function<const void*(const char*)> stub_get_extension_fn = [](const char* name) { return &kStubInstallationManagerApi; }; std::vector<char> system_path_content_dir(kSbFileMaxPath); SbSystemGetPath(kSbSystemPathContentDirectory, system_path_content_dir.data(), kSbFileMaxPath); // Since the libupdater_test.so library has already been loaded, // kSbSystemPathContentDirectory points to the content dir of the running // library and the installation dir is therefore its parent. std::string installation_path = base::FilePath(std::string(system_path_content_dir.begin(), system_path_content_dir.end())) .DirName() .value(); char manifest_content[] = R"json( { "manifest_version": 2, "name": "Cobalt", "description": "Cobalt", "version": "1.2.0" })json"; CreateManifest(manifest_content, installation_path); std::string version = GetCurrentEvergreenVersion(stub_get_extension_fn); ASSERT_EQ(version, "1.2.0"); DeleteManifest(installation_path); } TEST_F(UtilsTest, ReturnsVersionFromLoadedInstallationWhenErrorGettingIMExtension) { std::function<const void*(const char*)> stub_get_extension_fn = [](const char* name) { return nullptr; }; std::vector<char> system_path_content_dir(kSbFileMaxPath); SbSystemGetPath(kSbSystemPathContentDirectory, system_path_content_dir.data(), kSbFileMaxPath); // Since the libupdater_test.so library has already been loaded, // kSbSystemPathContentDirectory points to the content dir of the running // library and the installation dir is therefore its parent. std::string installation_path = base::FilePath(std::string(system_path_content_dir.begin(), system_path_content_dir.end())) .DirName() .value(); char manifest_content[] = R"json( { "manifest_version": 2, "name": "Cobalt", "description": "Cobalt", "version": "1.2.0" })json"; CreateManifest(manifest_content, installation_path); std::string version = GetCurrentEvergreenVersion(stub_get_extension_fn); ASSERT_EQ(version, "1.2.0"); DeleteManifest(installation_path); } TEST_F(UtilsTest, ReturnsDefaultVersionWhenManifestMissingFromLoadedInstallation) { // Two levels of resilience are actually tested... // First, the loaded installation is used because an error is encountered // while getting the Installation Manager extension. This is similar to // previous test cases. std::function<const void*(const char*)> stub_get_extension_fn = [](const char* name) { return nullptr; }; // And second, kDefaultManifestVersion should be used because no manifest is // found in the loaded installation. std::string version = GetCurrentEvergreenVersion(stub_get_extension_fn); ASSERT_EQ(version, kDefaultManifestVersion); } TEST_F(UtilsTest, ReturnsEvergreenLibraryMetadataFromCurrentManagedInstallation) { std::string installation_path = base::StrCat( {temp_dir_path_.data(), kSbFileSepString, "some_installation_path"}); int installation_index = 1; MockInstallationManagerApi* mock_installation_manager_api = GetMockInstallationManagerApi(); EXPECT_CALL(*mock_installation_manager_api, GetCurrentInstallationIndex()) .Times(1) .WillOnce(testing::Return(installation_index)); EXPECT_CALL( *mock_installation_manager_api, GetInstallationPath(installation_index, testing::_, kSbFileMaxPath)) .Times(1) .WillOnce( testing::DoAll(testing::SetArrayArgument<1>(installation_path.begin(), installation_path.end()), testing::Return(IM_EXT_SUCCESS))); std::function<const void*(const char*)> stub_get_extension_fn = [](const char* name) { return &kStubInstallationManagerApi; }; ASSERT_TRUE(SbDirectoryCreate(installation_path.c_str())); char manifest_content[] = R"json( { "manifest_version": 2, "name": "Cobalt", "description": "Cobalt", "version": "1.2.0" })json"; CreateManifest(manifest_content, installation_path); CreateEmptyLibrary("libcobalt.so", installation_path); EvergreenLibraryMetadata metadata = GetCurrentEvergreenLibraryMetadata(stub_get_extension_fn); ASSERT_EQ(metadata.version, "1.2.0"); ASSERT_EQ(metadata.file_type, "Uncompressed"); DeleteManifest(installation_path); DeleteLibraryDirRecursively(installation_path); } TEST_F(UtilsTest, ReturnsFileTypeUnknownInMetadataForUnexpectedLibInManagedInstallation) { std::string installation_path = base::StrCat( {temp_dir_path_.data(), kSbFileSepString, "some_installation_path"}); int installation_index = 1; MockInstallationManagerApi* mock_installation_manager_api = GetMockInstallationManagerApi(); EXPECT_CALL(*mock_installation_manager_api, GetCurrentInstallationIndex()) .Times(1) .WillOnce(testing::Return(installation_index)); EXPECT_CALL( *mock_installation_manager_api, GetInstallationPath(installation_index, testing::_, kSbFileMaxPath)) .Times(1) .WillOnce( testing::DoAll(testing::SetArrayArgument<1>(installation_path.begin(), installation_path.end()), testing::Return(IM_EXT_SUCCESS))); std::function<const void*(const char*)> stub_get_extension_fn = [](const char* name) { return &kStubInstallationManagerApi; }; ASSERT_TRUE(SbDirectoryCreate(installation_path.c_str())); CreateEmptyLibrary("libcobalt.unexpected", installation_path); EvergreenLibraryMetadata metadata = GetCurrentEvergreenLibraryMetadata(stub_get_extension_fn); ASSERT_EQ(metadata.file_type, "FileTypeUnknown"); DeleteLibraryDirRecursively(installation_path); } TEST_F(UtilsTest, ReturnsEvergreenLibMetadataFromLoadedInstallationWhenErrorGettingIM) { std::function<const void*(const char*)> stub_get_extension_fn = [](const char* name) { return nullptr; }; std::vector<char> system_path_content_dir(kSbFileMaxPath); SbSystemGetPath(kSbSystemPathContentDirectory, system_path_content_dir.data(), kSbFileMaxPath); // Since the libupdater_test.so library has already been loaded, // kSbSystemPathContentDirectory points to the content dir of the running // library and the installation dir is therefore its parent. std::string installation_path = base::FilePath(std::string(system_path_content_dir.begin(), system_path_content_dir.end())) .DirName() .value(); char manifest_content[] = R"json( { "manifest_version": 2, "name": "Cobalt", "description": "Cobalt", "version": "1.2.0" })json"; CreateManifest(manifest_content, installation_path); CreateEmptyLibrary("libcobalt.lz4", installation_path); EvergreenLibraryMetadata metadata = GetCurrentEvergreenLibraryMetadata(stub_get_extension_fn); ASSERT_EQ(metadata.version, "1.2.0"); ASSERT_EQ(metadata.file_type, "Compressed"); DeleteManifest(installation_path); DeleteLibraryDirRecursively(installation_path); } } // namespace } // namespace updater } // namespace cobalt
92c8d83d7ad9ffc0d27ef561cc36ec6921c0bdd0
a170461845f5b240daf2090810b4be706191f837
/pyqt/DemoFullCode-PythonQt/chap10Multimedia/Demo10_5VideoPlayer/QtApp/QWVideoWidget.cpp
02de1647858e006e00aff3fcedec36d051ce286a
[]
no_license
longhuarst/QTDemo
ec3873f85434c61cd2a8af7e568570d62c2e6da8
34f87f4b2337a140122b7c38937ab4fcf5f10575
refs/heads/master
2022-04-25T10:59:54.434587
2020-04-26T16:55:29
2020-04-26T16:55:29
259,048,398
1
1
null
null
null
null
UTF-8
C++
false
false
854
cpp
QWVideoWidget.cpp
#include "QWVideoWidget.h" #include <QKeyEvent> #include <QMouseEvent> void QWVideoWidget::keyPressEvent(QKeyEvent *event) {//按键事件,ESC退出全屏状态 if ((event->key() == Qt::Key_Escape)&&(isFullScreen())) { setFullScreen(false); event->accept(); } QVideoWidget::keyPressEvent(event); } void QWVideoWidget::mousePressEvent(QMouseEvent *event) {//鼠标事件,单击控制暂停和继续播放 if (event->button()==Qt::LeftButton) { if (m_player->state()==QMediaPlayer::PlayingState) m_player->pause(); else m_player->play(); } QVideoWidget::mousePressEvent(event); } QWVideoWidget::QWVideoWidget(QWidget *parent):QVideoWidget(parent) { } void QWVideoWidget::setMediaPlayer(QMediaPlayer *player) {//设置播放器 m_player=player; }
0904e2df3016971eb9b61c25e363631d836e2e76
3f05834538b43c760bbbf9ee2a4af7343afd2941
/cpu.h
8ea97222c81d83764cbc5ec5fc327696bbaca332
[]
no_license
beeliu/operating-system-simulator
1648437673a20c1460710e4eaecf457e72de2413
73a6dfc0a7b2b1a236c266999314812dae23f8e1
refs/heads/master
2022-04-14T14:05:20.831011
2020-03-18T16:30:36
2020-03-18T16:30:36
197,607,893
0
0
null
null
null
null
UTF-8
C++
false
false
851
h
cpu.h
/* Belinda Liu Interface file for CPU class */ #ifndef CPU_H #define CPU_H #include <vector> class CPU { public: // constructor CPU(); // add to ready-queue, parameter is pid of process void add(int p_id); // get currently running process, returns pid of running process int get_running(); // get all processes in queue, returns vector of process pids std::vector<int> get_all(); // remove process from queue, takes in pid of process to be removed // and puts next process in CPU // must be IN queue, return 1 if removed, 0 if not int remove(int p_id); // change currently running process to next in queue, remove old int change_current(); private: // ready queue std::vector<int> ready_queue; // currently running process pid int current; }; #endif /* CPU_H */
f4210d72361a8b99bc746e8ef28dc4fd69bc0f13
33aa67b183117fdec7065b1324627ca9f37f6f35
/levenshtein.cpp
0ba512aab2e7916631cb5f52f81fe1c0a1b30394
[]
no_license
mkk96/Competitive
0606055abab410c72f7b328803eaa1bd8e2d2342
a9a7e1e005092b1e35bcca568e9840019b9d9417
refs/heads/main
2023-06-18T16:34:26.849442
2021-07-19T17:03:11
2021-07-19T17:03:11
384,914,067
0
0
null
null
null
null
UTF-8
C++
false
false
829
cpp
levenshtein.cpp
#include<iostream> #include<bits/stdc++.h> #include<string.h> using namespace std; int cost(char a,char b) { if(a==b) { return 0; } return 1; } int minimum(int x,int y,int z) { if(x<=y&&x<=z) return x; if(y<=z&&y<=x) return y; if(z<=y&&z<=x) return z; } int levenshtein(char *a,char *b) { int n=strlen(a); int m=strlen(b); int array[n+1][m+1],i,j; for(i=0;i<=m;i++) { array[0][i]=i; } for(i=0;i<=n;i++) { array[i][0]=i; } for(i=1;i<=n;i++) { for(j=1;j<=m;j++) { array[i][j]=minimum(array[i][j-1]+1,array[i-1][j]+1,array[i-1][j-1]+cost(a[i-1],b[j-1])); } } /*for(i=0;i<=n;i++) { for(j=0;j<=m;j++) { cout<<array[i][j]<<" "; } cout<<"\n"; }*/ return array[n][m]; } int main() { char a[10],b[10]; cin>>a; cin>>b; int distance=levenshtein(a,b); cout<<distance; return 0; }
ff86298b7da3f9da6d0edc65bf9f59c174740bd1
52423031b782c7a0a246ac2b20928e183343ae5a
/CS325_200904/CS325_Fa2009/Classes/Class9-15/Node.hpp
6b34e7ce51e801f4adbbb5963e2978bfa5557449
[]
no_license
almostengr/college-coursework
59082f77bed0bf89ff39bfed3ea7641d4dc2dace
d0f3a21fb5f24c8baf18c1905eb3f3beff180856
refs/heads/master
2021-08-08T01:07:46.117218
2021-07-20T15:04:01
2021-07-20T15:04:01
170,057,043
0
0
null
null
null
null
UTF-8
C++
false
false
951
hpp
Node.hpp
#ifndef __NODE__ #define __NODE__ #include "Container.hpp" template <class T> class Node { T value; Node<T> *next; Node<T> *prev; static int counter; public: Node(T v); ~Node() { Node<T>::counter--; } Node(T v,Node<T>*, Node<T>*); Node<T>* getNext(); Node<T>* getPrev(); T getValue(); static int getCounter(){ return counter;} template <class S> friend class Container; // static int getCounter() {return counter;} }; template <class T> int Node<T>::counter = 0; template <class T> Node<T>::Node(T v) { this->value = v; this->next = 0; this->prev = 0; Node<T>::counter ++; } template <class T> Node<T>::Node(T v, Node<T> *p, Node<T> *n) { Node<T>::counter ++; this->value = v; this->next = n; this->prev = p; } template <class T> Node<T> *Node<T>::getNext() { return next; } template <class T> Node<T> *Node<T>::getPrev() { return prev; } template <class T> T Node<T>::getValue() { return value; } #endif
6aab90c984b10d33d8d937daf6cae7ca6e733311
b075499c188b2a350d9ae44b27d142f1a802a57b
/C++/Lab 9/cpp/Lab9e.cpp
e46bccd06d374f4b2d7adf729d53b0cef9635a72
[]
no_license
jdog101/C-Course
0f9838a40019850bbdee96cfe3abe577f4092d3b
1e640dd5d7557767125c3136fe7d40ef8b672ad4
refs/heads/master
2021-01-20T19:42:19.460864
2016-03-23T21:15:13
2016-03-23T21:15:13
null
0
0
null
null
null
null
UTF-8
C++
false
false
624
cpp
Lab9e.cpp
#include <iostream> using namespace std; int main() { double weights[7]{.10,.10,.10,.10,.20,.10,.30}; double myScores[7]; string labels[7] = {"Exam 1", "Exam 2", "Exam 3", "Final Exam", "Programming Assignment", "Other Activities", "Lab Test Grade"}; int grade; for(int i=0;i<7;i++) { cout << "Enter your grade for " << labels[i] << ": " << endl; cin >> grade; myScores[i]=grade; } double final=0; for(int z=0; z<7; z++) { final += (weights[z] * myScores[z]); } cout <<"Your final grade is: " << final << endl; }
5550ca0629ad0c6709c16b3dc0a5bdc8c7170f76
30bdd8ab897e056f0fb2f9937dcf2f608c1fd06a
/Implementation/1081.cpp
9d85acefbe78557896ab7f9a205ce26112de83c9
[]
no_license
thegamer1907/Code_Analysis
0a2bb97a9fb5faf01d983c223d9715eb419b7519
48079e399321b585efc8a2c6a84c25e2e7a22a61
refs/heads/master
2020-05-27T01:20:55.921937
2019-11-20T11:15:11
2019-11-20T11:15:11
188,403,594
2
1
null
null
null
null
UTF-8
C++
false
false
1,636
cpp
1081.cpp
// C++ #include <algorithm> #include <iostream> #include <string> #include <set> #include <stack> #include <map> #include <cmath> #include <iomanip> #include <cstdlib> #include <queue> #include <list> #define NM 100000000000000; using namespace std; typedef long long ll; //void sf(double r) //{ // if (fabs(l - r) / 2 > 10E-12) // { // ll t = l + r; // m = t / 2; // if (pow(m, n) > a) // { // r = m; // // } // else l = m; // // sf(r); // } //} const ll MAXN = 10000; vector <bool> prime(MAXN ,1); vector< ll > res; void Erat() { //fill(prime, prime + MAXN, true); prime[0] = prime[1] = false; for (int i = 2; i < MAXN; ++i) { if (prime[i]) { res.push_back(i); for (ll j = i + i; j < MAXN; j += i) { prime[j] = false; } } } } struct price { ll p1, p2, p3; price() : p1(0), p2(0), p3(0) {}; }; bool IsPrime(ll a) { if (a < 2) return false; ll aSqrt = sqrt((double)a) + 0.1; for (ll i = 2; i <= aSqrt; ++i) { if (a % i == 0) return false; } return true; } vector <ll> h(2*100000); ll sum(ll l, ll r) { ll summ = 0; for (ll i = l; i < r; i++) { summ += h[i] - h[r]; } return summ; } int main() { ll n; cin >> n; ll x; cin >> x; string s; cin >> s; for (ll j = 0; j < x; j++) { for (ll i = 1; i < n; i++) { if (s[i] == 'G' && s[i - 1] == 'B') { swap(s[i], s[i - 1]); i++; } } } cout << s; return 0; }
44ff739df0f8fb0cb4fb9fbdeecf53ab15d995cd
58859321e637036756359d0f53f2f5954a6532f4
/identica.cc
e1ef9b6537b1a4a40f759362469fc0354733d0cf
[]
no_license
thingie/ideirc
23039c3d8312aa3d38e05e49d6d9b380f533c70f
f68e02fe923948f172485aab49709cc43b186d11
refs/heads/master
2020-06-09T05:20:23.521095
2010-05-31T00:12:44
2010-05-31T00:12:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
861
cc
identica.cc
#include "identica.h" int identica_send (string username, string password, string message) { CURL *curl; CURLcode res; curl = curl_easy_init (); if (curl) { curl_easy_setopt (curl, CURLOPT_URL, "identi.ca/api/statuses/update.xml"); curl_easy_setopt (curl, CURLOPT_USERNAME, username.c_str ()); curl_easy_setopt (curl, CURLOPT_PASSWORD, password.c_str ()); struct curl_httppost* post = NULL; struct curl_httppost* last = NULL; curl_formadd (&post, &last, CURLFORM_COPYNAME, "status", CURLFORM_PTRCONTENTS, message.c_str (), CURLFORM_CONTENTTYPE, "text/plain", CURLFORM_END); curl_easy_setopt (curl, CURLOPT_HTTPPOST, post); res = curl_easy_perform (curl); curl_easy_cleanup (curl); curl_formfree (post); //TODO, we need to check at least if we were able to post sucessfully } return (int) res; }
876430253851368fb1a16feeb009840b5a59b01c
c7bbec13761615b04d4d6387fb6014b6354475da
/OS-SIM/MovieClip/TextInputClip.cpp
e9762002b22cff4f8c431281b7edfe8d39a52b0e
[]
no_license
somnathsarkar/Operating-System-Simulator
fef0fc5eb81d991fff0b67fb7d82b1a2f74766e6
287990045d2df2ac647acd0a898c9d5ceb4fe749
refs/heads/master
2021-01-22T03:23:04.723337
2017-05-25T07:19:36
2017-05-25T07:19:36
92,376,154
0
1
null
null
null
null
UTF-8
C++
false
false
1,044
cpp
TextInputClip.cpp
#include "TextInputClip.h" TextInputClip* TextInputClip::focus = NULL; TextInputClip::TextInputClip(int w, int h) : MouseClip(w, h, { 255,255,255,255 }) { text = ""; textClip = new MovieClip(text, "Myriad Pro Regular", 18); addChild(textClip); } void TextInputClip::setFocus(MouseClip *x) { focus = (TextInputClip*)x; } void TextInputClip::backspace() { if (text.length()) { text.pop_back(); updateTextClip(); } } void TextInputClip::textInput(std::string newtext){ text += newtext; updateTextClip(); } void TextInputClip::processTextEvent(SDL_Event& e) { switch (e.type) { case SDL_KEYDOWN: if (e.key.keysym.sym == SDLK_BACKSPACE) backspace(); else if (e.key.keysym.sym == SDLK_RETURN) { focus = NULL; onTextSubmit(); } break; case SDL_TEXTINPUT: textInput(e.text.text); break; } } void TextInputClip::onMouseUp() { setFocus(this); } void TextInputClip::updateTextClip() { removeChild(textClip); delete textClip; textClip = new MovieClip(text, "Myriad Pro Regular", 18); addChild(textClip); }
7652bb41090cf5f43c4da16fe11afac79c1a74f7
289ce088f01c117777c512afcbc89756a9f76520
/src/Engine/Application.h
2ffaa0dd12f4785630958bf4b591063e23d6771f
[]
no_license
OctoGames/Chis
13cff1ed556fe03793dbb0bb682008bd3e8e2e3c
da8861eab89cd104b9f744b5787b47af7cfe7714
refs/heads/master
2020-04-23T12:15:27.601130
2019-05-16T21:45:32
2019-05-16T21:45:32
171,162,412
0
0
null
null
null
null
UTF-8
C++
false
false
221
h
Application.h
#ifndef __APPLICATION_H__ #define __APPLICATION_H__ class Application { public: Application(); virtual ~Application(); virtual void init(); virtual void run(); virtual void close(); }; #endif // !__APPLICATION_H__
da0d5a6f8753ad34a19f46ee86ead3cfb2c44141
b802d4a571983c657d324ee049da7afacf71316f
/Kernel/Memory/IAllocator.h
35885c7415fa304041c31f3208a5279c01c4d00b
[]
no_license
Gilyermo/RailEngine
72d7b4bc20bce94054ceadce464afe5ddddb534a
44a4c528f9234a61c23282622c0ad3c3d2ed20a1
refs/heads/master
2022-11-23T05:29:17.859004
2020-06-20T04:23:25
2020-06-20T04:23:25
273,637,188
0
0
null
null
null
null
UTF-8
C++
false
false
523
h
IAllocator.h
#pragma once #include "Memory.h" #include "../Exception/Exception.h" #include <cstdint> #include <memory> namespace RGE { namespace Memory { class KERNEL_API IAllocator{ public: virtual ~IAllocator(){} virtual void* Allocate(uint32_t size) = 0; virtual void Deallocate(void* ptr) = 0; virtual uint32_t GetMaximumAllocationSize() const = 0; virtual uint32_t GetUsedMemorySize() const = 0; virtual uint32_t GetFreeMemorySize() const = 0; virtual bool IsMemoryAllocatedHere(const void* ptr) const = 0; }; } }
c8745c4c79811263f589d92a9d1cf2b34498996b
c6f4505920e0ef7a4c6b9fff5fed4c9ce24d97af
/ChainOfResponsibility/main.cpp
c085e2c69d9eb3a10c50c84e406f407fd193804a
[]
no_license
luzh0422/DesignPatterns
43f47e85fbc6a73d24435e2117ea726a17d7cf55
ca59713c9fa59115742da63ef0afbea1e7c6a8b2
refs/heads/master
2021-06-07T02:27:40.188342
2020-05-06T14:37:25
2020-05-06T14:37:25
153,556,496
3
0
null
null
null
null
UTF-8
C++
false
false
405
cpp
main.cpp
#include <iostream> #include "Support.h" #include "NoSupport.h" #include "OddSupport.h" #include "LimitSupport.h" int main() { Support *alice = new NoSupport("Alice"); Support *bob = new OddSupport("bob"); Support *diana = new LimitSupport("diana", 4); alice->setNext(bob)->setNext(diana); for (int i = 0; i < 100; i++) { alice->support(new Problem(i)); } return 0; }
510fcae26e9978c67f990afc6b1d8542def51c89
1f0f1db8455da450d5ceda6925202bab8c24d2b6
/Section-1/ariprog.cpp
ead034f99a18f3345d72a1abae6ffe896f3d8f6d
[]
no_license
CLDP/USACO-Training
5c7538a1d57622c1e1cb89416084e3ed4d8bce74
8ff9cdd30956bf40f8ece965f8081c162fdeba45
refs/heads/master
2021-06-24T06:21:04.916750
2017-03-13T16:19:09
2017-03-13T16:19:09
9,501,501
0
0
null
null
null
null
UTF-8
C++
false
false
1,152
cpp
ariprog.cpp
/* ID: CHN PROG: ariprog LANG: C++ */ #include <iostream> #include <cstdio> #include <vector> #include <string> #include <cstring> #include <cmath> #include <algorithm> using namespace std; bool z[125100]; vector<pair<int, int> > ans; int main() { freopen("ariprog.in", "r", stdin); freopen("ariprog.out", "w", stdout); int n, m; cin >> n >> m; for (int i = 0; i <= m; ++i) for (int j = 0; j <= m; ++j) z[i * i + j * j] = true; int p = 2 * m * m; for (int i = 0; i < p; ++i) if (z[i]) { for (int j = 1; j < p; ++j) { if (i + j * (n-1) > p) break; if (z[i + j * (n-1)]) { bool flag = true; for (int k = 1; k < n; ++k) { flag &= (z[i + j * k]); if (!flag) break; } if (flag) ans.push_back(make_pair(j, i)); } } } sort(ans.begin(), ans.end()); if (ans.size() == 0) cout << "NONE" << endl; for (int i = 0; i < ans.size(); ++i) cout << ans[i].second << " " << ans[i].first << endl; return 0; }
cd9f1428d2f236a029902e7b56429660f777a761
20049d88e2e8f0e1904efc561103c1d84d21507a
/kornilov.daniil/common/rectangle.hpp
0d7d9326fe3268fec42771d5513aa06448f3eb9b
[]
no_license
gogun/Labs-for-SPbSPU-C-course-during-2019
5442a69152add3e66f02a7541e8dc8dd817f38a1
16ade47b859517a48d0fdb2e9704464bce4cc355
refs/heads/master
2022-01-09T16:02:54.728830
2019-06-06T11:06:33
2019-06-06T11:06:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
471
hpp
rectangle.hpp
#ifndef RECTANGLE_H #define RECTANGLE_H #include "shape.hpp" namespace kornilov { class Rectangle : public Shape { public: Rectangle(const rectangle_t& parameters); double getArea() const override; rectangle_t getFrameRect() const override; void move(const double dx, const double dy) override; void move(const point_t& point) override; void scale(const double coefficient) override; private: rectangle_t rectangle_; }; } #endif
51f24d044f0d947c9bb0da07872f0bf94400b413
896916d6ef5d685bcd934f1ad611bb57d71bf6ca
/labwork/oop/lab3/task2/Dlg.h
ee0c098fb1d8e2ad0cadade392e086c10cf5d293
[]
no_license
didim99/TSTU
bc21f4cb47a3a960b4d9b974c1ffa5fbda627926
ea8c59ca97fc99d07cc979a2fcb78113c322cf2c
refs/heads/master
2022-06-04T11:06:39.515992
2022-05-23T19:33:18
2022-05-23T19:33:18
134,288,801
0
1
null
null
null
null
UTF-8
C++
false
false
639
h
Dlg.h
 #pragma once class Dlg : public CDialogEx { public: Dlg(CWnd* pParent = nullptr); afx_msg void OnBnClickedBtnExit(); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); #ifdef AFX_DESIGN_TIME enum { IDD = IDD_OOPLAB3_DIALOG }; #endif protected: virtual void DoDataExchange(CDataExchange* pDX); HICON m_hIcon; CSliderCtrl sbWidth; CPoint *prevPos; CClientDC *dc; CPen *pen; virtual BOOL OnInitDialog(); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); DECLARE_MESSAGE_MAP() };
d317fad5ef971cba09d999f5bfb4504937d232b6
a75695a7a3d10777cea9e12fa46dc1cc62ce44f1
/WEEK5/ques4.cpp
5459a85a3b57e90249ef46aa39d1c4c3c4586619
[]
no_license
nandita-manchikanti/DAA-lab-codes
2ff91f39345d44c4fb80bd1179fe0073e7393833
6c6d11891cb67f4055f05478b1dfbec92e61e3e7
refs/heads/main
2023-04-16T05:21:33.157792
2021-05-06T05:27:46
2021-05-06T05:27:46
364,791,635
1
0
null
null
null
null
UTF-8
C++
false
false
1,470
cpp
ques4.cpp
#include<iostream> using namespace std; class sorting { public: int binarySearch(int a[], int item, int low, int high); }; class operations : public sorting{ public: void insertionsort(int arr[],int n); void printarray(int array[],int n); }; void operations::printarray(int array[],int n) { cout<<"The sorted array is :"<<endl; for(int i=0;i<n;i++) { cout<<array[i]<<endl; } } int sorting::binarySearch(int a[], int item, int low, int high) { if (high <= low) return (item > a[low]) ? (low + 1) : low; int mid = (low + high) / 2; if (item == a[mid]) return mid + 1; if (item > a[mid]) return binarySearch(a, item, mid + 1, high); return binarySearch(a, item, low, mid - 1); } void operations::insertionsort(int array[],int n) { for(int i=0;i<n;i++) { int j=i-1; int selected=array[i]; int loc=binarySearch(array,selected,0,j); while(j>=loc) { array[j+1]=array[j]; j--; } array[j+1]=selected; } } int main() { operations obj; int n; cout<<"Enter the size of array :"<<endl; cin>>n; int array[n]; cout<<"Enter the elements of array :"<<endl; for(int i=0;i<n;i++) { cin>>array[i]; } obj.insertionsort(array,n); obj.printarray(array,n); return 0; }
e1a241b9d2ad91165915c544c8acbe838f6b0bcd
a5771d30a850d6b24932913eda102d50baffc07a
/test_three.h
2e0211db0cbf9b868a516a247acf8e4c8bbdf357
[]
no_license
PathfinderTJU/CSAPP_ex01
3a4f4228abf17a0dc89ad666991468dfce0f05ad
a5d7f497d8c3b7e6eef811576a58388f45229201
refs/heads/master
2020-05-14T01:25:33.276137
2019-04-16T12:26:42
2019-04-16T12:26:42
181,684,584
0
0
null
null
null
null
UTF-8
C++
false
false
269
h
test_three.h
#ifndef TEST_THREE_H_INCLUDED #define TEST_THREE_H_INCLUDED #include <iostream> class Test3{ public: void normalized(float* f); void Denomalized(float* f); void nan(float* f); void Infinity(float* f); }; #endif // TEST_THREE_H_INCLUDED
39ab106ad10020e16ac0dc415f3d5eeaa4ec1a73
057a475216e9beed41983481aafcaf109bbf58da
/base/poco/XML/include/Poco/XML/Content.h
012ac5333c9bb519bf37f612b9b6186e9fcbee08
[ "BSL-1.0", "Apache-2.0" ]
permissive
ClickHouse/ClickHouse
fece5204263a5b4d693854b6039699265f1bb27f
6649328db809d51a694c358571539bc5820464be
refs/heads/master
2023-08-31T18:48:36.615225
2023-08-31T17:51:24
2023-08-31T17:51:24
60,246,359
23,878
5,449
Apache-2.0
2023-09-14T20:10:52
2016-06-02T08:28:18
C++
UTF-8
C++
false
false
1,172
h
Content.h
// // Content.h // // Library: XML // Package: XML // Module: Content // // Definition of the Content enum. // // Copyright (c) 2015, Applied Informatics Software Engineering GmbH. // and Contributors. // // Based on libstudxml (http://www.codesynthesis.com/projects/libstudxml/). // Copyright (c) 2009-2013 Code Synthesis Tools CC. // // SPDX-License-Identifier: BSL-1.0 // #ifndef XML_Content_INCLUDED #define XML_Content_INCLUDED namespace Poco { namespace XML { struct Content /// XML content model. C++11 enum class emulated for C++98. /// /// element characters whitespaces notes /// Empty no no ignored /// Simple no yes preserved content accumulated /// Complex yes no ignored /// Mixed yes yes preserved { enum value { Empty, Simple, Complex, Mixed }; Content(value v) : _v(v) { } operator value() const { return _v; } private: value _v; }; } } // namespace Poco::XML #endif // XML_Content_INCLUDED
219705cfa95eca89fb97d8771bf37557563dd07b
13c80c3d048b5267d3ba7803706b43155751b429
/Archive/hdu/2015 Astar Contest - Round 2A/hdu5249-3.cpp
26f3b870e1a937433264e8b8ca98f7b8ab4ba8a3
[]
no_license
contropist/CodeWorld
d0938f0031ca1f4e3b86e104b2538a60e43e49a8
7723f67073afdb2cd2626a45401c3146aebfd53d
refs/heads/master
2022-03-09T08:07:16.023970
2016-08-09T10:07:20
2016-08-09T10:07:20
null
0
0
null
null
null
null
UTF-8
C++
false
false
986
cpp
hdu5249-3.cpp
//@ Including Header #include <csl_std.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> /* * Name : hdu5249-3.cpp * Date : 2015年8月8日 上午9:53:05 * Copyright : fateud.com * Anti-Mage : The magic ends here. */ typedef __gnu_pbds::tree< int, __gnu_pbds ::null_type, std::less<int>, __gnu_pbds ::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update, std::allocator<char>> rb_tree; //@ Main Function int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); int _, __ = 1; for(int n; cin >> n; --_, ++__) { std::cout << "Case #" << __ <<":\n"; rb_tree p; std::queue<int> q; while (n--) { char s[10]; cin >> s; int x; switch (s[0]) { case 'i': cin >> x; q.push(x), p.insert(x); break; case 'o': x = q.front(), q.pop(), p.erase(x); break; case 'q': cout << *p.find_by_order(p.size()/2) << '\n'; break; } } } return 0; }
be2a7e043f3c97e00ca3a8b1bfc21d72c8519a21
eec6fc365c7415835b4a69eaceb23a224f2abc47
/BaekJoon/2020/데이트 (1296번) pq_ver .cpp
596dafaa6024bd06ef17e037744f93f7585d3e4d
[]
no_license
chosh95/STUDY
3e2381c632cebecc9a91e791a4a27a89ea6491ea
0c88a1dd55d1826e72ebebd5626d6d83665c8431
refs/heads/master
2022-04-30T23:58:56.228240
2022-04-18T13:08:01
2022-04-18T13:08:01
166,837,216
3
1
null
2019-06-20T10:51:49
2019-01-21T15:32:03
C++
UTF-8
C++
false
false
998
cpp
데이트 (1296번) pq_ver .cpp
#include <iostream> #include <queue> #include <string> #include <algorithm> using namespace std; int N; string origin; int l, o, v, e; struct cmp { bool operator()(pair<int, string> a, pair<int, string> b) { if (a.first == b.first) return a.second > b.second; return a.first <= b.first; } }; int main() { cin >> origin; for (int i = 0; i < origin.size(); i++) { if (origin[i] == 'L') l++; if (origin[i] == 'O') o++; if (origin[i] == 'V') v++; if (origin[i] == 'E') e++; } cin >> N; priority_queue<pair<int, string>, vector<pair<int, string>>, cmp> q; while (N--) { int tmpL = l, tmpO = o, tmpV = v, tmpE = e; string str; cin >> str; for (int i = 0; i < str.size(); i++) { if (str[i] == 'L') tmpL++; if (str[i] == 'O') tmpO++; if (str[i] == 'V') tmpV++; if (str[i] == 'E') tmpE++; } int res = ((tmpL + tmpO) * (tmpL + tmpV) * (tmpL + tmpE) * (tmpO + tmpV) * (tmpO + tmpE) * (tmpV + tmpE)) % 100; q.push({ res, str }); } cout << q.top().second; }
de8924ff8b626ce39a45dedc1f3e61e39cc2bd5d
2c0597600a0fa91343e34f61f818e4f2e298ce5d
/milestones/MS5/Perishable.cpp
ba78d01125733f7cba4e6462b21b6a670c9f60e8
[]
no_license
jayson528/OOP244
045e8758446dbc65da500ca929b79eff9235aab5
0507d27e3b708ad143ea22a8e0e30bd4dc351267
refs/heads/master
2021-10-10T09:04:12.786424
2019-01-08T17:09:29
2019-01-08T17:09:29
164,696,407
0
0
null
null
null
null
UTF-8
C++
false
false
1,757
cpp
Perishable.cpp
#include <iomanip> #include <iostream> #include <fstream> #include <cstring> #include "Perishable.h" #include "Date.h" using namespace std; namespace AMA { Perishable::Perishable() : Product('P') { } std::fstream& Perishable::store(std::fstream& file, bool newLine) const { Product::store(file, !(newLine)); file << ","; expiryDate.write(file); if (newLine) { file << endl; } return file; } std::fstream& Perishable::load(std::fstream& file) { Product::load(file); expiryDate.read(file); file.get(); return file; } std::ostream& Perishable::write(std::ostream& os, bool linear) const { Product::write(os, linear); if (Product::isClear() && !Product::isEmpty()) { if (linear) { os << expiry(); } else { os << endl << " Expiry date: " << expiry(); } } return os; } std::istream& Perishable::read(std::istream& is) { Date tempDate; Product::read(is); if (isClear()){ cout << " Expiry date (YYYY/MM/DD): "; tempDate.read(is); switch (tempDate.errCode()) { case 0: break; case 1: Product::message("Invalid Date Entry"); is.std::istream::setstate(std::ios::failbit); break; case 2: Product::message("Invalid Year in Date Entry"); is.std::istream::setstate(std::ios::failbit); break; case 3: Product::message("Invalid Month in Date Entry"); is.std::istream::setstate(std::ios::failbit); break; case 4: Product::message("Invalid Day in Date Entry"); is.std::istream::setstate(std::ios::failbit); break; } } this->expiryDate = tempDate; return is; } const Date& Perishable::expiry() const { return expiryDate; } }
93a50a7b32270d461bfb28ed4c94d72e9848d1c9
a47e52cfba6561edddf535b6675a5294a3630906
/include/entities/Response.h
6da11490317ee2d6ebfbf3a3ab5d1ff28b603a8a
[ "MIT" ]
permissive
KonstantinPronin/task-manager
9fdbd1023e6577a38231165588ea47bb8b7eff61
dc59ed5994b3cf04ae6f69748894e378e5713fc2
refs/heads/master
2020-12-29T08:43:03.549073
2020-07-06T12:22:05
2020-07-06T12:22:05
238,540,595
0
0
MIT
2020-07-06T12:22:06
2020-02-05T20:20:32
null
UTF-8
C++
false
false
900
h
Response.h
#ifndef TASK_MANAGER_RESPONSE_H #define TASK_MANAGER_RESPONSE_H #include <vector> #include <memory> #include "Entity.h" #include "Project.h" #include "Task.h" #include "User.h" enum class responseMode { SUCCESSFULL_AUTHORIZATION, SUCCESSFULL_DEAUTHORIZATION, PRINT }; enum class responseCode { _EMPTY, TASK, PROJECT, USER, TASK_LIST, PROJECT_LIST, USER_LIST }; class Response { private: public: Response() : isError(false), code(responseCode::_EMPTY), errorBody("") {} responseMode mode; responseCode code; bool isError; std::string errorBody; std::shared_ptr<Project> project; std::shared_ptr<std::vector<Project>> projects; std::shared_ptr<User> user; std::shared_ptr<std::vector<User>> users; std::shared_ptr<Task> task; std::shared_ptr<std::vector<Task>> tasks; }; #endif //TASK_MANAGER_RESPONSE_H
1986130f06f967bbb2a22ed2488b0f8e36a09d79
3fa0123c9fa6d3a3f0e041c172e74a4c096aeff9
/include/SideStack.h
1a89c50966017fc1f72b8aa9fcebe69f6c485aba
[ "Apache-2.0" ]
permissive
weliveindetail/sidestack
208ea07175b2ff120926bcc5df5824692d99998b
d578a9c8bba8c9df29d75e574246c0c4f93dca1b
refs/heads/master
2021-01-22T08:48:27.419444
2014-04-15T23:56:44
2014-04-15T23:56:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
552
h
SideStack.h
#pragma once #include <functional> class SideStack { public: SideStack(); ~SideStack(); void executeOnSideStack(std::function<void()> func); void switchStacks(); private: void *m_storedBP; void *m_storedSP; std::function<void()> m_continuationFunction; void *m_stackTop; void *m_stackBottom; char *m_baseAddress; size_t m_totalSize; bool allocSideStack(); void deallocSideStack(); size_t getVirtualMemoryPageSize() const; enum class CallingMode; void handle(CallingMode mode); //void tryCatchWrapper(); };
558adea1c1feb41b6ffb19a2f0dbc81d8715a187
a5326af130d8c0f3138282e0e8f84704d662e341
/library/video_transforms/normalized_cross_correlation.h
5dc6c67507f77fa5151275f34a2d7c6d23889451
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
daniel-riehm/burn-out
98b75739400f981f7509a966da4bf449e3397a38
1d2afcd36d37127b5a3b6fa3f60bc195408ab3ea
refs/heads/master
2022-03-05T12:25:59.466369
2019-11-15T01:37:47
2019-11-15T01:37:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,453
h
normalized_cross_correlation.h
/*ckwg +5 * Copyright 2012-2015 by Kitware, Inc. All Rights Reserved. Please refer to * KITWARE_LICENSE.TXT for licensing information, or contact General Counsel, * Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065. */ #ifndef VIDTK_VIDEO_NORMALIZED_CROSS_CORRELATION_H #define VIDTK_VIDEO_NORMALIZED_CROSS_CORRELATION_H #include "vil_for_each.h" #include <boost/accumulators/accumulators.hpp> #include <boost/accumulators/statistics/mean.hpp> #include <boost/accumulators/statistics/stats.hpp> #include <boost/accumulators/statistics/variance.hpp> namespace vidtk { // vil_algo "implements" this algorithm, but not properly. /* * \frac{1}{n} \sum_{x,y} (\frac{(f(x,y)-\bar{f})(t(x,y)-\bar{t})}{\sigma_f\sigma_t}) */ namespace detail { typedef double stat_t; typedef boost::accumulators::accumulator_set<stat_t, boost::accumulators::stats < boost::accumulators::tag::mean , boost::accumulators::tag::variance(boost::accumulators::immediate) > > nxcorr_stats_t; template <typename SrcT, typename KernelT, typename AccumT> struct correlation_functor { correlation_functor(stat_t src_mean_, stat_t src_stdev_, stat_t kernel_mean_, stat_t kernel_stdev_) : src_mean(src_mean_) , kernel_mean(kernel_mean_) , stdev(kernel_stdev_ * src_stdev_) { } void operator () (SrcT s, KernelT k) { stats((s - src_mean) * (k - kernel_mean)); } AccumT sum() const { return boost::accumulators::sum(stats) / stdev; } typedef boost::accumulators::accumulator_set<AccumT, boost::accumulators::stats < boost::accumulators::tag::sum > > corr_stats_t; stat_t const src_mean; stat_t const kernel_mean; stat_t const stdev; corr_stats_t stats; }; template <typename SrcT, typename KernelT, typename AccumT> inline AccumT normalized_cross_correlation_px(vil_image_view<SrcT> const& src, vil_image_view<KernelT> const& kernel, stat_t kernel_stdev, stat_t kernel_mean) { nxcorr_stats_t src_stats; src_stats = vil_for_each(src, src_stats); stat_t const src_stdev = std::sqrt(boost::accumulators::variance(src_stats)); stat_t const src_mean = boost::accumulators::mean(src_stats); typedef correlation_functor<SrcT, KernelT, AccumT> correlation_functor_t; correlation_functor_t corr_func(src_mean, src_stdev, kernel_mean, kernel_stdev); correlation_functor_t const result(vil_for_each_2(src, kernel, corr_func)); return result.sum(); } } template <typename SrcT, typename DestT, typename KernelT, typename AccumT> inline void normalized_cross_correlation(vil_image_view<SrcT> const& src, vil_image_view<DestT>& dest, vil_image_view<KernelT> const& kernel, AccumT const&) { size_t const sni = src.ni(); size_t const snj = src.nj(); size_t const kni = kernel.ni(); size_t const knj = kernel.nj(); size_t const knp = kernel.nplanes(); if ((sni < kni) || (snj < knj)) { // The caller must handle that dest is not modified. return; } size_t const dni = 1 + sni - kni; size_t const dnj = 1 + snj - knj; assert(src.nplanes() == knp); assert(dni > 0); assert(dnj > 0); detail::nxcorr_stats_t kernel_stats; kernel_stats = vil_for_each(kernel, kernel_stats); detail::stat_t const kernel_stdev = std::sqrt(boost::accumulators::variance(kernel_stats)); detail::stat_t const kernel_mean = boost::accumulators::mean(kernel_stats); dest.set_size(dni, dnj, 1); ptrdiff_t const d_i = dest.istep(); ptrdiff_t const d_j = dest.jstep(); ptrdiff_t const s_i = src.istep(); ptrdiff_t const s_j = src.jstep(); ptrdiff_t const s_p = src.planestep(); size_t const ksz = kernel.size(); SrcT const* sr = src.top_left_ptr(); DestT* dr = dest.top_left_ptr(); for (size_t j = 0; j < dnj; ++j, sr += s_j, dr += d_j) { SrcT const* sp = sr; DestT* dp = dr; for (size_t i = 0; i < dni; ++i, sp += s_i, dp += d_i) { vil_image_view<SrcT> const src_view(src.memory_chunk(), sp, kni, knj, knp, s_i, s_j, s_p); *dp = DestT(detail::normalized_cross_correlation_px<SrcT, KernelT, AccumT>(src_view, kernel, kernel_stdev, kernel_mean) / ksz); } } } } #endif // VIDTK_VIDEO_NORMALIZED_CROSS_CORRELATION_H
9fe05516cd4451aca7254a3ad271481506bd9a47
fbd349d3027424aaa4c7d329979ea45e8cf76dc5
/uap/uap_planner.h
04edb5714f70093001d69563eb88fc104f582576
[]
no_license
computerex/uap
0faad63552457971d9d69aea0e488585a1701839
a75503a4d0985214be0b840f30ddc3dc389dfa81
refs/heads/main
2023-03-18T15:20:32.976199
2020-12-23T21:38:10
2020-12-23T21:38:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
929
h
uap_planner.h
//#######################################################################################// //UAP planner MFD, Made by Artlav in 2011 //I don't remember WTF that was supposed to be //#######################################################################################// #define pages 3 //#######################################################################################// class uap_planner_mfd:public MFD{ public: uap_planner_mfd(DWORD w,DWORD h,VESSEL *vessel); ~uap_planner_mfd(); char *ButtonLabel(int bt); int ButtonMenu(const MFDBUTTONMENU **menu)const; bool ConsumeButton(int bt,int event); bool ConsumeKeyBuffered(DWORD key); void Update(HDC hDC); static int MsgProc(UINT msg, UINT mfd, WPARAM wparam, LPARAM lparam); void get_tgt(); void do_enter(int n); bool do_set(char *nam); int mfd_seq,scrx,scry; }; //#######################################################################################//
9782e40a9a9809aaea2c3aec012d1f8bbb58fc8c
67e54f80489e796b7653cfefcdd410c7ada1d152
/08. String to Integer (atoi).cpp
57c0246d22eaebcbe3cb293071ce4646229becc3
[]
no_license
nerdsquirrel/Leetcode-submissions
df81e88d23db6d6b24f65f5f14b5eb0e2c2ed736
550ce4a141ea740bb43d458da87d94c3d396c0eb
refs/heads/master
2021-01-17T14:00:31.865018
2020-10-05T12:50:27
2020-10-05T12:50:27
57,905,939
0
1
null
null
null
null
UTF-8
C++
false
false
222
cpp
08. String to Integer (atoi).cpp
class Solution { public: int myAtoi(string str) { string t; t=str; if(t=="") t="0"; stringstream s; int i; s<<t; s>>i; return i; } };
1c2358a516cf412d8757abf5b89d99f744d16429
37465aa1e5400f480e9a9a162ae42cd580e2ed97
/3D Renderer/gameobjects/Items.cpp
1019de4da72fc099ba7f03a1d3492efd0a0fa4e5
[]
no_license
zveale/projects
eafbf9a5c336a84f2005308f794936c0e27d954a
b5f3427dd0d3064a6c20b0d5c9556e24192352c0
refs/heads/master
2023-02-10T23:34:11.625587
2021-01-06T18:48:58
2021-01-06T18:48:58
265,102,541
0
0
null
null
null
null
UTF-8
C++
false
false
5,151
cpp
Items.cpp
#include <string> #include <cctype> #include "Items.h" #include "assimp\Importer.hpp" #include "assimp\scene.h" #include "GameObject.h" #include "StaticModel.h" #include "glm\vec3.hpp" #include "glm\mat4x4.hpp" #include "glm\mat3x3.hpp" #include "glm\gtx\transform.hpp" Items::Items() : GameObject() { for (int i = 0; i < numItems; ++i) { sceneMatrix[i] = glm::mat4(0.0f); inventoryMatrix[i] = glm::mat4(0.0f); slotMatrix[i] = glm::mat4(0.0f); } } void Items::Load() { models[0].LoadModel("../files/asset/items/0_item.dae"); models[1].LoadModel("../files/asset/items/1_item.dae"); models[2].LoadModel("../files/asset/items/2_item.dae"); models[3].LoadModel("../files/asset/items/3_item.dae"); for (int i = 0; i < numItems; ++i) staticModels[i] = &models[i]; ids[0] = "0_item"; ids[1] = "1_item"; ids[2] = "2_item"; ids[3] = "3_item"; LoadMatrices("../files/asset/items/item_matrices.dae"); state[0] = STATE::SCENE; state[1] = STATE::SCENE; state[2] = STATE::SCENE; state[3] = STATE::SCENE; currentMatrix[0] = &sceneMatrix[0]; currentMatrix[1] = &sceneMatrix[1]; currentMatrix[2] = &sceneMatrix[2]; currentMatrix[3] = &sceneMatrix[3]; } void Items::Update(float dt) { } void Items::Draw(ShaderProgram& shaderProgram, const glm::mat4& projectionMatrix, const glm::mat4& viewMatrix, const int index) { const glm::mat4 modelViewMatrix = viewMatrix * *currentMatrix[index]; const glm::mat4 viewProjectionMatrix = projectionMatrix * glm::mat4(glm::mat3(viewMatrix)); const glm::mat3 normalMatrix = glm::transpose(glm::inverse(glm::mat3(*currentMatrix[index]))); const glm::mat4 modelViewProjectionMatrix = projectionMatrix * modelViewMatrix; shaderProgram.SetUniformMat4("modelMatrix", *currentMatrix[index]); shaderProgram.SetUniformMat3("normalMatrix", normalMatrix); shaderProgram.SetUniformMat4("viewMatrix", viewMatrix); shaderProgram.SetUniformMat4("projectionMatrix", projectionMatrix); shaderProgram.SetUniformMat4("viewProjectionMatrix", viewProjectionMatrix); shaderProgram.SetUniformMat4("modelViewProjectionMatrix", modelViewProjectionMatrix); shaderProgram.SetUniformBool("isAnimated", false); models[index].Draw(); } void Items::Delete() {} void Items::SendShaderData(ShaderProgram& shaderProgram, const int index) {} const unsigned Items::NumElements() { return numItems; } /* Pickup item at index. If it is in scene move to invetory(render item underneath scene), if the item is in the inventory move it into its final scene location. */ void Items::PickupItem(int index) { if (state[index] == STATE::SCENE && numItemsInInventory != MAX_INVENTORY_ITEMS) { state[index] = STATE::INVENTORY; currentMatrix[index] = &inventoryMatrix[index]; ++numItemsInInventory; if (numItemsInInventory == MAX_INVENTORY_ITEMS) lastItemIndex = index; } else if (state[index] == STATE::SCENE && numItemsInInventory == MAX_INVENTORY_ITEMS) { state[index] = STATE::INVENTORY; currentMatrix[index] = &inventoryMatrix[index]; state[lastItemIndex] = STATE::SCENE; sceneMatrix[lastItemIndex] = sceneMatrix[index]; currentMatrix[lastItemIndex] = &sceneMatrix[lastItemIndex]; lastItemIndex = index; } else if (state[index] == STATE::INVENTORY) { state[index] = STATE::SLOT; currentMatrix[index] = &slotMatrix[index]; --numItemsInInventory; } } const glm::mat4* Items::GetCurrentMatrix(const int index) const { return currentMatrix[index]; } void Items::LoadMatrices(std::string path) { Assimp::Importer importer; const aiScene* scene = importer.ReadFile(path, NULL); if (!scene || !scene->mRootNode) { printf("Error loading shadows!\n Error message: %s\n", importer.GetErrorString()); return; } ProcessSceneGraph(scene->mRootNode, scene); } void Items::ProcessSceneGraph(aiNode* node, const aiScene* scene) { for (unsigned i = 0; i < node->mNumChildren; i++) { CreateItem(node->mChildren[i], scene); ProcessSceneGraph(node->mChildren[i], scene); } } void Items::CreateItem(const aiNode* node, const aiScene* scene) { std::string name = node->mName.C_Str(); glm::mat4 rotationCorrection = glm::rotate(glm::radians(-90.0f), glm::vec3(1.0f, 0.0f, 0.0f)); glm::mat4 transform = Cast_aiMat4ToGlmMat4(node->mTransformation); glm::mat4 model = rotationCorrection * transform * glm::inverse(rotationCorrection); if (std::isdigit(name[0])) { int index = name[0] - '0'; if (name.find("scene") != std::string::npos) sceneMatrix[index] = model; else if (name.find("inventory") != std::string::npos) inventoryMatrix[index] = model; else if (name.find("slot") != std::string::npos) slotMatrix[index] = model; } } glm::mat4 Items::Cast_aiMat4ToGlmMat4(const aiMatrix4x4& ai_matr) { return glm::mat4( ai_matr.a1, ai_matr.b1, ai_matr.c1, ai_matr.d1, ai_matr.a2, ai_matr.b2, ai_matr.c2, ai_matr.d2, ai_matr.a3, ai_matr.b3, ai_matr.c3, ai_matr.d3, ai_matr.a4, ai_matr.b4, ai_matr.c4, ai_matr.d4); } glm::vec3 Items::Cast_aiVec3DToGlmVec3(const aiVector3D& aiVec) { return glm::vec3(aiVec.x, aiVec.y, aiVec.z); }
77240a8422b75c234d723c5f5966f1018dbda30e
9c5e3a071788a1717e370dc0595afbce2c125aa3
/libraries/USBSerial/USBSerial.cpp
68443dbad4f90915969ee10e3afbd23a7440db5f
[]
no_license
wllis/framework-arduino-gd32v
34d13c30db38c3aa71c855f3500d61c50396f4f0
5752c87923d3a37989a7d7a73c2aae2e4f6b972c
refs/heads/master
2023-03-16T02:06:09.894210
2020-11-28T18:02:38
2020-11-28T18:02:38
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,723
cpp
USBSerial.cpp
// USB Serial code #if defined (USBCON) && (USBD_USE_CDC) #include "USBSerial.h" #include "CDC.h" #include "RingBuffer.h" extern "C" uint8_t packet_receive; USBSerial SerialUSB; #define RX_BUFFER_SIZE 1024 RingBufferN<RX_BUFFER_SIZE> rx_buffer; void USBSerial::begin(void) { CDC_Init(); rx_buffer.clear(); } void USBSerial::begin(uint32_t /* baud_count */) { // uart config is ignored in USB-CDC begin(); } void USBSerial::begin(uint32_t /* baud_count */, uint8_t /* config */) { // uart config is ignored in USB-CDC begin(); } void USBSerial::end() { CDC_deInit(); } #if 0 int USBSerial::availableForWrite() { // Just transmit queue size, available for write return static_cast<int>(CDC_TransmitQueue_WriteSize(&TransmitQueue)); } #endif size_t USBSerial::write(uint8_t ch) { // Just write single-byte buffer. return write(&ch, 1); } size_t USBSerial::write(const uint8_t *buffer, size_t size) { return write((uint8_t*) buffer, size); } size_t USBSerial::write(uint8_t *buffer, size_t size) { size_t rest = size; if (packet_receive) available(); // check for read before write return CDC_write(buffer, size); return size - rest; } int USBSerial::available(void) { uint8_t tbuf[64]; size_t rlen; rlen = CDC_recv(tbuf); // read any new data if (rlen) { for (size_t i=0; i< rlen; i++) rx_buffer.store_char(tbuf[i]); // write to ring }; return rx_buffer.available(); } int USBSerial::read(void) { return rx_buffer.read_char(); } size_t USBSerial::readBytes(char *buffer, size_t length) { uint16_t nread = 0; while ((this->available() > 0) && (nread < length)) { *buffer++ = rx_buffer.read_char(); nread++; } return nread; } size_t USBSerial::readBytesUntil(char terminator, char *buffer, size_t length) { uint16_t nread = 0; char c; while ((this->available() > 0) && (nread < length)) { c = rx_buffer.read_char(); if (c == terminator) break; *buffer++ = c; nread++; } return nread; } int USBSerial::peek(void) { return rx_buffer.peek(); } void USBSerial::flush(void) { // Wait for TransmitQueue read size becomes zero // TS: safe, because it not be stopped while receive 0 // while (CDC_TransmitQueue_ReadSize(&TransmitQueue) > 0) {} } uint32_t USBSerial::baud() { return 115200; } uint8_t USBSerial::stopbits() { return ONE_STOP_BIT; } uint8_t USBSerial::paritytype() { return NO_PARITY; } uint8_t USBSerial::numbits() { return 8; } bool USBSerial::dtr(void) { return false; } bool USBSerial::rts(void) { return false; } USBSerial::operator bool() { bool result = false; #if 0 if (lineState == 1) { result = true; } #endif // delay(10); return result; } #endif
a39ed609596af5763cd0c27cb4df6f0f02869ee8
37b707c2f9a9daf55b411f5929a7ed7a70c5e4ff
/findscreen.cpp
284edd0d1eea7ac65307fd54578739f4cf0944ba
[]
no_license
e173101/JumpOneJumpCheat
d6f38a93f06e160845e09f4ebbbdda2e1a4aa8a7
8a20fa62e31c0645a84efcc2caddc5be74dadb3e
refs/heads/master
2020-03-09T08:39:16.318807
2018-06-03T06:49:35
2018-06-03T06:49:35
128,694,320
0
0
null
null
null
null
UTF-8
C++
false
false
3,544
cpp
findscreen.cpp
//Lai Yongtian //2018-3-29 #include "findscreen.h" #include <QtCore> #include <opencv2/opencv.hpp> using namespace std; using namespace cv; #define IPHONESEX (640.0/2) #define IPHONESEY (1136.0/2) FindScreen::FindScreen() { } bool isIPhoneScreen(RotatedRect rotatedRect, Point2f p[], Point2f screenCenter) { Point2f p_t[4]; //find three point in 1,2,3 phase rotatedRect.points(p_t); int index[3]={4,4,4}; for(int i=0;i<4;i++) { if((p_t[i]-screenCenter).x < 0 && \ (p_t[i]-screenCenter).y < 0 ) index[0]=i; if((p_t[i]-screenCenter).x > 0 && \ (p_t[i]-screenCenter).y < 0 ) index[1]=i; if((p_t[i]-screenCenter).x > 0 && \ (p_t[i]-screenCenter).y > 0 ) index[2]=i; } for(int i=0;i<3;i++) { if(index[i]==4) return false; p[i]=p_t[index[i]]; } //find is it an iphone double a=((p[0]-p[1]).x)*((p[0]-p[1]).x)+((p[0]-p[1]).y)*((p[0]-p[1]).y); double b=((p[1]-p[2]).x)*((p[1]-p[2]).x)+((p[1]-p[2]).y)*((p[1]-p[2]).y); double ratioOfScreen = a/b; if(abs(ratioOfScreen - (IPHONESEX*IPHONESEX)/(IPHONESEY*IPHONESEY))<0.2 ||\ abs(ratioOfScreen - (IPHONESEY*IPHONESEY)/(IPHONESEX*IPHONESEX))<0.2 ) { qDebug("%f",ratioOfScreen); return true; } return false; } //return the warp mat and size that you can warp it Mat FindScreen::find(Mat mat) { //mat->screen int rows = mat.rows, cols = mat.cols; Point2f screenCenter(cols/2,rows/2); Mat gray,edges,black; vector<vector<Point> > contours; vector<Vec4i> hierarchy; //vector<RotatedRect> rects; Point2f screenCorners[4]; Point2f dstTri[3]; screenCorners[0]=Point2f(0,0); screenCorners[1]=Point2f(cols,0); screenCorners[2]=Point2f(cols,rows); screenCorners[3]=Point2f(0,rows); black = Mat::zeros(rows,cols, CV_8U); screen = Mat::zeros(IPHONESEY,IPHONESEX, CV_8UC3); cvtColor(mat, gray, CV_BGR2GRAY); GaussianBlur(gray, gray, Size(5, 5),0); Canny(gray,edges,100,200); findContours(edges,contours,hierarchy,CV_RETR_TREE,CV_CHAIN_APPROX_SIMPLE); for(uint i=0;i <hierarchy.size();i++) { if(hierarchy[i][1]==-1) //Only the last child was needed { RotatedRect tempRect; //qDebug("%d,%d,%d,%d",hierarchy[i][0],hierarchy[i][1],hierarchy[i][2],hierarchy[i][3]); //drawContours(black,contours,i,255,1); tempRect=minAreaRect(contours[i]); if(isIPhoneScreen(tempRect, screenCorners,screenCenter)) { //Drow line(mat,screenCorners[0],screenCorners[1],150,10); line(mat,screenCorners[1],screenCorners[2],500,10); //qDebug("(%f,%f),(%f,%f),(%f,%f)",screenCorners[0].x,screenCorners[0].y,screenCorners[1].x,screenCorners[1].y,screenCorners[2].x,screenCorners[2].y); break; } } } dstTri[0] = Point2f( IPHONESEX,0 ); dstTri[1] = Point2f (IPHONESEX,IPHONESEY); dstTri[2] = Point2f(0,IPHONESEY); warp = getAffineTransform(screenCorners,dstTri); warpAffine(mat, screen, warp, screen.size()); // if(mat.data) // imshow("asdf",black); return warp; } //Make sure after find screen you got the warp Mat FindScreen::getScreen(Mat mat) { if(warp.data && screen.data) { warpAffine(mat, screen, warp, screen.size()); return screen; } return mat; }
3245280793df79a4f5b5e7b3e819a2260151c553
b8cf17aa729db87929bc3ae00656e73689be77af
/Module3/Task4/main.cpp
126f43bb6364a35c1d7f35b25f17ca0b9f5418fc
[]
no_license
egozverev/MIPT_2sem_ALGORITHM_CPP
6a2210cb035ce670e5acf2e615cc69567f43a068
70b249ccfcd23c186917dd960005033a1b67449e
refs/heads/master
2020-04-22T06:18:06.492462
2019-12-14T14:26:40
2019-12-14T14:26:40
170,186,036
0
0
null
null
null
null
UTF-8
C++
false
false
6,488
cpp
main.cpp
#include "matrix_graph.h" #include <algorithm> #include <iostream> #include <limits> #include <queue> void FillGraph(CMatrixGraph &graph, unsigned int edgeNumber) { for (int i = 0; i < edgeNumber; ++i) { int from, to, distance; std::cin >> from >> to >> distance; --from; --to; graph.AddEdge(from, to, distance); } } CMatrixGraph GetResidualNetwork(const CMatrixGraph &graph, const CMatrixGraph &flow) { // Получить дополняющую сеть CMatrixGraph resGraph(graph.VerticesCount()); for (int first = 0; first < graph.VerticesCount(); ++first) { for (int second = 0; second < graph.VerticesCount(); ++second) { if (first == second) { continue; } resGraph.AddEdge(first, second, graph.GetEdgeLength(first, second) - flow.GetEdgeLength(first, second)); } } return resGraph; } CMatrixGraph GetAuxiliaryNetwork(const CMatrixGraph &graph) { //получить вспомогательную ( слоистую ) сеть std::vector<int> level(graph.VerticesCount(), std::numeric_limits<int>::max()); std::queue<int> vertices; vertices.push(0); level[0] = 0; while (!vertices.empty()) { int current = vertices.front(); vertices.pop(); std::vector<std::pair<int, int>> next; graph.GetNextVertices(current, next); for (std::pair<int, int> edge: next) { int to = edge.second; if (level[to] > level[current] + 1) { level[to] = level[current] + 1; vertices.push(to); } } } CMatrixGraph auxGraph(graph.VerticesCount()); for (int first = 0; first < graph.VerticesCount(); ++first) { std::vector<std::pair<int, int>> next; graph.GetNextVertices(first, next); for (std::pair<int, int> second: next) { int to = second.second; if (level[to] == level[first] + 1) { auxGraph.AddEdge(first, to, second.first); } } } return auxGraph; } int dfs(int from, int curFlow, std::vector<int> &firstExistingSon, const CMatrixGraph &graph, CMatrixGraph &flow) { if (!curFlow) { return 0; } if (from == graph.VerticesCount() - 1) { return curFlow; } std::vector<std::pair<int, int> > next; graph.GetNextVertices(from, next); for (int i = firstExistingSon[from]; i < next.size(); ++i) { std::pair<int, int> vertex = next[i]; int givenFlow = dfs(vertex.second, std::min(curFlow, vertex.first - flow.GetEdgeLength(from, vertex.second)), firstExistingSon, graph, flow); if (!givenFlow) { ++firstExistingSon[from]; continue; } flow.ChangeEdgeLength(from, vertex.second, flow.GetEdgeLength(from, vertex.second) + givenFlow); flow.ChangeEdgeLength(vertex.second, from, flow.GetEdgeLength(vertex.second, from) - givenFlow); return givenFlow; } return 0; } int GetBlockingFlow(CMatrixGraph &graph, CMatrixGraph &blockingFlow) { std::vector<int> firstExistingSon(graph.VerticesCount()); int flowThroughBlockingGraph = 0; int givenFlow = 0; do { givenFlow = dfs(0, std::numeric_limits<int>::max(), firstExistingSon, graph, blockingFlow); flowThroughBlockingGraph += givenFlow; } while (givenFlow > 0); return flowThroughBlockingGraph; } int CalculateMaxFlow(CMatrixGraph &graph) { CMatrixGraph flow(graph.VerticesCount()); int answer = 0; while (true) { CMatrixGraph resGraph = GetResidualNetwork(graph, flow); CMatrixGraph auxGraph = GetAuxiliaryNetwork(resGraph); CMatrixGraph blockingFlow(graph.VerticesCount()); int flowProfit = GetBlockingFlow(auxGraph, blockingFlow); if (!flowProfit) { break; } answer += flowProfit; for (int first = 0; first < graph.VerticesCount(); ++first) { for (int second = 0; second < graph.VerticesCount(); ++second) { flow.ChangeEdgeLength(first, second, flow.GetEdgeLength(first, second) + blockingFlow.GetEdgeLength(first, second)); } } } return answer; } //Код текущей задачи CMatrixGraph CreateBaseTeaGraph(int peopleNumber, int teaNumber) { // Создаёт каркас для графа по входным данным. Пустые рёбра между истоком и голубчиками CMatrixGraph baseGraph(peopleNumber + teaNumber + 2); // 2 фиктивные вершины for (int i = 0; i < teaNumber; ++i) { int currentSortNumber; std::cin >> currentSortNumber; baseGraph.AddEdge(peopleNumber + i + 1, peopleNumber + teaNumber + 1, currentSortNumber); } for (int i = 0; i < peopleNumber; ++i) { int numberOfSorts; std::cin >> numberOfSorts; for (int j = 0; j < numberOfSorts; ++j) { int curSort; std::cin >> curSort; baseGraph.AddEdge(1 + i, peopleNumber + curSort, std::numeric_limits<int>::max()); } } return baseGraph; } bool IsTeaPartyAccepted(int numOfDays, CMatrixGraph baseGraph, int peopleNum) { //нужно именно копирование - на основе базового графа построится текущий. for (int guy = 1; guy <= peopleNum; ++guy) { baseGraph.AddEdge(0, guy, numOfDays); } return (CalculateMaxFlow(baseGraph) == numOfDays * peopleNum); } int CalculateDaysOfTeaParty() { int peopleNumber, teaNumber; std::cin >> peopleNumber >> teaNumber; CMatrixGraph baseGraph = CreateBaseTeaGraph(peopleNumber, teaNumber); const int stock = peopleNumber + teaNumber + 1; // 2 фиктивные вершины - сток и исток int maxNumOfDays = 0; for (int i = peopleNumber + 1; i < baseGraph.VerticesCount() - 1; ++i) { maxNumOfDays += baseGraph.GetEdgeLength(i, stock); } int first = 0; int last = maxNumOfDays + 1; while (first < last - 1) { int mid = last - (last - first)/2; if (IsTeaPartyAccepted(mid, baseGraph, peopleNumber)) { first = mid; } else { last = mid; } } return first; } int main() { std::cout << CalculateDaysOfTeaParty(); }
f89f04e67172ffab88e77ea76b54c389e56cf3bd
2e6f0e68d9b7a3ee072484aacd5dc01b32884da4
/DrawingBuilder/EssaiTextureLib/theMain.cpp
5bc3a9a40316780b38ecfd38d8e83bee25e253e6
[]
no_license
Ikiriss/Drawing-Builder
6c9969975562a44ce774bdba3f7e4aad57004ddf
52854e8ea64ee51921afaf243e6000dc652a7778
refs/heads/master
2021-07-19T01:37:20.525264
2017-10-12T08:36:15
2017-10-12T08:36:15
106,663,936
0
0
null
null
null
null
UTF-8
C++
false
false
2,931
cpp
theMain.cpp
#include <SFML\Graphics.hpp> #include <Box2D\Box2D.h> #include <fstream> #include <iostream> #include <iomanip> #include <string> #include <stdlib.h> #include <math.h> #include <chrono> #include <thread> #include <vector> #include "theMain.h" #include "MenuMainState.h" #include "MenuLevelState.h" #include "State.h" #include "GameState.h" #include "LevelDesignState.h" #include "StatesNames.h" #pragma region VARIABLES static int fps = 60; // Frame Per Second #pragma endregion VARIABLES int theMain() { /** Prepare the window */ sf::RenderWindow window(sf::VideoMode(1200, 1000, 32), "DrawingBuilder"); window.setFramerateLimit(fps); // Create the state stack and initialise with the menuState std::stack<States::stateName> stack; const States::stateName menuState = States::stateName::Menu; stack.push(menuState); MenuMainState mainMenu(window, stack); MenuLevelState levelMenu(window, stack); GameState game(window, stack); LevelDesignState levelConstructor(window, stack); while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { // Close event if (event.type == sf::Event::Closed) window.close(); // Event handler switch (stack.top()) { case States::stateName::Menu : mainMenu.handleEvent(event); break; case States::stateName::LevelMenu : levelMenu.handleEvent(event); break; case States::stateName::Game : if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) { float mouseX = (float)sf::Mouse::getPosition(window).x; float mouseY = (float)sf::Mouse::getPosition(window).y; game.getWorld()->changeBodyPosition(mouseX, mouseY); } game.handleEvent(event); break; case States::stateName::LevelDesignState : if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) { float mouseX = (float)sf::Mouse::getPosition(window).x; float mouseY = (float)sf::Mouse::getPosition(window).y; levelConstructor.getWorld()->changeBodyPosition(mouseX, mouseY); } levelConstructor.handleEvent(event); break; } } // Drawing handler switch (stack.top()) { case States::stateName::Menu: window.clear(); window.setView(window.getDefaultView()); mainMenu.draw(); window.display(); break; case States::stateName::LevelMenu: window.clear(); window.setView(window.getDefaultView()); levelMenu.draw(); window.display(); break; case States::stateName::Game: game.setLevel(levelMenu.getPressedItem() + 1); /* if (!game.getIsLevelAlreadyLoaded()) { game.setIsLevelAlreadyLoaded(true); game.loadLevelInfo(); } */ window.clear(sf::Color::White); window.setView(window.getDefaultView()); game.draw(); window.display(); break; case States::stateName::LevelDesignState: window.clear(sf::Color::White); window.setView(window.getDefaultView()); levelConstructor.draw(); window.display(); break; } } }
9fb2dee91f4a248383a925092d87d52b19e9f7be
244f9ee92c82615c2ed4bb1a777408932de1206d
/day06/ex00/convert.cpp
ef485871eaf2cb99ecabd6766a3c11efe5ca3af5
[]
no_license
AntonKurenov/plus_plus_module
265612bddd4197deaa408a35c0306e0ebaf54be1
629435c359c602e81ab21de6909292520a10ef0c
refs/heads/master
2023-03-31T17:07:28.565579
2021-04-12T16:31:56
2021-04-12T16:31:56
337,382,023
0
0
null
null
null
null
UTF-8
C++
false
false
2,332
cpp
convert.cpp
#include "convert.hpp" void convertToInt(Data); void convertToChar(Data); void convertToFloat(Data); void convertToDouble(Data); void convertToInt(Data data) { int m_int; m_int = static_cast<int>(data.init_val); std::cout << "int: "; if (data.bad_double == 1) { std::cout << "impossible" << std::endl; return ; } if (data.init_val <= std::numeric_limits<int>::max() && data.init_val >=\ std::numeric_limits<int>::min()) { std::cout << m_int << std::endl; return ; } std::cout << "impossible" << std::endl; } void convertToDouble(Data data) { std::cout << "double: "; if (data.bad_double == 1) { std::cout << "impossible" << std::endl; return ; } else { std::cout << data.init_val << std::endl; } } void convertToFloat(Data data) { float m_float; double val = data.init_val; m_float = static_cast<float>(data.init_val); std::cout << "float: "; if (data.bad_double == 1 || val >= std::numeric_limits<float>::max() ||\ val <= std::numeric_limits<float>::min()) { std::cout << "impossible" << std::endl; return ; } if (isnan(data.init_val) || isinf(data.init_val)) { std::cout << static_cast<float>(data.init_val) << "f" << std::endl; return ; } if (data.init_val - static_cast<long>(data.init_val) == 0) { std::cout << static_cast<float>(data.init_val) << ".0f" << std::endl; } else { std::cout << static_cast<float>(data.init_val) << "f" << std::endl; } } void convertToChar(Data data) { int m_char; m_char = static_cast<int>(data.init_val); if (data.bad_double == 1 || isnan(data.init_val) || isinf(data.init_val)) { std::cout << "char: impossible" << std::endl; return ; } if (m_char >= 127) { std::cout << "char: impossible" << std::endl; return ; } if (isprint(m_char)) { std::cout << "char: '" << static_cast<char>(m_char) << "'" << std::endl; return ; } else { std::cout << "char: not printable" << std::endl; } } int main(int argc, char **argv) { if (argc != 2) { std::cerr << "Error: wrong number of arguments" << std::endl; return 1; } Data data = {.bad_double = 0, .init_val = 0}; std::string str = argv[1]; try { data.init_val = std::stod(str); } catch(const std::exception &e) { data.bad_double = 1; } convertToChar(data); convertToInt(data); convertToFloat(data); convertToDouble(data); return 0; }
a961fc276cc3bfbe4ddae5e495e4ff93e0cc35eb
637c4892287929583bdadd8630d5353dd78dc82c
/test/jacobi/OpenMP/Fortran/jacobi.F90.opari.inc
c063f04e523be7f2d52b1a1c6a938f7b28970db3
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
readex-eu/readex-scorep
6819f074bba6b4fe9d6de07cf7037d2829cbbccf
38d7b84145f229b44670656d59f84faa51007ced
refs/heads/master
2020-03-27T01:04:12.730561
2018-08-22T14:42:37
2018-08-22T14:42:37
145,679,275
1
0
null
null
null
null
UTF-8
C++
false
false
1,020
inc
jacobi.F90.opari.inc
INTEGER( KIND=8 ) :: pomp2_region_1 CHARACTER (LEN=259), parameter :: pomp2_ctc_1 =& "255*regionType=parallel*sscl=jacobi.F90:56:56*escl=jacobi.F90:81:81**" INTEGER( KIND=8 ) :: pomp2_region_2 CHARACTER (LEN=253), parameter :: pomp2_ctc_2 =& "249*regionType=do*sscl=jacobi.F90:57:57*escl=jacobi.F90:63:63**" INTEGER( KIND=8 ) :: pomp2_region_3 CHARACTER (LEN=268), parameter :: pomp2_ctc_3 =& "264*regionType=do*sscl=jacobi.F90:64:64*"//& "escl=jacobi.F90:80:80*hasReduction=1**" integer ( kind=4 ) :: pomp2_lib_get_max_threads logical :: pomp2_test_lock integer ( kind=4 ) :: pomp2_test_nest_lock integer( kind=8 ) pomp_tpd common /pomp_tpd/ pomp_tpd !$omp threadprivate(/pomp_tpd/) integer ( kind=8 ) :: pomp2_old_task, pomp2_new_task logical :: pomp2_if integer ( kind=4 ) :: pomp2_num_threads common /cb8j6lstatlxpyf/ pomp2_region_1,& pomp2_region_2,& pomp2_region_3
72954169dfe3333b13542704ad71f49878731b3f
f7dc806f341ef5dbb0e11252a4693003a66853d5
/scene/3d/reflection_probe.h
5438219d5e7904907f94b0b661ac7e5c8d174758
[ "LicenseRef-scancode-free-unknown", "MIT", "CC-BY-4.0", "OFL-1.1", "Bison-exception-2.2", "CC0-1.0", "LicenseRef-scancode-nvidia-2002", "LicenseRef-scancode-other-permissive", "GPL-3.0-only", "LicenseRef-scancode-unknown-license-reference", "Unlicense", "BSL-1.0", "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unicode", "BSD-2-Clause", "FTL", "GPL-3.0-or-later", "Bitstream-Vera", "Zlib", "MPL-2.0", "MIT-Modern-Variant" ]
permissive
godotengine/godot
8a2419750f4851d1426a8f3bcb52cac5c86f23c2
970be7afdc111ccc7459d7ef3560de70e6d08c80
refs/heads/master
2023-08-21T14:37:00.262883
2023-08-21T06:26:15
2023-08-21T06:26:15
15,634,981
68,852
18,388
MIT
2023-09-14T21:42:16
2014-01-04T16:05:36
C++
UTF-8
C++
false
false
4,781
h
reflection_probe.h
/**************************************************************************/ /* reflection_probe.h */ /**************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /**************************************************************************/ /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* */ /* 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. */ /**************************************************************************/ #ifndef REFLECTION_PROBE_H #define REFLECTION_PROBE_H #include "scene/3d/visual_instance_3d.h" class ReflectionProbe : public VisualInstance3D { GDCLASS(ReflectionProbe, VisualInstance3D); public: enum UpdateMode { UPDATE_ONCE, UPDATE_ALWAYS, }; enum AmbientMode { AMBIENT_DISABLED, AMBIENT_ENVIRONMENT, AMBIENT_COLOR }; private: RID probe; float intensity = 1.0; float max_distance = 0.0; Vector3 size = Vector3(20, 20, 20); Vector3 origin_offset = Vector3(0, 0, 0); bool box_projection = false; bool enable_shadows = false; bool interior = false; AmbientMode ambient_mode = AMBIENT_ENVIRONMENT; Color ambient_color = Color(0, 0, 0); float ambient_color_energy = 1.0; float mesh_lod_threshold = 1.0; uint32_t cull_mask = (1 << 20) - 1; UpdateMode update_mode = UPDATE_ONCE; protected: static void _bind_methods(); void _validate_property(PropertyInfo &p_property) const; #ifndef DISABLE_DEPRECATED bool _set(const StringName &p_name, const Variant &p_value); bool _get(const StringName &p_name, Variant &r_property) const; #endif // DISABLE_DEPRECATED public: void set_intensity(float p_intensity); float get_intensity() const; void set_ambient_mode(AmbientMode p_mode); AmbientMode get_ambient_mode() const; void set_ambient_color(Color p_ambient); Color get_ambient_color() const; void set_ambient_color_energy(float p_energy); float get_ambient_color_energy() const; void set_interior_ambient_probe_contribution(float p_contribution); float get_interior_ambient_probe_contribution() const; void set_max_distance(float p_distance); float get_max_distance() const; void set_mesh_lod_threshold(float p_pixels); float get_mesh_lod_threshold() const; void set_size(const Vector3 &p_size); Vector3 get_size() const; void set_origin_offset(const Vector3 &p_offset); Vector3 get_origin_offset() const; void set_as_interior(bool p_enable); bool is_set_as_interior() const; void set_enable_box_projection(bool p_enable); bool is_box_projection_enabled() const; void set_enable_shadows(bool p_enable); bool are_shadows_enabled() const; void set_cull_mask(uint32_t p_layers); uint32_t get_cull_mask() const; void set_update_mode(UpdateMode p_mode); UpdateMode get_update_mode() const; virtual AABB get_aabb() const override; virtual PackedStringArray get_configuration_warnings() const override; ReflectionProbe(); ~ReflectionProbe(); }; VARIANT_ENUM_CAST(ReflectionProbe::AmbientMode); VARIANT_ENUM_CAST(ReflectionProbe::UpdateMode); #endif // REFLECTION_PROBE_H
548d6c5cd3d7cb6a9e4da5431d5d3092cc269dbd
68057a3152a6e9fb5f9352b536c89374b9c4d333
/tests/units/stack_base_weak.cpp
16625afa55490f52001fa82db081f40fcf319f93
[ "ISC" ]
permissive
mashavorob/lfds
b9ce3a0f839e7c47ac44319112f25b7725bdfd6e
3890472a8a9996ce35d9a28f185df4c2f219a2bd
refs/heads/master
2016-09-06T18:33:20.121328
2015-06-05T18:22:18
2015-06-05T18:22:18
28,824,065
0
0
null
null
null
null
UTF-8
C++
false
false
2,038
cpp
stack_base_weak.cpp
/* * stack_base_weak.cpp * * Created on: Dec 23, 2014 * Author: masha */ #include <xtomic/impl/stack_base_weak.hpp> #include "gtest/gtest.h" TEST(stack_base_weak, pop) { typedef xtomic::stack_base_weak<int> stack_type; typedef stack_type::node_type node_type; stack_type stack; EXPECT_EQ(stack.pop(), static_cast<node_type*>(0)); } TEST(stack_base_weak, push) { typedef xtomic::stack_base_weak<int> stack_type; typedef stack_type::node_type node_type; stack_type stack; node_type a; stack.push(&a); EXPECT_EQ(stack.pop(), &a); EXPECT_EQ(stack.pop(), static_cast<node_type*>(0)); } TEST(stack_base_weak, push3) { typedef xtomic::stack_base_weak<int> stack_type; typedef stack_type::node_type node_type; stack_type stack; node_type a[3]; stack.push(&a[0]); stack.push(&a[1]); stack.push(&a[2]); EXPECT_EQ(stack.pop(), &a[2]); EXPECT_EQ(stack.pop(), &a[1]); EXPECT_EQ(stack.pop(), &a[0]); EXPECT_EQ(stack.pop(), static_cast<node_type*>(0)); } TEST(stack_base_weak, atomic_pop) { typedef xtomic::stack_base_weak<int> stack_type; typedef stack_type::node_type node_type; stack_type stack; EXPECT_EQ(stack.atomic_pop(), static_cast<node_type*>(0)); } TEST(stack_base_weak, atomic_push) { typedef xtomic::stack_base_weak<int> stack_type; typedef stack_type::node_type node_type; stack_type stack; node_type a; stack.atomic_push(&a); EXPECT_EQ(stack.atomic_pop(), &a); EXPECT_EQ(stack.atomic_pop(), static_cast<node_type*>(0)); } TEST(stack_base_weak, atomic_push3) { typedef xtomic::stack_base_weak<int> stack_type; typedef stack_type::node_type node_type; stack_type stack; node_type a[3]; stack.atomic_push(&a[0]); stack.atomic_push(&a[1]); stack.atomic_push(&a[2]); EXPECT_EQ(stack.atomic_pop(), &a[2]); EXPECT_EQ(stack.atomic_pop(), &a[1]); EXPECT_EQ(stack.atomic_pop(), &a[0]); EXPECT_EQ(stack.atomic_pop(), static_cast<node_type*>(0)); }
217314b0e6945c585adb4a13222f7451ec8a4f60
af5a51b88a0c64107c32eb008bbdb221db52e551
/from_sourceforge/gpx/X/branches/doc/include/gpx/math/const_VectorPtrN.hpp
f46f385a7d677896491a08339a181625f4952ff9
[ "BSD-2-Clause" ]
permissive
michpolicht/gpx
fea1fdd77e510e325014309c6b9ce7c8410c8e51
ed678357089eca129719d48e4a5489a08c4ca21b
refs/heads/master
2021-01-10T06:32:47.279724
2016-11-14T01:40:16
2016-11-14T01:40:16
50,761,190
1
0
null
null
null
null
UTF-8
C++
false
false
5,799
hpp
const_VectorPtrN.hpp
/** * @file * @brief Vector<N> definition. */ #include "_structures_warning.hpp" namespace gpx { namespace math { /** * General n-dimensional vector. Not implemented yet. */ template <std::size_t N, typename T = real_t> class const_VectorPtr { protected: T * const m_ptr; public: /** * Constructor. * @param coords pointer to 2 element coordinates array. */ const_VectorPtr(T * coords); /** * Assignment operator. */ // void operator=(const VectorPtr<2> & other); // // /** // * Subscript operator (coords access). // */ // real_t & operator[](int i); // // /** // * Const version of subscript operator. // */ // real_t operator[](int i) const; // // /** // * Function call operator. Same as subscript operator, however () operator // * is preferred for accessing matrices. // */ // real_t & operator()(int i); // // /** // * Const version of function call operator. // */ // real_t operator()(int i) const; // // /** // * Equality operator. // */ // bool operator==(const VectorPtr<N> & other); // // /** // * Inequality operator. // */ // bool operator!=(const VectorPtr<N> & other); /** * Addition assignment. */ // VectorPtr<N> & operator+=(const VectorPtr<N> & other); /** * Addition. */ // Vector<N> operator+(const VectorPtr<N> & other); /** * Subtraction. */ // Vector<N> operator-(const VectorPtr<N> & other); /** * Subtraction assignment. */ // VectorPtr<N> & operator-=(const VectorPtr<N> & other); /** * Division assignment. Divide all vector coordinates by scalar. * @param scalar scalar. */ // VectorPtr<N> & operator/=(const real_t scalar); /** * Division. */ // Vector<N> operator/(const real_t scalar); /** * Multiplication assignment. */ // VectorPtr<N> & operator*=(const real_t scalar); /** * Multiplication. */ // Vector<N> operator*(const real_t scalar); /** * Conversion to const real_t * const. */ // operator const real_t * const() const; /** * Conversion to real_t * const. */ // operator real_t * const(); /** * Reset vector coordinates to (0.0, 0.0). */ // VectorPtr<N> & zero(); /** * Add other vector to this vector. * @param other other vector. * @return reference to current vector. */ // VectorPtr<N> & add(const VectorPtr<2> & other); /** * Subtract other vector from this vector. * @param other other vector. * @return reference to current vector. */ // VectorPtr<N> & sub(const VectorPtr<2> & other); /** * Divide all vector coordinates by scalar. * @param scalar scalar. * @return reference to current vector. */ // VectorPtr<N> & div(const real_t scalar); /** * Multiply all vector coordinates by scalar. * @param scalar scalar. * @return reference to current vector. */ // VectorPtr<N> & mult(const real_t scalar); /** * Get dot (or scalar) product of this vector and other. * @param other other vector. * @return dot product. */ // real_t dot(const VectorPtr<N> & other) const; /** * Get dot product of this vector. * @return dot product of this vector. */ // real_t dot() const; //inner product (like dot but result is vector<1>) ? // Vector<1> inn(const VectorPtr<2> & other) const; /** * Get outer product of this vector and other. * @param other other vector. * @return outer product matrix. */ // Matrix<N,N> out(const VectorPtr<N> & other) const; /** * Get vector length. * @return length of vector. */ // real_t length() const; /** * Normalize this vector. */ // VectorPtr<N> & normalize(); /** * Invert this vector. */ // VectorPtr<N> & invert(); /** * Get versor of this vector. * @return normalized vector. * * @warning vector must be non zero vector. */ // Vector<N> versor() const; /** * Get cross product of this vector. * @return cross product. */ // Vector<N> cross(... N-2 vectors) const; /** * Rotate around specified (N-1)-dimensional hyper-axis (point - for 2 dimensional * vector, line - for 3 dimensional vector, plane - for 4 dimensional vector and so on). * Hyper-axis is determined by non-selected coordinates. * @param i coordinate to rotate. * @param j coordinate to rotate. */ // VectorPtr<N> & rotate(int i, int j); }; } } //(c)MP: Copyright © 2010, Michał Policht. All rights reserved. //(c)MP: Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. //(c)MP: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //(c)MP: The above copyright statement is OSI approved, Simplified BSD License without 3. clause.
fb5c1d2ee811411c9d2eaba1b5b9664a57cac1e5
cb8c337a790b62905ad3b30f7891a4dff0ae7b6d
/st-ericsson/multimedia/imaging/ext_hsmcamera/src/camport.cpp
a425f8ce119386e8ff448abc48ef506f4501e403
[]
no_license
CustomROMs/android_vendor
67a2a096bfaa805d47e7d72b0c7a0d7e4830fa31
295e660547846f90ac7ebe42a952e613dbe1b2c3
refs/heads/master
2020-04-27T15:01:52.612258
2019-03-11T13:26:23
2019-03-12T11:23:02
174,429,381
1
0
null
null
null
null
UTF-8
C++
false
false
35,153
cpp
camport.cpp
/* * Copyright (C) ST-Ericsson SA 2011. All rights reserved. * This code is ST-Ericsson proprietary and confidential. * Any use of the code for whatever purpose is subject to * specific written permission of ST-Ericsson SA. */ #include "ext_camport.h" #include "ext_grabctlcommon.h" #include "IFM_Types.h" #include "ext_camera.h" #include "ext_omxcamera.h" #include "extradata.h" #undef DBGT_LAYER #define DBGT_LAYER 1 #undef DBGT_PREFIX #define DBGT_PREFIX "PORT" #include "debug_trace.h" void camport::setDefaultFormatInPortDefinition(OMX_PARAM_PORTDEFINITIONTYPE * defaultDef) { DBGT_PROLOG(""); DBGT_PTRACE("PortIndex = %d", (int)defaultDef->nPortIndex); t_uint16 mWidth = 0; t_uint16 mHeight = 0; t_uint16 mStride = 0; t_sint32 stride = 0; t_uint32 sliceHeight = 0; OMX_U32 bufferSize = 0; switch(defaultDef->nPortIndex) { case CAMERA_PORT_OUT0: { /* Video port */ mParamPortDefinition.format.video.cMIMEType = NULL; mParamPortDefinition.format.video.pNativeRender = 0 ;// not used mParamPortDefinition.format.video.nFrameWidth = defaultDef->format.video.nFrameWidth; mParamPortDefinition.format.video.nFrameHeight = defaultDef->format.video.nFrameHeight; mParamPortDefinition.format.video.nBitrate = 0; mParamPortDefinition.format.video.xFramerate = defaultDef->format.video.xFramerate; mParamPortDefinition.format.video.bFlagErrorConcealment = OMX_FALSE; mParamPortDefinition.format.video.eCompressionFormat = (OMX_VIDEO_CODINGTYPE)OMX_VIDEO_CodingUnused; mParamPortDefinition.format.video.eColorFormat = defaultDef->format.video.eColorFormat; mParamPortDefinition.format.video.pNativeWindow = 0; mInternalFrameWidth = mParamPortDefinition.format.video.nFrameWidth; mInternalFrameHeight = mParamPortDefinition.format.video.nFrameHeight; /* Get the number of byte per pixel */ mBytesPerPixel = getPixelDepth(mParamPortDefinition.format.video.eColorFormat); /* Check hardware constraints */ getHwConstraints(defaultDef->nPortIndex, defaultDef->format.video.eColorFormat,&mWidth, &mHeight, &mStride); /* Align buffer allocation according to the hardware constraints. * If width/height set by client is not compliant to HW * constraints, handle those internally. Note that port * configuration seen by client (getParameter) is based on * the (potentially unaligned) values set by the client ! */ mInternalFrameWidth = (mInternalFrameWidth + (mWidth-1))&~(mWidth-1); mInternalFrameHeight = (mInternalFrameHeight + (mHeight-1))&~(mHeight-1); /* Buffer size taking into account hardware constraint */ bufferSize = (OMX_U32) ((double) (mInternalFrameWidth * mInternalFrameHeight) * mBytesPerPixel); #ifdef STAB if ((mParamPortDefinition.format.video.eColorFormat != OMX_COLOR_FormatRawBayer8bit)&&(mParamPortDefinition.format.video.eColorFormat !=OMX_COLOR_FormatRawBayer10bit )) { bufferSize += sizeof(OMX_DIGITALVIDEOSTABINFOTYPE); /* allocate 30% extra to accomodate stab overscanning */ bufferSize += (bufferSize*7)/9; } #endif /* Set stride and sliceHeight */ stride = mInternalFrameWidth * mStride; sliceHeight = mInternalFrameHeight; if (bufferSize == 0) { DBGT_ASSERT(0); } /* Updated param */ mParamPortDefinition.nBufferSize = bufferSize; mParamPortDefinition.format.video.nStride = stride; mParamPortDefinition.format.video.nSliceHeight = sliceHeight; DBGT_PTRACE("mParamPortDefinition.format.video.xFramerate = %d", (int) mParamPortDefinition.format.video.xFramerate); DBGT_PTRACE("mParamPortDefinition.format.video.nFrameWidth = %d", (int)mParamPortDefinition.format.video.nFrameWidth); DBGT_PTRACE("mParamPortDefinition.format.video.nFrameHeight = %d ", (int)mParamPortDefinition.format.video.nFrameHeight); DBGT_PTRACE("mParamPortDefinition.format.video.eCompressionFormat = %d", (int)mParamPortDefinition.format.video.eCompressionFormat); DBGT_PTRACE("mParamPortDefinition.format.video.eColorFormat = %d", (int)mParamPortDefinition.format.video.eColorFormat); DBGT_PTRACE("mParamPortDefinition.format.video.nStride = %d", (int)mParamPortDefinition.format.video.nStride); DBGT_PTRACE("mParamPortDefinition.format.video.nSliceHeight = %d", (int)mParamPortDefinition.format.video.nSliceHeight); DBGT_PTRACE("mParamPortDefinition.nBufferSize = %d", (int)mParamPortDefinition.nBufferSize); break; } case CAMERA_PORT_OUT1: { /* Image port */ mParamPortDefinition.format.image.cMIMEType = NULL; mParamPortDefinition.format.image.pNativeRender = 0 ;// not used mParamPortDefinition.format.image.nFrameWidth = defaultDef->format.image.nFrameWidth; mParamPortDefinition.format.image.nFrameHeight = defaultDef->format.image.nFrameHeight; mParamPortDefinition.format.image.bFlagErrorConcealment = OMX_FALSE; mParamPortDefinition.format.image.eCompressionFormat = (OMX_IMAGE_CODINGTYPE)OMX_IMAGE_CodingUnused; mParamPortDefinition.format.image.eColorFormat = defaultDef->format.image.eColorFormat; mParamPortDefinition.format.image.pNativeWindow = 0; mInternalFrameWidth = mParamPortDefinition.format.image.nFrameWidth; mInternalFrameHeight = mParamPortDefinition.format.image.nFrameHeight; /* Get the number of byte per pixel */ mBytesPerPixel = getPixelDepth(mParamPortDefinition.format.image.eColorFormat); /* Check hardware constraints */ getHwConstraints(defaultDef->nPortIndex, defaultDef->format.image.eColorFormat,&mWidth, &mHeight, &mStride); /* Align buffer allocation according to the hardware constraint*/ mInternalFrameWidth = (mInternalFrameWidth + (mWidth-1))&~(mWidth-1); mInternalFrameHeight = (mInternalFrameHeight + (mHeight-1))&~(mHeight-1); /* Buffer size taking into account hardware constraint */ bufferSize = (OMX_U32) ((double) (mInternalFrameWidth * mInternalFrameHeight) * mBytesPerPixel); /* Set stride and sliceHeight */ stride = mInternalFrameWidth * mStride; sliceHeight = mInternalFrameHeight; //Increase buffer size for adding extradata bufferSize += Extradata::GetExtradataSize(Component_Camera, defaultDef->nPortIndex); if (bufferSize == 0) { DBGT_ASSERT(0); } /* Updated param */ mParamPortDefinition.nBufferSize = bufferSize; mParamPortDefinition.format.image.nStride = stride; mParamPortDefinition.format.image.nSliceHeight = sliceHeight; DBGT_PTRACE("mParamPortDefinition.format.image.nFrameWidth = %d", (int)mParamPortDefinition.format.image.nFrameWidth); DBGT_PTRACE("mParamPortDefinition.format.image.nFrameHeight = %d", (int)mParamPortDefinition.format.image.nFrameHeight); DBGT_PTRACE("mParamPortDefinition.format.image.eCompressionFormat = %d", (int)mParamPortDefinition.format.image.eCompressionFormat); DBGT_PTRACE("mParamPortDefinition.format.image.eColorFormat = %d", (int)mParamPortDefinition.format.image.eColorFormat); DBGT_PTRACE("mParamPortDefinition.format.image.nStride = %d", (int)mParamPortDefinition.format.image.nStride); DBGT_PTRACE("mParamPortDefinition.format.image.nSliceHeight = %d", (int)mParamPortDefinition.format.image.nSliceHeight); DBGT_PTRACE("mParamPortDefinition.nBufferSize = %d", (int)mParamPortDefinition.nBufferSize); break; } default: { DBGT_ASSERT(0); //this should not be called for other pipeId break; } } DBGT_EPILOG(""); } OMX_ERRORTYPE camport::checkFormatInPortDefinition(const OMX_PARAM_PORTDEFINITIONTYPE &portdef) { /* This is very dangerous as it implies that the operating mode is known at that time.*/ /* It means that IndexCommonSensorMode should be set before the OMX_IndexParamPortDefinition */ /* If not, sizes/format are evaluated in Still mode as it is the default one */ /* Could do : also call this function on IndexCommonSensorMode so that * it returns an error, once the operating mode is known */ if(portdef.nPortIndex==CAMERA_PORT_OUT0) { /* check Size*/ if(portdef.format.video.nFrameWidth > getMaxRes(CAMERA_PORT_OUT0)) return OMX_ErrorBadParameter; /* Check Format */ if(isSupportedFmt(CAMERA_PORT_OUT0, portdef.format.video.eColorFormat, (t_uint32)portdef.format.video.eCompressionFormat) != OMX_TRUE) return OMX_ErrorBadParameter; return OMX_ErrorNone; } else if(portdef.nPortIndex==CAMERA_PORT_OUT1) { /* check Size*/ if(portdef.format.image.nFrameWidth > getMaxRes(CAMERA_PORT_OUT1)) return OMX_ErrorBadParameter; /* Check Format */ if(isSupportedFmt(CAMERA_PORT_OUT1,portdef.format.image.eColorFormat, (t_uint32)portdef.format.image.eCompressionFormat) != OMX_TRUE) return OMX_ErrorBadParameter; return OMX_ErrorNone; } else return OMX_ErrorBadParameter;//portId is not correct. } typedef struct CAM_PORT_INDEX_STRUCT { OMX_U32 nSize; OMX_VERSIONTYPE nVersion; OMX_U32 nPortIndex; } CAM_PORT_INDEX_STRUCT; OMX_ERRORTYPE camport::setParameter( OMX_INDEXTYPE nParamIndex, OMX_PTR pComponentParameterStructure) { OMX_ERRORTYPE error = OMX_ErrorNone; switch (nParamIndex) { case OMX_IndexParamCommonSensorMode: { CAM_PORT_INDEX_STRUCT *portIdxStruct = static_cast<CAM_PORT_INDEX_STRUCT *>(pComponentParameterStructure); /* check that indeed it is an OMX_ALL else return an error */ DBGT_PTRACE("camport::setParameter, nPortIndex %ld",portIdxStruct->nPortIndex); OMX_PARAM_SENSORMODETYPE *pSensorMode = (OMX_PARAM_SENSORMODETYPE *)pComponentParameterStructure; DBGT_PTRACE("New sensor mode: Framerate: %ffps, Framesize: %ux%u", (double)pSensorMode->nFrameRate, (char)pSensorMode->sFrameSize.nWidth, (char)pSensorMode->sFrameSize.nHeight ); bOneShot=pSensorMode->bOneShot; ENS_Component* comp = (ENS_Component*)&getENSComponent(); OMX_STATETYPE state; comp->GetState(comp,&state); if( state == OMX_StateLoaded) { /* update the opmode whatever the portState and whatever OMX_ALL was set or not */ DBGT_PTRACE("in loaded state"); COmxCamera* omxcam = (COmxCamera*)&getENSComponent(); Camera* cam = (Camera*)&omxcam->getProcessingComponent(); omxcam->mSensorMode=*(OMX_PARAM_SENSORMODETYPE*)pComponentParameterStructure; if(pSensorMode->bOneShot== OMX_FALSE) cam->setOperatingMode(OpMode_Cam_VideoPreview); else cam->setOperatingMode(OpMode_Cam_StillPreview); DBGT_PTRACE("bOneShot %d", pSensorMode->bOneShot); error = OMX_ErrorNone; } else { DBGT_PTRACE("not in loaded state"); // in idle state all ports must be disabled and should have the same value of bOneShot on the last call of this setParameter camport * port0 = (camport *) comp->getPort(CAMERA_PORT_OUT0); camport * port1 = (camport *) comp->getPort(CAMERA_PORT_OUT1); if((port0->isEnabled() == OMX_TRUE) || (port1->isEnabled() == OMX_TRUE)) { DBGT_PTRACE("all port are not disabled"); //if one of the port is enabled we dont change the current opemode, it wont be applied. // ENS will report an error // but suppose vpb2 is enabled, we would have process this function for vpb1 and vpb0. // taht s why we do not do anything in that case. error = OMX_ErrorNone; } else // means all of them are disabled { DBGT_PTRACE("all port are disabled"); // in that case all bOneShot should be the same but this has to be checked only on the last call of setParamter, means on vpb2 if(portIdxStruct->nPortIndex == CAMERA_PORT_OUT1) { if((port0->bOneShot== OMX_TRUE) && (port1->bOneShot== OMX_TRUE)) { DBGT_PTRACE("bOneShot true for all ports, change mSensorMode and stillPathEnabled and opmode for camera component"); COmxCamera* omxcam = (COmxCamera*)&getENSComponent(); Camera* cam = (Camera*)&omxcam->getProcessingComponent(); omxcam->mSensorMode=*(OMX_PARAM_SENSORMODETYPE*)pComponentParameterStructure; cam->setOperatingMode(OpMode_Cam_StillPreview); error = OMX_ErrorNone; } else if((port0->bOneShot== OMX_FALSE) && (port1->bOneShot== OMX_FALSE)) { DBGT_PTRACE("bOneShot false for all ports, change mSensorMode and stillPathEnabled and opmode for camera component"); COmxCamera* omxcam = (COmxCamera*)&getENSComponent(); Camera* cam = (Camera*)&omxcam->getProcessingComponent(); omxcam->mSensorMode=*(OMX_PARAM_SENSORMODETYPE*)pComponentParameterStructure; cam->setOperatingMode(OpMode_Cam_VideoPreview); error = OMX_ErrorNone; } else { DBGT_PTRACE("bOneShot ot the same for all ports, return error"); // all port have not the same value, do not change opmode camera and return error // this means it has come without a OMX_ALL, or without same values for all portIndex error = OMX_ErrorBadPortIndex; } } else { DBGT_PTRACE("not vpb1, dont do anything yet"); error = OMX_ErrorNone; } } } break; } default : error = ENS_Port::setParameter(nParamIndex,pComponentParameterStructure); break; } return error; } OMX_ERRORTYPE camport::getParameter( OMX_INDEXTYPE nParamIndex, OMX_PTR pComponentParameterStructure) const { OMX_ERRORTYPE error = OMX_ErrorNone; switch (nParamIndex) { case OMX_IndexParamCommonSensorMode: { CAM_PORT_INDEX_STRUCT *portIdxStruct = static_cast<CAM_PORT_INDEX_STRUCT *>(pComponentParameterStructure); (void)portIdxStruct->nPortIndex; /* check that indeed it is an OMX_ALL else return an error */ DBGT_PTRACE("camport::getParameter, nPortIndex %ld",portIdxStruct->nPortIndex); /* dont do anything yet */ error = OMX_ErrorNone; break; } default : error = ENS_Port::getParameter(nParamIndex,pComponentParameterStructure); break; } return error; } OMX_ERRORTYPE camport::setFormatInPortDefinition(const OMX_PARAM_PORTDEFINITIONTYPE &portdef) { DBGT_PROLOG(""); DBGT_PTRACE("PortIndex = %d", (int)portdef.nPortIndex); t_uint16 mWidth = 0; t_uint16 mHeight = 0; t_uint16 mStride = 0; t_sint32 stride = 0; t_uint32 sliceHeight = 0; OMX_U32 bufferSize = 0; OMX_ERRORTYPE error = OMX_ErrorNone; error = checkFormatInPortDefinition(portdef); if(error != OMX_ErrorNone) { goto end; } switch(portdef.nPortIndex) { case CAMERA_PORT_OUT0: { /* Video port */ mParamPortDefinition.format.video.cMIMEType = portdef.format.video.cMIMEType; mParamPortDefinition.format.video.xFramerate = portdef.format.video.xFramerate; mParamPortDefinition.format.video.nFrameWidth = portdef.format.video.nFrameWidth; mParamPortDefinition.format.video.nFrameHeight = portdef.format.video.nFrameHeight; mParamPortDefinition.format.video.pNativeRender = portdef.format.video.pNativeRender; mParamPortDefinition.format.video.bFlagErrorConcealment = portdef.format.video.bFlagErrorConcealment; mParamPortDefinition.format.video.eCompressionFormat = portdef.format.video.eCompressionFormat; mParamPortDefinition.format.video.eColorFormat = portdef.format.video.eColorFormat; mParamPortDefinition.format.video.pNativeWindow = portdef.format.video.pNativeWindow; mInternalFrameWidth = mParamPortDefinition.format.video.nFrameWidth; mInternalFrameHeight = mParamPortDefinition.format.video.nFrameHeight; /* Get the number of byte per pixel */ mBytesPerPixel = getPixelDepth(mParamPortDefinition.format.video.eColorFormat); /* Check hardware constraints */ getHwConstraints(portdef.nPortIndex, portdef.format.video.eColorFormat,&mWidth, &mHeight, &mStride); /* Align buffer allocation according to the hardware constraints. * If width/height set by client is not compliant to HW * constraints, handle those internally. Note that port * configuration seen by client (getParameter) is based on * the (potentially unaligned) values set by the client ! */ mInternalFrameWidth = (mInternalFrameWidth + (mWidth-1))&~(mWidth-1); mInternalFrameHeight = (mInternalFrameHeight + (mHeight-1))&~(mHeight-1); if((mInternalFrameWidth != mParamPortDefinition.format.video.nFrameWidth) || (mInternalFrameHeight != mParamPortDefinition.format.video.nFrameHeight)) { DBGT_WARNING("Frame size requested is %dx%d.", (int)mParamPortDefinition.format.video.nFrameWidth, (int)mParamPortDefinition.format.video.nFrameHeight); DBGT_WARNING("Frame size output by the camera need to be %dx%d to respect hardware constraint alignment", (int)mInternalFrameWidth, (int)mInternalFrameHeight); DBGT_PTRACE("Allocated buffer size will be %dx%d to respect hardware constraint alignment for current pixel format", (int)mInternalFrameWidth, (int)mInternalFrameHeight); } else { DBGT_PTRACE("Allocated buffer size will be %dx%d (same as the frame size)", (int)mInternalFrameWidth, (int)mInternalFrameHeight); } /* Buffer size taking into account hardware constraint */ bufferSize = (OMX_U32) ((double) (mInternalFrameWidth * mInternalFrameHeight) * mBytesPerPixel); #ifdef STAB if ((mParamPortDefinition.format.video.eColorFormat != OMX_COLOR_FormatRawBayer8bit)&& (mParamPortDefinition.format.video.eColorFormat !=OMX_COLOR_FormatRawBayer10bit )) { bufferSize += sizeof(OMX_DIGITALVIDEOSTABINFOTYPE); /* allocate 30% extra to accomodate stab overscanning */ bufferSize += (bufferSize*7)/9; } #endif if (mParamPortDefinition.format.video.eColorFormat == OMX_STE_COLOR_FormatRawData){ // this pixel format is composed of a yuv frame & a jpeg // Both of them are interlaced. The buffer size is fix to 10 Mbytes bufferSize = 0xA00000; } /* Set stride and sliceHeight */ stride = mInternalFrameWidth * mStride; sliceHeight = mInternalFrameHeight; if (bufferSize == 0) { DBGT_ASSERT(0); //frameWidth and height have been overwritten, assert } /* Updated param */ mParamPortDefinition.nBufferSize = bufferSize; mParamPortDefinition.format.video.nStride = stride; mParamPortDefinition.format.video.nSliceHeight = sliceHeight; //use nSliceHeight to warn about buffer alignement need to be used to configure SIA DMA portSettingsChanged = OMX_TRUE; DBGT_PTRACE("mParamPortDefinition.format.video.xFramerate = %d", (int)mParamPortDefinition.format.video.xFramerate); DBGT_PTRACE("mParamPortDefinition.format.video.nFrameWidth = %d", (int)mParamPortDefinition.format.video.nFrameWidth); DBGT_PTRACE("mParamPortDefinition.format.video.nFrameHeight = %d", (int)mParamPortDefinition.format.video.nFrameHeight); DBGT_PTRACE("mParamPortDefinition.format.video.eCompressionFormat = %d", (int)mParamPortDefinition.format.video.eCompressionFormat); DBGT_PTRACE("mParamPortDefinition.format.video.eColorFormat = %d", (int)mParamPortDefinition.format.video.eColorFormat); DBGT_PTRACE("mParamPortDefinition.format.video.nStride = %d", (int)mParamPortDefinition.format.video.nStride); DBGT_PTRACE("mParamPortDefinition.format.video.nSliceHeight = %d", (int)mParamPortDefinition.format.video.nSliceHeight); DBGT_PTRACE("mParamPortDefinition.nBufferSize = %d", (int)mParamPortDefinition.nBufferSize); break; } case CAMERA_PORT_OUT1: { /* Video port */ mParamPortDefinition.format.image.cMIMEType = portdef.format.image.cMIMEType; mParamPortDefinition.format.image.nFrameWidth = portdef.format.image.nFrameWidth; mParamPortDefinition.format.image.nFrameHeight = portdef.format.image.nFrameHeight; mParamPortDefinition.format.image.pNativeRender = portdef.format.image.pNativeRender; mParamPortDefinition.format.image.bFlagErrorConcealment = portdef.format.image.bFlagErrorConcealment; mParamPortDefinition.format.image.eCompressionFormat = portdef.format.image.eCompressionFormat; mParamPortDefinition.format.image.eColorFormat = portdef.format.image.eColorFormat; mParamPortDefinition.format.image.pNativeWindow = portdef.format.image.pNativeWindow; mInternalFrameWidth = portdef.format.image.nFrameWidth; mInternalFrameHeight = portdef.format.image.nFrameHeight; DBGT_PTRACE("=========================eCompressionFormat = %d\n", mParamPortDefinition.format.image.eCompressionFormat ); if(mParamPortDefinition.format.image.eCompressionFormat == OMX_IMAGE_CodingJPEG) { /* We are in the external ISP Jpeg case */ /* We retrive from the driver .dat file the file size needed * to store the Jpeg. */ int bSuccess; COmxCamera* omxcam = (COmxCamera*)&getENSComponent(); Camera* cam = (Camera*)&omxcam->getProcessingComponent(); HAL_Gr_Camera_SizeConfig_t* SizeConfig_p = new HAL_Gr_Camera_SizeConfig_t; t_uint8 Id = 0; bool found = 0; DBGT_PTRACE("============================setFormatInPortDefinition Before SizeConfig - %d %d", mInternalFrameWidth, mInternalFrameHeight); while(!found) { bSuccess = cam->cam_Ctrllib->Camera_CtrlLib_GetSizeConfig(cam->cam_h, Id, SizeConfig_p); if(!bSuccess){ DBGT_PTRACE("Error from Camera_CtrlLib_GetSizeConfig: Id not found"); DBGT_ASSERT(0); break; } DBGT_PTRACE("SizeConfig[%d] - %d %d", Id, SizeConfig_p->Width, SizeConfig_p->Height,SizeConfig_p->Type ); if((SizeConfig_p->Height == (int)mInternalFrameHeight) && (SizeConfig_p->Width == (int)mInternalFrameWidth) && (SizeConfig_p->Type == 0)) /*For raw capture table contains 0*/ found = 1; else Id++; } bSuccess = cam->cam_Ctrllib->Camera_CtrlLib_GetNeededJPEG_BufferSize(cam->cam_h, Id, (int*) &bufferSize); if(!bSuccess) { DBGT_PTRACE("Error from Camera_CtrlLib_GetNeededJPEG_BufferSize"); DBGT_ASSERT(0); } DBGT_PTRACE("Allocated buffer size for Jpeg = %d", (int)bufferSize); if (bufferSize == 0) { /* Driver .dat shoul define the buffer size needed in * case of Jpeg picture. */ DBGT_ASSERT(0); } /* Set stride and sliceHeight */ stride = 0; sliceHeight = 1; //use nSliceHeight to warn about buffer alignement needed to be used to configure SIA DMA } else { /* We are in external ISP yuv case */ /* Get the number of byte per pixel */ mBytesPerPixel = getPixelDepth(mParamPortDefinition.format.image.eColorFormat); /* Check hardware constraints */ getHwConstraints(portdef.nPortIndex, portdef.format.image.eColorFormat,&mWidth, &mHeight, &mStride); /* Align buffer allocation according to the hardware constraints. * If width/height set by client is not compliant to HW * constraints, handle those internally. Note that port * configuration seen by client (getParameter) is based on * the (potentially unaligned) values set by the client ! */ mInternalFrameWidth = (mInternalFrameWidth + (mWidth-1))&~(mWidth-1); mInternalFrameHeight = (mInternalFrameHeight + (mHeight-1))&~(mHeight-1); if((mInternalFrameWidth != mParamPortDefinition.format.image.nFrameWidth) || (mInternalFrameHeight != mParamPortDefinition.format.image.nFrameHeight)) { DBGT_WARNING("Frame size requested is %dx%d.", (int)mParamPortDefinition.format.video.nFrameWidth, (int)mParamPortDefinition.format.video.nFrameHeight); DBGT_WARNING("Frame size output by the camera need to be %dx%d to respect hardware constraint alignment", (int)mInternalFrameWidth, (int)mInternalFrameHeight); DBGT_PTRACE("Allocated buffer size will be %dx%d to respect hardware constraint alignment for current pixel format", (int)mInternalFrameWidth, (int)mInternalFrameHeight); } else { DBGT_PTRACE("Allocated buffer size will be %dx%d (same as the frame size)", (int)mInternalFrameWidth, (int)mInternalFrameHeight); } /* Buffer size taking into account hardware constraint */ bufferSize = (OMX_U32) ((double) (mInternalFrameWidth * mInternalFrameHeight) * mBytesPerPixel); /* Set stride and sliceHeight */ stride = mInternalFrameWidth * mStride; sliceHeight = mInternalFrameHeight; } //Increase buffer size for adding extradata bufferSize += Extradata::GetExtradataSize(Component_Camera, portdef.nPortIndex); if (bufferSize == 0) { DBGT_ASSERT(0); //frameWidth and height have been overwritten, assert } /* Updated param */ mParamPortDefinition.nBufferSize = bufferSize; mParamPortDefinition.format.image.nStride = stride; mParamPortDefinition.format.image.nSliceHeight = sliceHeight; //use nSliceHeight to warn about buffer alignement need to be used to configure SIA DMA portSettingsChanged = OMX_TRUE; DBGT_PTRACE("mParamPortDefinition.format.image.nFrameWidth = %d", (int)mParamPortDefinition.format.image.nFrameWidth); DBGT_PTRACE("mParamPortDefinition.format.image.nFrameHeight = %d", (int)mParamPortDefinition.format.image.nFrameHeight); DBGT_PTRACE("mParamPortDefinition.format.image.eCompressionFormat = %d", (int)mParamPortDefinition.format.image.eCompressionFormat); DBGT_PTRACE("mParamPortDefinition.format.image.eColorFormat = %d", (int)mParamPortDefinition.format.image.eColorFormat); DBGT_PTRACE("mParamPortDefinition.format.image.nStride = %d", (int)mParamPortDefinition.format.image.nStride); DBGT_PTRACE("mParamPortDefinition.format.image.nSliceHeight = %d", (int)mParamPortDefinition.format.image.nSliceHeight); DBGT_PTRACE("mParamPortDefinition.nBufferSize = %d", (int)mParamPortDefinition.nBufferSize); break; } default: { DBGT_ASSERT(0); //this should not be called for other pipeId break; } } end: DBGT_EPILOG(""); return error; } void camport::getHwConstraints(t_uint16 portId,OMX_COLOR_FORMATTYPE omxformat, t_uint16 * p_multiple_width, t_uint16 * p_multiple_height, t_uint16 * p_multiple_stride) { /* table coming from hardware specification */ /* return value is multiple of pixels */ switch(portId) { case CAMERA_PORT_OUT0: //CAM Pipe case CAMERA_PORT_OUT1: //CAM Pipe { switch((t_uint32)omxformat) { case OMX_STE_COLOR_FormatRawData: *p_multiple_width = 1; *p_multiple_height = 1; *p_multiple_stride = 1; break; case OMX_COLOR_FormatCbYCrY: *p_multiple_width = 8; *p_multiple_height = 1; *p_multiple_stride = 2; break; case OMX_COLOR_FormatYUV420Planar: case OMX_COLOR_FormatYUV420SemiPlanar: *p_multiple_width = 8; *p_multiple_height = 2; *p_multiple_stride = 1; break; case OMX_SYMBIAN_COLOR_FormatYUV420MBPackedSemiPlanar: *p_multiple_width = 16; *p_multiple_height = 16; *p_multiple_stride = 1; break; default: DBGT_ASSERT(0); //this should not be called for other omxformat break; } break; } default: DBGT_ASSERT(0); //this should not be called for other pipeId break; } } /* * Supported Fmt table */ OMX_BOOL camport::isSupportedFmt(t_uint16 portID, OMX_COLOR_FORMATTYPE omxformat, t_uint32 omxcodingformat) { switch(portID) { case CAMERA_PORT_OUT0: { OMX_IMAGE_CODINGTYPE omxencodingformat = (OMX_IMAGE_CODINGTYPE)omxcodingformat; switch (omxencodingformat) { case OMX_IMAGE_CodingUnused: break; case OMX_IMAGE_CodingJPEG: return OMX_TRUE; default: return OMX_FALSE; } switch ((t_uint32)omxformat) { case OMX_STE_COLOR_FormatRawData: case OMX_COLOR_FormatCbYCrY: case OMX_COLOR_FormatYUV420Planar: case OMX_COLOR_FormatYUV420SemiPlanar: case OMX_SYMBIAN_COLOR_FormatYUV420MBPackedSemiPlanar: return OMX_TRUE; default: return OMX_FALSE; } } case CAMERA_PORT_OUT1: { OMX_IMAGE_CODINGTYPE omxencodingformat = (OMX_IMAGE_CODINGTYPE)omxcodingformat; switch (omxencodingformat) { case OMX_IMAGE_CodingUnused: break; case OMX_IMAGE_CodingJPEG: return OMX_TRUE; default: return OMX_FALSE; } switch ((t_uint32)omxformat) { case OMX_STE_COLOR_FormatRawData: case OMX_COLOR_FormatCbYCrY: case OMX_COLOR_FormatYUV420Planar: case OMX_COLOR_FormatYUV420SemiPlanar: case OMX_SYMBIAN_COLOR_FormatYUV420MBPackedSemiPlanar: return OMX_TRUE; default: return OMX_FALSE; } } default: DBGT_ASSERT(0,"portId has been corrupted");//portId has been corrupted return OMX_FALSE; } } t_uint16 camport::getMaxRes(t_uint16 portId) { switch (portId) { case CAMERA_PORT_OUT0: return 3280; case CAMERA_PORT_OUT1: return 3280; default: DBGT_ASSERT(0); // portId has been overriden return 0; } }
7a98e9501c65ec040cb9e7820235349ab947eca8
bda11204be0b6570fc340d4318e38ddf343579f0
/stan/math/opencl/sub_block.hpp
d8634af6bc98d718ec41a048fe9440ef5684c16a
[ "BSD-3-Clause", "GPL-2.0-only", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
bstatcomp/math
bf47bd40bcf23b2d523ea51c7bc9afb34b8aa730
45371f4925d4f45a9ec64ba99ab6afbc695516b7
refs/heads/develop
2021-08-07T21:21:45.273667
2020-10-02T19:47:57
2020-10-02T19:47:57
107,233,452
3
0
BSD-3-Clause
2020-08-27T21:24:50
2017-10-17T07:32:06
C++
UTF-8
C++
false
false
1,316
hpp
sub_block.hpp
#ifndef STAN_MATH_OPENCL_SUB_BLOCK_HPP #define STAN_MATH_OPENCL_SUB_BLOCK_HPP #ifdef STAN_OPENCL #include <stan/math/prim/meta.hpp> #include <stan/math/prim/err.hpp> #include <stan/math/opencl/opencl_context.hpp> #include <stan/math/opencl/matrix_cl_view.hpp> #include <stan/math/opencl/matrix_cl.hpp> #include <stan/math/opencl/kernel_generator/block.hpp> #include <stan/math/prim/err/throw_domain_error.hpp> #include <CL/cl2.hpp> #include <vector> #include <algorithm> namespace stan { namespace math { /** \ingroup matrix_cl_group * Write the contents of A into * `this` starting at the top left of `this` * @param A input matrix * @param A_i the offset row in A * @param A_j the offset column in A * @param this_i the offset row for the matrix to be subset into * @param this_j the offset col for the matrix to be subset into * @param nrows the number of rows in the submatrix * @param ncols the number of columns in the submatrix */ template <typename T> inline void matrix_cl<T, require_arithmetic_t<T>>::sub_block( const matrix_cl<T, require_arithmetic_t<T>>& A, size_t A_i, size_t A_j, size_t this_i, size_t this_j, size_t nrows, size_t ncols) { block(*this, this_i, this_j, nrows, ncols) = block(A, A_i, A_j, nrows, ncols); } } // namespace math } // namespace stan #endif #endif
74b14d522e5d46ff2ce10de600dd090a35159677
5219fb0e1f6bf72ab747e1a1f3b6235fbd8c08bd
/ProducerConsumer.cpp
f70d162cf8b618bbe1739262680c1f3df2dab177
[]
no_license
raviswan/ProgrammingProblems
5f35105cc5e5e327741c67f5231871c089bf58cc
25dccd075019a69a721f4dc603bc68ccbc086e82
refs/heads/master
2021-09-28T16:20:23.575957
2021-09-09T20:02:58
2021-09-09T20:02:58
46,036,071
9
8
null
null
null
null
UTF-8
C++
false
false
2,210
cpp
ProducerConsumer.cpp
#include <iostream> #include <vector> #include <thread> #include <chrono> #include <mutex> #include <queue> using namespace std; const int PRODUCER_COUNT = 2; const int CONSUMER_COUNT = 4; class WorkerQueue{ public: void add(int elem){ unique_lock<mutex> locker(mu); q.push(elem); cout<<"Produced elem "<<q.back()<<endl; locker.unlock(); cond.notify_one(); } int remove(int threadID){ unique_lock<mutex> locker(mu); cond.wait(locker, [&]() { return !q.empty(); }); a = q.front(); q.pop(); cout<<"Thread: "<<threadID<<" consumed "<<a<<endl; locker.unlock(); return a; } void operator()(){ return; } private: int a; queue<int> q; mutex mu; condition_variable cond; }; class Consumer{ public: Consumer(WorkerQueue& wq):wq(wq){ } int removeElem(int threadID){ return wq.remove(threadID); } int operator()(int i){ int a; while(1){ { removeElem(i); } this_thread::sleep_for(chrono::milliseconds(1000)); } } private: WorkerQueue& wq; }; class Producer{ public: Producer(WorkerQueue& wq):wq(wq){ } void operator()(){ while(1){ { ++elem; wq.add(elem); } this_thread::sleep_for(chrono::milliseconds(100)); } } private: WorkerQueue& wq; int elem = 1000; }; int main(){ WorkerQueue wq; Consumer a(ref(wq)); Consumer b(ref(wq)); Producer p(ref(wq)); thread producerThread(ref(p)); thread c1Thread(ref(a), 1); thread c2Thread(ref(b), 2); //vector<thread> consumerThreads; //vector<Consumer*> consumerVector; //vector<Producer*> producerVector; // //vector<thread> producerThreads; // for (int i = 0 ; i < PRODUCER_COUNT; ++i){ // producerVector.push_back(new Producer(&wq)); // thread t(new Producer(&wq)); // producerThreads.push_back(t); // } // for (int i = 0 ; i < CONSUMER_COUNT; ++i){ // consumerVector.push_back(new Consumer(&wq)); // thread t(consumerVector[i]); // consumerThreads.push_back(t); // } //cout<<"Number of consumer threads = "<<consumerVector.size()<<endl; //cout<<"number of producers threads = "<<producerVector.size()<<endl; producerThread.join(); c1Thread.join(); c2Thread.join(); return 1; }
92c792a23153c5d04b266f62dc506525ef5f786f
08c5dcb5542cab1210fe7c551bbbcdc9deb0049c
/src/bin/HPdesign.cc
29d88a142d44e7d9866656cd22ec0ced22e6fa86
[ "LicenseRef-scancode-newlib-historical" ]
permissive
BackofenLab/CPSP-tools
89d9922dbbaa7189b0e1c347e1500c0ac2494de7
a6b36b7a6bfe5fb2e533477b096aaf65975f1ac2
refs/heads/master
2023-03-17T13:25:50.724547
2023-03-08T16:17:38
2023-03-08T16:17:38
55,157,464
0
0
null
2016-03-31T14:54:58
2016-03-31T14:35:00
C++
UTF-8
C++
false
false
16,101
cc
HPdesign.cc
/* * Main authors: * Martin Mann http://www.bioinf.uni-freiburg.de/~mmann/ * * Contributing authors: * Sebastian Will http://www.bioinf.uni-freiburg.de/~will/ * * Copyright: * Martin Mann, 2007 * * This file is part of the CPSP-tools package: * http://www.bioinf.uni-freiburg.de/sw/cpsp/ * * See the file "LICENSE" for information on usage and * redistribution of this file, and for a * DISCLAIMER OF ALL WARRANTIES. * */ #include "HPdesign.hh" #include "version.hh" #include <iomanip> #include <biu/Timer.hh> #include <biu/LatticeFrame.hh> #include <cpsp/HCoreDatabaseFILE.hh> #include <cpsp/gecode/GC_HPThreading.hh> namespace cpsp { ///////////////////////////////////////////////// // HPdesignOptions implementations ///////////////////////////////////////////////// HPdesignOptions::HPdesignOptions(int argc, char** argv) throw(cpsp::Exception) : opts(NULL), lattice(NULL), structure(NULL), coreDB(NULL), subOptLvl(0), maxDegeneracy(10), verboseOut(false), minHs(2), maxHs(99999), all(false), maxSeqs(1), minimalOut(false), structsRel() { // init allowed arguments biu::OptionMap allowedArgs; std::string infoText; initAllowedArguments(allowedArgs,infoText); // parse programm arguments opts = new biu::COptionParser( allowedArgs, argc, (char**)argv, infoText); if (opts->noErrors()) { if (opts->getBoolVal("help")) { opts->coutUsage(); throw cpsp::Exception("",0); } if (opts->getBoolVal("version")) { giveVersion(); throw cpsp::Exception("",0); } verboseOut = opts->getBoolVal("v"); minimalOut = opts->getBoolVal("s"); if (minimalOut) verboseOut = false; all = opts->getBoolVal("all"); if (all) { maxSeqs = UINT_MAX-2; } // lattice modell if (opts->getStrVal("lat") == "CUB") latDescr = new biu::LatticeDescriptorCUB(); else if (opts->getStrVal("lat") == "FCC") latDescr = new biu::LatticeDescriptorFCC(); else { throw cpsp::Exception( "Error in arguments: lattice is not supported",-2); } lattice = new biu::LatticeModel(latDescr); // structure if (opts->argExist("relMoves") ) { structure = new biu::IPointVec( lattice->relMovesToPoints( lattice->parseMoveString( opts->getStrVal("struct") ))); } else { structure = new biu::IPointVec( lattice->absMovesToPoints( lattice->parseMoveString( opts->getStrVal("struct") ))); } // the set of relative move strings to structure const biu::AutomorphismVec autM = lattice->getDescriptor()->getAutomorphisms(); biu::AutomorphismVec::const_iterator a; biu::IPointVec act(*structure); for (a = autM.begin(); a!= autM.end(); a++) { for (biu::IPointVec::size_type pos=0; pos < structure->size(); pos++) { act[pos] = (*a) * (structure->at(pos)); } structsRel.insert(lattice->getString(lattice->pointsToRelMoves(act))); } // H-core database char * tmpStr = NULL; if (opts->argExist("dbPath")) { coreDB = new cpsp::HCoreDatabaseFILE(opts->getStrVal("dbPath")); } else if ((tmpStr = getenv("CPSP_COREDB")) != NULL) { coreDB = new cpsp::HCoreDatabaseFILE(std::string(tmpStr)); } else { throw cpsp::Exception( "H-core database Error: no database available (FILE)",-1); } // testen if (!coreDB->isConnected()) { throw cpsp::Exception( "H-core database Error: can't open database",-1); } if (!coreDB->initCoreAccess( *latDescr, structure->size())) { throw cpsp::Exception( "H-core database Error: access init failed",-1); } // suboptimality level int tmp = opts->getIntVal("subOpt"); if (tmp < 0) { throw cpsp::Exception( "Parameter Error: subOpt < 0",-1); } else { subOptLvl = (unsigned int)tmp; } // maximal degeneracy tmp = opts->getIntVal("maxDeg"); if (tmp < 1) { throw cpsp::Exception( "Parameter Error: maxDeg < 1",-1); } else { maxDegeneracy = (unsigned int)tmp; } tmp = opts->getIntVal("minH"); if (tmp < 2) { throw cpsp::Exception( "Parameter Error: minH < 2",-1); } else { minHs = (unsigned int)tmp; } tmp = opts->getIntVal("maxH"); if (tmp < 0) { throw cpsp::Exception( "Parameter Error: maxH < 0",-1); } else { maxHs = std::min((unsigned int)tmp, (unsigned int)structure->size()); // check if useful limits if (minHs > maxHs) { throw cpsp::Exception( "Parameter Error: minH > maxH",-1); } } if (opts->argExist("maxSeq")) { tmp = opts->getIntVal("maxSeq"); if (tmp < 0) { throw cpsp::Exception( "Parameter Error: maxSeq < 0",-1); } else { maxSeqs = (unsigned int)tmp; } } statistics = opts->argExist("stat"); } else { throw cpsp::Exception( "Parameter Error: not parseable",-1); } } HPdesignOptions::~HPdesignOptions() { if (coreDB != NULL) delete coreDB; if (structure != NULL) delete structure; if (lattice != NULL) delete lattice; if (opts != NULL) delete opts; } bool HPdesignOptions::structFound(const cpsp::StringVec & structs) const { assert(lattice != NULL); bool found = false; for (cpsp::StringVec::const_iterator i = structs.begin(); !found && i!=structs.end(); i++) { // empty strings are skipped (may occure by GC_HPThreading::enumerateStructures(..) ) if (i->compare("") == 0) continue; // get relative move string std::string str = lattice->getString( lattice->absMovesToRelMoves( lattice->getDescriptor()->getSequence(*i))); // search if one of the symmetrics to the initial one found = std::find(structsRel.begin(),structsRel.end(),str) != structsRel.end(); } return found; } void HPdesignOptions::initAllowedArguments(biu::OptionMap & allowedArgs, std::string &infoText ) const { allowedArgs.push_back(biu::COption( "struct", false, biu::COption::STRING, "the structure as a move string")); allowedArgs.push_back(biu::COption( "dbPath", true, biu::COption::STRING, "file based database root path (or use $CPSP_COREDB)")); allowedArgs.push_back(biu::COption( "lat", true, biu::COption::STRING, "lattice (CUB, FCC)", "CUB")); allowedArgs.push_back(biu::COption( "relMoves", true, biu::COption::BOOL, "structure given in relative moves")); allowedArgs.push_back(biu::COption( "subOpt", true, biu::COption::INT, "suboptimal core levels taken into account (value >= 0)", "0")); allowedArgs.push_back(biu::COption( "maxDeg", true, biu::COption::INT, "maximal degeneracy allowed for a sequence (value >= 1)", "1")); allowedArgs.push_back(biu::COption( "maxSeq", true, biu::COption::INT, "maximal number of sequences to design (value >= 0)")); allowedArgs.push_back(biu::COption( "minH", true, biu::COption::INT, "minimal number of Hs in sequence (value >= 2)", "2")); allowedArgs.push_back(biu::COption( "maxH", true, biu::COption::INT, "maximal number of Hs in sequence (value >= 0)", "99999")); allowedArgs.push_back(biu::COption( "all", true, biu::COption::BOOL, "find all sequences")); allowedArgs.push_back(biu::COption( "s", true, biu::COption::BOOL, "silent - minimal output")); allowedArgs.push_back(biu::COption( "stat", true, biu::COption::BOOL, "print statistics of the run")); allowedArgs.push_back(biu::COption( "v", true, biu::COption::BOOL, "verbose output")); allowedArgs.push_back(biu::COption( "help", true, biu::COption::BOOL, "program parameters and help")); allowedArgs.push_back(biu::COption( "version", true, biu::COption::BOOL, "version information of this program")); infoText = std::string("HPdesign designs for a given structure sequences that will") + std::string(" maximally fold into a given number of optimal structures") + std::string(" (degeneracy), the given structure within.\n\nTo find them an") + std::string(" H-core database is used with optimal and suboptimal cores.") + std::string(" Beginning with the biggest possible core iteratively all") + std::string(" cores up to a given suboptimality level are taken into account") + std::string(" to design the sequences."); } // initArguments ///////////////////////////////////////////////// // HPdesign implementations ///////////////////////////////////////////////// HPdesign::HPdesign(HPdesignOptions *opts_) : opts(opts_), stat(opts->doStatistic()?new Statistic():NULL) { initStructPoints(); } HPdesign::~HPdesign() { if (stat != NULL) { delete stat; stat = NULL; } } void HPdesign::generateSeqs() { // timer for statistics biu::Timer timer; timer.start(); biu::IPointVec::size_type maxHH = opts->getMaxHs(), hCount = maxHH; const biu::LatticeDescriptor *latD = opts->getLattice()->getDescriptor(); unsigned int i = 0, lastMaxHH = 0, designedSeqs = 0; // for each number of Hs allowed (and if still seqs to design) while ((opts->getMaxSeqs() > designedSeqs) && hCount >= (biu::IPointVec::size_type)opts->getMinHs()) { lastMaxHH = INT_MAX; // for each suboptimality level for this core size for(i=opts->getSubOptLvl()+1; lastMaxHH>0 && i>0; i--) { lastMaxHH--; if (opts->getCoreDB()->initCoreAccess(*latD, hCount, 0, lastMaxHH) ) { // check for all best in initialised coreDB designedSeqs += checkCores( opts->getCoreDB(), lastMaxHH, (opts->getMaxSeqs()-designedSeqs) ); } else { lastMaxHH = 0; // loop breaking } } hCount--; // reduce core size } if (!opts->silent()) { if (designedSeqs == 0) { std::cout <<"\n ==> no sequence found\n" <<std::endl; } else { std::cout <<"\n ==> designed sequences = " <<designedSeqs <<std::endl; } } if (stat != NULL) { stat->time = timer.stop(); std::cout <<"\n - statistics :\n" <<"\n runtime : " <<stat->time <<" ms" <<"\n seqs. tested : " <<stat->generatedSeqs <<"\n cores tested : " <<stat->coresTested <<"\n" <<std::endl; } } unsigned int HPdesign::checkCores(HCoreDatabase * coreDB, unsigned int & contacts, unsigned int maxSeqs) { HCore core; contacts = 0; unsigned int numOfSeqs = 0; std::set< std::string > foundSeqs; if (! coreDB->getNextCore(core)) return false; else { contacts = core.getContacts(); if (opts->verboseOutput()) std::cout <<"\n --> next cores: size = "<< core.getSize() <<", HH-contacts = " <<contacts <<std::endl; coreDB->setActMinHHcontacts(contacts); std::string actSeq; std::vector< PosSet >::const_iterator s; biu::IntPoint shift; do { if (stat != NULL) { stat->coresTested++; } for (s = structPoints.begin(); s != structPoints.end(); s++) { if (isSubset(*s, core.getPoints(),shift)) { // std::cerr <<" was gefunden ... nun noch seq ausrechnen!" <<std::endl; actSeq = std::string(s->size(),'P'); // std::cout <<"shift : "<<shift <<std::endl ; for(biu::IPointSet::const_iterator it = core.getPoints().begin(); it != core.getPoints().end(); it++) { StructPos act = *(s->find(*it+shift)); actSeq[act.getSeqPos()] = 'H'; } foundSeqs.insert(actSeq); } } } while (coreDB->getNextCore(core)); for(std::set< std::string >::const_iterator seqs = foundSeqs.begin(); numOfSeqs < maxSeqs && seqs != foundSeqs.end(); seqs++) { if(checkSeq(*seqs)) numOfSeqs++; } } return numOfSeqs; } void HPdesign::initStructPoints(void) { const biu::AutomorphismVec autM = opts->getLattice()->getDescriptor()->getAutomorphisms(); biu::AutomorphismVec::const_iterator a; structPoints.resize(autM.size()); std::vector< PosSet >::iterator sp = structPoints.begin(); const biu::IPointVec* orig = opts->getStructure(); biu::IPointVec::const_iterator op; std::string::size_type pos = 0; for (a = autM.begin(); a!= autM.end(); a++) { pos = 0; for(op = orig->begin(); op != orig->end(); op++) { sp->insert( StructPos((*a) * (*op),pos)); // apply automorphism a to point op pos++; } sp++; // next automorph point set to fill } } bool HPdesign::isSubset(const PosSet &s, const biu::IPointSet &sub, biu::IntPoint & shift) { if (s.size() < sub.size()) // sub has to be smaller return false; if (s.size() == 0) // is true for empty sets return true; // std::cout <<"\nstruct : "; // {for (PosSet::const_iterator k = s.begin(); k!= s.end(); k++) std::cout <<*k <<", ";} // std::cout <<"\nsub : "; // {for (biu::IPointSet::const_iterator k = sub.begin(); k!= sub.end(); k++) std::cout <<*k <<", ";} // std::cout <<std::endl<<std::endl; PosSet::size_type maxTests = s.size()-sub.size()+1; PosSet::const_iterator sIt = s.begin(); biu::IPointSet::const_iterator pIt = sub.begin(); for (;maxTests>0; maxTests--) { pIt = sub.begin(); shift = *sIt - *pIt; for (pIt++; pIt != sub.end(); pIt++) { if ( s.find(*pIt + shift) == s.end() ) break; } if (pIt == sub.end()) // than all points found in s return true; sIt++; } return false; } bool HPdesign::checkSeq(const std::string& seq) { if (stat != NULL) { stat->generatedSeqs++; } using namespace cpsp; using namespace cpsp::gecode; GC_HPThreading threading; threading.setLatticeDescriptor(opts->getLattice()->getDescriptor()); threading.setSequence(seq); // testen if (!opts->getCoreDB()->isConnected()) { throw cpsp::Exception( "H-core database Error: can't open database",-1); } if (!opts->getCoreDB()->initCoreAccess( *(opts->getLattice()->getDescriptor()), threading.getCoreSize(), threading.getContactsInSeq(), UINT_MAX-2)) { throw cpsp::Exception( "H-core database Error: access init failed",-1); } threading.setCoreDB(opts->getCoreDB()); threading.setCoreSelection(GC_HPThreading::ALL_BEST); threading.setVerboseOutput(false); threading.setRunMode(GC_HPThreading::COUNT); threading.setUsingDDS(false); threading.setSymmetryBreaking(true); threading.setMaxStructures(opts->getMaxDegeneracy()+1); threading.setNoOutput(true); cpsp::StringVec structs; // unsigned int deg = threading.generateStructures(); unsigned int deg = threading.enumerateStructures(structs); // check if degeneracy limit is maintained // check if structure is among the optimal ones if ( deg > 0 && deg <= opts->getMaxDegeneracy() && opts->structFound(structs)) { if (!opts->silent()) { std::cout <<" " <<seq <<" : degeneracy = " <<std::setw(6) <<deg <<", energy = -" <<std::setw(5) <<(opts->getCoreDB()->getActMinHHcontacts()-threading.getContactsInSeq()) <<std::endl; } else { std::cout <<seq <<" " <<std::setw(6) <<deg <<std::endl; } return true; } return false; } } ///////////////////////////////////////////////// // main ///////////////////////////////////////////////// int main(int argc, char ** argv) { using namespace cpsp; try { // check user parameters HPdesignOptions opts(argc,argv); if (!opts.silent()) { std::cout <<"\n==================================" <<"\n HPdesign - CPSP-tool-library" <<"\n==================================" <<"\n" <<std::endl; } // generate deisgn object with user parameter settings HPdesign hpDesign(&opts); // generate sequences hpDesign.generateSeqs(); if (!opts.silent()) { std::cout <<"\n==================================\n" <<std::endl; } // catch errors in user parameters etc. } catch (cpsp::Exception& ex) { std::cerr <<"\n\t"+ex.toString()+"\n\n" <<std::endl; return ex.retValue; } return 0; }
9ac760afd252681be3efdaeb42e16eaa8078eade
c091bf55a7a4767f8154724c9b517a83b7cdc2f9
/contest5/AA.cpp
91e0e7132bd1a6bac6c8aa39eaee38a72c04c7f8
[]
no_license
yerson001/ProgramacionCompetitiva
374355f2d13d8f82a67631e3eb42d656f871c0f3
3b07eb84a3406000652cdcffe9ee387b0b47a720
refs/heads/main
2023-05-27T19:00:03.941374
2021-06-13T21:19:44
2021-06-13T21:19:44
372,605,134
0
0
null
null
null
null
UTF-8
C++
false
false
704
cpp
AA.cpp
#include <bits/stdc++.h> int main() { std::cin.tie(nullptr); int t; std::cin >> t; while (t--) { int n, m; std::cin >> n >> m; for (int i = 0; i < n; ++i) { int a; std::cin >> a; m -= a; } std::cout << (m == 0 ? "YES" : "NO") << "\n"; } return 0; } /* #include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, m, sum = 0; cin >> n >> m; vector<int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; sum += a[i]; } cout << (sum == m ? "YES\n" : "NO\n"); } } */
e030065c2710ec2ea344084ec9ca96ce87722b5f
202c8727aa87d1265c6cb837922d8c9cf2b2752e
/Actividad7/main.cpp
c2ddbe27612c187aeb0bc37d7558453350cc4e2e
[]
no_license
nlandau91/Procesamiento-de-Imagenes
b80d39d0a38eeb8cf7ea69c5682fae8fb84284ec
6613a77ecb894bdb4382e47707c870d06b1d48e1
refs/heads/main
2023-01-31T13:41:27.995901
2020-12-07T19:21:30
2020-12-07T19:21:30
300,063,974
0
0
null
null
null
null
UTF-8
C++
false
false
10,538
cpp
main.cpp
#include <opencv2/opencv.hpp> #include <iostream> cv::Mat resize(cv::Mat &src, int h = 800) { double ratio = (double)h / src.rows; cv::Mat dst; cv::resize(src, dst, cv::Size(), ratio, ratio); return dst; } //corrige la perspectiva de una imagen cv::Mat corregirPerspectiva(cv::Mat &src) { //buscamos los bordes de la hoja //para eso, la convertimos a escala de grises cv::Mat src_gray; cv::cvtColor(src, src_gray, cv::COLOR_BGR2GRAY); //aplicamos un filtro bilateral que preserva bordes cv::Mat thr; cv::bilateralFilter(src_gray, thr, 5, 75, 75); //cv::imshow("thr", thr); //cv::waitKey(0); //aplicamos un threshold para que nos quede una imagen binaria //cv::threshold(thr, thr, 170, 255, cv::THRESH_BINARY); cv::adaptiveThreshold(thr, thr, 255, cv::ADAPTIVE_THRESH_GAUSSIAN_C, cv::THRESH_BINARY, 57, 4); //cv::imshow("thr", thr); //cv::waitKey(0); //filtro de la mediana para limpiar pequenios detalles cv::medianBlur(thr, thr, 5); //cv::imshow("thr", thr); //cv::waitKey(0); //agregamos un borde negro en caso de que la hoja este tocando un borde de la imagen cv::copyMakeBorder(thr, thr, 5, 5, 5, 5, cv::BORDER_CONSTANT, cv::Scalar(0, 0, 0)); cv::Mat edges; cv::Canny(thr, edges, 200, 250); //cv::imshow("edges", edges); //cv::waitKey(0); //ahora que tenemos los bordes, encontramos el contorno //cv::Mat contours; std::vector<std::vector<cv::Point>> contours; cv::Mat hierarchy; cv::findContours(edges, contours, hierarchy, cv::RETR_TREE, cv::CHAIN_APPROX_SIMPLE); //buscamos el contorno del rectangulo mas grande //si no lo encontramos, devolvemos las esquinas de la imagen original int height = edges.rows; int width = edges.cols; int max_contour_area = (height - 10) * (height - 10); //suponemos que la hoja ocupa al menos un cuarto de la imagen int maxAreaFound = max_contour_area * 0.25; //guardamos el contorno de la pagina std::vector<cv::Point> pageContour = {cv::Point(5, 5), cv::Point(5, height - 5), cv::Point(width - 5, height - 5), cv::Point(width - 5, 5)}; //iteramos sobre todos los contornos int idx = 0; int maxidx = 0; for (std::vector<cv::Point> cnt : contours) { //simplificamos el contorno double perimeter = cv::arcLength(cnt, true); //cv::Mat approx; std::vector<cv::Point> approx; cv::approxPolyDP(cnt, approx, 0.02 * perimeter, true); //la pagina tiene 4 esquinas y es convexa //el area debe ser mayor que maxAreaFound if (approx.size() == 4) { if (cv::isContourConvex(approx)) { double area = cv::contourArea(approx); if (maxAreaFound < area && area < max_contour_area) { maxAreaFound = area; pageContour = approx; maxidx = idx; } } } idx++; } //cv::drawContours(src,contours,maxidx,cv::Scalar(255,255,255),1,cv::LINE_8,hierarchy,0); //ahora tenemos los 4 puntos que definen el contorno //los ordenamos en sentido antihorario comenzando por la esquina superior izquierda double midX = pageContour[0].x + pageContour[1].x + pageContour[2].x + pageContour[3].x; midX = (double)midX / 4; double midY = pageContour[0].y + pageContour[1].y + pageContour[2].y + pageContour[3].y; midY = (double)midY / 4; std::vector<cv::Point2f> quad_pts(4); //puntos origen for (cv::Point p : pageContour) { if (p.x < midX && p.y < midY) { quad_pts[0] = p; } if (p.x < midX && p.y >= midY) { quad_pts[1] = p; } if (p.x >= midX && p.y >= midY) { quad_pts[2] = p; } if (p.x >= midX && p.y < midY) { quad_pts[3] = p; } } //arreglamos el offset de 5 del contorno for (cv::Point p : quad_pts) { p.x -= 5; if (p.x < 0) { p.x = 0; } p.y -= 5; if (p.y < 0) { p.y = 0; } } cv::Rect boundRect = cv::boundingRect(pageContour); std::vector<cv::Point2f> squre_pts; //puntos destino squre_pts.push_back(cv::Point2f(boundRect.x, boundRect.y)); squre_pts.push_back(cv::Point2f(boundRect.x, boundRect.y + boundRect.height)); squre_pts.push_back(cv::Point2f(boundRect.x + boundRect.width, boundRect.y + boundRect.height)); squre_pts.push_back(cv::Point2f(boundRect.x + boundRect.width, boundRect.y)); cv::Mat transmtx = cv::getPerspectiveTransform(quad_pts, squre_pts); cv::Mat transformed = cv::Mat::zeros(src.rows, src.cols, CV_8UC3); cv::warpPerspective(src, transformed, transmtx, src.size()); return transformed; } int main(int argc, char *argv[]) { //leemos la imagen char const *src_path = "img.png"; if (argc > 1) { src_path = argv[1]; } cv::Mat src = cv::imread(src_path, cv::IMREAD_UNCHANGED); if (src.empty()) { std::cout << "No se pudo cargar la imagen" << std::endl; return -1; } //empezamos por corregir la perspectiva de la hoja cv::Mat corrected = corregirPerspectiva(src); //ahora que tenemos la perspectiva corregida, procedemos a identificar circulos //filtramos la imagen para elimiar ruido cv::Mat filtered; cv::medianBlur(corrected,filtered,5); //aplicamos thresholds a la imagen para separar los colores que nos interesan //esto es mas sencillo si utilizamos hsv cv::Mat hsv_image; cv::cvtColor(filtered, hsv_image, cv::COLOR_BGR2HSV); //establecemos los rangos para cada color, dividimos por dos porque el rango va de 0 a 180, no a 360 int low_H_rojo1 = 0 / 2, high_H_rojo1 = 15 / 2 - 1; int low_H_naranja = 28 / 2, high_H_naranja = 36 / 2 - 1; int low_H_amarillo = 39 / 2, high_H_amarillo = 55 / 2 - 1; int low_H_rojo2 = 355 / 2, high_H_rojo2 = 360 / 2; //establecemos los rangos para el s y el v, esto nos sirve para que los blancos y negros no sean confundidos con algun color int low_S = 100, high_S = 220; int low_V = 100, high_V = 220; //Para cada rango, obtenemos una imagen con solamente los pixels que se encuentran en ese rango cv::Mat en_rango_rojo1, en_rango_rojo2, en_rango_rojo, en_rango_naranja, en_rango_amarillo; cv::inRange(hsv_image, cv::Scalar(low_H_rojo1, 40, low_V), cv::Scalar(high_H_rojo1, high_S, high_V), en_rango_rojo1); cv::inRange(hsv_image, cv::Scalar(low_H_rojo2, 40, low_V), cv::Scalar(high_H_rojo2, high_S, high_V), en_rango_rojo2); cv::bitwise_or(en_rango_rojo1, en_rango_rojo2, en_rango_rojo); cv::inRange(hsv_image, cv::Scalar(low_H_naranja, low_S, low_V), cv::Scalar(high_H_naranja, high_S, high_V), en_rango_naranja); cv::inRange(hsv_image, cv::Scalar(low_H_amarillo, low_S, low_V), cv::Scalar(high_H_amarillo, high_S, high_V), en_rango_amarillo); //aplicamos operaciones morfologicas (apertura + cierre) para eliminar imperfecciones cv::medianBlur(en_rango_rojo, en_rango_rojo, 5); cv::medianBlur(en_rango_naranja, en_rango_naranja, 5); cv::medianBlur(en_rango_amarillo, en_rango_amarillo, 5); cv::Mat kernel = cv::getStructuringElement(cv::MORPH_ELLIPSE, cv::Size(5, 5)); cv::morphologyEx(en_rango_rojo, en_rango_rojo, cv::MORPH_OPEN, kernel); cv::morphologyEx(en_rango_rojo, en_rango_rojo, cv::MORPH_CLOSE, kernel); cv::morphologyEx(en_rango_naranja, en_rango_naranja, cv::MORPH_OPEN, kernel); cv::morphologyEx(en_rango_naranja, en_rango_naranja, cv::MORPH_CLOSE, kernel); cv::morphologyEx(en_rango_amarillo, en_rango_amarillo, cv::MORPH_OPEN, kernel); cv::morphologyEx(en_rango_amarillo, en_rango_amarillo, cv::MORPH_CLOSE, kernel); //usamos el metodo de hough para encontrar circulos std::vector<cv::Vec3f> red_circles; std::vector<cv::Vec3f> orange_circles; std::vector<cv::Vec3f> yellow_circles; cv::HoughCircles(en_rango_rojo, red_circles, cv::HOUGH_GRADIENT, 1, en_rango_rojo.rows / 4, // change this value to detect circles with different distances to each other 100, 20, 0, 0); // change the last two parameters (min_radius & max_radius) to detect larger circles cv::HoughCircles(en_rango_naranja, orange_circles, cv::HOUGH_GRADIENT, 1, en_rango_naranja.rows / 4, 100, 20, 0, 0); cv::HoughCircles(en_rango_amarillo, yellow_circles, cv::HOUGH_GRADIENT, 1, en_rango_amarillo.rows / 4, 100, 20, 0, 0); // Loop over all detected circles and outline them on the original image if (red_circles.size() > 0) { for (size_t current_circle = 0; current_circle < red_circles.size(); ++current_circle) { cv::Point center(std::round(red_circles[current_circle][0]), std::round(red_circles[current_circle][1])); int radius = std::round(red_circles[current_circle][2]); cv::circle(corrected, center, radius, cv::Scalar(181,113,255), 5); } } if (orange_circles.size() > 0) { for (size_t current_circle = 0; current_circle < orange_circles.size(); ++current_circle) { cv::Point center(std::round(orange_circles[current_circle][0]), std::round(orange_circles[current_circle][1])); int radius = std::round(orange_circles[current_circle][2]); cv::circle(corrected, center, radius, cv::Scalar(16,64,180), 5); } } if (yellow_circles.size() > 0) { for (size_t current_circle = 0; current_circle < yellow_circles.size(); ++current_circle) { cv::Point center(std::round(yellow_circles[current_circle][0]), std::round(yellow_circles[current_circle][1])); int radius = std::round(yellow_circles[current_circle][2]); cv::circle(corrected, center, radius, cv::Scalar(0,255,255), 5); } } cv::namedWindow("src", cv::WINDOW_NORMAL); cv::namedWindow("corrected", cv::WINDOW_NORMAL); //cv::namedWindow("en_rango_rojo", cv::WINDOW_NORMAL); //cv::namedWindow("en_rango_naranja", cv::WINDOW_NORMAL); //cv::namedWindow("en_rango_amarillo", cv::WINDOW_NORMAL); cv::imshow("src", src); cv::imshow("corrected", corrected); //cv::imshow("en_rango_rojo", en_rango_rojo); //cv::imshow("en_rango_naranja", en_rango_naranja); //cv::imshow("en_rango_amarillo", en_rango_amarillo); cv::waitKey(0); cv::destroyAllWindows(); }
360071d5c4d5ddad8163f55f92806fae835d9626
536656cd89e4fa3a92b5dcab28657d60d1d244bd
/chrome/browser/offline_pages/prefetch/notifications/prefetch_notification_service_impl.h
18f7dcb0c769dce8d3cc153e168a8e0351757243
[ "BSD-3-Clause" ]
permissive
ECS-251-W2020/chromium
79caebf50443f297557d9510620bf8d44a68399a
ac814e85cb870a6b569e184c7a60a70ff3cb19f9
refs/heads/master
2022-08-19T17:42:46.887573
2020-03-18T06:08:44
2020-03-18T06:08:44
248,141,336
7
8
BSD-3-Clause
2022-07-06T20:32:48
2020-03-18T04:52:18
null
UTF-8
C++
false
false
1,334
h
prefetch_notification_service_impl.h
// Copyright 2020 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 CHROME_BROWSER_OFFLINE_PAGES_PREFETCH_NOTIFICATIONS_PREFETCH_NOTIFICATION_SERVICE_IMPL_H_ #define CHROME_BROWSER_OFFLINE_PAGES_PREFETCH_NOTIFICATIONS_PREFETCH_NOTIFICATION_SERVICE_IMPL_H_ #include "chrome/browser/offline_pages/prefetch/notifications/prefetch_notification_service.h" #include <memory> #include "base/memory/weak_ptr.h" namespace notifications { class NotificationScheduleService; } // namespace notifications namespace offline_pages { // Service to manage offline prefetch notifications via // notifications::NotificationScheduleService. class PrefetchNotificationServiceImpl : public PrefetchNotificationService { public: PrefetchNotificationServiceImpl( notifications::NotificationScheduleService* schedule_service); ~PrefetchNotificationServiceImpl() override; private: // Used to schedule notification to show in the future. Must outlive this // class. notifications::NotificationScheduleService* schedule_service_; DISALLOW_COPY_AND_ASSIGN(PrefetchNotificationServiceImpl); }; } // namespace offline_pages #endif // CHROME_BROWSER_OFFLINE_PAGES_PREFETCH_NOTIFICATIONS_PREFETCH_NOTIFICATION_SERVICE_IMPL_H_
c3598d97084455dc4b465f7e9fe404edba19994d
de131f7e17eec3bfd8f95f58c2e0be92c9f9d7d5
/Documentos/Parcial2/CC1017248976/Punto2/CuentaCheques.h
ea3acd6b83c7093d51b1b884347a93524c66c33b
[]
no_license
Valentinaba/CursoFCII_UdeA-2020-2
ed270bff33f7bef47236dbc593f0bb24bd3f8b8a
6b45c8fe63aa28d5ea404ecebe16c0ce95bb1001
refs/heads/master
2023-01-31T03:47:56.254179
2020-12-18T02:28:07
2020-12-18T02:28:07
289,015,438
0
0
null
2020-08-20T16:21:27
2020-08-20T13:35:55
null
UTF-8
C++
false
false
339
h
CuentaCheques.h
#ifndef CUENTA_CH #define CUENTA_CH #include <iostream> #include "Cuenta.h" class CuentaCheques : public Cuenta { public: CuentaCheques(const double, const double); void cargarCheques(const double); void abonar(const double); void cargar(const double); private: double tasaCuota; void fijarCuota(const double); }; #endif
4ebdc054c03bc5fb9c9931cd1df893ff9755df2b
8f961bc022f5ce587d854b7458909c3e0f1ef4bb
/framework/amorphous/LightWave/3DMeshModelBuilder_LW.hpp
60e56e12c5d0684961d6e06e940b5ff01d06fd25
[]
no_license
takashikumagai/amorphous
73f0bd8c5f5d947a71bbad696ce728f25c456aae
8e5f5ec9368757a639ed4cf7aeb02a4b201e6b42
refs/heads/master
2020-05-17T10:55:59.428403
2018-07-05T02:48:59
2018-07-05T02:48:59
183,671,422
0
0
null
null
null
null
UTF-8
C++
false
false
4,429
hpp
3DMeshModelBuilder_LW.hpp
#ifndef __3DMESHMODELBUILDER_LW_H__ #define __3DMESHMODELBUILDER_LW_H__ #include <list> #include "fwd.hpp" #include "amorphous/Graphics/MeshModel/3DMeshModelBuilder.hpp" #include "amorphous/Graphics/MeshModel/General3DMesh.hpp" //#ifdef _DEBUG //#pragma comment ( lib, "LW_FrameworkEx_d.lib" ) //#else //#pragma comment ( lib, "LW_FrameworkEx.lib" ) //#endif namespace amorphous { struct SLayerSet { std::string strOutputFilename; int GroupNumber; std::vector<LWO2_Layer *> vecpMeshLayer; /// A skeleton is created from the skelegons in this layer and saved /// to the same file with the mesh data extracted from vecpMeshLayer. /// A skeleton of a mesh must be represented as a single skelegon tree /// in a single layer. LWO2_Layer *pSkelegonLayer; public: SLayerSet() : GroupNumber(-1), pSkelegonLayer(NULL) {} SLayerSet( const std::vector<LWO2_Layer *>& mesh_layer ) : GroupNumber(-1), vecpMeshLayer(mesh_layer), pSkelegonLayer(NULL) {} SLayerSet(const std::string& output_filename) : strOutputFilename(output_filename), GroupNumber(-1), pSkelegonLayer(NULL) {} }; class C3DMeshModelBuilder_LW : public C3DModelLoader { /// borrowed reference /// this class does not load / release the model data /// the model data has to be supplied before building the model std::shared_ptr<LWO2_Object> m_pSrcObject; std::string m_strTargetLayerName; /// store indices from the original skeleton index to the dest bone index /// dest bone indices are in the order of the tree traversal during runtime /// and point to blend matrices std::vector<int> m_vecDestBoneIndex; int m_iNumDestBones; /// hold info from which mesh is created SLayerSet m_TargetLayerInfo; std::vector<std::string> m_vecSurfaceMaterialOption; const unsigned int m_DefaultVertexFlags; bool m_UseBoneStartAsBoneLocalOrigin; std::vector<int> m_PolygonGroupIndices; private: void BuildSkeletonFromSkelegon_r( int iSrcBoneIndex, const std::vector<LWO2_Bone>& rvecSrcBone, const LWO2_Layer& rLayer, // const Vector3& vParentOffset, CMMA_Bone& rDestBone ); /// set transform from model space to bone space /// all the bone transforms are not supposed to have rotations void BuildBoneTransformsNROT_r(const Vector3& vParentOffset, CMMA_Bone& rDestBone ); void SetVertexWeights( std::vector<General3DVertex>& rDestVertexBuffer, LWO2_Layer& rLayer ); void ProcessLayer( LWO2_Layer& rLayer, const GeometryFilter& filter = GeometryFilter() ); /// create mesh materials from the surfaces of the LightWave object /// - surface texture: stored in CMMA_Material.vecTexture[0] /// - normal map texture: stored in CMMA_Material.vecTexture[1] void SetMaterials(); /// load options written in the comment text box on the surface editor dialog void LoadSurfaceCommentOptions(); void BreakPolygonsIntoSubsetsByPolygonGroups(); public: C3DMeshModelBuilder_LW(); C3DMeshModelBuilder_LW( std::shared_ptr<LWO2_Object> pSrcObject ); ~C3DMeshModelBuilder_LW(); virtual const std::string GetInputDirectoryPath() const; virtual const std::string GetOutputFilePath() const; virtual const std::string& GetSurfaceMaterialOption( int material_index ) const { return m_vecSurfaceMaterialOption[material_index]; } void SetTargetLayerName( std::string& strName ) { m_strTargetLayerName = strName; } void LoadMeshModel(); /// build mesh from the layers that has the same name as m_strTargetLayerName bool BuildMeshModel(); /// build mesh from the target layer info bool BuildMeshModel( SLayerSet& rLayerInfo ); /// create mesh archive object by directly handing a layer. /// the pointer to a source LW object must be set in advance as an argument /// of the constructor when the instance is created. bool BuildMeshFromLayer( LWO2_Layer& rLayer ); void BuildSkeletonFromSkelegon( LWO2_Layer& rLayer ); std::vector<int>& GetDestBoneIndexArray() { return m_vecDestBoneIndex; } bool LoadFromLWO2Object( std::shared_ptr<LWO2_Object> pObject, const GeometryFilter& geometry_filter ); virtual bool LoadFromFile( const std::string& model_filepath, const GeometryFilter& geometry_filter ); virtual std::string GetBasePath(); }; /// \param words [in] layer name separated by spaces or tabs int GetGroupNumber( const std::vector<std::string>& words ); } // amorphous #endif /* __3DMESHMODELBUILDER_LW_H__ */
fb9d1d38f3c720dacc8501d7ea257c30d896ae45
29676d738b7a0c8dcb4811844f3e5238a3d4a710
/mainstagiaire.cpp
d369a4d940c7d853559a3aab2bcfd1196b135c3b
[]
no_license
Omariov/stagiaire
885d926cfa40b6d1790ac4144667304ab8321f0f
42c223607573c69b620aa8086a8707473102a14b
refs/heads/master
2023-08-27T06:42:56.880896
2021-11-05T00:26:15
2021-11-05T00:26:15
424,768,505
0
0
null
null
null
null
UTF-8
C++
false
false
422
cpp
mainstagiaire.cpp
#include "stagiaire.h" #include <assert.h> #include <iostream> #include <string.h> using namespace std; using namespace stage; int main() { stagiaire*a= new stagiaire("ahmed", "amine", "ilisi", 10, 12, 13); stagiaire*b = new stagiaire("med", "am", "ilisi", 1, 2, 3); stagiaire*c = new stagiaire(); stagiaire d("ahmed", "amine", "ilisi", 10, 12, 13); a.affichage; a->affichage; return 0; }
7ba5f9df517f60685389fc9e12a8ff45320a300e
037eab938a724c923cc27bb6976edbafe2660dbc
/src/bootloader/i2c_ee.cpp
598124fdc29fae1b4594661b33e472f4d8e55f85
[]
no_license
kc8goq/ersky9x
5c4c477cb81b4ee3d97cbcd01dc62036b3b6ab91
53bcdeb1f8848a10ca83092b419ad8b8b3277747
refs/heads/master
2021-01-10T08:48:58.523255
2016-03-07T12:37:32
2016-03-07T12:37:32
53,323,894
0
0
null
null
null
null
UTF-8
C++
false
false
10,104
cpp
i2c_ee.cpp
/** ****************************************************************************** * @file Project/ee_drivers/i2c_ee.c * @author X9D Application Team * @version V 0.2 * @date 12-JULY-2012 * @brief This file provides a set of functions needed to manage the * communication between I2C peripheral and I2C M24CXX EEPROM. CAT5137 added,share the I2C. ****************************************************************************** */ #include "radio.h" #include "stm32f2xx.h" #include "logicio.h" #include "stm32f2xx_rcc.h" #include "hal.h" #include "i2c_ee.h" #include "timers.h" #define I2C_delay() hw_delay( 100 ) /** * @brief Configure the used I/O ports pin * @param None * @retval None */ static void I2C_GPIO_Configuration(void) { RCC->AHB1ENR |= RCC_AHB1ENR_GPIOBEN ; // Enable portB clock RCC->AHB1ENR |= RCC_AHB1ENR_GPIOEEN ; // Enable portE clock // GPIO_InitTypeDef GPIO_InitStructure; GPIOB->BSRRH =I2C_EE_WP; //PB9 configure_pins( I2C_EE_WP, PIN_OUTPUT | PIN_OS50 | PIN_PORTB | PIN_PUSHPULL | PIN_NO_PULL ) ; // GPIO_InitStructure.GPIO_Pin = I2C_EE_WP; // GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; // GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; // GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; // GPIO_Init(I2C_EE_WP_GPIO, &GPIO_InitStructure); /* Configure I2C_EE pins: SCL and SDA */ configure_pins( I2C_EE_SCL | I2C_EE_SDA, PIN_OUTPUT | PIN_OS50 | PIN_PORTB | PIN_ODRAIN | PIN_PULLUP ) ; // GPIO_InitStructure.GPIO_Pin = I2C_EE_SCL | I2C_EE_SDA;//PE0,PE1 // GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; // GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; // GPIO_InitStructure.GPIO_OType = GPIO_OType_OD; // GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; // GPIO_Init(I2C_EE_GPIO, &GPIO_InitStructure); //Set Idle levels SDA_H; SCL_H; WP_L ; } short I2C_START() { SDA_H; I2C_delay(); SCL_H; I2C_delay(); // if (!SDA_read) return 0; SDA_L; I2C_delay(); // if (SDA_read) return 0; SCL_L; I2C_delay(); return 1; } void I2C_STOP() { SCL_L; I2C_delay(); SDA_L; I2C_delay(); SCL_H; I2C_delay(); SDA_H; I2C_delay(); } void I2C_ACK() { SCL_L; I2C_delay(); SDA_L; I2C_delay(); SCL_H; I2C_delay(); SCL_L; I2C_delay(); } void I2C_NO_ACK() { SCL_L; I2C_delay(); SDA_H; I2C_delay(); SCL_H; I2C_delay(); SCL_L; I2C_delay(); } short I2C_WAIT_ACK() { short i=50; SCL_L; I2C_delay(); SDA_H; I2C_delay(); SCL_H; I2C_delay(); while(i) { if(SDA_read) { I2C_delay(); i--; } else { i=2; break; } } SCL_L; I2C_delay(); return i; } void I2C_SEND_DATA(char SendByte) { short i=8; while (i--) { SCL_L; // I2C_delay(); if (SendByte & 0x80) SDA_H; else SDA_L; SendByte <<= 1; I2C_delay(); SCL_H; I2C_delay(); } SCL_L; I2C_delay(); } char I2C_READ() { short i=8; char ReceiveByte=0; SDA_H; while (i--) { ReceiveByte <<= 1; SCL_L; I2C_delay(); SCL_H; I2C_delay(); if (SDA_read) { ReceiveByte|=0x01; } } SCL_L; return ReceiveByte; } void I2C_EE_Init() { /* GPIO Periph clock enable */ RCC_AHB1PeriphClockCmd(I2C_EE_GPIO_CLK, ENABLE); /* GPIO configuration */ I2C_GPIO_Configuration(); } void I2C_set_volume( register uint8_t volume ) { I2C_START(); I2C_SEND_DATA(I2C_CAT5137_ADDRESS|EE_CMD_WRITE); I2C_WAIT_ACK(); I2C_SEND_DATA(0); I2C_WAIT_ACK(); I2C_SEND_DATA(volume); I2C_WAIT_ACK(); I2C_STOP(); } uint8_t I2C_read_volume() { uint8_t volume ; I2C_START(); I2C_SEND_DATA(I2C_CAT5137_ADDRESS|EE_CMD_WRITE); I2C_WAIT_ACK(); I2C_SEND_DATA(0); I2C_WAIT_ACK(); I2C_START(); I2C_SEND_DATA(I2C_CAT5137_ADDRESS|EE_CMD_READ); I2C_WAIT_ACK(); volume = I2C_READ(); I2C_NO_ACK(); I2C_STOP(); return volume ; } /** * @brief Writes one byte to the I2C EEPROM. * @param pBuffer : pointer to the buffer containing the data to be * written to the EEPROM. * @param WriteAddr : EEPROM's internal address to write to. * @retval None */ void I2C_EE_ByteWrite(uint8_t* pBuffer, uint16_t WriteAddr) { I2C_START(); I2C_SEND_DATA(I2C_EEPROM_ADDRESS|EE_CMD_WRITE); I2C_WAIT_ACK(); #ifdef EE_M24C08 I2C_SEND_DATA(WriteAddr); I2C_WAIT_ACK(); #else I2C_SEND_DATA((uint8_t)((WriteAddr&0xFF00)>>8) ); I2C_WAIT_ACK(); I2C_SEND_DATA((uint8_t)(WriteAddr&0xFF)); I2C_WAIT_ACK(); #endif I2C_SEND_DATA(*pBuffer); I2C_WAIT_ACK(); I2C_STOP(); } /** * @brief Reads a block of data from the EEPROM. * @param pBuffer : pointer to the buffer that receives the data read * from the EEPROM. * @param ReadAddr : EEPROM's internal address to read from. * @param NumByteToRead : number of bytes to read from the EEPROM. * @retval None */ void I2C_EE_BufferRead(uint8_t* pBuffer, uint16_t ReadAddr, uint16_t NumByteToRead) { I2C_START(); I2C_SEND_DATA(I2C_EEPROM_ADDRESS|EE_CMD_WRITE); I2C_WAIT_ACK(); #ifdef EE_M24C08 I2C_SEND_DATA(ReadAddr); I2C_WAIT_ACK(); #else I2C_SEND_DATA((uint8_t)((ReadAddr & 0xFF00) >> 8)); I2C_WAIT_ACK(); I2C_SEND_DATA((uint8_t)(ReadAddr & 0x00FF)); I2C_WAIT_ACK(); #endif I2C_START(); I2C_SEND_DATA(I2C_EEPROM_ADDRESS|EE_CMD_READ); I2C_WAIT_ACK(); while (NumByteToRead) { if (NumByteToRead == 1) { *pBuffer =I2C_READ(); I2C_NO_ACK(); I2C_STOP(); } else { *pBuffer =I2C_READ(); I2C_ACK(); pBuffer++; } NumByteToRead--; } } /** * @brief Writes buffer of data to the I2C EEPROM. * @param pBuffer : pointer to the buffer containing the data to be * written to the EEPROM. * @param WriteAddr : EEPROM's internal address to write to. * @param NumByteToWrite : number of bytes to write to the EEPROM. * @retval None */ void I2C_EE_BufferWrite(uint8_t* pBuffer, uint16_t WriteAddr, uint16_t NumByteToWrite) { uint8_t NumOfPage = 0, NumOfSingle = 0, count = 0; uint16_t Addr = 0; Addr = WriteAddr % I2C_FLASH_PAGESIZE; count = I2C_FLASH_PAGESIZE - Addr; NumOfPage = NumByteToWrite / I2C_FLASH_PAGESIZE; NumOfSingle = NumByteToWrite % I2C_FLASH_PAGESIZE; /* If WriteAddr is I2C_FLASH_PAGESIZE aligned */ if (Addr == 0) { /* If NumByteToWrite < I2C_FLASH_PAGESIZE */ if (NumOfPage == 0) { I2C_EE_PageWrite(pBuffer, WriteAddr, NumOfSingle); I2C_EE_WaitEepromStandbyState(); } /* If NumByteToWrite > I2C_FLASH_PAGESIZE */ else { while (NumOfPage--) { I2C_EE_PageWrite(pBuffer, WriteAddr, I2C_FLASH_PAGESIZE); I2C_EE_WaitEepromStandbyState(); WriteAddr += I2C_FLASH_PAGESIZE; pBuffer += I2C_FLASH_PAGESIZE; } if (NumOfSingle != 0) { I2C_EE_PageWrite(pBuffer, WriteAddr, NumOfSingle); I2C_EE_WaitEepromStandbyState(); } } } /* If WriteAddr is not I2C_FLASH_PAGESIZE aligned */ else { /* If NumByteToWrite < I2C_FLASH_PAGESIZE */ if (NumOfPage== 0) { /* If the number of data to be written is more than the remaining space in the current page: */ if (NumByteToWrite > count) { /* Write the data conained in same page */ I2C_EE_PageWrite(pBuffer, WriteAddr, count); I2C_EE_WaitEepromStandbyState(); /* Write the remaining data in the following page */ I2C_EE_PageWrite((uint8_t*)(pBuffer + count), (WriteAddr + count), (NumByteToWrite - count)); I2C_EE_WaitEepromStandbyState(); } else { I2C_EE_PageWrite(pBuffer, WriteAddr, NumOfSingle); I2C_EE_WaitEepromStandbyState(); } } /* If NumByteToWrite > I2C_FLASH_PAGESIZE */ else { NumByteToWrite -= count; NumOfPage = NumByteToWrite / I2C_FLASH_PAGESIZE; NumOfSingle = NumByteToWrite % I2C_FLASH_PAGESIZE; if (count != 0) { I2C_EE_PageWrite(pBuffer, WriteAddr, count); I2C_EE_WaitEepromStandbyState(); WriteAddr += count; pBuffer += count; } while (NumOfPage--) { I2C_EE_PageWrite(pBuffer, WriteAddr, I2C_FLASH_PAGESIZE); I2C_EE_WaitEepromStandbyState(); WriteAddr += I2C_FLASH_PAGESIZE; pBuffer += I2C_FLASH_PAGESIZE; } if (NumOfSingle != 0) { I2C_EE_PageWrite(pBuffer, WriteAddr, NumOfSingle); I2C_EE_WaitEepromStandbyState(); } } } } /** * @brief Writes more than one byte to the EEPROM with a single WRITE cycle. * @note The number of byte can't exceed the EEPROM page size. * @param pBuffer : pointer to the buffer containing the data to be * written to the EEPROM. * @param WriteAddr : EEPROM's internal address to write to. * @param NumByteToWrite : number of bytes to write to the EEPROM. * @retval None */ void I2C_EE_PageWrite(uint8_t* pBuffer, uint16_t WriteAddr, uint8_t NumByteToWrite) { I2C_START(); I2C_SEND_DATA(I2C_EEPROM_ADDRESS|EE_CMD_WRITE); I2C_WAIT_ACK(); #ifdef EE_M24C08 I2C_SEND_DATA(WriteAddr); I2C_WAIT_ACK(); #else I2C_SEND_DATA((uint8_t)((WriteAddr & 0xFF00) >> 8)); I2C_WAIT_ACK(); I2C_SEND_DATA((uint8_t)(WriteAddr & 0x00FF)); I2C_WAIT_ACK(); #endif /* EE_M24C08 */ /* While there is data to be written */ while (NumByteToWrite--) { I2C_SEND_DATA(*pBuffer); I2C_WAIT_ACK(); pBuffer++; } I2C_STOP(); } /** * @brief Wait for EEPROM Standby state * @param None * @retval None */ void I2C_EE_WaitEepromStandbyState(void) { do { I2C_START(); I2C_SEND_DATA(I2C_EEPROM_ADDRESS|EE_CMD_WRITE); } while (0 == I2C_WAIT_ACK()); I2C_STOP(); }
b9c8710271be8bbb658c0566c0875ac0c9c37dae
4bbe189811a50b2dacfb1ef970506eb2f38ee3dd
/endless-tunnel/app/src/main/cpp/glm/gtc/type_ptr.hpp
764f344df98466cfbbf1472b9127ecc8969f05b1
[ "Apache-2.0" ]
permissive
android/ndk-samples
9ddf0633512841a0c9f79d011a4b82e044923356
87bf557531f3d3d50fbba6d64ac4a601a865788a
refs/heads/main
2023-08-24T11:01:56.016375
2023-08-04T21:20:12
2023-08-04T21:20:12
35,718,695
3,721
1,570
Apache-2.0
2023-08-04T21:20:14
2015-05-16T10:02:15
C++
UTF-8
C++
false
false
5,837
hpp
type_ptr.hpp
/////////////////////////////////////////////////////////////////////////////////// /// OpenGL Mathematics (glm.g-truc.net) /// /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) /// 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. /// /// @ref gtc_type_ptr /// @file glm/gtc/type_ptr.hpp /// @date 2009-05-06 / 2011-06-05 /// @author Christophe Riccio /// /// @see core (dependence) /// @see gtc_half_float (dependence) /// @see gtc_quaternion (dependence) /// /// @defgroup gtc_type_ptr GLM_GTC_type_ptr /// @ingroup gtc /// /// @brief Handles the interaction between pointers and vector, matrix types. /// /// This extension defines an overloaded function, glm::value_ptr, which /// takes any of the \ref core_template "core template types". It returns /// a pointer to the memory layout of the object. Matrix types store their /// values in column-major order. /// /// This is useful for uploading data to matrices or copying data to buffer /// objects. /// /// Example: /// @code /// #include <glm/glm.hpp> /// #include <glm/gtc/type_ptr.hpp> /// /// glm::vec3 aVector(3); /// glm::mat4 someMatrix(1.0); /// /// glUniform3fv(uniformLoc, 1, glm::value_ptr(aVector)); /// glUniformMatrix4fv(uniformMatrixLoc, 1, GL_FALSE, /// glm::value_ptr(someMatrix)); /// @endcode /// /// <glm/gtc/type_ptr.hpp> need to be included to use these functionalities. /////////////////////////////////////////////////////////////////////////////////// #ifndef GLM_GTC_type_ptr #define GLM_GTC_type_ptr // Dependency: #include <cstring> #include "../gtc/quaternion.hpp" #include "../mat2x2.hpp" #include "../mat2x3.hpp" #include "../mat2x4.hpp" #include "../mat3x2.hpp" #include "../mat3x3.hpp" #include "../mat3x4.hpp" #include "../mat4x2.hpp" #include "../mat4x3.hpp" #include "../mat4x4.hpp" #include "../vec2.hpp" #include "../vec3.hpp" #include "../vec4.hpp" #if (defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) #pragma message("GLM: GLM_GTC_type_ptr extension included") #endif namespace glm { /// @addtogroup gtc_type_ptr /// @{ /// Return the constant address to the data of the input parameter. /// @see gtc_type_ptr template <typename genType> GLM_FUNC_DECL typename genType::value_type const* value_ptr(genType const& vec); /// Build a vector from a pointer. /// @see gtc_type_ptr template <typename T> GLM_FUNC_DECL detail::tvec2<T, defaultp> make_vec2(T const* const ptr); /// Build a vector from a pointer. /// @see gtc_type_ptr template <typename T> GLM_FUNC_DECL detail::tvec3<T, defaultp> make_vec3(T const* const ptr); /// Build a vector from a pointer. /// @see gtc_type_ptr template <typename T> GLM_FUNC_DECL detail::tvec4<T, defaultp> make_vec4(T const* const ptr); /// Build a matrix from a pointer. /// @see gtc_type_ptr template <typename T> GLM_FUNC_DECL detail::tmat2x2<T, defaultp> make_mat2x2(T const* const ptr); /// Build a matrix from a pointer. /// @see gtc_type_ptr template <typename T> GLM_FUNC_DECL detail::tmat2x3<T, defaultp> make_mat2x3(T const* const ptr); /// Build a matrix from a pointer. /// @see gtc_type_ptr template <typename T> GLM_FUNC_DECL detail::tmat2x4<T, defaultp> make_mat2x4(T const* const ptr); /// Build a matrix from a pointer. /// @see gtc_type_ptr template <typename T> GLM_FUNC_DECL detail::tmat3x2<T, defaultp> make_mat3x2(T const* const ptr); /// Build a matrix from a pointer. /// @see gtc_type_ptr template <typename T> GLM_FUNC_DECL detail::tmat3x3<T, defaultp> make_mat3x3(T const* const ptr); /// Build a matrix from a pointer. /// @see gtc_type_ptr template <typename T> GLM_FUNC_DECL detail::tmat3x4<T, defaultp> make_mat3x4(T const* const ptr); /// Build a matrix from a pointer. /// @see gtc_type_ptr template <typename T> GLM_FUNC_DECL detail::tmat4x2<T, defaultp> make_mat4x2(T const* const ptr); /// Build a matrix from a pointer. /// @see gtc_type_ptr template <typename T> GLM_FUNC_DECL detail::tmat4x3<T, defaultp> make_mat4x3(T const* const ptr); /// Build a matrix from a pointer. /// @see gtc_type_ptr template <typename T> GLM_FUNC_DECL detail::tmat4x4<T, defaultp> make_mat4x4(T const* const ptr); /// Build a matrix from a pointer. /// @see gtc_type_ptr template <typename T> GLM_FUNC_DECL detail::tmat2x2<T, defaultp> make_mat2(T const* const ptr); /// Build a matrix from a pointer. /// @see gtc_type_ptr template <typename T> GLM_FUNC_DECL detail::tmat3x3<T, defaultp> make_mat3(T const* const ptr); /// Build a matrix from a pointer. /// @see gtc_type_ptr template <typename T> GLM_FUNC_DECL detail::tmat4x4<T, defaultp> make_mat4(T const* const ptr); /// Build a quaternion from a pointer. /// @see gtc_type_ptr template <typename T> GLM_FUNC_DECL detail::tquat<T, defaultp> make_quat(T const* const ptr); /// @} } // namespace glm #include "type_ptr.inl" #endif // GLM_GTC_type_ptr
ba83cdef72232cbb38ee75a3d6f80279e8956b7c
c37dbf067525db9563efb819d976eb63c0bd8cbb
/opengl/early_practice/src/main.cpp
bdadf32303bca2f61c857e7c41f56de0c7c0901f
[]
no_license
taylon/playground
add2d8221b2626c583ef12ffcb8c26cabbfd2765
26915f496ee889e42531d18ea14bccd5b2bb03cf
refs/heads/master
2023-03-10T09:10:25.368593
2021-02-20T19:37:15
2021-02-25T01:20:02
287,410,568
1
0
null
null
null
null
UTF-8
C++
false
false
2,320
cpp
main.cpp
#include <iostream> #include <glad/glad.h> #include <GLFW/glfw3.h> #include "shaders.h" void framebufferSizeCallback(GLFWwindow *window, int width, int height) { glViewport(0, 0, width, height); } void processInput(GLFWwindow *window) { if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, true); } int main(void) { // init glfw glfwInit(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 6); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); auto window_width = 800; auto window_height = 600; auto *window = glfwCreateWindow(window_width, window_height, "OpenGL Fun!", NULL, NULL); if (window == NULL) { std::cout << "Failed to create GLFW window" << std::endl; glfwTerminate(); return -1; } glfwMakeContextCurrent(window); glfwSetFramebufferSizeCallback(window, framebufferSizeCallback); // -- // load OpenGL function pointers if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) { std::cout << "Failed to initialize GLAD" << std::endl; return -1; } // -- auto shaderProgram = createShaderProgram(); // Bind vertex array object unsigned int vertexArrayObject; glGenVertexArrays(1, &vertexArrayObject); glBindVertexArray(vertexArrayObject); // copy the vertices data to the GPU // clang-format off float vertices[] = { -0.25f, -0.25f, 0.0f, 0.25f, -0.25f, 0.0f, 0.0f, 0.25f, 0.0f, 0.25f, -0.25f, 0.0f, 0.75f, -0.25f, 0.0f, 0.5f, 0.25f, 0.0f }; // clang-format off unsigned int buffer; glGenBuffers(1, &buffer); glBindBuffer(GL_ARRAY_BUFFER, buffer); glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); // -- // set the vertex attributes pointers glEnableVertexAttribArray(0); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void *)0); while (!glfwWindowShouldClose(window)) { processInput(window); glClearColor(0.2f, 0.3f, 0.3f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); glUseProgram(shaderProgram); glBindVertexArray(vertexArrayObject); /* glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); */ glDrawArrays(GL_TRIANGLES, 0, 6); glfwSwapBuffers(window); glfwPollEvents(); } glfwTerminate(); return 0; }
0dd4beb75331791b65991a6d3b23e1c9096ea6ee
5d83739af703fb400857cecc69aadaf02e07f8d1
/Archive2/af/1763564786fc09/main.cpp
7d04589647c17d85d0123d80960925987deb7de7
[]
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
321
cpp
main.cpp
#include <iostream> class A { public: virtual void foo() const { std::cout << "A\n"; } }; class B : public A{ public: void foo() const { std::cout << "B\n"; } }; class C: public B { public: void foo() const { std::cout << "C\n"; } }; int main() { A const& a = C{}; a.foo(); }
227d8e7ae8e55b1574ecb7537fb7bb3f475be7e4
2bfddaf9c0ceb7bf46931f80ce84a829672b0343
/tests/xtd.forms.unit_tests/src/xtd/forms/style_sheets/tests/background_image_tests.cpp
5c319a2688053d263766f04cd4cc39c1e875dd57
[ "MIT" ]
permissive
gammasoft71/xtd
c6790170d770e3f581b0f1b628c4a09fea913730
ecd52f0519996b96025b196060280b602b41acac
refs/heads/master
2023-08-19T09:48:09.581246
2023-08-16T20:52:11
2023-08-16T20:52:11
170,525,609
609
53
MIT
2023-05-06T03:49:33
2019-02-13T14:54:22
C++
UTF-8
C++
false
false
4,149
cpp
background_image_tests.cpp
#include <xtd/forms/style_sheets/background_image.h> #include <xtd/drawing/system_colors.h> #include <xtd/not_supported_exception.h> #include <xtd/tunit/assert.h> #include <xtd/tunit/collection_assert.h> #include <xtd/tunit/test_class_attribute.h> #include <xtd/tunit/test_method_attribute.h> using namespace xtd; using namespace xtd::drawing; using namespace xtd::forms::style_sheets; using namespace xtd::tunit; namespace xtd::forms::style_sheets::tests { class test_class_(background_image_tests) { public: void test_method_(create_with_default_constructor) { background_image i; assert::are_equal(image_type::none, i.image_type(), csf_); assert::is_empty(i.url().to_string(), csf_); assert::are_equal(2U, i.colors().size(), csf_); collection_assert::are_equal({color::black, color::black}, i.colors(), csf_); assert::are_equal(180, i.angle(), csf_); } void test_method_(create_with_specified_url) { background_image i("file://arrow.png"); assert::are_equal(image_type::url, i.image_type(), csf_); assert::are_equal("arrow.png", i.url().host(), csf_); assert::are_equal(2U, i.colors().size(), csf_); collection_assert::are_equal({color::black, color::black}, i.colors(), csf_); assert::are_equal(180, i.angle(), csf_); } void test_method_(create_with_specified_colors) { background_image i({color::blue, color::white}); assert::are_equal(image_type::linear_gradient, i.image_type(), csf_); assert::is_empty(i.url().to_string(), csf_); assert::are_equal(2U, i.colors().size(), csf_); collection_assert::are_equal({color::blue, color::white}, i.colors(), csf_); assert::are_equal(180, i.angle(), csf_); } void test_method_(create_with_specified_image_type_linear_gradient_and_colors) { background_image i(image_type::linear_gradient, {color::blue, color::white}); assert::are_equal(image_type::linear_gradient, i.image_type(), csf_); assert::is_empty(i.url().to_string(), csf_); assert::are_equal(2U, i.colors().size(), csf_); collection_assert::are_equal({color::blue, color::white}, i.colors(), csf_); assert::are_equal(180, i.angle(), csf_); } void test_method_(create_with_specified_image_type_linear_gradient_and_one_color) { assert::throws<argument_exception>([] {background_image i(image_type::linear_gradient, {color::blue});}, csf_); } void test_method_(create_with_specified_image_type_radial_gradient_and_colors) { assert::throws<not_supported_exception>([] {background_image i(image_type::radial_gradient, {color::blue, color::white});}, csf_); } void test_method_(create_with_specified_image_type_conic_gradient_and_colors) { assert::throws<not_supported_exception>([] {background_image i(image_type::conic_gradient, {color::blue, color::white});}, csf_); } void test_method_(create_with_specified_image_type_linear_gradient_colors_and_angle) { background_image i(image_type::linear_gradient, {color::blue, color::white}, 270); assert::are_equal(image_type::linear_gradient, i.image_type(), csf_); assert::is_empty(i.url().to_string(), csf_); assert::are_equal(2U, i.colors().size(), csf_); collection_assert::are_equal({color::blue, color::white}, i.colors(), csf_); assert::are_equal(270, i.angle(), csf_); } void test_method_(create_with_specified_image_type_linear_gradient_one_color_and_angle) { assert::throws<argument_exception>([] {background_image i(image_type::linear_gradient, {color::blue}, 270);}, csf_); } void test_method_(create_with_specified_image_type_radial_gradient_colors_and_angle) { assert::throws<not_supported_exception>([] {background_image i(image_type::radial_gradient, {color::blue, color::white}, 270);}, csf_); } void test_method_(create_with_specified_image_type_conic_gradient_colors_and_angle) { assert::throws<not_supported_exception>([] {background_image i(image_type::conic_gradient, {color::blue, color::white}, 270);}, csf_); } }; }
f5f1cb3bf98746a1438fd65937fdfc1445ee963d
66d91dc268b72b96ea9f7c457b1b3eec343bf873
/week10/linkedList2/wk10_linkedList2_adupree/node.cpp
2c8c1f3f32924206eb872c593968f84700e6be37
[]
no_license
AlexanderJDupree/CS162
0614ae2dc1e713dd47a69d5b82e1abd32df321c0
c9e49a3314d6051dc72bb87218a184fe009d52c9
refs/heads/master
2020-03-08T01:06:58.674234
2018-06-13T23:15:45
2018-06-13T23:15:45
127,821,973
0
1
null
null
null
null
UTF-8
C++
false
false
428
cpp
node.cpp
// Implementation for Node class #include "node.h" #define NULL 0 Node::Node() : data(0), next(NULL) {} Node::~Node() {} // Inspectors const int& Node::getData() const { return data; } Node* Node::getLink() { return next; } // Mutators Node* Node::setData(int data) { this->data = data; return this; } Node* Node::setLink(Node* node) { next = node; return this; }
b9a02348a62e7c97b12d5e09dc5b4d0095b66022
4d4cb2e411543597e91f4f52fb83671313da41d9
/src/enemies/enemies.hpp
c6a3a611cbdd4bf5d2697923aa3427807910a3e8
[]
no_license
MartinTaTTe/tower-defense
71e4f71408aaa03d5afe5f78a570866b7300aef3
1b5c6d4cd157cf584f0c5c0953a120b7b4f3ac4f
refs/heads/master
2023-03-04T08:32:01.345210
2021-02-10T15:19:52
2021-02-17T17:37:09
331,945,890
1
0
null
null
null
null
UTF-8
C++
false
false
169
hpp
enemies.hpp
#pragma once #include "enemy.hpp" #include "fast_enemy.hpp" #include "flying_enemy.hpp" #include "normal_enemy.hpp" #include "regen_enemy.hpp" #include "spawn_enemy.hpp"
b19fcedd40ece68553cad7192f64749b23b3b73a
f96dd22d8241b3e4f3a2600381d88ed80b9179b1
/include/Carna/base/BufferedVectorFieldFormat.h
8b6b8cd888f19c28f3a36f9525019d850f8d0ca0
[ "BSD-3-Clause" ]
permissive
2592671413/Carna
1a72a2b5202a34c8eaf502be9adc3e638d8fa527
51a77304428ef7913c7006ed979d5d427fe5b1d3
refs/heads/master
2021-01-11T17:59:26.257822
2016-12-13T15:26:14
2016-12-13T15:26:14
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,886
h
BufferedVectorFieldFormat.h
/* * Copyright (C) 2010 - 2015 Leonid Kostrykin * * Chair of Medical Engineering (mediTEC) * RWTH Aachen University * Pauwelsstr. 20 * 52074 Aachen * Germany * */ #ifndef BUFFEREDVECTORFIELDFORMAT_H_6014714286 #define BUFFEREDVECTORFIELDFORMAT_H_6014714286 #include <Carna/Carna.h> /** \file BufferedVectorFieldFormat.h * \brief Defines \ref Carna::base::BufferedVectorFieldFormat. */ namespace Carna { namespace base { // ---------------------------------------------------------------------------------- // BufferedVectorFieldFormat // ---------------------------------------------------------------------------------- /** \brief * Maps \ref math::VectorField implementations to \ref Texture formats. */ template< typename BufferedVectorFieldType > struct BufferedVectorFieldFormat { static_assert( sizeof( BufferedVectorFieldType ) == -1, "Unknown BufferedVectorFieldType." ); }; /** \brief * Defines \ref Texture format for \ref HUVolumeUInt16. */ template< > struct CARNA_LIB BufferedVectorFieldFormat< HUVolumeUInt16 > { const static unsigned int INTERNAL_FORMAT; ///< \copydoc ManagedTexture3D::internalFormat const static unsigned int PIXEL_FORMAT; ///< \copydoc ManagedTexture3D::pixelFormat const static unsigned int BUFFER_TYPE; ///< \copydoc ManagedTexture3D::bufferType }; /** \brief * Defines \ref Texture format for \ref NormalMap3DInt8. */ template< > struct CARNA_LIB BufferedVectorFieldFormat< NormalMap3DInt8 > { const static unsigned int INTERNAL_FORMAT; ///< \copydoc ManagedTexture3D::internalFormat const static unsigned int PIXEL_FORMAT; ///< \copydoc ManagedTexture3D::pixelFormat const static unsigned int BUFFER_TYPE; ///< \copydoc ManagedTexture3D::bufferType }; } // namespace Carna :: base } // namespace Carna #endif // BUFFEREDVECTORFIELDFORMAT_H_6014714286
2715a063a43da27b24fc5428cefb1727438e6cc9
5ea33d3e72fb94d9b27404973aabbad0274f0d08
/oactobjs/piaoutproj/PebsOasdiInfo.cpp
d1065a6eae759d6dfb2bb89b01d4c070de03a54f
[ "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-public-domain" ]
permissive
bslabs/anypiamac
d99538ea35732dc6804a4f1d231d6034bb8f68c1
199a118e4feffbafde2007c326d9b1c774e9c4ff
refs/heads/master
2021-06-24T08:21:34.583844
2020-11-21T07:37:01
2020-11-21T07:37:01
36,282,920
5
1
null
null
null
null
UTF-8
C++
false
false
5,862
cpp
PebsOasdiInfo.cpp
// Functions for the <see cref="PebsOasdiInfo"/> class to manage the Social // Security Statement oasdi benefit info page. // $Id: PebsOasdiInfo.cpp 1.8.1.2 2012/03/08 10:56:07EST 277133 Development $ #include "PebsOasdiInfo.h" #include "FormatString.h" #include "PiaException.h" #include "Resource.h" #include "PebsOut.h" using namespace std; /// <summary>Initializes PebsOasdiInfo.</summary> /// /// <param name="newWorkerData">Worker data.</param> PebsOasdiInfo::PebsOasdiInfo( const WorkerData& newWorkerData ) : PebsPageOut(), workerData(newWorkerData) { } /// <summary>Destructor.</summary> PebsOasdiInfo::~PebsOasdiInfo() { } /// <summary>Prepares oasdi benefit estimate information.</summary> void PebsOasdiInfo::prepareStrings() { //try { // outputString.clear(); // prepareHeader(workerData); // outputString.push_back("Retirement Benefits"); // outputString.push_back(""); // outputString.push_back( // "You can get reduced benefits as early as 62 or get full-retirement"); // outputString.push_back( // "at age 65. (Starting in the year 2000 for people born in 1938 or"); // outputString.push_back( // "later, this age will increase gradually. By 2027, full-retirement"); // outputString.push_back( // "age wil be 67 for people born after 1959.) Your benefits may be"); // outputString.push_back( // "higher if you delay retiring until after full-retirement age."); // outputString.push_back(""); // outputString.push_back(equals); // outputString.push_back("Disability Benefits"); // outputString.push_back(""); // outputString.push_back( // "These benefits are paid if you become totally disabled before you"); // outputString.push_back( // "reach full-retirement age. To get disability benefits, three things"); // outputString.push_back("are necessary:"); // outputString.push_back( // " You need a certain number of work credits and they had to be"); // outputString.push_back( // " earned during a specific period of time;"); // outputString.push_back( // " You must have a physical or mental condition that has lasted, or"); // outputString.push_back( // " is expected to last, at least 12 months or to end in death; and"); // outputString.push_back( // " Your disability must be severe enough to keep you from doing any"); // outputString.push_back( // " substantial work, not just your last job."); // outputString.push_back(""); // outputString.push_back(equals); // outputString.push_back("Benefits for Your Family"); // outputString.push_back(""); // outputString.push_back( // "As you work, you also build up protection for your family. Benefits"); // outputString.push_back("may be payable to:"); // outputString.push_back( // " Your unmarried children under age 18 (under age 19 if in high"); // outputString.push_back( // " school) or 18 and older if disabled before age 22;"); // outputString.push_back( // " Your spouse who is age 62 or older or who is any age and caring"); // outputString.push_back( // " for your qualified child who is under age 16 or disabled; and"); // outputString.push_back( // " Your divorced spouse who was married to you for at least 10 years"); // outputString.push_back( // " and who is age 62 or older and unmarried."); // outputString.push_back( // "Usually each family member qualifies for a monthly benefit that is"); // outputString.push_back( // "up to 50 percent of your retirement or disability benefit, subject"); // outputString.push_back("to the limit explained below."); // outputString.push_back(""); // outputString.push_back( // "If you die, your unmarried young or disabled children may qualify"); // outputString.push_back( // "for monthly payments. Your widow or widower, even if divorced, may"); // outputString.push_back("also qualify for payments starting:"); // outputString.push_back( // " At age 60 or age 50 if disabled (if divorced, your marriage must"); // outputString.push_back(" have lasted 10 years); or"); // outputString.push_back( // " At any age if caring for your qualified child who is under age 16"); // outputString.push_back(" or disabled."); // outputString.push_back(""); // outputString.push_back( // "There is a limit on the amount we can pay to your and your family"); // outputString.push_back( // "altogether. This total depends on the amount of your benefit and"); // outputString.push_back( // "the number of family members who also qualify. The total varies,"); // outputString.push_back( // "but is generally equal to about 150 to 180 percent of your"); // outputString.push_back( // "retirement benefit. (It may be less for disability benefits.) The"); // outputString.push_back( // "family limit also applies to benefits for your survivors."); // outputString.push_back(""); // outputString.push_back( // "Your spouse cannot get both his or her own benefit plus a full"); // outputString.push_back( // "benefit on your record. We can only pay an amount equal to the"); // outputString.push_back( // "larger of the two benefits. Your spouse should call us and ask how"); // outputString.push_back( // "to get a Social Security Statement like this. When you both have"); // outputString.push_back( // "statements, we can help estimate your spouse's future benefits on"); // outputString.push_back("the two records."); //} catch (PiaException&) { // throw PiaException("Error in PebsOasdiInfo::prepareStrings"); //} }
100582b070d9f7a53aa35e6ad9e79853d59cb38b
c9138031642f3198fc3e3344710bb2b23c28ebfd
/enterpage.h
137617667d3eeaceca80c5376f79d3e5b10a2f2c
[]
no_license
BenjaminChenTW/pd2-2048
51ddf6429f20612c6b21737b54ee7bcb7e000db6
15851ea05bf8e5bacf9e754f71b611f79b5fe43d
refs/heads/master
2021-03-27T08:55:27.894012
2015-05-31T16:02:18
2015-05-31T16:02:18
36,609,171
0
0
null
null
null
null
UTF-8
C++
false
false
513
h
enterpage.h
#ifndef ENTERPAGE_H #define ENTERPAGE_H #include <QMainWindow> #include <QKeyEvent> #include <QDebug> #include "mainpage.h" namespace Ui { class EnterPage; } class EnterPage : public QMainWindow { Q_OBJECT public: explicit EnterPage(QWidget *parent = 0); ~EnterPage(); void endPage(bool *result); private slots: void ClickStart(); void ClickQuit(); private: Ui::EnterPage *ui; MainPage *game; int *win; void keyPressEvent(QKeyEvent *event); }; #endif // ENTERPAGE_H
3ab16d7cc91b6d0c8f9a6e3e73f132cc7b05b113
ff4999ae662707a882085b75b8cc377a714f747c
/C/services/storage/include/storage_api.h
1b2d152ba4235d654d8c9e2601d3c2f1738c985a
[ "Apache-2.0" ]
permissive
fledge-iot/fledge
095631d6a9be10444cdde0a7a3acbb039aabc8bd
d4804240a653ab6e324b5949069c0e17bf19e374
refs/heads/develop
2023-08-22T05:29:07.549634
2023-08-21T11:22:19
2023-08-21T11:22:19
225,508,004
111
44
Apache-2.0
2023-09-14T10:42:06
2019-12-03T01:58:59
Python
UTF-8
C++
false
false
6,251
h
storage_api.h
#ifndef _STORAGE_API_H #define _STORAGE_API_H /* * Fledge storage service. * * Copyright (c) 2017 OSisoft, LLC * * Released under the Apache 2.0 Licence * * Author: Mark Riddoch */ #include <server_http.hpp> #include <storage_plugin.h> #include <storage_stats.h> #include <storage_registry.h> #include <stream_handler.h> using namespace std; using HttpServer = SimpleWeb::Server<SimpleWeb::HTTP>; /* * The URL for each entry point */ #define COMMON_ACCESS "^/storage/table/([A-Za-z][a-zA-Z0-9_]*)$" #define COMMON_QUERY "^/storage/table/([A-Za-z][a-zA-Z_0-9]*)/query$" #define READING_ACCESS "^/storage/reading$" #define READING_QUERY "^/storage/reading/query" #define READING_PURGE "^/storage/reading/purge" #define READING_INTEREST "^/storage/reading/interest/([A-Za-z0-9\\*][a-zA-Z0-9_%\\.\\-]*)$" #define TABLE_INTEREST "^/storage/table/interest/([A-Za-z\\*][a-zA-Z0-9_%\\.\\-]*)$" #define GET_TABLE_SNAPSHOTS "^/storage/table/([A-Za-z][a-zA-Z_0-9_]*)/snapshot$" #define CREATE_TABLE_SNAPSHOT GET_TABLE_SNAPSHOTS #define LOAD_TABLE_SNAPSHOT "^/storage/table/([A-Za-z][a-zA-Z_0-9_]*)/snapshot/([a-zA-Z_0-9_]*)$" #define DELETE_TABLE_SNAPSHOT LOAD_TABLE_SNAPSHOT #define CREATE_STORAGE_STREAM "^/storage/reading/stream$" #define STORAGE_SCHEMA "^/storage/schema" #define STORAGE_TABLE_ACCESS "^/storage/schema/([A-Za-z][a-zA-Z0-9_]*)/table/([A-Za-z][a-zA-Z0-9_]*)$" #define STORAGE_TABLE_QUERY "^/storage/schema/([A-Za-z][a-zA-Z0-9_]*)/table/([A-Za-z][a-zA-Z_0-9]*)/query$" #define PURGE_FLAG_RETAIN "retain" #define PURGE_FLAG_RETAIN_ANY "retainany" #define PURGE_FLAG_RETAIN_ALL "retainall" #define PURGE_FLAG_PURGE "purge" #define TABLE_NAME_COMPONENT 1 #define STORAGE_SCHEMA_NAME_COMPONENT 1 #define STORAGE_TABLE_NAME_COMPONENT 2 #define ASSET_NAME_COMPONENT 1 #define SNAPSHOT_ID_COMPONENT 2 /** * The Storage API class - this class is responsible for the registration of all API * entry points in the storage API and the dispatch of those API calls to the internals * of the storage service and the storage plugin itself. */ class StorageApi { public: StorageApi(const unsigned short port, const unsigned int threads); ~StorageApi(); static StorageApi *getInstance(); void initResources(); void setPlugin(StoragePlugin *); void setReadingPlugin(StoragePlugin *); void start(); void startServer(); void wait(); void stopServer(); unsigned short getListenerPort(); void commonInsert(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void commonSimpleQuery(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void commonQuery(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void commonUpdate(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void commonDelete(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void defaultResource(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void readingAppend(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void readingFetch(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void readingQuery(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void readingPurge(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void readingRegister(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void readingUnregister(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void tableRegister(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void tableUnregister(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void createTableSnapshot(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void loadTableSnapshot(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void deleteTableSnapshot(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void getTableSnapshots(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void createStorageStream(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); bool readingStream(ReadingStream **readings, bool commit); void createStorageSchema(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void storageTableInsert(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void storageTableUpdate(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void storageTableDelete(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void storageTableSimpleQuery(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void storageTableQuery(shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request); void printList(); bool createSchema(const std::string& schema); public: std::atomic<int> m_workers_count; private: static StorageApi *m_instance; HttpServer *m_server; unsigned short m_port; unsigned int m_threads; thread *m_thread; StoragePlugin *plugin; StoragePlugin *readingPlugin; StorageStats stats; std::map<string, pair<int,std::list<std::string>::iterator>> m_seqnum_map; const unsigned int max_entries_in_seqnum_map = 16; std::list<std::string> seqnum_map_lru_list; // has the most recently accessed elements of m_seqnum_map at front of the dequeue std::mutex mtx_seqnum_map; StorageRegistry registry; void respond(shared_ptr<HttpServer::Response>, const string&); void respond(shared_ptr<HttpServer::Response>, SimpleWeb::StatusCode, const string&); void internalError(shared_ptr<HttpServer::Response>, const exception&); void mapError(string&, PLUGIN_ERROR *); StreamHandler *streamHandler; }; #endif
26c499276b502a64af594887e93260383f0462eb
55b1dd5b4d09765fc35d1edeea765d5b61034dc1
/unixv6.cc
bd3c41486688c53d8fe80da213c6ae528fcbbe4f
[]
no_license
ajaykarthik/unixv6
6d7c2ec90263bc5df07af5545a5ea2486e1f7917
5da0dae80bafe046f793d286537b19f199e72951
refs/heads/master
2021-01-01T05:31:12.536937
2015-02-04T01:11:10
2015-02-04T01:11:10
30,273,577
1
0
null
null
null
null
UTF-8
C++
false
false
26,618
cc
unixv6.cc
/***************************************************************************************************************** Operating Systems project 2 Ajay Karthik Ganesan and Ashwin Rameshkumar This program, when run creates a virtual unix file system, which removes the V-6 file system size limit of 16MB Compiled and run on cs3.utdallas.edu compile as CC fsaccess.cc and run as ./a.out Max file size is 12.5 GB ******************************************************************************************************************/ #include <unistd.h> #include <fcntl.h> #include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include<string.h> #include <iostream.h> #include <fstream.h> #include<vector> //for file size #include <sys/stat.h> using namespace std; //Global constants const block_Size = 2048; //Given block size //Easier to work with global files as we need them in almost all functions and // we don't need to pass them as parameters every time int num_iNodes, num_Blocks; string new_File_System; int fd; int next_free_inode = 1; //initialised to 2 , inode 1 is root //This dynamic memory is written into the file system during the q command and also de-allocated void *root_dir; void *super; long long max_file_size = 13421772800; //function prototype off_t fsize(const char *filename); void test(); /************************************************************************* struct superblock Variables same as those in v-6 file-system, From the given requirements, we consider that there is one i node per block **************************************************************************/ struct superblock { unsigned short isize; unsigned short fsize; unsigned short nfree; unsigned int free[100]; unsigned short ninode; unsigned int inode[100]; char flock; char ilock; char fmod; unsigned short time[2]; //constructor superblock() { isize = num_iNodes; fsize = num_Blocks; //First block not potentially available for allocation to a file ninode = num_iNodes; //initial n-free value nfree = 100; //dummy values for the rest of the variables flock = 'j'; ilock = 'b'; fmod = 'n'; time[0] = time[1] = 0; //current_block will be used later int current_block= (num_iNodes + 3) ; //Write free data blocks into free[] list //For example, if num_iNodes is 100, free data blocks start from 103 ( We use one block per iNode) for (int j=0; (current_block < (num_iNodes + 103)) && (current_block < num_Blocks); current_block++,j++) { //Block 0 is unused, block 1 is super-block,block 3 is root directory //rest of the num_iNodes are blocks allocated for iNodes //Hence data blocks start from num_iNodes+ 3 free[99-j] = current_block; //inode[] is not used in this implementation, hence a dummy value is assigned inode[j] = 0; } //i is the first block not written into the free list //Write next 100 free free data block into the 0th block of the free[] array //repeat this till the data blocks are exhausted int first_data_block; int new_nfree; int *new_free_array; while(current_block < num_Blocks) { first_data_block = current_block-1; //lseek to this block and write nfree as first 2 bytes //Get pointer to block 1 if (lseek(fd,first_data_block * block_Size, SEEK_SET) < 0) { cout << "Error getting to first_data_block for assigning new nfree\n"; } //write nfree if((num_Blocks - current_block) > 100) { new_nfree = 100; } else { new_nfree = (num_Blocks - current_block) ; } new_free_array = new int[new_nfree+1]; new_free_array[0] = new_nfree; //use current block and write next 100 blocks (if blocks are available) for(int j=1;j < new_nfree+1 ;j++,current_block++) { new_free_array[(new_nfree+1)-j] = current_block ; } //Write the whole block, because its easier if (write(fd, new_free_array ,block_Size) < block_Size) { cout << "Error writing new block"; } delete[] new_free_array; } } /*************************************************************************************************** get the next free data block to assign to a file or directory, if nfree becomes 0 , read the contents of free[0] and assign first number to nfree and next 100 number to free[] array Note: No check is made to see if all data blocks are exhausted as this is not part of the requirement ****************************************************************************************************/ int get_next_freeblock() { nfree--; if(nfree == 0) //bring in contents from free[0] and fill it up as the new nfree and free array { int block_to_return = free[0]; if (lseek(fd,free[0] * block_Size, SEEK_SET) < 0) { cout << "Error getting to free[0] for reading new nfree\n"; return -1; } //max size will be 101 int *new_free_array = new int[101]; if (read(fd, new_free_array ,block_Size) < 0) { cout << "Error reading new block"; return -1; } nfree=new_free_array[0]; for(int i=0;i<nfree;i++) { free[i] = new_free_array[i+1]; } delete[] new_free_array; return block_to_return; } //Business as usual else { return free[nfree]; } } /*************************************************************************************************** return the last free block allocated, used for reference ****************************************************************************************************/ int last_block_used() { return free[nfree]; } //destructor ~superblock() { delete[] free; delete[] inode; delete[] time; } }; /************************************************************************************** struct inode Variables same as those in v-6 filesystem, but size of file and addr[] size values are updated to increase max size **************************************************************************************/ struct inode { unsigned int flags; char nlinks; char uid; char gid; //Max file size is 12.5GB unsigned long long int size; //Each is a double in-direct block unsigned int addr[25]; unsigned short actime; unsigned short modtime[2]; //constructor inode() { flags = 004777; //initialized to unallocated, plain small file, set uid on execution, permission for all users is 1 nlinks='0'; uid='1'; gid='2'; size=0; modtime[0]=0; modtime[1]=0; actime=1; } }; /************************************************************************************** struct directory Used to write the root directory (along with file and sub-directory entries) and also sub-directories **************************************************************************************/ struct directory { //Entry could be a file or a directory string *entry_Name ; int *inode_list; int inode_iterator; //Initialise root directory with given name , written to block after the inodes are assigned directory() { entry_Name = new string[num_iNodes+1]; inode_iterator = 0; inode_list = new int[num_iNodes]; entry_Name[inode_iterator] = new_File_System; // file system name for every directory, including root inode_list[inode_iterator]=1;// inode of root is 1 inode_iterator++; entry_Name[inode_iterator] = new_File_System; inode_list[inode_iterator]=1; inode_iterator++; } //Initialize sub directory (mkdir) directory(string dir_name) { entry_Name = new string[2]; // one for root, one for self inode_iterator = 0; inode_list = new int[2]; entry_Name[inode_iterator] = dir_name; inode_list[inode_iterator] = next_free_inode; inode_iterator++; entry_Name[inode_iterator] = new_File_System; inode_list[inode_iterator] = 1;//root inode_iterator++; } //Delete the dynamic heap memory to prevent leakage ~directory() { delete[] inode_list; delete[] entry_Name; } //Entry inside a folder ( Only the root folder has entries in this implementation ) void file_entry(string entry) { entry_Name[inode_iterator]= entry; inode_list[inode_iterator] = next_free_inode; inode_iterator++; //return 0; } }; /************************************************************************* function: initfs returns int so as the return -1 on read,write and seek errors initialise the virtual file system Global variables used path: Path of the file that represents the virtual disk num_Blocks: number of blocks allocated in total num_iNodes: number of iNodes ( We store one iNode per block, the remaining part of each block is not used ) **************************************************************************/ int initfs() { int file_System_Size = num_Blocks * 2048; // Size of on block * number of blocks char *disk_Size_dummy = new char[file_System_Size]; //to fill the disk with 0's /*************************************************************************** Initialize the file system (all blocks) with '0's ***************************************************************************/ //Set all blocks to '0' for (int i=0; i < file_System_Size; i++) { disk_Size_dummy[i] = '0'; } //Get pointer to block 0 if (lseek(fd, 0, SEEK_SET) < 0) { cout << "Error getting to block 0 for assigning 0's\n"; return -1; } //Write 0's to the whole file system if (write(fd, disk_Size_dummy, file_System_Size) < file_System_Size) { cout << "Error writing file system"; return -1; } //delete dummy value from heap delete[] disk_Size_dummy; /*************************************************************************** Write super block to block 1 of the file system super block size is 820 bytes (Remaining bytes in the block are unused) ***************************************************************************/ //Create super-block super = new superblock(); //Get pointer to block 1 if (lseek(fd, block_Size, SEEK_SET) < 0) { cout << "Error getting to block 1 for assigning super-block\n"; return -1; } //Write super-block onto the file system if (write(fd, super, sizeof(superblock)) < sizeof(superblock)) { cout << "Error writing super-block\n"; return -1; } /************************************************************************************** Write iNodes to the file system One iNode per block, iNode size is 220 bytes (Remaining bytes in the block are unused) Start from block 2 ( Block 0 is unused and Block 1 superblock ) ***************************************************************************************/ //Create an i-node to write num_inode times inode *temp_iNode = new inode(); for(int i=0; i<num_iNodes; i++) { //Get pointer to block i+2 if(lseek(fd, (i+2)*block_Size, SEEK_SET) < 0) { cout<<"Error getting to block for writing i nodes\n"; return -1; } //Write block i+2 with inode if(write(fd,temp_iNode,sizeof(inode)) < sizeof(inode)) { cout<<"Error writing inode number "<<i<<endl; return -1; } } delete[] temp_iNode; /************************************************************************************** Write the root directory information into the first data block This is used to keep track of the files and directories in the file system ***************************************************************************************/ root_dir = new directory(); //write root directory in the file system //Get pointer to block i+2 if(lseek(fd, (num_iNodes+ 2)*block_Size, SEEK_SET) < 0) { cout<<"Error getting to block for writing root dir\n"; return -1; } //Write block i+2 with inode if(write(fd,root_dir,sizeof(directory)) < sizeof(directory)) { cout<<"Error writing directory \n"; return -1; } /*********************************************************************************************** Create inode for the root directory and write it into block 2 (beginning of inodes) ***********************************************************************************************/ inode *root_inode = new inode(); root_inode->flags = 144777; // i node is allocated and file type is directory //go to the inode if (lseek(fd,2 * block_Size, SEEK_SET) < 0) { cout << "Error getting to block 0 for assigning 0's\n"; //return -1; } //Write root inode if (write(fd, root_inode, sizeof(inode)) < sizeof(inode)) { cout << "Error writing root inode"; //return -1; } delete[] root_inode; } /************************************************************************************** cpin : create a new file called v6-file in the newly created file system and copy the contents of the input file into the new file system. v6-file: input file name ***************************************************************************************/ int cpin ( string v6_file ) { //file descriptors for the external(input) file int inputfd; inputfd = 0; if((inputfd=open(v6_file.c_str(),O_RDWR)) < -1) { cout<<"Error opening input file\n"; return -1; } inode *node = new inode(); unsigned long long int filesize ; filesize = fsize(v6_file.c_str()); node->size = filesize; if(filesize == 0) { cout<<"Error empty file\n"; return -1; } //inode for file next_free_inode++; int num_blocks_needed_for_file=0; //calculate the the data blocks required to store the file num_blocks_needed_for_file = filesize/block_Size; if(filesize%block_Size != 0) num_blocks_needed_for_file++; //extra data lesser than a block size if(filesize <= 51200) //Small file { char* input_file_contents = new char[filesize]; // read the file if (lseek(inputfd, 0 ,SEEK_SET) < 0) { cout << "Error seek input file\n"; return -1; } if (read(inputfd, input_file_contents ,filesize) < filesize) { cout << "Error reading input file\n"; return -1; } node->flags = 104777; //allocated, plain , small file //get contents for the addr[] array for(int i=0;i<num_blocks_needed_for_file;i++) { node->addr[i] = ((superblock*)(super))->get_next_freeblock(); } //write null values to the remaining addr[] for(int i=num_blocks_needed_for_file;i<25;i++) { node->addr[i] = 0;//null } /********************************************************************************** write inode **********************************************************************************/ //first inode starts from block 2. (i.e inode 1(root) is in block 2) if (lseek(fd,(next_free_inode+1) * block_Size, SEEK_SET) < 0) { cout << "Error getting to block "<<next_free_inode<<endl; return -1; } if (write(fd, node, sizeof(inode)) < sizeof(inode)) { cout << "Error writing inode "<<next_free_inode<<endl; return -1; } /********************************************************************************** write data **********************************************************************************/ if (lseek(fd,(node->addr[0]) * block_Size, SEEK_SET) < 0) { cout << "Error getting to addr[0] small file \n"; return -1; } if (write(fd, input_file_contents, filesize) < filesize) { cout << "Error writing file "<<endl; return -1; } delete[] input_file_contents; } else //Large file { node->flags = 114777; //allocated, plain , large file //one addr[] stores 512*512 = 262144 blocks int addr_count_required = num_blocks_needed_for_file/262144 ; if(num_blocks_needed_for_file%262144!=0)addr_count_required++; //file size exceeds maximum if(addr_count_required > 25) { cout<<"File size exceeds maximum\n"; return -1; } /********************************************************************************** write addr array a single address in the addr array can point to 512*512 blocks **********************************************************************************/ //addr[] for(int i=0;i<addr_count_required;i++) { node->addr[i] = ((superblock*)(super))->get_next_freeblock(); } //write null values to the remaining addr[] for(int i=addr_count_required;i<25;i++) { node->addr[i] = 0;//null } /********************************************************************************** write inode **********************************************************************************/ //first inode starts from block 2. (i.e inode 1(root) is in block 2) if (lseek(fd,(next_free_inode+1) * block_Size, SEEK_SET) < 0) { cout << "Error getting to block "<<next_free_inode<<endl; return -1; } if (write(fd, node, sizeof(inode)) < sizeof(inode)) { cout << "Error writing inode "<<next_free_inode<<endl; return -1; } /********************************************************************************** write pointers - Level 1 A Single address in a level can point to 512 blocks **********************************************************************************/ int *blocks_to_assign ; //assume blocks till addr_count_required would be full (there is some data wastage) //Level 1 int num_blocks_allocated = 0; // Keep track of num blocks allocated Vs num of blocks in file blocks_to_assign = new int [512]; for(int i=0;i<addr_count_required;i++) { //write 512 addresses into the first indirect block int j=0; for(;(j<512) && (num_blocks_allocated<=num_blocks_needed_for_file);j++) { blocks_to_assign[j] =((superblock*)(super))->get_next_freeblock(); num_blocks_allocated = num_blocks_allocated + 512; } //add zeros if less than 512 for(;j<512;j++) { blocks_to_assign[j] = 0; } //go to addr[i] if (lseek(fd, node->addr[i] * block_Size, SEEK_SET) < 0) { cout << "Error getting to addr "<<endl; return -1; } //write these free blocks into addr[i] if (write(fd, blocks_to_assign, block_Size) < block_Size) { cout << "Error writing pointers "<<endl; return -1; } } delete[] blocks_to_assign; /********************************************************************************** write pointers - Level 2 A Single address in a level can point to 1 block **********************************************************************************/ //The starting address is the block next to addr[addr_count_required] as data is sequential int start = ((node->addr[addr_count_required-1])+1); int stop = ((superblock*)(super))->last_block_used(); num_blocks_allocated = 0;//reset blocks_to_assign = new int [512]; for(int i=start ; i<= stop ; i++) { //write 512 addresses into the first indirect block int j=0; for(;(j<512) && (num_blocks_allocated<=num_blocks_needed_for_file);j++) { blocks_to_assign[j] =((superblock*)(super))->get_next_freeblock(); num_blocks_allocated++ ; } //add zeros if less than 512 for(;j<512;j++) { blocks_to_assign[j] = 0; } //go to addr[i] if (lseek(fd, i * block_Size, SEEK_SET) < 0) { cout << "Error getting to addr "<<endl; return -1; } //write these free blocks into addr[i] if (write(fd, blocks_to_assign, block_Size) < block_Size) { cout << "Error writing pointers "<<endl; return -1; } } delete[] blocks_to_assign; /********************************************************************************** read input data **********************************************************************************/ char* input_file_contents = new char[filesize]; // read the file if (lseek(inputfd, 0, SEEK_SET) < 0) { cout << "Error getting to addr "<<endl; return -1; } if (read(inputfd, input_file_contents ,filesize) < filesize) { cout << "Error reading input file\n"; return -1; } /********************************************************************************** write data **********************************************************************************/ int write_data_from = stop +1; //The starting address is the block next to stop as data is sequential //go to addr[i] if (lseek(fd, write_data_from * block_Size, SEEK_SET) < 0) { cout << "Error getting to addr "<<endl; return -1; } //write data if (write(fd, input_file_contents, filesize) < filesize) { cout << "Error writing data "<<endl; return -1; } delete[] input_file_contents; } //Entry into the root directory ((directory*) root_dir)->file_entry(v6_file.c_str()); delete[] node; } /****************************************************************************************************** This function is used to find the file size of the given input file for the cpin function This function is from the stack overflow website http://stackoverflow.com/questions/8236/how-do-you-determine-the-size-of-a-file-in-c filename: input file name off_t : returns the size of the file *******************************************************************************************************/ off_t fsize(const char *filename) { struct stat st; if (stat(filename, &st) == 0) return st.st_size; return -1; } /************************************************************************************** cpout : create external file if v6 file exists ***************************************************************************************/ void cpout(string v6_file, string externalfile) { //Check if v6 file exists int ilist_match=0; for(;ilist_match<=((directory*)root_dir)->inode_iterator;ilist_match++) { if(((directory*)root_dir)->entry_Name[ilist_match] == v6_file) break; } if(ilist_match>=((directory*)root_dir)->inode_iterator) { cout<<"File doesn't exist\n"; return; } //get inode for the v6 file int v6_inode = ((directory*)root_dir)->inode_list[ilist_match]; inode *node = new inode(); //inode x is in block x+1 if (lseek(fd, (v6_inode+1) * block_Size ,SEEK_SET) < 0) { cout << "Error getting to addr "<<endl; } if (read(fd, node ,sizeof(inode)) < sizeof(inode)) { cout << "Error reading v6 inode\n"; } //get file size and starting address, file is contiguous unsigned long long int file_size = node->size; int starting_addr; if(file_size <= 51200) { starting_addr = node->addr[0]; } else { //get addr[0] block int *block0 = new int[512]; if (lseek(fd, node->addr[0] * block_Size,SEEK_SET) < 0) { cout << "Error getting to starting_addr "<<endl; } if (read(fd, block0 ,block_Size) < block_Size) { cout << "Error reading input file block0\n"; } //get first element of block0 int *block1 = new int[512]; if (lseek(fd, block0[0] * block_Size,SEEK_SET) < 0) { cout << "Error getting to starting_addr "<<endl; } if (read(fd, block1 ,block_Size) < block_Size) { cout << "Error reading input file block1\n"; } starting_addr = block1[0]; delete[] block0; delete[] block1; } char* v6_file_contents = new char[file_size]; //read file if (lseek(fd, starting_addr * block_Size,SEEK_SET) < 0) { cout << "Error getting to starting_addr "<<endl; } if (read(fd, v6_file_contents ,file_size) < file_size) { cout << "Error reading input file\n"; } //write output ofstream file_to_return;; file_to_return.open(externalfile.c_str()); int external_fd; if((external_fd=open(externalfile.c_str(),O_RDWR)) < -1) { cout<<"Error opening file descriptor for next free inode\n"; } if (lseek(external_fd, 0,SEEK_SET) < 0) { cout << "Error getting to external "<<endl; } if (write(external_fd, v6_file_contents ,file_size) < file_size) { cout << "Error writing input file\n"; } file_to_return.close(); delete[] v6_file_contents; } /************************************************************************************** mkdir: create a new directory by the name dirname and store its contents in root dir ilist and also create an inode ***************************************************************************************/ void mkdir(string dirname) { //Check if dir exists for(int ilist_match=0;ilist_match<=((directory*)root_dir)->inode_iterator;ilist_match++) { if(((directory*)root_dir)->entry_Name[ilist_match] == dirname) { cout<<"Directory already exists\n"; return; } } //entry in root's ilist ((directory*)root_dir)->file_entry(dirname.c_str()); //inode for dir next_free_inode++; //create inode inode *dir_inode = new inode(); dir_inode->flags = 144777; // allocated, directory, user ID, all access //get block for storing addr int block = ((superblock*)(super))->get_next_freeblock(); dir_inode->addr[0] = block; //write inode in file system if (lseek(fd, (next_free_inode+1) * block_Size ,SEEK_SET) < 0) { cout << "Error getting to inode "<<endl; } if (write(fd, dir_inode ,sizeof(inode)) < sizeof(inode)) { cout << "Error writing input file\n"; } //create the sub directory directory* sub_dir = new directory(dirname.c_str()); //write the directory into the file system if (lseek(fd, block * block_Size ,SEEK_SET) < 0) { cout << "Error getting to dir "<<endl; } if (write(fd, sub_dir ,sizeof(directory)) < sizeof(directory)) { cout << "Error writing input file\n"; } delete[] dir_inode; } /************************************************************************************** quit: save all system data and close ***************************************************************************************/ void quit() { //need to save superblock and root directory //write superblock in file system if (lseek(fd, block_Size ,SEEK_SET) < 0) { cout << "Error getting to inode "<<endl; } if (write(fd, (superblock*)super ,sizeof(superblock)) < sizeof(superblock)) { cout << "Error writing superblock file\n"; } //write root dir in first block after inodes (this space was initially reserved) if (lseek(fd,(num_iNodes +1 ) * block_Size ,SEEK_SET) < 0) { cout << "Error getting to inode "<<endl; } if (write(fd, (directory*)root_dir ,sizeof(directory)) < sizeof(directory)) { cout << "Error writing directory file\n"; } } int main() { //temp assignment (get from user) new_File_System = "testing"; num_iNodes = 300; num_Blocks = 10000; ofstream outputFile; outputFile.open(new_File_System.c_str()); if((fd=open(new_File_System.c_str(),O_RDWR)) < -1) { cout<<"Error opening file descriptor for next free inode\n"; return -1; } if(initfs() == -1) { cout<<"Error initializing file system\n"; return -1; } cpin("test.docx"); cpout("test.docx","extern.txt"); mkdir("folder"); outputFile.close(); //temp (add to q) delete[] root_dir; delete[] super; return (0); }
79af32316aed94055636f7f7ff18bf2427e571c0
070220e82b5d89e18b93d6ef34d702d2119575ed
/lc7hashcat/include/CLC7JTRGPUInfo.h
2cc8e807e4db22c8c31f933c48a33dfb60d34a72
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
Brute-f0rce/l0phtcrack
2eb4e51f36fd28c9119269881d5e66e6a6dac533
25f681c07828e5e68e0dd788d84cc13c154aed3d
refs/heads/main
2023-08-19T16:41:06.137715
2021-10-17T01:06:21
2021-10-17T01:06:21
418,568,833
2
0
null
null
null
null
UTF-8
C++
false
false
1,949
h
CLC7JTRGPUInfo.h
#ifndef __INC_CLC7JTRGPUINFO #define __INC_CLC7JTRGPUINFO #include<QVector> enum GPUPLATFORM { GPU_NONE=0, GPU_OPENCL=1, //GPU_CUDA=2 }; struct GPUINFO { GPUINFO() { platform = GPU_NONE; jtrindex = 0xFFFFFFFF; maxclock = 0; streamprocessors = 0; } GPUPLATFORM platform; quint32 jtrindex; QString name; QString vendor; QString type; QString deviceversion; QString driverversion; quint32 maxclock; quint32 streamprocessors; inline bool operator==(const GPUINFO &other) const { return (platform == other.platform) && (jtrindex == other.jtrindex) && (name == other.name) && (vendor == other.vendor) && (type == other.type) && (deviceversion == other.deviceversion) && (driverversion == other.driverversion) && (maxclock == other.maxclock) && (streamprocessors == other.streamprocessors); } }; inline QDataStream &operator<<(QDataStream &out, const GPUINFO &gpuinfo) { out << (quint32 &)gpuinfo.platform; out << gpuinfo.jtrindex; out << gpuinfo.name; out << gpuinfo.vendor; out << gpuinfo.type; out << gpuinfo.deviceversion; out << gpuinfo.driverversion; out << gpuinfo.maxclock; out << gpuinfo.streamprocessors; return out; } inline QDataStream &operator>>(QDataStream &in, GPUINFO &gpuinfo) { in >> (quint32 &)gpuinfo.platform; in >> gpuinfo.jtrindex; in >> gpuinfo.name; in >> gpuinfo.vendor; in >> gpuinfo.type; in >> gpuinfo.deviceversion; in >> gpuinfo.driverversion; in >> gpuinfo.maxclock; in >> gpuinfo.streamprocessors; return in; } class CLC7GPUInfo { private: QVector<GPUINFO> m_gpuinfo; bool IsSupportedGPU(const GPUINFO & gi); bool ExecuteJTR(QStringList args, QString & out, QString &err, int &retval); void DetectOPENCL(void); //void DetectCUDA(void); public: CLC7GPUInfo(); void Detect(void); QVector<GPUINFO> GetGPUInfo() const; }; #endif
2f3872842ef1652b0117763a28b3ad9baebecd06
ac2516485d1c1e16a86a30eeee9adc138dfde4bf
/examinationroom/src/ui/parameter/parameterdialog.cpp
bbb3124d26e85bab4a6ff201b5e813c7bab3c975
[]
no_license
cbreak-black/ExaminationRoom
ebee8da293fb2c659366a030cc4ee14553d5ada7
a3d47201d003257b1a986e8fdec01be5c31cc5e5
refs/heads/master
2021-01-19T19:37:47.197485
2011-10-14T12:36:00
2011-10-14T12:36:00
576,101
0
0
null
null
null
null
UTF-8
C++
false
false
927
cpp
parameterdialog.cpp
/* * parameterdialog.cpp * ExaminationRoom * * Created by cbreak on 04.05.08. * Copyright 2008 __MyCompanyName__. All rights reserved. * */ #include "parameterdialog.h" #include <QVBoxLayout> #include <QFileDialog> namespace Examination { Parameterdialog::Parameterdialog(QWidget * parent) : QWidget(parent) { layout_ = new QVBoxLayout(); setLayout(layout_); } Parameterdialog::~Parameterdialog() { delete layout_; } QSize Parameterdialog::sizeHint () const { return QSize(256, 256); } void Parameterdialog::addWidget(QWidget * w) { layout_->addWidget(w); } std::string Parameterdialog::openFileRelative(const char * caption, const char * filter) { QString fileName = QFileDialog::getOpenFileName(this, caption, QString(), filter); if (!fileName.isNull()) { QDir dir(QDir::currentPath()); return dir.relativeFilePath(fileName).toStdString(); } else { return std::string(); // empty } } }
bdbeed596582f383198fabb273735dfcafd07a0a
360e04537b3a0215fad4bfc2e521d20877c9fa60
/Tree/树状数组/Mobile phones.cpp
fc18a5e4d59b1df03a16a1728e0ebbdec75e0074
[]
no_license
Randool/Algorithm
95a95b3b75b1ff2dc1edfa06bb7f4c286ee3d514
a6c4fc3551efedebe3bfe5955c4744d7ff5ec032
refs/heads/master
2020-03-16T19:40:49.033078
2019-07-08T15:05:50
2019-07-08T15:05:50
132,927,189
0
0
null
null
null
null
UTF-8
C++
false
false
1,471
cpp
Mobile phones.cpp
#include <cstdio> #include <cstring> #include <iomanip> #include <iostream> using namespace std; #define MAXN 1030 #define lowbit(x) x&(-x) int in, s; int map[MAXN][MAXN]; void update(int x, int y, int t) { while (x < MAXN) { int yy = y; while (yy < MAXN) { map[x][yy] += t; yy += lowbit(yy); } x += lowbit(x); } } int getSum(int x, int y) { int s = 0; while (x) { int yy = y; while (yy) { s += map[x][yy]; yy -= lowbit(yy); } x -= lowbit(x); } return s; } void Show(int N) { for (int i=0; i<=N; ++i) { for (int j=0; j<=N; ++j) printf("%d ", map[i][j]); printf("\n"); } printf("\n"); } int main() { //freopen("in.txt", "r", stdin); while (scanf("%d", &in)) { if (in == 1) { int x, y, a; scanf("%d%d%d", &x, &y, &a); ++x, ++y; update(x, y, a); // Show(s); } else if (in == 2) { int l, b, r, t; scanf("%d%d%d%d", &l, &b, &r, &t); ++l, ++b, ++r, ++t; int ans = getSum(r,t)-getSum(l-1,t)-getSum(r,b-1)+getSum(l-1,b-1); printf("%d\n", ans); } else if (in == 0) { scanf("%d", &s); memset(map, 0, sizeof(map)); } else if (in == 3) break; } return 0; }
268347e2dde1a46cc3171f8d6b441ea6b1433b7b
32377c243d785d555ce63575c528eb2c8bd52381
/orchestrierungMinimalBeispiel/serviceTemplate.h
1a412dfa12c8923ce1d3b39f081c45307c25a002
[]
no_license
twolff-afk/workflow-engine
8383932bc8a6ce252da95844dbd995e7e1a16277
75223d68b767696852cb947f75b50882c25ad3f0
refs/heads/master
2023-04-18T17:47:11.788362
2021-05-05T09:45:42
2021-05-05T09:45:42
null
0
0
null
null
null
null
UTF-8
C++
false
false
793
h
serviceTemplate.h
#ifndef SERVICE_H #define SERVICE_H #include <string> #include <map> using namespace std; class serviceTemplate { private: string documentation; string url; string portType; string inputMessage; std::map<int, std::string> inputArguments; std::map<int, std::string> outputArguments; public: serviceTemplate(); void createServiceAsXml(string filename); void setDocumentation(string Documentation); string getDocumentation(); void setUrl(string Url); string getUrl(); void setPortType(string PortType); string getPortType(); void setInputMessage(string InputMessage); string getInputMessage(); void createInputArgument(int index, std::string name, std::string datatype); void createOutputArgument(int index, std::string name, std::string datatype); }; #endif
16bc86898a3938f80043a10d0d18dc026705b5c4
e75cc18f64db23b9c1d304c39fb74ed083d9feee
/assignment-5/Tetromino.h
d9c97f184fdbfb55dba404e2ae4149aa63feeeb5
[]
no_license
ChrisProgramming2018/cpp-course
0b790e29ca239639dac70fa163d8af186ba7f7c7
398c0da3e49e67440ab663bb61d45eaf2dd56d2a
refs/heads/master
2020-04-06T12:20:27.792277
2018-12-22T14:42:30
2018-12-22T14:42:30
157,451,729
0
0
null
null
null
null
UTF-8
C++
false
false
1,351
h
Tetromino.h
// Copyright 2018 // Computer Science // Author: Christian Leininger Christianleininger@gmx.de #ifndef ASSIGNMENT_5_TETROMINO_H_ #define ASSIGNMENT_5_TETROMINO_H_ #include <gtest/gtest.h> // Class for a single Tetromino. class Tetromino { public: // Reset Tetromino to given kind in starting position at the top. void reset(int kindOfTetromino); // Move Tetromino according to last key. If reverse == true, do the opposite. void move(int key, bool reverse); // FRIEND_TEST(TetrisTest, move); // Rotate Tetromino by n times 90 degrees clockwise. void rotate(int n); // FRIEND_TEST(TetrisTest, rotate); // Show Tetromino at current position. If showOrDelete == true, draw in // inverse video, otherwise draw spaces to delete it. If bottomReached, draw // in red. void show(bool showOrDelete, bool bottomReached); private: friend class Structure; // Stretch of a pixel; static const int _sx = 5; static const int _sy = 3; // Absolute position of the Tetromino. int _tx; int _ty; // Relative positions of the four parts of the Tetromino. int _txr[4]; int _tyr[4]; FRIEND_TEST(TetrisTest, move); FRIEND_TEST(TetrisTest, rotate); FRIEND_TEST(TetrisTest, reset); FRIEND_TEST(StructureTest, addTetromino); FRIEND_TEST(StructureTest, checkCollision); }; #endif // ASSIGNMENT_5_TETROMINO_H_
e493a013cc038edc89eb04e333d9ebe06bbece1c
5f2b8865e3e8d18551b8daaa2618d146a82e1181
/第11章/第11章 11.9/main1.cpp
be885f1ccdf259a3b73bb47f697ea30f6b620b92
[]
no_license
licunz/li_cunzhi
628730843c15e1743dca4859d787e50be79521f1
2348976cba77eefa662e91c51c74e4bafc08633b
refs/heads/master
2020-04-02T09:42:59.868934
2019-04-29T05:07:13
2019-04-29T05:07:13
154,306,301
0
0
null
null
null
null
UTF-8
C++
false
false
416
cpp
main1.cpp
#include<iostream> #include"TwoDaypackage.h" #include"Opackage.h" using namespace std; #include<string> int main() { TwoDaypackage a("li","chun","zhi","jining","lovy",10,100,5,50); cout<<"111"<<a.getjname()<<endl; cout<<"222"<<a.getsname()<<endl; cout<<"333"<<a.calculatecost()<<endl; Opackage b("li","chun","zhi","jining","lovy",10,100,5,50); cout<<"444"<<b.calculatecost()<<endl; }
7c0c148b414d9537b8cbbf09e24aaef623f8b3b5
c68f791005359cfec81af712aae0276c70b512b0
/December Cook-Off 2017/ROTPTS.cpp
20d29f05c5ce8dbba6b8d25843c42067d1e8dde8
[]
no_license
luqmanarifin/cp
83b3435ba2fdd7e4a9db33ab47c409adb088eb90
08c2d6b6dd8c4eb80278ec34dc64fd4db5878f9f
refs/heads/master
2022-10-16T14:30:09.683632
2022-10-08T20:35:42
2022-10-08T20:35:42
51,346,488
106
46
null
2017-04-16T11:06:18
2016-02-09T04:26:58
C++
UTF-8
C++
false
false
3,753
cpp
ROTPTS.cpp
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; #define matrix vector<vector<long long>> inline void norm(long long& at) { if (at >= mod) at -= mod; if (at < 0) at += mod; } inline matrix add(matrix& a, matrix& b) { matrix ret(a.size(), vector<long long>(a[0].size(), 0)); for (int i = 0; i < a.size(); i++) { for (int j = 0; j < a[0].size(); j++) { ret[i][j] = a[i][j] + b[i][j]; norm(ret[i][j]); } } return ret; } inline matrix multiply(matrix& a, matrix& b) { matrix ret(a.size(), vector<long long>(b[0].size(), 0)); for (int k = 0; k < a[0].size(); k++) { for (int i = 0; i < a.size(); i++) { for (int j = 0; j < b[0].size(); j++) { ret[i][j] += a[i][k] * b[k][j]; ret[i][j] %= mod; } } } return ret; } inline matrix negasikeun(matrix& a) { matrix ret(a.size(), vector<long long>(a[0].size(), 0)); for (int i = 0; i < a.size(); i++) { for (int j = 0; j < a[0].size(); j++) { ret[i][j] = mod - a[i][j]; norm(ret[i][j]); } } return ret; } struct item { item() { a = {{1, 0}, {0, 1}}; b = {{0}, {0}}; } item(matrix a, matrix b) : a(a), b(b) {} matrix a, b; }; inline item combine(item& a, item& b) { matrix retA = multiply(b.a, a.a); matrix temp = multiply(b.a, a.b); matrix retB = add(temp, b.b); return item(retA, retB); } matrix rot[] = { {{1, 0}, {0, 1}}, {{0, -1}, {1, 0}}, {{-1, 0}, {0, -1}}, {{0, 1}, {-1, 0}} }; int id[360]; struct segtree { segtree(vector<item> ori) : ori(ori) { a.resize(ori.size() << 2); build(1, 0, ori.size() - 1); } void build(int p, int l, int r) { if (l == r) { a[p] = ori[l]; return; } int mid = (l + r) >> 1; build(p + p, l, mid); build(p + p + 1, mid + 1, r); a[p] = combine(a[p + p], a[p + p + 1]); } void update(int at, item& val) { update(1, 0, ori.size() - 1, at, val); } inline void update(int p, int l, int r, int at, item& val) { if (l == r) { a[p] = val; return; } int mid = (l + r) >> 1; if (at <= mid) { update(p + p, l, mid, at, val); } else { update(p + p + 1, mid + 1, r, at, val); } a[p] = combine(a[p + p], a[p + p + 1]); } item find(int l, int r) { return find(1, 0, ori.size() - 1, l, r); } inline item find(int p, int l, int r, int ll, int rr) { if (ll <= l && r <= rr) return a[p]; int mid = (l + r) >> 1; item ret; if (ll <= mid) { item lef = find(p + p, l, mid, ll, rr); ret = combine(ret, lef); } if (mid < rr) { item rig = find(p + p + 1, mid + 1, r, ll, rr); ret = combine(ret, rig); } return ret; } vector<item> ori, a; }; inline item build(int x, int y, int b) { b = id[b]; matrix A = {{x}, {y}}; matrix B = rot[b]; matrix retA = B; matrix temp = multiply(B, A); temp = negasikeun(temp); matrix retB = add(temp, A); return item(retA, retB); } inline matrix apply(int x, int y, item o) { matrix X = {{x}, {y}}; matrix temp = multiply(o.a, X); return add(temp, o.b); } int main() { id[90] = 1; id[180] = 2; id[270] = 3; int n; scanf("%d", &n); vector<item> a; for (int i = 0; i < n; i++) { int x, y, d; scanf("%d %d %d", &x, &y, &d); a.push_back(build(x, y, d)); } segtree seg(a); int q; scanf("%d", &q); while (q--) { int t, x, y, l, r; scanf("%d %d %d %d %d", &t, &x, &y, &l, &r); if (t == 1) { l--; r--; item ret = seg.find(l, r); matrix ans = apply(x, y, ret); printf("%lld %lld\n", ans[0][0], ans[1][0]); } else { x--; item be = build(y, l, r); seg.update(x, be); } } return 0; }
342feea9d0171bf0234f26db6ec4e894b6623931
f05ad7795ddf4b4a9675829301541d35ebb985a7
/Framework/Include/World/cgWorldObject.h
85ae43b375c903e640fd27ec4e8fab2566c38390
[]
no_license
blockspacer/CarbonSDKAlpha
4d89904b822691fef2ea457bdacb8fcdb79a860d
a90d30cd970be25e73102eb6ef5f709f7753dce2
refs/heads/master
2021-05-21T09:46:23.810708
2014-07-26T21:16:34
2014-07-26T21:16:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
11,285
h
cgWorldObject.h
//---------------------------------------------------------------------------// // ____ _ _ // // / ___|__ _ _ __| |__ ___ _ __ __ _/ | __ __ // // | | / _` | '__| '_ \ / _ \| '_ \ \ \ / / | \ \/ / // // | |__| (_| | | | |_) | (_) | | | | \ V /| |_ > < // // \____\__,_|_| |_.__/ \___/|_| |_| \_/ |_(_)_/\_\ // // Game Institute - Carbon Game Development Toolkit // // // //---------------------------------------------------------------------------// // // // Name : cgWorldObject.h // // // // Desc : Base class for all objects that make up a scene. Objects are // // basically the foundation of all scene components such as meshes, // // cameras, light sources, etc. Objects don't specifically maintain // // scene information such as transformation matrices since they // // technically belong to the world and can exist in multiple scenes. // // Objects can however be referenced by object node types to provide // // their final connection to the scene(s) as required (i.e. // // cgObjectNode and its derived types to give them position, // // orientation, etc.) // // // //---------------------------------------------------------------------------// // Copyright (c) 1997 - 2013 Game Institute. All Rights Reserved. // //---------------------------------------------------------------------------// #pragma once #if !defined( _CGE_CGWORLDOBJECT_H_ ) #define _CGE_CGWORLDOBJECT_H_ //----------------------------------------------------------------------------- // cgWorldObject Header Includes //----------------------------------------------------------------------------- #include <cgBase.h> #include <World/cgWorldComponent.h> #include <World/cgWorldTypes.h> #include <Resources/cgResourceHandles.h> #include <Math/cgBoundingBox.h> #include <Physics/cgPhysicsTypes.h> //----------------------------------------------------------------------------- // Forward Declarations //----------------------------------------------------------------------------- class cgWorld; class cgScene; class cgCameraNode; class cgObjectNode; class cgVisibilitySet; class cgObjectSubElement; //----------------------------------------------------------------------------- // Globally Unique Type Id(s) //----------------------------------------------------------------------------- // {FCC02596-AD72-4EDD-A7ED-32330F759CD1} const cgUID RTID_WorldObject = {0xFCC02596, 0xAD72, 0x4EDD, {0xA7, 0xED, 0x32, 0x33, 0xF, 0x75, 0x9C, 0xD1}}; //----------------------------------------------------------------------------- // Main Class Declarations //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // Name : cgWorldObject (Class) /// <summary> /// Base class for the objects that exist in the world. /// </summary> //----------------------------------------------------------------------------- class CGE_API cgWorldObject : public cgWorldComponent { DECLARE_DERIVED_SCRIPTOBJECT( cgWorldObject, cgWorldComponent, "WorldObject" ) public: //------------------------------------------------------------------------- // Constructors & Destructors //------------------------------------------------------------------------- cgWorldObject( cgUInt32 referenceId, cgWorld * world ); cgWorldObject( cgUInt32 referenceId, cgWorld * world, cgWorldObject * init, cgCloneMethod::Base initMethod ); virtual ~cgWorldObject( ); //------------------------------------------------------------------------- // Public Static Functions //------------------------------------------------------------------------- static const cgWorldObjectTypeDesc::Map & getRegisteredTypes ( ); static void registerType ( const cgUID & globalIdentifier, const cgString & name, cgWorldObjectTypeDesc::ObjectAllocNewFunc objectAllocNew, cgWorldObjectTypeDesc::ObjectAllocCloneFunc objectAllocClone, cgWorldObjectTypeDesc::NodeAllocNewFunc nodeAllocNew, cgWorldObjectTypeDesc::NodeAllocCloneFunc nodeAllocClone ); //------------------------------------------------------------------------- // Public Methods //------------------------------------------------------------------------- bool clone ( cgCloneMethod::Base method, cgWorld * world, bool internalObject, cgWorldObject *& objectOut ); void setBaseMass ( cgFloat mass ); void setMassTransformAmount ( cgFloat amount ); cgFloat getBaseMass ( ) const; cgFloat getMassTransformAmount ( ) const; cgObjectSubElement * createSubElement ( const cgUID & category, const cgUID & identifier ); //------------------------------------------------------------------------- // Public Virtual Methods //------------------------------------------------------------------------- // Properties virtual bool isRenderable ( ) const; virtual bool isShadowCaster ( ) const; virtual cgBoundingBox getLocalBoundingBox ( ); // Sub-elements virtual bool getSubElementCategories ( cgObjectSubElementCategory::Map & categories ) const; virtual bool supportsSubElement ( const cgUID & Category, const cgUID & Identifier ) const; virtual cgObjectSubElement * createSubElement ( bool internalElement, const cgUID & category, const cgUID & identifier ); virtual cgObjectSubElement * cloneSubElement ( cgObjectSubElement * element ); virtual const cgObjectSubElementArray & getSubElements ( const cgUID & category ) const; virtual void deleteSubElement ( cgObjectSubElement * element ); virtual void deleteSubElements ( const cgObjectSubElementArray & elements ); // Rendering virtual void sandboxRender ( cgUInt32 flags, cgCameraNode * camera, cgVisibilitySet * visibilityData, const cgPlane & gridPlane, cgObjectNode * issuer ); virtual bool render ( cgCameraNode * camera, cgVisibilitySet * visibilityData, cgObjectNode * issuer ); virtual bool renderSubset ( cgCameraNode * camera, cgVisibilitySet * visibilityData, cgObjectNode * issuer, const cgMaterialHandle & material ); // Data operations virtual void applyObjectRescale ( cgFloat scale ); // Sandbox Integration virtual bool pick ( cgCameraNode * camera, cgObjectNode * issuer, const cgSize & viewportSize, const cgVector3 & rayOrigin, const cgVector3 & rayDirection, cgUInt32 flags, cgFloat wireTolerance, cgFloat & distanceOut ); //------------------------------------------------------------------------- // Public Virtual Methods (Overrides cgWorldComponent) //------------------------------------------------------------------------- virtual bool onComponentCreated ( cgComponentCreatedEventArgs * e ); virtual bool onComponentLoading ( cgComponentLoadingEventArgs * e ); virtual void onComponentDeleted ( ); virtual bool createTypeTables ( const cgUID & typeIdentifier ); //------------------------------------------------------------------------- // Public Virtual Methods (Overrides cgReference) //------------------------------------------------------------------------- virtual const cgUID & getReferenceType ( ) const { return RTID_WorldObject; } virtual bool queryReferenceType ( const cgUID & type ) const; //------------------------------------------------------------------------- // Public Virtual Methods (Overrides DisposableScriptObject) //------------------------------------------------------------------------- virtual void dispose ( bool disposeBase ); protected: //------------------------------------------------------------------------- // Protected Typedefs //------------------------------------------------------------------------- CGE_UNORDEREDMAP_DECLARE( cgUID, cgObjectSubElementArray, ElementCategoryMap ) //------------------------------------------------------------------------- // Protected Methods //------------------------------------------------------------------------- void prepareQueries ( ); bool insertComponentData ( ); //------------------------------------------------------------------------- // Protected Variables //------------------------------------------------------------------------- ElementCategoryMap mSubElementCategories; // Array containing all object sub-elements exposed to the system. cgFloat mMass; // Mass of this object as it is represented in the physics world. cgFloat mMassTransformAmount; // Scalar that describes how much the 'scale' component of the node's transform can affect the mass. //------------------------------------------------------------------------- // Protected Static Variables //------------------------------------------------------------------------- // Cached database queries. static cgWorldQuery mInsertBaseObject; static cgWorldQuery mInsertSubElement; static cgWorldQuery mDeleteSubElement; static cgWorldQuery mUpdateMassProperties; static cgWorldQuery mLoadBaseObject; static cgWorldQuery mLoadSubElements; // Registered object types static cgWorldObjectTypeDesc::Map mRegisteredObjectTypes; // All of the object types registered with the system }; #endif // !_CGE_CGWORLDOBJECT_H_
3e9eac91a94954359e8001363c5ef96a1619ced7
996e3a87e3cb335718ffb1be9b56ee241b067d0f
/include/texture.hpp
5b54f6ed21625331602fa9106cb73209664185a9
[]
no_license
claudiojrt/sdl_tutorial
c125d730467758f0ee9e7ee6c7af24a871aeef0a
2bddc0712399bacf234d49a8bc9784bf972b6444
refs/heads/master
2020-04-15T05:56:57.542438
2019-01-09T00:14:12
2019-01-09T00:14:12
164,442,876
0
0
null
null
null
null
UTF-8
C++
false
false
986
hpp
texture.hpp
#pragma once #include <SDL.h> #include <SDL_image.h> #include <timer.hpp> #include <iostream> #include <string> #include <vector> class Texture { public: //Initializes variables Texture(); //Deallocates memory ~Texture(); //Loads image at specified path bool loadFromFile(SDL_Renderer* renderer, std::string path); //Deallocates texture void free(); //Renders texture at given point void render(int x, int y, SDL_Rect clip, SDL_Rect camera, double scale); //Set color modulation void setColor(Uint8 red, Uint8 green, Uint8 blue); //Get size int getWidth(); int getHeight(); //Setters void setRotationAngle(double angle); void setCenter(SDL_Point* center); void setFlipMode(SDL_RendererFlip mode); private: //Renderer SDL_Renderer* mRenderer; //The actual hardware texture SDL_Texture* mTexture; //Image dimensions int mWidth; int mHeight; double mAngle; SDL_Point* mCenter; SDL_RendererFlip mFlipMode; };